@apia/execution 4.0.26 → 4.0.28

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.js CHANGED
@@ -1,13 +1,14 @@
1
1
  import { makeObservable, observable, action, runInAction, reaction, computed, toJS } from 'mobx';
2
+ import axios, { AxiosError } from 'axios';
2
3
  import xml2js from 'xml2js';
3
4
  import he from 'he';
4
5
  import { parseBooleans, parseNumbers } from 'xml2js/lib/processors';
5
6
  import QueryString from 'qs';
6
- import { arrayOrArray, EventEmitter as EventEmitter$1, isTrue, toBoolean, downloadUrl, addBoundary, formatMessage, parseAsSize, shallowEqual as shallowEqual$1, Mutex, awaitTime, noNaN as noNaN$1, getDateFormat, freezeDeep, uniqueId, parseXMLRequestResponse, Url, postNavigation } from '@apia/util';
7
- import axios from 'axios';
7
+ import { arrayOrArray, EventEmitter as EventEmitter$1, isTrue, toBoolean, downloadUrl, addBoundary, formatMessage, parseAsSize, shallowEqual as shallowEqual$1, Mutex, awaitTime, noNaN as noNaN$1, getDateFormat, uniqueId, parseXMLRequestResponse, Url, postNavigation } from '@apia/util';
8
8
  import { Cell, TableController, Row, FocusControllerPlugin } from '@apia/table2-controller';
9
9
  import dayjs from 'dayjs';
10
10
  import { MobXTree } from '@apia/tree2-controller';
11
+ import { Scheduler } from '@apia/scheduler-controller';
11
12
 
