@oondemand/oon-core-front 0.3.68 → 0.3.70

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
@@ -342,6 +342,12 @@ type OonCollectionListConfig = {
342
342
  filters?: OonListFilterDef[];
343
343
  columns?: Array<string | OonColumnDef>;
344
344
  rowActions?: OonRowActionDef[];
345
+ /** Permite ocultar ações CRUD nativas quando a Central fornece ações de negócio próprias. */
346
+ builtInActions?: {
347
+ create?: boolean;
348
+ edit?: boolean;
349
+ delete?: boolean;
350
+ };
345
351
  };
346
352
  type OonRelationDef = {
347
353
  model: string;
package/dist/index.js CHANGED
@@ -1280,8 +1280,10 @@ function buildDomainMutationPayload(fields, values) {
1280
1280
  const payload = {};
1281
1281
  for (const field of fields) {
1282
1282
  if (field.readonly || field.computed) continue;
1283
- const value2 = coerceDomainFormValue(values[field.field] ?? "", field.kind);
1283
+ const rawValue = values[field.field] ?? "";
1284
+ const value2 = coerceDomainFormValue(rawValue, field.kind);
1284
1285
  if (value2 !== void 0) payload[field.field] = value2;
1286
+ else if (field.kind === "ref") payload[field.field] = null;
1285
1287
  }
1286
1288
  return payload;
1287
1289
  }
@@ -1336,6 +1338,12 @@ function ReferenceSelect({
1336
1338
  onChange
1337
1339
  }) {
1338
1340
  const initialLabel = useMemo3(() => initialReferenceLabel(initialValue), [initialValue]);
1341
+ const initialId = useMemo3(() => {
1342
+ if (initialValue && typeof initialValue === "object") {
1343
+ return referenceId(initialValue);
1344
+ }
1345
+ return String(initialValue ?? "");
1346
+ }, [initialValue]);
1339
1347
  const resolvedFilters = useMemo3(() => cleanFilters(filters), [filters]);
1340
1348
  const filtersKey = useMemo3(() => JSON.stringify(resolvedFilters), [resolvedFilters]);
1341
1349
  const emptyFieldsKey = useMemo3(() => JSON.stringify(emptyFields), [emptyFields]);
@@ -1357,8 +1365,8 @@ function ReferenceSelect({
1357
1365
  }, [search]);
1358
1366
  useEffect3(() => {
1359
1367
  if (!value2) setSelectedLabel("");
1360
- else if (initialLabel) setSelectedLabel(initialLabel);
1361
- }, [initialLabel, value2]);
1368
+ else if (initialId === value2 && initialLabel) setSelectedLabel(initialLabel);
1369
+ }, [initialId, initialLabel, value2]);
1362
1370
  useEffect3(() => {
1363
1371
  if (!disabled) return;
1364
1372
  setOpen(false);
@@ -3348,17 +3356,17 @@ function CoreCollection({ model, label, section = "Cole\xE7\xE3o", mode = "dynam
3348
3356
  columns: resolvedColumns,
3349
3357
  filters: list?.filters,
3350
3358
  cellRenderers,
3351
- onCreate: () => {
3359
+ onCreate: list?.builtInActions?.create === false ? void 0 : () => {
3352
3360
  setFormError(null);
3353
3361
  if (detailModal?.enabled) setDetailState({ open: true });
3354
3362
  else setFormState({ open: true });
3355
3363
  },
3356
- onEdit: (row) => {
3364
+ onEdit: list?.builtInActions?.edit === false ? void 0 : (row) => {
3357
3365
  setFormError(null);
3358
3366
  if (detailModal?.enabled) setDetailState({ open: true, row });
3359
3367
  else setFormState({ open: true, row });
3360
3368
  },
3361
- onDelete: (row) => {
3369
+ onDelete: list?.builtInActions?.delete === false ? void 0 : (row) => {
3362
3370
  if (window.confirm("Excluir este registro?")) deleteMutation.mutate(row);
3363
3371
  },
3364
3372
  renderRowActions: list?.rowActions?.length ? (row) => list.rowActions?.map((action) => /* @__PURE__ */ jsx17(
@@ -4577,7 +4585,7 @@ function Sidebar({ app, menu, registry }) {
4577
4585
  // package.json
4578
4586
  var package_default = {
4579
4587
  name: "@oondemand/oon-core-front",
4580
- version: "0.3.68",
4588
+ version: "0.3.70",
4581
4589
  repository: {
4582
4590
  type: "git",
4583
4591
  url: "git+https://github.com/oondemand/oon-platform.git",
@@ -6862,6 +6870,16 @@ function CoreIntegrationTickets({ provider = "omie" }) {
6862
6870
  await queue.refetch();
6863
6871
  }
6864
6872
  });
6873
+ const processPending = useMutation5({
6874
+ mutationFn: async () => http.post(
6875
+ "/integrations/queue/process",
6876
+ { provider, limit: 100 },
6877
+ { headers: { "x-oon-origin": "integration" } }
6878
+ ),
6879
+ onSuccess: async () => {
6880
+ await queue.refetch();
6881
+ }
6882
+ });
6865
6883
  useEffect10(() => {
6866
6884
  const totalPages2 = queue.data?.pagination?.totalPages ?? 1;
6867
6885
  if (page > totalPages2) setPage(Math.max(1, totalPages2));
@@ -6876,7 +6894,7 @@ function CoreIntegrationTickets({ provider = "omie" }) {
6876
6894
  const totalPages = Math.max(1, pagination?.totalPages ?? 1);
6877
6895
  const totalItems = pagination?.totalItems ?? 0;
6878
6896
  const statuses = queue.data?.summary?.statuses ?? {};
6879
- const operationError = action.error || queue.error;
6897
+ const operationError = action.error || processPending.error || queue.error;
6880
6898
  return /* @__PURE__ */ jsxs25(Stack11, { gap: 5, children: [
6881
6899
  /* @__PURE__ */ jsxs25(Flex17, { align: "start", justify: "space-between", gap: 3, wrap: "wrap", children: [
6882
6900
  /* @__PURE__ */ jsxs25(Box24, { children: [
@@ -6892,6 +6910,17 @@ function CoreIntegrationTickets({ provider = "omie" }) {
6892
6910
  setView("board");
6893
6911
  setPage(1);
6894
6912
  }, children: "Quadro" }),
6913
+ /* @__PURE__ */ jsx40(
6914
+ Button17,
6915
+ {
6916
+ size: "sm",
6917
+ colorPalette: "blue",
6918
+ loading: processPending.isPending,
6919
+ disabled: processPending.isPending,
6920
+ onClick: () => processPending.mutate(),
6921
+ children: "Processar pendentes"
6922
+ }
6923
+ ),
6895
6924
  /* @__PURE__ */ jsx40(Button17, { size: "sm", variant: "outline", loading: queue.isFetching, onClick: () => queue.refetch(), children: "Atualizar" })
6896
6925
  ] })
6897
6926
  ] }),