@oondemand/oon-core-front 0.3.11 → 0.3.14

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 CHANGED
@@ -246,6 +246,7 @@ interface OonColumnDef {
246
246
  permissions?: string[];
247
247
  capabilities?: string[];
248
248
  }
249
+ type OonFormFieldWidget = "default" | "checkbox";
249
250
  interface OonFormFieldDef {
250
251
  field: string;
251
252
  label?: string;
@@ -255,6 +256,19 @@ interface OonFormFieldDef {
255
256
  /** model relacionada quando kind === "ref". */
256
257
  ref?: string;
257
258
  renderer?: string;
259
+ /** Controle visual pontual sem substituir a página/formulário inteiro. */
260
+ widget?: OonFormFieldWidget;
261
+ /** Valor persistido quando um checkbox está marcado. Default: true. */
262
+ checkedValue?: string | number | boolean;
263
+ /** Valor persistido quando um checkbox está desmarcado. Default: false. */
264
+ uncheckedValue?: string | number | boolean;
265
+ /** Agrupa campos relacionados em um bloco visual comum. */
266
+ group?: string;
267
+ /** Rótulo exibido uma vez acima do grupo. Default: group. */
268
+ groupLabel?: string;
269
+ groupDescription?: string;
270
+ /** Exibe controles do mesmo grupo na mesma linha quando houver espaço. */
271
+ inline?: boolean;
258
272
  permissions?: string[];
259
273
  capabilities?: string[];
260
274
  }
@@ -267,6 +281,138 @@ interface OonActionDef {
267
281
  capabilities?: string[];
268
282
  action?: string;
269
283
  }
284
+ type OonListFilterDef = {
285
+ field: string;
286
+ label?: string;
287
+ type?: "text" | "select" | "date" | "dateRange" | "numberRange" | "boolean" | "ref";
288
+ options?: Array<{
289
+ label: string;
290
+ value: string | number | boolean | null;
291
+ }>;
292
+ defaultValue?: unknown;
293
+ placeholder?: string;
294
+ };
295
+ type OonConditionDef = {
296
+ field: string;
297
+ exists: boolean;
298
+ } | {
299
+ field: string;
300
+ equals: unknown;
301
+ } | {
302
+ field: string;
303
+ notEquals: unknown;
304
+ } | {
305
+ field: string;
306
+ in: unknown[];
307
+ } | {
308
+ field: string;
309
+ gt: number;
310
+ } | {
311
+ field: string;
312
+ gte: number;
313
+ } | {
314
+ field: string;
315
+ lt: number;
316
+ } | {
317
+ field: string;
318
+ lte: number;
319
+ };
320
+ type OonRowActionDef = {
321
+ id?: string;
322
+ label: string;
323
+ icon?: string;
324
+ type: "openDetailModal" | "navigate" | "apiAction" | "customAction";
325
+ method?: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
326
+ endpoint?: string;
327
+ href?: string;
328
+ initialTab?: string;
329
+ confirm?: {
330
+ title?: string;
331
+ description?: string;
332
+ };
333
+ disabledWhen?: OonConditionDef;
334
+ hiddenWhen?: OonConditionDef;
335
+ refresh?: Array<"self" | "parent" | "all" | string>;
336
+ roles?: string[];
337
+ permissions?: string[];
338
+ capabilities?: string[];
339
+ renderer?: string;
340
+ };
341
+ type OonCollectionListConfig = {
342
+ filters?: OonListFilterDef[];
343
+ columns?: Array<string | OonColumnDef>;
344
+ rowActions?: OonRowActionDef[];
345
+ };
346
+ type OonRelationDef = {
347
+ model: string;
348
+ foreignKey: string;
349
+ parentKey?: string;
350
+ label?: string;
351
+ };
352
+ type OonRelatedGridColumnDef = OonColumnDef & {
353
+ editable?: boolean;
354
+ readonly?: boolean;
355
+ format?: "text" | "number" | "currency" | "percent" | "date" | "badge";
356
+ editor?: "string" | "number" | "currency" | "date" | "enum" | "select" | "ref" | "boolean" | "textarea";
357
+ hidden?: boolean;
358
+ roles?: string[];
359
+ required?: boolean;
360
+ display?: "badgeExists" | "badge" | string;
361
+ };
362
+ type OonSummaryCardDef = {
363
+ label: string;
364
+ source?: "field" | "relatedCount" | "relatedSum" | "relatedAvg" | "customMetric";
365
+ field?: string;
366
+ relation?: string | OonRelationDef;
367
+ metric?: string;
368
+ format?: "text" | "number" | "currency" | "percent" | "date" | "badge";
369
+ };
370
+ type OonDetailTabDef = {
371
+ id: string;
372
+ label: string;
373
+ type: "summary";
374
+ cards?: OonSummaryCardDef[];
375
+ } | {
376
+ id: string;
377
+ label: string;
378
+ type: "form";
379
+ groups?: Array<{
380
+ label: string;
381
+ description?: string;
382
+ fields: string[];
383
+ columns?: 1 | 2 | 3 | 4;
384
+ }>;
385
+ fields?: string[];
386
+ } | {
387
+ id: string;
388
+ label: string;
389
+ type: "relatedGrid";
390
+ relation: string | OonRelationDef;
391
+ editable?: boolean;
392
+ editMode?: "inline" | "modal" | "drawer";
393
+ columns?: Array<string | OonRelatedGridColumnDef>;
394
+ rowActions?: OonRowActionDef[];
395
+ } | {
396
+ id: string;
397
+ label: string;
398
+ type: "readonlyGrid";
399
+ relation: string | OonRelationDef;
400
+ columns?: Array<string | OonRelatedGridColumnDef>;
401
+ rowActions?: OonRowActionDef[];
402
+ } | {
403
+ id: string;
404
+ label: string;
405
+ type: "customComponent";
406
+ component: string;
407
+ props?: Record<string, unknown>;
408
+ };
409
+ type OonDetailModalConfig = {
410
+ enabled?: boolean;
411
+ titleField?: string;
412
+ size?: "md" | "lg" | "xl" | "full";
413
+ defaultTab?: string;
414
+ tabs: OonDetailTabDef[];
415
+ };
270
416
  interface CollectionViewDef {
271
417
  type: "collection";
272
418
  /** id de rota/menu; default = model em minúsculas. */
@@ -280,12 +426,15 @@ interface CollectionViewDef {
280
426
  mode?: CollectionMode;
281
427
  /** modo "full": colunas explícitas. */
282
428
  columns?: OonColumnDef[];
283
- /** modo "full": campos de formulário explícitos. */
429
+ /** Campos explícitos ou overrides pontuais sobre a metadata do model. */
284
430
  form?: OonFormFieldDef[];
285
431
  importExport?: boolean;
286
432
  renderer?: string;
287
433
  cardRenderer?: string;
288
434
  actions?: OonActionDef[];
435
+ list?: OonCollectionListConfig;
436
+ relations?: Record<string, OonRelationDef>;
437
+ detailModal?: OonDetailModalConfig;
289
438
  permissions?: string[];
290
439
  capabilities?: string[];
291
440
  }
@@ -448,6 +597,11 @@ interface CentralUiManifest {
448
597
  path?: string;
449
598
  label?: string;
450
599
  section?: string;
600
+ /** Overrides pontuais de campos; os demais continuam vindo da metadata. */
601
+ form?: OonFormFieldDef[];
602
+ list?: OonCollectionListConfig;
603
+ relations?: Record<string, OonRelationDef>;
604
+ detailModal?: OonDetailModalConfig;
451
605
  }>;
452
606
  pipelines?: Array<{
453
607
  name?: string;
@@ -517,8 +671,11 @@ interface CoreCollectionProps {
517
671
  columns?: OonColumnDef[];
518
672
  form?: OonFormFieldDef[];
519
673
  importExport?: boolean;
674
+ list?: OonCollectionListConfig;
675
+ relations?: Record<string, OonRelationDef>;
676
+ detailModal?: OonDetailModalConfig;
520
677
  }
521
- declare function CoreCollection({ model, label, section, mode, endpoint, columns, form, importExport }: CoreCollectionProps): react.JSX.Element;
678
+ declare function CoreCollection({ model, label, section, mode, endpoint, columns, form, importExport, list, relations, detailModal }: CoreCollectionProps): react.JSX.Element;
522
679
 
523
680
  interface CoreDocumentProps {
524
681
  model: string;