12
13
  const deepEqual = (a, b) => {
13
14
  if (Object.is(a, b))
@@ -45,16 +46,16 @@ const deepEqual = (a, b) => {
45
46
  return a === b;
46
47
  };
47
48
 
48
- var __defProp$r = Object.defineProperty;
49
- var __defNormalProp$r = (obj, key, value) => key in obj ? __defProp$r(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
50
- var __publicField$r = (obj, key, value) => {
51
- __defNormalProp$r(obj, key + "" , value);
49
+ var __defProp$s = Object.defineProperty;
50
+ var __defNormalProp$s = (obj, key, value) => key in obj ? __defProp$s(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
51
+ var __publicField$s = (obj, key, value) => {
52
+ __defNormalProp$s(obj, key + "" , value);
52
53
  return value;
53
54
  };
54
55
  class Notification {
55
56
  constructor(props) {
56
57
  this.props = props;
57
- __publicField$r(this, "state");
58
+ __publicField$s(this, "state");
58
59
  this.state = props;
59
60
  makeObservable(this, { state: observable });
60
61
  }
@@ -401,14 +402,14 @@ function replaceLabelHtmlValues(o) {
401
402
  }
402
403
  return o;
403
404
  }
404
- const parseXml = (xml) => {
405
+ const parseXml = (xml, behaveConfig) => {
405
406
  let objJS;
406
407
  if (typeof xml === "object" && !(xml instanceof XMLDocument)) {
407
408
  return xml;
408
409
  }
409
410
  const parser = new xml2js.Parser({
410
- trim: true,
411
- normalize: true,
411
+ trim: !behaveConfig?.avoidTrimXml,
412
+ normalize: !behaveConfig?.avoidNormalize,
412
413
  explicitRoot: false,
413
414
  mergeAttrs: true,
414
415
  explicitArray: false,
@@ -445,6 +446,16 @@ function getWindow(execution) {
445
446
  return execution.environment.window;
446
447
  }
447
448
 
449
+ var ExecutionState = /* @__PURE__ */ ((ExecutionState2) => {
450
+ ExecutionState2[ExecutionState2["RUNNING"] = 0] = "RUNNING";
451
+ ExecutionState2[ExecutionState2["LOADING"] = 1] = "LOADING";
452
+ ExecutionState2[ExecutionState2["FINISHED"] = 2] = "FINISHED";
453
+ ExecutionState2[ExecutionState2["RENDERING"] = 3] = "RENDERING";
454
+ ExecutionState2[ExecutionState2["CONFIRMING"] = 4] = "CONFIRMING";
455
+ ExecutionState2[ExecutionState2["FINISHED_WITH_ERROR"] = 5] = "FINISHED_WITH_ERROR";
456
+ return ExecutionState2;
457
+ })(ExecutionState || {});
458
+
448
459
  function dispatchMessage(execution, type, message) {
449
460
  execution.notifications.add(
450
461
  new MessageNotification({
@@ -466,8 +477,10 @@ function getAxios() {
466
477
  );
467
478
  }
468
479
  const handleWrongResponse = (execution, error) => {
469
- if (error instanceof InvalidSessionException)
470
- throw error;
480
+ if (error instanceof InvalidSessionException || error instanceof AxiosError && error.status === 403) {
481
+ execution.kill();
482
+ throw new InvalidSessionException();
483
+ }
471
484
  let errorMessage;
472
485
  if (typeof error !== "string") {
473
486
  if (error.message)
@@ -510,12 +523,13 @@ function parseMessages(execution, response) {
510
523
  dispatchMessage.bind(dispatchMessage, execution, "error")
511
524
  );
512
525
  }
513
- async function handleResponse(execution, result) {
526
+ async function handleResponse(execution, result, behaveConfig) {
514
527
  try {
515
528
  if (!result || result.data === void 0) ; else {
516
529
  const parsedResponse = await parseSuccessfulResponse(
517
530
  execution,
518
- result
531
+ result,
532
+ behaveConfig
519
533
  );
520
534
  return {
521
535
  ...result,
@@ -535,7 +549,7 @@ async function handleResponse(execution, result) {
535
549
  }
536
550
  class InvalidSessionException extends Error {
537
551
  }
538
- const parseSuccessfulResponse = async (execution, response) => {
552
+ const parseSuccessfulResponse = async (execution, response, behaveConfig) => {
539
553
  let parsedObj = void 0;
540
554
  if (isJsonResponse(response)) {
541
555
  if (typeof response.data === "string")
@@ -546,9 +560,12 @@ const parseSuccessfulResponse = async (execution, response) => {
546
560
  parsedObj = response.data;
547
561
  } else if (isXmlResponse(response)) {
548
562
  try {
549
- parsedObj = parseXml(response.data);
563
+ parsedObj = parseXml(response.data, behaveConfig);
550
564
  } catch (e) {
551
- handleWrongResponse(execution, new Error(e));
565
+ handleWrongResponse(
566
+ execution,
567
+ e instanceof Error ? e : new Error(e)
568
+ );
552
569
  }
553
570
  } else if (isHtmlResponse(response)) {
554
571
  console.error(
@@ -585,20 +602,29 @@ const parseSuccessfulResponse = async (execution, response) => {
585
602
  return null;
586
603
  };
587
604
  async function post(execution, actualUrl, behaveConfig) {
605
+ if (execution.state.executionState === ExecutionState.FINISHED && !behaveConfig?.allowAfterFinish) {
606
+ throw new Error("Cannot perform requests after execution has finished");
607
+ }
588
608
  const postData = behaveConfig?.postDataTreatment === "stringify" ? QueryString.stringify(
589
609
  behaveConfig.postData,
590
610
  behaveConfig.stringifyOptions
591
611
  ) : behaveConfig?.postData;
592
612
  const response = await (await getAxios()).post(actualUrl, postData, { ...behaveConfig?.axiosConfig, headers: { ...behaveConfig?.axiosConfig?.headers, ...execution.environment.headers } }).catch((e) => {
593
- handleWrongResponse(execution, new Error(e));
613
+ handleWrongResponse(
614
+ execution,
615
+ e instanceof Error ? e : new Error(e)
616
+ );
594
617
  });
595
618
  if (response) {
596
- const result = handleResponse(execution, response);
619
+ const result = handleResponse(execution, response, behaveConfig);
597
620
  return result;
598
621
  }
599
622
  return null;
600
623
  }
601
624
  async function get(execution, actualUrl, behaveConfig) {
625
+ if (execution.state.executionState === ExecutionState.FINISHED) {
626
+ throw new Error("Cannot perform requests after execution has finished");
627
+ }
602
628
  const response = await (await getAxios()).get(actualUrl, { ...behaveConfig?.axiosConfig, headers: { ...behaveConfig?.axiosConfig?.headers, ...execution.environment.headers } }).catch((e) => {
603
629
  handleWrongResponse(
604
630
  execution,
@@ -661,20 +687,20 @@ function makeApiaUrl(execution, props) {
661
687
  return `${contextWord ? "/" : ""}${contextWord}/${actualAjaxUrl}?${timestamp}${!props?.preventAsXmlParameter ? "asXml=true&" : ""}${props?.queryString ? `${props.queryString}&` : ""}${queryString ? `${queryString}&` : ""}${tabId}`;
662
688
  }
663
689
 
664
- var __defProp$q = Object.defineProperty;
665
- var __defNormalProp$q = (obj, key, value) => key in obj ? __defProp$q(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
666
- var __publicField$q = (obj, key, value) => {
667
- __defNormalProp$q(obj, typeof key !== "symbol" ? key + "" : key, value);
690
+ var __defProp$r = Object.defineProperty;
691
+ var __defNormalProp$r = (obj, key, value) => key in obj ? __defProp$r(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
692
+ var __publicField$r = (obj, key, value) => {
693
+ __defNormalProp$r(obj, typeof key !== "symbol" ? key + "" : key, value);
668
694
  return value;
669
695
  };
670
696
  class EventEmitter {
671
697
  constructor() {
672
- __publicField$q(this, "callbacks", {
698
+ __publicField$r(this, "callbacks", {
673
699
  on: {},
674
700
  once: {}
675
701
  });
676
- __publicField$q(this, "enabled", true);
677
- __publicField$q(this, "debugMode", false);
702
+ __publicField$r(this, "enabled", true);
703
+ __publicField$r(this, "debugMode", false);
678
704
  }
679
705
  debug(enable = true) {
680
706
  this.debugMode = enable;
@@ -740,10 +766,10 @@ class EventEmitter {
740
766
  }
741
767
  }
742
768
 
743
- var __defProp$p = Object.defineProperty;
744
- var __defNormalProp$p = (obj, key, value) => key in obj ? __defProp$p(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
745
- var __publicField$p = (obj, key, value) => {
746
- __defNormalProp$p(obj, key + "" , value);
769
+ var __defProp$q = Object.defineProperty;
770
+ var __defNormalProp$q = (obj, key, value) => key in obj ? __defProp$q(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
771
+ var __publicField$q = (obj, key, value) => {
772
+ __defNormalProp$q(obj, key + "" , value);
747
773
  return value;
748
774
  };
749
775
  function isSetter(data) {
@@ -752,7 +778,7 @@ function isSetter(data) {
752
778
  class StatefulEmitter extends EventEmitter {
753
779
  constructor(initialState) {
754
780
  super();
755
- __publicField$p(this, "state", {});
781
+ __publicField$q(this, "state", {});
756
782
  this.state = Object.assign({}, initialState);
757
783
  }
758
784
  emit(event, data) {
@@ -787,18 +813,18 @@ class StatefulEmitter extends EventEmitter {
787
813
  }
788
814
  }
789
815
 
790
- var __defProp$o = Object.defineProperty;
791
- var __defNormalProp$o = (obj, key, value) => key in obj ? __defProp$o(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
792
- var __publicField$o = (obj, key, value) => {
793
- __defNormalProp$o(obj, typeof key !== "symbol" ? key + "" : key, value);
816
+ var __defProp$p = Object.defineProperty;
817
+ var __defNormalProp$p = (obj, key, value) => key in obj ? __defProp$p(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
818
+ var __publicField$p = (obj, key, value) => {
819
+ __defNormalProp$p(obj, typeof key !== "symbol" ? key + "" : key, value);
794
820
  return value;
795
821
  };
796
822
  const NullObject = Symbol("NullObject");
797
823
  class BouncingEmitter extends StatefulEmitter {
798
824
  constructor() {
799
825
  super(...arguments);
800
- __publicField$o(this, "bouncingTimeouts", {});
801
- __publicField$o(this, "defaultTiming", 100);
826
+ __publicField$p(this, "bouncingTimeouts", {});
827
+ __publicField$p(this, "defaultTiming", 100);
802
828
  /**
803
829
  * Throttles a event emit with the warranty that the data will be emitted at most every (timing)ms. Take the following event throttling, where each E is a call to this method and each character represents 20ms:
804
830
  *
@@ -810,8 +836,8 @@ class BouncingEmitter extends StatefulEmitter {
810
836
  *
811
837
  * @param configuration.emitOnStart - Emits an event on the first call to throttle when no pending throttle is stored. **If emitOnStart is true and an only call to throttle is made, it will emit an only event.**
812
838
  */
813
- __publicField$o(this, "throttleData", {});
814
- __publicField$o(this, "throttleEmittedOnInit", {});
839
+ __publicField$p(this, "throttleData", {});
840
+ __publicField$p(this, "throttleEmittedOnInit", {});
815
841
  }
816
842
  /**
817
843
  * Debounces a event emit with until there is no call to the emit methods by (timing)ms. Take the following event throttling, where each E is a call to this method and each character represents 20ms:
@@ -941,16 +967,16 @@ function parseFakeJSON$1(str) {
941
967
  return ret;
942
968
  }
943
969
 
944
- var __defProp$n = Object.defineProperty;
945
- var __defNormalProp$n = (obj, key, value) => key in obj ? __defProp$n(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
946
- var __publicField$n = (obj, key, value) => {
947
- __defNormalProp$n(obj, typeof key !== "symbol" ? key + "" : key, value);
970
+ var __defProp$o = Object.defineProperty;
971
+ var __defNormalProp$o = (obj, key, value) => key in obj ? __defProp$o(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
972
+ var __publicField$o = (obj, key, value) => {
973
+ __defNormalProp$o(obj, typeof key !== "symbol" ? key + "" : key, value);
948
974
  return value;
949
975
  };
950
976
  class WithProperties {
951
977
  constructor(initialState) {
952
- __publicField$n(this, "properties", {});
953
- __publicField$n(this, "parentGrid", null);
978
+ __publicField$o(this, "properties", {});
979
+ __publicField$o(this, "parentGrid", null);
954
980
  if (initialState) {
955
981
  this.properties = initialState;
956
982
  }
@@ -1127,10 +1153,10 @@ const asyncCreateNewField = async (execution, fld) => {
1127
1153
  return creator(execution, fld);
1128
1154
  };
1129
1155
 
1130
- var __defProp$m = Object.defineProperty;
1131
- var __defNormalProp$m = (obj, key, value) => key in obj ? __defProp$m(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1132
- var __publicField$m = (obj, key, value) => {
1133
- __defNormalProp$m(obj, typeof key !== "symbol" ? key + "" : key, value);
1156
+ var __defProp$n = Object.defineProperty;
1157
+ var __defNormalProp$n = (obj, key, value) => key in obj ? __defProp$n(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1158
+ var __publicField$n = (obj, key, value) => {
1159
+ __defNormalProp$n(obj, typeof key !== "symbol" ? key + "" : key, value);
1134
1160
  return value;
1135
1161
  };
1136
1162
  var __accessCheck$k = (obj, member, msg) => {
@@ -1164,15 +1190,15 @@ async function getApiaFunctions(execution) {
1164
1190
  let Field$1 = class Field extends WithProperties {
1165
1191
  constructor({ properties, ...definition }) {
1166
1192
  super();
1167
- __publicField$m(this, "form", {});
1168
- __publicField$m(this, "definition");
1169
- __publicField$m(this, "state", {
1193
+ __publicField$n(this, "form", {});
1194
+ __publicField$n(this, "definition");
1195
+ __publicField$n(this, "state", {
1170
1196
  validation: { dirty: false, errorMessage: "", synchronizing: false }
1171
1197
  });
1172
1198
  __privateAdd$k(this, _hasInited$1, false);
1173
1199
  this.properties = properties;
1174
1200
  this.definition = definition;
1175
- makeObservable(this, { state: observable });
1201
+ makeObservable(this, { state: observable, definition: observable });
1176
1202
  }
1177
1203
  async getScriptEventParams(fncParams) {
1178
1204
  const fncParamsArray = [];
@@ -1218,6 +1244,7 @@ let Field$1 = class Field extends WithProperties {
1218
1244
  const events = (this.definition.scriptEvents || []).filter(
1219
1245
  (c) => c.evtName === eventName
1220
1246
  );
1247
+ let result = true;
1221
1248
  if (events.length > 0) {
1222
1249
  for (const event of events) {
1223
1250
  try {
@@ -1235,11 +1262,10 @@ let Field$1 = class Field extends WithProperties {
1235
1262
  }).text
1236
1263
  );
1237
1264
  }
1238
- const result = await fn(
1265
+ result = await fn(
1239
1266
  await asyncCreateNewField(this.form.execution, this),
1240
1267
  ...await this.getScriptEventParams(event.fncParams)
1241
1268
  );
1242
- return result;
1243
1269
  } catch (e) {
1244
1270
  console.error(e);
1245
1271
  this.form.execution.notifications.add(
@@ -1252,7 +1278,7 @@ let Field$1 = class Field extends WithProperties {
1252
1278
  }
1253
1279
  }
1254
1280
  }
1255
- return true;
1281
+ return result;
1256
1282
  }
1257
1283
  async fireAjaxServerEvent(event, params) {
1258
1284
  try {
@@ -1374,16 +1400,16 @@ class Button extends Field$1 {
1374
1400
  }
1375
1401
  }
1376
1402
 
1377
- var __defProp$l = Object.defineProperty;
1378
- var __defNormalProp$l = (obj, key, value) => key in obj ? __defProp$l(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1379
- var __publicField$l = (obj, key, value) => {
1380
- __defNormalProp$l(obj, typeof key !== "symbol" ? key + "" : key, value);
1403
+ var __defProp$m = Object.defineProperty;
1404
+ var __defNormalProp$m = (obj, key, value) => key in obj ? __defProp$m(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1405
+ var __publicField$m = (obj, key, value) => {
1406
+ __defNormalProp$m(obj, typeof key !== "symbol" ? key + "" : key, value);
1381
1407
  return value;
1382
1408
  };
1383
1409
  const _Captcha = class _Captcha extends Field$1 {
1384
1410
  constructor(definition) {
1385
1411
  super(definition);
1386
- __publicField$l(this, "id", "");
1412
+ __publicField$m(this, "id", "");
1387
1413
  this.state.value = "";
1388
1414
  this.properties.name = "__captcha__";
1389
1415
  _Captcha.emitter.on("confirm", () => {
@@ -1434,8 +1460,8 @@ const _Captcha = class _Captcha extends Field$1 {
1434
1460
  }
1435
1461
  }
1436
1462
  };
1437
- __publicField$l(_Captcha, "emitter", new EventEmitter$1());
1438
- __publicField$l(_Captcha, "confirmParams", {});
1463
+ __publicField$m(_Captcha, "emitter", new EventEmitter$1());
1464
+ __publicField$m(_Captcha, "confirmParams", {});
1439
1465
  let Captcha = _Captcha;
1440
1466
 
1441
1467
  class TooMuchRetriesException extends Error {
@@ -1508,10 +1534,10 @@ function isFieldShowAsText(f) {
1508
1534
  return isTrue(f.properties.disabled) || isTrue(f.getForm().definition.readonly) || isTrue(f.getForm().definition.readOnly) || isTrue(f.properties.inputAsText);
1509
1535
  }
1510
1536
 
1511
- var __defProp$k = Object.defineProperty;
1512
- var __defNormalProp$k = (obj, key, value) => key in obj ? __defProp$k(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1513
- var __publicField$k = (obj, key, value) => {
1514
- __defNormalProp$k(obj, typeof key !== "symbol" ? key + "" : key, value);
1537
+ var __defProp$l = Object.defineProperty;
1538
+ var __defNormalProp$l = (obj, key, value) => key in obj ? __defProp$l(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1539
+ var __publicField$l = (obj, key, value) => {
1540
+ __defNormalProp$l(obj, typeof key !== "symbol" ? key + "" : key, value);
1515
1541
  return value;
1516
1542
  };
1517
1543
  var __accessCheck$j = (obj, member, msg) => {
@@ -1552,8 +1578,8 @@ class FieldWithAttribute extends Field$1 {
1552
1578
  }) {
1553
1579
  super(definition);
1554
1580
  __privateAdd$j(this, _lastOnChangeValue, null);
1555
- __publicField$k(this, "lastSynchronizationValue", null);
1556
- __publicField$k(this, "attribute");
1581
+ __publicField$l(this, "lastSynchronizationValue", null);
1582
+ __publicField$l(this, "attribute");
1557
1583
  this.attribute = new Attribute(attId, attName, attLabel, valueType);
1558
1584
  this.state.value = value;
1559
1585
  this.state.validation = {
@@ -1738,16 +1764,16 @@ class Checkbox extends FieldWithAttribute {
1738
1764
  }
1739
1765
  }
1740
1766
 
1741
- var __defProp$j = Object.defineProperty;
1742
- var __defNormalProp$j = (obj, key, value) => key in obj ? __defProp$j(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1743
- var __publicField$j = (obj, key, value) => {
1744
- __defNormalProp$j(obj, key + "" , value);
1767
+ var __defProp$k = Object.defineProperty;
1768
+ var __defNormalProp$k = (obj, key, value) => key in obj ? __defProp$k(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1769
+ var __publicField$k = (obj, key, value) => {
1770
+ __defNormalProp$k(obj, key + "" , value);
1745
1771
  return value;
1746
1772
  };
1747
1773
  class Translation {
1748
1774
  constructor(execution, state) {
1749
1775
  this.execution = execution;
1750
- __publicField$j(this, "state");
1776
+ __publicField$k(this, "state");
1751
1777
  this.state = {
1752
1778
  ...state,
1753
1779
  hasChanged: false,
@@ -1763,7 +1789,8 @@ class Translation {
1763
1789
  if (this.state.remoteValue === void 0) {
1764
1790
  const result = await post(
1765
1791
  this.execution,
1766
- url
1792
+ url,
1793
+ { avoidNormalize: true, avoidTrimXml: true }
1767
1794
  );
1768
1795
  const newValue = result?.data?.values?.value;
1769
1796
  this.state.tempValue = newValue !== "null" ? result?.data?.values?.value ?? "" : "";
@@ -1811,19 +1838,19 @@ function parseFakeJSON(fakeJSON) {
1811
1838
  }));
1812
1839
  }
1813
1840
 
1814
- var __defProp$i = Object.defineProperty;
1815
- var __defNormalProp$i = (obj, key, value) => key in obj ? __defProp$i(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1816
- var __publicField$i = (obj, key, value) => {
1817
- __defNormalProp$i(obj, typeof key !== "symbol" ? key + "" : key, value);
1841
+ var __defProp$j = Object.defineProperty;
1842
+ var __defNormalProp$j = (obj, key, value) => key in obj ? __defProp$j(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1843
+ var __publicField$j = (obj, key, value) => {
1844
+ __defNormalProp$j(obj, typeof key !== "symbol" ? key + "" : key, value);
1818
1845
  return value;
1819
1846
  };
1820
1847
  class TranslatableField extends FieldWithAttribute {
1821
1848
  constructor(props) {
1822
1849
  super(props);
1823
- __publicField$i(this, "translations", /* @__PURE__ */ new Map());
1824
- __publicField$i(this, "selectedLanguageId", this.getLanguages()[0]?.id);
1825
- __publicField$i(this, "isTradLoading", false);
1826
- __publicField$i(this, "definitionTradParsed", {});
1850
+ __publicField$j(this, "translations", /* @__PURE__ */ new Map());
1851
+ __publicField$j(this, "selectedLanguageId", this.getLanguages()[0]?.id);
1852
+ __publicField$j(this, "isTradLoading", false);
1853
+ __publicField$j(this, "definitionTradParsed", {});
1827
1854
  makeObservable(this, {
1828
1855
  translations: observable,
1829
1856
  selectedLanguageId: observable,
@@ -1951,10 +1978,10 @@ class Editor extends TranslatableField {
1951
1978
  }
1952
1979
  }
1953
1980
 
1954
- var __defProp$h = Object.defineProperty;
1955
- var __defNormalProp$h = (obj, key, value) => key in obj ? __defProp$h(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1956
- var __publicField$h = (obj, key, value) => {
1957
- __defNormalProp$h(obj, key + "" , value);
1981
+ var __defProp$i = Object.defineProperty;
1982
+ var __defNormalProp$i = (obj, key, value) => key in obj ? __defProp$i(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1983
+ var __publicField$i = (obj, key, value) => {
1984
+ __defNormalProp$i(obj, key + "" , value);
1958
1985
  return value;
1959
1986
  };
1960
1987
  function getFileExtension(fileName) {
@@ -1990,7 +2017,7 @@ class UploaderModalController {
1990
2017
  this.api = api;
1991
2018
  this.modalConfig = modalConfig;
1992
2019
  this.conf = conf;
1993
- __publicField$h(this, "state");
2020
+ __publicField$i(this, "state");
1994
2021
  makeObservable(this, {
1995
2022
  state: observable
1996
2023
  });
@@ -2191,7 +2218,7 @@ class UploaderModalController {
2191
2218
  }
2192
2219
  this.allMetadata.forEach((c) => {
2193
2220
  if (c.required === "Y") {
2194
- if (c.name.trim() === "" && c.free) {
2221
+ if (c.name.trim() === "" && c.free === "Y") {
2195
2222
  c.labelErrorMessage = getLabel(
2196
2223
  this.api.execution,
2197
2224
  "msgReqField"
@@ -2202,16 +2229,20 @@ class UploaderModalController {
2202
2229
  c.errorMessage = getLabel(this.api.execution, "msgReqField").text;
2203
2230
  isValid = false;
2204
2231
  }
2232
+ if (c.type === "N" && c.value.trim() === "") {
2233
+ c.errorMessage = getLabel(this.api.execution, "msgMustBeNum").text;
2234
+ isValid = false;
2235
+ }
2205
2236
  }
2206
2237
  });
2207
2238
  return isValid;
2208
2239
  }
2209
2240
  }
2210
2241
 
2211
- var __defProp$g = Object.defineProperty;
2212
- var __defNormalProp$g = (obj, key, value) => key in obj ? __defProp$g(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2213
- var __publicField$g = (obj, key, value) => {
2214
- __defNormalProp$g(obj, typeof key !== "symbol" ? key + "" : key, value);
2242
+ var __defProp$h = Object.defineProperty;
2243
+ var __defNormalProp$h = (obj, key, value) => key in obj ? __defProp$h(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2244
+ var __publicField$h = (obj, key, value) => {
2245
+ __defNormalProp$h(obj, typeof key !== "symbol" ? key + "" : key, value);
2215
2246
  return value;
2216
2247
  };
2217
2248
  function returnExactlyTheSame(defaultParameters) {
@@ -2238,13 +2269,13 @@ class UploaderApi extends EventEmitter$1 {
2238
2269
  this.id = id;
2239
2270
  this.type = type;
2240
2271
  this.modalConfig = modalConfig;
2241
- __publicField$g(this, "maxFiles", Infinity);
2242
- __publicField$g(this, "modalController", null);
2243
- __publicField$g(this, "allowTranslations", false);
2244
- __publicField$g(this, "langs");
2245
- __publicField$g(this, "currentConfiguration");
2246
- __publicField$g(this, "docTypePermittedObjId");
2247
- __publicField$g(this, "state", {
2272
+ __publicField$h(this, "maxFiles", Infinity);
2273
+ __publicField$h(this, "modalController", null);
2274
+ __publicField$h(this, "allowTranslations", false);
2275
+ __publicField$h(this, "langs");
2276
+ __publicField$h(this, "currentConfiguration");
2277
+ __publicField$h(this, "docTypePermittedObjId");
2278
+ __publicField$h(this, "state", {
2248
2279
  progress: 0,
2249
2280
  allowedTypes: [],
2250
2281
  selectedDocTypeId: "1",
@@ -2256,18 +2287,18 @@ class UploaderApi extends EventEmitter$1 {
2256
2287
  translatedFiles: /* @__PURE__ */ new Map(),
2257
2288
  hasAllDocTypes: false
2258
2289
  });
2259
- __publicField$g(this, "getAjaxUploadFileStatusParameters", returnExactlyTheSame);
2260
- __publicField$g(this, "getAjaxUploadStartParameters", returnExactlyTheSame);
2261
- __publicField$g(this, "getConfirmDropModalParameters", returnExactlyTheSame);
2262
- __publicField$g(this, "getCheckLockDocumentParameters", returnExactlyTheSame);
2263
- __publicField$g(this, "getCheckWebDavLockParameters", returnExactlyTheSame);
2264
- __publicField$g(this, "getConfirmDropModalPostdata", returnExactlyTheSame);
2265
- __publicField$g(this, "getConfirmDropModalMetadataString", ({
2290
+ __publicField$h(this, "getAjaxUploadFileStatusParameters", returnExactlyTheSame);
2291
+ __publicField$h(this, "getAjaxUploadStartParameters", returnExactlyTheSame);
2292
+ __publicField$h(this, "getConfirmDropModalParameters", returnExactlyTheSame);
2293
+ __publicField$h(this, "getCheckLockDocumentParameters", returnExactlyTheSame);
2294
+ __publicField$h(this, "getCheckWebDavLockParameters", returnExactlyTheSame);
2295
+ __publicField$h(this, "getConfirmDropModalPostdata", returnExactlyTheSame);
2296
+ __publicField$h(this, "getConfirmDropModalMetadataString", ({
2266
2297
  metadata
2267
2298
  }) => {
2268
2299
  return metadata?.filter?.((current) => !!current.value).map((current) => `${current.id}~${current.type}~${current.value}`).join(";") ?? [];
2269
2300
  });
2270
- __publicField$g(this, "getConfirmDropModalPermissionsString", ({
2301
+ __publicField$h(this, "getConfirmDropModalPermissionsString", ({
2271
2302
  poolsPermissions,
2272
2303
  usersPermissions
2273
2304
  }) => {
@@ -2280,36 +2311,36 @@ class UploaderApi extends EventEmitter$1 {
2280
2311
  );
2281
2312
  return returnString;
2282
2313
  });
2283
- __publicField$g(this, "getConfirmDropModalAdditionalMetadataString", (additionalMetadata) => {
2314
+ __publicField$h(this, "getConfirmDropModalAdditionalMetadataString", (additionalMetadata) => {
2284
2315
  return Object.values(additionalMetadata).filter((current) => !!current?.value).map((current) => `${current.name}~${current.value}`).join(";");
2285
2316
  });
2286
- __publicField$g(this, "getDeleteDocumentParameters", returnExactlyTheSame);
2287
- __publicField$g(this, "getClearTempFilesParameters", returnExactlyTheSame);
2288
- __publicField$g(this, "getDocumentInfoParameters", returnExactlyTheSame);
2289
- __publicField$g(this, "getDownloadMultipleDocumentsParameters", returnExactlyTheSame);
2290
- __publicField$g(this, "getEditDocumentParameters", returnExactlyTheSame);
2291
- __publicField$g(this, "getLockDocumentParameters", returnExactlyTheSame);
2292
- __publicField$g(this, "getMarkFileToSignParameters", returnExactlyTheSame);
2293
- __publicField$g(this, "getProcessDroppedFilesParameters", returnExactlyTheSame);
2294
- __publicField$g(this, "getProcessDroppedFilesPostdata", returnExactlyTheSame);
2295
- __publicField$g(this, "getReloadMetadataParameters", returnExactlyTheSame);
2296
- __publicField$g(this, "getSaveDroppedFilesParameters", returnExactlyTheSame);
2297
- __publicField$g(this, "parseFileDefinition", (file) => {
2317
+ __publicField$h(this, "getDeleteDocumentParameters", returnExactlyTheSame);
2318
+ __publicField$h(this, "getClearTempFilesParameters", returnExactlyTheSame);
2319
+ __publicField$h(this, "getDocumentInfoParameters", returnExactlyTheSame);
2320
+ __publicField$h(this, "getDownloadMultipleDocumentsParameters", returnExactlyTheSame);
2321
+ __publicField$h(this, "getEditDocumentParameters", returnExactlyTheSame);
2322
+ __publicField$h(this, "getLockDocumentParameters", returnExactlyTheSame);
2323
+ __publicField$h(this, "getMarkFileToSignParameters", returnExactlyTheSame);
2324
+ __publicField$h(this, "getProcessDroppedFilesParameters", returnExactlyTheSame);
2325
+ __publicField$h(this, "getProcessDroppedFilesPostdata", returnExactlyTheSame);
2326
+ __publicField$h(this, "getReloadMetadataParameters", returnExactlyTheSame);
2327
+ __publicField$h(this, "getSaveDroppedFilesParameters", returnExactlyTheSame);
2328
+ __publicField$h(this, "parseFileDefinition", (file) => {
2298
2329
  return {
2299
2330
  ...parseFileDefinition(this.execution, file, false),
2300
2331
  canEdit: file.canEdit || file.canWrite,
2301
2332
  canRead: file.canRead
2302
2333
  };
2303
2334
  });
2304
- __publicField$g(this, "getLoadFileSystemStructureTree", () => ({
2335
+ __publicField$h(this, "getLoadFileSystemStructureTree", () => ({
2305
2336
  useDocTypePermitted: true,
2306
2337
  docTypePermittedObjId: this.docTypePermittedObjId,
2307
2338
  docTypePermittedObjType: this.type
2308
2339
  }));
2309
- if (!window.fileApi) {
2310
- window.fileApi = {};
2340
+ if (!getWindow(this.execution).fileApi) {
2341
+ getWindow(this.execution).fileApi = {};
2311
2342
  }
2312
- window.fileApi[this.id] = this;
2343
+ getWindow(this.execution).fileApi[this.id] = this;
2313
2344
  makeObservable(this, {
2314
2345
  state: observable
2315
2346
  });
@@ -2501,7 +2532,9 @@ class UploaderApi extends EventEmitter$1 {
2501
2532
  if (this.modalController) {
2502
2533
  this.modalController.state.isReadonly = false;
2503
2534
  }
2504
- this.state.selectedDocTypeId = "1";
2535
+ this.state.selectedDocTypeId = this.getDocTypes().find(
2536
+ (c) => String(c.id) === "1"
2537
+ ) ? "1" : this.getDocTypes()[0]?.id;
2505
2538
  this.state.inProgressFiles = [];
2506
2539
  this.state.versioningFile = null;
2507
2540
  }
@@ -3452,10 +3485,10 @@ class UploaderApi extends EventEmitter$1 {
3452
3485
  }
3453
3486
  }
3454
3487
 
3455
- var __defProp$f = Object.defineProperty;
3456
- var __defNormalProp$f = (obj, key, value) => key in obj ? __defProp$f(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3457
- var __publicField$f = (obj, key, value) => {
3458
- __defNormalProp$f(obj, typeof key !== "symbol" ? key + "" : key, value);
3488
+ var __defProp$g = Object.defineProperty;
3489
+ var __defNormalProp$g = (obj, key, value) => key in obj ? __defProp$g(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3490
+ var __publicField$g = (obj, key, value) => {
3491
+ __defNormalProp$g(obj, typeof key !== "symbol" ? key + "" : key, value);
3459
3492
  return value;
3460
3493
  };
3461
3494
  class FormsUploader extends UploaderApi {
@@ -3470,15 +3503,15 @@ class FormsUploader extends UploaderApi {
3470
3503
  this.type = type;
3471
3504
  this.modalConfig = modalConfig;
3472
3505
  this.field = field;
3473
- __publicField$f(this, "isEditionMode");
3474
- __publicField$f(this, "getAjaxUploadFileStatusParameters", (defaultParameters) => {
3506
+ __publicField$g(this, "isEditionMode");
3507
+ __publicField$g(this, "getAjaxUploadFileStatusParameters", (defaultParameters) => {
3475
3508
  return {
3476
3509
  ...defaultParameters,
3477
3510
  forceDocTypeId: this.field.properties.docType,
3478
3511
  ...this.getFormParameters()
3479
3512
  };
3480
3513
  });
3481
- __publicField$f(this, "getAjaxUploadStartParameters", ({
3514
+ __publicField$g(this, "getAjaxUploadStartParameters", ({
3482
3515
  useDocTypePermitted,
3483
3516
  docTypePermittedObjType,
3484
3517
  docTypePermittedObjId,
@@ -3490,7 +3523,7 @@ class FormsUploader extends UploaderApi {
3490
3523
  ...this.getFormParameters()
3491
3524
  };
3492
3525
  });
3493
- __publicField$f(this, "getCheckLockDocumentParameters", ({
3526
+ __publicField$g(this, "getCheckLockDocumentParameters", ({
3494
3527
  prefix,
3495
3528
  ...parameters
3496
3529
  }) => {
@@ -3499,7 +3532,7 @@ class FormsUploader extends UploaderApi {
3499
3532
  ...this.getFormParameters()
3500
3533
  };
3501
3534
  });
3502
- __publicField$f(this, "getCheckSignatureParameters", (parameters) => {
3535
+ __publicField$g(this, "getCheckSignatureParameters", (parameters) => {
3503
3536
  const { frmId, frmParent } = this.getFormParameters();
3504
3537
  return {
3505
3538
  ...parameters,
@@ -3507,7 +3540,7 @@ class FormsUploader extends UploaderApi {
3507
3540
  frmParent
3508
3541
  };
3509
3542
  });
3510
- __publicField$f(this, "getClearTempFilesParameters", ({
3543
+ __publicField$g(this, "getClearTempFilesParameters", ({
3511
3544
  elemType,
3512
3545
  ...rest
3513
3546
  }) => {
@@ -3520,7 +3553,7 @@ class FormsUploader extends UploaderApi {
3520
3553
  index
3521
3554
  };
3522
3555
  });
3523
- __publicField$f(this, "getConfirmDropModalParameters", (defaultParameters) => {
3556
+ __publicField$g(this, "getConfirmDropModalParameters", (defaultParameters) => {
3524
3557
  return {
3525
3558
  ...defaultParameters,
3526
3559
  elemType: this.elemId(),
@@ -3528,7 +3561,7 @@ class FormsUploader extends UploaderApi {
3528
3561
  ...this.getFormParameters()
3529
3562
  };
3530
3563
  });
3531
- __publicField$f(this, "getConfirmDropModalPostdata", ({
3564
+ __publicField$g(this, "getConfirmDropModalPostdata", ({
3532
3565
  pe,
3533
3566
  ...parameters
3534
3567
  }) => {
@@ -3538,7 +3571,7 @@ class FormsUploader extends UploaderApi {
3538
3571
  editionMode
3539
3572
  };
3540
3573
  });
3541
- __publicField$f(this, "getDeleteDocumentParameters", ({
3574
+ __publicField$g(this, "getDeleteDocumentParameters", ({
3542
3575
  prefix,
3543
3576
  isAjax,
3544
3577
  ...currentParameters
@@ -3549,13 +3582,13 @@ class FormsUploader extends UploaderApi {
3549
3582
  ...rest
3550
3583
  };
3551
3584
  });
3552
- __publicField$f(this, "getDocumentInfoParameters", (parameters) => {
3585
+ __publicField$g(this, "getDocumentInfoParameters", (parameters) => {
3553
3586
  return {
3554
3587
  ...parameters,
3555
3588
  ajaxUrl: getWindow(this.execution).URL_REQUEST_AJAX
3556
3589
  };
3557
3590
  });
3558
- __publicField$f(this, "getEditDocumentParameters", ({ action, docId }) => {
3591
+ __publicField$g(this, "getEditDocumentParameters", ({ action, docId }) => {
3559
3592
  const { prefix, editionMode, ...rest } = this.getFormParameters();
3560
3593
  return {
3561
3594
  action,
@@ -3564,7 +3597,7 @@ class FormsUploader extends UploaderApi {
3564
3597
  ajaxUrl: "apia.execution.FormAction.run"
3565
3598
  };
3566
3599
  });
3567
- __publicField$f(this, "getLoadFilesForFolderParameters", () => {
3600
+ __publicField$g(this, "getLoadFilesForFolderParameters", () => {
3568
3601
  return {
3569
3602
  useDocTypePermitted: this.state.allowedTypes.length === 1 ? true : void 0,
3570
3603
  docTypeForcedId: this.state.allowedTypes.length === 1 ? this.state.allowedTypes[0].id : void 0,
@@ -3572,11 +3605,11 @@ class FormsUploader extends UploaderApi {
3572
3605
  loadFolders: true
3573
3606
  };
3574
3607
  });
3575
- __publicField$f(this, "getLoadFileSystemStructureTree", () => ({
3608
+ __publicField$g(this, "getLoadFileSystemStructureTree", () => ({
3576
3609
  useDocTypePermitted: this.state.allowedTypes.length === 1,
3577
3610
  docTypeForcedId: this.docTypePermittedObjId
3578
3611
  }));
3579
- __publicField$f(this, "getLockDocumentParameters", ({
3612
+ __publicField$g(this, "getLockDocumentParameters", ({
3580
3613
  prefix,
3581
3614
  isAjax,
3582
3615
  ...currentParameters
@@ -3587,7 +3620,7 @@ class FormsUploader extends UploaderApi {
3587
3620
  ...rest
3588
3621
  };
3589
3622
  });
3590
- __publicField$f(this, "getMarkFileToSignParameters", ({
3623
+ __publicField$g(this, "getMarkFileToSignParameters", ({
3591
3624
  docId,
3592
3625
  prefix,
3593
3626
  ...defaultParameters
@@ -3599,7 +3632,7 @@ class FormsUploader extends UploaderApi {
3599
3632
  ...this.getFormParameters()
3600
3633
  };
3601
3634
  });
3602
- __publicField$f(this, "getProcessDroppedFilesParameters", (defaultParameters) => {
3635
+ __publicField$g(this, "getProcessDroppedFilesParameters", (defaultParameters) => {
3603
3636
  const { prefix, ...rest } = this.getFormParameters();
3604
3637
  return {
3605
3638
  ...defaultParameters,
@@ -3608,7 +3641,7 @@ class FormsUploader extends UploaderApi {
3608
3641
  ...rest
3609
3642
  };
3610
3643
  });
3611
- __publicField$f(this, "getProcessDroppedFilesPostdata", ({
3644
+ __publicField$g(this, "getProcessDroppedFilesPostdata", ({
3612
3645
  useDocTypePermitted,
3613
3646
  docTypePermittedObjId,
3614
3647
  docTypePermittedObjType,
@@ -3616,14 +3649,14 @@ class FormsUploader extends UploaderApi {
3616
3649
  }) => {
3617
3650
  return { ...parameters, editionMode: this.getFormParameters().editionMode };
3618
3651
  });
3619
- __publicField$f(this, "getReloadMetadataParameters", (defaultParameters) => {
3652
+ __publicField$g(this, "getReloadMetadataParameters", (defaultParameters) => {
3620
3653
  return {
3621
3654
  ...defaultParameters,
3622
3655
  ...getWindow(this.execution).IS_EDIT_GRID ? { editionMode: true } : null,
3623
3656
  ...this.getFormParameters()
3624
3657
  };
3625
3658
  });
3626
- __publicField$f(this, "getSaveDroppedFilesParameters", (defaultParameters) => {
3659
+ __publicField$g(this, "getSaveDroppedFilesParameters", (defaultParameters) => {
3627
3660
  const elemId = this.elemId();
3628
3661
  const { prefix, ...rest } = this.getFormParameters();
3629
3662
  return {
@@ -3634,7 +3667,7 @@ class FormsUploader extends UploaderApi {
3634
3667
  ...rest
3635
3668
  };
3636
3669
  });
3637
- __publicField$f(this, "parseFileDefinition", (file) => {
3670
+ __publicField$g(this, "parseFileDefinition", (file) => {
3638
3671
  return {
3639
3672
  ...parseFileDefinition(
3640
3673
  this.execution,
@@ -3717,16 +3750,16 @@ class FormsUploader extends UploaderApi {
3717
3750
  }
3718
3751
  }
3719
3752
 
3720
- var __defProp$e = Object.defineProperty;
3721
- var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$e(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3722
- var __publicField$e = (obj, key, value) => {
3723
- __defNormalProp$e(obj, key + "" , value);
3753
+ var __defProp$f = Object.defineProperty;
3754
+ var __defNormalProp$f = (obj, key, value) => key in obj ? __defProp$f(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3755
+ var __publicField$f = (obj, key, value) => {
3756
+ __defNormalProp$f(obj, key + "" , value);
3724
3757
  return value;
3725
3758
  };
3726
3759
  class File extends FieldWithAttribute {
3727
3760
  constructor() {
3728
3761
  super(...arguments);
3729
- __publicField$e(this, "uploader", {});
3762
+ __publicField$f(this, "uploader", {});
3730
3763
  }
3731
3764
  async init(form) {
3732
3765
  await super.init(form);
@@ -3828,10 +3861,10 @@ function noNaN(number, defaultReturn = 0) {
3828
3861
  return returnNumber;
3829
3862
  }
3830
3863
 
3831
- var __defProp$d = Object.defineProperty;
3832
- var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3833
- var __publicField$d = (obj, key, value) => {
3834
- __defNormalProp$d(obj, key + "" , value);
3864
+ var __defProp$e = Object.defineProperty;
3865
+ var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$e(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3866
+ var __publicField$e = (obj, key, value) => {
3867
+ __defNormalProp$e(obj, key + "" , value);
3835
3868
  return value;
3836
3869
  };
3837
3870
  var __accessCheck$i = (obj, member, msg) => {
@@ -3856,7 +3889,7 @@ var _unsubscribeTableEvents;
3856
3889
  class GridFooterHandler {
3857
3890
  constructor(grid) {
3858
3891
  this.grid = grid;
3859
- __publicField$d(this, "state", {
3892
+ __publicField$e(this, "state", {
3860
3893
  isSortUpDisabled: true,
3861
3894
  isSortDownDisabled: true
3862
3895
  });
@@ -3956,15 +3989,15 @@ class HeaderCell extends Cell {
3956
3989
  }
3957
3990
  }
3958
3991
 
3959
- var __defProp$c = Object.defineProperty;
3960
- var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3961
- var __publicField$c = (obj, key, value) => {
3962
- __defNormalProp$c(obj, key + "" , value);
3992
+ var __defProp$d = Object.defineProperty;
3993
+ var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3994
+ var __publicField$d = (obj, key, value) => {
3995
+ __defNormalProp$d(obj, key + "" , value);
3963
3996
  return value;
3964
3997
  };
3965
3998
  class FieldsCache {
3966
3999
  constructor() {
3967
- __publicField$c(this, "cached", {});
4000
+ __publicField$d(this, "cached", {});
3968
4001
  }
3969
4002
  getIndex(index) {
3970
4003
  if (!this.cached[index])
@@ -3997,6 +4030,12 @@ class FieldsCache {
3997
4030
  }
3998
4031
  }
3999
4032
 
4033
+ var __defProp$c = Object.defineProperty;
4034
+ var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4035
+ var __publicField$c = (obj, key, value) => {
4036
+ __defNormalProp$c(obj, key + "" , value);
4037
+ return value;
4038
+ };
4000
4039
  class ModalInput extends FieldWithAttribute {
4001
4040
  constructor({ value, ...definition }) {
4002
4041
  super({
@@ -4006,6 +4045,8 @@ class ModalInput extends FieldWithAttribute {
4006
4045
  },
4007
4046
  value: { storeValue: value, showValue: definition.qry_show_value }
4008
4047
  });
4048
+ __publicField$c(this, "isLoading", false);
4049
+ makeObservable(this, { isLoading: observable });
4009
4050
  }
4010
4051
  fireEvent(eventName) {
4011
4052
  return super.fireEvent(eventName);
@@ -4014,62 +4055,72 @@ class ModalInput extends FieldWithAttribute {
4014
4055
  return this.getValue().showValue !== "" && this.getValue().storeValue !== "";
4015
4056
  }
4016
4057
  async setValueFromInputWrite(value) {
4017
- if (isFieldShowAsText(this) || shallowEqual$1(value, this.getValue().showValue) || value === "")
4018
- return;
4019
- if (value !== this.getValue().showValue) {
4058
+ this.isLoading = true;
4059
+ try {
4060
+ if (isFieldShowAsText(this) || shallowEqual$1(value, this.getValue().showValue) || value === "")
4061
+ return;
4062
+ if (value !== this.getValue().showValue) {
4063
+ const result = await post(
4064
+ this.form.execution,
4065
+ makeApiaUrl(this.form.execution, {
4066
+ action: "checkModalValue",
4067
+ ajaxUrl: "/apia.execution.FormAction.run"
4068
+ }),
4069
+ {
4070
+ postData: {
4071
+ frmId: this.form.definition.id,
4072
+ frmParent: this.form.definition.frmParent,
4073
+ fldId: this.definition.id,
4074
+ attId: this.attribute.id,
4075
+ qryId: this.definition.qryId,
4076
+ index: this.definition.index,
4077
+ value
4078
+ },
4079
+ postDataTreatment: "stringify"
4080
+ }
4081
+ );
4082
+ if (result?.data?.ret_value) {
4083
+ const setValueResult = await this.setValue({
4084
+ storeValue: result?.data?.ret_value.value,
4085
+ showValue: result?.data?.ret_value.show_value
4086
+ });
4087
+ if (setValueResult) {
4088
+ this.fireEvent("onChange");
4089
+ }
4090
+ this.setError("");
4091
+ } else {
4092
+ this.setValue({ showValue: "", storeValue: "" });
4093
+ this.setError(getWindow(this.form.execution).MSG_VAL_NOT_FOUND);
4094
+ }
4095
+ }
4096
+ } finally {
4097
+ this.isLoading = false;
4098
+ }
4099
+ }
4100
+ async setValueFromModalSelection(rowId) {
4101
+ this.isLoading = true;
4102
+ try {
4020
4103
  const result = await post(
4021
4104
  this.form.execution,
4022
4105
  makeApiaUrl(this.form.execution, {
4023
- action: "checkModalValue",
4024
- ajaxUrl: "/apia.execution.FormAction.run"
4106
+ ajaxUrl: "/apia.query.ModalAction.run",
4107
+ action: "getValues"
4025
4108
  }),
4026
- {
4027
- postData: {
4028
- frmId: this.form.definition.id,
4029
- frmParent: this.form.definition.frmParent,
4030
- fldId: this.definition.id,
4031
- attId: this.attribute.id,
4032
- qryId: this.definition.qryId,
4033
- index: this.definition.index,
4034
- value
4035
- },
4036
- postDataTreatment: "stringify"
4037
- }
4109
+ { postData: { id: rowId }, postDataTreatment: "stringify" }
4038
4110
  );
4039
- if (result?.data?.ret_value) {
4111
+ if (result?.data?.row?.cell) {
4040
4112
  const setValueResult = await this.setValue({
4041
- storeValue: result?.data?.ret_value.value,
4042
- showValue: result?.data?.ret_value.show_value
4113
+ storeValue: result.data.row.cell[0],
4114
+ showValue: result.data.row.cell[1]
4043
4115
  });
4116
+ this.form.execution.setLastModalReturn(result.data.row.cell);
4044
4117
  if (setValueResult) {
4118
+ this.fireEvent("onModalReturn");
4045
4119
  this.fireEvent("onChange");
4046
4120
  }
4047
- this.setError("");
4048
- } else {
4049
- this.setValue({ showValue: "", storeValue: "" });
4050
- this.setError(getWindow(this.form.execution).MSG_VAL_NOT_FOUND);
4051
- }
4052
- }
4053
- }
4054
- async setValueFromModalSelection(rowId) {
4055
- const result = await post(
4056
- this.form.execution,
4057
- makeApiaUrl(this.form.execution, {
4058
- ajaxUrl: "/apia.query.ModalAction.run",
4059
- action: "getValues"
4060
- }),
4061
- { postData: { id: rowId }, postDataTreatment: "stringify" }
4062
- );
4063
- if (result?.data?.row?.cell) {
4064
- const setValueResult = await this.setValue({
4065
- storeValue: result.data.row.cell[0],
4066
- showValue: result.data.row.cell[1]
4067
- });
4068
- this.form.execution.setLastModalReturn(result.data.row.cell);
4069
- if (setValueResult) {
4070
- this.fireEvent("onModalReturn");
4071
- this.fireEvent("onChange");
4072
4121
  }
4122
+ } finally {
4123
+ this.isLoading = false;
4073
4124
  }
4074
4125
  }
4075
4126
  async validate() {
@@ -4393,6 +4444,13 @@ class Grid extends Field$1 {
4393
4444
  deletingIndices.forEach(
4394
4445
  (c) => this.controller.body.getRowByIndex(c).remove()
4395
4446
  );
4447
+ for (let i = minIndex; i < this.controller.body.rows.length; i++) {
4448
+ this.controller.body.getRowByIndex(i).cells.forEach((c) => {
4449
+ if (c instanceof GridCell) {
4450
+ c.getField().definition.index = i;
4451
+ }
4452
+ });
4453
+ }
4396
4454
  this.tableController.clearSelection();
4397
4455
  if (this.tableController.body.rows.length === 0 && this.getProperty("includeFirstRow")) {
4398
4456
  await res;
@@ -5273,7 +5331,9 @@ class Select extends FieldWithAttribute {
5273
5331
  properties: { possibleValue }
5274
5332
  }) {
5275
5333
  return Promise.resolve(
5276
- String(possibleValue?.find((c) => c.selected)?.value || "")
5334
+ String(
5335
+ possibleValue?.find((c) => c.selected)?.value || possibleValue?.[0]?.value || ""
5336
+ )
5277
5337
  );
5278
5338
  }
5279
5339
  }
@@ -5398,70 +5458,34 @@ class Tree extends FieldWithAttribute {
5398
5458
  var __defProp$9 = Object.defineProperty;
5399
5459
  var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5400
5460
  var __publicField$9 = (obj, key, value) => {
5401
- __defNormalProp$9(obj, typeof key !== "symbol" ? key + "" : key, value);
5461
+ __defNormalProp$9(obj, key + "" , value);
5402
5462
  return value;
5403
5463
  };
5404
- const dateFormat = "DD/MM/YYYY";
5405
- function getCurrentDate() {
5406
- return dayjs().format(dateFormat);
5407
- }
5408
- const initState = {
5409
- validation: {
5410
- dirty: false,
5411
- errorMessage: "",
5412
- synchronizing: false
5413
- },
5414
- isStageMounted: {},
5415
- stageData: [],
5416
- isLoading: "NotLoading",
5417
- initialProps: {
5418
- schId: "",
5419
- proId: "",
5420
- proVerId: "",
5421
- tskId: "",
5422
- showDisponibility: "false",
5423
- showAttributes: "false"
5424
- }
5425
- };
5426
- class Scheduler extends Field$1 {
5464
+ class SchedulerField extends Field$1 {
5427
5465
  constructor(definition) {
5428
5466
  super(definition);
5429
- __publicField$9(this, "inited", false);
5430
- __publicField$9(this, "tableController", new TableController({
5431
- allowEdition: false,
5432
- allowSelection: false,
5433
- isSelectionMultiple: false,
5434
- allowResize: false
5435
- }));
5436
- __publicField$9(this, "parsedDateLabel", () => {
5437
- const mondayWeek = this.state?.data?.mondayWeek;
5438
- if (!mondayWeek) {
5439
- return "";
5440
- } else {
5441
- const monday = dayjs(mondayWeek, dateFormat);
5442
- const sunday = monday.add(6, "day");
5443
- const mondayDate = noNaN$1(monday.date());
5444
- const sundayDate = noNaN$1(sunday.date());
5445
- const mondayMonth = noNaN$1(monday.month());
5446
- const sundayMonth = noNaN$1(sunday.month());
5447
- const mondayYear = noNaN$1(monday.year());
5448
- const sundayYear = noNaN$1(sunday.year());
5449
- const getMonthLabel = (monthIndex) => getWindow(this.form.execution).LBL_MONTHS[monthIndex];
5450
- if (mondayDate > sundayDate && mondayMonth < sundayMonth) {
5451
- return `${mondayDate} de ${getMonthLabel(mondayMonth)} - ${sundayDate} de ${getMonthLabel(sundayMonth)}, ${mondayYear}`;
5452
- }
5453
- if (mondayMonth > sundayMonth) {
5454
- return `${mondayDate} de ${getMonthLabel(mondayMonth)}, ${mondayYear} - ${sundayDate} de ${getMonthLabel(sundayMonth)}, ${sundayYear}`;
5455
- }
5456
- return `${mondayDate} - ${sundayDate} de ${getMonthLabel(mondayMonth)}, ${mondayYear}`;
5457
- }
5467
+ __publicField$9(this, "_schedController");
5468
+ this._schedController = new Scheduler(this.parsedInitialProperties, {
5469
+ loadWeek: this.loadWeek.bind(this),
5470
+ deleteDate: this.deleteDate.bind(this),
5471
+ markDay: this.markDay.bind(this),
5472
+ loadInfo: this.loadInfo.bind(this)
5458
5473
  });
5459
- this.state = initState;
5460
5474
  }
5461
- get controller() {
5462
- return this.tableController;
5475
+ async deleteDate() {
5476
+ const res = await get(
5477
+ this.form.execution,
5478
+ makeApiaUrl(this.form.execution, {
5479
+ ajaxUrl: "/apia.design.TaskSchedulerAction.run",
5480
+ action: "clearExecutionSchedulerSelectedDay"
5481
+ })
5482
+ );
5483
+ if (res?.data?.success) {
5484
+ return true;
5485
+ }
5486
+ return false;
5463
5487
  }
5464
- get initialProperties() {
5488
+ get parsedInitialProperties() {
5465
5489
  const value = String(this.properties.value);
5466
5490
  let start = 0;
5467
5491
  let end = 0;
@@ -5482,11 +5506,10 @@ class Scheduler extends Field$1 {
5482
5506
  }
5483
5507
  async init(form) {
5484
5508
  await super.init(form);
5485
- this.loadWeek();
5509
+ this._schedController.loadWeek();
5486
5510
  }
5487
- async loadWeek(weekDay = getCurrentDate()) {
5488
- const { schId, proId, proVerId, tskId } = this.initialProperties;
5489
- const result = await get(
5511
+ async loadWeek(weekDay, schId, proId, proVerId, tskId) {
5512
+ const res = await get(
5490
5513
  this.form.execution,
5491
5514
  makeApiaUrl(this.form.execution, {
5492
5515
  ajaxUrl: "/apia.design.TaskSchedulerAction.run",
@@ -5498,427 +5521,36 @@ class Scheduler extends Field$1 {
5498
5521
  tskId
5499
5522
  })
5500
5523
  );
5501
- if (result?.data) {
5502
- this.state.data = result.data;
5503
- this.state.initialProps = this.initialProperties;
5504
- this.makeDaysStage(result.data);
5505
- this.state.validation = {
5506
- ...this.state.validation,
5507
- synchronizing: false
5508
- };
5509
- const rows = this.parseRows(result.data);
5510
- if (!this.inited) {
5511
- this.inited = true;
5512
- const tableJson = {
5513
- columns: this.getSchedulerColumns(result?.data),
5514
- rows,
5515
- filters: []
5516
- };
5517
- this.controller.build(tableJson);
5518
- } else {
5519
- this.controller.head.getState("rows").forEach((r) => {
5520
- r.cells.forEach((cell, cellIndex) => {
5521
- const newCell = this.getSchedulerColumns(result.data)[cellIndex];
5522
- if (newCell) {
5523
- if (cellIndex !== 0) {
5524
- cell.setState((cellState) => {
5525
- return {
5526
- ...cellState,
5527
- content: newCell.content
5528
- };
5529
- });
5530
- }
5531
- }
5532
- });
5533
- });
5534
- this.controller.body.getState("rows").forEach((r, i) => {
5535
- r.cells.forEach((cell, cellIndex) => {
5536
- const newCell = rows[i]?.cells?.[cellIndex];
5537
- if (newCell) {
5538
- cell.setState((cellState) => {
5539
- return {
5540
- ...cellState,
5541
- content: newCell.content,
5542
- properties: newCell.properties,
5543
- domProperties: newCell.domProperties
5544
- };
5545
- });
5546
- }
5547
- });
5548
- });
5549
- }
5550
- } else {
5551
- this.state.validation.errorMessage = "Failed to load scheduler data";
5552
- }
5553
- this.state.isLoading = "NotLoading";
5524
+ return res?.data ?? null;
5554
5525
  }
5555
- parseRows(data) {
5556
- const retrievedDays = arrayOrArray(data?.tskSchDay);
5557
- const hourIndexes = arrayOrArray(
5558
- retrievedDays.find((c) => c?.tskSchHour)?.tskSchHour
5526
+ async loadInfo(schId, weekDay, dayNumber, hour) {
5527
+ const res = await post(
5528
+ this.form.execution,
5529
+ makeApiaUrl(this.form.execution, {
5530
+ ajaxUrl: "/apia.design.TaskSchedulerAction.run",
5531
+ action: "getExecutionSchedulerDayInfo",
5532
+ schId,
5533
+ weekDay,
5534
+ dayNumber,
5535
+ hour
5536
+ })
5559
5537
  );
5560
- const columnsWithOutHour = this.getSchedulerColumns(data).slice(1);
5561
- const newRows = hourIndexes.map((hour, rowIdx) => {
5562
- const currentDate = dayjs();
5563
- const currentHour = Number(dayjs().format("HHmm"));
5564
- const newRow = {
5565
- id: hour.hour,
5566
- cells: [
5567
- {
5568
- colName: "hour",
5569
- content: `${hour.hour.slice(0, -2)}:${hour.hour.slice(2)}`
5570
- },
5571
- ...columnsWithOutHour.map((_, colIdx) => {
5572
- const currentDayDefinition = retrievedDays[colIdx];
5573
- const currentHourDefinition = arrayOrArray(
5574
- currentDayDefinition?.tskSchHour
5575
- )[rowIdx];
5576
- const parsingDay = dayjs(currentDayDefinition?.day, dateFormat);
5577
- const parsingHour = Number(currentHourDefinition?.hour);
5578
- const isEnabled = !hour?.disabled && Number(currentHourDefinition?.value) + Number(this.state.data?.overassign) > 0 && (!(parsingDay.isSame(currentDate, "day") || parsingDay.isBefore(currentDate, "day")) || parsingDay.isSame(currentDate, "day") && currentHour <= parsingHour);
5579
- const isQueriedDisabled = hour?.disabled;
5580
- const returnCell = {
5581
- colName: columnsWithOutHour[colIdx].colName,
5582
- domProperties: {
5583
- className: isEnabled ? "" : "disabled"
5584
- },
5585
- properties: {
5586
- cellId: `${hour.hour}_${colIdx + 1}_${data?.mondayWeek ?? ""}`,
5587
- currentDayDefinition,
5588
- isEnabled,
5589
- isQueriedDisabled,
5590
- weekDay: data?.mondayWeek ?? "",
5591
- dayNumber: colIdx + 1,
5592
- hour: hour.hour,
5593
- value: Number(currentHourDefinition?.value),
5594
- valuePlusOverassign: Number(currentHourDefinition?.value) + Number(this.state.data?.overassign),
5595
- isOverassignClassName: !!(!Number(currentHourDefinition?.value) && Number(currentHourDefinition?.value) < Number(this.state.data?.overassign))
5596
- }
5597
- };
5598
- return returnCell;
5599
- }).filter((c) => c !== null)
5600
- ]
5601
- };
5602
- return newRow;
5603
- });
5604
- return newRows;
5538
+ return res?.data?.pro_instances?.pro_instance ?? [];
5605
5539
  }
5606
- isMorningTime(hour) {
5607
- if (Number(hour) < 1200)
5608
- return true;
5609
- return false;
5540
+ async markDay(weekDay, hour, dayNumber) {
5541
+ await get(
5542
+ this.form.execution,
5543
+ makeApiaUrl(this.form.execution, {
5544
+ ajaxUrl: "/apia.design.TaskSchedulerAction.run",
5545
+ action: "setExecutionSchedulerSelectedDay",
5546
+ weekDay,
5547
+ hour,
5548
+ dayNumber
5549
+ })
5550
+ );
5610
5551
  }
5611
- setState(newState) {
5612
- Object.entries(newState).forEach(([key, value]) => {
5613
- this.state[key] = value;
5614
- });
5615
- }
5616
- setDay(day) {
5617
- if (!this.state.selectedDay)
5618
- this.state.selectedDay = {};
5619
- this.state.selectedDay = { ...this.state.selectedDay, ...day };
5620
- }
5621
- setStage({ index, newStage }) {
5622
- if (!this.state.stageData)
5623
- this.state.stageData = [];
5624
- this.state.stageData[index] = newStage;
5625
- this.state.stageData.splice(index + 1);
5626
- }
5627
- syncStage(day, hour) {
5628
- this.makeMorningOrAfternoonStage(day);
5629
- this.makeHoursStage(day, this.isMorningTime(hour));
5630
- }
5631
- makeDaysStage(data) {
5632
- const dayData = data ?? this.state.data;
5633
- const overassign = this.state.data?.overassign;
5634
- const availableDays = arrayOrArray(dayData?.tskSchDay).map((currentDay) => {
5635
- const isDisabled = !arrayOrArray(currentDay?.tskSchHour).find(
5636
- (hour) => {
5637
- const parsingDay = dayjs(currentDay.day, dateFormat);
5638
- const currentDate = dayjs();
5639
- const parsingHour = Number(hour.hour);
5640
- const currentHour = Number(dayjs().format("HHmm"));
5641
- if (hour.hour !== void 0 && noNaN$1(hour.value) + noNaN$1(overassign) >= 0 && !(parsingDay.isSame(currentDate, "day") || parsingDay.isBefore(currentDate, "day")) || parsingDay.isSame(currentDate, "day") && currentHour <= parsingHour && !hour.disabled) {
5642
- return true;
5643
- }
5644
- return false;
5645
- }
5646
- );
5647
- return { ...currentDay, isDisabled };
5648
- }) ?? [];
5649
- const availableDaysButtons = availableDays.map((c) => {
5650
- const parsingDay = dayjs(c.day, dateFormat);
5651
- const returnBtn = {
5652
- isDisabled: c.isDisabled,
5653
- "aria-label": getWindow(this.form.execution).LBL_DAYS[dayjs(parsingDay).day()],
5654
- title: c.day,
5655
- label: `${getWindow(this.form.execution).LBL_DAYS[dayjs(parsingDay).day()]},
5656
- ${dayjs(parsingDay).get("date")}`,
5657
- value: "",
5658
- isSelectedSelector: () => {
5659
- return this.state.selectedDay?.day === c.day;
5660
- },
5661
- action: () => {
5662
- const isLoading = this.state.isLoading;
5663
- if (isLoading !== "NotLoading")
5664
- return;
5665
- this.makeMorningOrAfternoonStage(c);
5666
- const parsedMondayWeek = dayjs(dayData?.mondayWeek, dateFormat).get(
5667
- "date"
5668
- );
5669
- const parsedDay = dayjs(c.day, dateFormat).get("date");
5670
- this.setDay({
5671
- mondayWeek: dayData?.mondayWeek,
5672
- day: c.day,
5673
- dayNumber: Number(parsedDay) - Number(parsedMondayWeek) + 1
5674
- });
5675
- }
5676
- };
5677
- return returnBtn;
5678
- });
5679
- this.setStage({
5680
- index: 0,
5681
- newStage: {
5682
- name: "daysList",
5683
- buttons: [...availableDaysButtons]
5684
- }
5685
- });
5686
- }
5687
- makeMorningOrAfternoonStage(day) {
5688
- const thisDate = day.day;
5689
- const hours = arrayOrArray(day.tskSchHour);
5690
- const isLoading = this.state.isLoading;
5691
- const overassign = this.state.data?.overassign;
5692
- const parsingDay = dayjs(thisDate, dateFormat);
5693
- const currentDate = dayjs();
5694
- const currentHour = Number(dayjs().format("HHmm"));
5695
- const morningHours = hours?.filter((hour) => {
5696
- return (parsingDay.isSame(currentDate, "day") && currentHour <= Number(hour.hour) || !parsingDay.isSame(currentDate, "day") && Number(hour.value) + Number(overassign) > 0) && Number(hour.hour) < 1200;
5697
- });
5698
- const afternoonHours = hours?.filter((hour) => {
5699
- return (parsingDay.isSame(currentDate, "day") && currentHour <= Number(hour.hour) || !parsingDay.isSame(currentDate, "day") && Number(hour.value) + Number(overassign) > 0) && Number(hour.hour) >= 1200;
5700
- });
5701
- const morningButton = {
5702
- isDisabled: (morningHours?.length ?? 0) === 0,
5703
- label: getWindow(this.form.execution).LBL_SCHED_MORNING_TEXT,
5704
- title: getWindow(this.form.execution).LBL_SCHED_MORNING_TEXT,
5705
- "aria-label": getWindow(this.form.execution).LBL_SCHED_MORNING_TEXT,
5706
- value: "",
5707
- isSelectedSelector: () => {
5708
- return this.isMorningTime(
5709
- this.state.selectedDay?.morningOrAfternoonSelected
5710
- );
5711
- },
5712
- action: () => {
5713
- if (isLoading !== "NotLoading")
5714
- return;
5715
- this.setDay({
5716
- morningOrAfternoonSelected: 1100
5717
- });
5718
- const newStagesStringArray = [];
5719
- this.makeHoursStage(day, this.isMorningTime(1100));
5720
- this.setState({
5721
- stageList: newStagesStringArray
5722
- });
5723
- }
5724
- };
5725
- const afternoonButton = {
5726
- isDisabled: (afternoonHours?.length ?? 0) === 0,
5727
- label: getWindow(this.form.execution).LBL_SCHED_AFTERNOON_TEXT,
5728
- title: getWindow(this.form.execution).LBL_SCHED_AFTERNOON_TEXT,
5729
- "aria-label": getWindow(this.form.execution).LBL_SCHED_AFTERNOON_TEXT,
5730
- value: "",
5731
- isSelectedSelector: () => {
5732
- if (this.state.selectedDay?.morningOrAfternoonSelected) {
5733
- return !this.isMorningTime(
5734
- this.state.selectedDay?.morningOrAfternoonSelected
5735
- );
5736
- }
5737
- return false;
5738
- },
5739
- action: () => {
5740
- if (isLoading !== "NotLoading")
5741
- return;
5742
- this.setDay({
5743
- morningOrAfternoonSelected: 1300
5744
- });
5745
- this.makeHoursStage(day, this.isMorningTime(1300));
5746
- }
5747
- };
5748
- this.setStage({
5749
- index: 1,
5750
- newStage: {
5751
- name: "morningOrAfternoon",
5752
- buttons: [morningButton, afternoonButton].filter(
5753
- (current) => current !== null
5754
- )
5755
- }
5756
- });
5757
- }
5758
- makeHoursStage(day, isMorning) {
5759
- const thisDate = day.day;
5760
- const hours = arrayOrArray(day.tskSchHour);
5761
- const overassign = this.state.data?.overassign;
5762
- const parsingDay = dayjs(thisDate, dateFormat);
5763
- const currentDate = dayjs();
5764
- const currentHour = Number(dayjs().format("HHmm"));
5765
- const isLoading = this.state.isLoading;
5766
- let morningOrAfternoonHours;
5767
- if (isMorning) {
5768
- morningOrAfternoonHours = hours?.filter((hour) => {
5769
- return (parsingDay.isSame(currentDate, "day") && currentHour <= Number(hour.hour) || !parsingDay.isSame(currentDate, "day") && Number(hour.value) + Number(overassign) > 0) && Number(hour.hour) < 1200;
5770
- });
5771
- } else {
5772
- morningOrAfternoonHours = hours?.filter((hour) => {
5773
- return (parsingDay.isSame(currentDate, "day") && currentHour <= Number(hour.hour) || !parsingDay.isSame(currentDate, "day") && Number(hour.value) + Number(overassign) > 0) && Number(hour.hour) >= 1200;
5774
- });
5775
- }
5776
- const enableHours = morningOrAfternoonHours?.filter(
5777
- (hour) => !hour.disabled
5778
- );
5779
- this.setStage({
5780
- index: 2,
5781
- newStage: {
5782
- name: "daysHours",
5783
- buttons: enableHours?.map((hour) => {
5784
- const returnButton = {
5785
- title: hour.hour,
5786
- label: `${hour.hour.slice(0, -2)}:${hour.hour.slice(2)}`,
5787
- value: hour.value,
5788
- "aria-label": hour.hour,
5789
- isSelectedSelector: () => {
5790
- return this.state?.selectedDay?.hour === hour.hour;
5791
- },
5792
- action: () => {
5793
- if (isLoading !== "NotLoading")
5794
- return;
5795
- this.setState({
5796
- selectedCell: `${hour.hour} ${String(
5797
- this.state?.selectedDay?.dayNumber
5798
- )} ${this.state?.selectedDay?.mondayWeek}`
5799
- });
5800
- this.setDay({
5801
- hour: hour.hour,
5802
- mondayWeek: this.state?.selectedDay?.mondayWeek
5803
- });
5804
- get(
5805
- this.form.execution,
5806
- makeApiaUrl(this.form.execution, {
5807
- ajaxUrl: "/apia.design.TaskSchedulerAction.run",
5808
- action: "setExecutionSchedulerSelectedDay",
5809
- weekDay: this.state?.selectedDay?.mondayWeek,
5810
- hour: hour.hour,
5811
- dayNumber: this.state?.selectedDay?.dayNumber
5812
- })
5813
- ).then(() => {
5814
- }).catch(() => {
5815
- });
5816
- }
5817
- };
5818
- return returnButton;
5819
- })
5820
- }
5821
- });
5822
- }
5823
- async deleteDate() {
5824
- this.setState({ isLoading: "DeleteWeek" });
5825
- get(
5826
- this.form.execution,
5827
- makeApiaUrl(this.form.execution, {
5828
- ajaxUrl: "/apia.design.TaskSchedulerAction.run",
5829
- action: "clearExecutionSchedulerSelectedDay"
5830
- })
5831
- ).then((response) => {
5832
- if (response?.data?.success) {
5833
- this.setState({
5834
- selectedDay: {},
5835
- selectedCell: null,
5836
- isLoading: "NotLoading"
5837
- });
5838
- this.makeDaysStage();
5839
- }
5840
- }).catch(() => {
5841
- });
5842
- }
5843
- async goNextWeek() {
5844
- if (this.state.isLoading === "NotLoading") {
5845
- this.setState({ isLoading: "NextWeek" });
5846
- await this.loadWeek(
5847
- dayjs(this.state.data?.mondayWeek, dateFormat).add(7, "day").format(dateFormat)
5848
- );
5849
- this.makeDaysStage(this.state.data);
5850
- }
5851
- }
5852
- async goPreviousWeek() {
5853
- if (this.state.isLoading === "NotLoading") {
5854
- this.setState({ isLoading: "LastWeek" });
5855
- await this.loadWeek(
5856
- dayjs(this.state.data?.mondayWeek, dateFormat).subtract(7, "day").format(dateFormat)
5857
- );
5858
- this.makeDaysStage(this.state.data);
5859
- }
5860
- }
5861
- getSchedulerColumns(data) {
5862
- if (!data || !data.mondayWeek) {
5863
- return [];
5864
- }
5865
- const columns = [
5866
- {
5867
- content: getWindow(this.form.execution).TSK_SCH_HOUR,
5868
- colName: "Hour",
5869
- width: "75px"
5870
- },
5871
- {
5872
- content: `${getWindow(this.form.execution).TSK_DAY_MON} ${dayjs(
5873
- data?.mondayWeek,
5874
- dateFormat
5875
- ).format("DD/MM")}`,
5876
- colName: "Monday"
5877
- },
5878
- {
5879
- content: `${getWindow(this.form.execution).TSK_DAY_TUE} ${dayjs(
5880
- data?.mondayWeek,
5881
- dateFormat
5882
- ).add(1, "day").format("DD/MM")}`,
5883
- colName: "Tuesday"
5884
- },
5885
- {
5886
- content: `${getWindow(this.form.execution).TSK_DAY_WED} ${dayjs(
5887
- data?.mondayWeek,
5888
- dateFormat
5889
- ).add(2, "day").format("DD/MM")} `,
5890
- colName: "Wednesday"
5891
- },
5892
- {
5893
- content: `${getWindow(this.form.execution).TSK_DAY_THU} ${dayjs(
5894
- data?.mondayWeek,
5895
- dateFormat
5896
- ).add(3, "day").format("DD/MM")}`,
5897
- colName: "Thursday"
5898
- },
5899
- {
5900
- content: `${getWindow(this.form.execution).TSK_DAY_FRI} ${dayjs(
5901
- data?.mondayWeek,
5902
- dateFormat
5903
- ).add(4, "day").format("DD/MM")}`,
5904
- colName: "Friday"
5905
- },
5906
- {
5907
- content: `${getWindow(this.form.execution).TSK_DAY_SAT} ${dayjs(
5908
- data?.mondayWeek,
5909
- dateFormat
5910
- ).add(5, "day").format("DD/MM")}`,
5911
- colName: "Saturday"
5912
- },
5913
- {
5914
- content: `${getWindow(this.form.execution).TSK_DAY_SUN} ${dayjs(
5915
- data?.mondayWeek,
5916
- dateFormat
5917
- ).add(6, "day").format("DD/MM")}`,
5918
- colName: "Sunday"
5919
- }
5920
- ];
5921
- return columns;
5552
+ get schedController() {
5553
+ return this._schedController;
5922
5554
  }
5923
5555
  }
5924
5556
 
@@ -6282,9 +5914,6 @@ class ButtonField extends ApiaField {
6282
5914
  }
6283
5915
  _field$d = new WeakMap();
6284
5916
 
6285
- class EditorField extends ApiaField {
6286
- }
6287
-
6288
5917
  var __accessCheck$f = (obj, member, msg) => {
6289
5918
  if (!member.has(obj))
6290
5919
  throw TypeError("Cannot " + msg);
@@ -6351,6 +5980,9 @@ class ApiaFieldWithAttribute extends ApiaField {
6351
5980
  }
6352
5981
  _field$c = new WeakMap();
6353
5982
 
5983
+ class EditorField extends ApiaFieldWithAttribute {
5984
+ }
5985
+
6354
5986
  var __accessCheck$e = (obj, member, msg) => {
6355
5987
  if (!member.has(obj))
6356
5988
  throw TypeError("Cannot " + msg);
@@ -7414,16 +7046,13 @@ class ApiaFunctions {
7414
7046
  this.actionButton(actualId)?.disable();
7415
7047
  }
7416
7048
  disableOptionButton(id) {
7417
- const actualId = typeof id === "number" ? this.getButtonAction(id) : id;
7418
- this.disableActionButton(actualId);
7049
+ this.disableActionButton(id);
7419
7050
  }
7420
7051
  enableActionButton(id) {
7421
- const actualId = typeof id === "number" ? this.getButtonAction(id) : id;
7422
- this.actionButton(actualId)?.enable();
7052
+ this.actionButton(id)?.enable();
7423
7053
  }
7424
7054
  enableOptionButton(id) {
7425
- const actualId = typeof id === "number" ? this.getButtonAction(id) : id;
7426
- this.enableActionButton(actualId);
7055
+ this.enableActionButton(id);
7427
7056
  }
7428
7057
  getAllForms() {
7429
7058
  return this.execution.getAllForms().map((c) => new ApiaForm(this.execution, c));
@@ -7446,38 +7075,38 @@ class ApiaFunctions {
7446
7075
  getButtonAction(id) {
7447
7076
  let btnId;
7448
7077
  switch (id) {
7449
- case (ActionsController.CLOSE || "CLOSE"):
7450
- btnId = "CLOSE";
7078
+ case ActionsController.CLOSE:
7079
+ btnId = "btnClose";
7451
7080
  break;
7452
- case (ActionsController.CONFIRM || "CONFIRM"):
7453
- btnId = "CONFIRM";
7081
+ case ActionsController.CONFIRM:
7082
+ btnId = "btnCon";
7454
7083
  break;
7455
- case (ActionsController.DELEGATE || "DELEGATE"):
7456
- btnId = "DELEGATE";
7084
+ case ActionsController.DELEGATE:
7085
+ btnId = "lblExeDelegar";
7457
7086
  break;
7458
- case (ActionsController.NEXT || "NEXT"):
7459
- btnId = "NEXT";
7087
+ case ActionsController.NEXT:
7088
+ btnId = "btnSig";
7460
7089
  break;
7461
- case (ActionsController.PREVIOUS || "PREVIOUS"):
7462
- btnId = "PREVIOUS";
7090
+ case ActionsController.PREVIOUS:
7091
+ btnId = "btnAnt";
7463
7092
  break;
7464
- case (ActionsController.PRINT || "PRINT"):
7465
- btnId = "PRINT";
7093
+ case ActionsController.PRINT:
7094
+ btnId = "btnStaPri";
7466
7095
  break;
7467
- case (ActionsController.RELEASE || "RELEASE"):
7468
- btnId = "RELEASE";
7096
+ case ActionsController.RELEASE:
7097
+ btnId = "btnEjeLib";
7469
7098
  break;
7470
- case (ActionsController.SAVE || "SAVE"):
7471
- btnId = "SAVE";
7099
+ case ActionsController.SAVE:
7100
+ btnId = "btnGua";
7472
7101
  break;
7473
- case (ActionsController.SIGN || "SIGN"):
7474
- btnId = "SIGN";
7102
+ case ActionsController.SIGN:
7103
+ btnId = "btnSig";
7475
7104
  break;
7476
- case (ActionsController.SHARE || "SHARE"):
7477
- btnId = "SHARE";
7105
+ case ActionsController.SHARE:
7106
+ btnId = "lblShareMsg";
7478
7107
  break;
7479
- case (ActionsController.VIEW_DOCS || "VIEW_DOCS"):
7480
- btnId = "VIEW_DOCS";
7108
+ case ActionsController.VIEW_DOCS:
7109
+ btnId = "sbtEjeDoc";
7481
7110
  break;
7482
7111
  default:
7483
7112
  throw new Error(`There is no button with id ${id}`);
@@ -7546,12 +7175,10 @@ class ApiaFunctions {
7546
7175
  return null;
7547
7176
  }
7548
7177
  hideActionButton(id) {
7549
- const actualId = typeof id === "number" ? this.getButtonAction(id) : id;
7550
- this.actionButton(actualId)?.hide();
7178
+ this.actionButton(id)?.hide();
7551
7179
  }
7552
7180
  hideOptionButton(id) {
7553
- const actualId = typeof id === "number" ? this.getButtonAction(id) : id;
7554
- this.hideActionButton(actualId);
7181
+ this.hideActionButton(id);
7555
7182
  }
7556
7183
  saveTask() {
7557
7184
  this.execution.doSave().then((res) => {
@@ -7566,12 +7193,10 @@ class ApiaFunctions {
7566
7193
  this.execution.setStepTitle(stepNumber, stepTitle);
7567
7194
  }
7568
7195
  showActionButton(id) {
7569
- const actualId = typeof id === "number" ? this.getButtonAction(id) : id;
7570
- this.actionButton(actualId)?.show();
7196
+ this.actionButton(id)?.show();
7571
7197
  }
7572
7198
  showOptionButton(id) {
7573
- const actualId = typeof id === "number" ? this.getButtonAction(id) : id;
7574
- this.showActionButton(actualId);
7199
+ this.showActionButton(id);
7575
7200
  }
7576
7201
  viewAdmEntity(entName, entNum) {
7577
7202
  this.admEntity(entName, entNum);
@@ -7618,8 +7243,14 @@ class CustomComponent {
7618
7243
  isLoading: false,
7619
7244
  attributes: {},
7620
7245
  properties: {},
7621
- additional: {}
7246
+ additional: {},
7247
+ component: null
7622
7248
  });
7249
+ if (definition.error_while_processing) {
7250
+ throw new Error(
7251
+ `Cannot initialize custom component ${definition.name}: ${definition.error_while_processing}`
7252
+ );
7253
+ }
7623
7254
  makeObservable(this, {
7624
7255
  _state: observable,
7625
7256
  state: computed
@@ -7627,7 +7258,7 @@ class CustomComponent {
7627
7258
  this.parseStateObject(definition.state.state);
7628
7259
  }
7629
7260
  get state() {
7630
- return freezeDeep(toJS(this._state));
7261
+ return toJS(this._state);
7631
7262
  }
7632
7263
  getAdditional() {
7633
7264
  return this.state.additional;
@@ -7929,39 +7560,16 @@ class CustomComponent {
7929
7560
  this._state.isLoading = false;
7930
7561
  }
7931
7562
  }
7932
- }
7933
- _hasInited = new WeakMap();
7934
-
7935
- function decodeBase64ToUtf8(base64String) {
7936
- const binaryString = atob(base64String);
7937
- const bytes = Uint8Array.from(binaryString, (char) => char.charCodeAt(0));
7938
- return new TextDecoder("utf-8").decode(bytes);
7939
- }
7940
- async function getFormXMLDataAsObj(formDiv) {
7941
- if (formDiv.dataset.xml) {
7942
- const formData = await parseXml(
7943
- decodeBase64ToUtf8(formDiv.dataset.xml)
7944
- );
7945
- return formData;
7946
- }
7947
- return null;
7948
- }
7949
- async function readFormsDefinition(execution) {
7950
- const elements = [
7951
- ...getDocument(execution).querySelectorAll(".formContainer")
7952
- ];
7953
- const forms = [];
7954
- for await (const form of elements) {
7955
- const def = await getFormXMLDataAsObj(form);
7956
- if (def)
7957
- forms.push(def);
7563
+ setState(prop, value) {
7564
+ this._state[prop] = value;
7958
7565
  }
7959
- return forms;
7960
7566
  }
7567
+ _hasInited = new WeakMap();
7961
7568
 
7962
- class InitialData {
7963
- static getFormsDefinition(execution) {
7964
- return readFormsDefinition(execution);
7569
+ class StatusNotification extends Notification {
7570
+ constructor(props) {
7571
+ super(props);
7572
+ this.props = props;
7965
7573
  }
7966
7574
  }
7967
7575
 
@@ -7971,24 +7579,67 @@ var __publicField$6 = (obj, key, value) => {
7971
7579
  __defNormalProp$6(obj, typeof key !== "symbol" ? key + "" : key, value);
7972
7580
  return value;
7973
7581
  };
7582
+ class Notifications {
7583
+ constructor(execution) {
7584
+ this.execution = execution;
7585
+ __publicField$6(this, "emitter", new EventEmitter());
7586
+ __publicField$6(this, "notifications", []);
7587
+ __publicField$6(this, "on", this.emitter.on.bind(this.emitter));
7588
+ makeObservable(this, {
7589
+ notifications: observable,
7590
+ add: action,
7591
+ remove: action
7592
+ });
7593
+ }
7594
+ add(notification) {
7595
+ this.notifications.push(notification);
7596
+ this.emitter.emit("notification", notification);
7597
+ }
7598
+ closeTab() {
7599
+ this.emitter.emit("closeTab", null);
7600
+ }
7601
+ getAll() {
7602
+ return this.notifications;
7603
+ }
7604
+ getById(id) {
7605
+ return this.notifications.find((c) => c.id === id);
7606
+ }
7607
+ kill() {
7608
+ this.emitter.emit("kill", null);
7609
+ }
7610
+ remove(notification) {
7611
+ this.notifications = this.notifications.filter((c) => {
7612
+ if (typeof notification === "string" || typeof notification === "number")
7613
+ return c.id !== notification;
7614
+ return c !== notification;
7615
+ });
7616
+ }
7617
+ }
7618
+
7619
+ var __defProp$5 = Object.defineProperty;
7620
+ var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7621
+ var __publicField$5 = (obj, key, value) => {
7622
+ __defNormalProp$5(obj, typeof key !== "symbol" ? key + "" : key, value);
7623
+ return value;
7624
+ };
7974
7625
  class Form extends WithProperties {
7975
7626
  constructor(execution, definition) {
7976
7627
  const props = parseFakeJSON$1(definition.properties);
7977
7628
  super(props);
7978
7629
  this.execution = execution;
7979
- __publicField$6(this, "fields");
7980
- __publicField$6(this, "state", { isMarkedToSign: false });
7981
- __publicField$6(this, "_customComponents", /* @__PURE__ */ new Map());
7982
- __publicField$6(this, "fieldsById", /* @__PURE__ */ new Map());
7983
- __publicField$6(this, "fieldsByName", /* @__PURE__ */ new Map());
7984
- __publicField$6(this, "fieldsByAttributeId", /* @__PURE__ */ new Map());
7985
- __publicField$6(this, "fieldsByAttributeName", /* @__PURE__ */ new Map());
7986
- __publicField$6(this, "fieldsGroups", /* @__PURE__ */ new Map());
7987
- __publicField$6(this, "definition", {});
7988
- __publicField$6(this, "cucCmpByAttId", /* @__PURE__ */ new Map());
7989
- __publicField$6(this, "cucCmpByFldId", /* @__PURE__ */ new Map());
7990
- __publicField$6(this, "cucCmpByAttName", /* @__PURE__ */ new Map());
7991
- __publicField$6(this, "mustRenderFields", []);
7630
+ __publicField$5(this, "fields");
7631
+ __publicField$5(this, "state", { isMarkedToSign: false });
7632
+ __publicField$5(this, "_customComponents", /* @__PURE__ */ new Map());
7633
+ __publicField$5(this, "fieldsById", /* @__PURE__ */ new Map());
7634
+ __publicField$5(this, "fieldsByName", /* @__PURE__ */ new Map());
7635
+ __publicField$5(this, "fieldsByAttributeId", /* @__PURE__ */ new Map());
7636
+ __publicField$5(this, "fieldsByAttributeName", /* @__PURE__ */ new Map());
7637
+ __publicField$5(this, "fieldsGroups", /* @__PURE__ */ new Map());
7638
+ __publicField$5(this, "definition", {});
7639
+ __publicField$5(this, "cucCmpByAttId", /* @__PURE__ */ new Map());
7640
+ __publicField$5(this, "cucCmpByFldId", /* @__PURE__ */ new Map());
7641
+ __publicField$5(this, "cucCmpByAttName", /* @__PURE__ */ new Map());
7642
+ __publicField$5(this, "mustRenderFields", []);
7992
7643
  makeObservable(this, {
7993
7644
  state: observable,
7994
7645
  allFields: computed,
@@ -8267,6 +7918,39 @@ class Form extends WithProperties {
8267
7918
  }
8268
7919
  }
8269
7920
 
7921
+ function decodeBase64ToUtf8(base64String) {
7922
+ const binaryString = atob(base64String);
7923
+ const bytes = Uint8Array.from(binaryString, (char) => char.charCodeAt(0));
7924
+ return new TextDecoder("utf-8").decode(bytes);
7925
+ }
7926
+ async function getFormXMLDataAsObj(formDiv) {
7927
+ if (formDiv.dataset.xml) {
7928
+ const formData = await parseXml(
7929
+ decodeBase64ToUtf8(formDiv.dataset.xml)
7930
+ );
7931
+ return formData;
7932
+ }
7933
+ return null;
7934
+ }
7935
+ async function readFormsDefinition(execution) {
7936
+ const elements = [
7937
+ ...getDocument(execution).querySelectorAll(".formContainer")
7938
+ ];
7939
+ const forms = [];
7940
+ for await (const form of elements) {
7941
+ const def = await getFormXMLDataAsObj(form);
7942
+ if (def)
7943
+ forms.push(def);
7944
+ }
7945
+ return forms;
7946
+ }
7947
+
7948
+ class InitialData {
7949
+ static getFormsDefinition(execution) {
7950
+ return readFormsDefinition(execution);
7951
+ }
7952
+ }
7953
+
8270
7954
  const defaultFieldsMap = Object.freeze({
8271
7955
  area: () => Textarea,
8272
7956
  button: () => Button,
@@ -8295,7 +7979,7 @@ const defaultFieldsMap = Object.freeze({
8295
7979
  const definition = def;
8296
7980
  const value = definition.properties?.value;
8297
7981
  if (value && String(value).indexOf("schedContainer") !== -1) {
8298
- return Scheduler;
7982
+ return SchedulerField;
8299
7983
  }
8300
7984
  return Label;
8301
7985
  },
@@ -8307,46 +7991,6 @@ const defaultFieldsMap = Object.freeze({
8307
7991
  tree: () => Tree
8308
7992
  });
8309
7993
 
8310
- var __defProp$5 = Object.defineProperty;
8311
- var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8312
- var __publicField$5 = (obj, key, value) => {
8313
- __defNormalProp$5(obj, typeof key !== "symbol" ? key + "" : key, value);
8314
- return value;
8315
- };
8316
- class Notifications {
8317
- constructor(execution) {
8318
- this.execution = execution;
8319
- __publicField$5(this, "emitter", new EventEmitter());
8320
- __publicField$5(this, "notifications", []);
8321
- __publicField$5(this, "on", this.emitter.on.bind(this.emitter));
8322
- makeObservable(this, {
8323
- notifications: observable,
8324
- add: action,
8325
- remove: action
8326
- });
8327
- }
8328
- add(notification) {
8329
- this.notifications.push(notification);
8330
- this.emitter.emit("notification", notification);
8331
- }
8332
- closeTab() {
8333
- this.emitter.emit("closeTab", null);
8334
- }
8335
- getAll() {
8336
- return this.notifications;
8337
- }
8338
- getById(id) {
8339
- return this.notifications.find((c) => c.id === id);
8340
- }
8341
- remove(notification) {
8342
- this.notifications = this.notifications.filter((c) => {
8343
- if (typeof notification === "string" || typeof notification === "number")
8344
- return c.id !== notification;
8345
- return c !== notification;
8346
- });
8347
- }
8348
- }
8349
-
8350
7994
  var __defProp$4 = Object.defineProperty;
8351
7995
  var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8352
7996
  var __publicField$4 = (obj, key, value) => {
@@ -8586,6 +8230,9 @@ class Entity {
8586
8230
  const result = {
8587
8231
  busEntSta: this.state?.status.value ?? ""
8588
8232
  };
8233
+ if (this.state?.identifier?.body?.value) {
8234
+ result.txtEntNum = this.state?.identifier.body.value ?? "";
8235
+ }
8589
8236
  if (this.state?.categories) {
8590
8237
  result.catId = this.state?.categories.map((c) => c.id);
8591
8238
  this.state?.categories.filter((c) => c.checked).forEach((c) => {
@@ -9051,7 +8698,8 @@ async function checkWizard(execution, status) {
9051
8698
  postDataTreatment: "stringify",
9052
8699
  stringifyOptions: {
9053
8700
  arrayFormat: "repeat"
9054
- }
8701
+ },
8702
+ allowAfterFinish: true
9055
8703
  }
9056
8704
  );
9057
8705
  if (checkWizardResponse?.data?.url) {
@@ -9317,14 +8965,6 @@ var __publicField = (obj, key, value) => {
9317
8965
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
9318
8966
  return value;
9319
8967
  };
9320
- var ExecutionState = /* @__PURE__ */ ((ExecutionState2) => {
9321
- ExecutionState2[ExecutionState2["RUNNING"] = 0] = "RUNNING";
9322
- ExecutionState2[ExecutionState2["LOADING"] = 1] = "LOADING";
9323
- ExecutionState2[ExecutionState2["FINISHED"] = 2] = "FINISHED";
9324
- ExecutionState2[ExecutionState2["RENDERING"] = 3] = "RENDERING";
9325
- ExecutionState2[ExecutionState2["CONFIRMING"] = 4] = "CONFIRMING";
9326
- return ExecutionState2;
9327
- })(ExecutionState || {});
9328
8968
  const unescapeMarkup = (str) => {
9329
8969
  if (str !== void 0 && str.length > 0) {
9330
8970
  return str.replace(/&apos;/g, "'").replace(/&quot;/g, '"').replace(/&gt;/g, ">").replace(/&lt;/g, "<").replace(/&amp;/g, "&");
@@ -9355,7 +8995,7 @@ class Execution extends EventEmitter$1 {
9355
8995
  });
9356
8996
  __publicField(this, "state", {
9357
8997
  formsReady: [],
9358
- executionState: 1 /* LOADING */,
8998
+ executionState: ExecutionState.LOADING,
9359
8999
  locked: true,
9360
9000
  hasChangedAnything: false
9361
9001
  });
@@ -9468,7 +9108,7 @@ class Execution extends EventEmitter$1 {
9468
9108
  const res = await InitialData.getFormsDefinition(this);
9469
9109
  try {
9470
9110
  for await (const formDefinition of res) {
9471
- if (!parseFakeJSON$1(formDefinition.properties).frmTab) {
9111
+ if (!parseFakeJSON$1(formDefinition.properties).frmTab && !parseFakeJSON$1(formDefinition.properties).frmHidden) {
9472
9112
  this.mustRenderForms.push(
9473
9113
  formDefinition.frmParent + "_" + formDefinition.formName
9474
9114
  );
@@ -9486,17 +9126,12 @@ class Execution extends EventEmitter$1 {
9486
9126
  }
9487
9127
  }
9488
9128
  this.state.formsReady = this.getAllForms();
9489
- this.state.executionState = this.mustRenderForms.length === 0 ? 0 /* RUNNING */ : 3 /* RENDERING */;
9129
+ this.state.executionState = this.mustRenderForms.length === 0 ? ExecutionState.RUNNING : ExecutionState.RENDERING;
9490
9130
  this.state.locked = false;
9491
9131
  this.fireEvents("onLoad");
9492
9132
  } catch (e) {
9493
- console.error(e);
9494
- this.notifications.add(
9495
- new MessageNotification({
9496
- type: "error",
9497
- message: labels.errorLoadForms()
9498
- })
9499
- );
9133
+ this.state.executionState = ExecutionState.FINISHED_WITH_ERROR;
9134
+ throw e;
9500
9135
  }
9501
9136
  }
9502
9137
  getHiddenForms() {
@@ -9509,8 +9144,8 @@ class Execution extends EventEmitter$1 {
9509
9144
  this.mustRenderForms = this.mustRenderForms.filter(
9510
9145
  (c) => c !== frmParent + "_" + frmName
9511
9146
  );
9512
- if (this.mustRenderForms.length - this.getHiddenForms().length === 0) {
9513
- this.state.executionState = 0 /* RUNNING */;
9147
+ if (this.mustRenderForms.length === 0) {
9148
+ this.state.executionState = ExecutionState.RUNNING;
9514
9149
  }
9515
9150
  }
9516
9151
  async delegate() {
@@ -9620,7 +9255,7 @@ class Execution extends EventEmitter$1 {
9620
9255
  }
9621
9256
  );
9622
9257
  if (data?.data?.text) {
9623
- this.state.executionState = 2 /* FINISHED */;
9258
+ this.state.executionState = ExecutionState.FINISHED;
9624
9259
  }
9625
9260
  return data;
9626
9261
  }
@@ -9728,6 +9363,14 @@ class Execution extends EventEmitter$1 {
9728
9363
  if (this._steps)
9729
9364
  return this._steps[step];
9730
9365
  }
9366
+ /**
9367
+ * Ends the current session
9368
+ */
9369
+ kill() {
9370
+ frameElement?.handleDeadSession?.();
9371
+ this.state.executionState = ExecutionState.FINISHED;
9372
+ this.notifications.kill();
9373
+ }
9731
9374
  async viewDocs() {
9732
9375
  const url = `${getWindow(this).CONTEXT}/react/generic/docExecutionModal.jsp?isProcessMonitor=${getWindow(this).IN_MONITOR_PROCESS ?? "false"}&isTaskMonitor=${getWindow(this).IN_MONITOR_TASK ?? "false"}&isTask=true${getWindow(this).TAB_ID_REQUEST}&react=true`;
9733
9376
  const result = await get(this, url);
@@ -9780,12 +9423,5 @@ class Execution extends EventEmitter$1 {
9780
9423
  }
9781
9424
  }
9782
9425
 
9783
- class StatusNotification extends Notification {
9784
- constructor(props) {
9785
- super(props);
9786
- this.props = props;
9787
- }
9788
- }
9789
-
9790
- export { ActionsController, AdditionalCell, ApiaAttribute, ApiaField, ApiaFieldWithAttribute, ApiaForm, ApiaFunctions, BouncingEmitter, Button, ButtonField, Captcha, CaptchaField, CheckField, Checkbox, CustomComponent, GridField as DataGridField, Editor, EditorField, EventEmitter, Execution, ExecutionState, Field$1 as Field, FieldWithAttribute, File, FileUploaderField, FlowModal$1 as FlowModal, Form, FormsUploader, Grid, GridCell, GridField, GridPaginated, HeaderCell, Hidden, HiddenField, IProperty, Image, ImageField, Input, InputField, InvalidSessionException, Label, Link, LinkField, MessageNotification, ModalInput, ModalInputField, Multiple, MultipleField, Notifications, Password, PasswordField, Radio, RadioField, Scheduler, Select, SelectField, ShowConfirmMessage, ShowPathSelection, ShowPoolSelection, ShowSign$1 as ShowSign, ShowSignSelection$1 as ShowSignSelection, StatefulEmitter, StatusNotification, AreaField as TextAreaField, TextField, Textarea, Title, TranslatableField, Translation, Tree, TreeField, UploaderApi, UploaderModalController, createNewField, deepEqual, get, getCurrentDate, getLabel, isHtmlResponse, isJsonResponse, isOneClickUploadEnabled, isXmlResponse, makeApiaUrl, parseFakeJSON$1 as parseFakeJSON, parseFileDefinition, parseSuccessfulResponse, parseXml, post, returnExactlyTheSame, shallowEqual };
9426
+ export { ActionsController, AdditionalCell, ApiaAttribute, ApiaField, ApiaFieldWithAttribute, ApiaForm, ApiaFunctions, BouncingEmitter, Button, ButtonField, Captcha, CaptchaField, CheckField, Checkbox, CustomComponent, GridField as DataGridField, Editor, EditorField, EventEmitter, Execution, ExecutionState, Field$1 as Field, FieldWithAttribute, File, FileUploaderField, FlowModal$1 as FlowModal, Form, FormsUploader, Grid, GridCell, GridField, GridPaginated, HeaderCell, Hidden, HiddenField, IProperty, Image, ImageField, Input, InputField, InvalidSessionException, Label, Link, LinkField, MessageNotification, ModalInput, ModalInputField, Multiple, MultipleField, Notifications, Password, PasswordField, Radio, RadioField, SchedulerField, Select, SelectField, ShowConfirmMessage, ShowPathSelection, ShowPoolSelection, ShowSign$1 as ShowSign, ShowSignSelection$1 as ShowSignSelection, StatefulEmitter, StatusNotification, AreaField as TextAreaField, TextField, Textarea, Title, TranslatableField, Translation, Tree, TreeField, UploaderApi, UploaderModalController, createNewField, deepEqual, get, getLabel, isHtmlResponse, isJsonResponse, isOneClickUploadEnabled, isXmlResponse, makeApiaUrl, parseFakeJSON$1 as parseFakeJSON, parseFileDefinition, parseSuccessfulResponse, parseXml, post, returnExactlyTheSame, shallowEqual };
9791
9427
  //# sourceMappingURL=index.js.map