pixelon 0.9.4 → 0.9.5
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.
|
@@ -272,9 +272,16 @@ export interface ReactiveCrudConfig {
|
|
|
272
272
|
layout?: 'auto' | 'table' | 'cards';
|
|
273
273
|
/** SPEC-093 — ancho (px) por debajo del cual `auto` pinta tarjetas. 768 por defecto. */
|
|
274
274
|
cardsBelow?: number;
|
|
275
|
-
/** SPEC-087 — cuenta atrás en el panel de un registro. Ver `DeadlineConfig`.
|
|
276
|
-
|
|
275
|
+
/** SPEC-087 — cuenta atrás en el panel de un registro. Ver `DeadlineConfig`.
|
|
276
|
+
* SPEC-187 — o VARIAS: se pinta la primera cuyo campo trae valor. Un módulo puede tener más
|
|
277
|
+
* de un plazo (el de la solicitud, el del comprobante) y nunca corren a la vez. */
|
|
278
|
+
deadline?: DeadlineConfig | DeadlineConfig[];
|
|
277
279
|
}
|
|
280
|
+
/** SPEC-187 — de los plazos configurados, el que corre en esta fila (el primero con valor). */
|
|
281
|
+
export declare function plazoVigente(deadline: DeadlineConfig | DeadlineConfig[] | undefined, row: Record<string, unknown> | null | undefined): {
|
|
282
|
+
config: DeadlineConfig;
|
|
283
|
+
at: string;
|
|
284
|
+
} | null;
|
|
278
285
|
/** SPEC-087 — fecha límite de un registro, pintada como cuenta atrás junto a sus acciones.
|
|
279
286
|
*
|
|
280
287
|
* Es deliberadamente genérico: dice «esta tarjeta tiene una fecha límite», no de qué es el plazo.
|
package/dist/index.esm.js
CHANGED
|
@@ -16867,8 +16867,20 @@ function collapseLocationFields(fields, valores) {
|
|
|
16867
16867
|
if (f.moleculeType !== "LOCATION" || !f.bind) continue;
|
|
16868
16868
|
const address = out[f.bind.address];
|
|
16869
16869
|
if (typeof address !== "string" || !address.trim()) continue;
|
|
16870
|
-
out[f.
|
|
16870
|
+
const lat = out[f.bind.lat];
|
|
16871
|
+
const lng = out[f.bind.lng];
|
|
16872
|
+
const source = f.bind.source ? out[f.bind.source] : void 0;
|
|
16873
|
+
const valor = { address };
|
|
16874
|
+
if (typeof lat === "number" && typeof lng === "number") {
|
|
16875
|
+
valor.lat = lat;
|
|
16876
|
+
valor.lng = lng;
|
|
16877
|
+
}
|
|
16878
|
+
if (typeof source === "string" && source) valor.source = source;
|
|
16879
|
+
out[f.name] = valor;
|
|
16871
16880
|
delete out[f.bind.address];
|
|
16881
|
+
delete out[f.bind.lat];
|
|
16882
|
+
delete out[f.bind.lng];
|
|
16883
|
+
if (f.bind.source) delete out[f.bind.source];
|
|
16872
16884
|
}
|
|
16873
16885
|
return out;
|
|
16874
16886
|
}
|
|
@@ -17021,6 +17033,8 @@ function ReactiveCrudChat({ component, eventBus, assistantMessageId }) {
|
|
|
17021
17033
|
const moduleKey = pick("module");
|
|
17022
17034
|
const openCreate = pick("openCreate") === true;
|
|
17023
17035
|
const prefill = pick("prefill");
|
|
17036
|
+
const createLabel = pick("createLabel");
|
|
17037
|
+
const createdLabel = pick("createdLabel");
|
|
17024
17038
|
let config;
|
|
17025
17039
|
if (typeof moduleKey === "string" && resolveModuleConfig) {
|
|
17026
17040
|
config = resolveModuleConfig(moduleKey);
|
|
@@ -17043,7 +17057,7 @@ function ReactiveCrudChat({ component, eventBus, assistantMessageId }) {
|
|
|
17043
17057
|
if (!config) return null;
|
|
17044
17058
|
const title = config.title ?? "Gesti\xF3n";
|
|
17045
17059
|
const done = openCreate && created;
|
|
17046
|
-
const triggerLabel = done ? config.labels?.createdButton ?? "Solicitud enviada" : openCreate ? config.labels?.createButton ?? "Crear" : `Abrir ${title.toLowerCase()}`;
|
|
17060
|
+
const triggerLabel = done ? createdLabel ?? config.labels?.createdButton ?? "Solicitud enviada" : openCreate ? createLabel ?? config.labels?.createButton ?? "Crear" : `Abrir ${title.toLowerCase()}`;
|
|
17047
17061
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
17048
17062
|
/* @__PURE__ */ jsxs(
|
|
17049
17063
|
"button",
|
|
@@ -17113,6 +17127,16 @@ function ReactiveCrudChat({ component, eventBus, assistantMessageId }) {
|
|
|
17113
17127
|
] });
|
|
17114
17128
|
}
|
|
17115
17129
|
|
|
17130
|
+
function plazoVigente(deadline, row) {
|
|
17131
|
+
if (!deadline || !row) return null;
|
|
17132
|
+
const lista = Array.isArray(deadline) ? deadline : [deadline];
|
|
17133
|
+
for (const d of lista) {
|
|
17134
|
+
const at = row[d.field];
|
|
17135
|
+
if (typeof at === "string" && at) return { config: d, at };
|
|
17136
|
+
}
|
|
17137
|
+
return null;
|
|
17138
|
+
}
|
|
17139
|
+
|
|
17116
17140
|
function restante(hasta) {
|
|
17117
17141
|
return Math.max(0, hasta - Date.now());
|
|
17118
17142
|
}
|
|
@@ -17224,6 +17248,7 @@ function ServiceActionsPanel({ config, recordId, recordLabel, allowed, sinAccion
|
|
|
17224
17248
|
return () => observador.disconnect();
|
|
17225
17249
|
}, [recordId]);
|
|
17226
17250
|
const gastada = !esUltima;
|
|
17251
|
+
const plazo = plazoVigente(config.deadline, row);
|
|
17227
17252
|
const actions = useMemo(() => {
|
|
17228
17253
|
if (!row) return [];
|
|
17229
17254
|
if (gastada) {
|
|
@@ -17255,12 +17280,12 @@ function ServiceActionsPanel({ config, recordId, recordLabel, allowed, sinAccion
|
|
|
17255
17280
|
crud.loading && !row && /* @__PURE__ */ jsx("div", { className: "px-chat-crud-item__hint", children: "Cargando\u2026" }),
|
|
17256
17281
|
!crud.loading && !row && /* @__PURE__ */ jsx("div", { className: "px-chat-crud-item__hint", children: "No se encontr\xF3 el servicio." }),
|
|
17257
17282
|
gastada && /* @__PURE__ */ jsx("div", { className: "px-chat-crud-item__hint", children: "Este paso ya se gestion\xF3. Contin\xFAa en el mensaje m\xE1s reciente." }),
|
|
17258
|
-
row && !gastada &&
|
|
17283
|
+
row && !gastada && plazo && /* @__PURE__ */ jsx(
|
|
17259
17284
|
DeadlineCountdown,
|
|
17260
17285
|
{
|
|
17261
|
-
deadline:
|
|
17262
|
-
label: config.
|
|
17263
|
-
expiredLabel: config.
|
|
17286
|
+
deadline: plazo.at,
|
|
17287
|
+
label: plazo.config.label,
|
|
17288
|
+
expiredLabel: plazo.config.expiredLabel
|
|
17264
17289
|
}
|
|
17265
17290
|
),
|
|
17266
17291
|
row && /* @__PURE__ */ jsxs("div", { className: "px-chat-crud-item__actions", children: [
|
package/dist/index.js
CHANGED
|
@@ -16888,8 +16888,20 @@ function collapseLocationFields(fields, valores) {
|
|
|
16888
16888
|
if (f.moleculeType !== "LOCATION" || !f.bind) continue;
|
|
16889
16889
|
const address = out[f.bind.address];
|
|
16890
16890
|
if (typeof address !== "string" || !address.trim()) continue;
|
|
16891
|
-
out[f.
|
|
16891
|
+
const lat = out[f.bind.lat];
|
|
16892
|
+
const lng = out[f.bind.lng];
|
|
16893
|
+
const source = f.bind.source ? out[f.bind.source] : void 0;
|
|
16894
|
+
const valor = { address };
|
|
16895
|
+
if (typeof lat === "number" && typeof lng === "number") {
|
|
16896
|
+
valor.lat = lat;
|
|
16897
|
+
valor.lng = lng;
|
|
16898
|
+
}
|
|
16899
|
+
if (typeof source === "string" && source) valor.source = source;
|
|
16900
|
+
out[f.name] = valor;
|
|
16892
16901
|
delete out[f.bind.address];
|
|
16902
|
+
delete out[f.bind.lat];
|
|
16903
|
+
delete out[f.bind.lng];
|
|
16904
|
+
if (f.bind.source) delete out[f.bind.source];
|
|
16893
16905
|
}
|
|
16894
16906
|
return out;
|
|
16895
16907
|
}
|
|
@@ -17042,6 +17054,8 @@ function ReactiveCrudChat({ component, eventBus, assistantMessageId }) {
|
|
|
17042
17054
|
const moduleKey = pick("module");
|
|
17043
17055
|
const openCreate = pick("openCreate") === true;
|
|
17044
17056
|
const prefill = pick("prefill");
|
|
17057
|
+
const createLabel = pick("createLabel");
|
|
17058
|
+
const createdLabel = pick("createdLabel");
|
|
17045
17059
|
let config;
|
|
17046
17060
|
if (typeof moduleKey === "string" && resolveModuleConfig) {
|
|
17047
17061
|
config = resolveModuleConfig(moduleKey);
|
|
@@ -17064,7 +17078,7 @@ function ReactiveCrudChat({ component, eventBus, assistantMessageId }) {
|
|
|
17064
17078
|
if (!config) return null;
|
|
17065
17079
|
const title = config.title ?? "Gesti\xF3n";
|
|
17066
17080
|
const done = openCreate && created;
|
|
17067
|
-
const triggerLabel = done ? config.labels?.createdButton ?? "Solicitud enviada" : openCreate ? config.labels?.createButton ?? "Crear" : `Abrir ${title.toLowerCase()}`;
|
|
17081
|
+
const triggerLabel = done ? createdLabel ?? config.labels?.createdButton ?? "Solicitud enviada" : openCreate ? createLabel ?? config.labels?.createButton ?? "Crear" : `Abrir ${title.toLowerCase()}`;
|
|
17068
17082
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
17069
17083
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
17070
17084
|
"button",
|
|
@@ -17134,6 +17148,16 @@ function ReactiveCrudChat({ component, eventBus, assistantMessageId }) {
|
|
|
17134
17148
|
] });
|
|
17135
17149
|
}
|
|
17136
17150
|
|
|
17151
|
+
function plazoVigente(deadline, row) {
|
|
17152
|
+
if (!deadline || !row) return null;
|
|
17153
|
+
const lista = Array.isArray(deadline) ? deadline : [deadline];
|
|
17154
|
+
for (const d of lista) {
|
|
17155
|
+
const at = row[d.field];
|
|
17156
|
+
if (typeof at === "string" && at) return { config: d, at };
|
|
17157
|
+
}
|
|
17158
|
+
return null;
|
|
17159
|
+
}
|
|
17160
|
+
|
|
17137
17161
|
function restante(hasta) {
|
|
17138
17162
|
return Math.max(0, hasta - Date.now());
|
|
17139
17163
|
}
|
|
@@ -17245,6 +17269,7 @@ function ServiceActionsPanel({ config, recordId, recordLabel, allowed, sinAccion
|
|
|
17245
17269
|
return () => observador.disconnect();
|
|
17246
17270
|
}, [recordId]);
|
|
17247
17271
|
const gastada = !esUltima;
|
|
17272
|
+
const plazo = plazoVigente(config.deadline, row);
|
|
17248
17273
|
const actions = React.useMemo(() => {
|
|
17249
17274
|
if (!row) return [];
|
|
17250
17275
|
if (gastada) {
|
|
@@ -17276,12 +17301,12 @@ function ServiceActionsPanel({ config, recordId, recordLabel, allowed, sinAccion
|
|
|
17276
17301
|
crud.loading && !row && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-chat-crud-item__hint", children: "Cargando\u2026" }),
|
|
17277
17302
|
!crud.loading && !row && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-chat-crud-item__hint", children: "No se encontr\xF3 el servicio." }),
|
|
17278
17303
|
gastada && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-chat-crud-item__hint", children: "Este paso ya se gestion\xF3. Contin\xFAa en el mensaje m\xE1s reciente." }),
|
|
17279
|
-
row && !gastada &&
|
|
17304
|
+
row && !gastada && plazo && /* @__PURE__ */ jsxRuntime.jsx(
|
|
17280
17305
|
DeadlineCountdown,
|
|
17281
17306
|
{
|
|
17282
|
-
deadline:
|
|
17283
|
-
label: config.
|
|
17284
|
-
expiredLabel: config.
|
|
17307
|
+
deadline: plazo.at,
|
|
17308
|
+
label: plazo.config.label,
|
|
17309
|
+
expiredLabel: plazo.config.expiredLabel
|
|
17285
17310
|
}
|
|
17286
17311
|
),
|
|
17287
17312
|
row && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-chat-crud-item__actions", children: [
|