@apia/execution 4.0.46 → 4.0.50
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 +10 -2
- package/dist/index.js +86 -10
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
package/dist/index.d.ts
CHANGED
|
@@ -308,6 +308,7 @@ type TApiaGridProperties = TApiaFieldCommonProperties & {
|
|
|
308
308
|
type TApiaHiddenProperties = TApiaFieldCommonProperties & TApiaGroupableFieldProperties & TApiaFieldWithAttributeProperties & {};
|
|
309
309
|
type TApiaImageProperties = TApiaFieldCommonProperties & TApiaGroupableFieldProperties & {
|
|
310
310
|
imageUrl?: string;
|
|
311
|
+
url?: string;
|
|
311
312
|
};
|
|
312
313
|
type TApiaInputProperties = TApiaFieldCommonProperties & TApiaTranslatableFieldProperties & TApiaGroupableFieldProperties & TApiaFieldWithAttributeProperties & TApiaFieldSizableFieldProperties & {
|
|
313
314
|
regExpMessage?: string;
|
|
@@ -762,6 +763,7 @@ declare const FormConstants: Readonly<{
|
|
|
762
763
|
PROPERTY_FORM_TAB: "frmTab";
|
|
763
764
|
PROPERTY_FORM_DONT_FIRE: "frmDontFire";
|
|
764
765
|
PROPERTY_FORM_READONLY: "readOnly";
|
|
766
|
+
PROPERTY_FORM_INVISIBLE: "frmInvisible";
|
|
765
767
|
}>;
|
|
766
768
|
|
|
767
769
|
interface IIProperty {
|
|
@@ -1105,6 +1107,7 @@ declare class SelectField extends ApiaFieldWithAttribute<string | number | (stri
|
|
|
1105
1107
|
#private;
|
|
1106
1108
|
constructor(execution: Execution, field: Select);
|
|
1107
1109
|
getOptions(asObject: boolean): TOptionsMap$2 | TOptionsAsArray | null;
|
|
1110
|
+
getTextValue(value: string): any;
|
|
1108
1111
|
addOption(optionValue: string | number, showValue: string, allowRepeatedValue: boolean): void;
|
|
1109
1112
|
setOptions(optionsArray: PossibleValue[]): void;
|
|
1110
1113
|
removeOption(optionValue: string | number): void;
|
|
@@ -1137,6 +1140,7 @@ declare class RadioField extends ApiaFieldWithAttribute {
|
|
|
1137
1140
|
constructor(execution: Execution, field: Radio);
|
|
1138
1141
|
getOptions(asObject: boolean): TOptionsMap$1 | PossibleValue[] | null;
|
|
1139
1142
|
clearOptions(): void | null;
|
|
1143
|
+
getTextValue(value: string): any;
|
|
1140
1144
|
addOption(radioValue: string | number, showValue: string, allowRepeatedValue: boolean): void;
|
|
1141
1145
|
setOptions(options: PossibleValue[]): void;
|
|
1142
1146
|
removeOption(radioValue: string | number): void;
|
|
@@ -1911,7 +1915,7 @@ declare class Form extends WithProperties<TApiaFormProperties> {
|
|
|
1911
1915
|
definition: Omit<TApiaFieldBaseDefinition<Record<string, any>>, "properties">;
|
|
1912
1916
|
}>[];
|
|
1913
1917
|
get customComponents(): Map<string, CustomComponent>;
|
|
1914
|
-
|
|
1918
|
+
toggleFormCollapse(): Promise<void>;
|
|
1915
1919
|
openForm(): void;
|
|
1916
1920
|
getField(field: string, index?: number): Field<TApiaFieldCommonProperties, TApiaFieldBaseDefinition<TApiaFieldCommonProperties>, {
|
|
1917
1921
|
definition: Omit<TApiaFieldBaseDefinition<TApiaFieldCommonProperties>, "properties">;
|
|
@@ -2697,6 +2701,7 @@ declare class Execution extends EventEmitter$1<{
|
|
|
2697
2701
|
private observations;
|
|
2698
2702
|
private executedOnLoadEvents;
|
|
2699
2703
|
executionConfig: TExecutionConfig | null;
|
|
2704
|
+
lastFieldFocusedId: string | null;
|
|
2700
2705
|
private _steps;
|
|
2701
2706
|
private _currentStep;
|
|
2702
2707
|
private _stepCount;
|
|
@@ -3396,6 +3401,7 @@ declare const IProperty: {
|
|
|
3396
3401
|
readonly PROPERTY_FORM_TAB: "frmTab";
|
|
3397
3402
|
readonly PROPERTY_FORM_DONT_FIRE: "frmDontFire";
|
|
3398
3403
|
readonly PROPERTY_FORM_READONLY: "readOnly";
|
|
3404
|
+
readonly PROPERTY_FORM_INVISIBLE: "frmInvisible";
|
|
3399
3405
|
readonly TYPE_INPUT: "input";
|
|
3400
3406
|
readonly TYPE_SELECT: "select";
|
|
3401
3407
|
readonly TYPE_RADIO: "radio";
|
|
@@ -3678,5 +3684,7 @@ declare function getLabel(execution: Execution, label: string, replacers?: Parti
|
|
|
3678
3684
|
|
|
3679
3685
|
declare function parseFakeJSON<T extends Record<string, unknown>>(str: string): T;
|
|
3680
3686
|
|
|
3681
|
-
|
|
3687
|
+
declare function getFocusIdentifier(field: Field): string;
|
|
3688
|
+
|
|
3689
|
+
export { ActionsController, AdditionalCell, ApiaAttribute, ApiaField, ApiaFieldWithAttribute, ApiaForm, ApiaFunctions, BouncingEmitter, Button, ButtonField, Captcha, CaptchaField, CheckField, Checkbox, type ComponentEvent, CustomComponent, GridField as DataGridField, Editor, EditorField, EventEmitter, Execution, ExecutionState, Field, FieldWithAttribute, type FieldWithAttributeState, type FieldsMapping, File$1 as File, FileUploaderField, FlowModal, Form, FormsUploader, Grid, GridCell, GridField, GridPaginated, HeaderCell, Hidden, HiddenField, type IApiaField, type IApiaForm, type IApiaFunctions, type IIProperty, IProperty, type ISignatureData, Image, ImageField, Input, InputField, InvalidSessionException, Label, Link, LinkField, MessageNotification, ModalInput, ModalInputField, Multiple, MultipleField, Notifications, Password, PasswordField, type PossibleValue, Radio, RadioField, type RadioPossibleValue, SchedulerField, Select, SelectField, type SelectPossibleValue, ShowConfirmMessage, ShowPathSelection, ShowPoolSelection, ShowSign, ShowSignSelection, StatefulEmitter, type Status, StatusNotification, type TApiaButtonProperties, type TApiaCaptchaProperties, type TApiaCheckboxProperties, type TApiaEditorProperties, type TApiaFieldBaseDefinition, type TApiaFieldCommonProperties, type TApiaFieldDefinition, type TApiaFieldPossibleValue, type TApiaFieldSizableFieldProperties, type TApiaFieldType, type TApiaFieldValueType, type TApiaFieldWithAttributeBaseProps, type TApiaFieldWithAttributeProperties, type TApiaFileProperties, type TApiaForm, type TApiaFormProperties, type TApiaGridProperties, type TApiaGroupableFieldProperties, type TApiaHiddenProperties, type TApiaImageProperties, type TApiaInputProperties, type TApiaLabelProperties, type TApiaLinkProperties, type TApiaMultipleProperties, type TApiaPasswordProperties, type TApiaRadioProperties, type TApiaSchedulerProperties, type TApiaSelectProperties, type TApiaTextareaProperties, type TApiaTitleProperties, type TApiaTranslatableFieldProperties, type TApiaTreePossibleValue, type TApiaTreeProperties, type TApiaValuatedFieldProperties, type TCheckWizardResponse, type TCusCmpStateRequest, type TCustomComponentDefaultResponse, type TCustomComponentDefinition, type TExecutionConfig, type TFetchConfirmPathResponse, type TFieldEvent, type TFieldScriptEvent, type TFieldScriptEventParameters, type TFieldScriptEvents, type TFieldServerEvent, type TFieldServerEvents, type TFormEventName, type TFormScriptEvent, type TFormScriptEventParameters, type TFormScriptEvents, type TFrmParent, type TItemTreeObj, type TObservation, type TObservations, type TPathType, type TSignaturesData, AreaField as TextAreaField, TextField, Textarea, Title, TranslatableField, Translation, Tree, TreeField, UploaderApi, createNewField, deepEqual, get, getFocusIdentifier, getLabel, isHtmlResponse, isJsonResponse, isXmlResponse, makeApiaUrl, parseFakeJSON, parseSuccessfulResponse, parseXml, post, shallowEqual };
|
|
3682
3690
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1172,7 +1172,7 @@ const setAjaxFormResponse = async (execution, response) => {
|
|
|
1172
1172
|
apiaForm.setProperty(IProperty$1.PROPERTY_FORM_HIDDEN, false);
|
|
1173
1173
|
}
|
|
1174
1174
|
if (form.c === "t" && String(apiaForm.getProperty(IProperty$1.PROPERTY_FORM_CLOSED)) !== "true") {
|
|
1175
|
-
apiaForm.
|
|
1175
|
+
apiaForm.toggleFormCollapse();
|
|
1176
1176
|
} else if (form.c === "f" && String(apiaForm.getProperty(IProperty$1.PROPERTY_FORM_CLOSED)) === "true") {
|
|
1177
1177
|
apiaForm.openForm();
|
|
1178
1178
|
}
|
|
@@ -1193,6 +1193,11 @@ const asyncCreateNewField = async (execution, fld) => {
|
|
|
1193
1193
|
return creator(execution, fld);
|
|
1194
1194
|
};
|
|
1195
1195
|
|
|
1196
|
+
function getFocusIdentifier(field) {
|
|
1197
|
+
const name = field.properties.name || field.attribute?.name || field.definition.id;
|
|
1198
|
+
return `${field.getForm().definition.frmParent}_${field.getForm().definition.formName}_${name}${field.definition.index ? `_${field.definition.index}` : ""}`;
|
|
1199
|
+
}
|
|
1200
|
+
|
|
1196
1201
|
var __defProp$n = Object.defineProperty;
|
|
1197
1202
|
var __defNormalProp$n = (obj, key, value) => key in obj ? __defProp$n(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1198
1203
|
var __publicField$n = (obj, key, value) => {
|
|
@@ -1395,6 +1400,9 @@ class Field extends WithProperties {
|
|
|
1395
1400
|
}
|
|
1396
1401
|
if (event) {
|
|
1397
1402
|
const isAjax = event.isAjax;
|
|
1403
|
+
this.getForm().execution.lastFieldFocusedId = getFocusIdentifier(
|
|
1404
|
+
this
|
|
1405
|
+
);
|
|
1398
1406
|
if (isAjax) {
|
|
1399
1407
|
return this.fireAjaxServerEvent(event, params);
|
|
1400
1408
|
} else {
|
|
@@ -3973,8 +3981,36 @@ class Input extends TranslatableField {
|
|
|
3973
3981
|
const inFmt = getDateFormat(options?.format);
|
|
3974
3982
|
const outFmt = getDateFormat();
|
|
3975
3983
|
if (typeof newValue === "string") {
|
|
3976
|
-
const
|
|
3977
|
-
if (
|
|
3984
|
+
const trimmed = newValue.trim();
|
|
3985
|
+
if (/^\d+$/.test(trimmed)) {
|
|
3986
|
+
const digits = trimmed.length;
|
|
3987
|
+
let ms = Number(trimmed);
|
|
3988
|
+
if (digits === 10) {
|
|
3989
|
+
ms = ms * 1e3;
|
|
3990
|
+
}
|
|
3991
|
+
const d2 = dayjs(ms);
|
|
3992
|
+
if (!d2.isValid() && trimmed !== "") {
|
|
3993
|
+
this.state.validation.errorMessage = getLabel(
|
|
3994
|
+
this.getForm().execution,
|
|
3995
|
+
"msgInvalidDate"
|
|
3996
|
+
).text;
|
|
3997
|
+
this.validDate = false;
|
|
3998
|
+
}
|
|
3999
|
+
return super.setValue(d2.isValid() ? d2.format(outFmt) : "", options);
|
|
4000
|
+
}
|
|
4001
|
+
const d = dayjs(trimmed, inFmt, true);
|
|
4002
|
+
if (!d.isValid() && trimmed !== "") {
|
|
4003
|
+
this.state.validation.errorMessage = getLabel(
|
|
4004
|
+
this.getForm().execution,
|
|
4005
|
+
"msgInvalidDate"
|
|
4006
|
+
).text;
|
|
4007
|
+
this.validDate = false;
|
|
4008
|
+
}
|
|
4009
|
+
return super.setValue(d.isValid() ? d.format(outFmt) : "", options);
|
|
4010
|
+
}
|
|
4011
|
+
if (typeof newValue === "number") {
|
|
4012
|
+
const d = dayjs(newValue);
|
|
4013
|
+
if (!d.isValid()) {
|
|
3978
4014
|
this.state.validation.errorMessage = getLabel(
|
|
3979
4015
|
this.getForm().execution,
|
|
3980
4016
|
"msgInvalidDate"
|
|
@@ -4518,7 +4554,8 @@ const FormConstants = Object.freeze({
|
|
|
4518
4554
|
PROPERTY_FORM_CLOSED: "prpFrmClosed",
|
|
4519
4555
|
PROPERTY_FORM_TAB: "frmTab",
|
|
4520
4556
|
PROPERTY_FORM_DONT_FIRE: "frmDontFire",
|
|
4521
|
-
PROPERTY_FORM_READONLY: "readOnly"
|
|
4557
|
+
PROPERTY_FORM_READONLY: "readOnly",
|
|
4558
|
+
PROPERTY_FORM_INVISIBLE: "frmInvisible"
|
|
4522
4559
|
});
|
|
4523
4560
|
|
|
4524
4561
|
const IProperty = {
|
|
@@ -4767,7 +4804,7 @@ var __accessCheck$f = (obj, member, msg) => {
|
|
|
4767
4804
|
};
|
|
4768
4805
|
var __privateGet$f = (obj, member, getter) => {
|
|
4769
4806
|
__accessCheck$f(obj, member, "read from private field");
|
|
4770
|
-
return member.get(obj);
|
|
4807
|
+
return getter ? getter.call(obj) : member.get(obj);
|
|
4771
4808
|
};
|
|
4772
4809
|
var __privateAdd$f = (obj, member, value) => {
|
|
4773
4810
|
if (member.has(obj))
|
|
@@ -4799,6 +4836,9 @@ class SelectField extends ApiaFieldWithAttribute {
|
|
|
4799
4836
|
}
|
|
4800
4837
|
return null;
|
|
4801
4838
|
}
|
|
4839
|
+
getTextValue(value) {
|
|
4840
|
+
return __privateGet$f(this, _field$b).getTextValue(value);
|
|
4841
|
+
}
|
|
4802
4842
|
// adds a option to the select field
|
|
4803
4843
|
addOption(optionValue, showValue, allowRepeatedValue) {
|
|
4804
4844
|
let isValueRepeated = false;
|
|
@@ -4960,7 +5000,7 @@ var __accessCheck$c = (obj, member, msg) => {
|
|
|
4960
5000
|
};
|
|
4961
5001
|
var __privateGet$c = (obj, member, getter) => {
|
|
4962
5002
|
__accessCheck$c(obj, member, "read from private field");
|
|
4963
|
-
return member.get(obj);
|
|
5003
|
+
return getter ? getter.call(obj) : member.get(obj);
|
|
4964
5004
|
};
|
|
4965
5005
|
var __privateAdd$c = (obj, member, value) => {
|
|
4966
5006
|
if (member.has(obj))
|
|
@@ -4996,6 +5036,9 @@ class RadioField extends ApiaFieldWithAttribute {
|
|
|
4996
5036
|
__privateGet$c(this, _field$8).properties.possibleValue = [];
|
|
4997
5037
|
}
|
|
4998
5038
|
}
|
|
5039
|
+
getTextValue(value) {
|
|
5040
|
+
return __privateGet$c(this, _field$8).getTextValue(value);
|
|
5041
|
+
}
|
|
4999
5042
|
addOption(radioValue, showValue, allowRepeatedValue) {
|
|
5000
5043
|
if (__privateGet$c(this, _field$8).definition.id) {
|
|
5001
5044
|
const radioValues = arrayOrArray(__privateGet$c(this, _field$8).properties.possibleValue);
|
|
@@ -6440,8 +6483,19 @@ class Form extends WithProperties {
|
|
|
6440
6483
|
get customComponents() {
|
|
6441
6484
|
return this._customComponents;
|
|
6442
6485
|
}
|
|
6443
|
-
|
|
6444
|
-
this.properties.prpFrmClosed =
|
|
6486
|
+
async toggleFormCollapse() {
|
|
6487
|
+
this.properties.prpFrmClosed = !this.properties.prpFrmClosed;
|
|
6488
|
+
void post(
|
|
6489
|
+
this.execution,
|
|
6490
|
+
makeApiaUrl(this.execution, {
|
|
6491
|
+
ajaxUrl: "apia.execution.FormAction.run?",
|
|
6492
|
+
action: "closeForm",
|
|
6493
|
+
frmId: this.definition.id,
|
|
6494
|
+
frmParent: this.definition.frmParent,
|
|
6495
|
+
collapse: this.properties.prpFrmClosed,
|
|
6496
|
+
react: true
|
|
6497
|
+
})
|
|
6498
|
+
);
|
|
6445
6499
|
}
|
|
6446
6500
|
openForm() {
|
|
6447
6501
|
this.properties.prpFrmClosed = false;
|
|
@@ -7846,6 +7900,27 @@ var __publicField = (obj, key, value) => {
|
|
|
7846
7900
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
7847
7901
|
return value;
|
|
7848
7902
|
};
|
|
7903
|
+
function parseNotificationType(str) {
|
|
7904
|
+
let type = "warning";
|
|
7905
|
+
switch (str) {
|
|
7906
|
+
case "1":
|
|
7907
|
+
type = "success";
|
|
7908
|
+
break;
|
|
7909
|
+
case "2":
|
|
7910
|
+
type = "warning";
|
|
7911
|
+
break;
|
|
7912
|
+
case "3":
|
|
7913
|
+
type = "error";
|
|
7914
|
+
break;
|
|
7915
|
+
case "4":
|
|
7916
|
+
type = "modal";
|
|
7917
|
+
break;
|
|
7918
|
+
case "5":
|
|
7919
|
+
type = "info";
|
|
7920
|
+
break;
|
|
7921
|
+
}
|
|
7922
|
+
return type;
|
|
7923
|
+
}
|
|
7849
7924
|
const unescapeMarkup = (str) => {
|
|
7850
7925
|
if (str !== void 0 && str.length > 0) {
|
|
7851
7926
|
return str.replace(/'/g, "'").replace(/"/g, '"').replace(/>/g, ">").replace(/</g, "<").replace(/&/g, "&");
|
|
@@ -7863,6 +7938,7 @@ class Execution extends EventEmitter$1 {
|
|
|
7863
7938
|
__publicField(this, "observations");
|
|
7864
7939
|
__publicField(this, "executedOnLoadEvents", false);
|
|
7865
7940
|
__publicField(this, "executionConfig", null);
|
|
7941
|
+
__publicField(this, "lastFieldFocusedId", null);
|
|
7866
7942
|
__publicField(this, "_steps", []);
|
|
7867
7943
|
__publicField(this, "_currentStep", 1);
|
|
7868
7944
|
__publicField(this, "_stepCount", 1);
|
|
@@ -8006,7 +8082,7 @@ class Execution extends EventEmitter$1 {
|
|
|
8006
8082
|
(c) => this.notifications.add(
|
|
8007
8083
|
new MessageNotification({
|
|
8008
8084
|
message: c.text,
|
|
8009
|
-
type:
|
|
8085
|
+
type: parseNotificationType(c.type)
|
|
8010
8086
|
})
|
|
8011
8087
|
)
|
|
8012
8088
|
);
|
|
@@ -8398,5 +8474,5 @@ class Execution extends EventEmitter$1 {
|
|
|
8398
8474
|
}
|
|
8399
8475
|
}
|
|
8400
8476
|
|
|
8401
|
-
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, 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, createNewField, deepEqual, get, getLabel, isHtmlResponse, isJsonResponse, isXmlResponse, makeApiaUrl, parseFakeJSON$1 as parseFakeJSON, parseSuccessfulResponse, parseXml, post, shallowEqual };
|
|
8477
|
+
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, 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, createNewField, deepEqual, get, getFocusIdentifier, getLabel, isHtmlResponse, isJsonResponse, isXmlResponse, makeApiaUrl, parseFakeJSON$1 as parseFakeJSON, parseSuccessfulResponse, parseXml, post, shallowEqual };
|
|
8402
8478
|
//# sourceMappingURL=index.js.map
|