@adatechnology/content-ui 0.2.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/README.md +15 -0
- package/dist/index.d.ts +230 -24
- package/dist/index.js +1124 -176
- package/dist/index.js.map +1 -1
- package/dist/styles.css +292 -2
- package/dist/styles.css.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -48,6 +48,21 @@ const adminApi: ContentAdminApi = {
|
|
|
48
48
|
| `StatusChip` | `status` |
|
|
49
49
|
| `TagsInput` | `value`, `onChange`, `suggestions?`, `label` |
|
|
50
50
|
|
|
51
|
+
### Abas, modelos, republicar e publicação automática
|
|
52
|
+
|
|
53
|
+
Tudo opt-in pela API injetada (sem o método, a peça não aparece): `countPosts` liga as abas
|
|
54
|
+
**Publicados / Agendados / Rascunhos / Modelos** com contagem; `saveAsTemplate` e `createFromTemplate`
|
|
55
|
+
ligam "Salvar como modelo" e "Novo a partir do modelo"; `republishPost` liga "Republicar" (nova data, mesmo
|
|
56
|
+
link); `listRecurrences`/`createRecurrence`/`updateRecurrence`/`removeRecurrence` ligam o painel de
|
|
57
|
+
publicação automática na aba Modelos. Estado é sempre ícone + palavra + cor, e a dica usa o `Tooltip` do
|
|
58
|
+
pacote (hover e foco, nunca `title`). Para o host manter os próprios controles, o `ContentWorkspace` aceita
|
|
59
|
+
`renderDateTimeInput` e `renderSelect`; sem eles os diálogos usam `datetime-local` e `<select>` nativos.
|
|
60
|
+
|
|
61
|
+
A lista segue a regra de listagens: **busca primeiro e à esquerda**, depois filtros (abas por situação e tags
|
|
62
|
+
multisseleção) e as ações à direita; cabeçalhos ordenáveis (`aria-sort`), caixas de marcar próprias com ações em
|
|
63
|
+
lote (publicar, despublicar, excluir), paginação do servidor com "x–y de total" e itens por página. Com
|
|
64
|
+
`syncUrl`, busca, aba, tags, página, tamanho e ordem vão para a query string (`?tab=&q=&tags=&page=&size=&sort=&order=`).
|
|
65
|
+
|
|
51
66
|
O editor protege alterações não salvas (aviso do navegador ao fechar a aba e confirmação no botão
|
|
52
67
|
Voltar), valida com o mesmo schema do servidor, gera o slug do título enquanto o autor não o edita
|
|
53
68
|
e esconde o upload quando a API não tem `uploadCoverImage`.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { ReactNode } from 'react';
|
|
2
|
+
import { ReactNode, ReactElement } from 'react';
|
|
3
3
|
import * as _adatechnology_content_contracts from '@adatechnology/content-contracts';
|
|
4
|
-
import { PostStatus, Paginated, PostSummary, Post, CreatePostInput, UpdatePostInput, PublishPostInput, TagCount, PublicPostSummary, PublicPost } from '@adatechnology/content-contracts';
|
|
4
|
+
import { PostStatus, PostSortField, Paginated, PostSummary, Post, CreatePostInput, UpdatePostInput, PublishPostInput, PostCounts, SaveAsTemplateInput, CreateFromTemplateInput, RepublishPostInput, RecurrenceRule, CreateRecurrenceInput, UpdateRecurrenceInput, TagCount, PublicPostSummary, PublicPost } from '@adatechnology/content-contracts';
|
|
5
5
|
|
|
6
6
|
var statusDraft = "Rascunho";
|
|
7
7
|
var statusScheduled = "Agendado";
|
|
@@ -65,7 +65,7 @@ var schedule = "Agendar";
|
|
|
65
65
|
var unpublish = "Despublicar";
|
|
66
66
|
var archive = "Arquivar";
|
|
67
67
|
var archiveConfirm = "Arquivar este post? Ele sai do site.";
|
|
68
|
-
var close = "
|
|
68
|
+
var close = "Fechar";
|
|
69
69
|
var unsavedConfirm = "Há alterações não salvas. Sair mesmo assim?";
|
|
70
70
|
var unsavedBadge = "Alterações não salvas";
|
|
71
71
|
var saveError = "Não foi possível salvar.";
|
|
@@ -92,6 +92,57 @@ var shareOn = "Compartilhar no {network}";
|
|
|
92
92
|
var notFound = "Post não encontrado.";
|
|
93
93
|
var postsEmpty = "Nenhum post publicado ainda.";
|
|
94
94
|
var clearFilters = "Limpar filtros";
|
|
95
|
+
var statusTemplate = "Modelo";
|
|
96
|
+
var tabsLabel = "Situação dos posts";
|
|
97
|
+
var tabPublished = "Publicados";
|
|
98
|
+
var tabScheduled = "Agendados";
|
|
99
|
+
var tabDraft = "Rascunhos";
|
|
100
|
+
var tabTemplates = "Modelos";
|
|
101
|
+
var columnActions = "Ações";
|
|
102
|
+
var dialogCancel = "Cancelar";
|
|
103
|
+
var actionError = "Não foi possível concluir. Tente de novo.";
|
|
104
|
+
var emptyTemplates = "Nenhum modelo ainda. Em qualquer post, use “Salvar como modelo”.";
|
|
105
|
+
var saveAsTemplate = "Salvar como modelo";
|
|
106
|
+
var saveAsTemplateTip = "Cria uma cópia reutilizável. O post original não muda.";
|
|
107
|
+
var templateNameLabel = "Nome do modelo";
|
|
108
|
+
var newFromTemplate = "Novo a partir do modelo";
|
|
109
|
+
var newFromTemplateTip = "Cria um rascunho com o conteúdo do modelo.";
|
|
110
|
+
var newPostTitleLabel = "Título do novo post";
|
|
111
|
+
var createDraft = "Criar rascunho";
|
|
112
|
+
var republish = "Republicar";
|
|
113
|
+
var republishTip = "Muda a data e mantém o mesmo link: o jeito certo para buscadores.";
|
|
114
|
+
var republishDateLabel = "Nova data de publicação";
|
|
115
|
+
var republishHint = "O endereço do post não muda. Use agora ou uma data passada: data futura tiraria o post do ar.";
|
|
116
|
+
var recurrenceTitle = "Publicação automática";
|
|
117
|
+
var recurrenceNew = "Nova recorrência";
|
|
118
|
+
var recurrenceCreate = "Criar recorrência";
|
|
119
|
+
var recurrenceTemplate = "Modelo";
|
|
120
|
+
var recurrenceFrequency = "Repete";
|
|
121
|
+
var recurrenceStart = "Primeira publicação";
|
|
122
|
+
var frequencyWeekly = "Toda semana";
|
|
123
|
+
var frequencyMonthly = "Todo mês";
|
|
124
|
+
var recurrenceHint = "A cada data, um post novo é publicado sozinho a partir do modelo.";
|
|
125
|
+
var recurrenceNext = "próxima {date}";
|
|
126
|
+
var recurrenceActive = "Ativa";
|
|
127
|
+
var recurrencePaused = "Pausada";
|
|
128
|
+
var recurrencePause = "Pausar";
|
|
129
|
+
var recurrenceResume = "Retomar";
|
|
130
|
+
var recurrenceRemove = "Apagar regra";
|
|
131
|
+
var recurrenceRemoveTip = "Apaga só a regra. Os posts já publicados continuam no ar.";
|
|
132
|
+
var recurrenceEmpty = "Nenhuma recorrência. Crie uma para publicar sozinho toda semana ou mês.";
|
|
133
|
+
var recurrenceNeedsTemplate = "Crie um modelo primeiro para agendar publicações automáticas.";
|
|
134
|
+
var selectAll = "Selecionar todos";
|
|
135
|
+
var selectRow = "Selecionar {title}";
|
|
136
|
+
var selectedCount = "Selecionados: {count}";
|
|
137
|
+
var clearSelection = "Limpar seleção";
|
|
138
|
+
var batchLabel = "Ações em lote";
|
|
139
|
+
var batchPublish = "Publicar";
|
|
140
|
+
var batchUnpublish = "Despublicar";
|
|
141
|
+
var batchArchive = "Excluir";
|
|
142
|
+
var batchArchiveConfirm = "Excluir {count} posts? Eles saem do site; o conteúdo fica arquivado.";
|
|
143
|
+
var batchPartial = "Só {done} de {total} concluídos. Tente de novo nos demais.";
|
|
144
|
+
var itemsPerPage = "Por página";
|
|
145
|
+
var rangeLabel = "{from}–{to} de {total}";
|
|
95
146
|
var bodyHintToolbar = "Selecione o texto e use os botões acima. Atalhos: Ctrl+B negrito, Ctrl+I itálico, Ctrl+K link.";
|
|
96
147
|
var toolbarLabel = "Formatação do texto";
|
|
97
148
|
var formatBold = "Negrito";
|
|
@@ -111,7 +162,6 @@ var linkText = "Texto do link";
|
|
|
111
162
|
var imageDialogTitle = "Inserir imagem";
|
|
112
163
|
var imageUploadFromDevice = "Enviar do aparelho";
|
|
113
164
|
var dialogInsert = "Inserir";
|
|
114
|
-
var dialogCancel = "Cancelar";
|
|
115
165
|
var fileNoneChosen = "Nenhum arquivo escolhido";
|
|
116
166
|
var emojiTitle = "Escolher emoji";
|
|
117
167
|
var emojiSearch = "Buscar emoji";
|
|
@@ -214,6 +264,57 @@ var ptBR = {
|
|
|
214
264
|
notFound: notFound,
|
|
215
265
|
postsEmpty: postsEmpty,
|
|
216
266
|
clearFilters: clearFilters,
|
|
267
|
+
statusTemplate: statusTemplate,
|
|
268
|
+
tabsLabel: tabsLabel,
|
|
269
|
+
tabPublished: tabPublished,
|
|
270
|
+
tabScheduled: tabScheduled,
|
|
271
|
+
tabDraft: tabDraft,
|
|
272
|
+
tabTemplates: tabTemplates,
|
|
273
|
+
columnActions: columnActions,
|
|
274
|
+
dialogCancel: dialogCancel,
|
|
275
|
+
actionError: actionError,
|
|
276
|
+
emptyTemplates: emptyTemplates,
|
|
277
|
+
saveAsTemplate: saveAsTemplate,
|
|
278
|
+
saveAsTemplateTip: saveAsTemplateTip,
|
|
279
|
+
templateNameLabel: templateNameLabel,
|
|
280
|
+
newFromTemplate: newFromTemplate,
|
|
281
|
+
newFromTemplateTip: newFromTemplateTip,
|
|
282
|
+
newPostTitleLabel: newPostTitleLabel,
|
|
283
|
+
createDraft: createDraft,
|
|
284
|
+
republish: republish,
|
|
285
|
+
republishTip: republishTip,
|
|
286
|
+
republishDateLabel: republishDateLabel,
|
|
287
|
+
republishHint: republishHint,
|
|
288
|
+
recurrenceTitle: recurrenceTitle,
|
|
289
|
+
recurrenceNew: recurrenceNew,
|
|
290
|
+
recurrenceCreate: recurrenceCreate,
|
|
291
|
+
recurrenceTemplate: recurrenceTemplate,
|
|
292
|
+
recurrenceFrequency: recurrenceFrequency,
|
|
293
|
+
recurrenceStart: recurrenceStart,
|
|
294
|
+
frequencyWeekly: frequencyWeekly,
|
|
295
|
+
frequencyMonthly: frequencyMonthly,
|
|
296
|
+
recurrenceHint: recurrenceHint,
|
|
297
|
+
recurrenceNext: recurrenceNext,
|
|
298
|
+
recurrenceActive: recurrenceActive,
|
|
299
|
+
recurrencePaused: recurrencePaused,
|
|
300
|
+
recurrencePause: recurrencePause,
|
|
301
|
+
recurrenceResume: recurrenceResume,
|
|
302
|
+
recurrenceRemove: recurrenceRemove,
|
|
303
|
+
recurrenceRemoveTip: recurrenceRemoveTip,
|
|
304
|
+
recurrenceEmpty: recurrenceEmpty,
|
|
305
|
+
recurrenceNeedsTemplate: recurrenceNeedsTemplate,
|
|
306
|
+
selectAll: selectAll,
|
|
307
|
+
selectRow: selectRow,
|
|
308
|
+
selectedCount: selectedCount,
|
|
309
|
+
clearSelection: clearSelection,
|
|
310
|
+
batchLabel: batchLabel,
|
|
311
|
+
batchPublish: batchPublish,
|
|
312
|
+
batchUnpublish: batchUnpublish,
|
|
313
|
+
batchArchive: batchArchive,
|
|
314
|
+
batchArchiveConfirm: batchArchiveConfirm,
|
|
315
|
+
batchPartial: batchPartial,
|
|
316
|
+
itemsPerPage: itemsPerPage,
|
|
317
|
+
rangeLabel: rangeLabel,
|
|
217
318
|
bodyHintToolbar: bodyHintToolbar,
|
|
218
319
|
toolbarLabel: toolbarLabel,
|
|
219
320
|
formatBold: formatBold,
|
|
@@ -233,7 +334,6 @@ var ptBR = {
|
|
|
233
334
|
imageDialogTitle: imageDialogTitle,
|
|
234
335
|
imageUploadFromDevice: imageUploadFromDevice,
|
|
235
336
|
dialogInsert: dialogInsert,
|
|
236
|
-
dialogCancel: dialogCancel,
|
|
237
337
|
fileNoneChosen: fileNoneChosen,
|
|
238
338
|
emojiTitle: emojiTitle,
|
|
239
339
|
emojiSearch: emojiSearch,
|
|
@@ -273,8 +373,13 @@ type ListPostsParams = {
|
|
|
273
373
|
readonly page?: number;
|
|
274
374
|
readonly pageSize?: number;
|
|
275
375
|
readonly status?: PostStatus;
|
|
376
|
+
/** Uma tag, ou várias separadas por vírgula (basta ter uma). */
|
|
276
377
|
readonly tag?: string;
|
|
277
378
|
readonly search?: string;
|
|
379
|
+
readonly sort?: PostSortField;
|
|
380
|
+
readonly order?: 'asc' | 'desc';
|
|
381
|
+
/** `true`: só modelos. */
|
|
382
|
+
readonly isTemplate?: boolean;
|
|
278
383
|
};
|
|
279
384
|
type ContentAdminApi = {
|
|
280
385
|
listPosts(params: ListPostsParams): Promise<Paginated<PostSummary>>;
|
|
@@ -284,6 +389,18 @@ type ContentAdminApi = {
|
|
|
284
389
|
publishPost(id: string, input?: PublishPostInput): Promise<Post>;
|
|
285
390
|
unpublishPost(id: string): Promise<Post>;
|
|
286
391
|
archivePost(id: string): Promise<void>;
|
|
392
|
+
/** Ausente: a lista não tem abas por situação nem contagens (filtro de status em lista suspensa). */
|
|
393
|
+
countPosts?(): Promise<PostCounts>;
|
|
394
|
+
/** Ausente: sem "Salvar como modelo" e sem a aba Modelos. */
|
|
395
|
+
saveAsTemplate?(id: string, input?: SaveAsTemplateInput): Promise<Post>;
|
|
396
|
+
createFromTemplate?(id: string, input?: CreateFromTemplateInput): Promise<Post>;
|
|
397
|
+
/** Ausente: sem "Republicar". */
|
|
398
|
+
republishPost?(id: string, input?: RepublishPostInput): Promise<Post>;
|
|
399
|
+
/** Ausentes: sem o painel de publicação automática (recorrência). */
|
|
400
|
+
listRecurrences?(): Promise<readonly RecurrenceRule[]>;
|
|
401
|
+
createRecurrence?(input: CreateRecurrenceInput): Promise<RecurrenceRule>;
|
|
402
|
+
updateRecurrence?(id: string, input: UpdateRecurrenceInput): Promise<RecurrenceRule>;
|
|
403
|
+
removeRecurrence?(id: string): Promise<void>;
|
|
287
404
|
/** Ausente: o filtro de tag vira campo livre e o editor não sugere tags. */
|
|
288
405
|
listTags?(): Promise<readonly TagCount[]>;
|
|
289
406
|
/** Ausente: a capa é só por URL — sem alvo de upload que sempre falharia. */
|
|
@@ -323,6 +440,18 @@ type DateTimeInputProps = {
|
|
|
323
440
|
};
|
|
324
441
|
/** Troca o `<input type="datetime-local">` nativo pelo seletor de data e hora do host. */
|
|
325
442
|
type RenderDateTimeInput = (props: DateTimeInputProps) => ReactNode;
|
|
443
|
+
type SelectInputProps = {
|
|
444
|
+
readonly id: string;
|
|
445
|
+
readonly label: string;
|
|
446
|
+
readonly value: string;
|
|
447
|
+
readonly options: readonly {
|
|
448
|
+
readonly id: string;
|
|
449
|
+
readonly label: string;
|
|
450
|
+
}[];
|
|
451
|
+
readonly onChange: (value: string) => void;
|
|
452
|
+
};
|
|
453
|
+
/** Troca o `<select>` nativo pelo menu de seleção do host. */
|
|
454
|
+
type RenderSelect = (props: SelectInputProps) => ReactNode;
|
|
326
455
|
|
|
327
456
|
type ContentProviderProps = {
|
|
328
457
|
/** Painel: lista e editor. Site público não precisa passar. */
|
|
@@ -389,16 +518,19 @@ declare function validateDraft(draft: PostDraft): Partial<Record<DraftErrorField
|
|
|
389
518
|
/** Entrada do campo de tags: separa por vírgula/quebra e normaliza como o servidor fará. */
|
|
390
519
|
declare function splitTagInput(value: string): string[];
|
|
391
520
|
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
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>>;
|
|
399
533
|
};
|
|
400
|
-
declare function ContentWorkspace({ pageSize, newPostDefaults, onPostSaved, showFormattingToolbar, renderDateTimeInput, }: ContentWorkspaceProps): react.JSX.Element;
|
|
401
|
-
|
|
402
534
|
type PostListProps = {
|
|
403
535
|
readonly onSelect: (post: PostSummary) => void;
|
|
404
536
|
/** Ausente: sem botão "Novo post". */
|
|
@@ -406,8 +538,32 @@ type PostListProps = {
|
|
|
406
538
|
readonly pageSize?: number;
|
|
407
539
|
/** Mude o valor para forçar recarga (ex.: depois de salvar no editor). */
|
|
408
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;
|
|
409
547
|
};
|
|
410
|
-
declare function PostList({ onSelect, onCreate, pageSize, reloadKey }: PostListProps): react.JSX.Element;
|
|
548
|
+
declare function PostList({ onSelect, onCreate, pageSize, reloadKey, syncUrl, renderDateTimeInput, renderSelect, renderExport, }: PostListProps): react.JSX.Element;
|
|
549
|
+
|
|
550
|
+
type ContentWorkspaceProps = {
|
|
551
|
+
/** Repassado à lista: botão de exportação do host (opt-in). */
|
|
552
|
+
readonly renderExport?: PostListProps['renderExport'];
|
|
553
|
+
readonly pageSize?: number;
|
|
554
|
+
/** Valores iniciais do post novo (ex.: autor logado). */
|
|
555
|
+
readonly newPostDefaults?: Partial<PostDraft>;
|
|
556
|
+
readonly onPostSaved?: (post: Post) => void;
|
|
557
|
+
/** Seletor de data e hora do host (padrão: `datetime-local` nativo). */
|
|
558
|
+
readonly renderDateTimeInput?: RenderDateTimeInput;
|
|
559
|
+
/** Menu de seleção do host (padrão: `<select>` nativo). */
|
|
560
|
+
readonly renderSelect?: RenderSelect;
|
|
561
|
+
/** Busca, aba, tags, página, tamanho e ordem da lista na URL (padrão: não). */
|
|
562
|
+
readonly syncUrl?: boolean;
|
|
563
|
+
/** Barra de formatação do corpo do post (padrão: ligada). */
|
|
564
|
+
readonly showFormattingToolbar?: boolean;
|
|
565
|
+
};
|
|
566
|
+
declare function ContentWorkspace({ pageSize, newPostDefaults, onPostSaved, renderDateTimeInput, renderSelect, syncUrl, renderExport, showFormattingToolbar, }: ContentWorkspaceProps): react.JSX.Element;
|
|
411
567
|
|
|
412
568
|
type PostEditorProps = {
|
|
413
569
|
/** Ausente: post novo. */
|
|
@@ -425,6 +581,12 @@ type PostEditorProps = {
|
|
|
425
581
|
};
|
|
426
582
|
declare function PostEditor({ postId, defaults, onSaved, onArchived, onClose, showFormattingToolbar, renderDateTimeInput, }: PostEditorProps): react.JSX.Element;
|
|
427
583
|
|
|
584
|
+
type TooltipProps = {
|
|
585
|
+
readonly text: string;
|
|
586
|
+
readonly children: ReactElement;
|
|
587
|
+
};
|
|
588
|
+
declare function Tooltip({ text, children }: TooltipProps): react.JSX.Element;
|
|
589
|
+
|
|
428
590
|
declare const COVER_MAX_BYTES: number;
|
|
429
591
|
declare const COVER_MIME_TYPES: readonly string[];
|
|
430
592
|
type EditorFeedback = 'saved' | 'saveError' | 'coverTooLarge' | 'coverInvalidType' | 'coverUploadError' | 'errorSchedule';
|
|
@@ -500,8 +662,10 @@ declare function FilePicker({ buttonLabel, emptyLabel, accept, isBusy, onPick }:
|
|
|
500
662
|
|
|
501
663
|
type StatusChipProps = {
|
|
502
664
|
readonly status: PostStatus;
|
|
665
|
+
/** Modelo mostra "Modelo" no lugar do status (ele nunca vai ao ar). */
|
|
666
|
+
readonly isTemplate?: boolean;
|
|
503
667
|
};
|
|
504
|
-
declare function StatusChip({ status }: StatusChipProps): react.JSX.Element;
|
|
668
|
+
declare function StatusChip({ status, isTemplate }: StatusChipProps): react.JSX.Element;
|
|
505
669
|
|
|
506
670
|
/**
|
|
507
671
|
* Copyright (c) 2026 Ada Technology. MIT License.
|
|
@@ -630,21 +794,63 @@ type AsyncResource<TData> = {
|
|
|
630
794
|
*/
|
|
631
795
|
declare function useAsyncResource<TData>(load: () => Promise<TData>, key: string): AsyncResource<TData>;
|
|
632
796
|
|
|
797
|
+
/**
|
|
798
|
+
* Copyright (c) 2026 Ada Technology. MIT License.
|
|
799
|
+
*
|
|
800
|
+
* Estado da lista na URL (`?q=&tab=&tags=&page=&size=&sort=&order=`): recarregar a página, voltar do
|
|
801
|
+
* editor e mandar o link a um colega reabrem a lista exatamente como estava.
|
|
802
|
+
*/
|
|
803
|
+
|
|
804
|
+
declare const PAGE_SIZE_OPTIONS: readonly [10, 20, 50, 100];
|
|
805
|
+
type ListUrlState = {
|
|
806
|
+
readonly tab?: PostListTab;
|
|
807
|
+
readonly search: string;
|
|
808
|
+
readonly tags: readonly string[];
|
|
809
|
+
readonly page: number;
|
|
810
|
+
readonly pageSize?: number;
|
|
811
|
+
readonly sort: PostSortField;
|
|
812
|
+
readonly order: 'asc' | 'desc';
|
|
813
|
+
};
|
|
814
|
+
/** Lê a URL tolerando lixo: valor inválido cai no padrão, nunca quebra a tela. */
|
|
815
|
+
declare function parseListUrlState(search: string): ListUrlState;
|
|
816
|
+
/** Só grava o que difere do padrão: a URL de uma lista intocada fica limpa. */
|
|
817
|
+
declare function serializeListUrlState(state: ListUrlState): string;
|
|
818
|
+
|
|
819
|
+
/** Aba da lista: só existe quando a API injetada sabe contar (`countPosts`). */
|
|
820
|
+
declare const POST_LIST_TAB: {
|
|
821
|
+
readonly PUBLISHED: "published";
|
|
822
|
+
readonly SCHEDULED: "scheduled";
|
|
823
|
+
readonly DRAFT: "draft";
|
|
824
|
+
readonly TEMPLATES: "templates";
|
|
825
|
+
};
|
|
826
|
+
type PostListTab = (typeof POST_LIST_TAB)[keyof typeof POST_LIST_TAB];
|
|
633
827
|
type PostListFilters = {
|
|
634
|
-
readonly
|
|
635
|
-
readonly
|
|
636
|
-
readonly search?: string;
|
|
828
|
+
readonly tags: readonly string[];
|
|
829
|
+
readonly search: string;
|
|
637
830
|
};
|
|
638
831
|
declare function usePostList(params: {
|
|
639
832
|
readonly pageSize: number;
|
|
640
833
|
readonly reloadKey?: number;
|
|
834
|
+
/** Espelha busca, aba, tags, página, tamanho e ordem na query string da URL. */
|
|
835
|
+
readonly syncUrl?: boolean;
|
|
641
836
|
}): {
|
|
642
837
|
posts: AsyncResource<_adatechnology_content_contracts.Paginated<_adatechnology_content_contracts.PostSummary>>;
|
|
838
|
+
counts: PostCounts | undefined;
|
|
643
839
|
tags: readonly TagCount[] | undefined;
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
840
|
+
state: ListUrlState;
|
|
841
|
+
tab: PostListTab | undefined;
|
|
842
|
+
pageSize: number;
|
|
843
|
+
selectedIds: ReadonlySet<string>;
|
|
844
|
+
setSelectedIds: react.Dispatch<react.SetStateAction<ReadonlySet<string>>>;
|
|
845
|
+
toggleSelected: (id: string) => void;
|
|
846
|
+
toggleSort: (field: PostSortField) => void;
|
|
847
|
+
toggleTag: (tag: string) => void;
|
|
848
|
+
setTab: (next: PostListTab) => void;
|
|
849
|
+
setSearch: (search: string) => void;
|
|
850
|
+
setPageSize: (next: number) => void;
|
|
851
|
+
setPage: (page: number) => void;
|
|
852
|
+
clearFilters: () => void;
|
|
853
|
+
refresh: () => void;
|
|
648
854
|
hasFilters: boolean;
|
|
649
855
|
};
|
|
650
856
|
|
|
@@ -759,4 +965,4 @@ declare function buildPageItems(params: {
|
|
|
759
965
|
readonly siblings?: number;
|
|
760
966
|
}): PageItem[];
|
|
761
967
|
|
|
762
|
-
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, MarkdownContent, type MarkdownContentProps, MarkdownEditor, type MarkdownEditorProps, type PageItem, Pagination, type PaginationProps, PostCard, type PostCardProps, type PostDraft, PostEditor, type PostEditorProps, type PostEditorState, PostList, type PostListFilters, PostListPage, type PostListPageProps, type PostListProps, type PostMeta, PostPage, type PostPageProps, type RenderDateTimeInput, type RenderLink, type RenderLinkProps, SHARE_NETWORK, SHARE_NETWORKS, ShareButtons, type ShareButtonsProps, type ShareLink, type ShareNetwork, StatusChip, type StatusChipProps, TagsInput, type TagsInputProps, type TextSelection, type UploadImageResult, buildPageItems, buildPostMeta, buildShareLinks, deriveSlug, draftFromPost, draftToInput, formatPostDate, fromDateTimeLocalValue, insertImage, insertLink, insertText, interpolate, isDraftDirty, resolveContentMessages, searchEmoji, 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 };
|