@esfaenza/flow-builder 20.3.6 → 20.3.7

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.
@@ -800,7 +800,7 @@ function elementIcon(type, label, variant) {
800
800
  if (icon) {
801
801
  return icon;
802
802
  }
803
- const fallback = (label || type).trim().charAt(0).toUpperCase();
803
+ const fallback = (label || type)?.trim().charAt(0).toUpperCase();
804
804
  return fallback || '•';
805
805
  }
806
806
 
@@ -865,7 +865,7 @@ function isValidFlowName(name) {
865
865
  * `currentName` esclude se stesso dal controllo, per non segnalare un elemento in modifica.
866
866
  */
867
867
  function checkFlowName(name, usedNames, currentName) {
868
- const trimmed = (name ?? '').trim();
868
+ const trimmed = (name ?? '')?.trim();
869
869
  if (!trimmed) {
870
870
  return { isValid: false, problem: 'empty', message: 'Il nome tecnico e’ obbligatorio.' };
871
871
  }
@@ -896,7 +896,7 @@ function checkFlowName(name, usedNames, currentName) {
896
896
  * Va lasciato modificabile finche' l'elemento e' nuovo.
897
897
  */
898
898
  function slugifyFlowName(label) {
899
- const source = (label ?? '').trim();
899
+ const source = (label ?? '')?.trim();
900
900
  if (!source) {
901
901
  return '';
902
902
  }
@@ -938,7 +938,7 @@ function uniqueFlowName(base, usedNames) {
938
938
  * `Cliente.Email` → `Cliente`; `$Record.Stato` → `$Record`; `Importo` → `Importo`.
939
939
  */
940
940
  function referenceRoot(reference) {
941
- const value = (reference ?? '').trim();
941
+ const value = (reference ?? '')?.trim();
942
942
  const dot = value.indexOf('.');
943
943
  return dot < 0 ? value : value.slice(0, dot);
944
944
  }
@@ -960,7 +960,7 @@ function isCustomConditionLogic(logic) {
960
960
  if (!logic) {
961
961
  return false;
962
962
  }
963
- const normalized = logic.trim().toLowerCase();
963
+ const normalized = logic?.trim().toLowerCase();
964
964
  return normalized !== 'and' && normalized !== 'or' && normalized !== 'formula';
965
965
  }
966
966
  /**
@@ -1047,7 +1047,7 @@ function moveCondition(holder, from, to) {
1047
1047
  * del backend (`CONDITION_LOGIC_INVALID`).
1048
1048
  */
1049
1049
  function checkConditionLogic(logic, conditionCount) {
1050
- const trimmed = logic.trim();
1050
+ const trimmed = logic?.trim();
1051
1051
  if (!trimmed) {
1052
1052
  return null;
1053
1053
  }
@@ -1154,7 +1154,7 @@ function areTypesComparable(left, right) {
1154
1154
  * scrive — e la traduce, invece di lasciare che `parseFloat` tronchi silenziosamente a `1`.
1155
1155
  */
1156
1156
  function parseInvariantNumber(raw) {
1157
- const trimmed = raw.trim();
1157
+ const trimmed = raw?.trim();
1158
1158
  if (!trimmed) {
1159
1159
  return undefined;
1160
1160
  }
@@ -1209,7 +1209,7 @@ function stageStepOutputReferenced(reference, steps) {
1209
1209
  if (!reference) {
1210
1210
  return undefined;
1211
1211
  }
1212
- const root = referenceRoot(reference.trim());
1212
+ const root = referenceRoot(reference?.trim());
1213
1213
  return steps.find((step) => !!step.name && step.name === root)?.name;
1214
1214
  }
1215
1215
  /**
@@ -1264,7 +1264,7 @@ function severityBucket(severity) {
1264
1264
  if (!severity) {
1265
1265
  return 'Info';
1266
1266
  }
1267
- return BUCKET_BY_NAME.get(severity.trim().toLowerCase()) ?? 'Info';
1267
+ return BUCKET_BY_NAME.get(severity?.trim().toLowerCase()) ?? 'Info';
1268
1268
  }
1269
1269
  /** L'ordine in cui si presentano: prima cio' che blocca l'attivazione. */
1270
1270
  const SEVERITY_BUCKETS = ['Error', 'Warning', 'Info'];
@@ -1387,8 +1387,8 @@ function reasonOf(status) {
1387
1387
  * e' un esito (`unverifiable`), non un errore da gestire in ogni chiamante.
1388
1388
  */
1389
1389
  async function resolvePath(catalog, root, path, options) {
1390
- const trimmed = (path ?? '').trim();
1391
- const segments = trimmed.split('.').map((segment) => segment.trim());
1390
+ const trimmed = (path ?? '')?.trim();
1391
+ const segments = trimmed.split('.').map((segment) => segment?.trim());
1392
1392
  const levels = [];
1393
1393
  const resolved = [];
1394
1394
  const base = { root, path: trimmed, segments, levels, resolved };
@@ -3541,7 +3541,7 @@ class ElementPaletteComponent {
3541
3541
  return items;
3542
3542
  }, ...(ngDevMode ? [{ debugName: "items" }] : []));
3543
3543
  groups = computed(() => {
3544
- const needle = this.filter().trim().toLowerCase();
3544
+ const needle = this.filter()?.trim().toLowerCase();
3545
3545
  const groups = [];
3546
3546
  for (const item of this.items()) {
3547
3547
  // La ricerca guarda anche l'etichetta del tipo: cercando «ordina o filtra» si trovano
@@ -3735,7 +3735,7 @@ class ReferencePickerComponent {
3735
3735
  * l'editor non deve accusare cio' che il backend non verifica.
3736
3736
  */
3737
3737
  navigableRoot = computed(() => {
3738
- const root = referenceRoot((this.value() ?? '').trim());
3738
+ const root = referenceRoot((this.value() ?? '')?.trim());
3739
3739
  if (!root) {
3740
3740
  return undefined;
3741
3741
  }
@@ -3753,7 +3753,7 @@ class ReferencePickerComponent {
3753
3753
  /** Il percorso dopo la radice: `Cliente.Email` di `Richiesta.Cliente.Email`. */
3754
3754
  navigatedPath = computed(() => {
3755
3755
  const root = this.navigableRoot()?.reference.name;
3756
- const value = (this.value() ?? '').trim();
3756
+ const value = (this.value() ?? '')?.trim();
3757
3757
  return root && value.length > root.length ? value.slice(root.length + 1) : '';
3758
3758
  }, ...(ngDevMode ? [{ debugName: "navigatedPath" }] : []));
3759
3759
  navigation = navigatePath(this.catalog, () => {
@@ -3790,7 +3790,7 @@ class ReferencePickerComponent {
3790
3790
  }));
3791
3791
  }, ...(ngDevMode ? [{ debugName: "pathReferences" }] : []));
3792
3792
  options = computed(() => {
3793
- const needle = this.query().trim().toLowerCase();
3793
+ const needle = this.query()?.trim().toLowerCase();
3794
3794
  // Le globali assegnabili — `$Flow.CurrentStage`, `$Flow.ActiveStages` e quelle che l'host
3795
3795
  // dichiara scrivibili — le comprende già `POST /flows/references/writable`: aggiungerle
3796
3796
  // qui le duplicherebbe (§5.2, §6.4).
@@ -3861,7 +3861,7 @@ class ReferencePickerComponent {
3861
3861
  * risponderebbe `GLOBAL_UNKNOWN`.
3862
3862
  */
3863
3863
  valueState = computed(() => {
3864
- const value = (this.value() ?? '').trim();
3864
+ const value = (this.value() ?? '')?.trim();
3865
3865
  if (!value) {
3866
3866
  return 'empty';
3867
3867
  }
@@ -3978,7 +3978,7 @@ class ReferencePickerComponent {
3978
3978
  }
3979
3979
  /** Scrittura libera: indispensabile per gli scope dell'host e per i percorsi non enumerabili. */
3980
3980
  onManualInput(value) {
3981
- this.valueChange.emit(value.trim() ? value.trim() : undefined);
3981
+ this.valueChange.emit(value?.trim() ? value?.trim() : undefined);
3982
3982
  }
3983
3983
  clear() {
3984
3984
  this.valueChange.emit(undefined);
@@ -4044,8 +4044,8 @@ class ObjectPickerComponent {
4044
4044
  * resterebbe nella casella pur non essendo piu' il valore del documento.
4045
4045
  */
4046
4046
  effect(() => {
4047
- const value = (this.value() ?? '').trim();
4048
- if (value !== (untracked(this.query) ?? '').trim()) {
4047
+ const value = (this.value() ?? '')?.trim();
4048
+ if (value !== (untracked(this.query) ?? '')?.trim()) {
4049
4049
  this.query.set(null);
4050
4050
  }
4051
4051
  });
@@ -4053,7 +4053,7 @@ class ObjectPickerComponent {
4053
4053
  /** Quel che si vede nella casella: il filtro se si sta digitando, il valore altrimenti. */
4054
4054
  text = computed(() => this.query() ?? this.value() ?? '', ...(ngDevMode ? [{ debugName: "text" }] : []));
4055
4055
  options = computed(() => {
4056
- const needle = (this.query() ?? '').trim().toLowerCase();
4056
+ const needle = (this.query() ?? '')?.trim().toLowerCase();
4057
4057
  const all = this.objects();
4058
4058
  if (!needle) {
4059
4059
  return all;
@@ -4066,14 +4066,14 @@ class ObjectPickerComponent {
4066
4066
  * "non lo so" non e' "non esiste".
4067
4067
  */
4068
4068
  isUnknown = computed(() => {
4069
- const value = (this.value() ?? '').trim();
4069
+ const value = (this.value() ?? '')?.trim();
4070
4070
  if (!value || !this.hasCatalog()) {
4071
4071
  return false;
4072
4072
  }
4073
4073
  return !this.objects().some((object) => object.name === value);
4074
4074
  }, ...(ngDevMode ? [{ debugName: "isUnknown" }] : []));
4075
4075
  labelOfValue = computed(() => {
4076
- const value = (this.value() ?? '').trim();
4076
+ const value = (this.value() ?? '')?.trim();
4077
4077
  const found = this.objects().find((object) => object.name === value);
4078
4078
  return found?.label && found.label !== found.name ? found.label : null;
4079
4079
  }, ...(ngDevMode ? [{ debugName: "labelOfValue" }] : []));
@@ -4095,7 +4095,7 @@ class ObjectPickerComponent {
4095
4095
  onInput(text) {
4096
4096
  this.query.set(text);
4097
4097
  this.open();
4098
- this.valueChange.emit(text.trim() ? text.trim() : undefined);
4098
+ this.valueChange.emit(text?.trim() ? text?.trim() : undefined);
4099
4099
  }
4100
4100
  choose(object) {
4101
4101
  this.valueChange.emit(object.name);
@@ -4170,8 +4170,8 @@ class FieldPickerComponent {
4170
4170
  // Vedi ObjectPickerComponent: il filtro sopravvive alla propria scrittura, non a un
4171
4171
  // valore che arriva da fuori (un'altra riga della lista, un altro elemento).
4172
4172
  effect(() => {
4173
- const value = (this.value() ?? '').trim();
4174
- if (value !== (untracked(this.query) ?? '').trim()) {
4173
+ const value = (this.value() ?? '')?.trim();
4174
+ if (value !== (untracked(this.query) ?? '')?.trim()) {
4175
4175
  this.query.set(null);
4176
4176
  }
4177
4177
  });
@@ -4189,7 +4189,7 @@ class FieldPickerComponent {
4189
4189
  if (!tail) {
4190
4190
  return [];
4191
4191
  }
4192
- const needle = tail.segment.trim().toLowerCase();
4192
+ const needle = tail.segment?.trim().toLowerCase();
4193
4193
  if (!needle) {
4194
4194
  return tail.level.entries;
4195
4195
  }
@@ -4257,7 +4257,7 @@ class FieldPickerComponent {
4257
4257
  onInput(text) {
4258
4258
  this.query.set(text);
4259
4259
  this.open();
4260
- this.valueChange.emit(text.trim() ? text.trim() : undefined);
4260
+ this.valueChange.emit(text?.trim() ? text?.trim() : undefined);
4261
4261
  }
4262
4262
  choose(entry) {
4263
4263
  this.valueChange.emit(`${this.prefix()}${entry.name}`);
@@ -4331,15 +4331,15 @@ class NamePickerComponent {
4331
4331
  constructor() {
4332
4332
  // Vedi ObjectPickerComponent: il filtro non sopravvive a un valore che arriva da fuori.
4333
4333
  effect(() => {
4334
- const value = (this.value() ?? '').trim();
4335
- if (value !== (untracked(this.query) ?? '').trim()) {
4334
+ const value = (this.value() ?? '')?.trim();
4335
+ if (value !== (untracked(this.query) ?? '')?.trim()) {
4336
4336
  this.query.set(null);
4337
4337
  }
4338
4338
  });
4339
4339
  }
4340
4340
  text = computed(() => this.query() ?? this.value() ?? '', ...(ngDevMode ? [{ debugName: "text" }] : []));
4341
4341
  visibleOptions = computed(() => {
4342
- const needle = (this.query() ?? '').trim().toLowerCase();
4342
+ const needle = (this.query() ?? '')?.trim().toLowerCase();
4343
4343
  const all = this.options();
4344
4344
  if (!needle) {
4345
4345
  return all;
@@ -4348,14 +4348,14 @@ class NamePickerComponent {
4348
4348
  }, ...(ngDevMode ? [{ debugName: "visibleOptions" }] : []));
4349
4349
  hasOptions = computed(() => this.options().length > 0, ...(ngDevMode ? [{ debugName: "hasOptions" }] : []));
4350
4350
  isUnknown = computed(() => {
4351
- const value = (this.value() ?? '').trim();
4351
+ const value = (this.value() ?? '')?.trim();
4352
4352
  if (!value || !this.hasOptions()) {
4353
4353
  return false;
4354
4354
  }
4355
4355
  return !this.options().some((option) => option.name === value);
4356
4356
  }, ...(ngDevMode ? [{ debugName: "isUnknown" }] : []));
4357
4357
  labelOfValue = computed(() => {
4358
- const value = (this.value() ?? '').trim();
4358
+ const value = (this.value() ?? '')?.trim();
4359
4359
  const found = this.options().find((option) => option.name === value);
4360
4360
  return found ? this.describe(found) || null : null;
4361
4361
  }, ...(ngDevMode ? [{ debugName: "labelOfValue" }] : []));
@@ -4375,7 +4375,7 @@ class NamePickerComponent {
4375
4375
  onInput(text) {
4376
4376
  this.query.set(text);
4377
4377
  this.open();
4378
- this.valueChange.emit(text.trim() ? text.trim() : undefined);
4378
+ this.valueChange.emit(text?.trim() ? text?.trim() : undefined);
4379
4379
  }
4380
4380
  choose(option) {
4381
4381
  this.valueChange.emit(option.name);
@@ -4527,8 +4527,8 @@ class StructureMemberPickerComponent {
4527
4527
  // Vedi ObjectPickerComponent: il filtro sopravvive alla propria scrittura, non a un valore
4528
4528
  // che arriva da fuori (un'altra riga della lista, un altro elemento).
4529
4529
  effect(() => {
4530
- const value = (this.value() ?? '').trim();
4531
- if (value !== (untracked(this.query) ?? '').trim()) {
4530
+ const value = (this.value() ?? '')?.trim();
4531
+ if (value !== (untracked(this.query) ?? '')?.trim()) {
4532
4532
  this.query.set(null);
4533
4533
  }
4534
4534
  });
@@ -4554,7 +4554,7 @@ class StructureMemberPickerComponent {
4554
4554
  return entries.filter((entry) => entry.isWritable || !!entry.next);
4555
4555
  }, ...(ngDevMode ? [{ debugName: "available" }] : []));
4556
4556
  options = computed(() => {
4557
- const needle = (this.tail()?.segment ?? '').trim().toLowerCase();
4557
+ const needle = (this.tail()?.segment ?? '')?.trim().toLowerCase();
4558
4558
  const all = this.available();
4559
4559
  if (!needle) {
4560
4560
  return all;
@@ -4641,7 +4641,7 @@ class StructureMemberPickerComponent {
4641
4641
  onInput(text) {
4642
4642
  this.query.set(text);
4643
4643
  this.open();
4644
- this.valueChange.emit(text.trim() ? text.trim() : undefined);
4644
+ this.valueChange.emit(text?.trim() ? text?.trim() : undefined);
4645
4645
  }
4646
4646
  choose(entry) {
4647
4647
  this.valueChange.emit(`${this.prefix()}${entry.name}`);
@@ -5148,7 +5148,7 @@ class ConditionEditorComponent {
5148
5148
  // Assente = tutte le condizioni devono essere vere (§4.3).
5149
5149
  return 'and';
5150
5150
  }
5151
- const normalized = logic.trim().toLowerCase();
5151
+ const normalized = logic?.trim().toLowerCase();
5152
5152
  if (normalized === 'and') {
5153
5153
  return 'and';
5154
5154
  }
@@ -5413,7 +5413,7 @@ class RecordFilterEditorComponent {
5413
5413
  if (!logic) {
5414
5414
  return 'and';
5415
5415
  }
5416
- const normalized = logic.trim().toLowerCase();
5416
+ const normalized = logic?.trim().toLowerCase();
5417
5417
  if (normalized === 'and') {
5418
5418
  return 'and';
5419
5419
  }