@adatechnology/content-ui 0.3.0 → 0.4.0
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/index.d.ts +33 -16
- package/dist/index.js +24 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -518,7 +518,38 @@ declare function validateDraft(draft: PostDraft): Partial<Record<DraftErrorField
|
|
|
518
518
|
/** Entrada do campo de tags: separa por vírgula/quebra e normaliza como o servidor fará. */
|
|
519
519
|
declare function splitTagInput(value: string): string[];
|
|
520
520
|
|
|
521
|
+
/**
|
|
522
|
+
* O que a lista está mostrando agora, para o host montar um botão "Exportar" ao lado dos filtros.
|
|
523
|
+
*
|
|
524
|
+
* O pacote não exporta nada: quem gera o arquivo é o backend do host, com os mesmos filtros da tela.
|
|
525
|
+
* `filters` traz os filtros ativos já como texto; `pageCount`, quantas linhas a página tem.
|
|
526
|
+
*/
|
|
527
|
+
type ListExportContext = {
|
|
528
|
+
readonly total: number;
|
|
529
|
+
readonly page: number;
|
|
530
|
+
readonly pageSize: number;
|
|
531
|
+
readonly pageCount: number;
|
|
532
|
+
readonly filters: Readonly<Record<string, string>>;
|
|
533
|
+
};
|
|
534
|
+
type PostListProps = {
|
|
535
|
+
readonly onSelect: (post: PostSummary) => void;
|
|
536
|
+
/** Ausente: sem botão "Novo post". */
|
|
537
|
+
readonly onCreate?: () => void;
|
|
538
|
+
readonly pageSize?: number;
|
|
539
|
+
/** Mude o valor para forçar recarga (ex.: depois de salvar no editor). */
|
|
540
|
+
readonly reloadKey?: number;
|
|
541
|
+
/** Guarda busca, aba, tags, página, tamanho e ordem na query string. */
|
|
542
|
+
readonly syncUrl?: boolean;
|
|
543
|
+
readonly renderDateTimeInput?: RenderDateTimeInput;
|
|
544
|
+
readonly renderSelect?: RenderSelect;
|
|
545
|
+
/** Ausente: sem exportação. Opt-in do host, na barra do título. */
|
|
546
|
+
readonly renderExport?: (context: ListExportContext) => ReactNode;
|
|
547
|
+
};
|
|
548
|
+
declare function PostList({ onSelect, onCreate, pageSize, reloadKey, syncUrl, renderDateTimeInput, renderSelect, renderExport, }: PostListProps): react.JSX.Element;
|
|
549
|
+
|
|
521
550
|
type ContentWorkspaceProps = {
|
|
551
|
+
/** Repassado à lista: botão de exportação do host (opt-in). */
|
|
552
|
+
readonly renderExport?: PostListProps['renderExport'];
|
|
522
553
|
readonly pageSize?: number;
|
|
523
554
|
/** Valores iniciais do post novo (ex.: autor logado). */
|
|
524
555
|
readonly newPostDefaults?: Partial<PostDraft>;
|
|
@@ -532,21 +563,7 @@ type ContentWorkspaceProps = {
|
|
|
532
563
|
/** Barra de formatação do corpo do post (padrão: ligada). */
|
|
533
564
|
readonly showFormattingToolbar?: boolean;
|
|
534
565
|
};
|
|
535
|
-
declare function ContentWorkspace({ pageSize, newPostDefaults, onPostSaved, renderDateTimeInput, renderSelect, syncUrl, showFormattingToolbar, }: ContentWorkspaceProps): react.JSX.Element;
|
|
536
|
-
|
|
537
|
-
type PostListProps = {
|
|
538
|
-
readonly onSelect: (post: PostSummary) => void;
|
|
539
|
-
/** Ausente: sem botão "Novo post". */
|
|
540
|
-
readonly onCreate?: () => void;
|
|
541
|
-
readonly pageSize?: number;
|
|
542
|
-
/** Mude o valor para forçar recarga (ex.: depois de salvar no editor). */
|
|
543
|
-
readonly reloadKey?: number;
|
|
544
|
-
/** Guarda busca, aba, tags, página, tamanho e ordem na query string. */
|
|
545
|
-
readonly syncUrl?: boolean;
|
|
546
|
-
readonly renderDateTimeInput?: RenderDateTimeInput;
|
|
547
|
-
readonly renderSelect?: RenderSelect;
|
|
548
|
-
};
|
|
549
|
-
declare function PostList({ onSelect, onCreate, pageSize, reloadKey, syncUrl, renderDateTimeInput, renderSelect, }: PostListProps): react.JSX.Element;
|
|
566
|
+
declare function ContentWorkspace({ pageSize, newPostDefaults, onPostSaved, renderDateTimeInput, renderSelect, syncUrl, renderExport, showFormattingToolbar, }: ContentWorkspaceProps): react.JSX.Element;
|
|
550
567
|
|
|
551
568
|
type PostEditorProps = {
|
|
552
569
|
/** Ausente: post novo. */
|
|
@@ -948,4 +965,4 @@ declare function buildPageItems(params: {
|
|
|
948
965
|
readonly siblings?: number;
|
|
949
966
|
}): PageItem[];
|
|
950
967
|
|
|
951
|
-
export { type AsyncResource, COVER_MAX_BYTES, COVER_MIME_TYPES, type ContentAdminApi, type ContentLocale, type ContentMessages, ContentProvider, type ContentProviderProps, type ContentPublicApi, type ContentText, ContentWorkspace, type ContentWorkspaceProps, DEFAULT_CONTENT_LOCALE, DRAFT_ERROR, type DateTimeInputProps, type DraftErrorField, EMOJI_BY_CATEGORY, EMOJI_CATEGORIES, EMPTY_POST_DRAFT, type EditorFeedback, EmojiPicker, type EmojiPickerProps, FilePicker, type FilePickerProps, type LinePrefixKind, type ListPostsParams, type ListPublishedPostsParams, type ListUrlState, MarkdownContent, type MarkdownContentProps, MarkdownEditor, type MarkdownEditorProps, PAGE_SIZE_OPTIONS, POST_LIST_TAB, type PageItem, Pagination, type PaginationProps, PostCard, type PostCardProps, type PostDraft, PostEditor, type PostEditorProps, type PostEditorState, PostList, type PostListFilters, PostListPage, type PostListPageProps, type PostListProps, type PostListTab, type PostMeta, PostPage, type PostPageProps, type RenderDateTimeInput, type RenderLink, type RenderLinkProps, type RenderSelect, SHARE_NETWORK, SHARE_NETWORKS, type SelectInputProps, ShareButtons, type ShareButtonsProps, type ShareLink, type ShareNetwork, StatusChip, type StatusChipProps, TagsInput, type TagsInputProps, type TextSelection, Tooltip, type TooltipProps, type UploadImageResult, buildPageItems, buildPostMeta, buildShareLinks, deriveSlug, draftFromPost, draftToInput, formatPostDate, fromDateTimeLocalValue, insertImage, insertLink, insertText, interpolate, isDraftDirty, parseListUrlState, resolveContentMessages, searchEmoji, serializeListUrlState, splitTagInput, toDateTimeLocalValue, toggleLinePrefix, toggleWrap, useAsyncResource, useContentAdminApi, useContentPublicApi, useContentText, usePostEditor, usePostList, useRenderLink, useUnsavedChangesGuard, validateDraft };
|
|
968
|
+
export { type AsyncResource, COVER_MAX_BYTES, COVER_MIME_TYPES, type ContentAdminApi, type ContentLocale, type ContentMessages, ContentProvider, type ContentProviderProps, type ContentPublicApi, type ContentText, ContentWorkspace, type ContentWorkspaceProps, DEFAULT_CONTENT_LOCALE, DRAFT_ERROR, type DateTimeInputProps, type DraftErrorField, EMOJI_BY_CATEGORY, EMOJI_CATEGORIES, EMPTY_POST_DRAFT, type EditorFeedback, EmojiPicker, type EmojiPickerProps, FilePicker, type FilePickerProps, type LinePrefixKind, type ListExportContext, type ListPostsParams, type ListPublishedPostsParams, type ListUrlState, MarkdownContent, type MarkdownContentProps, MarkdownEditor, type MarkdownEditorProps, PAGE_SIZE_OPTIONS, POST_LIST_TAB, type PageItem, Pagination, type PaginationProps, PostCard, type PostCardProps, type PostDraft, PostEditor, type PostEditorProps, type PostEditorState, PostList, type PostListFilters, PostListPage, type PostListPageProps, type PostListProps, type PostListTab, type PostMeta, PostPage, type PostPageProps, type RenderDateTimeInput, type RenderLink, type RenderLinkProps, type RenderSelect, SHARE_NETWORK, SHARE_NETWORKS, type SelectInputProps, ShareButtons, type ShareButtonsProps, type ShareLink, type ShareNetwork, StatusChip, type StatusChipProps, TagsInput, type TagsInputProps, type TextSelection, Tooltip, type TooltipProps, type UploadImageResult, buildPageItems, buildPostMeta, buildShareLinks, deriveSlug, draftFromPost, draftToInput, formatPostDate, fromDateTimeLocalValue, insertImage, insertLink, insertText, interpolate, isDraftDirty, parseListUrlState, resolveContentMessages, searchEmoji, serializeListUrlState, splitTagInput, toDateTimeLocalValue, toggleLinePrefix, toggleWrap, useAsyncResource, useContentAdminApi, useContentPublicApi, useContentText, usePostEditor, usePostList, useRenderLink, useUnsavedChangesGuard, validateDraft };
|
package/dist/index.js
CHANGED
|
@@ -2572,6 +2572,15 @@ function RecurrencePanel(props) {
|
|
|
2572
2572
|
|
|
2573
2573
|
// src/components/PostList.tsx
|
|
2574
2574
|
import { jsx as jsx23, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
2575
|
+
function buildExportFilters(state, tab) {
|
|
2576
|
+
return {
|
|
2577
|
+
...tab ? { tab } : {},
|
|
2578
|
+
...state.search ? { search: state.search } : {},
|
|
2579
|
+
...state.tags.length > 0 ? { tag: state.tags.join(",") } : {},
|
|
2580
|
+
sort: state.sort,
|
|
2581
|
+
order: state.order
|
|
2582
|
+
};
|
|
2583
|
+
}
|
|
2575
2584
|
function PostList({
|
|
2576
2585
|
onSelect,
|
|
2577
2586
|
onCreate,
|
|
@@ -2579,7 +2588,8 @@ function PostList({
|
|
|
2579
2588
|
reloadKey,
|
|
2580
2589
|
syncUrl,
|
|
2581
2590
|
renderDateTimeInput,
|
|
2582
|
-
renderSelect
|
|
2591
|
+
renderSelect,
|
|
2592
|
+
renderExport
|
|
2583
2593
|
}) {
|
|
2584
2594
|
const { messages } = useContentText();
|
|
2585
2595
|
const api = useContentAdminApi();
|
|
@@ -2625,7 +2635,16 @@ function PostList({
|
|
|
2625
2635
|
list.setSelectedIds(list.selectedIds.size === rows.length ? /* @__PURE__ */ new Set() : new Set(rows.map((row) => row.id)));
|
|
2626
2636
|
}
|
|
2627
2637
|
return /* @__PURE__ */ jsxs20("section", { className: "adc-root adc-post-list", children: [
|
|
2628
|
-
/* @__PURE__ */
|
|
2638
|
+
/* @__PURE__ */ jsxs20("header", { className: "adc-toolbar", children: [
|
|
2639
|
+
/* @__PURE__ */ jsx23("h2", { className: "adc-title", children: messages.listTitle }),
|
|
2640
|
+
renderExport && posts.data ? renderExport({
|
|
2641
|
+
total: posts.data.pagination.total,
|
|
2642
|
+
page: state.page,
|
|
2643
|
+
pageSize: list.pageSize,
|
|
2644
|
+
pageCount: posts.data.data.length,
|
|
2645
|
+
filters: buildExportFilters(list.state, tab)
|
|
2646
|
+
}) : null
|
|
2647
|
+
] }),
|
|
2629
2648
|
/* @__PURE__ */ jsx23(
|
|
2630
2649
|
PostListToolbar,
|
|
2631
2650
|
{
|
|
@@ -2713,6 +2732,7 @@ function ContentWorkspace({
|
|
|
2713
2732
|
renderDateTimeInput,
|
|
2714
2733
|
renderSelect,
|
|
2715
2734
|
syncUrl,
|
|
2735
|
+
renderExport,
|
|
2716
2736
|
showFormattingToolbar
|
|
2717
2737
|
}) {
|
|
2718
2738
|
const [view, setView] = useState15({ kind: "list" });
|
|
@@ -2749,7 +2769,8 @@ function ContentWorkspace({
|
|
|
2749
2769
|
...syncUrl ? { syncUrl } : {},
|
|
2750
2770
|
...pageSize ? { pageSize } : {},
|
|
2751
2771
|
onSelect: (post) => setView({ kind: "editor", postId: post.id }),
|
|
2752
|
-
onCreate: () => setView({ kind: "editor" })
|
|
2772
|
+
onCreate: () => setView({ kind: "editor" }),
|
|
2773
|
+
...renderExport ? { renderExport } : {}
|
|
2753
2774
|
}
|
|
2754
2775
|
);
|
|
2755
2776
|
}
|