mtxuilib 0.1.8 → 0.1.11
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/{DeleteComfirm.jsx → DeleteComfirm.js} +9 -22
- package/dist/common/FullCenter.js +6 -0
- package/dist/common/{GlobalSearch.jsx → GlobalSearch.js} +2 -4
- package/dist/common/{MtImage.jsx → MtImage.js} +2 -1
- package/dist/common/MtProgressBar.js +6 -0
- package/dist/common/NotFoundGoBack.js +10 -0
- package/dist/common/SlntTree/{SlntChildrenTabs.jsx → SlntChildrenTabs.js} +5 -12
- package/dist/common/SlntTree/{SlntTreeNode.jsx → SlntTreeNode.js} +3 -5
- package/dist/common/devtools/DebugValue.js +8 -0
- package/dist/common/devtools/{DevTools.jsx → DevTools.js} +2 -4
- package/dist/common/{mtlink.jsx → mtlink.js} +3 -4
- package/dist/common/pip/PipExamplePage.js +20 -0
- package/dist/common/pip/{ReactDocumentPictureInPicture.jsx → ReactDocumentPictureInPicture.js} +6 -11
- package/dist/common/react-markdown/Code.js +9 -0
- package/dist/common/react-markdown/{MarkdownToolbar.jsx → MarkdownToolbar.js} +2 -5
- package/dist/common/react-markdown/ReactMarkdownExample.js +19 -0
- package/dist/common/schema-form/SchemaFormFieldsRender.js +12 -0
- package/dist/common/schema-form/{SchemaFormView.jsx → SchemaFormView.js} +3 -15
- package/dist/common/table/SimpleTable.js +10 -0
- package/dist/common/table/cells/ExpenderCell.js +7 -0
- package/dist/common/table/cells/SelectCell.js +19 -0
- package/dist/common/table/cells/{Text.jsx → Text.js} +2 -4
- package/dist/common/table/cells/ViewLink.js +19 -0
- package/dist/common/table/cells/container/cellWrapper.js +5 -0
- package/dist/common/table/cells/number.js +10 -0
- package/dist/common/table/cells/{string.jsx → string.js} +2 -5
- package/dist/common/table/data-table-pagination.js +10 -0
- package/dist/common/table/data-table-view-options.js +13 -0
- package/dist/common/table/example/{ExampleTable.jsx → ExampleTable.js} +7 -25
- package/dist/common/table/header/SimpleHeader.js +16 -0
- package/dist/common/table/header/header.js +16 -0
- package/dist/common/tailwind-indicator.js +7 -0
- package/dist/common/theme/mode-toggle.js +10 -0
- package/dist/common/theme/theme-toggle.js +9 -0
- package/dist/common/tiptap/MenuBar.js +34 -0
- package/dist/common/tiptap/{TiptapEditor.jsx → TiptapEditor.js} +7 -17
- package/dist/common/tiptap/examples/Demo-Default.js +84 -0
- package/dist/common/tiptap/examples/{Demo-Tiptap.jsx → Demo-Tiptap.js} +2 -1
- package/dist/demos/bigcode/BigCode.js +11 -0
- package/dist/demos/condition-type/{serialize.jsx → serialize.js} +2 -3
- package/dist/demos/{demo-react-use.jsx → demo-react-use.js} +2 -3
- package/dist/demos/scrollarea/LongListDemo.js +7 -0
- package/dist/demos/scrollarea/ScrollAreaDemo.js +14 -0
- package/dist/demos/suspense-ssr/ExampleOg.js +7 -0
- package/dist/demos/suspense-ssr/ExamplePage.js +13 -0
- package/dist/demos/suspense-ssr/{ExampleProviderProviders.jsx → ExampleProviderProviders.js} +2 -3
- package/dist/demos/suspense-ssr/ReadMe.js +6 -0
- package/dist/demos/suspense-ssr/{examplesPostDetail.jsx → examplesPostDetail.js} +3 -11
- package/dist/demos/suspense-ssr/examplesPosts.js +17 -0
- package/dist/form/EditFormToolbar.js +43 -0
- package/dist/form/ZodForm.js +34 -0
- package/dist/form/deleteConform.js +38 -0
- package/dist/icons/crazy-spinner.js +5 -0
- package/dist/icons/font-default.js +4 -0
- package/dist/icons/font-mono.js +4 -0
- package/dist/icons/font-serif.js +4 -0
- package/dist/icons/github.js +4 -0
- package/dist/icons/icons.js +147 -0
- package/dist/icons/loading-circle.js +4 -0
- package/dist/icons/magic.js +4 -0
- package/dist/lib/htmlparse/components/ItemActionButton.js +17 -0
- package/dist/lib/htmlparse/htmlParse.js +32 -0
- package/dist/lib/react-query/{ReactQueryProvider.jsx → ReactQueryProvider.js} +4 -16
- package/dist/lib/{render.jsx → render.js} +2 -1
- package/dist/lib/service-worker/{ServiceWorkerMain.jsx → ServiceWorkerMain.js} +5 -11
- package/dist/lib/trpc-query/TrpcComponents/TrpcDehydrate.js +7 -0
- package/dist/misc/CustomErrorRetry.js +9 -0
- package/dist/misc/{ExampleErrorDemo.jsx → ExampleErrorDemo.js} +3 -6
- package/dist/misc/{MtErrorBoundary.jsx → MtErrorBoundary.js} +3 -12
- package/dist/misc/{MtErrorBoundary.stories.jsx → MtErrorBoundary.stories.js} +4 -3
- package/dist/misc/MtErrorBoundaryV2.js +7 -0
- package/dist/misc/{MtErrorBoundaryV2.stories.jsx → MtErrorBoundaryV2.stories.js} +4 -3
- package/dist/mtapp/{History.jsx → History.js} +2 -3
- package/dist/mtapp/{MtAppProvider.jsx → MtAppProvider.js} +2 -4
- package/dist/mtedtior/{AiButtons.jsx → AiButtons.js} +2 -4
- package/dist/mtedtior/{MtEditor.jsx → MtEditor.js} +20 -61
- package/dist/mtedtior/components/{editor-bubble-item.jsx → editor-bubble-item.js} +2 -3
- package/dist/mtedtior/components/{editor-bubble.jsx → editor-bubble.js} +2 -6
- package/dist/mtedtior/components/{editor-command-item.jsx → editor-command-item.js} +2 -3
- package/dist/mtedtior/components/{editor-command.jsx → editor-command.js} +5 -13
- package/dist/mtedtior/components/{editor.jsx → editor.js} +3 -6
- package/dist/mtedtior/extensions/{image-resizer.jsx → image-resizer.js} +5 -4
- package/dist/mtedtior/extensions/{slash-command.jsx → slash-command.js} +12 -11
- package/dist/mtedtior/generative/ai-completion-command.js +30 -0
- package/dist/mtedtior/generative/ai-selector-commands.js +42 -0
- package/dist/mtedtior/generative/ai-selector.js +48 -0
- package/dist/mtedtior/generative/{generative-menu-switch.jsx → generative-menu-switch.js} +3 -11
- package/dist/mtedtior/mtextesions/{DemoComponent.jsx → DemoComponent.js} +2 -4
- package/dist/mtedtior/selectors/color-selector.js +104 -0
- package/dist/mtedtior/selectors/link-selector.js +50 -0
- package/dist/mtedtior/selectors/{node-selector.jsx → node-selector.js} +5 -22
- package/dist/mtedtior/selectors/{text-buttons.jsx → text-buttons.js} +5 -10
- package/dist/service-worker/{ServiceWorkerMain.jsx → ServiceWorkerMain.js} +5 -11
- package/dist/styles/globals.css +219 -0
- package/dist/styles/index.css +3 -0
- package/dist/styles/main.css +12 -0
- package/dist/styles/prosemirror.css +171 -0
- package/dist/ui/accordion.js +14 -0
- package/dist/ui/alert-dialog.js +27 -0
- package/dist/ui/{alert.jsx → alert.js} +4 -3
- package/dist/ui/{avatar.jsx → avatar.js} +4 -3
- package/dist/ui/{badge.jsx → badge.js} +2 -2
- package/dist/ui/breadcrumb.js +23 -0
- package/dist/ui/{button.jsx → button.js} +2 -1
- package/dist/ui/{calendar.jsx → calendar.js} +6 -6
- package/dist/ui/{card.jsx → card.js} +7 -6
- package/dist/ui/checkbox.js +9 -0
- package/dist/ui/command.js +29 -0
- package/dist/ui/context-menu.js +34 -0
- package/dist/ui/dialog.js +23 -0
- package/dist/ui/drawer.js +23 -0
- package/dist/ui/dropdown-menu.js +36 -0
- package/dist/ui/{form.jsx → form.js} +8 -13
- package/dist/ui/hover-card.js +10 -0
- package/dist/ui/input.js +8 -0
- package/dist/ui/{label.jsx → label.js} +2 -1
- package/dist/ui/menubar.js +36 -0
- package/dist/ui/navigation-menu.js +25 -0
- package/dist/ui/pagination.js +23 -0
- package/dist/ui/popover.js +10 -0
- package/dist/ui/progress.js +8 -0
- package/dist/ui/radio-group.js +15 -0
- package/dist/ui/resizable.js +9 -0
- package/dist/ui/scroll-area.js +12 -0
- package/dist/ui/select.js +22 -0
- package/dist/ui/separator.js +8 -0
- package/dist/ui/{sheet.jsx → sheet.js} +7 -15
- package/dist/ui/skeleton.js +6 -0
- package/dist/ui/slider.js +8 -0
- package/dist/ui/{sonner.jsx → sonner.js} +3 -2
- package/dist/ui/switch.js +8 -0
- package/dist/ui/table.js +20 -0
- package/dist/ui/tabs.js +13 -0
- package/dist/ui/textarea.js +8 -0
- package/dist/ui/{toast.jsx → toast.js} +7 -8
- package/dist/ui/toaster.js +10 -0
- package/dist/ui/{toggle.jsx → toggle.js} +2 -1
- package/dist/ui/tooltip.js +11 -0
- package/dist/ui-mt/Boundary.js +10 -0
- package/dist/ui-mt/{DropdownMenuItemLink.jsx → DropdownMenuItemLink.js} +2 -3
- package/dist/ui-mt/ErrorMessage.js +6 -0
- package/dist/ui-mt/{ExampleTree.jsx → ExampleTree.js} +2 -6
- package/dist/ui-mt/{MtDialog.jsx → MtDialog.js} +4 -5
- package/dist/ui-mt/NavTag.js +28 -0
- package/dist/ui-mt/ScreenPanel.js +9 -0
- package/dist/ui-mt/{SimpleModel.jsx → SimpleModel.js} +2 -5
- package/dist/ui-mt/SimpleTag.js +6 -0
- package/dist/ui-mt/Tree.js +63 -0
- package/dist/ui-mt/{WithLinkIf.jsx → WithLinkIf.js} +2 -1
- package/dist/ui-mt/headline.js +4 -0
- package/dist/ui-mt/input-field/InputField.js +21 -0
- package/dist/ui-mt/input-field/{RichEditorInput.jsx → RichEditorInput.js} +5 -6
- package/dist/ui-mt/input-field/SingleUploadForm.js +62 -0
- package/dist/ui-mt/input-field/TextArea.js +13 -0
- package/dist/ui-mt/input-field/{TextFileInput.jsx → TextFileInput.js} +5 -8
- package/dist/ui-mt/input-field/select/InputSelect.js +16 -0
- package/dist/ui-mt/inputs/SearchInput.js +10 -0
- package/dist/ui-mt/inputs/TaskStatusInput.js +22 -0
- package/dist/ui-mt/inputs/{UrlsInput.jsx → UrlsInput.js} +2 -3
- package/dist/ui-mt/modal/{MtModal.jsx → MtModal.js} +3 -9
- package/dist/ui-mt/mt-tree-view/{mt-tree-view-api.jsx → mt-tree-view-api.js} +19 -45
- package/dist/ui-mt/mt-tree-view/mt-treeview.js +26 -0
- package/dist/ui-mt/pagination.js +30 -0
- package/dist/ui-mt/skeleton/NewLoading.js +6 -0
- package/dist/ui-mt/skeleton/SkeletonInput.js +5 -0
- package/dist/ui-mt/skeleton/SkeletonLayout.js +6 -0
- package/dist/ui-mt/skeleton/SkeletonLoading.js +10 -0
- package/dist/ui-mt/skeleton/skeleton-card.js +5 -0
- package/dist/ui-mt/skeleton/skeleton2.js +4 -0
- package/dist/ui-mt/skeleton/skeletons.js +6 -0
- package/dist/ui-mt/skeleton.js +5 -0
- package/dist/ui-vamp/alert.js +37 -0
- package/dist/ui-vamp/{button.jsx → button.js} +2 -1
- package/dist/ui-vamp/card.js +24 -0
- package/dist/ui-vamp/{chip.jsx → chip.js} +2 -1
- package/dist/ui-vamp/dropdown.js +24 -0
- package/dist/ui-vamp/external-link.js +5 -0
- package/dist/ui-vamp/{input.jsx → input.js} +4 -13
- package/dist/ui-vamp/keyvalue.js +4 -0
- package/dist/ui-vamp/mobile-nav-button.js +9 -0
- package/dist/ui-vamp/modal.js +18 -0
- package/dist/ui-vamp/{textarea.jsx → textarea.js} +2 -4
- package/dist/ui-vamp/toggle-group.js +11 -0
- package/dist/video-player/{mt-video-player.jsx → mt-video-player.js} +2 -11
- package/dist/video-player/video-player2/modal-video-player.js +12 -0
- package/package.json +2 -4
- package/dist/common/FullCenter.jsx +0 -7
- package/dist/common/MtProgressBar.jsx +0 -5
- package/dist/common/NotFoundGoBack.jsx +0 -15
- package/dist/common/devtools/DebugValue.jsx +0 -16
- package/dist/common/pip/PipExamplePage.jsx +0 -42
- package/dist/common/react-markdown/Code.jsx +0 -12
- package/dist/common/react-markdown/ReactMarkdownExample.jsx +0 -27
- package/dist/common/schema-form/SchemaFormFieldsRender.jsx +0 -22
- package/dist/common/table/SimpleTable.jsx +0 -26
- package/dist/common/table/cells/ExpenderCell.jsx +0 -10
- package/dist/common/table/cells/SelectCell.jsx +0 -32
- package/dist/common/table/cells/ViewLink.jsx +0 -32
- package/dist/common/table/cells/container/cellWrapper.jsx +0 -6
- package/dist/common/table/cells/number.jsx +0 -11
- package/dist/common/table/data-table-pagination.jsx +0 -49
- package/dist/common/table/data-table-view-options.jsx +0 -26
- package/dist/common/table/header/SimpleHeader.jsx +0 -39
- package/dist/common/table/header/header.jsx +0 -15
- package/dist/common/tailwind-indicator.jsx +0 -13
- package/dist/common/theme/mode-toggle.jsx +0 -28
- package/dist/common/theme/theme-toggle.jsx +0 -12
- package/dist/common/tiptap/MenuBar.jsx +0 -100
- package/dist/common/tiptap/examples/Demo-Default.jsx +0 -152
- package/dist/demos/bigcode/BigCode.jsx +0 -16
- package/dist/demos/scrollarea/LongListDemo.jsx +0 -8
- package/dist/demos/scrollarea/ScrollAreaDemo.jsx +0 -43
- package/dist/demos/suspense-ssr/ExampleOg.jsx +0 -19
- package/dist/demos/suspense-ssr/ExamplePage.jsx +0 -55
- package/dist/demos/suspense-ssr/ReadMe.jsx +0 -44
- package/dist/demos/suspense-ssr/examplesPosts.jsx +0 -24
- package/dist/form/EditFormToolbar.jsx +0 -67
- package/dist/form/ZodForm.jsx +0 -35
- package/dist/form/deleteConform.jsx +0 -65
- package/dist/icons/crazy-spinner.jsx +0 -8
- package/dist/icons/font-default.jsx +0 -6
- package/dist/icons/font-mono.jsx +0 -6
- package/dist/icons/font-serif.jsx +0 -6
- package/dist/icons/github.jsx +0 -5
- package/dist/icons/icons.jsx +0 -188
- package/dist/icons/loading-circle.jsx +0 -6
- package/dist/icons/magic.jsx +0 -7
- package/dist/lib/htmlparse/components/ItemActionButton.jsx +0 -58
- package/dist/lib/htmlparse/htmlParse.jsx +0 -50
- package/dist/lib/trpc-query/TrpcComponents/TrpcDehydrate.jsx +0 -11
- package/dist/misc/CustomErrorRetry.jsx +0 -13
- package/dist/misc/MtErrorBoundaryV2.jsx +0 -13
- package/dist/mtedtior/generative/ai-completion-command.jsx +0 -48
- package/dist/mtedtior/generative/ai-selector-commands.jsx +0 -55
- package/dist/mtedtior/generative/ai-selector.jsx +0 -72
- package/dist/mtedtior/selectors/color-selector.jsx +0 -138
- package/dist/mtedtior/selectors/link-selector.jsx +0 -68
- package/dist/ui/accordion.jsx +0 -20
- package/dist/ui/alert-dialog.jsx +0 -29
- package/dist/ui/breadcrumb.jsx +0 -27
- package/dist/ui/checkbox.jsx +0 -12
- package/dist/ui/command.jsx +0 -37
- package/dist/ui/context-menu.jsx +0 -52
- package/dist/ui/dialog.jsx +0 -31
- package/dist/ui/drawer.jsx +0 -28
- package/dist/ui/dropdown-menu.jsx +0 -54
- package/dist/ui/hover-card.jsx +0 -9
- package/dist/ui/input.jsx +0 -7
- package/dist/ui/menubar.jsx +0 -54
- package/dist/ui/navigation-menu.jsx +0 -34
- package/dist/ui/pagination.jsx +0 -31
- package/dist/ui/popover.jsx +0 -11
- package/dist/ui/progress.jsx +0 -9
- package/dist/ui/radio-group.jsx +0 -18
- package/dist/ui/resizable.jsx +0 -12
- package/dist/ui/scroll-area.jsx +0 -19
- package/dist/ui/select.jsx +0 -39
- package/dist/ui/separator.jsx +0 -7
- package/dist/ui/skeleton.jsx +0 -5
- package/dist/ui/slider.jsx +0 -12
- package/dist/ui/switch.jsx +0 -9
- package/dist/ui/table.jsx +0 -21
- package/dist/ui/tabs.jsx +0 -12
- package/dist/ui/textarea.jsx +0 -7
- package/dist/ui/toaster.jsx +0 -19
- package/dist/ui/tooltip.jsx +0 -10
- package/dist/ui-mt/Boundary.jsx +0 -16
- package/dist/ui-mt/ErrorMessage.jsx +0 -7
- package/dist/ui-mt/NavTag.jsx +0 -35
- package/dist/ui-mt/ScreenPanel.jsx +0 -10
- package/dist/ui-mt/SimpleTag.jsx +0 -7
- package/dist/ui-mt/Tree.jsx +0 -98
- package/dist/ui-mt/headline.jsx +0 -8
- package/dist/ui-mt/input-field/InputField.jsx +0 -40
- package/dist/ui-mt/input-field/SingleUploadForm.jsx +0 -83
- package/dist/ui-mt/input-field/TextArea.jsx +0 -20
- package/dist/ui-mt/input-field/select/InputSelect.jsx +0 -44
- package/dist/ui-mt/inputs/SearchInput.jsx +0 -12
- package/dist/ui-mt/inputs/TaskStatusInput.jsx +0 -38
- package/dist/ui-mt/mt-tree-view/mt-treeview.jsx +0 -40
- package/dist/ui-mt/pagination.jsx +0 -49
- package/dist/ui-mt/skeleton/NewLoading.jsx +0 -31
- package/dist/ui-mt/skeleton/SkeletonInput.jsx +0 -6
- package/dist/ui-mt/skeleton/SkeletonLayout.jsx +0 -8
- package/dist/ui-mt/skeleton/SkeletonLoading.jsx +0 -14
- package/dist/ui-mt/skeleton/skeleton-card.jsx +0 -10
- package/dist/ui-mt/skeleton/skeleton2.jsx +0 -8
- package/dist/ui-mt/skeleton/skeletons.jsx +0 -12
- package/dist/ui-mt/skeleton.jsx +0 -4
- package/dist/ui-vamp/alert.jsx +0 -45
- package/dist/ui-vamp/card.jsx +0 -32
- package/dist/ui-vamp/dropdown.jsx +0 -25
- package/dist/ui-vamp/external-link.jsx +0 -6
- package/dist/ui-vamp/keyvalue.jsx +0 -6
- package/dist/ui-vamp/mobile-nav-button.jsx +0 -13
- package/dist/ui-vamp/modal.jsx +0 -22
- package/dist/ui-vamp/toggle-group.jsx +0 -10
- package/dist/video-player/video-player2/modal-video-player.jsx +0 -43
- /package/dist/common/SlntTree/{Slnt.z.jsx → Slnt.z.js} +0 -0
- /package/dist/common/{TrpcQuery.jsx → TrpcQuery.js} +0 -0
- /package/dist/common/table/{datatable-view-options.jsx → datatable-view-options.js} +0 -0
- /package/dist/demos/{lib.jsx → lib.js} +0 -0
- /package/dist/hooks/{use-media-query.jsx → use-media-query.js} +0 -0
- /package/dist/hooks/{useIsIntersecting.jsx → useIsIntersecting.js} +0 -0
- /package/dist/icons/{Cross2Icon.jsx → Cross2Icon.js} +0 -0
- /package/dist/icons/{DotsHorizontalIcon.jsx → DotsHorizontalIcon.js} +0 -0
- /package/dist/icons/{MixerHorizontal.jsx → MixerHorizontal.js} +0 -0
- /package/dist/icons/{index.jsx → index.js} +0 -0
- /package/dist/mtedtior/extensions/{drag-and-drop.jsx → drag-and-drop.js} +0 -0
- /package/dist/mtedtior/plugins/{upload-images.jsx → upload-images.js} +0 -0
- /package/dist/mtedtior/{utils.jsx → utils.js} +0 -0
- /package/dist/ui/{aspect-ratio.jsx → aspect-ratio.js} +0 -0
- /package/dist/ui/{collapsible.jsx → collapsible.js} +0 -0
- /package/dist/ui-mt/{Button.jsx → Button.js} +0 -0
- /package/dist/ui-mt/{MtForm.jsx → MtForm.js} +0 -0
- /package/dist/ui-mt/{Separator.jsx → Separator.js} +0 -0
- /package/dist/ui-mt/{Slot.jsx → Slot.js} +0 -0
- /package/dist/ui-mt/inputs/{input.jsx → input.js} +0 -0
- /package/dist/ui-mt/mt-tree-view/{MtTreeViewExample.jsx → MtTreeViewExample.js} +0 -0
- /package/dist/ui-mt/skeleton/{SkeletonDashboardShell.jsx → SkeletonDashboardShell.js} +0 -0
- /package/dist/ui-mt/{types.jsx → types.js} +0 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
3
|
import { createContext, useCallback, useContext, useMemo } from "react";
|
|
3
4
|
import { createStore, useStore } from "zustand";
|
|
4
5
|
import { immer } from "zustand/middleware/immer";
|
|
@@ -18,10 +19,7 @@ const formContext = createContext(null);
|
|
|
18
19
|
export const DeleteConfirmProvider = (props) => {
|
|
19
20
|
const { children, ...etc } = props;
|
|
20
21
|
const mystore = useMemo(() => createDeleteConformStore(etc), [etc]);
|
|
21
|
-
return (
|
|
22
|
-
{children}
|
|
23
|
-
<DeleteConfirmDlg />
|
|
24
|
-
</formContext.Provider>);
|
|
22
|
+
return (_jsxs(formContext.Provider, { value: mystore, children: [children, _jsx(DeleteConfirmDlg, {})] }));
|
|
25
23
|
};
|
|
26
24
|
function useDeleteConfirmStore(selector) {
|
|
27
25
|
const store = useContext(formContext);
|
|
@@ -44,22 +42,11 @@ export const DeleteConfirmDlg = () => {
|
|
|
44
42
|
const open = useDeleteConfirmStore((x) => x.open);
|
|
45
43
|
const setOpen = useDeleteConfirmStore((x) => x.setOpen);
|
|
46
44
|
const confirmCallback = useDeleteConfirmStore((x) => x.confirmCallback);
|
|
47
|
-
return (
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}}>
|
|
55
|
-
Continue
|
|
56
|
-
</MtButton>
|
|
57
|
-
<MtButton variant={"outline"} onClick={() => {
|
|
58
|
-
setOpen(false);
|
|
59
|
-
confirmCallback && confirmCallback();
|
|
60
|
-
}}>
|
|
61
|
-
Cancel
|
|
62
|
-
</MtButton>
|
|
63
|
-
</DialogContent>
|
|
64
|
-
</Dialog>);
|
|
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(MtButton, { variant: "destructive", onClick: async () => {
|
|
46
|
+
setOpen(false);
|
|
47
|
+
confirmCallback && confirmCallback();
|
|
48
|
+
}, children: "Continue" }), _jsx(MtButton, { variant: "outline", onClick: () => {
|
|
49
|
+
setOpen(false);
|
|
50
|
+
confirmCallback && confirmCallback();
|
|
51
|
+
}, children: "Cancel" })] }) }));
|
|
65
52
|
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
export const FullCenter = (props) => {
|
|
4
|
+
const { children } = props;
|
|
5
|
+
return (_jsx("div", { className: "flex h-full w-full items-center justify-center", children: _jsx("div", { className: "flex-1", children: children }) }));
|
|
6
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
3
|
import { createContext, useContext, useMemo } from "react";
|
|
3
4
|
import { createStore, useStore } from "zustand";
|
|
4
5
|
export const createFormSlice = (set, get) => ({
|
|
@@ -14,10 +15,7 @@ const formContext = createContext(null);
|
|
|
14
15
|
export const GlobalSearchProvider = (props) => {
|
|
15
16
|
const { children, ...etc } = props;
|
|
16
17
|
const mystore = useMemo(() => createDeleteConformStore(etc), [etc]);
|
|
17
|
-
return (
|
|
18
|
-
{children}
|
|
19
|
-
|
|
20
|
-
</formContext.Provider>);
|
|
18
|
+
return (_jsx(formContext.Provider, { value: mystore, children: children }));
|
|
21
19
|
};
|
|
22
20
|
export function useGlobalSearch(selector) {
|
|
23
21
|
const store = useContext(formContext);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
2
|
import { isCloudflarePage } from 'mtxlib/utils';
|
|
2
3
|
import Image from 'next/image';
|
|
3
4
|
const normalizeSrc = (src) => {
|
|
@@ -23,5 +24,5 @@ function getImageLoader() {
|
|
|
23
24
|
}
|
|
24
25
|
}
|
|
25
26
|
export const MtImage = (props) => {
|
|
26
|
-
return
|
|
27
|
+
return _jsx(Image, { ...props, loader: getImageLoader() });
|
|
27
28
|
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { AppProgressBar } from "next-nprogress-bar";
|
|
4
|
+
export const MtProgressBar = () => {
|
|
5
|
+
return _jsx(AppProgressBar, { height: "4px", color: "#4934eb", options: { showSpinner: false }, shallowRouting: true });
|
|
6
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useRouter } from "next/navigation";
|
|
4
|
+
import { Button } from "../ui/button";
|
|
5
|
+
export const NotFoundGoBack = () => {
|
|
6
|
+
const router = useRouter();
|
|
7
|
+
return (_jsxs("div", { className: "container flex flex-col", children: [_jsx("div", { className: "mx-auto p-8", children: "not found" }), _jsx(Button, { className: "mx-auto p-8", onClick: () => {
|
|
8
|
+
router.back();
|
|
9
|
+
}, children: "Go back" })] }));
|
|
10
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
3
|
import { urlJoinPaths } from "mtxlib/http/url";
|
|
3
4
|
import { usePathname, useSelectedLayoutSegment, useSelectedLayoutSegments, } from "next/navigation";
|
|
4
5
|
import { cn } from "../../lib/utils";
|
|
@@ -11,23 +12,15 @@ export const SlntChildrenTabs = () => {
|
|
|
11
12
|
const segment = useSelectedLayoutSegment();
|
|
12
13
|
const basePath = pathName.slice(0, -segments.join("/").length);
|
|
13
14
|
const basePath3 = "/" + segments.join("/");
|
|
14
|
-
return (
|
|
15
|
-
|
|
16
|
-
{parentData?.children?.map((item, i) => {
|
|
15
|
+
return (_jsx("div", { className: "flex gap-1 ", children: parentData?.children?.map((item, i) => {
|
|
17
16
|
let href = `${urlJoinPaths(basePath, item.routeName || "")}`;
|
|
18
17
|
if (!segments?.length) {
|
|
19
18
|
href = urlJoinPaths(pathName, item.routeName || "");
|
|
20
19
|
}
|
|
21
|
-
return (
|
|
22
|
-
|
|
23
|
-
{item.label}
|
|
24
|
-
</MtLink>
|
|
25
|
-
|
|
26
|
-
</TabItem>);
|
|
27
|
-
})}
|
|
28
|
-
</div>);
|
|
20
|
+
return (_jsx(TabItem, { activate: segment == item.routeName, children: _jsx(MtLink, { variant: "ghost", href: href, children: item.label }, i) }, i));
|
|
21
|
+
}) }));
|
|
29
22
|
};
|
|
30
23
|
const TabItem = (props) => {
|
|
31
24
|
const { activate, ...etc } = props;
|
|
32
|
-
return (
|
|
25
|
+
return (_jsx("div", { "data-state": activate && "active", className: cn("ring-offset-background focus-visible:ring-ring data-[state=active]:bg-background data-[state=active]:text-foreground inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow"), ...etc }));
|
|
33
26
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
3
|
import { useSelectedLayoutSegment, useSelectedLayoutSegments, } from "next/navigation";
|
|
3
4
|
import { createContext, useContext, useMemo } from "react";
|
|
4
5
|
import { useStore } from "zustand";
|
|
@@ -14,7 +15,7 @@ export const slntContext = createContext(null);
|
|
|
14
15
|
export const MenuTreeProvider = (props) => {
|
|
15
16
|
const { children, ...etc } = props;
|
|
16
17
|
const mystore = useMemo(() => createModalStore(etc), [etc]);
|
|
17
|
-
return (
|
|
18
|
+
return (_jsx(slntContext.Provider, { value: mystore, children: children }));
|
|
18
19
|
};
|
|
19
20
|
export const DEFAULT_USE_SHALLOW = true;
|
|
20
21
|
export function useMenuTreeStore(selector) {
|
|
@@ -40,8 +41,5 @@ export const SlntTreeNode = (props) => {
|
|
|
40
41
|
console.log({ message: `(SlntTreeNode)${segment}`, fined, parent });
|
|
41
42
|
return fined;
|
|
42
43
|
}, [parent, segment]);
|
|
43
|
-
return (
|
|
44
|
-
|
|
45
|
-
{children}
|
|
46
|
-
</MenuTreeProvider>);
|
|
44
|
+
return (_jsx(MenuTreeProvider, { menuNode: currNode, children: children }));
|
|
47
45
|
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { MtButton } from "../../ui-mt/Button";
|
|
4
|
+
import { Dialog, DialogContent, DialogTrigger } from "../../ui/dialog";
|
|
5
|
+
export const DebugValue = (props) => {
|
|
6
|
+
const { title, data, className } = props;
|
|
7
|
+
return (_jsxs(Dialog, { children: [_jsx(DialogTrigger, { asChild: true, children: _jsx(MtButton, { variant: "outline", className: className, children: title || "debug" }) }), _jsx(DialogContent, { className: "max-h-lvh w-full overflow-scroll bg-red-100", children: _jsx("pre", { className: " text-xs", children: JSON.stringify(data, null, 2) }) })] }));
|
|
8
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
3
|
import dynamic from "next/dynamic";
|
|
3
4
|
import { useHotkeys } from "react-hotkeys-hook";
|
|
4
5
|
import { useMtapp } from "../../mtapp/MtAppProvider";
|
|
@@ -19,8 +20,5 @@ export const DevTools = () => {
|
|
|
19
20
|
if (!debug) {
|
|
20
21
|
return null;
|
|
21
22
|
}
|
|
22
|
-
return (
|
|
23
|
-
<ReactQueryDevtoolsProduction buttonPosition="bottom-right"/>
|
|
24
|
-
<TailwindIndicator />
|
|
25
|
-
</>);
|
|
23
|
+
return (_jsxs(_Fragment, { children: [_jsx(ReactQueryDevtoolsProduction, { buttonPosition: "bottom-right" }), _jsx(TailwindIndicator, {})] }));
|
|
26
24
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
3
|
import { Slot } from "@radix-ui/react-slot";
|
|
3
4
|
import Link from "next/link";
|
|
4
5
|
import React from "react";
|
|
@@ -6,11 +7,9 @@ import { cn } from "../lib/utils";
|
|
|
6
7
|
import { buttonVariants } from "../ui/button";
|
|
7
8
|
export const MtLink = React.forwardRef(({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
8
9
|
const Comp = asChild ? Slot : Link;
|
|
9
|
-
return (
|
|
10
|
+
return (_jsx(Comp, { className: cn(((variant) && buttonVariants({ variant: variant, className }))), ref: ref, ...props }));
|
|
10
11
|
});
|
|
11
12
|
MtLink.displayName = "MtLink";
|
|
12
13
|
export function MtExternalLink({ children, className, ...props }) {
|
|
13
|
-
return (
|
|
14
|
-
{children}
|
|
15
|
-
</a>);
|
|
14
|
+
return (_jsx("a", { className: cn(className, "hover:text-brandtext-500 hover:underline hover:brightness-150"), rel: "noopener noreferrer", ...props, children: children }));
|
|
16
15
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import ReactDocumentPictureInPicture from "mtxuilib/common/pip/ReactDocumentPictureInPicture";
|
|
4
|
+
import { MtButton } from "mtxuilib/ui-mt/Button";
|
|
5
|
+
import { useRef, useState } from "react";
|
|
6
|
+
export default function PipExamplePage() {
|
|
7
|
+
const pipWindowRef = useRef(null);
|
|
8
|
+
return (_jsx(_Fragment, { children: _jsx(ReactDocumentPictureInPicture, { ref: pipWindowRef, width: "50%", height: "100%", buttonRenderer: ({ open, close, toggle, isOpen }) => (_jsxs("div", { className: "flex gap-2", children: [_jsxs("b", { children: ["Is ", isOpen ? "Open" : "Closed", " "] }), _jsx(MtButton, { onClick: open, children: "Open" }), _jsx(MtButton, { onClick: close, children: "Close" }), _jsx(MtButton, { onClick: toggle, children: "Toggle" })] })), children: _jsx(Comp, { pipWindowRef: pipWindowRef }) }) }));
|
|
9
|
+
}
|
|
10
|
+
const Comp = (props) => {
|
|
11
|
+
const { pipWindowRef } = props;
|
|
12
|
+
const [text, setText] = useState("tet1");
|
|
13
|
+
return (_jsxs("div", { className: "prose", children: [_jsx("h1", { children: "\u753B\u4E2D\u753B\u663E\u793A\uFF08\u8303\u4F8B\uFF09" }), _jsxs("div", { children: [_jsx("button", { onClick: () => {
|
|
14
|
+
console.log("关闭");
|
|
15
|
+
setText("ssssssssssssssss");
|
|
16
|
+
}, children: "sssss" }), _jsxs(MtButton, { onClick: () => {
|
|
17
|
+
console.log("关闭");
|
|
18
|
+
setText("ssssssssssssssss");
|
|
19
|
+
}, children: ["\u5173\u95ED333 ", text] })] }), _jsx("i", { children: "This text should be displayed in a Document Picture in Picture filling the maximum allow height and 50% of the width of the original window" })] }));
|
|
20
|
+
};
|
package/dist/common/pip/{ReactDocumentPictureInPicture.jsx → ReactDocumentPictureInPicture.js}
RENAMED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
3
|
import { forwardRef, useCallback, useImperativeHandle, useMemo, useRef, useState } from "react";
|
|
3
4
|
export var FeatureUnavailableReasonEnum;
|
|
4
5
|
(function (FeatureUnavailableReasonEnum) {
|
|
@@ -106,17 +107,11 @@ const ReactDocumentPictureInPicture = forwardRef((props, ref) => {
|
|
|
106
107
|
return featureUnavailableRenderer;
|
|
107
108
|
}
|
|
108
109
|
const buttonRenderer = typeof props.buttonRenderer === "function" ? props.buttonRenderer({ open, close, toggle, isOpen }) : props.buttonRenderer;
|
|
109
|
-
return (
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
width: '100%',
|
|
115
|
-
height: '100%',
|
|
116
|
-
}}>
|
|
117
|
-
{props.children}
|
|
118
|
-
</div>
|
|
119
|
-
</div>);
|
|
110
|
+
return (_jsxs("div", { children: [buttonRenderer, _jsx("div", { ref: contentRef, style: {
|
|
111
|
+
display: isOpen ? 'block' : 'none',
|
|
112
|
+
width: '100%',
|
|
113
|
+
height: '100%',
|
|
114
|
+
}, children: props.children })] }));
|
|
120
115
|
});
|
|
121
116
|
ReactDocumentPictureInPicture.displayName = "ReactDocumentPictureInPicture";
|
|
122
117
|
export default ReactDocumentPictureInPicture;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter';
|
|
3
|
+
import { materialOceanic } from 'react-syntax-highlighter/dist/cjs/styles/prism';
|
|
4
|
+
export const CodeBlock = ({ ...props }) => {
|
|
5
|
+
return (_jsx(SyntaxHighlighter, { language: props.className?.replace(/(?:lang(?:uage)?-)/, ''), style: materialOceanic, wrapLines: true, className: 'not-prose rounded-md', children: props.children }));
|
|
6
|
+
};
|
|
7
|
+
export const Pre = ({ ...props }) => {
|
|
8
|
+
return (_jsx("div", { className: 'not-prose', children: props.children }));
|
|
9
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
2
|
import { Button } from "../../ui/button";
|
|
2
3
|
const MarkdownToolbar = ({ feedElement }) => {
|
|
3
4
|
const btns = [
|
|
@@ -6,10 +7,6 @@ const MarkdownToolbar = ({ feedElement }) => {
|
|
|
6
7
|
{ name: 'S', syntax: '~Strikethrough~' },
|
|
7
8
|
{ name: 'H1', syntax: '# ' },
|
|
8
9
|
];
|
|
9
|
-
return (
|
|
10
|
-
{btns.map(btn => (<Button key={btn.syntax} className="flex rounded-md" onClick={() => feedElement(btn.syntax)}>
|
|
11
|
-
{btn.name}
|
|
12
|
-
</Button>))}
|
|
13
|
-
</header>);
|
|
10
|
+
return (_jsx("header", { className: " flex gap-1 bg-[#253237]", children: btns.map(btn => (_jsx(Button, { className: "flex rounded-md", onClick: () => feedElement(btn.syntax), children: btn.name }, btn.syntax))) }));
|
|
14
11
|
};
|
|
15
12
|
export default MarkdownToolbar;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import Markdown from 'react-markdown';
|
|
4
|
+
import rehypeExternalLinks from 'rehype-external-links';
|
|
5
|
+
import rehypeSanitize from 'rehype-sanitize';
|
|
6
|
+
import remarkGfm from 'remark-gfm';
|
|
7
|
+
import { CodeBlock, Pre } from "./Code";
|
|
8
|
+
export const ReactMarkdownExample = () => {
|
|
9
|
+
const options = {
|
|
10
|
+
code: CodeBlock,
|
|
11
|
+
pre: Pre,
|
|
12
|
+
};
|
|
13
|
+
return (_jsx("div", { className: 'bg-slate-500', children: _jsx("div", { className: 'flex h-screen justify-between', children: _jsx("article", { className: 'w-full pl-6 pt-5', children: _jsx(Markdown, { className: 'prose prose-invert min-w-full', remarkPlugins: [remarkGfm], rehypePlugins: [
|
|
14
|
+
rehypeSanitize,
|
|
15
|
+
[rehypeExternalLinks,
|
|
16
|
+
{ content: { type: 'text', value: '🔗' } }
|
|
17
|
+
],
|
|
18
|
+
], components: options }) }) }) }));
|
|
19
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage } from "mtxuilib/ui/form";
|
|
4
|
+
import { Input } from "mtxuilib/ui/input";
|
|
5
|
+
import { useFormContext } from "react-hook-form";
|
|
6
|
+
export const SchemaFormFieldsRender = (props) => {
|
|
7
|
+
const { schema } = props;
|
|
8
|
+
const form = useFormContext();
|
|
9
|
+
return (_jsx(_Fragment, { children: schema.fields?.map((formField, i) => {
|
|
10
|
+
return (_jsx(FormField, { control: form.control, name: formField.name, defaultValue: formField.defaultValue || "", render: ({ field }) => (_jsxs(FormItem, { children: [formField.label && _jsx(FormLabel, { children: formField.label }), _jsx(FormControl, { children: _jsx(_Fragment, { children: _jsx(Input, { placeholder: formField.placeholder, ...field }) }) }), formField.description && _jsx(FormDescription, { children: formField.description }), _jsx(FormMessage, {})] })) }, i));
|
|
11
|
+
}) }));
|
|
12
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
3
|
import { useState } from "react";
|
|
3
4
|
import { FormProvider, useForm } from "react-hook-form";
|
|
4
5
|
import { EditFormToolbar } from "mtxuilib/form/EditFormToolbar";
|
|
@@ -12,20 +13,7 @@ export const SchemaFormView = (props) => {
|
|
|
12
13
|
defaultValues: defaultValues,
|
|
13
14
|
});
|
|
14
15
|
if (!formSchema) {
|
|
15
|
-
return
|
|
16
|
+
return _jsx("div", { className: "border p-8", children: "missing formSchema params" });
|
|
16
17
|
}
|
|
17
|
-
return (
|
|
18
|
-
<FormProvider {...form}>
|
|
19
|
-
<Card className="p-2">
|
|
20
|
-
<CardContent>
|
|
21
|
-
<form onSubmit={form.handleSubmit(onSubmit)}>
|
|
22
|
-
<SchemaFormFieldsRender schema={formSchema}/>
|
|
23
|
-
<DialogFooter>
|
|
24
|
-
<EditFormToolbar onCancel={() => onCancel && onCancel()}/>
|
|
25
|
-
</DialogFooter>
|
|
26
|
-
</form>
|
|
27
|
-
</CardContent>
|
|
28
|
-
</Card>
|
|
29
|
-
</FormProvider>
|
|
30
|
-
</>);
|
|
18
|
+
return (_jsx(_Fragment, { children: _jsx(FormProvider, { ...form, children: _jsx(Card, { className: "p-2", children: _jsx(CardContent, { children: _jsxs("form", { onSubmit: form.handleSubmit(onSubmit), children: [_jsx(SchemaFormFieldsRender, { schema: formSchema }), _jsx(DialogFooter, { children: _jsx(EditFormToolbar, { onCancel: () => onCancel && onCancel() }) })] }) }) }) }) }));
|
|
31
19
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { flexRender } from "@tanstack/react-table";
|
|
4
|
+
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "../../ui/table";
|
|
5
|
+
export function SimpleTable(props) {
|
|
6
|
+
const { table } = props;
|
|
7
|
+
return (_jsx("div", { className: "rounded-md border", children: _jsxs(Table, { children: [_jsx(TableHeader, { children: table.getHeaderGroups().map((headerGroup) => (_jsx(TableRow, { children: headerGroup.headers.map((header) => {
|
|
8
|
+
return (_jsx(TableHead, { children: header.isPlaceholder ? null : flexRender(header.column.columnDef.header, header.getContext()) }, header.id));
|
|
9
|
+
}) }, headerGroup.id))) }), _jsx(TableBody, { children: table.getRowModel().rows?.length ? (table.getRowModel().rows.map((row) => (_jsx(TableRow, { "data-state": row.getIsSelected() && "selected", children: row.getVisibleCells().map((cell) => (_jsx(TableCell, { children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id))) }, row.id)))) : (_jsx(TableRow, {})) })] }) }));
|
|
10
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { ChevronRight } from 'lucide-react';
|
|
4
|
+
import { cn } from "../../../lib/utils";
|
|
5
|
+
export const ExpenderCell = (info) => {
|
|
6
|
+
return info.row.getCanExpand() ? (_jsx("button", { className: "pointer", onClick: info.row.getToggleExpandedHandler(), children: _jsx(ChevronRight, { className: cn(info.row.getIsExpanded() && "rotate-90") }) })) : ('🔵');
|
|
7
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { Select, SelectContent, SelectGroup, SelectItem, SelectTrigger, SelectValue } from "../../../ui/select";
|
|
5
|
+
export const SelectCell = (info) => {
|
|
6
|
+
const [value, setValue] = React.useState(info.cell.getValue());
|
|
7
|
+
const onBlur = () => {
|
|
8
|
+
const numValue = parseInt(value);
|
|
9
|
+
};
|
|
10
|
+
return _jsx("div", { className: "flex w-full", children: _jsx("input", { type: "number", value: value, onChange: e => setValue(e.target.value), onBlur: onBlur, className: "grow" }) });
|
|
11
|
+
};
|
|
12
|
+
export const NewSelectCell = ({ placeholder, items }) => {
|
|
13
|
+
const component = (_info) => {
|
|
14
|
+
return _jsx(_Fragment, { children: _jsxs(Select, { children: [_jsx(SelectTrigger, { className: "w-[180px]", children: _jsx(SelectValue, { placeholder: placeholder || "--" }) }), _jsx(SelectContent, { children: _jsx(SelectGroup, { children: items?.map((item, i) => {
|
|
15
|
+
return _jsx(SelectItem, { value: item.value, children: item.label }, i);
|
|
16
|
+
}) }) })] }) });
|
|
17
|
+
};
|
|
18
|
+
return component;
|
|
19
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
3
|
import React from "react";
|
|
3
4
|
export const NewTextCell = ({ enableEdit, placeholder, popup }) => (info) => {
|
|
4
5
|
const initialValue = info.cell.getValue();
|
|
@@ -8,8 +9,5 @@ export const NewTextCell = ({ enableEdit, placeholder, popup }) => (info) => {
|
|
|
8
9
|
}, [initialValue]);
|
|
9
10
|
const onBlur = () => {
|
|
10
11
|
};
|
|
11
|
-
return
|
|
12
|
-
|
|
13
|
-
{value}
|
|
14
|
-
</>;
|
|
12
|
+
return _jsx(_Fragment, { children: value });
|
|
15
13
|
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import Link from "next/link";
|
|
4
|
+
import React from "react";
|
|
5
|
+
import { Select, SelectContent, SelectGroup, SelectItem, SelectTrigger, SelectValue } from "../../../ui/select";
|
|
6
|
+
export const ViewLinkCell = (info) => {
|
|
7
|
+
const [value, setValue] = React.useState(info.cell.getValue());
|
|
8
|
+
const onBlur = () => {
|
|
9
|
+
const numValue = parseInt(value);
|
|
10
|
+
};
|
|
11
|
+
return _jsx(_Fragment, { children: _jsx(Link, { href: "#", children: "res link" }) });
|
|
12
|
+
};
|
|
13
|
+
export const NewSelectCell = ({ placeholder, items }) => {
|
|
14
|
+
return (info) => {
|
|
15
|
+
return _jsx(_Fragment, { children: _jsxs(Select, { children: [_jsx(SelectTrigger, { className: "w-[180px]", children: _jsx(SelectValue, { placeholder: placeholder || "--" }) }), _jsx(SelectContent, { children: _jsx(SelectGroup, { children: items?.map((item, i) => {
|
|
16
|
+
return _jsx(SelectItem, { value: item.value, children: item.label }, i);
|
|
17
|
+
}) }) })] }) });
|
|
18
|
+
};
|
|
19
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import React from "react";
|
|
4
|
+
export const NumberCell = (info) => {
|
|
5
|
+
const [value, setValue] = React.useState(info.cell.getValue());
|
|
6
|
+
const onBlur = () => {
|
|
7
|
+
const numValue = parseInt(value);
|
|
8
|
+
};
|
|
9
|
+
return _jsx("div", { className: "flex w-full", children: _jsx("input", { type: "number", value: value, onChange: e => setValue(e.target.value), onBlur: onBlur, className: "grow" }) });
|
|
10
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
3
|
import React from "react";
|
|
3
4
|
import { CellWrapper } from "./container/cellWrapper";
|
|
4
5
|
export const StringCell = (info) => {
|
|
@@ -10,9 +11,5 @@ export const StringCell = (info) => {
|
|
|
10
11
|
React.useEffect(() => {
|
|
11
12
|
setValue(initialValue);
|
|
12
13
|
}, [initialValue]);
|
|
13
|
-
return
|
|
14
|
-
{value}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
</CellWrapper>;
|
|
14
|
+
return _jsx(CellWrapper, { children: value });
|
|
18
15
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { ChevronLeftIcon, ChevronRightIcon, DoubleArrowLeftIcon, DoubleArrowRightIcon } from "@radix-ui/react-icons";
|
|
4
|
+
import { MtButton } from "../../ui-mt/Button";
|
|
5
|
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "../../ui/select";
|
|
6
|
+
export function DataTablePagination({ table }) {
|
|
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
|
+
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(MtButton, { 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(MtButton, { 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(MtButton, { 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(MtButton, { 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
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { MixerHorizontalIcon } from "@radix-ui/react-icons";
|
|
4
|
+
import { MtButton } from "../../ui-mt/Button";
|
|
5
|
+
import { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, } from "../../ui/dropdown-menu";
|
|
6
|
+
export function DataTableViewOptions({ table }) {
|
|
7
|
+
return (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs(MtButton, { 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
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
3
|
import { createColumnHelper, flexRender, getCoreRowModel, useReactTable } from "@tanstack/react-table";
|
|
3
4
|
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "../../../ui/table";
|
|
4
5
|
const columnHelper = createColumnHelper();
|
|
@@ -17,7 +18,7 @@ const defaultColumns = [
|
|
|
17
18
|
columnHelper.accessor((row) => row.lastName, {
|
|
18
19
|
id: "lastName",
|
|
19
20
|
cell: (info) => info.getValue(),
|
|
20
|
-
header: () =>
|
|
21
|
+
header: () => _jsx("span", { children: "Last Name" }),
|
|
21
22
|
footer: (props) => props.column.id,
|
|
22
23
|
}),
|
|
23
24
|
],
|
|
@@ -34,7 +35,7 @@ const defaultColumns = [
|
|
|
34
35
|
header: "More Info",
|
|
35
36
|
columns: [
|
|
36
37
|
columnHelper.accessor("visits", {
|
|
37
|
-
header: () =>
|
|
38
|
+
header: () => _jsx("span", { children: "Visits" }),
|
|
38
39
|
footer: (props) => props.column.id,
|
|
39
40
|
}),
|
|
40
41
|
columnHelper.accessor("status", {
|
|
@@ -74,29 +75,10 @@ function DataTableDemo1Inner({ columns, data }) {
|
|
|
74
75
|
columns,
|
|
75
76
|
getCoreRowModel: getCoreRowModel(),
|
|
76
77
|
});
|
|
77
|
-
return (
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
{table.getHeaderGroups().map((headerGroup) => (<TableRow key={headerGroup.id}>
|
|
81
|
-
{headerGroup.headers.map((header) => {
|
|
82
|
-
return (<TableHead key={header.id}>
|
|
83
|
-
{header.isPlaceholder ? null : flexRender(header.column.columnDef.header, header.getContext())}
|
|
84
|
-
</TableHead>);
|
|
85
|
-
})}
|
|
86
|
-
</TableRow>))}
|
|
87
|
-
</TableHeader>
|
|
88
|
-
<TableBody>
|
|
89
|
-
{table.getRowModel().rows?.length ? (table.getRowModel().rows.map((row) => (<TableRow key={row.id} data-state={row.getIsSelected() && "selected"}>
|
|
90
|
-
{row.getVisibleCells().map((cell) => (<TableCell key={cell.id}>{flexRender(cell.column.columnDef.cell, cell.getContext())}</TableCell>))}
|
|
91
|
-
</TableRow>))) : (<TableRow>
|
|
92
|
-
<TableCell colSpan={columns.length} className="h-24 text-center">
|
|
93
|
-
No results.
|
|
94
|
-
</TableCell>
|
|
95
|
-
</TableRow>)}
|
|
96
|
-
</TableBody>
|
|
97
|
-
</Table>
|
|
98
|
-
</div>);
|
|
78
|
+
return (_jsx("div", { className: "rounded-md border", children: _jsxs(Table, { children: [_jsx(TableHeader, { children: table.getHeaderGroups().map((headerGroup) => (_jsx(TableRow, { children: headerGroup.headers.map((header) => {
|
|
79
|
+
return (_jsx(TableHead, { children: header.isPlaceholder ? null : flexRender(header.column.columnDef.header, header.getContext()) }, header.id));
|
|
80
|
+
}) }, headerGroup.id))) }), _jsx(TableBody, { children: table.getRowModel().rows?.length ? (table.getRowModel().rows.map((row) => (_jsx(TableRow, { "data-state": row.getIsSelected() && "selected", children: row.getVisibleCells().map((cell) => (_jsx(TableCell, { children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id))) }, row.id)))) : (_jsx(TableRow, { children: _jsx(TableCell, { colSpan: columns.length, className: "h-24 text-center", children: "No results." }) })) })] }) }));
|
|
99
81
|
}
|
|
100
82
|
export function DataTableDemo1() {
|
|
101
|
-
return
|
|
83
|
+
return _jsx(DataTableDemo1Inner, { columns: defaultColumns, data: demoData });
|
|
102
84
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { cn } from "../../../lib/utils";
|
|
4
|
+
import { ArrowDownIcon, ArrowUpIcon, CaretSortIcon, EyeNoneIcon } from "@radix-ui/react-icons";
|
|
5
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger, } from "mtxuilib/ui/dropdown-menu";
|
|
6
|
+
import { Button } from "../../../ui/button";
|
|
7
|
+
export function SimpleHeader(props) {
|
|
8
|
+
const { column } = props;
|
|
9
|
+
return _jsx(SimpleHeaderRender, { column: column, title: "Status" });
|
|
10
|
+
}
|
|
11
|
+
export function SimpleHeaderRender({ column, title, className, }) {
|
|
12
|
+
if (!column.getCanSort()) {
|
|
13
|
+
return _jsx("div", { className: cn(className), children: title });
|
|
14
|
+
}
|
|
15
|
+
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: "data-[state=open]:bg-accent -ml-3 h-8", 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: "text-muted-foreground/70 mr-2 h-3.5 w-3.5" }), "Asc"] }), _jsxs(DropdownMenuItem, { onClick: () => column.toggleSorting(true), children: [_jsx(ArrowDownIcon, { className: "text-muted-foreground/70 mr-2 h-3.5 w-3.5" }), "Desc"] }), _jsx(DropdownMenuSeparator, {}), _jsxs(DropdownMenuItem, { onClick: () => column.toggleVisibility(false), children: [_jsx(EyeNoneIcon, { className: "text-muted-foreground/70 mr-2 h-3.5 w-3.5" }), "Hide"] })] })] }) }));
|
|
16
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Checkbox } from "../../../ui/checkbox";
|
|
3
|
+
import { SimpleHeaderRender } from "./SimpleHeader";
|
|
4
|
+
export const TableHeader = (props) => {
|
|
5
|
+
const { table, column, columnConfig } = props;
|
|
6
|
+
if (!columnConfig.header) {
|
|
7
|
+
return _jsx("div", {});
|
|
8
|
+
}
|
|
9
|
+
const headerType = columnConfig.header.type;
|
|
10
|
+
switch (headerType) {
|
|
11
|
+
case "checkbox":
|
|
12
|
+
return (_jsx(Checkbox, { checked: table.getIsAllPageRowsSelected() || (table.getIsSomePageRowsSelected() && "indeterminate"), onCheckedChange: (value) => table.toggleAllPageRowsSelected(!!value), "aria-label": "Select all", className: "translate-y-[2px]" }));
|
|
13
|
+
default:
|
|
14
|
+
return _jsx(SimpleHeaderRender, { column: column, title: columnConfig.header.label });
|
|
15
|
+
}
|
|
16
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
export const TailwindIndicator = () => {
|
|
4
|
+
if (process.env.NODE_ENV === 'production')
|
|
5
|
+
return null;
|
|
6
|
+
return (_jsxs("div", { className: "fixed bottom-1 left-1 z-50 flex h-6 w-6 items-center justify-center rounded-full bg-gray-800 p-3 font-mono text-xs text-white", children: [_jsx("div", { className: "block sm:hidden", children: "xs" }), _jsx("div", { className: "hidden sm:block md:hidden", children: "sm" }), _jsx("div", { className: "hidden md:block lg:hidden", children: "md" }), _jsx("div", { className: "hidden lg:block xl:hidden", children: "lg" }), _jsx("div", { className: "hidden xl:block 2xl:hidden", children: "xl" }), _jsx("div", { className: "hidden 2xl:block", children: "2xl" })] }));
|
|
7
|
+
};
|