@apia/execution 4.0.40 → 4.0.41

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.d.ts CHANGED
@@ -2300,7 +2300,8 @@ declare class UploaderApi extends EventEmitter$1<{
2300
2300
  shouldReset?: boolean;
2301
2301
  }): File[];
2302
2302
  parseFileDefinition: (file: TFileUploaded) => TUploaderFileInfo;
2303
- getLoadFileSystemStructureTree: () => Record<string, unknown>;
2303
+ getLoadFileSystemStructureTree(): Record<string, unknown>;
2304
+ getLoadFilesForFolderParameters(): Record<string, unknown>;
2304
2305
  }
2305
2306
 
2306
2307
  declare class UploaderModalController {
@@ -3396,13 +3397,7 @@ declare class Captcha extends Field<TApiaCaptchaProperties, TApiaCaptchaDefiniti
3396
3397
  type CheckboxEvents = 'onClick';
3397
3398
  declare class Checkbox extends FieldWithAttribute<TApiaCheckboxProperties, boolean> {
3398
3399
  fireEvent(eventName: CheckboxEvents, options?: TFireEventOptions): Promise<boolean>;
3399
- protected getInitialValue({ value, properties, }: TApiaFieldWithAttributeBaseProps<TApiaCheckboxProperties>): Promise<boolean>;
3400
- setValue(newValue: boolean, options?: Partial<{
3401
- comparator: Comparator$1<any>;
3402
- format: 'd/m/Y' | 'apia';
3403
- markAsDirty: boolean;
3404
- synchronize: boolean;
3405
- }> | undefined): Promise<boolean>;
3400
+ protected getInitialValue({ value, }: TApiaFieldWithAttributeBaseProps<TApiaCheckboxProperties>): Promise<boolean>;
3406
3401
  }
3407
3402
 
3408
3403
  type EditorEvents = 'onChange';
package/dist/index.js CHANGED
@@ -10,7 +10,6 @@ import dayjs from 'dayjs';
10
10
  import customParseFormat from 'dayjs/plugin/customParseFormat';
11
11
  import { MobXTree } from '@apia/tree2-controller';
12
12
  import { Scheduler } from '@apia/scheduler-controller';
13
- import { ApiaUtil } from '@apia/components';
14
13
 
15
14
  const deepEqual = (a, b) => {
16
15
  if (Object.is(a, b))
@@ -1769,16 +1768,9 @@ class Checkbox extends FieldWithAttribute {
1769
1768
  return super.fireEvent(eventName, options);
1770
1769
  }
1771
1770
  getInitialValue({
1772
- value,
1773
- properties
1771
+ value
1774
1772
  }) {
1775
- return value === void 0 || value === "" ? properties.checked || value : value;
1776
- }
1777
- setValue(newValue, options) {
1778
- if (newValue !== "") {
1779
- return super.setValue(isTrue(newValue), options);
1780
- }
1781
- return Promise.resolve(false);
1773
+ return value === "" || value === void 0 ? Promise.resolve(false) : value;
1782
1774
  }
1783
1775
  }
1784
1776
 
@@ -2362,11 +2354,6 @@ class UploaderApi extends EventEmitter$1 {
2362
2354
  canRead: file.canRead
2363
2355
  };
2364
2356
  });
2365
- __publicField$i(this, "getLoadFileSystemStructureTree", () => ({
2366
- useDocTypePermitted: true,
2367
- docTypePermittedObjId: this.docTypePermittedObjId,
2368
- docTypePermittedObjType: this.type
2369
- }));
2370
2357
  if (!getWindow(this.execution).fileApi) {
2371
2358
  getWindow(this.execution).fileApi = {};
2372
2359
  }
