@apia/execution 4.0.32 → 4.0.33

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
@@ -2244,6 +2244,7 @@ declare class UploaderApi extends EventEmitter$1<{
2244
2244
  markedToSign: boolean;
2245
2245
  } & ResponseSysMessages) | null> | null>;
2246
2246
  editDocument(id: string): Promise<void>;
2247
+ downloadVersion(fileId: string, version?: string): Promise<void>;
2247
2248
  downloadDocument(id: string, version?: string): Promise<void>;
2248
2249
  ajaxDeleteDocument(id: string, langId?: number): Promise<void>;
2249
2250
  version(file: TUploaderFileInfo, conf?: {
@@ -2710,6 +2711,7 @@ declare class FormsUploader extends UploaderApi {
2710
2711
  getProcessDroppedFilesPostdata: ({ useDocTypePermitted, docTypePermittedObjId, docTypePermittedObjType, ...parameters }: Record<string, unknown>) => Record<string, unknown>;
2711
2712
  getReloadMetadataParameters: (defaultParameters: Record<string, unknown>) => Record<string, unknown>;
2712
2713
  getSaveDroppedFilesParameters: (defaultParameters: Record<string, unknown>) => Record<string, unknown>;
2714
+ downloadVersion(fileId: string, version?: string): Promise<void>;
2713
2715
  downloadDocument(fileId: string, version?: string): Promise<void>;
2714
2716
  loadCurrentDocuments(): Promise<void>;
2715
2717
  parseFileDefinition: (file: TFileUploaded) => TUploaderFileInfo;
@@ -3728,6 +3730,7 @@ declare class Radio extends FieldWithAttribute<TApiaRadioProperties, number | st
3728
3730
  declare class Select extends FieldWithAttribute<TApiaSelectProperties, string, TApiaSelectDefinition> {
3729
3731
  constructor({ possibleValue, ...definition }: TApiaSelectDefinition);
3730
3732
  protected getInitialValue({ properties: { possibleValue }, }: TApiaFieldWithAttributeBaseProps<TApiaSelectProperties>): Promise<string>;
3733
+ protected getSynchronizePostConfiguration(value: any): IApiaApiPostConfig<any>;
3731
3734
  }
3732
3735
 
3733
3736
  declare class Textarea extends TranslatableField<TApiaTextareaProperties, string> {
package/dist/index.js CHANGED
@@ -2943,6 +2943,19 @@ class UploaderApi extends EventEmitter$1 {
2943
2943
  }
2944
2944
  }
2945
2945
  }
2946
+ async downloadVersion(fileId, version) {
2947
+ const file = this.getDocument(fileId);
2948
+ if (!file)
2949
+ return;
2950
+ if (getWindow(this.execution).IN_MONITOR || await this.checkWebDavLock(file.docId))
2951
+ await downloadUrl(
2952
+ makeApiaUrl(this.execution, {
2953
+ action: "downloadDocument",
2954
+ docId: file.downloadDocId,
2955
+ version
2956
+ })
2957
+ );
2958
+ }
2946
2959
  async downloadDocument(id, version) {
2947
2960
  const file = this.getDocument(id);
2948
2961
  if (getWindow(this.execution).IN_MONITOR || await this.checkWebDavLock(file.docId)) {
@@ -3758,7 +3771,7 @@ class FormsUploader extends UploaderApi {
3758
3771
  }
3759
3772
  };
3760
3773
  }
3761
- async downloadDocument(fileId, version) {
3774
+ async downloadVersion(fileId, version) {
3762
3775
  const file = this.getDocument(fileId);
3763
3776
  if (!file)
3764
3777
  return;
@@ -3771,6 +3784,22 @@ class FormsUploader extends UploaderApi {
3771
3784
  })
3772
3785
  );
3773
3786
  }
3787
+ async downloadDocument(fileId, version) {
3788
+ const file = this.getDocument(fileId);
3789
+ const { prefix, ...rest } = this.getFormParameters();
3790
+ if (!file)
3791
+ return;
3792
+ if (getWindow(this.execution).IN_MONITOR || await this.checkWebDavLock(file.docId))
3793
+ await downloadUrl(
3794
+ makeApiaUrl(this.execution, {
3795
+ action: "download",
3796
+ docId: file.downloadDocId,
3797
+ ajaxUrl: "/page/generic/downloadAttDoc.jsp",
3798
+ version,
3799
+ ...rest
3800
+ })
3801
+ );
3802
+ }
3774
3803
  loadCurrentDocuments() {
3775
3804
  return null;
3776
3805
  }
@@ -5261,21 +5290,15 @@ class Input extends TranslatableField {
5261
5290
  const inFmt = getDateFormat(options?.format);
5262
5291
  const outFmt = getDateFormat();
5263
5292
  if (typeof newValue === "string") {
5264
- if (newValue.match(/^\d+$/)) {
5265
- const value = new Date(Number.parseInt(newValue));
5266
- const d = dayjs(value);
5267
- return super.setValue(d.isValid() ? d.format(outFmt) : "", options);
5268
- } else {
5269
- const d = dayjs(newValue.trim(), inFmt, true);
5270
- if (!d.isValid() && newValue.trim() !== "") {
5271
- this.state.validation.errorMessage = getLabel(
5272
- this.getForm().execution,
5273
- "msgInvalidDate"
5274
- ).text;
5275
- this.validDate = false;
5276
- }
5277
- return super.setValue(d.isValid() ? d.format(outFmt) : "", options);
5293
+ const d = dayjs(newValue.trim(), inFmt, true);
5294
+ if (!d.isValid() && newValue.trim() !== "") {
5295
+ this.state.validation.errorMessage = getLabel(
5296
+ this.getForm().execution,
5297
+ "msgInvalidDate"
5298
+ ).text;
5299
+ this.validDate = false;
5278
5300
  }
5301
+ return super.setValue(d.isValid() ? d.format(outFmt) : "", options);
5279
5302
  }
5280
5303
  if (newValue instanceof Date) {
5281
5304
  const d = dayjs(newValue);
@@ -5392,10 +5415,14 @@ class Select extends FieldWithAttribute {
5392
5415
  }) {
5393
5416
  return Promise.resolve(
5394
5417
  String(
5395
- possibleValue?.find((c) => c.selected)?.value || possibleValue?.[0]?.value || ""
5418
+ this.state.value !== void 0 ? this.state.value : possibleValue?.find((c) => c.selected)?.value || possibleValue?.[0]?.value || ""
5396
5419
  )
5397
5420
  );
5398
5421
  }
5422
+ getSynchronizePostConfiguration(value) {
5423
+ const conf = super.getSynchronizePostConfiguration(String(value));
5424
+ return conf;
5425
+ }
5399
5426
  }
5400
5427
 
5401
5428
  class Textarea extends TranslatableField {