@yimingliao/cms 0.0.145 → 0.0.146
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/export/client/index.js +1 -71
- package/dist/src/client/interfaces/components/shadcn/sidebar.js +1 -1
- package/dist/src/client/interfaces/styles/constants.js +1 -3
- package/dist/types/export/client/components/index.d.ts +2 -0
- package/dist/types/export/client/components/index.d.ts.map +1 -0
- package/dist/types/export/client/index.d.ts +1 -1
- package/dist/types/export/client/index.d.ts.map +1 -1
- package/dist/types/src/client/index.d.ts +1 -1
- package/dist/types/src/client/index.d.ts.map +1 -1
- package/dist/types/src/client/interfaces/index.d.ts +0 -2
- package/dist/types/src/client/interfaces/index.d.ts.map +1 -1
- package/package.json +6 -1
- package/dist/src/client/applications/ui/use-parent-pathname.js +0 -10
- package/dist/src/client/interfaces/components/admin-initializer.js +0 -29
- package/dist/src/client/interfaces/components/resources/file/file-card.js +0 -87
- package/dist/src/client/interfaces/components/resources/file/file-list.js +0 -159
- package/dist/src/client/interfaces/components/resources/file/is-locked-buttons.js +0 -71
- package/dist/src/client/interfaces/components/resources/file/type-buttons.js +0 -62
- package/dist/src/client/interfaces/components/ui/blocks/list-cards-container/list-cards-container.js +0 -96
- package/dist/src/client/interfaces/components/ui/blocks/list-cards-container/page-size-selector.js +0 -63
- package/dist/src/client/interfaces/components/ui/blocks/list-cards-container/pagination.js +0 -94
- package/dist/src/client/interfaces/components/ui/blocks/page-header/page-header-title.js +0 -26
- package/dist/src/client/interfaces/components/ui/blocks/page-header/page-header.js +0 -74
- package/dist/src/client/interfaces/components/ui/blocks/page-header/presets/batch-create.js +0 -33
- package/dist/src/client/interfaces/components/ui/blocks/page-header/presets/batch.js +0 -39
- package/dist/src/client/interfaces/components/ui/blocks/page-header/presets/create.js +0 -33
- package/dist/src/client/interfaces/components/ui/blocks/page-header/presets/edit.js +0 -33
- package/dist/src/client/interfaces/components/ui/blocks/page-header/presets/index.js +0 -48
- package/dist/src/client/interfaces/components/ui/blocks/page-header/presets/show.js +0 -61
- package/dist/src/client/interfaces/components/ui/blocks/page-header/presets/trash.js +0 -39
- package/dist/src/client/interfaces/components/ui/buttons/return-button.js +0 -61
- package/dist/src/client/interfaces/components/ui/cards/action-buttons-card.js +0 -82
- package/dist/src/client/interfaces/components/ui/cards/resource-card/card-status-bar.js +0 -51
- package/dist/src/client/interfaces/components/ui/cards/resource-card/card-text-content.js +0 -38
- package/dist/src/client/interfaces/components/ui/cards/resource-card/resource-card.js +0 -77
- package/dist/src/client/interfaces/components/ui/display/array-list.js +0 -69
- package/dist/src/client/interfaces/components/ui/display/badge.js +0 -41
- package/dist/src/client/interfaces/components/ui/display/html-display.js +0 -32
- package/dist/src/client/interfaces/components/ui/display/object-array-list.js +0 -75
- package/dist/src/client/interfaces/components/ui/features/accordion/accordion-container.js +0 -31
- package/dist/src/client/interfaces/components/ui/features/accordion/accordion-header.js +0 -34
- package/dist/src/client/interfaces/components/ui/features/accordion/accordion.js +0 -81
- package/dist/src/client/interfaces/components/ui/features/expandable-list/expand-bar.js +0 -39
- package/dist/src/client/interfaces/components/ui/features/expandable-list/expandable-list-content.js +0 -49
- package/dist/src/client/interfaces/components/ui/features/expandable-list/expandable-list.js +0 -53
- package/dist/src/client/interfaces/components/ui/features/external-link.js +0 -15
- package/dist/src/client/interfaces/components/ui/features/file/file-info/file-info.js +0 -118
- package/dist/src/client/interfaces/components/ui/features/file/file-info/file-name.js +0 -48
- package/dist/src/client/interfaces/components/ui/features/file/file-picker/file-picker-container.js +0 -74
- package/dist/src/client/interfaces/components/ui/features/file/file-picker/file-picker-placeholder.js +0 -48
- package/dist/src/client/interfaces/components/ui/features/file/file-picker/file-picker.js +0 -109
- package/dist/src/client/interfaces/components/ui/features/file/file-preview/file-preview-list.js +0 -85
- package/dist/src/client/interfaces/components/ui/features/file/file-preview/file-preview-meta.js +0 -40
- package/dist/src/client/interfaces/components/ui/features/file/file-preview/file-preview.js +0 -113
- package/dist/src/client/interfaces/components/ui/features/file/uploader.js +0 -101
- package/dist/src/client/interfaces/components/ui/features/pick-modal/pick-modal-body.js +0 -112
- package/dist/src/client/interfaces/components/ui/features/pick-modal/pick-modal-trigger.js +0 -97
- package/dist/src/client/interfaces/components/ui/features/pick-modal/pick-modal.js +0 -77
- package/dist/src/client/interfaces/components/ui/features/smart-image.js +0 -57
- package/dist/src/client/interfaces/components/ui/features/tick.js +0 -27
- package/dist/src/client/interfaces/components/ui/form/containers/fields-container.js +0 -24
- package/dist/src/client/interfaces/components/ui/form/containers/main-fields.js +0 -25
- package/dist/src/client/interfaces/components/ui/form/containers/side-fields.js +0 -24
- package/dist/src/client/interfaces/components/ui/form/control-fields/built-in-fields.js +0 -9
- package/dist/src/client/interfaces/components/ui/form/control-fields/control-fields-display.js +0 -112
- package/dist/src/client/interfaces/components/ui/form/control-fields/control-fields-input.js +0 -158
- package/dist/src/client/interfaces/components/ui/form/control-fields/control-fields.js +0 -59
- package/dist/src/client/interfaces/components/ui/form/field-body.js +0 -79
- package/dist/src/client/interfaces/components/ui/form/index-field.js +0 -87
- package/dist/src/client/interfaces/components/ui/form/slug-field.js +0 -82
- package/dist/src/client/interfaces/components/ui/inputs/array-input.js +0 -110
- package/dist/src/client/interfaces/components/ui/inputs/checkbox.js +0 -93
- package/dist/src/client/interfaces/components/ui/inputs/editor/base/base-editor.js +0 -143
- package/dist/src/client/interfaces/components/ui/inputs/editor/base/built-in-plugins.js +0 -71
- package/dist/src/client/interfaces/components/ui/inputs/editor/base/configs/heading.config.js +0 -41
- package/dist/src/client/interfaces/components/ui/inputs/editor/base/configs/image.config.js +0 -32
- package/dist/src/client/interfaces/components/ui/inputs/editor/base/configs/table.config.js +0 -15
- package/dist/src/client/interfaces/components/ui/inputs/editor/editor.js +0 -112
- package/dist/src/client/interfaces/components/ui/inputs/editor/plugins/asset-manager/asset-manager.js +0 -24
- package/dist/src/client/interfaces/components/ui/inputs/editor/plugins/asset-manager/use-control-asset-mamager.js +0 -26
- package/dist/src/client/interfaces/components/ui/inputs/editor/plugins/file-repository/upload-adapter.js +0 -84
- package/dist/src/client/interfaces/components/ui/inputs/editor/plugins/word-count-display/icons.js +0 -17
- package/dist/src/client/interfaces/components/ui/inputs/editor/plugins/word-count-display/word-count-display.js +0 -81
- package/dist/src/client/interfaces/components/ui/inputs/editor/use-init-editor/use-init-editor.js +0 -50
- package/dist/src/client/interfaces/components/ui/inputs/search-input.js +0 -61
- package/dist/src/client/interfaces/components/ui/inputs/select.js +0 -69
- package/dist/src/client/interfaces/components/ui/inputs/textarea.js +0 -62
- package/dist/src/client/interfaces/components/ui/layouts/content-container.js +0 -38
- package/dist/src/client/interfaces/components/ui/layouts/navbar/i18n-selector.js +0 -42
- package/dist/src/client/interfaces/components/ui/layouts/navbar/nav-user.js +0 -106
- package/dist/src/client/interfaces/components/ui/layouts/navbar/navbar.js +0 -84
- package/dist/src/client/interfaces/components/ui/layouts/navbar/sign-out-button.js +0 -58
- package/dist/src/client/interfaces/components/ui/layouts/navbar/theme-selector.js +0 -51
- package/dist/src/client/interfaces/components/ui/layouts/sidebar/nav-main.js +0 -99
- package/dist/src/constants/file.js +0 -27
- package/dist/src/shared/list-items.js +0 -3
- package/dist/src/shared/utils/debounce.js +0 -14
package/dist/src/client/interfaces/components/ui/blocks/list-cards-container/list-cards-container.js
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
-
import { useTranslator } from 'intor/react';
|
|
4
|
-
import { useEffect } from 'react';
|
|
5
|
-
import '@radix-ui/react-avatar';
|
|
6
|
-
import 'ua-parser-js';
|
|
7
|
-
import 'clsx';
|
|
8
|
-
import 'tailwind-merge';
|
|
9
|
-
import 'next/navigation';
|
|
10
|
-
import '../../../shadcn/badge.js';
|
|
11
|
-
import '../../../shadcn/button.js';
|
|
12
|
-
import '@radix-ui/react-collapsible';
|
|
13
|
-
import '@radix-ui/react-dialog';
|
|
14
|
-
import 'lucide-react';
|
|
15
|
-
import '@radix-ui/react-dropdown-menu';
|
|
16
|
-
import '../../../shadcn/input-group.js';
|
|
17
|
-
import '@radix-ui/react-label';
|
|
18
|
-
import '@radix-ui/react-select';
|
|
19
|
-
import '@radix-ui/react-separator';
|
|
20
|
-
import '../../../shadcn/sidebar.js';
|
|
21
|
-
import { Spinner } from '../../../shadcn/spinner.js';
|
|
22
|
-
import '@radix-ui/react-tooltip';
|
|
23
|
-
import 'next/link';
|
|
24
|
-
import '../../../../../../constants/paths/auth.js';
|
|
25
|
-
import '../../../../../../constants/paths/main.js';
|
|
26
|
-
import '../../../../../../constants/paths/resources.js';
|
|
27
|
-
import '../../../../../../constants/redirect-paths.js';
|
|
28
|
-
import 'mime-types';
|
|
29
|
-
import '../../../../../../domain/resources/admin/constants.js';
|
|
30
|
-
import 'next/image';
|
|
31
|
-
import 'ckeditor5';
|
|
32
|
-
import 'ckeditor5/translations/en.js';
|
|
33
|
-
import 'ckeditor5/translations/zh.js';
|
|
34
|
-
import 'sonner';
|
|
35
|
-
import { SearchInput } from '../../inputs/search-input.js';
|
|
36
|
-
import { PageSizeSelector } from './page-size-selector.js';
|
|
37
|
-
import { Pagination } from './pagination.js';
|
|
38
|
-
|
|
39
|
-
function ListCardsContainer({
|
|
40
|
-
// pagination
|
|
41
|
-
page,
|
|
42
|
-
setPage,
|
|
43
|
-
pageSize,
|
|
44
|
-
setPageSize,
|
|
45
|
-
total,
|
|
46
|
-
// search string
|
|
47
|
-
searchString,
|
|
48
|
-
setSearchString,
|
|
49
|
-
// ui states
|
|
50
|
-
isFetching,
|
|
51
|
-
// base
|
|
52
|
-
children,
|
|
53
|
-
headerChildren
|
|
54
|
-
}) {
|
|
55
|
-
const { t } = useTranslator();
|
|
56
|
-
const isNotFound = total === 0;
|
|
57
|
-
useEffect(() => {
|
|
58
|
-
setPage(1);
|
|
59
|
-
}, [searchString, setPage]);
|
|
60
|
-
return /* @__PURE__ */ jsxs("div", { className: "flex h-full flex-col gap-6", children: [
|
|
61
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
62
|
-
headerChildren,
|
|
63
|
-
/* @__PURE__ */ jsx("div", { className: "ml-auto w-64", children: /* @__PURE__ */ jsx(
|
|
64
|
-
SearchInput,
|
|
65
|
-
{
|
|
66
|
-
searchString,
|
|
67
|
-
setSearchString,
|
|
68
|
-
isLoading: isFetching
|
|
69
|
-
}
|
|
70
|
-
) })
|
|
71
|
-
] }),
|
|
72
|
-
/* @__PURE__ */ jsx("div", { className: "max-h-[88%] flex-1 overflow-y-auto", children: isFetching ? /* @__PURE__ */ jsx(Spinner, {}) : isNotFound ? /* @__PURE__ */ jsx("p", { className: "text-sm opacity-50", children: t("ui.no-data.text") }) : /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-4", children }) }),
|
|
73
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
74
|
-
/* @__PURE__ */ jsx("div", { className: "w-52" }),
|
|
75
|
-
/* @__PURE__ */ jsx(
|
|
76
|
-
Pagination,
|
|
77
|
-
{
|
|
78
|
-
page,
|
|
79
|
-
setPage,
|
|
80
|
-
pageSize,
|
|
81
|
-
total
|
|
82
|
-
}
|
|
83
|
-
),
|
|
84
|
-
/* @__PURE__ */ jsx(
|
|
85
|
-
PageSizeSelector,
|
|
86
|
-
{
|
|
87
|
-
pageSize,
|
|
88
|
-
setPageSize,
|
|
89
|
-
setPage
|
|
90
|
-
}
|
|
91
|
-
)
|
|
92
|
-
] })
|
|
93
|
-
] });
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
export { ListCardsContainer };
|
package/dist/src/client/interfaces/components/ui/blocks/list-cards-container/page-size-selector.js
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
-
import { useTranslator } from 'intor/react';
|
|
4
|
-
import 'react';
|
|
5
|
-
import 'ua-parser-js';
|
|
6
|
-
import 'clsx';
|
|
7
|
-
import 'tailwind-merge';
|
|
8
|
-
import 'next/navigation';
|
|
9
|
-
import 'lucide-react';
|
|
10
|
-
import '@radix-ui/react-avatar';
|
|
11
|
-
import '../../../shadcn/badge.js';
|
|
12
|
-
import '../../../shadcn/button.js';
|
|
13
|
-
import '@radix-ui/react-collapsible';
|
|
14
|
-
import '@radix-ui/react-dialog';
|
|
15
|
-
import '@radix-ui/react-dropdown-menu';
|
|
16
|
-
import '../../../shadcn/input-group.js';
|
|
17
|
-
import '@radix-ui/react-label';
|
|
18
|
-
import '@radix-ui/react-select';
|
|
19
|
-
import '@radix-ui/react-separator';
|
|
20
|
-
import '../../../shadcn/sidebar.js';
|
|
21
|
-
import '@radix-ui/react-tooltip';
|
|
22
|
-
import 'next/link';
|
|
23
|
-
import '../../../../../../constants/paths/auth.js';
|
|
24
|
-
import '../../../../../../constants/paths/main.js';
|
|
25
|
-
import '../../../../../../constants/paths/resources.js';
|
|
26
|
-
import '../../../../../../constants/redirect-paths.js';
|
|
27
|
-
import 'mime-types';
|
|
28
|
-
import '../../../../../../domain/resources/admin/constants.js';
|
|
29
|
-
import 'next/image';
|
|
30
|
-
import 'ckeditor5';
|
|
31
|
-
import 'ckeditor5/translations/en.js';
|
|
32
|
-
import 'ckeditor5/translations/zh.js';
|
|
33
|
-
import 'sonner';
|
|
34
|
-
import { Select, Option } from '../../inputs/select.js';
|
|
35
|
-
|
|
36
|
-
function PageSizeSelector({
|
|
37
|
-
pageSize,
|
|
38
|
-
setPageSize,
|
|
39
|
-
setPage
|
|
40
|
-
}) {
|
|
41
|
-
const { t } = useTranslator();
|
|
42
|
-
return /* @__PURE__ */ jsxs("div", { className: "flex w-52 items-center gap-4", children: [
|
|
43
|
-
/* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-sm whitespace-nowrap", children: t("ui.layout.item-list-container.items-per-page.text") }),
|
|
44
|
-
/* @__PURE__ */ jsxs(
|
|
45
|
-
Select,
|
|
46
|
-
{
|
|
47
|
-
value: String(pageSize),
|
|
48
|
-
onValueChange: (value) => {
|
|
49
|
-
setPageSize(Number(value ?? 20));
|
|
50
|
-
setPage(1);
|
|
51
|
-
},
|
|
52
|
-
className: "w-full",
|
|
53
|
-
children: [
|
|
54
|
-
/* @__PURE__ */ jsx(Option, { value: String(20), children: "20" }),
|
|
55
|
-
/* @__PURE__ */ jsx(Option, { value: String(40), children: "40" }),
|
|
56
|
-
/* @__PURE__ */ jsx(Option, { value: String(80), children: "80" })
|
|
57
|
-
]
|
|
58
|
-
}
|
|
59
|
-
)
|
|
60
|
-
] });
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export { PageSizeSelector };
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
-
import '@radix-ui/react-avatar';
|
|
4
|
-
import 'react';
|
|
5
|
-
import 'ua-parser-js';
|
|
6
|
-
import 'clsx';
|
|
7
|
-
import 'tailwind-merge';
|
|
8
|
-
import 'next/navigation';
|
|
9
|
-
import '../../../shadcn/badge.js';
|
|
10
|
-
import '../../../shadcn/button.js';
|
|
11
|
-
import '@radix-ui/react-collapsible';
|
|
12
|
-
import '@radix-ui/react-dialog';
|
|
13
|
-
import 'lucide-react';
|
|
14
|
-
import '@radix-ui/react-dropdown-menu';
|
|
15
|
-
import '../../../shadcn/input-group.js';
|
|
16
|
-
import '@radix-ui/react-label';
|
|
17
|
-
import { Pagination as Pagination$1, PaginationContent, PaginationItem, PaginationPrevious, PaginationLink, PaginationEllipsis, PaginationNext } from '../../../shadcn/pagination.js';
|
|
18
|
-
import '@radix-ui/react-select';
|
|
19
|
-
import '@radix-ui/react-separator';
|
|
20
|
-
import '../../../shadcn/sidebar.js';
|
|
21
|
-
import '@radix-ui/react-tooltip';
|
|
22
|
-
|
|
23
|
-
function Pagination({
|
|
24
|
-
page,
|
|
25
|
-
setPage,
|
|
26
|
-
pageSize,
|
|
27
|
-
total = 0
|
|
28
|
-
}) {
|
|
29
|
-
const totalPages = Math.ceil(total / pageSize);
|
|
30
|
-
const isFirst = page === 1;
|
|
31
|
-
const isLastPage = page === totalPages;
|
|
32
|
-
const handlePrev = () => {
|
|
33
|
-
if (isFirst) return;
|
|
34
|
-
setPage((prev) => prev - 1);
|
|
35
|
-
};
|
|
36
|
-
const handleNext = () => {
|
|
37
|
-
if (isLastPage) return;
|
|
38
|
-
setPage((prev) => prev + 1);
|
|
39
|
-
};
|
|
40
|
-
const siblingsCount = 2;
|
|
41
|
-
let startPage = Math.max(2, page - siblingsCount);
|
|
42
|
-
let endPage = Math.min(totalPages - 1, page + siblingsCount);
|
|
43
|
-
if (page - siblingsCount < 2) {
|
|
44
|
-
endPage = Math.min(totalPages - 1, endPage + (2 - (page - siblingsCount)));
|
|
45
|
-
}
|
|
46
|
-
if (page + siblingsCount > totalPages - 1) {
|
|
47
|
-
startPage = Math.max(
|
|
48
|
-
2,
|
|
49
|
-
startPage - (page + siblingsCount - (totalPages - 1))
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
const pages = [];
|
|
53
|
-
for (let i = startPage; i <= endPage; i++) {
|
|
54
|
-
pages.push(i);
|
|
55
|
-
}
|
|
56
|
-
const isAtFirstPage = page === 1;
|
|
57
|
-
const isAtLastPage = page === totalPages;
|
|
58
|
-
return /* @__PURE__ */ jsx(Pagination$1, { className: "flex-1", children: /* @__PURE__ */ jsxs(PaginationContent, { children: [
|
|
59
|
-
/* @__PURE__ */ jsx(PaginationItem, { children: /* @__PURE__ */ jsx(PaginationPrevious, { disabled: isAtFirstPage, onClick: handlePrev }) }),
|
|
60
|
-
/* @__PURE__ */ jsx(PaginationItem, { children: /* @__PURE__ */ jsx(
|
|
61
|
-
PaginationLink,
|
|
62
|
-
{
|
|
63
|
-
isActive: page === 1,
|
|
64
|
-
disabled: isAtFirstPage,
|
|
65
|
-
onClick: () => setPage(1),
|
|
66
|
-
children: "1"
|
|
67
|
-
}
|
|
68
|
-
) }),
|
|
69
|
-
startPage > 2 && /* @__PURE__ */ jsx(PaginationItem, { children: /* @__PURE__ */ jsx(PaginationEllipsis, {}) }),
|
|
70
|
-
pages.map((p) => {
|
|
71
|
-
const isThisPage = page === p;
|
|
72
|
-
return /* @__PURE__ */ jsx(PaginationItem, { children: /* @__PURE__ */ jsx(PaginationLink, { isActive: isThisPage, onClick: () => setPage(p), children: p }) }, p);
|
|
73
|
-
}),
|
|
74
|
-
endPage < totalPages - 1 && /* @__PURE__ */ jsx(PaginationItem, { children: /* @__PURE__ */ jsx(PaginationEllipsis, {}) }),
|
|
75
|
-
totalPages > 1 && /* @__PURE__ */ jsx(PaginationItem, { children: /* @__PURE__ */ jsx(
|
|
76
|
-
PaginationLink,
|
|
77
|
-
{
|
|
78
|
-
isActive: page === totalPages,
|
|
79
|
-
disabled: isAtLastPage,
|
|
80
|
-
onClick: () => setPage(totalPages),
|
|
81
|
-
children: totalPages
|
|
82
|
-
}
|
|
83
|
-
) }),
|
|
84
|
-
/* @__PURE__ */ jsx(PaginationItem, { children: /* @__PURE__ */ jsx(
|
|
85
|
-
PaginationNext,
|
|
86
|
-
{
|
|
87
|
-
disabled: isAtLastPage || totalPages <= 1,
|
|
88
|
-
onClick: handleNext
|
|
89
|
-
}
|
|
90
|
-
) })
|
|
91
|
-
] }) });
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
export { Pagination };
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { createElement } from 'react';
|
|
3
|
-
import 'ua-parser-js';
|
|
4
|
-
import { cn } from '../../../../../applications/shadcn/utils.js';
|
|
5
|
-
import 'next/navigation';
|
|
6
|
-
|
|
7
|
-
function PageHeaderTitle({
|
|
8
|
-
icon,
|
|
9
|
-
title,
|
|
10
|
-
subtitle,
|
|
11
|
-
children,
|
|
12
|
-
leftChildren,
|
|
13
|
-
className
|
|
14
|
-
}) {
|
|
15
|
-
return /* @__PURE__ */ jsxs("div", { className: cn("flex items-center gap-3", className), children: [
|
|
16
|
-
leftChildren,
|
|
17
|
-
icon && createElement(icon),
|
|
18
|
-
/* @__PURE__ */ jsxs("div", { className: "flex-center w-fit gap-3 whitespace-nowrap", children: [
|
|
19
|
-
subtitle && /* @__PURE__ */ jsx("p", { className: "text-muted-foreground", children: subtitle }),
|
|
20
|
-
/* @__PURE__ */ jsx("p", { className: "scroll-m-20 text-xl font-semibold tracking-tight", children: title })
|
|
21
|
-
] }),
|
|
22
|
-
children
|
|
23
|
-
] });
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export { PageHeaderTitle };
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
-
import { useTranslator } from 'intor/react';
|
|
4
|
-
import { Files } from 'lucide-react';
|
|
5
|
-
import 'react';
|
|
6
|
-
import 'ua-parser-js';
|
|
7
|
-
import { cn } from '../../../../../applications/shadcn/utils.js';
|
|
8
|
-
import 'next/navigation';
|
|
9
|
-
import { PAGE_HEADER_HEIGHT } from '../../../../styles/constants.js';
|
|
10
|
-
import '@radix-ui/react-avatar';
|
|
11
|
-
import '../../../shadcn/badge.js';
|
|
12
|
-
import '../../../shadcn/button.js';
|
|
13
|
-
import '@radix-ui/react-collapsible';
|
|
14
|
-
import '@radix-ui/react-dialog';
|
|
15
|
-
import '@radix-ui/react-dropdown-menu';
|
|
16
|
-
import '../../../shadcn/input-group.js';
|
|
17
|
-
import '@radix-ui/react-label';
|
|
18
|
-
import '@radix-ui/react-select';
|
|
19
|
-
import { Separator } from '../../../shadcn/separator.js';
|
|
20
|
-
import '../../../shadcn/sidebar.js';
|
|
21
|
-
import '@radix-ui/react-tooltip';
|
|
22
|
-
import { PageHeaderTitle } from './page-header-title.js';
|
|
23
|
-
import { createIndexPreset } from './presets/index.js';
|
|
24
|
-
import { createBatchPreset } from './presets/batch.js';
|
|
25
|
-
import { createBatchCreatePreset } from './presets/batch-create.js';
|
|
26
|
-
import { createCreatePreset } from './presets/create.js';
|
|
27
|
-
import { createEditPreset } from './presets/edit.js';
|
|
28
|
-
import { createShowPreset } from './presets/show.js';
|
|
29
|
-
import { createTrashPreset } from './presets/trash.js';
|
|
30
|
-
|
|
31
|
-
const PRESET_BUILDERS = {
|
|
32
|
-
default: () => ({ titleProps: { icon: Files } }),
|
|
33
|
-
index: createIndexPreset,
|
|
34
|
-
create: createCreatePreset,
|
|
35
|
-
show: createShowPreset,
|
|
36
|
-
edit: createEditPreset,
|
|
37
|
-
batch: createBatchPreset,
|
|
38
|
-
"batch-create": createBatchCreatePreset,
|
|
39
|
-
trash: createTrashPreset
|
|
40
|
-
};
|
|
41
|
-
function PageHeader(props) {
|
|
42
|
-
const { t } = useTranslator();
|
|
43
|
-
const variant = props.variant ?? "default";
|
|
44
|
-
const isDefault = variant === "default";
|
|
45
|
-
const preset = PRESET_BUILDERS[variant]({ props, t });
|
|
46
|
-
const left = props.leftChildren ?? preset.left;
|
|
47
|
-
const resolvedTitleProps = { ...preset.titleProps, ...props.titleProps };
|
|
48
|
-
const right = props.rightChildren ?? preset.right;
|
|
49
|
-
return /* @__PURE__ */ jsxs("div", { style: { height: PAGE_HEADER_HEIGHT }, children: [
|
|
50
|
-
/* @__PURE__ */ jsxs(
|
|
51
|
-
"div",
|
|
52
|
-
{
|
|
53
|
-
className: cn(
|
|
54
|
-
"relative h-full px-6",
|
|
55
|
-
"flex items-center justify-between gap-3"
|
|
56
|
-
),
|
|
57
|
-
children: [
|
|
58
|
-
!isDefault && left && /* @__PURE__ */ jsx("div", { className: "flex items-center gap-3", children: left }),
|
|
59
|
-
/* @__PURE__ */ jsx(
|
|
60
|
-
PageHeaderTitle,
|
|
61
|
-
{
|
|
62
|
-
className: cn(!isDefault && "absolute left-1/2 -translate-x-1/2"),
|
|
63
|
-
...resolvedTitleProps
|
|
64
|
-
}
|
|
65
|
-
),
|
|
66
|
-
right && /* @__PURE__ */ jsx("div", { className: "ml-auto flex items-center gap-3", children: right })
|
|
67
|
-
]
|
|
68
|
-
}
|
|
69
|
-
),
|
|
70
|
-
/* @__PURE__ */ jsx(Separator, {})
|
|
71
|
-
] });
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export { PageHeader };
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
2
|
-
import { FilePlus } from 'lucide-react';
|
|
3
|
-
import 'next/navigation';
|
|
4
|
-
import 'react';
|
|
5
|
-
import '@radix-ui/react-avatar';
|
|
6
|
-
import 'ua-parser-js';
|
|
7
|
-
import 'clsx';
|
|
8
|
-
import 'tailwind-merge';
|
|
9
|
-
import '../../../../shadcn/badge.js';
|
|
10
|
-
import '../../../../shadcn/button.js';
|
|
11
|
-
import '@radix-ui/react-collapsible';
|
|
12
|
-
import '@radix-ui/react-dialog';
|
|
13
|
-
import '@radix-ui/react-dropdown-menu';
|
|
14
|
-
import '../../../../shadcn/input-group.js';
|
|
15
|
-
import '@radix-ui/react-label';
|
|
16
|
-
import '@radix-ui/react-select';
|
|
17
|
-
import '@radix-ui/react-separator';
|
|
18
|
-
import '../../../../shadcn/sidebar.js';
|
|
19
|
-
import '@radix-ui/react-tooltip';
|
|
20
|
-
import { ReturnButton } from '../../../buttons/return-button.js';
|
|
21
|
-
|
|
22
|
-
function createBatchCreatePreset(ctx) {
|
|
23
|
-
const { props, t } = ctx;
|
|
24
|
-
return {
|
|
25
|
-
left: /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(ReturnButton, { useConfirm: true, replaceParent: true, ...props.returnButtonProps }) }),
|
|
26
|
-
titleProps: {
|
|
27
|
-
icon: FilePlus,
|
|
28
|
-
subtitle: t("ui.page-header.batch-create.subtitle.text")
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export { createBatchCreatePreset };
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { FilePen, CopyCheck, CopyX, FileX, FilePlus } from 'lucide-react';
|
|
3
|
-
import { Button } from '../../../buttons/button.js';
|
|
4
|
-
import { ReturnButton } from '../../../buttons/return-button.js';
|
|
5
|
-
|
|
6
|
-
function createBatchPreset(ctx) {
|
|
7
|
-
const { props, t } = ctx;
|
|
8
|
-
return {
|
|
9
|
-
left: /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(ReturnButton, { pushToParent: true, ...props.returnButtonProps, children: t("ui.button.exit-batch-mode.text") }) }),
|
|
10
|
-
titleProps: {
|
|
11
|
-
icon: FilePen,
|
|
12
|
-
subtitle: t("ui.page-header.batch.subtitle.text"),
|
|
13
|
-
children: /* @__PURE__ */ jsx(
|
|
14
|
-
Button,
|
|
15
|
-
{
|
|
16
|
-
variant: "success",
|
|
17
|
-
href: props.batchCreateButtonHref,
|
|
18
|
-
icon: FilePlus,
|
|
19
|
-
children: t("ui.button.batch-create.text")
|
|
20
|
-
}
|
|
21
|
-
)
|
|
22
|
-
},
|
|
23
|
-
right: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
24
|
-
/* @__PURE__ */ jsx(Button, { size: "icon", variant: "outline", onClick: props.selectAllFn, children: /* @__PURE__ */ jsx(CopyCheck, {}) }),
|
|
25
|
-
/* @__PURE__ */ jsx(Button, { size: "icon", variant: "outline", onClick: props.cancelAllFn, children: /* @__PURE__ */ jsx(CopyX, {}) }),
|
|
26
|
-
/* @__PURE__ */ jsx(
|
|
27
|
-
Button,
|
|
28
|
-
{
|
|
29
|
-
...props.destroyButtonProps,
|
|
30
|
-
variant: "destructive",
|
|
31
|
-
icon: FileX,
|
|
32
|
-
children: t("ui.button.destroy.text")
|
|
33
|
-
}
|
|
34
|
-
)
|
|
35
|
-
] })
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export { createBatchPreset };
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
2
|
-
import { FilePlus } from 'lucide-react';
|
|
3
|
-
import 'next/navigation';
|
|
4
|
-
import 'react';
|
|
5
|
-
import '@radix-ui/react-avatar';
|
|
6
|
-
import 'ua-parser-js';
|
|
7
|
-
import 'clsx';
|
|
8
|
-
import 'tailwind-merge';
|
|
9
|
-
import '../../../../shadcn/badge.js';
|
|
10
|
-
import '../../../../shadcn/button.js';
|
|
11
|
-
import '@radix-ui/react-collapsible';
|
|
12
|
-
import '@radix-ui/react-dialog';
|
|
13
|
-
import '@radix-ui/react-dropdown-menu';
|
|
14
|
-
import '../../../../shadcn/input-group.js';
|
|
15
|
-
import '@radix-ui/react-label';
|
|
16
|
-
import '@radix-ui/react-select';
|
|
17
|
-
import '@radix-ui/react-separator';
|
|
18
|
-
import '../../../../shadcn/sidebar.js';
|
|
19
|
-
import '@radix-ui/react-tooltip';
|
|
20
|
-
import { ReturnButton } from '../../../buttons/return-button.js';
|
|
21
|
-
|
|
22
|
-
function createCreatePreset(ctx) {
|
|
23
|
-
const { props, t } = ctx;
|
|
24
|
-
return {
|
|
25
|
-
left: /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(ReturnButton, { useConfirm: true, replaceParent: true, ...props.returnButtonProps }) }),
|
|
26
|
-
titleProps: {
|
|
27
|
-
icon: FilePlus,
|
|
28
|
-
subtitle: t("ui.page-header.create.subtitle.text")
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export { createCreatePreset };
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
2
|
-
import { FilePen } from 'lucide-react';
|
|
3
|
-
import 'next/navigation';
|
|
4
|
-
import 'react';
|
|
5
|
-
import '@radix-ui/react-avatar';
|
|
6
|
-
import 'ua-parser-js';
|
|
7
|
-
import 'clsx';
|
|
8
|
-
import 'tailwind-merge';
|
|
9
|
-
import '../../../../shadcn/badge.js';
|
|
10
|
-
import '../../../../shadcn/button.js';
|
|
11
|
-
import '@radix-ui/react-collapsible';
|
|
12
|
-
import '@radix-ui/react-dialog';
|
|
13
|
-
import '@radix-ui/react-dropdown-menu';
|
|
14
|
-
import '../../../../shadcn/input-group.js';
|
|
15
|
-
import '@radix-ui/react-label';
|
|
16
|
-
import '@radix-ui/react-select';
|
|
17
|
-
import '@radix-ui/react-separator';
|
|
18
|
-
import '../../../../shadcn/sidebar.js';
|
|
19
|
-
import '@radix-ui/react-tooltip';
|
|
20
|
-
import { ReturnButton } from '../../../buttons/return-button.js';
|
|
21
|
-
|
|
22
|
-
function createEditPreset(ctx) {
|
|
23
|
-
const { props, t } = ctx;
|
|
24
|
-
return {
|
|
25
|
-
left: /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(ReturnButton, { useConfirm: true, replaceParent: true, ...props.returnButtonProps }) }),
|
|
26
|
-
titleProps: {
|
|
27
|
-
icon: FilePen,
|
|
28
|
-
subtitle: t("ui.page-header.edit.subtitle.text")
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export { createEditPreset };
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
2
|
-
import { Files, FileStack, FolderCog, FileSpreadsheet, FilePlus } from 'lucide-react';
|
|
3
|
-
import { Button } from '../../../buttons/button.js';
|
|
4
|
-
import { ReturnButton } from '../../../buttons/return-button.js';
|
|
5
|
-
|
|
6
|
-
function createIndexPreset(ctx) {
|
|
7
|
-
const { props, t } = ctx;
|
|
8
|
-
return {
|
|
9
|
-
left: /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(ReturnButton, { pushToParent: true, ...props.returnButtonProps }) }),
|
|
10
|
-
titleProps: {
|
|
11
|
-
icon: Files,
|
|
12
|
-
children: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
13
|
-
props.settingButtonProps && props.showTopicSettingButton && /* @__PURE__ */ jsx(
|
|
14
|
-
Button,
|
|
15
|
-
{
|
|
16
|
-
...props.settingButtonProps,
|
|
17
|
-
variant: "outline",
|
|
18
|
-
icon: FolderCog,
|
|
19
|
-
isDisabled: props.settingButtonProps.isDisabled ?? props.isDisabled,
|
|
20
|
-
children: `${t("ui.button.setting.text")} ${t("resources.topic.text")}`
|
|
21
|
-
}
|
|
22
|
-
),
|
|
23
|
-
props.createCategoryButtonProps && /* @__PURE__ */ jsx(
|
|
24
|
-
Button,
|
|
25
|
-
{
|
|
26
|
-
...props.createCategoryButtonProps,
|
|
27
|
-
variant: "success",
|
|
28
|
-
icon: FileSpreadsheet,
|
|
29
|
-
isDisabled: props.createCategoryButtonProps.isDisabled ?? props.isDisabled,
|
|
30
|
-
children: t("ui.button.create.text")
|
|
31
|
-
}
|
|
32
|
-
),
|
|
33
|
-
props.createButtonProps && /* @__PURE__ */ jsx(
|
|
34
|
-
Button,
|
|
35
|
-
{
|
|
36
|
-
variant: "success",
|
|
37
|
-
icon: FilePlus,
|
|
38
|
-
...props.createButtonProps,
|
|
39
|
-
children: t("ui.button.create.text")
|
|
40
|
-
}
|
|
41
|
-
)
|
|
42
|
-
] })
|
|
43
|
-
},
|
|
44
|
-
right: props.batchButtonProps && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(Button, { variant: "outline", icon: FileStack, ...props.batchButtonProps, children: /* @__PURE__ */ jsx("span", { className: "text-sm", children: t("ui.button.batch.text") }) }) })
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export { createIndexPreset };
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
2
|
-
import { File, FileStack, FolderSearch, FilePen, FileX, Lock } from 'lucide-react';
|
|
3
|
-
import 'react';
|
|
4
|
-
import 'ua-parser-js';
|
|
5
|
-
import { cn } from '../../../../../../applications/shadcn/utils.js';
|
|
6
|
-
import 'next/navigation';
|
|
7
|
-
import { Button } from '../../../buttons/button.js';
|
|
8
|
-
import { ReturnButton } from '../../../buttons/return-button.js';
|
|
9
|
-
|
|
10
|
-
function createShowPreset(ctx) {
|
|
11
|
-
const { props, t } = ctx;
|
|
12
|
-
return {
|
|
13
|
-
left: /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(ReturnButton, { pushToParent: true, ...props.returnButtonProps }) }),
|
|
14
|
-
titleProps: {
|
|
15
|
-
icon: File,
|
|
16
|
-
children: !props.isNotFound && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
17
|
-
props.showButtonProps && /* @__PURE__ */ jsx(
|
|
18
|
-
Button,
|
|
19
|
-
{
|
|
20
|
-
...props.showButtonProps,
|
|
21
|
-
variant: "outline",
|
|
22
|
-
icon: FolderSearch,
|
|
23
|
-
isDisabled: props.showButtonProps.isDisabled || props.isDisabled,
|
|
24
|
-
children: `${t("ui.button.show.text")} ${t("resources.related.text")}`
|
|
25
|
-
}
|
|
26
|
-
),
|
|
27
|
-
props.editButtonProps && /* @__PURE__ */ jsx(
|
|
28
|
-
Button,
|
|
29
|
-
{
|
|
30
|
-
...props.editButtonProps,
|
|
31
|
-
variant: "warning",
|
|
32
|
-
icon: FilePen,
|
|
33
|
-
isDisabled: props.editButtonProps.isDisabled || props.isDisabled,
|
|
34
|
-
children: t("ui.button.edit.text")
|
|
35
|
-
}
|
|
36
|
-
),
|
|
37
|
-
props.destroyButtonProps && /* @__PURE__ */ jsx(
|
|
38
|
-
Button,
|
|
39
|
-
{
|
|
40
|
-
...props.destroyButtonProps,
|
|
41
|
-
variant: "destructive",
|
|
42
|
-
icon: FileX,
|
|
43
|
-
isDisabled: props.destroyButtonProps.isDisabled || props.isDisabled,
|
|
44
|
-
children: t("ui.button.destroy.text")
|
|
45
|
-
}
|
|
46
|
-
),
|
|
47
|
-
/* @__PURE__ */ jsx(
|
|
48
|
-
Lock,
|
|
49
|
-
{
|
|
50
|
-
className: cn(
|
|
51
|
-
props.isLocked && !props.isDisabled ? "opacity-100" : "opacity-0"
|
|
52
|
-
)
|
|
53
|
-
}
|
|
54
|
-
)
|
|
55
|
-
] })
|
|
56
|
-
},
|
|
57
|
-
right: props.batchButtonProps && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(Button, { variant: "outline", icon: FileStack, ...props.batchButtonProps, children: /* @__PURE__ */ jsx("span", { className: "text-sm", children: t("ui.button.batch.text") }) }) })
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export { createShowPreset };
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { Trash2, CopyCheck, CopyX, FileSymlink, FileX } from 'lucide-react';
|
|
3
|
-
import { Button } from '../../../buttons/button.js';
|
|
4
|
-
import { ReturnButton } from '../../../buttons/return-button.js';
|
|
5
|
-
|
|
6
|
-
function createTrashPreset(ctx) {
|
|
7
|
-
const { props, t } = ctx;
|
|
8
|
-
return {
|
|
9
|
-
left: /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(ReturnButton, { pushToParent: true, ...props.returnButtonProps }) }),
|
|
10
|
-
titleProps: {
|
|
11
|
-
icon: Trash2,
|
|
12
|
-
title: t("main.trash.text")
|
|
13
|
-
},
|
|
14
|
-
right: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
15
|
-
/* @__PURE__ */ jsx(Button, { size: "icon", variant: "outline", onClick: props.selectAllFn, children: /* @__PURE__ */ jsx(CopyCheck, {}) }),
|
|
16
|
-
/* @__PURE__ */ jsx(Button, { size: "icon", variant: "outline", onClick: props.cancelAllFn, children: /* @__PURE__ */ jsx(CopyX, {}) }),
|
|
17
|
-
/* @__PURE__ */ jsx(
|
|
18
|
-
Button,
|
|
19
|
-
{
|
|
20
|
-
...props.restoreButtonProps,
|
|
21
|
-
variant: "success",
|
|
22
|
-
icon: FileSymlink,
|
|
23
|
-
children: t("ui.button.restore.text")
|
|
24
|
-
}
|
|
25
|
-
),
|
|
26
|
-
/* @__PURE__ */ jsx(
|
|
27
|
-
Button,
|
|
28
|
-
{
|
|
29
|
-
...props.destroyButtonProps,
|
|
30
|
-
variant: "destructive",
|
|
31
|
-
icon: FileX,
|
|
32
|
-
children: t("ui.button.destroy.text")
|
|
33
|
-
}
|
|
34
|
-
)
|
|
35
|
-
] })
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export { createTrashPreset };
|