@@ -2996,7 +2983,7 @@ class UploaderApi extends EventEmitter$1 {
2996
2983
  const checkLock = await this.checkLockDocument(file.docId, true);
2997
2984
  const isLocked = await this.checkWebDavLock(file.docId);
2998
2985
  if (checkLock === true && isLocked) {
2999
- if (!this.modalConfig.oneClickUpload) {
2986
+ if (!this.modalConfig.oneClickUpload && conf.newFiles?.length === 0) {
3000
2987
  this.modalController = new UploaderModalController(
3001
2988
  this,
3002
2989
  this.modalConfig,
@@ -3012,12 +2999,24 @@ class UploaderApi extends EventEmitter$1 {
3012
2999
  this.state.selectedDocTypeId = file.docTypeId;
3013
3000
  await this.versionFileInfo(file);
3014
3001
  if (conf.newFiles && conf.newFiles.length > 0) {
3015
- await this.saveDroppedFiles(conf.newFiles, {
3002
+ const res = await this.saveDroppedFiles(conf.newFiles, {
3016
3003
  langId: conf.langId,
3017
3004
  translatingFile: conf.translatingFile,
3018
3005
  shouldReset: false,
3019
3006
  strictMode: true
3020
3007
  });
3008
+ if (res) {
3009
+ if (!this.modalConfig.oneClickUpload) {
3010
+ this.modalController = new UploaderModalController(
3011
+ this,
3012
+ this.modalConfig,
3013
+ {
3014
+ versionFile: file
3015
+ }
3016
+ );
3017
+ this.modalController.openModal();
3018
+ }
3019
+ }
3021
3020
  } else {
3022
3021
  await this.reloadMetadata({
3023
3022
  docId: file.docId,
@@ -3496,7 +3495,7 @@ class UploaderApi extends EventEmitter$1 {
3496
3495
  if (conf?.langId)
3497
3496
  return files;
3498
3497
  const currentFiles = this.state.inProgressFiles;
3499
- const alreadyUploadedFiles = this.filesArray.filter(
3498
+ const alreadyUploadedFiles = Object.values(this.state.files).filter(
3500
3499
  (current) => Number(current.docId) < 0
3501
3500
  );
3502
3501
  let alreadyIncludedFileNames = "";
@@ -3540,6 +3539,20 @@ class UploaderApi extends EventEmitter$1 {
3540
3539
  }
3541
3540
  return files;
3542
3541
  }
3542
+ getLoadFileSystemStructureTree() {
3543
+ return {
3544
+ useDocTypePermitted: true,
3545
+ docTypePermittedObjId: this.docTypePermittedObjId,
3546
+ docTypePermittedObjType: this.type
3547
+ };
3548
+ }
3549
+ getLoadFilesForFolderParameters() {
3550
+ return {
3551
+ useDocTypePermitted: true,
3552
+ docTypePermittedObjId: this.docTypePermittedObjId,
3553
+ docTypePermittedObjType: this.type
3554
+ };
3555
+ }
3543
3556
  }
3544
3557
 
3545
3558
  var __defProp$h = Object.defineProperty;
@@ -5027,12 +5040,15 @@ class Grid extends Field {
5027
5040
  if (field instanceof File) {
5028
5041
  field.loadFromDefinition(state.file_prp);
5029
5042
  } else if (field instanceof ModalInput) {
5030
- field.setValue({
5031
- showValue: state.qry_show_value || "",
5032
- storeValue: state.value || ""
5033
- });
5043
+ field.setValue(
5044
+ {
5045
+ showValue: state.qry_show_value || "",
5046
+ storeValue: state.value || ""
5047
+ },
5048
+ { force: true }
5049
+ );
5034
5050
  } else if (field instanceof FieldWithAttribute) {
5035
- field.setValue(state.value, { synchronize: false });
5051
+ field.setValue(state.value, { synchronize: false, force: true });
5036
5052
  }
5037
5053
  }
5038
5054
  });
@@ -5413,7 +5429,7 @@ class Radio extends FieldWithAttribute {
5413
5429
  return super.fireEvent(eventName, options);
5414
5430
  }
5415
5431
  getTextValue(value) {
5416
- return this.state.properties.possibleValue ? arrayOrArray(this.state.properties.possibleValue).find(
5432
+ return this.properties.possibleValue ? arrayOrArray(this.properties.possibleValue).find(
5417
5433
  (c) => c.value === value
5418
5434
  )?.label : value;
5419
5435
  }
@@ -5443,7 +5459,7 @@ class Select extends FieldWithAttribute {
5443
5459
  return conf;
5444
5460
  }
5445
5461
  getTextValue(value) {
5446
- return this.state.properties.possibleValue ? arrayOrArray(this.state.properties.possibleValue).find(
5462
+ return this.properties.possibleValue ? arrayOrArray(this.properties.possibleValue).find(
5447
5463
  (c) => c.value === value
5448
5464
  )?.label : value;
5449
5465
  }
@@ -9013,7 +9029,7 @@ async function defaultConfirm(execution, status) {
9013
9029
  }
9014
9030
  const url = arrayOrArray(confirmResponse.data.actions?.action.param)[1];
9015
9031
  if (url === "callNavigateClose") {
9016
- ApiaUtil.instance.tabs.currentTab.close(true);
9032
+ (getWindow(execution)?.top?.ApiaUtil).tabs.currentTab.close(true);
9017
9033
  } else {
9018
9034
  const c = new Url(url);
9019
9035
  getWindow(execution).location.assign(