@oondemand/oon-core-front 0.4.4 → 0.4.6

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
@@ -925,8 +925,9 @@ interface CoreCollectionProps {
925
925
  relations?: Record<string, OonRelationDef>;
926
926
  detailModal?: OonDetailModalConfig;
927
927
  cellRenderers?: OonComponentRegistry["cellRenderers"];
928
+ registry?: OonComponentRegistry;
928
929
  }
929
- declare function CoreCollection({ model, label, section, mode, endpoint, columns, form, importExport, list, relations, detailModal, cellRenderers }: CoreCollectionProps): react.JSX.Element;
930
+ declare function CoreCollection({ model, label, section, mode, endpoint, columns, form, importExport, list, relations, detailModal, cellRenderers, registry }: CoreCollectionProps): react.JSX.Element;
930
931
 
931
932
  interface CoreDocumentProps {
932
933
  model: string;
@@ -967,9 +968,10 @@ interface CorePipelineProps {
967
968
  list?: OonCollectionListConfig;
968
969
  defaultActions?: OonPipelineDefaultActionsDef;
969
970
  ticketActions?: OonPipelineActionDef[];
971
+ registry?: OonComponentRegistry;
970
972
  }
971
973
  /** Esteira com quadro/lista, filtros, inclusão e ações operacionais no ticket. */
972
- declare function CorePipeline({ model, label, endpoint, stageField, stages, titleField, form, relations, ticketModal, filters, create, viewModes, defaultView, list, defaultActions, ticketActions, }: CorePipelineProps): react.JSX.Element;
974
+ declare function CorePipeline({ model, label, endpoint, stageField, stages, titleField, form, relations, ticketModal, filters, create, viewModes, defaultView, list, defaultActions, ticketActions, registry, }: CorePipelineProps): react.JSX.Element;
973
975
 
974
976
  interface CoreIntegrationProps {
975
977
  label?: string;
package/dist/index.js CHANGED
@@ -3001,6 +3001,11 @@ function CoreRelatedGrid({
3001
3001
 
3002
3002
  // src/components/internal/CoreTabbedDetail.tsx
3003
3003
  import { jsx as jsx18, jsxs as jsxs12 } from "react/jsx-runtime";
3004
+ function resolveCustomDetailComponent(tab, registry) {
3005
+ if (tab?.type !== "customComponent") return void 0;
3006
+ const componentKey = tab.component.startsWith("custom:") ? tab.component.slice("custom:".length) : tab.component;
3007
+ return registry?.pageComponents?.[componentKey];
3008
+ }
3004
3009
  function toValue2(value2, kind) {
3005
3010
  if (value2 == null) return "";
3006
3011
  if (kind === "date") {
@@ -3375,6 +3380,7 @@ function CoreTabbedDetail({
3375
3380
  formFields,
3376
3381
  resource,
3377
3382
  relations,
3383
+ registry,
3378
3384
  refreshTokens,
3379
3385
  onRefresh,
3380
3386
  onParentSaved,
@@ -3384,6 +3390,7 @@ function CoreTabbedDetail({
3384
3390
  externalSubmit
3385
3391
  }) {
3386
3392
  const active = tabs.find((tab) => tab.id === activeTab) ?? tabs[0];
3393
+ const CustomComponent = resolveCustomDetailComponent(active, registry);
3387
3394
  const activeForm = active?.type === "form" ? active : void 0;
3388
3395
  const draftFields = useMemo7(() => fieldsForFormTabs(formFields, tabs), [formFields, tabs]);
3389
3396
  const formParent = useMemo7(() => parent ?? {}, [parent]);
@@ -3429,8 +3436,18 @@ function CoreTabbedDetail({
3429
3436
  refreshToken: refreshTokens[active.id],
3430
3437
  onRefresh
3431
3438
  }
3432
- ) : active.type === "customComponent" ? /* @__PURE__ */ jsxs12(Text12, { color: "#667085", children: [
3433
- "Componente customizado: ",
3439
+ ) : active.type === "customComponent" && CustomComponent ? /* @__PURE__ */ jsx18(
3440
+ CustomComponent,
3441
+ {
3442
+ ...active.props ?? {},
3443
+ parent,
3444
+ record: parent,
3445
+ recordId: parent?._id ?? parent?.id,
3446
+ refreshToken: refreshTokens[active.id],
3447
+ onRefresh
3448
+ }
3449
+ ) : active.type === "customComponent" ? /* @__PURE__ */ jsxs12(Text12, { color: "#C92A2A", children: [
3450
+ "Componente customizado n\xE3o registrado: ",
3434
3451
  active.component
3435
3452
  ] }) : /* @__PURE__ */ jsx18(Text12, { color: "#667085", children: "Salve o registro principal para liberar esta aba." })
3436
3453
  ] })
@@ -3439,7 +3456,7 @@ function CoreTabbedDetail({
3439
3456
 
3440
3457
  // src/components/internal/CoreDetailModal.tsx
3441
3458
  import { jsx as jsx19, jsxs as jsxs13 } from "react/jsx-runtime";
3442
- function CoreDetailModal({ model, title, config, formFields, recordId, initialRecord, initialTab, relations, topActions, bottomActions, onClose, onSaved }) {
3459
+ function CoreDetailModal({ model, title, config, formFields, recordId, initialRecord, initialTab, relations, registry, topActions, bottomActions, onClose, onSaved }) {
3443
3460
  const schemaQuery = useModelSchema(model);
3444
3461
  const schema = schemaQuery.data;
3445
3462
  const resource = useOonResource(schema?.basePath ?? `/${model.toLowerCase()}s`);
@@ -3522,6 +3539,7 @@ function CoreDetailModal({ model, title, config, formFields, recordId, initialRe
3522
3539
  formFields: resolvedFormFields,
3523
3540
  resource,
3524
3541
  relations,
3542
+ registry,
3525
3543
  refreshTokens,
3526
3544
  onRefresh: refresh,
3527
3545
  formId,
@@ -3578,7 +3596,7 @@ function mergeFormFields(metadataFields, overrides) {
3578
3596
  });
3579
3597
  return merged;
3580
3598
  }
3581
- function CoreCollection({ model, label, section = "Cole\xE7\xE3o", mode = "dynamic", endpoint, columns, form, importExport, list, relations, detailModal, cellRenderers }) {
3599
+ function CoreCollection({ model, label, section = "Cole\xE7\xE3o", mode = "dynamic", endpoint, columns, form, importExport, list, relations, detailModal, cellRenderers, registry }) {
3582
3600
  const needsSchema = mode !== "full" || !columns || !form || !endpoint;
3583
3601
  const schemaQuery = useModelSchema(needsSchema ? model : "");
3584
3602
  const schema = schemaQuery.data;
@@ -3683,6 +3701,7 @@ function CoreCollection({ model, label, section = "Cole\xE7\xE3o", mode = "dynam
3683
3701
  initialRecord: detailState.row,
3684
3702
  initialTab: detailState.initialTab,
3685
3703
  relations,
3704
+ registry,
3686
3705
  onClose: () => setDetailState({ open: false }),
3687
3706
  onSaved: invalidate
3688
3707
  }
@@ -3935,7 +3954,8 @@ function CorePipeline({
3935
3954
  defaultView,
3936
3955
  list,
3937
3956
  defaultActions,
3938
- ticketActions = []
3957
+ ticketActions = [],
3958
+ registry
3939
3959
  }) {
3940
3960
  const schemaQuery = useModelSchema(model);
3941
3961
  const schema = schemaQuery.data;
@@ -4264,6 +4284,7 @@ function CorePipeline({
4264
4284
  initialRecord: selectedTicket,
4265
4285
  initialTab: creating ? create?.initialTab : void 0,
4266
4286
  relations,
4287
+ registry,
4267
4288
  topActions: modalTopActions,
4268
4289
  bottomActions: modalBottomActions,
4269
4290
  onClose: () => {
@@ -4759,7 +4780,7 @@ function renderView(view, registry) {
4759
4780
  switch (view.type) {
4760
4781
  case "collection": {
4761
4782
  const v = view;
4762
- return /* @__PURE__ */ jsx29(CoreCollection, { model: v.model, mode: v.mode, columns: v.columns, form: v.form, label: viewLabel(v), section: v.section, importExport: v.importExport, list: v.list, relations: v.relations, detailModal: v.detailModal, cellRenderers: registry?.cellRenderers });
4783
+ return /* @__PURE__ */ jsx29(CoreCollection, { model: v.model, mode: v.mode, columns: v.columns, form: v.form, label: viewLabel(v), section: v.section, importExport: v.importExport, list: v.list, relations: v.relations, detailModal: v.detailModal, cellRenderers: registry?.cellRenderers, registry });
4763
4784
  }
4764
4785
  case "document": {
4765
4786
  const v = view;
@@ -4767,7 +4788,7 @@ function renderView(view, registry) {
4767
4788
  }
4768
4789
  case "pipeline": {
4769
4790
  const v = view;
4770
- return /* @__PURE__ */ jsx29(CorePipeline, { model: v.model, label: viewLabel(v), stageField: v.stageField, stages: v.stages, titleField: v.titleField, form: v.form, relations: v.relations, ticketModal: v.ticketModal, filters: v.filters, create: v.create, viewModes: v.viewModes, defaultView: v.defaultView, list: v.list, defaultActions: v.defaultActions, ticketActions: v.ticketActions });
4791
+ return /* @__PURE__ */ jsx29(CorePipeline, { model: v.model, label: viewLabel(v), stageField: v.stageField, stages: v.stages, titleField: v.titleField, form: v.form, relations: v.relations, ticketModal: v.ticketModal, filters: v.filters, create: v.create, viewModes: v.viewModes, defaultView: v.defaultView, list: v.list, defaultActions: v.defaultActions, ticketActions: v.ticketActions, registry });
4771
4792
  }
4772
4793
  case "dashboard": {
4773
4794
  const v = view;
@@ -4951,7 +4972,7 @@ function Sidebar({ app, menu, registry }) {
4951
4972
  // package.json
4952
4973
  var package_default = {
4953
4974
  name: "@oondemand/oon-core-front",
4954
- version: "0.4.4",
4975
+ version: "0.4.6",
4955
4976
  repository: {
4956
4977
  type: "git",
4957
4978
  url: "git+https://github.com/oondemand/oon-platform.git",