pixelon 0.5.2 → 0.5.4

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.
@@ -48,6 +48,15 @@ export interface ReactiveCrudField {
48
48
  showInModes?: Array<'create' | 'edit' | 'view'>;
49
49
  required?: boolean;
50
50
  placeholder?: string;
51
+ /** SPEC-137 — con qué nace el campo cuando el formulario se abre desde una fila.
52
+ *
53
+ * Acepta un literal o un `$campo`, que se resuelve contra la fila igual que en `payloadMap`.
54
+ * Es para cuando el sistema YA SABE la respuesta y preguntarla otra vez es hacer teclear lo que
55
+ * está en pantalla: el motivo de un rechazo que el propio sistema acaba de explicar, por
56
+ * ejemplo. Mismo principio que SPEC-095 — el botón ya lo dijo.
57
+ *
58
+ * Sigue siendo editable: es un punto de partida, no una respuesta impuesta. */
59
+ defaultValue?: string;
51
60
  options?: Array<{
52
61
  value: string;
53
62
  label: string;
package/dist/index.esm.js CHANGED
@@ -14606,6 +14606,14 @@ function ActionFormDrawer({ action, row, idField, eventBus, onExecute, onClose }
14606
14606
  }, [eventBus, action.key, normalFields]);
14607
14607
  const { locale } = useChatConfig();
14608
14608
  const separadores = useMemo(() => separadoresDelLocale(locale), [locale]);
14609
+ const defaultValues = useMemo(() => {
14610
+ const out = {};
14611
+ for (const f of normalFields) {
14612
+ if (f.defaultValue === void 0) continue;
14613
+ out[f.name] = typeof f.defaultValue === "string" && f.defaultValue.startsWith("$") ? row[f.defaultValue.slice(1)] : f.defaultValue;
14614
+ }
14615
+ return out;
14616
+ }, [normalFields, row]);
14609
14617
  const fields = useMemo(
14610
14618
  () => normalFields.map((f) => ({
14611
14619
  name: f.name,
@@ -14709,6 +14717,7 @@ function ActionFormDrawer({ action, row, idField, eventBus, onExecute, onClose }
14709
14717
  DynamicForm,
14710
14718
  {
14711
14719
  fields,
14720
+ defaultValues,
14712
14721
  validationSchema,
14713
14722
  onSubmit: (values) => void runSubmit(values),
14714
14723
  onCancel: onClose,
@@ -16902,7 +16911,8 @@ const ServicesMap = ({ config, eventBus, apiKey, filter, fill }) => {
16902
16911
  () => livePoints.length === 1 ? livePoints[0].id : void 0,
16903
16912
  [livePoints]
16904
16913
  );
16905
- return /* @__PURE__ */ jsx("div", { className: fill ? `${CLASS$6} ${CLASS$6}--fill` : CLASS$6, children: rows === null ? /* @__PURE__ */ jsx("p", { className: `${CLASS$6}__state`, children: labels.loadingText ?? "Cargando ubicaciones\u2026" }) : /* @__PURE__ */ jsxs(Fragment, { children: [
16914
+ const nadaQueDibujar = rows !== null && allPoints.length === 0 && route.length === 0;
16915
+ return /* @__PURE__ */ jsx("div", { className: fill ? `${CLASS$6} ${CLASS$6}--fill` : CLASS$6, children: rows === null ? /* @__PURE__ */ jsx("p", { className: `${CLASS$6}__state`, children: labels.loadingText ?? "Cargando ubicaciones\u2026" }) : nadaQueDibujar ? /* @__PURE__ */ jsx("p", { className: `${CLASS$6}__state`, children: lineaSinMapa(labels, missing, failed) }) : /* @__PURE__ */ jsxs(Fragment, { children: [
16906
16916
  /* @__PURE__ */ jsx(
16907
16917
  MapView,
16908
16918
  {
@@ -16934,6 +16944,16 @@ const ServicesMap = ({ config, eventBus, apiKey, filter, fill }) => {
16934
16944
  ] }) });
16935
16945
  };
16936
16946
  ServicesMap.displayName = "ServicesMap";
16947
+ function lineaSinMapa(labels, missing, failed) {
16948
+ if (failed) return "No se pudieron cargar las ubicaciones.";
16949
+ if (missing === 1) {
16950
+ return (labels.missingTextOne ?? labels.missingText ?? "{n} sin ubicaci\xF3n registrada").replace("{n}", "1");
16951
+ }
16952
+ if (missing > 1) {
16953
+ return (labels.missingText ?? "{n} sin ubicaci\xF3n registrada").replace("{n}", String(missing));
16954
+ }
16955
+ return labels.emptyText ?? "Sin ubicaciones para mostrar";
16956
+ }
16937
16957
 
16938
16958
  const CLASS$5 = `${COMPONENT_PREFIX$1}service-shortcuts`;
16939
16959
  const ICONS = {
package/dist/index.js CHANGED
@@ -14627,6 +14627,14 @@ function ActionFormDrawer({ action, row, idField, eventBus, onExecute, onClose }
14627
14627
  }, [eventBus, action.key, normalFields]);
14628
14628
  const { locale } = useChatConfig();
14629
14629
  const separadores = React.useMemo(() => separadoresDelLocale(locale), [locale]);
14630
+ const defaultValues = React.useMemo(() => {
14631
+ const out = {};
14632
+ for (const f of normalFields) {
14633
+ if (f.defaultValue === void 0) continue;
14634
+ out[f.name] = typeof f.defaultValue === "string" && f.defaultValue.startsWith("$") ? row[f.defaultValue.slice(1)] : f.defaultValue;
14635
+ }
14636
+ return out;
14637
+ }, [normalFields, row]);
14630
14638
  const fields = React.useMemo(
14631
14639
  () => normalFields.map((f) => ({
14632
14640
  name: f.name,
@@ -14730,6 +14738,7 @@ function ActionFormDrawer({ action, row, idField, eventBus, onExecute, onClose }
14730
14738
  DynamicForm,
14731
14739
  {
14732
14740
  fields,
14741
+ defaultValues,
14733
14742
  validationSchema,
14734
14743
  onSubmit: (values) => void runSubmit(values),
14735
14744
  onCancel: onClose,
@@ -16923,7 +16932,8 @@ const ServicesMap = ({ config, eventBus, apiKey, filter, fill }) => {
16923
16932
  () => livePoints.length === 1 ? livePoints[0].id : void 0,
16924
16933
  [livePoints]
16925
16934
  );
16926
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: fill ? `${CLASS$6} ${CLASS$6}--fill` : CLASS$6, children: rows === null ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: `${CLASS$6}__state`, children: labels.loadingText ?? "Cargando ubicaciones\u2026" }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
16935
+ const nadaQueDibujar = rows !== null && allPoints.length === 0 && route.length === 0;
16936
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: fill ? `${CLASS$6} ${CLASS$6}--fill` : CLASS$6, children: rows === null ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: `${CLASS$6}__state`, children: labels.loadingText ?? "Cargando ubicaciones\u2026" }) : nadaQueDibujar ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: `${CLASS$6}__state`, children: lineaSinMapa(labels, missing, failed) }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
16927
16937
  /* @__PURE__ */ jsxRuntime.jsx(
16928
16938
  MapView,
16929
16939
  {
@@ -16955,6 +16965,16 @@ const ServicesMap = ({ config, eventBus, apiKey, filter, fill }) => {
16955
16965
  ] }) });
16956
16966
  };
16957
16967
  ServicesMap.displayName = "ServicesMap";
16968
+ function lineaSinMapa(labels, missing, failed) {
16969
+ if (failed) return "No se pudieron cargar las ubicaciones.";
16970
+ if (missing === 1) {
16971
+ return (labels.missingTextOne ?? labels.missingText ?? "{n} sin ubicaci\xF3n registrada").replace("{n}", "1");
16972
+ }
16973
+ if (missing > 1) {
16974
+ return (labels.missingText ?? "{n} sin ubicaci\xF3n registrada").replace("{n}", String(missing));
16975
+ }
16976
+ return labels.emptyText ?? "Sin ubicaciones para mostrar";
16977
+ }
16958
16978
 
16959
16979
  const CLASS$5 = `${COMPONENT_PREFIX$1}service-shortcuts`;
16960
16980
  const ICONS = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pixelon",
3
- "version": "0.5.2",
3
+ "version": "0.5.4",
4
4
  "description": "Design system de la marca goluti",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -26,7 +26,8 @@
26
26
  "get:ip": "ipconfig getifaddr en0",
27
27
  "gen:ux-types": "node scripts/gen-ux-types.mjs",
28
28
  "gen:ux-types:check": "node scripts/gen-ux-types.mjs --check",
29
- "prepublishOnly": "npm run build:lib"
29
+ "prepublishOnly": "npm run build:lib",
30
+ "publicar": "bash scripts/publicar.sh"
30
31
  },
31
32
  "keywords": [
32
33
  "pixelon",