mtxuilib 0.1.589 → 0.1.591
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/common/DebugFormState.d.ts +2 -2
- package/dist/common/DebugFormState.js +2 -1
- package/dist/common/DeleteComfirm.js +5 -5
- package/dist/common/MtErrorBoundary.js +3 -9
- package/dist/common/index.d.ts +3 -0
- package/dist/common/index.js +3 -0
- package/dist/common/pip/PipExamplePage.js +1 -1
- package/dist/common/table/data-table-pagination.js +2 -2
- package/dist/common/table/data-table-view-options.js +2 -2
- package/dist/common/table/datatable-view-options.d.ts +1 -1
- package/dist/common/table/datatable-view-options.js +1 -1
- package/dist/components/ShowError.js +2 -2
- package/dist/data-table/data-table-column-header.d.ts +7 -0
- package/dist/data-table/data-table-column-header.js +12 -0
- package/dist/data-table/data-table-faceted-filter.d.ts +16 -0
- package/dist/data-table/data-table-faceted-filter.js +66 -0
- package/dist/data-table/data-table-pagination.d.ts +7 -0
- package/dist/data-table/data-table-pagination.js +14 -0
- package/dist/data-table/data-table-row-actions.d.ts +11 -0
- package/dist/data-table/data-table-row-actions.js +10 -0
- package/dist/data-table/data-table-toolbar.d.ts +31 -0
- package/dist/data-table/data-table-toolbar.js +18 -0
- package/dist/data-table/data-table-view-options.d.ts +6 -0
- package/dist/data-table/data-table-view-options.js +13 -0
- package/dist/data-table/data-table.d.ts +47 -0
- package/dist/data-table/data-table.js +68 -0
- package/dist/form/EditFormToolbar.js +5 -5
- package/dist/form/deleteConform.js +7 -9
- package/dist/hooks/use-can-back.d.ts +1 -1
- package/dist/hooks/use-can-back.js +1 -1
- package/dist/hooks/use-router.d.ts +1 -0
- package/dist/hooks/use-router.js +5 -0
- package/dist/hooks/use-scroll-to-bottom.d.ts +5 -0
- package/dist/hooks/use-scroll-to-bottom.js +22 -0
- package/dist/icons/LoaderI3con.d.ts +3 -0
- package/dist/icons/LoaderI3con.js +4 -0
- package/dist/icons/icons.d.ts +2 -0
- package/dist/icons/icons.js +3 -0
- package/dist/icons/index.d.ts +1 -4
- package/dist/icons/index.js +1 -4
- package/dist/layouts/web/WebLayoutHeader.js +1 -1
- package/dist/lib/htmlparse/components/ItemActionButton.js +2 -2
- package/dist/lib/htmlparse/htmlParse.js +1 -1
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/index.js +1 -0
- package/dist/lib/service-worker/ServiceWorkerMain.js +1 -1
- package/dist/lib/utils.d.ts +8 -0
- package/dist/lib/utils.js +94 -0
- package/dist/motion/mtmotion-variants.js +1 -1
- package/dist/{ui/mt → mt}/Button.d.ts +1 -1
- package/dist/{ui/mt → mt}/Button.js +1 -1
- package/dist/{ui/mt → mt}/DropdownMenuItemLink.d.ts +1 -1
- package/dist/{ui/mt → mt}/DropdownMenuItemLink.js +1 -1
- package/dist/mt/GoBackButton.d.ts +5 -0
- package/dist/mt/GoBackButton.js +19 -0
- package/dist/{ui/mt → mt}/IconButton.js +1 -1
- package/dist/{ui/mt → mt}/MtScrollArea copy.js +1 -1
- package/dist/{ui/mt → mt}/MtScrollArea.js +1 -1
- package/dist/{ui/mt → mt}/MtSlider.js +2 -2
- package/dist/{ui/mt → mt}/NavTag.js +4 -4
- package/dist/{ui/mt → mt}/ScreenPanel.d.ts +1 -1
- package/dist/{ui/mt → mt}/ScreenPanel.js +3 -3
- package/dist/{ui/mt → mt}/Separator.js +1 -1
- package/dist/{ui/mt → mt}/Slider.js +2 -2
- package/dist/{ui/mt → mt}/Tree.js +1 -1
- package/dist/mt/WithLinkIf.d.ts +4 -0
- package/dist/mt/code-editor.d.ts +17 -0
- package/dist/mt/code-editor.js +126 -0
- package/dist/mt/code-highlighter.d.ts +12 -0
- package/dist/mt/code-highlighter.js +33 -0
- package/dist/mt/copy-to-clipboard.d.ts +9 -0
- package/dist/mt/copy-to-clipboard.js +20 -0
- package/dist/{ui/mt → mt}/dialog/MtDialog.d.ts +2 -2
- package/dist/{ui/mt → mt}/dialog/MtDialog.js +3 -3
- package/dist/{ui/mt → mt}/input-field/InputField.js +3 -3
- package/dist/{ui/mt → mt}/input-field/TextArea.js +3 -3
- package/dist/{ui/mt → mt}/input-field/select/InputSelect.js +2 -2
- package/dist/{ui/mt → mt}/inputs/SearchInput.js +1 -1
- package/dist/{ui/mt → mt}/inputs/TagsInput.d.ts +1 -1
- package/dist/{ui/mt → mt}/inputs/TagsInput.js +1 -1
- package/dist/{ui/mt → mt}/inputs/TaskStatusInput.d.ts +1 -1
- package/dist/{ui/mt → mt}/inputs/UrlsInput.d.ts +1 -1
- package/dist/{ui/mt → mt}/inputs/UrlsInput.js +1 -1
- package/dist/mt/inputs/input.d.ts +1 -0
- package/dist/mt/inputs/input.js +2 -0
- package/dist/mt/loading.d.ts +4 -0
- package/dist/mt/loading.js +9 -0
- package/dist/mt/logging/logs.d.ts +15 -0
- package/dist/mt/logging/logs.js +132 -0
- package/dist/{ui/mt → mt}/mtlink.d.ts +1 -1
- package/dist/{ui/mt → mt}/mtlink.js +1 -1
- package/dist/{ui/mt → mt}/multi-select.js +6 -7
- package/dist/mt/relative-date.d.ts +7 -0
- package/dist/mt/relative-date.js +47 -0
- package/dist/mt/secret-copier.d.ts +10 -0
- package/dist/mt/secret-copier.js +77 -0
- package/dist/{ui/mt → mt}/skeleton/NewLoading.js +1 -1
- package/dist/{ui/mt → mt}/skeleton/SkeletonInput.d.ts +1 -1
- package/dist/{ui/mt → mt}/skeleton/SkeletonInput.js +1 -1
- package/dist/{ui/mt → mt}/skeleton/SkeletonLayout.js +1 -1
- package/dist/{ui/mt → mt}/skeleton/SkeletonLoading.js +1 -1
- package/dist/{ui/mt → mt}/skeleton/skeleton-card.js +1 -1
- package/dist/{ui/mt → mt}/skeleton/skeletons.js +2 -2
- package/dist/{ui/mt → mt}/skeleton.js +1 -1
- package/dist/mt/submit-button.d.ts +4 -0
- package/dist/mt/submit-button.js +9 -0
- package/dist/mt/tabs.d.ts +11 -0
- package/dist/mt/tabs.js +34 -0
- package/dist/ui/badge.d.ts +2 -2
- package/dist/ui/badge.js +3 -0
- package/dist/ui/button.d.ts +1 -1
- package/dist/ui/button.js +1 -0
- package/dist/ui/tooltip.d.ts +4 -0
- package/dist/ui/tooltip.js +4 -1
- package/package.json +53 -43
- package/src/common/DebugFormState.tsx +19 -0
- package/src/common/DeleteComfirm.tsx +123 -0
- package/src/common/FullCenter.tsx +16 -0
- package/src/common/GlobalSearch.tsx +43 -0
- package/src/common/HtmlChangesObserver.tsx +71 -0
- package/src/common/MtErrorBoundary.tsx +51 -0
- package/src/common/MtImage.tsx +42 -0
- package/src/common/MtProgressBar.tsx +6 -0
- package/src/common/NotFoundGoBack.tsx +19 -0
- package/src/common/SlntTree/Slnt.z.tsx +19 -0
- package/src/common/SlntTree/SlntTreeNode.tsx +104 -0
- package/src/common/index.tsx +3 -0
- package/src/common/markdown.tsx +9 -0
- package/src/common/mtlink.tsx +61 -0
- package/src/common/pip/PipExamplePage.tsx +84 -0
- package/src/common/pip/ReactDocumentPictureInPicture.tsx +248 -0
- package/src/common/pip/globals.d.ts +8 -0
- package/src/common/react-markdown/Code.tsx +23 -0
- package/src/common/react-markdown/MarkdownToolbar.tsx +35 -0
- package/src/common/react-markdown/ReactMarkdownExample.tsx +42 -0
- package/src/common/schema-form/SchemaFormFieldsRender.tsx +38 -0
- package/src/common/schema-form/SchemaFormView.tsx +48 -0
- package/src/common/schema-form/schema-form.z.ts +25 -0
- package/src/common/table/SimpleTable.tsx +45 -0
- package/src/common/table/cells/ExpenderCell.tsx +20 -0
- package/src/common/table/cells/SelectCell.tsx +53 -0
- package/src/common/table/cells/SortOrderCell.tsx-- +29 -0
- package/src/common/table/cells/Text.tsx +29 -0
- package/src/common/table/cells/ViewLink.tsx +54 -0
- package/src/common/table/cells/container/cellWrapper.tsx +12 -0
- package/src/common/table/cells/number.tsx +15 -0
- package/src/common/table/cells/string.tsx +75 -0
- package/src/common/table/columns/columns-example.tsx-- +83 -0
- package/src/common/table/data-table-pagination.tsx +97 -0
- package/src/common/table/data-table-view-options.tsx +57 -0
- package/src/common/table/datatable-view-options.tsx +20 -0
- package/src/common/table/example/ExampleTable.tsx +149 -0
- package/src/common/table/header/SimpleHeader.tsx +76 -0
- package/src/common/table/header/header.tsx +29 -0
- package/src/common/table/index.ts +21 -0
- package/src/common/table/row/CommonRow.tsx-- +27 -0
- package/src/common/table/row/DraggableRow.tsx-- +56 -0
- package/src/common/table/table.z.ts +56 -0
- package/src/common/tailwind-indicator.tsx +16 -0
- package/src/components/AutoResizingTextarea.tsx +51 -0
- package/src/components/ChatMessageBubble.tsx +55 -0
- package/src/components/ClipboardCopy.tsx +47 -0
- package/src/components/InlineCode.tsx +19 -0
- package/src/components/IntermediateStep.tsx +53 -0
- package/src/components/ShowError.tsx +20 -0
- package/src/components/button-scroll-to-bottom.tsx +35 -0
- package/src/components/confirm/ConfirmProvider.tsx +145 -0
- package/src/components/confirm/Confrom.tsx +52 -0
- package/src/components/devtools/DebugValue.tsx +57 -0
- package/src/components/devtools/DevTools.tsx +48 -0
- package/src/components/empty-screen.tsx +21 -0
- package/src/components/external-link.tsx +30 -0
- package/src/components/hidden-copyable-input.tsx +45 -0
- package/src/components/index.ts-- +8 -0
- package/src/components/skeletons/SkeletonListView.tsx +16 -0
- package/src/components/skeletons/SkeletonLoading.tsx +16 -0
- package/src/components/spinner.tsx +17 -0
- package/src/components/theme-toggle.tsx +42 -0
- package/src/components/themes/ThemeProvider.tsx +11 -0
- package/src/components/themes/theme-toggle.tsx +26 -0
- package/src/data-table/data-table-column-header.tsx +72 -0
- package/src/data-table/data-table-faceted-filter.tsx +267 -0
- package/src/data-table/data-table-pagination.tsx +115 -0
- package/src/data-table/data-table-row-actions.tsx +53 -0
- package/src/data-table/data-table-toolbar.tsx +90 -0
- package/src/data-table/data-table-view-options.tsx +57 -0
- package/src/data-table/data-table.tsx +267 -0
- package/src/fonts.ts +62 -0
- package/src/form/EditFormToolbar.tsx +143 -0
- package/src/form/PopupFormV2.tsx +184 -0
- package/src/form/SchemaFormFieldRender.tsx +79 -0
- package/src/form/ZodForm.tsx +92 -0
- package/src/form/deleteConform.tsx +100 -0
- package/src/hooks/use-block-stream.tsx-- +95 -0
- package/src/hooks/use-can-back.ts +15 -0
- package/src/hooks/use-config.ts +21 -0
- package/src/hooks/use-copy-to-clipboard.tsx +33 -0
- package/src/hooks/use-enter-submit.tsx +17 -0
- package/src/hooks/use-local-storage.ts +21 -0
- package/src/hooks/use-lock-body.ts +12 -0
- package/src/hooks/use-media-query.ts +39 -0
- package/src/hooks/use-mobile.tsx +21 -0
- package/src/hooks/use-mounted.ts +18 -0
- package/src/hooks/use-mutation-observer.ts +20 -0
- package/src/hooks/use-router.ts +120 -0
- package/src/hooks/use-router.ts.backup +69 -0
- package/src/hooks/use-scroll-anchor.tsx +85 -0
- package/src/hooks/use-scroll-to-bottom.ts +31 -0
- package/src/hooks/use-streamable-text.ts +25 -0
- package/src/hooks/useAgentEventStream.ts +60 -0
- package/src/hooks/useHighlighter.tsx +34 -0
- package/src/hooks/useIsIntersecting.tsx +24 -0
- package/src/hooks/useLayoutPath.ts-- +27 -0
- package/src/hooks/useLeaveConfirm.ts +38 -0
- package/src/hooks/useScript.ts +107 -0
- package/src/hooks/useSnapScroll.ts +57 -0
- package/src/i18n/I18nProvider.tsx +12 -0
- package/src/i18n/i18n.tsx +60 -0
- package/src/icons/Auth0.tsx +14 -0
- package/src/icons/Cognito.tsx +44 -0
- package/src/icons/CopliotIcon.tsx +21 -0
- package/src/icons/Cross2Icon.tsx +1 -0
- package/src/icons/Descope.tsx +328 -0
- package/src/icons/GarbageIcon.tsx +26 -0
- package/src/icons/Gitlab.tsx +27 -0
- package/src/icons/IconSpinner.tsx +18 -0
- package/src/icons/Image.tsx-- +24 -0
- package/src/icons/LoaderI3con.tsx +74 -0
- package/src/icons/MessageCircle.tsx-- +21 -0
- package/src/icons/Okta.tsx +17 -0
- package/src/icons/SaveIcon.tsx +22 -0
- package/src/icons/Telegram.tsx +22 -0
- package/src/icons/attachment.tsx-- +21 -0
- package/src/icons/copy.tsx-- +22 -0
- package/src/icons/crazy-spinner.tsx +11 -0
- package/src/icons/font-default.tsx +20 -0
- package/src/icons/font-mono.tsx +21 -0
- package/src/icons/font-serif.tsx +21 -0
- package/src/icons/github.tsx +15 -0
- package/src/icons/icons-ai.tsx +507 -0
- package/src/icons/icons.tsx +495 -0
- package/src/icons/index.ts +1 -0
- package/src/icons/index.tsx +4 -0
- package/src/icons/loading-circle.tsx +22 -0
- package/src/icons/magic.tsx +30 -0
- package/src/icons/messageBubble.tsx-- +21 -0
- package/src/icons/microphone.tsx-- +23 -0
- package/src/icons/minimize.tsx-- +24 -0
- package/src/icons/pencil.tsx-- +22 -0
- package/src/icons/squarePen.tsx +21 -0
- package/src/icons/thumbs.tsx-- +73 -0
- package/src/icons/user.tsx-- +22 -0
- package/src/index.ts +4 -0
- package/src/layouts/dash/DashLayout.tsx +76 -0
- package/src/layouts/dash/MainHeader.tsx +104 -0
- package/src/layouts/dash/nav.tsx +46 -0
- package/src/layouts/dash5/DashBreadcrumb.tsx +78 -0
- package/src/layouts/dash5/DetailViewExample.tsx +9 -0
- package/src/layouts/dash5/ListViewExample.tsx +9 -0
- package/src/layouts/dash5/MainHeader.tsx +130 -0
- package/src/layouts/dash5/SiderDebug.tsx +9 -0
- package/src/layouts/dash5/SiderNavItem.tsx +104 -0
- package/src/layouts/dash5/SiderToggleButton.tsx +52 -0
- package/src/layouts/dash5/dash5.store.tsx +137 -0
- package/src/layouts/dash5/index.tsx +155 -0
- package/src/layouts/dash5/main-nav.tsx-- +51 -0
- package/src/layouts/dash5/nav.tsx-- +137 -0
- package/src/layouts/types.tsx +25 -0
- package/src/layouts/web/WebLayout.tsx +15 -0
- package/src/layouts/web/WebLayoutHeader.tsx +57 -0
- package/src/layouts//345/270/203/345/261/200/350/256/276/350/256/241/345/217/202/350/200/203.md +3 -0
- package/src/lib/clientlib.ts +57 -0
- package/src/lib/componentHelper.ts +79 -0
- package/src/lib/copyText.ts +26 -0
- package/src/lib/debounce.ts +21 -0
- package/src/lib/domutils.ts +29 -0
- package/src/lib/errors.ts +9 -0
- package/src/lib/highlight-code.ts +33 -0
- package/src/lib/htmlparse/components/ItemActionButton.tsx +103 -0
- package/src/lib/htmlparse/htmlParse.tsx +112 -0
- package/src/lib/index.ts +1 -0
- package/src/lib/logger.ts +120 -0
- package/src/lib/react-query/ReactQueryProvider.tsx +81 -0
- package/src/lib/react.ts +14 -0
- package/src/lib/render.tsx +55 -0
- package/src/lib/service-worker/ServiceWorkerMain.tsx +57 -0
- package/src/lib/service-worker/sw.ts +49 -0
- package/src/lib/service-worker.js-- +36 -0
- package/src/lib/timeFormat.ts +22 -0
- package/src/lib/types.ts +25 -0
- package/src/lib/utils.ts +565 -0
- package/src/lib/zustand.ts +45 -0
- package/src/motion/mtmotion-variants.tsx +21 -0
- package/src/mt/Boundary.tsx +37 -0
- package/src/mt/Button.tsx +7 -0
- package/src/mt/Dialog.tsx +154 -0
- package/src/mt/DropdownMenuItemLink.tsx +21 -0
- package/src/mt/ErrorMessage.tsx +12 -0
- package/src/mt/ExampleTree.tsx +100 -0
- package/src/mt/GoBackButton.tsx +46 -0
- package/src/mt/IconButton.tsx +100 -0
- package/src/mt/LoadingDots.tsx +27 -0
- package/src/mt/MtCollapse.tsx +15 -0
- package/src/mt/MtScrollArea copy.tsx +130 -0
- package/src/mt/MtScrollArea.tsx +142 -0
- package/src/mt/MtSlider.tsx +83 -0
- package/src/mt/NavTag.tsx +87 -0
- package/src/mt/ScreenPanel.tsx +65 -0
- package/src/mt/Separator.tsx +4 -0
- package/src/mt/SimpleTag.tsx +16 -0
- package/src/mt/Slider.tsx +91 -0
- package/src/mt/Tree.tsx +279 -0
- package/src/mt/WithLinkIf.tsx +14 -0
- package/src/mt/code-editor.tsx +218 -0
- package/src/mt/code-highlighter.tsx +96 -0
- package/src/mt/copy-to-clipboard.tsx +52 -0
- package/src/mt/dialog/MtDialog.tsx +35 -0
- package/src/mt/headline.tsx +16 -0
- package/src/mt/index.ts-- +1 -0
- package/src/mt/input-field/InputField.tsx +85 -0
- package/src/mt/input-field/SingleUploadForm.tsx +151 -0
- package/src/mt/input-field/TextArea.tsx +67 -0
- package/src/mt/input-field/TextFileInput.tsx +89 -0
- package/src/mt/input-field/select/InputSelect.tsx +114 -0
- package/src/mt/inputs/SearchInput.tsx +28 -0
- package/src/mt/inputs/TagsInput.tsx +80 -0
- package/src/mt/inputs/TaskStatusInput.tsx +62 -0
- package/src/mt/inputs/UrlsInput.tsx +21 -0
- package/src/mt/inputs/input.tsx +3 -0
- package/src/mt/inputs/mui-chips-input.tsx +64 -0
- package/src/mt/loading.tsx +13 -0
- package/src/mt/logging/logs.tsx +213 -0
- package/src/mt/mt-tree-view/mt-tree-view-api.tsx-- +398 -0
- package/src/mt/mt-tree-view/mt-treeview.tsx-- +135 -0
- package/src/mt/mtlink.tsx +63 -0
- package/src/mt/multi-select.tsx +361 -0
- package/src/mt/pagination.tsx +98 -0
- package/src/mt/relative-date.tsx +92 -0
- package/src/mt/secret-copier.tsx +194 -0
- package/src/mt/skeleton/NewLoading.tsx +35 -0
- package/src/mt/skeleton/SkeletonInput.tsx +14 -0
- package/src/mt/skeleton/SkeletonLayout.tsx +38 -0
- package/src/mt/skeleton/SkeletonLoading.tsx +12 -0
- package/src/mt/skeleton/skeleton-card.tsx +13 -0
- package/src/mt/skeleton/skeleton2.tsx +10 -0
- package/src/mt/skeleton/skeletons.tsx +73 -0
- package/src/mt/skeleton.tsx +25 -0
- package/src/mt/spinner/Spinner1.tsx +32 -0
- package/src/mt/submit-button.tsx +40 -0
- package/src/mt/tabs.tsx +66 -0
- package/src/mt/types.tsx +4 -0
- package/src/mt/utils/easings.ts +3 -0
- package/src/styles/CalSans-SemiBold.otf +0 -0
- package/src/styles/globals.css +144 -0
- package/src/tailwind.ts +76 -0
- package/src/types/common.ts +13 -0
- package/src/types/index.d.ts +312 -0
- package/src/ui/accordion.tsx +60 -0
- package/src/ui/alert-dialog.tsx +132 -0
- package/src/ui/alert.tsx +59 -0
- package/src/ui/aspect-ratio.tsx +7 -0
- package/src/ui/avatar.tsx +50 -0
- package/src/ui/badge.tsx +42 -0
- package/src/ui/breadcrumb.tsx +111 -0
- package/src/ui/button.tsx +60 -0
- package/src/ui/calendar.tsx +71 -0
- package/src/ui/card.tsx +76 -0
- package/src/ui/checkbox.tsx +31 -0
- package/src/ui/codeblock.tsx +144 -0
- package/src/ui/collapsible.tsx +11 -0
- package/src/ui/command.tsx +153 -0
- package/src/ui/context-menu.tsx +193 -0
- package/src/ui/dialog.tsx +97 -0
- package/src/ui/drawer.tsx +139 -0
- package/src/ui/dropdown-menu.tsx +194 -0
- package/src/ui/form.tsx +172 -0
- package/src/ui/hover-card.tsx +29 -0
- package/src/ui/index.ts-- +1 -0
- package/src/ui/input.tsx +25 -0
- package/src/ui/label.tsx +26 -0
- package/src/ui/menubar.tsx +240 -0
- package/src/ui/navigation-menu.tsx +122 -0
- package/src/ui/pagination.tsx +120 -0
- package/src/ui/popover.tsx +31 -0
- package/src/ui/progress.tsx +28 -0
- package/src/ui/radio-group.tsx +44 -0
- package/src/ui/resizable.tsx +43 -0
- package/src/ui/scroll-area.tsx +90 -0
- package/src/ui/select.tsx +151 -0
- package/src/ui/separator.tsx +31 -0
- package/src/ui/sheet.tsx +140 -0
- package/src/ui/sidebar.tsx +774 -0
- package/src/ui/skeleton.tsx +15 -0
- package/src/ui/slider.tsx +28 -0
- package/src/ui/sonner.tsx +44 -0
- package/src/ui/switch.tsx +29 -0
- package/src/ui/table.tsx +111 -0
- package/src/ui/tabs.tsx +55 -0
- package/src/ui/textarea.tsx +24 -0
- package/src/ui/toast.tsx +131 -0
- package/src/ui/toaster.tsx +41 -0
- package/src/ui/toggle.tsx +45 -0
- package/src/ui/tooltip.tsx +49 -0
- package/src/ui/use-toast.ts +203 -0
- package/src/video-player/video-player2/modal-video-player.tsx-- +128 -0
- package/dist/common/tiptap/MenuBar.d.ts +0 -1
- package/dist/common/tiptap/MenuBar.js +0 -34
- package/dist/common/tiptap/TiptapEditor.d.ts +0 -5
- package/dist/common/tiptap/TiptapEditor.js +0 -46
- package/dist/common/tiptap/examples/Demo-Default.d.ts +0 -1
- package/dist/common/tiptap/examples/Demo-Default.js +0 -84
- package/dist/common/tiptap/examples/Demo-Tiptap.d.ts +0 -1
- package/dist/common/tiptap/examples/Demo-Tiptap.js +0 -13
- package/dist/components/themes/useTheme.d.ts +0 -0
- package/dist/components/themes/useTheme.js +0 -1
- package/dist/layouts/dash5/Dash5Debug.d.ts +0 -1
- package/dist/layouts/dash5/Dash5Debug.js +0 -6
- package/dist/ui/mt/MtForm.d.ts +0 -2
- package/dist/ui/mt/MtForm.js +0 -5
- package/dist/ui/mt/WithLinkIf.d.ts +0 -4
- package/dist/ui/mt/inputs/input.d.ts +0 -1
- package/dist/ui/mt/inputs/input.js +0 -2
- /package/dist/{ui/mt → mt}/Boundary.d.ts +0 -0
- /package/dist/{ui/mt → mt}/Boundary.js +0 -0
- /package/dist/{ui/mt → mt}/Dialog.d.ts +0 -0
- /package/dist/{ui/mt → mt}/Dialog.js +0 -0
- /package/dist/{ui/mt → mt}/ErrorMessage.d.ts +0 -0
- /package/dist/{ui/mt → mt}/ErrorMessage.js +0 -0
- /package/dist/{ui/mt → mt}/ExampleTree.d.ts +0 -0
- /package/dist/{ui/mt → mt}/ExampleTree.js +0 -0
- /package/dist/{ui/mt → mt}/IconButton.d.ts +0 -0
- /package/dist/{ui/mt → mt}/LoadingDots.d.ts +0 -0
- /package/dist/{ui/mt → mt}/LoadingDots.js +0 -0
- /package/dist/{ui/mt → mt}/MtCollapse.d.ts +0 -0
- /package/dist/{ui/mt → mt}/MtCollapse.js +0 -0
- /package/dist/{ui/mt → mt}/MtScrollArea copy.d.ts +0 -0
- /package/dist/{ui/mt → mt}/MtScrollArea.d.ts +0 -0
- /package/dist/{ui/mt → mt}/MtSlider.d.ts +0 -0
- /package/dist/{ui/mt → mt}/NavTag.d.ts +0 -0
- /package/dist/{ui/mt → mt}/Separator.d.ts +0 -0
- /package/dist/{ui/mt → mt}/SimpleTag.d.ts +0 -0
- /package/dist/{ui/mt → mt}/SimpleTag.js +0 -0
- /package/dist/{ui/mt → mt}/Slider.d.ts +0 -0
- /package/dist/{ui/mt → mt}/Tree.d.ts +0 -0
- /package/dist/{ui/mt → mt}/WithLinkIf.js +0 -0
- /package/dist/{ui/mt → mt}/headline.d.ts +0 -0
- /package/dist/{ui/mt → mt}/headline.js +0 -0
- /package/dist/{ui/mt → mt}/input-field/InputField.d.ts +0 -0
- /package/dist/{ui/mt → mt}/input-field/SingleUploadForm.d.ts +0 -0
- /package/dist/{ui/mt → mt}/input-field/SingleUploadForm.js +0 -0
- /package/dist/{ui/mt → mt}/input-field/TextArea.d.ts +0 -0
- /package/dist/{ui/mt → mt}/input-field/TextFileInput.d.ts +0 -0
- /package/dist/{ui/mt → mt}/input-field/TextFileInput.js +0 -0
- /package/dist/{ui/mt → mt}/input-field/select/InputSelect.d.ts +0 -0
- /package/dist/{ui/mt → mt}/inputs/SearchInput.d.ts +0 -0
- /package/dist/{ui/mt → mt}/inputs/TaskStatusInput.js +0 -0
- /package/dist/{ui/mt → mt}/inputs/mui-chips-input.d.ts +0 -0
- /package/dist/{ui/mt → mt}/inputs/mui-chips-input.js +0 -0
- /package/dist/{ui/mt → mt}/multi-select.d.ts +0 -0
- /package/dist/{ui/mt → mt}/pagination.d.ts +0 -0
- /package/dist/{ui/mt → mt}/pagination.js +0 -0
- /package/dist/{ui/mt → mt}/skeleton/NewLoading.d.ts +0 -0
- /package/dist/{ui/mt → mt}/skeleton/SkeletonLayout.d.ts +0 -0
- /package/dist/{ui/mt → mt}/skeleton/SkeletonLoading.d.ts +0 -0
- /package/dist/{ui/mt → mt}/skeleton/skeleton-card.d.ts +0 -0
- /package/dist/{ui/mt → mt}/skeleton/skeleton2.d.ts +0 -0
- /package/dist/{ui/mt → mt}/skeleton/skeleton2.js +0 -0
- /package/dist/{ui/mt → mt}/skeleton/skeletons.d.ts +0 -0
- /package/dist/{ui/mt → mt}/skeleton.d.ts +0 -0
- /package/dist/{ui/mt → mt}/spinner/Spinner1.d.ts +0 -0
- /package/dist/{ui/mt → mt}/spinner/Spinner1.js +0 -0
- /package/dist/{ui/mt → mt}/types.d.ts +0 -0
- /package/dist/{ui/mt → mt}/types.js +0 -0
- /package/dist/{ui/mt → mt}/utils/easings.d.ts +0 -0
- /package/dist/{ui/mt → mt}/utils/easings.js +0 -0
|
@@ -3,7 +3,8 @@ import { useMemo } from "react";
|
|
|
3
3
|
export const DebugFormState = (props) => {
|
|
4
4
|
const { form } = props;
|
|
5
5
|
useMemo(() => {
|
|
6
|
-
if (form?.formState?.errors &&
|
|
6
|
+
if (form?.formState?.errors &&
|
|
7
|
+
Object.keys(form?.formState?.errors).length > 0) {
|
|
7
8
|
console.warn("DebugFormState", form?.formState?.errors);
|
|
8
9
|
}
|
|
9
10
|
}, [form?.formState?.errors]);
|
|
@@ -3,7 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { createContext, useCallback, useContext, useMemo, } from "react";
|
|
4
4
|
import { createStore, useStore } from "zustand";
|
|
5
5
|
import { immer } from "zustand/middleware/immer";
|
|
6
|
-
import {
|
|
6
|
+
import { Button } from "../ui/button";
|
|
7
7
|
import { Dialog, DialogContent, DialogDescription, DialogTitle, } from "../ui/dialog";
|
|
8
8
|
export const createFormSlice = (set, get) => ({
|
|
9
9
|
setOpen: (open) => set({ open }),
|
|
@@ -42,11 +42,11 @@ export const DeleteConfirmDlg = () => {
|
|
|
42
42
|
const open = useDeleteConfirmStore((x) => x.open);
|
|
43
43
|
const setOpen = useDeleteConfirmStore((x) => x.setOpen);
|
|
44
44
|
const confirmCallback = useDeleteConfirmStore((x) => x.confirmCallback);
|
|
45
|
-
return (_jsx(Dialog, { open: open, onOpenChange: setOpen, children: _jsxs(DialogContent, { children: [_jsx(DialogTitle, { children: "delete confirm" }), _jsx(DialogDescription, { children: "will delete item, continue?" }), _jsx(
|
|
45
|
+
return (_jsx(Dialog, { open: open, onOpenChange: setOpen, children: _jsxs(DialogContent, { children: [_jsx(DialogTitle, { children: "delete confirm" }), _jsx(DialogDescription, { children: "will delete item, continue?" }), _jsx(Button, { variant: "destructive", onClick: async () => {
|
|
46
46
|
setOpen(false);
|
|
47
|
-
confirmCallback
|
|
48
|
-
}, children: "Continue" }), _jsx(
|
|
47
|
+
confirmCallback?.();
|
|
48
|
+
}, children: "Continue" }), _jsx(Button, { variant: "outline", onClick: () => {
|
|
49
49
|
setOpen(false);
|
|
50
|
-
confirmCallback
|
|
50
|
+
confirmCallback?.();
|
|
51
51
|
}, children: "Cancel" })] }) }));
|
|
52
52
|
};
|
|
@@ -1,16 +1,10 @@
|
|
|
1
|
-
import { jsx as _jsx
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { ErrorBoundary } from "react-error-boundary";
|
|
3
|
-
import {
|
|
3
|
+
import { Button } from "../ui/button";
|
|
4
4
|
export const MtErrorBoundary = (props) => {
|
|
5
5
|
const { children } = props;
|
|
6
6
|
return (_jsx(ErrorBoundary, { fallbackRender: ({ error, resetErrorBoundary }) => {
|
|
7
7
|
console.log("💥💥💥", error);
|
|
8
|
-
return (_jsx("div", { className: "flex items-center justify-center h-full w-full", children: _jsx(
|
|
8
|
+
return (_jsx("div", { className: "flex items-center justify-center h-full w-full", children: _jsx(Button, { onClick: () => resetErrorBoundary(), className: "min-w-24 p-4", children: "\u91CD\u8BD5" }) }));
|
|
9
9
|
}, onReset: () => { }, children: children }));
|
|
10
10
|
};
|
|
11
|
-
const CustomErrorRetry = (props) => {
|
|
12
|
-
const { message, onRetry } = props;
|
|
13
|
-
return (_jsxs("div", { className: "flex flex-col space-y-4 bg-red-200 p-2", children: [message && _jsx("h2", { children: message }), _jsx(MtButton, { onClick: () => {
|
|
14
|
-
onRetry();
|
|
15
|
-
}, children: "retry" })] }));
|
|
16
|
-
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import ReactDocumentPictureInPicture from "mtxuilib/common/pip/ReactDocumentPictureInPicture";
|
|
4
|
-
import { MtButton } from "mtxuilib/
|
|
4
|
+
import { MtButton } from "mtxuilib/mt/Button";
|
|
5
5
|
import { useRef, useState } from "react";
|
|
6
6
|
export default function PipExamplePage() {
|
|
7
7
|
const pipWindowRef = useRef(null);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { ChevronLeftIcon, ChevronRightIcon, DoubleArrowLeftIcon, DoubleArrowRightIcon, } from "@radix-ui/react-icons";
|
|
4
|
-
import {
|
|
4
|
+
import { Button } from "../../ui/button";
|
|
5
5
|
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "../../ui/select";
|
|
6
6
|
export function DataTablePagination({ table, }) {
|
|
7
7
|
return (_jsxs("div", { className: "flex items-center justify-between px-2", children: [_jsxs("div", { className: "text-muted-foreground flex-1 text-sm", children: [table.getFilteredSelectedRowModel().rows.length, " of", " ", table.getFilteredRowModel().rows.length, " row(s) selected."] }), _jsxs("div", { className: "flex items-center space-x-6 lg:space-x-8", children: [_jsxs("div", { className: "flex items-center space-x-2", children: [_jsx("p", { className: "text-sm font-medium", children: "Rows per page" }), _jsxs(Select, { value: `${table.getState().pagination.pageSize}`, onValueChange: (value) => {
|
|
8
8
|
table.setPageSize(Number(value));
|
|
9
|
-
}, children: [_jsx(SelectTrigger, { className: "h-8 w-[70px]", children: _jsx(SelectValue, { placeholder: table.getState().pagination.pageSize }) }), _jsx(SelectContent, { side: "top", children: [10, 20, 30, 40, 50].map((pageSize) => (_jsx(SelectItem, { value: `${pageSize}`, children: pageSize }, pageSize))) })] })] }), _jsxs("div", { className: "flex w-[100px] items-center justify-center text-sm font-medium", children: ["Page ", table.getState().pagination.pageIndex + 1, " of", " ", table.getPageCount()] }), _jsxs("div", { className: "flex items-center space-x-2", children: [_jsxs(
|
|
9
|
+
}, children: [_jsx(SelectTrigger, { className: "h-8 w-[70px]", children: _jsx(SelectValue, { placeholder: table.getState().pagination.pageSize }) }), _jsx(SelectContent, { side: "top", children: [10, 20, 30, 40, 50].map((pageSize) => (_jsx(SelectItem, { value: `${pageSize}`, children: pageSize }, pageSize))) })] })] }), _jsxs("div", { className: "flex w-[100px] items-center justify-center text-sm font-medium", children: ["Page ", table.getState().pagination.pageIndex + 1, " of", " ", table.getPageCount()] }), _jsxs("div", { className: "flex items-center space-x-2", children: [_jsxs(Button, { variant: "outline", className: "hidden h-8 w-8 p-0 lg:flex", onClick: () => table.setPageIndex(0), disabled: !table.getCanPreviousPage(), children: [_jsx("span", { className: "sr-only", children: "Go to first page" }), _jsx(DoubleArrowLeftIcon, { className: "h-4 w-4" })] }), _jsxs(Button, { variant: "outline", className: "h-8 w-8 p-0", onClick: () => table.previousPage(), disabled: !table.getCanPreviousPage(), children: [_jsx("span", { className: "sr-only", children: "Go to previous page" }), _jsx(ChevronLeftIcon, { className: "h-4 w-4" })] }), _jsxs(Button, { variant: "outline", className: "h-8 w-8 p-0", onClick: () => table.nextPage(), disabled: !table.getCanNextPage(), children: [_jsx("span", { className: "sr-only", children: "Go to next page" }), _jsx(ChevronRightIcon, { className: "h-4 w-4" })] }), _jsxs(Button, { variant: "outline", className: "hidden h-8 w-8 p-0 lg:flex", onClick: () => table.setPageIndex(table.getPageCount() - 1), disabled: !table.getCanNextPage(), children: [_jsx("span", { className: "sr-only", children: "Go to last page" }), _jsx(DoubleArrowRightIcon, { className: "h-4 w-4" })] })] })] })] }));
|
|
10
10
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { MixerHorizontalIcon } from "@radix-ui/react-icons";
|
|
4
|
-
import {
|
|
4
|
+
import { Button } from "../../ui/button";
|
|
5
5
|
import { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, } from "../../ui/dropdown-menu";
|
|
6
6
|
export function DataTableViewOptions({ table, }) {
|
|
7
|
-
return (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs(
|
|
7
|
+
return (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs(Button, { variant: "outline", size: "sm", className: "ml-auto hidden h-8 lg:flex", children: [_jsx(MixerHorizontalIcon, { className: "mr-2 h-4 w-4" }), "View"] }) }), _jsxs(DropdownMenuContent, { align: "end", className: "w-[150px]", children: [_jsx(DropdownMenuLabel, { children: "Toggle columns" }), _jsx(DropdownMenuSeparator, {}), table
|
|
8
8
|
.getAllColumns()
|
|
9
9
|
.filter((column) => typeof column.accessorFn !== "undefined" && column.getCanHide())
|
|
10
10
|
.map((column) => {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
2
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
3
|
+
import { Button } from "../ui/button";
|
|
4
4
|
export const ShowError = (props) => {
|
|
5
|
-
return (_jsxs("div", { className: "bg-orange-400 p-4 flex items-center justify-center flex-col", children: [_jsx("h3", { children: "\u5185\u90E8\u51FA\u9519" }), _jsx(
|
|
5
|
+
return (_jsxs("div", { className: "bg-orange-400 p-4 flex items-center justify-center flex-col", children: [_jsx("h3", { children: "\u5185\u90E8\u51FA\u9519" }), _jsx(Button, { type: "button", onClick: () => props.reset(), children: "\u91CD\u8BD5" })] }));
|
|
6
6
|
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Column } from "@tanstack/react-table";
|
|
2
|
+
interface DataTableColumnHeaderProps<TData, TValue> extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
column: Column<TData, TValue>;
|
|
4
|
+
title: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function DataTableColumnHeader<TData, TValue>({ column, title, className, }: DataTableColumnHeaderProps<TData, TValue>): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { ArrowDownIcon, ArrowUpIcon, CaretSortIcon, EyeNoneIcon, } from "@radix-ui/react-icons";
|
|
4
|
+
import { cn } from "mtxuilib/lib/utils";
|
|
5
|
+
import { Button } from "mtxuilib/ui/button";
|
|
6
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger, } from "mtxuilib/ui/dropdown-menu";
|
|
7
|
+
export function DataTableColumnHeader({ column, title, className, }) {
|
|
8
|
+
if (!column.getCanSort()) {
|
|
9
|
+
return _jsx("div", { className: cn(className, "text-xs"), children: title });
|
|
10
|
+
}
|
|
11
|
+
return (_jsx("div", { className: cn("flex items-center space-x-2", className), children: _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs(Button, { variant: "ghost", size: "sm", className: "-ml-3 h-8 data-[state=open]:bg-accent", children: [_jsx("span", { children: title }), column.getIsSorted() === "desc" ? (_jsx(ArrowDownIcon, { className: "ml-2 h-4 w-4" })) : column.getIsSorted() === "asc" ? (_jsx(ArrowUpIcon, { className: "ml-2 h-4 w-4" })) : (_jsx(CaretSortIcon, { className: "ml-2 h-4 w-4" }))] }) }), _jsxs(DropdownMenuContent, { align: "start", children: [_jsxs(DropdownMenuItem, { onClick: () => column.toggleSorting(false), children: [_jsx(ArrowUpIcon, { className: "mr-2 h-3.5 w-3.5 text-gray-600 dark:text-gray-400/70" }), "Asc"] }), _jsxs(DropdownMenuItem, { onClick: () => column.toggleSorting(true), children: [_jsx(ArrowDownIcon, { className: "mr-2 h-3.5 w-3.5 text-gray-600 dark:text-gray-400/70" }), "Desc"] }), _jsx(DropdownMenuSeparator, {}), _jsxs(DropdownMenuItem, { onClick: () => column.toggleVisibility(false), children: [_jsx(EyeNoneIcon, { className: "mr-2 h-3.5 w-3.5 text-gray-600 dark:text-gray-400/70" }), "Hide"] })] })] }) }));
|
|
12
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Column } from "@tanstack/react-table";
|
|
2
|
+
import { ToolbarType } from "./data-table-toolbar";
|
|
3
|
+
interface DataTableFacetedFilterProps<TData, TValue> {
|
|
4
|
+
column?: Column<TData, TValue>;
|
|
5
|
+
title?: string;
|
|
6
|
+
type?: ToolbarType;
|
|
7
|
+
options?: {
|
|
8
|
+
label: string;
|
|
9
|
+
value: string;
|
|
10
|
+
icon?: React.ComponentType<{
|
|
11
|
+
className?: string;
|
|
12
|
+
}>;
|
|
13
|
+
}[];
|
|
14
|
+
}
|
|
15
|
+
export declare function DataTableFacetedFilter<TData, TValue>({ column, title, type, options, }: DataTableFacetedFilterProps<TData, TValue>): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { CheckIcon, CircleIcon, PlusCircledIcon } from "@radix-ui/react-icons";
|
|
4
|
+
import { zodResolver } from "@hookform/resolvers/zod";
|
|
5
|
+
import { cn } from "mtxuilib/lib/utils";
|
|
6
|
+
import { Badge } from "mtxuilib/ui/badge";
|
|
7
|
+
import { Button } from "mtxuilib/ui/button";
|
|
8
|
+
import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, } from "mtxuilib/ui/command";
|
|
9
|
+
import { Input } from "mtxuilib/ui/input";
|
|
10
|
+
import { Popover, PopoverContent, PopoverTrigger } from "mtxuilib/ui/popover";
|
|
11
|
+
import { Separator } from "mtxuilib/ui/separator";
|
|
12
|
+
import { useForm } from "react-hook-form";
|
|
13
|
+
import { BiX } from "react-icons/bi";
|
|
14
|
+
import { z } from "zod";
|
|
15
|
+
import { ToolbarType } from "./data-table-toolbar";
|
|
16
|
+
const keyValuePairSchema = z.object({
|
|
17
|
+
key: z.string().min(1, "Key is required"),
|
|
18
|
+
value: z.string().min(1, "Value is required"),
|
|
19
|
+
});
|
|
20
|
+
const arrayInputSchema = z.object({
|
|
21
|
+
values: z.string().min(1, "At least one value is required"),
|
|
22
|
+
});
|
|
23
|
+
export function DataTableFacetedFilter({ column, title, type = ToolbarType.Checkbox, options, }) {
|
|
24
|
+
const selectedValues = new Set(column?.getFilterValue());
|
|
25
|
+
const { register, handleSubmit, reset } = useForm({
|
|
26
|
+
resolver: zodResolver(type === ToolbarType.KeyValue ? keyValuePairSchema : arrayInputSchema),
|
|
27
|
+
defaultValues: type === ToolbarType.KeyValue ? { key: "", value: "" } : { values: "" },
|
|
28
|
+
});
|
|
29
|
+
const onSubmit = (data) => {
|
|
30
|
+
if ("key" in data) {
|
|
31
|
+
selectedValues.add(`${data.key}:${data.value}`);
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
data.values
|
|
35
|
+
.split(",")
|
|
36
|
+
.forEach((value) => selectedValues.add(value.trim()));
|
|
37
|
+
}
|
|
38
|
+
const filterValues = Array.from(selectedValues);
|
|
39
|
+
column?.setFilterValue(filterValues.length ? filterValues : undefined);
|
|
40
|
+
reset();
|
|
41
|
+
};
|
|
42
|
+
const handleRemove = (filter) => {
|
|
43
|
+
selectedValues.delete(filter);
|
|
44
|
+
const filterValues = Array.from(selectedValues);
|
|
45
|
+
column?.setFilterValue(filterValues.length ? filterValues : undefined);
|
|
46
|
+
};
|
|
47
|
+
return (_jsxs(Popover, { children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs(Button, { variant: "outline", size: "sm", className: "h-8 border-dashed", children: [_jsx(PlusCircledIcon, { className: "mr-2 h-4 w-4" }), title, selectedValues?.size > 0 && (_jsxs(_Fragment, { children: [_jsx(Separator, { orientation: "vertical", className: "mx-2 h-4" }), _jsx(Badge, { variant: "secondary", className: "rounded-sm px-1 font-normal lg:hidden", children: selectedValues.size }), _jsx("div", { className: "hidden space-x-1 lg:flex", children: selectedValues.size > 2 ? (_jsxs(Badge, { variant: "secondary", className: "rounded-sm px-1 font-normal", children: [selectedValues.size, " selected"] })) : (Array.from(selectedValues).map((option, index) => (_jsxs(Badge, { variant: "secondary", className: "rounded-sm px-1 font-normal flex items-center space-x-1", children: [options?.find(({ value }) => value == option)?.label ||
|
|
48
|
+
option, _jsx(Button, { variant: "ghost", size: "xs", className: "ml-2", onClick: () => handleRemove(option), children: _jsx(BiX, { className: "h-3 w-3" }) })] }, index)))) })] }))] }) }), _jsxs(PopoverContent, { className: "w-[300px] p-2", align: "start", children: [[ToolbarType.Array, ToolbarType.KeyValue].includes(type) && (_jsxs("div", { children: [_jsx("div", { className: "", children: Array.from(selectedValues).map((filter, index) => (_jsxs(Badge, { variant: "secondary", className: "mr-2 mb-2 rounded-sm px-1 font-normal flex items-center space-x-1 font-normal pl-2", children: [_jsx("span", { className: "grow", children: filter }), _jsx(Button, { variant: "ghost", size: "icon", className: "ml-2 shrink-0", onClick: () => handleRemove(filter), children: _jsx(BiX, { className: "h-4 w-4" }) })] }, index))) }), _jsxs("form", { onSubmit: handleSubmit(onSubmit), children: [type === ToolbarType.KeyValue ? (_jsxs("div", { className: "flex items-center space-x-2 mb-2", children: [_jsx(Input, { type: "text", placeholder: "Key", ...register("key"), className: "flex-1" }), _jsx(Input, { type: "text", placeholder: "Value", ...register("value"), className: "flex-1" })] })) : (_jsx("div", { className: "mb-2", children: _jsx(Input, { type: "text", placeholder: "Enter values (comma-separated)", ...register("values"), className: "w-full" }) })), _jsxs(Button, { type: "submit", className: "w-full", size: "sm", children: ["Add ", title, " Filter"] }), selectedValues.size > 0 && (_jsx(Button, { onClick: () => column?.setFilterValue(undefined), className: "w-full mt-2", size: "sm", variant: "ghost", children: "Reset" }))] })] })), [ToolbarType.Checkbox, ToolbarType.Radio].includes(type) && (_jsxs(Command, { children: [_jsx(CommandInput, { placeholder: title }), _jsxs(CommandList, { children: [_jsx(CommandEmpty, { children: "No results found." }), _jsx(CommandGroup, { children: options?.map((option) => {
|
|
49
|
+
const isSelected = selectedValues.has(option.value);
|
|
50
|
+
return (_jsxs(CommandItem, { onSelect: () => {
|
|
51
|
+
if (isSelected) {
|
|
52
|
+
selectedValues.delete(option.value);
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
if (type == "radio") {
|
|
56
|
+
selectedValues.clear();
|
|
57
|
+
}
|
|
58
|
+
selectedValues.add(option.value);
|
|
59
|
+
}
|
|
60
|
+
const filterValues = Array.from(selectedValues);
|
|
61
|
+
column?.setFilterValue(filterValues.length ? filterValues : undefined);
|
|
62
|
+
}, children: [_jsx("div", { className: cn("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary", isSelected
|
|
63
|
+
? "bg-primary text-primary-foreground"
|
|
64
|
+
: "opacity-50 [&_svg]:invisible"), children: type === "checkbox" ? (_jsx(CheckIcon, { className: cn("h-4 w-4") })) : (_jsx(CircleIcon, { className: cn("h-4 w-4") })) }), option.icon && (_jsx(option.icon, { className: "mr-2 h-4 w-4 text-gray-700 dark:text-gray-300" })), _jsx("span", { children: option.label })] }, option.value));
|
|
65
|
+
}) }), selectedValues.size > 0 && (_jsxs(_Fragment, { children: [_jsx(CommandSeparator, {}), _jsx(CommandGroup, { children: _jsx(CommandItem, { onSelect: () => column?.setFilterValue(undefined), className: "justify-center text-center", children: "Reset" }) })] }))] })] }))] })] }));
|
|
66
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Table } from "@tanstack/react-table";
|
|
2
|
+
interface DataTablePaginationProps<TData> {
|
|
3
|
+
table: Table<TData>;
|
|
4
|
+
onSetPageSize?: (pageSize: number) => void;
|
|
5
|
+
}
|
|
6
|
+
export declare function DataTablePagination<TData>({ table, onSetPageSize, }: DataTablePaginationProps<TData>): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { ChevronLeftIcon, ChevronRightIcon, DoubleArrowLeftIcon, DoubleArrowRightIcon, } from "@radix-ui/react-icons";
|
|
3
|
+
import { Button } from "../ui/button";
|
|
4
|
+
import { Label } from "../ui/label";
|
|
5
|
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "../ui/select";
|
|
6
|
+
export function DataTablePagination({ table, onSetPageSize, }) {
|
|
7
|
+
const pagination = table.getState().pagination;
|
|
8
|
+
return (_jsxs("div", { className: "flex items-center justify-between px-2", children: [_jsxs("div", { className: "flex-1 text-sm text-gray-600 dark:text-gray-400", children: [table.getFilteredSelectedRowModel().rows.length, " of", " ", table.getFilteredRowModel().rows.length, " row(s) selected."] }), _jsxs("div", { className: "flex items-center space-x-6 lg:space-x-8", children: [_jsxs("div", { className: "flex items-center space-x-2", children: [_jsx(Label, { className: "text-sm font-medium text-gray-600 dark:text-gray-400", htmlFor: "rows-per-page", id: "rows-per-page-label", children: "Rows per page" }), _jsxs(Select, { value: `${pagination.pageSize}`, onValueChange: (value) => {
|
|
9
|
+
table.setPageSize(Number(value));
|
|
10
|
+
if (onSetPageSize) {
|
|
11
|
+
onSetPageSize(Number(value));
|
|
12
|
+
}
|
|
13
|
+
}, children: [_jsx(SelectTrigger, { className: "h-8 w-[70px]", id: "rows-per-page", "aria-labelledby": "rows-per-page-label", children: _jsx(SelectValue, { placeholder: pagination.pageSize }) }), _jsx(SelectContent, { side: "top", children: [50, 100, 200, 500].map((pageSize) => (_jsx(SelectItem, { value: `${pageSize}`, children: pageSize }, pageSize))) })] })] }), _jsxs("div", { className: "flex w-[100px] items-center justify-center text-sm font-medium", children: ["Page ", pagination.pageIndex + 1, " of ", table.getPageCount()] }), _jsxs("div", { className: "flex items-center space-x-2", children: [_jsxs(Button, { variant: "outline", className: "hidden h-8 w-8 p-0 lg:flex", onClick: () => table.setPageIndex(0), disabled: !table.getCanPreviousPage(), children: [_jsx("span", { className: "sr-only", children: "Go to first page" }), _jsx(DoubleArrowLeftIcon, { className: "h-4 w-4" })] }), _jsxs(Button, { variant: "outline", className: "h-8 w-8 p-0", onClick: () => table.previousPage(), disabled: !table.getCanPreviousPage(), children: [_jsx("span", { className: "sr-only", children: "Go to previous page" }), _jsx(ChevronLeftIcon, { className: "h-4 w-4" })] }), _jsxs(Button, { variant: "outline", className: "h-8 w-8 p-0", onClick: () => table.nextPage(), disabled: !table.getCanNextPage(), children: [_jsx("span", { className: "sr-only", children: "Go to next page" }), _jsx(ChevronRightIcon, { className: "h-4 w-4" })] }), _jsxs(Button, { variant: "outline", className: "hidden h-8 w-8 p-0 lg:flex", onClick: () => table.setPageIndex(table.getPageCount() - 1), disabled: !table.getCanNextPage(), children: [_jsx("span", { className: "sr-only", children: "Go to last page" }), _jsx(DoubleArrowRightIcon, { className: "h-4 w-4" })] })] })] })] }));
|
|
14
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Row } from "@tanstack/react-table";
|
|
2
|
+
import type { IDGetter } from "./data-table";
|
|
3
|
+
interface DataTableRowActionsProps<TData extends IDGetter> {
|
|
4
|
+
row: Row<TData>;
|
|
5
|
+
actions?: {
|
|
6
|
+
label: string;
|
|
7
|
+
onClick: (data: TData) => void;
|
|
8
|
+
}[];
|
|
9
|
+
}
|
|
10
|
+
export declare function DataTableRowActions<TData extends IDGetter>({ row, actions, }: DataTableRowActionsProps<TData>): import("react/jsx-runtime").JSX.Element | null;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { DotsHorizontalIcon } from "@radix-ui/react-icons";
|
|
3
|
+
import { Button } from "mtxuilib/ui/button";
|
|
4
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, } from "mtxuilib/ui/dropdown-menu";
|
|
5
|
+
export function DataTableRowActions({ row, actions, }) {
|
|
6
|
+
if (!actions?.length) {
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
return (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs(Button, { variant: "ghost", className: "flex h-8 w-8 p-0 data-[state=open]:bg-muted", children: [_jsx(DotsHorizontalIcon, { className: "h-4 w-4" }), _jsx("span", { className: "sr-only", children: "Open menu" })] }) }), _jsx(DropdownMenuContent, { align: "end", className: "w-[160px]", children: actions?.map((action) => (_jsx(DropdownMenuItem, { onClick: () => action.onClick(row.original), children: action.label }, action.label))) })] }));
|
|
10
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Table } from "@tanstack/react-table";
|
|
2
|
+
export interface FilterOption {
|
|
3
|
+
label: string;
|
|
4
|
+
value: string;
|
|
5
|
+
icon?: React.ComponentType<{
|
|
6
|
+
className?: string;
|
|
7
|
+
}>;
|
|
8
|
+
}
|
|
9
|
+
export declare enum ToolbarType {
|
|
10
|
+
Checkbox = "checkbox",
|
|
11
|
+
Radio = "radio",
|
|
12
|
+
KeyValue = "key-value",
|
|
13
|
+
Array = "array"
|
|
14
|
+
}
|
|
15
|
+
export type ToolbarFilters = {
|
|
16
|
+
columnId: string;
|
|
17
|
+
title: string;
|
|
18
|
+
type?: ToolbarType;
|
|
19
|
+
options?: FilterOption[];
|
|
20
|
+
}[];
|
|
21
|
+
interface DataTableToolbarProps<TData> {
|
|
22
|
+
table: Table<TData>;
|
|
23
|
+
filters: ToolbarFilters;
|
|
24
|
+
actions: JSX.Element[];
|
|
25
|
+
setSearch?: (search: string) => void;
|
|
26
|
+
search?: string;
|
|
27
|
+
showColumnToggle?: boolean;
|
|
28
|
+
isLoading?: boolean;
|
|
29
|
+
}
|
|
30
|
+
export declare function DataTableToolbar<TData>({ table, filters, actions, setSearch, search, showColumnToggle, isLoading, }: DataTableToolbarProps<TData>): import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Cross2Icon } from "@radix-ui/react-icons";
|
|
3
|
+
import { Button } from "mtxuilib/ui/button";
|
|
4
|
+
import { DataTableViewOptions } from "./data-table-view-options";
|
|
5
|
+
import { Spinner } from "mtxuilib/mt/loading";
|
|
6
|
+
import { Input } from "mtxuilib/ui/input";
|
|
7
|
+
import { DataTableFacetedFilter } from "./data-table-faceted-filter";
|
|
8
|
+
export var ToolbarType;
|
|
9
|
+
(function (ToolbarType) {
|
|
10
|
+
ToolbarType["Checkbox"] = "checkbox";
|
|
11
|
+
ToolbarType["Radio"] = "radio";
|
|
12
|
+
ToolbarType["KeyValue"] = "key-value";
|
|
13
|
+
ToolbarType["Array"] = "array";
|
|
14
|
+
})(ToolbarType || (ToolbarType = {}));
|
|
15
|
+
export function DataTableToolbar({ table, filters, actions, setSearch, search, showColumnToggle, isLoading = false, }) {
|
|
16
|
+
const isFiltered = table.getState().columnFilters?.length > 0;
|
|
17
|
+
return (_jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { className: "flex flex-1 items-center space-x-2", children: [setSearch && (_jsx(Input, { placeholder: "Search...", value: search, onChange: (e) => setSearch(e.target.value), className: "h-8 w-[150px] lg:w-[250px]" })), filters.map((filter) => (_jsx(DataTableFacetedFilter, { column: table.getColumn(filter.columnId), title: filter.title, type: filter.type, options: filter.options }, filter.columnId))), isFiltered && (_jsxs(Button, { variant: "ghost", onClick: () => table.resetColumnFilters(), className: "h-8 px-2 lg:px-3", children: ["Reset", _jsx(Cross2Icon, { className: "ml-2 h-4 w-4" })] }))] }), _jsxs("div", { className: "flex flex-row gap-4 items-center", children: [isLoading && _jsx(Spinner, {}), actions && actions.length > 0 && actions, showColumnToggle && _jsx(DataTableViewOptions, { table: table })] })] }));
|
|
18
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Table } from "@tanstack/react-table";
|
|
2
|
+
interface DataTableViewOptionsProps<TData> {
|
|
3
|
+
table: Table<TData>;
|
|
4
|
+
}
|
|
5
|
+
export declare function DataTableViewOptions<TData>({ table, }: DataTableViewOptionsProps<TData>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { DropdownMenuTrigger } from "@radix-ui/react-dropdown-menu";
|
|
3
|
+
import { MixerHorizontalIcon } from "@radix-ui/react-icons";
|
|
4
|
+
import { Button } from "mtxuilib/ui/button";
|
|
5
|
+
import { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuLabel, DropdownMenuSeparator, } from "mtxuilib/ui/dropdown-menu";
|
|
6
|
+
export function DataTableViewOptions({ table, }) {
|
|
7
|
+
return (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs(Button, { variant: "outline", size: "sm", className: "ml-auto hidden h-8 lg:flex", children: [_jsx(MixerHorizontalIcon, { className: "mr-2 h-4 w-4" }), "View"] }) }), _jsxs(DropdownMenuContent, { align: "end", className: "w-[150px]", children: [_jsx(DropdownMenuLabel, { children: "Toggle columns" }), _jsx(DropdownMenuSeparator, {}), table
|
|
8
|
+
.getAllColumns()
|
|
9
|
+
.filter((column) => typeof column.accessorFn !== "undefined" && column.getCanHide())
|
|
10
|
+
.map((column) => {
|
|
11
|
+
return (_jsx(DropdownMenuCheckboxItem, { className: "capitalize", checked: column.getIsVisible(), onCheckedChange: (value) => column.toggleVisibility(!!value), children: column.id }, column.id));
|
|
12
|
+
})] })] }));
|
|
13
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { type ColumnDef, type ColumnFiltersState, type OnChangeFn, type PaginationState, type Row, type RowSelectionState, type SortingState, type VisibilityState } from "@tanstack/react-table";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { type ToolbarFilters } from "./data-table-toolbar";
|
|
4
|
+
export interface IDGetter {
|
|
5
|
+
metadata: {
|
|
6
|
+
id: string;
|
|
7
|
+
};
|
|
8
|
+
getRow?: () => JSX.Element;
|
|
9
|
+
onClick?: () => void;
|
|
10
|
+
isExpandable?: boolean;
|
|
11
|
+
}
|
|
12
|
+
interface DataTableProps<TData extends IDGetter, TValue> {
|
|
13
|
+
columns: ColumnDef<TData, TValue>[];
|
|
14
|
+
data: TData[];
|
|
15
|
+
error?: Error | null;
|
|
16
|
+
filters: ToolbarFilters;
|
|
17
|
+
actions?: JSX.Element[];
|
|
18
|
+
sorting?: SortingState;
|
|
19
|
+
setSorting?: OnChangeFn<SortingState>;
|
|
20
|
+
setSearch?: (search: string) => void;
|
|
21
|
+
search?: string;
|
|
22
|
+
columnFilters?: ColumnFiltersState;
|
|
23
|
+
setColumnFilters?: OnChangeFn<ColumnFiltersState>;
|
|
24
|
+
pagination?: PaginationState;
|
|
25
|
+
setPagination?: OnChangeFn<PaginationState>;
|
|
26
|
+
pageCount?: number;
|
|
27
|
+
onSetPageSize?: (pageSize: number) => void;
|
|
28
|
+
showColumnToggle?: boolean;
|
|
29
|
+
columnVisibility?: VisibilityState;
|
|
30
|
+
setColumnVisibility?: OnChangeFn<VisibilityState>;
|
|
31
|
+
rowSelection?: RowSelectionState;
|
|
32
|
+
setRowSelection?: OnChangeFn<RowSelectionState>;
|
|
33
|
+
isLoading?: boolean;
|
|
34
|
+
enableRowSelection?: boolean;
|
|
35
|
+
getRowId?: ((originalRow: TData, index: number, parent?: Row<TData> | undefined) => string) | undefined;
|
|
36
|
+
manualSorting?: boolean;
|
|
37
|
+
manualFiltering?: boolean;
|
|
38
|
+
}
|
|
39
|
+
interface ExtraDataTableProps {
|
|
40
|
+
emptyState?: JSX.Element;
|
|
41
|
+
card?: {
|
|
42
|
+
containerStyle?: string;
|
|
43
|
+
component: React.FC<any> | ((data: any) => JSX.Element);
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
export declare function DataTable<TData extends IDGetter, TValue>({ columns, error, data, filters, actions, sorting, setSorting, setSearch, search, columnFilters, setColumnFilters, pagination, setPagination, pageCount, onSetPageSize, showColumnToggle, columnVisibility, setColumnVisibility, rowSelection, setRowSelection, isLoading, getRowId, emptyState, card, manualSorting, manualFiltering, }: DataTableProps<TData, TValue> & ExtraDataTableProps): import("react/jsx-runtime").JSX.Element;
|
|
47
|
+
export {};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { flexRender, getCoreRowModel, getFacetedRowModel, getFacetedUniqueValues, getFilteredRowModel, getPaginationRowModel, getSortedRowModel, useReactTable, } from "@tanstack/react-table";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow, } from "mtxuilib/ui/table";
|
|
5
|
+
import { cn } from "mtxuilib/lib/utils";
|
|
6
|
+
import { Skeleton } from "mtxuilib/ui/skeleton";
|
|
7
|
+
import { DataTablePagination } from "./data-table-pagination";
|
|
8
|
+
import { DataTableToolbar } from "./data-table-toolbar";
|
|
9
|
+
export function DataTable({ columns, error, data, filters, actions = [], sorting, setSorting, setSearch, search, columnFilters, setColumnFilters, pagination, setPagination, pageCount, onSetPageSize, showColumnToggle, columnVisibility, setColumnVisibility, rowSelection, setRowSelection, isLoading, getRowId, emptyState, card, manualSorting = true, manualFiltering = true, }) {
|
|
10
|
+
const loadingNoData = isLoading && !data.length;
|
|
11
|
+
const tableData = React.useMemo(() => (loadingNoData ? Array(10).fill({ metadata: {} }) : data), [loadingNoData, data]);
|
|
12
|
+
const tableColumns = React.useMemo(() => loadingNoData
|
|
13
|
+
? columns.map((column) => ({
|
|
14
|
+
...column,
|
|
15
|
+
cell: () => _jsx(Skeleton, { className: "h-4 w-[100px]" }),
|
|
16
|
+
}))
|
|
17
|
+
: columns, [loadingNoData, columns]);
|
|
18
|
+
const table = useReactTable({
|
|
19
|
+
data: tableData,
|
|
20
|
+
columns: tableColumns,
|
|
21
|
+
state: {
|
|
22
|
+
sorting,
|
|
23
|
+
columnVisibility,
|
|
24
|
+
rowSelection: rowSelection || {},
|
|
25
|
+
columnFilters,
|
|
26
|
+
pagination,
|
|
27
|
+
},
|
|
28
|
+
pageCount,
|
|
29
|
+
enableRowSelection: !!rowSelection,
|
|
30
|
+
onRowSelectionChange: setRowSelection,
|
|
31
|
+
onSortingChange: setSorting,
|
|
32
|
+
onColumnFiltersChange: setColumnFilters,
|
|
33
|
+
onColumnVisibilityChange: setColumnVisibility,
|
|
34
|
+
onPaginationChange: setPagination,
|
|
35
|
+
getCoreRowModel: getCoreRowModel(),
|
|
36
|
+
getFilteredRowModel: getFilteredRowModel(),
|
|
37
|
+
getPaginationRowModel: getPaginationRowModel(),
|
|
38
|
+
getSortedRowModel: getSortedRowModel(),
|
|
39
|
+
getFacetedRowModel: getFacetedRowModel(),
|
|
40
|
+
getFacetedUniqueValues: getFacetedUniqueValues(),
|
|
41
|
+
manualSorting,
|
|
42
|
+
manualFiltering,
|
|
43
|
+
manualPagination: true,
|
|
44
|
+
getRowId,
|
|
45
|
+
});
|
|
46
|
+
const getTableRow = (row) => {
|
|
47
|
+
if (row.original.getRow) {
|
|
48
|
+
return row.original.getRow();
|
|
49
|
+
}
|
|
50
|
+
return (_jsx(TableRow, { "data-state": row.getIsSelected() && "selected", className: cn(row.original.isExpandable && "cursor-pointer hover:bg-muted"), onClick: row.original.onClick, children: row.getVisibleCells().map((cell) => (_jsx(TableCell, { children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id))) }, row.id));
|
|
51
|
+
};
|
|
52
|
+
const getTable = () => (_jsxs(Table, { children: [_jsx(TableHeader, { children: table.getHeaderGroups().map((headerGroup) => (_jsx(TableRow, { children: headerGroup.headers.map((header) => {
|
|
53
|
+
return (_jsx(TableHead, { colSpan: header.colSpan, children: header.isPlaceholder
|
|
54
|
+
? null
|
|
55
|
+
: flexRender(header.column.columnDef.header, header.getContext()) }, header.id));
|
|
56
|
+
}) }, headerGroup.id))) }), _jsx(TableBody, { children: error ? (_jsx(TableRow, { className: "p-4 text-center text-red-500", children: _jsx(TableCell, { colSpan: columns.length, children: error.message || "An error occurred." }) })) : table.getRowModel().rows?.length ? (table.getRowModel().rows.map((row) => getTableRow(row))) : (_jsx(TableRow, { children: _jsx(TableCell, { colSpan: columns.length, className: "h-24 text-center", children: emptyState || "No results." }) })) })] }));
|
|
57
|
+
const getCards = () => (_jsx("div", { className: card?.containerStyle ||
|
|
58
|
+
"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3", children: error
|
|
59
|
+
? error.message || "An error occurred."
|
|
60
|
+
: table.getRowModel().rows?.length
|
|
61
|
+
? table
|
|
62
|
+
.getRowModel()
|
|
63
|
+
.rows.map((row) => card?.component
|
|
64
|
+
? card?.component({ data: row.original })
|
|
65
|
+
: null)
|
|
66
|
+
: emptyState || "No results." }));
|
|
67
|
+
return (_jsxs("div", { className: "space-y-4", children: [(setSearch || actions || (filters && filters.length > 0)) && (_jsx(DataTableToolbar, { table: table, filters: filters, isLoading: isLoading, actions: actions, search: search, setSearch: setSearch, showColumnToggle: showColumnToggle })), _jsx("div", { className: `rounded-md ${!card && "border"}`, children: !card ? getTable() : getCards() }), pagination && (_jsx(DataTablePagination, { table: table, onSetPageSize: onSetPageSize }))] }));
|
|
68
|
+
}
|
|
@@ -3,7 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { forwardRef, useMemo, useState } from "react";
|
|
4
4
|
import { useFormContext } from "react-hook-form";
|
|
5
5
|
import { cn } from "../lib/utils";
|
|
6
|
-
import {
|
|
6
|
+
import { Button } from "../ui/button";
|
|
7
7
|
import { ConformDeleteBtn } from "./deleteConform";
|
|
8
8
|
export const EditFormToolbar = forwardRef((props, forwardedRef) => {
|
|
9
9
|
const { submitText, onSubmit, onCancel, children, enableCancelConform, enableDeleteButton, onDelete, } = props;
|
|
@@ -22,7 +22,7 @@ export const EditFormToolbar = forwardRef((props, forwardedRef) => {
|
|
|
22
22
|
if (!form) {
|
|
23
23
|
throw new Error("SubmitButton must be used within a Form or have a form prop");
|
|
24
24
|
}
|
|
25
|
-
return (_jsxs("div", { className: "flex w-full flex-col p-1", children: [!openConform && (_jsxs("div", { className: "flex justify-end gap-2", children: [_jsx(
|
|
25
|
+
return (_jsxs("div", { className: "flex w-full flex-col p-1", children: [!openConform && (_jsxs("div", { className: "flex justify-end gap-2", children: [_jsx(Button, { variant: "outline", className: " min-w-24", onClick: (e) => {
|
|
26
26
|
e.preventDefault();
|
|
27
27
|
if (enableCancelConform && form?.formState?.isDirty) {
|
|
28
28
|
setOpenConform(true);
|
|
@@ -30,7 +30,7 @@ export const EditFormToolbar = forwardRef((props, forwardedRef) => {
|
|
|
30
30
|
else {
|
|
31
31
|
onCancel?.();
|
|
32
32
|
}
|
|
33
|
-
}, children: "\u53D6\u6D88" }), _jsx(
|
|
33
|
+
}, children: "\u53D6\u6D88" }), _jsx(Button, { form: props.form?.id, type: "submit", disabled: formState.isSubmitting, className: "min-w-24", children: formState.isSubmitting ? "Loading" : submitText || "确定" }), enableDeleteButton && (_jsx(ConformDeleteBtn, { callback: async () => {
|
|
34
34
|
onDelete?.();
|
|
35
35
|
}, disabled: form.formState.isSubmitting, variant: "destructive", children: "\u5220\u9664" }))] })), openConform && (_jsx(ComformCancel, { onBack: () => {
|
|
36
36
|
setOpenConform(false);
|
|
@@ -41,10 +41,10 @@ export const EditFormToolbar = forwardRef((props, forwardedRef) => {
|
|
|
41
41
|
EditFormToolbar.displayName = "EditFormToolbar";
|
|
42
42
|
const ComformCancel = (props) => {
|
|
43
43
|
const { onContinue, onBack } = props;
|
|
44
|
-
return (_jsxs("div", { className: "flex gap-2", children: ["\u672A\u4FDD\u5B58\u66F4\u6539\uFF0C\u786E\u5B9A\u7EE7\u7EED\u5417\uFF1F", _jsx(
|
|
44
|
+
return (_jsxs("div", { className: "flex gap-2", children: ["\u672A\u4FDD\u5B58\u66F4\u6539\uFF0C\u786E\u5B9A\u7EE7\u7EED\u5417\uFF1F", _jsx(Button, { onClick: (e) => {
|
|
45
45
|
e.preventDefault();
|
|
46
46
|
onBack();
|
|
47
|
-
}, children: "\u7EE7\u7EED\u7F16\u8F91" }), _jsx(
|
|
47
|
+
}, children: "\u7EE7\u7EED\u7F16\u8F91" }), _jsx(Button, { variant: "destructive", className: cn(""), onClick: (e) => {
|
|
48
48
|
e.preventDefault();
|
|
49
49
|
onContinue();
|
|
50
50
|
}, children: "\u5173\u95ED" })] }));
|
|
@@ -1,21 +1,19 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { Dialog, DialogContent, DialogDescription, DialogTitle, } from "@radix-ui/react-dialog";
|
|
3
2
|
import { Slot } from "@radix-ui/react-slot";
|
|
4
3
|
import React, { useState } from "react";
|
|
5
4
|
import { cn } from "../lib/utils";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { DialogTrigger } from "../ui/dialog";
|
|
5
|
+
import { Button, buttonVariants } from "../ui/button";
|
|
6
|
+
import { Dialog, DialogContent, DialogDescription, DialogTitle, DialogTrigger, } from "../ui/dialog";
|
|
9
7
|
export const DeleteConformDlg = (props) => {
|
|
10
8
|
const { handleOk } = props;
|
|
11
9
|
const [open, setOpen] = useState(false);
|
|
12
10
|
return (_jsxs(Dialog, { open: open, onOpenChange: setOpen, children: [_jsx(DialogTrigger, { asChild: true, onClick: (e) => {
|
|
13
11
|
e.preventDefault();
|
|
14
12
|
setOpen(true);
|
|
15
|
-
}, children: _jsx(
|
|
13
|
+
}, children: _jsx(Button, { children: "\u5220\u9664" }) }), _jsx(DialogContent, { children: _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Button, { onClick: (e) => {
|
|
16
14
|
e.preventDefault();
|
|
17
|
-
handleOk
|
|
18
|
-
}, children: "\u786E\u5B9A\u5220\u9664" }), _jsx(
|
|
15
|
+
handleOk?.();
|
|
16
|
+
}, children: "\u786E\u5B9A\u5220\u9664" }), _jsx(Button, { onClick: (e) => {
|
|
19
17
|
e.preventDefault();
|
|
20
18
|
setOpen(false);
|
|
21
19
|
}, children: "cancel" })] }) })] }));
|
|
@@ -26,12 +24,12 @@ export const ConformDeleteBtn = React.forwardRef(({ callback, className, variant
|
|
|
26
24
|
return (_jsxs(_Fragment, { children: [_jsx(Comp, { className: cn(buttonVariants({ variant, size, className })), ref: ref, ...props, onClick: (e) => {
|
|
27
25
|
e.preventDefault();
|
|
28
26
|
setDeleteConformOpen(true);
|
|
29
|
-
} }), deleteConformOpen && (_jsx(Dialog, { open: deleteConformOpen, onOpenChange: setDeleteConformOpen, children: _jsxs(DialogContent, { children: [_jsx(DialogTitle, { children: "\u786E\u8BA4" }), _jsx(DialogDescription, { children: "\u5C06\u5220\u9664\u8BB0\u5F55\uFF0C\u786E\u8BA4\u7EE7\u7EED\u5417\uFF1F" }), _jsx(
|
|
27
|
+
} }), deleteConformOpen && (_jsx(Dialog, { open: deleteConformOpen, onOpenChange: setDeleteConformOpen, children: _jsxs(DialogContent, { children: [_jsx(DialogTitle, { children: "\u786E\u8BA4" }), _jsx(DialogDescription, { children: "\u5C06\u5220\u9664\u8BB0\u5F55\uFF0C\u786E\u8BA4\u7EE7\u7EED\u5417\uFF1F" }), _jsx(Button, { variant: "destructive", onClick: async () => {
|
|
30
28
|
if (callback) {
|
|
31
29
|
await callback();
|
|
32
30
|
setDeleteConformOpen(false);
|
|
33
31
|
}
|
|
34
|
-
}, children: "\u5220\u9664\u786E\u8BA4" }), _jsx(
|
|
32
|
+
}, children: "\u5220\u9664\u786E\u8BA4" }), _jsx(Button, { variant: "outline", onClick: () => {
|
|
35
33
|
setDeleteConformOpen(false);
|
|
36
34
|
}, children: "Cancel" })] }) }))] }));
|
|
37
35
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function
|
|
1
|
+
export declare function useCanGoBack(): boolean;
|