@almadar/std 3.7.0 → 3.8.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.
@@ -302,7 +302,7 @@ function buildTrait(c) {
302
302
  if (isRefresh) {
303
303
  return { key: e, name: e, payload: [{ name: "data", type: "object", required: true }] };
304
304
  }
305
- return needsId ? { key: e, name: e, payload: [{ name: "id", type: "string", required: true }] } : { key: e, name: e };
305
+ return needsId ? { key: e, name: e, payload: [{ name: "id", type: "string", required: true }, { name: "row", type: "object" }] } : { key: e, name: e };
306
306
  })
307
307
  ];
308
308
  const listensDecl = c.refreshEvents.length > 0 ? c.refreshEvents.map((evt) => ({ event: evt, triggers: evt })) : void 0;
@@ -3066,14 +3066,14 @@ function buildStepUI(c, stepIndex) {
3066
3066
  };
3067
3067
  }
3068
3068
  function buildReviewUI(c) {
3069
- const reviewDetailChildren = c.nonIdFields.map((field) => ({
3069
+ const reviewRows = c.nonIdFields.map((field) => ({
3070
3070
  type: "stack",
3071
3071
  direction: "horizontal",
3072
3072
  gap: "md",
3073
3073
  justify: "space-between",
3074
3074
  children: [
3075
- { type: "typography", variant: "caption", content: field.name.charAt(0).toUpperCase() + field.name.slice(1) },
3076
- { type: "typography", variant: "body", content: `@item.${field.name}` }
3075
+ { type: "typography", variant: "caption", content: field.name.charAt(0).toUpperCase() + field.name.slice(1).replace(/([A-Z])/g, " $1") },
3076
+ { type: "typography", variant: "body", content: `@entity.${field.name}` }
3077
3077
  ]
3078
3078
  }));
3079
3079
  return {
@@ -3095,14 +3095,11 @@ function buildReviewUI(c) {
3095
3095
  { type: "wizard-progress", steps: c.wizardProgressSteps, currentStep: c.totalSteps },
3096
3096
  { type: "divider" },
3097
3097
  {
3098
- type: "data-list",
3098
+ type: "stack",
3099
+ direction: "vertical",
3100
+ gap: "sm",
3099
3101
  entity: c.entityName,
3100
- renderItem: ["fn", "item", {
3101
- type: "stack",
3102
- direction: "vertical",
3103
- gap: "sm",
3104
- children: reviewDetailChildren
3105
- }]
3102
+ children: reviewRows
3106
3103
  },
3107
3104
  {
3108
3105
  type: "wizard-navigation",
@@ -8449,7 +8446,7 @@ function resolve52(params) {
8449
8446
  createButtonLabel: params.createButtonLabel ?? `Create ${entityName}`,
8450
8447
  createFormTitle: params.createFormTitle ?? `Create ${entityName}`,
8451
8448
  editFormTitle: params.editFormTitle ?? `Edit ${entityName}`,
8452
- deleteMessage: params.deleteMessage ?? `Are you sure you want to delete this ${entityName.toLowerCase()}?`,
8449
+ deleteMessage: params.deleteMessage ?? `This action cannot be undone.`,
8453
8450
  emptyTitle: params.emptyTitle ?? `No ${p.toLowerCase()} yet`,
8454
8451
  emptyDescription: params.emptyDescription ?? `Create your first ${entityName.toLowerCase()} to get started.`,
8455
8452
  headerIcon: params.headerIcon ?? "list",
@@ -8601,6 +8598,10 @@ function stdList(params) {
8601
8598
  }));
8602
8599
  const sm = browseTrait.stateMachine;
8603
8600
  sm.states.push({ name: "deleting" });
8601
+ const deleteEvent = sm.events.find((e) => e.key === "DELETE");
8602
+ if (deleteEvent && !deleteEvent.payload) {
8603
+ deleteEvent.payload = [{ name: "id", type: "string" }, { name: "row", type: "object" }];
8604
+ }
8604
8605
  const existingKeys = new Set(sm.events.map((e) => e.key));
8605
8606
  if (!existingKeys.has("CONFIRM_DELETE")) sm.events.push({ key: "CONFIRM_DELETE", name: "Confirm Delete" });
8606
8607
  if (!existingKeys.has("CANCEL")) sm.events.push({ key: "CANCEL", name: "Cancel" });
@@ -8624,6 +8625,7 @@ function stdList(params) {
8624
8625
  { type: "typography", content: `Delete ${entityName}`, variant: "h3" }
8625
8626
  ] },
8626
8627
  { type: "divider" },
8628
+ { type: "typography", content: `@entity.${c.nonIdFields[0]?.name ?? "name"}`, variant: "h4" },
8627
8629
  { type: "typography", content: c.deleteMessage, variant: "body" },
8628
8630
  { type: "stack", direction: "horizontal", gap: "sm", justify: "end", children: [
8629
8631
  { type: "button", label: "Cancel", event: "CANCEL", variant: "ghost" },