@apia/api 0.2.2 → 0.3.0
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/LICENSE.md +20 -20
- package/README.md +26 -26
- package/cleanDist.json +3 -0
- package/dist/index.d.ts +29 -2
- package/dist/index.js +187 -116
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
package/LICENSE.md
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) [year] [fullname]
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) [year] [fullname]
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
21
|
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
# Initiator
|
|
2
|
-
|
|
3
|
-
Este package se creó con la única utilidad de copiarlo entero y pegarlo a la hora de crear un nuevo package.
|
|
4
|
-
|
|
5
|
-
Este iniciador permite crear un paquete que compila typescript y puede ser importado desde otros packages.
|
|
6
|
-
|
|
7
|
-
## IMPORTANTE
|
|
8
|
-
|
|
9
|
-
Los archivos **tsconfig.json** y **tsup.config.ts** no son archivos únicos sino symlinks a archivos de configuración comunes a todos los packages. En caso de que sea necesario modificar alguno de ellos **que en la gran mayoría de los casos no sería necesario**, es necesario eliminar el archivo a modificar y crear uno nuevo.
|
|
10
|
-
|
|
11
|
-
## Procedimiento
|
|
12
|
-
|
|
13
|
-
- Copiar la carpeta initiator y pegarla con otro nombre dentro de packages.
|
|
14
|
-
- Modificar el package.json:
|
|
15
|
-
- Eliminar la línea ```private: true```.
|
|
16
|
-
- Cambiar la ocurrencia `initiator` por el nombre del nuevo paquete.
|
|
17
|
-
- Agregar los scripts convenientes: dev, build, etc.
|
|
18
|
-
- Ejecutar el comando lerna bootstrap desde la carpeta raíz.
|
|
19
|
-
|
|
20
|
-
Luego de ejecutar estos pasos, el package estaría listo para comenzar a usarse.
|
|
21
|
-
|
|
22
|
-
Este package trae como dependencias por defecto theme-ui y react. Si se desea agregar más dependencias se debe ejecutar el comando ```lerna add --scope="@apia/packageName" dependencyName```. Ejemplo, si creamos un paquete con el nombre @apia/myPackage y queremos agregar lodash como dependencia, ejecutamos el comando ```lerna add --scope="@apia/myPackage" lodash```.
|
|
23
|
-
|
|
24
|
-
**Importante 1**: Dado que estamos desarrollando packages, es importante determinar si las dependencias que vamos a agregar son de tipo dependency o de tipo peerDependency.
|
|
25
|
-
|
|
26
|
-
**Importante 2**: lerna no permite instalar de a varias dependencias a la vez como lo hace npm, por lo tanto, si se desea agregar varias dependencias se debe ejecutar el comando anterior tantas veces como dependencias se quiera agregar.
|
|
1
|
+
# Initiator
|
|
2
|
+
|
|
3
|
+
Este package se creó con la única utilidad de copiarlo entero y pegarlo a la hora de crear un nuevo package.
|
|
4
|
+
|
|
5
|
+
Este iniciador permite crear un paquete que compila typescript y puede ser importado desde otros packages.
|
|
6
|
+
|
|
7
|
+
## IMPORTANTE
|
|
8
|
+
|
|
9
|
+
Los archivos **tsconfig.json** y **tsup.config.ts** no son archivos únicos sino symlinks a archivos de configuración comunes a todos los packages. En caso de que sea necesario modificar alguno de ellos **que en la gran mayoría de los casos no sería necesario**, es necesario eliminar el archivo a modificar y crear uno nuevo.
|
|
10
|
+
|
|
11
|
+
## Procedimiento
|
|
12
|
+
|
|
13
|
+
- Copiar la carpeta initiator y pegarla con otro nombre dentro de packages.
|
|
14
|
+
- Modificar el package.json:
|
|
15
|
+
- Eliminar la línea ```private: true```.
|
|
16
|
+
- Cambiar la ocurrencia `initiator` por el nombre del nuevo paquete.
|
|
17
|
+
- Agregar los scripts convenientes: dev, build, etc.
|
|
18
|
+
- Ejecutar el comando lerna bootstrap desde la carpeta raíz.
|
|
19
|
+
|
|
20
|
+
Luego de ejecutar estos pasos, el package estaría listo para comenzar a usarse.
|
|
21
|
+
|
|
22
|
+
Este package trae como dependencias por defecto theme-ui y react. Si se desea agregar más dependencias se debe ejecutar el comando ```lerna add --scope="@apia/packageName" dependencyName```. Ejemplo, si creamos un paquete con el nombre @apia/myPackage y queremos agregar lodash como dependencia, ejecutamos el comando ```lerna add --scope="@apia/myPackage" lodash```.
|
|
23
|
+
|
|
24
|
+
**Importante 1**: Dado que estamos desarrollando packages, es importante determinar si las dependencias que vamos a agregar son de tipo dependency o de tipo peerDependency.
|
|
25
|
+
|
|
26
|
+
**Importante 2**: lerna no permite instalar de a varias dependencias a la vez como lo hace npm, por lo tanto, si se desea agregar varias dependencias se debe ejecutar el comando anterior tantas veces como dependencias se quiera agregar.
|
package/cleanDist.json
ADDED
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import React__default from 'react';
|
|
2
3
|
import { AxiosResponse, AxiosRequestConfig } from 'axios';
|
|
3
|
-
import { TModify, TApiaLoad } from '@apia/util';
|
|
4
|
+
import { TModify, TApiaLoad, TApiaFormElement } from '@apia/util';
|
|
4
5
|
import { TNotificationMessage, notify } from '@apia/notifications';
|
|
5
6
|
import { TModal } from '@apia/components';
|
|
6
7
|
import QueryString from 'qs';
|
|
@@ -207,6 +208,17 @@ type TApiaApiMethodHandler = {
|
|
|
207
208
|
setValue: (name: string, value: string) => void;
|
|
208
209
|
};
|
|
209
210
|
type TApiaApiMethod = (handler: TApiaApiMethodHandler, props: TMethod['props']) => Promise<void> | void;
|
|
211
|
+
type TApiaApiField = TApiaApiMethodHandler & {
|
|
212
|
+
element: TModify<TApiaFormElement, {
|
|
213
|
+
onChange: React.ChangeEventHandler;
|
|
214
|
+
}>;
|
|
215
|
+
};
|
|
216
|
+
type TStoredApiaApiMethod = (props?: TMethod['props']) => unknown;
|
|
217
|
+
/**
|
|
218
|
+
* Este método permite cargar en forma asíncrona un método que se encuentre
|
|
219
|
+
* dentro del directorio /api/methods
|
|
220
|
+
*/
|
|
221
|
+
declare function getFunction(name: string, handler: TApiaApiMethodHandler): Promise<TStoredApiaApiMethod | undefined>;
|
|
210
222
|
interface IModalConfig {
|
|
211
223
|
modalTitle?: string;
|
|
212
224
|
onClose?: () => void;
|
|
@@ -225,4 +237,19 @@ interface IApiaApiHandlerState {
|
|
|
225
237
|
}
|
|
226
238
|
declare const ApiaApiHandler: React.MemoExoticComponent<() => React.JSX.Element>;
|
|
227
239
|
|
|
228
|
-
|
|
240
|
+
declare global {
|
|
241
|
+
interface Window {
|
|
242
|
+
SALT: string;
|
|
243
|
+
IV: string;
|
|
244
|
+
PASSPHRASE: string;
|
|
245
|
+
KEY_SIZE: string;
|
|
246
|
+
ITERATION_COUNT: string;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Permite cargar en forma asíncrona un modal que se encuentre dentro del
|
|
251
|
+
* directorio /api/modals
|
|
252
|
+
* */
|
|
253
|
+
declare const getModal: (path: string) => React__default.LazyExoticComponent<React__default.ComponentType<TApiaApiField>>;
|
|
254
|
+
|
|
255
|
+
export { ApiaApi, ApiaApiHandler, IApiaApiRequestConfig, TApiaApiAxiosResponse, TApiaApiMethod, TApiaApiResult, getFunction, getModal, makeApiaUrl };
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import React__default, { createContext } from 'react';
|
|
|
4
4
|
import { Box, getVariant } from '@apia/theme';
|
|
5
5
|
import { debugDispatcher, EventEmitter, parseXmlAsync, arrayOrArray, useMount, encrypt, WithEventsValue, focus, focusSelector, useStateRef, useUnmount } from '@apia/util';
|
|
6
6
|
import { notify, getNotificationMessageObj, dispatchNotifications } from '@apia/notifications';
|
|
7
|
-
import { classToValidate, Checkbox, FileInput, classToValidationFunction, Input, Radio, Select, useFormContext, validationsStore, hasSucceedFormValidation, Form } from '@apia/validations';
|
|
7
|
+
import { classToValidate, Checkbox, FileInput, classToValidationFunction, Input, Radio, Select, Textarea, useFormContext, validationsStore, hasSucceedFormValidation, Form } from '@apia/validations';
|
|
8
8
|
import { SimpleButton, useModal, Modal, ProgressBar } from '@apia/components';
|
|
9
9
|
import axios from 'axios';
|
|
10
10
|
import { merge, uniqueId } from 'lodash';
|
|
@@ -20,21 +20,21 @@ const ApiaApiContext = ({
|
|
|
20
20
|
};
|
|
21
21
|
var ApiaApiContext$1 = React.memo(ApiaApiContext);
|
|
22
22
|
|
|
23
|
-
var __defProp$
|
|
23
|
+
var __defProp$9 = Object.defineProperty;
|
|
24
24
|
var __defProps$4 = Object.defineProperties;
|
|
25
25
|
var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
|
|
26
|
-
var __getOwnPropSymbols$
|
|
27
|
-
var __hasOwnProp$
|
|
28
|
-
var __propIsEnum$
|
|
29
|
-
var __defNormalProp$
|
|
30
|
-
var __spreadValues$
|
|
26
|
+
var __getOwnPropSymbols$9 = Object.getOwnPropertySymbols;
|
|
27
|
+
var __hasOwnProp$9 = Object.prototype.hasOwnProperty;
|
|
28
|
+
var __propIsEnum$9 = Object.prototype.propertyIsEnumerable;
|
|
29
|
+
var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
30
|
+
var __spreadValues$9 = (a, b) => {
|
|
31
31
|
for (var prop in b || (b = {}))
|
|
32
|
-
if (__hasOwnProp$
|
|
33
|
-
__defNormalProp$
|
|
34
|
-
if (__getOwnPropSymbols$
|
|
35
|
-
for (var prop of __getOwnPropSymbols$
|
|
36
|
-
if (__propIsEnum$
|
|
37
|
-
__defNormalProp$
|
|
32
|
+
if (__hasOwnProp$9.call(b, prop))
|
|
33
|
+
__defNormalProp$9(a, prop, b[prop]);
|
|
34
|
+
if (__getOwnPropSymbols$9)
|
|
35
|
+
for (var prop of __getOwnPropSymbols$9(b)) {
|
|
36
|
+
if (__propIsEnum$9.call(b, prop))
|
|
37
|
+
__defNormalProp$9(a, prop, b[prop]);
|
|
38
38
|
}
|
|
39
39
|
return a;
|
|
40
40
|
};
|
|
@@ -42,11 +42,11 @@ var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
|
|
|
42
42
|
var __objRest$1 = (source, exclude) => {
|
|
43
43
|
var target = {};
|
|
44
44
|
for (var prop in source)
|
|
45
|
-
if (__hasOwnProp$
|
|
45
|
+
if (__hasOwnProp$9.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
46
46
|
target[prop] = source[prop];
|
|
47
|
-
if (source != null && __getOwnPropSymbols$
|
|
48
|
-
for (var prop of __getOwnPropSymbols$
|
|
49
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$
|
|
47
|
+
if (source != null && __getOwnPropSymbols$9)
|
|
48
|
+
for (var prop of __getOwnPropSymbols$9(source)) {
|
|
49
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$9.call(source, prop))
|
|
50
50
|
target[prop] = source[prop];
|
|
51
51
|
}
|
|
52
52
|
return target;
|
|
@@ -165,7 +165,7 @@ function handleActions(actions) {
|
|
|
165
165
|
);
|
|
166
166
|
const actionsArray = arrayOrArray(actions.action);
|
|
167
167
|
actionsArray.forEach((action) => {
|
|
168
|
-
ApiaActions.emit("action", __spreadProps$4(__spreadValues$
|
|
168
|
+
ApiaActions.emit("action", __spreadProps$4(__spreadValues$9({}, action), {
|
|
169
169
|
param: arrayOrArray(action.param)
|
|
170
170
|
}));
|
|
171
171
|
});
|
|
@@ -192,7 +192,7 @@ function handleOnClose({
|
|
|
192
192
|
});
|
|
193
193
|
if (notificationsObject)
|
|
194
194
|
notificationsObject.forEach((notification) => {
|
|
195
|
-
notify(__spreadProps$4(__spreadValues$
|
|
195
|
+
notify(__spreadProps$4(__spreadValues$9({}, notification), {
|
|
196
196
|
onClose: func.default
|
|
197
197
|
}));
|
|
198
198
|
});
|
|
@@ -254,7 +254,7 @@ const parseSuccessfulResponse = (_0, _1, ..._2) => __async$2(void 0, [_0, _1, ..
|
|
|
254
254
|
return null;
|
|
255
255
|
}
|
|
256
256
|
if (behaveConfig.validateResponse) {
|
|
257
|
-
const validateResult = yield behaveConfig.validateResponse(__spreadProps$4(__spreadValues$
|
|
257
|
+
const validateResult = yield behaveConfig.validateResponse(__spreadProps$4(__spreadValues$9({}, response), {
|
|
258
258
|
data: (_a = parsedObj == null ? void 0 : parsedObj.load) != null ? _a : parsedObj
|
|
259
259
|
}));
|
|
260
260
|
if (typeof validateResult === "string")
|
|
@@ -331,7 +331,7 @@ const parseSuccessfulResponse = (_0, _1, ..._2) => __async$2(void 0, [_0, _1, ..
|
|
|
331
331
|
);
|
|
332
332
|
if (!handle(load, currentUrl, {
|
|
333
333
|
methodsPath: outerBehaveConfig.methodsPath,
|
|
334
|
-
modalConfiguration: __spreadProps$4(__spreadValues$
|
|
334
|
+
modalConfiguration: __spreadProps$4(__spreadValues$9({}, behaveConfig.modalConfiguration), {
|
|
335
335
|
onClose: () => {
|
|
336
336
|
var _a2, _b2;
|
|
337
337
|
if (onClose)
|
|
@@ -355,9 +355,9 @@ const parseSuccessfulResponse = (_0, _1, ..._2) => __async$2(void 0, [_0, _1, ..
|
|
|
355
355
|
);
|
|
356
356
|
}
|
|
357
357
|
}
|
|
358
|
-
return __spreadProps$4(__spreadValues$
|
|
358
|
+
return __spreadProps$4(__spreadValues$9({}, load), { sysMessages, exceptions, sysExceptions });
|
|
359
359
|
}
|
|
360
|
-
return __spreadProps$4(__spreadValues$
|
|
360
|
+
return __spreadProps$4(__spreadValues$9({}, rest), { sysMessages, exceptions, sysExceptions });
|
|
361
361
|
}
|
|
362
362
|
return null;
|
|
363
363
|
});
|
|
@@ -387,7 +387,7 @@ function handleResponse(_0, _1) {
|
|
|
387
387
|
data: parsedResponse
|
|
388
388
|
}
|
|
389
389
|
);
|
|
390
|
-
return __spreadProps$4(__spreadValues$
|
|
390
|
+
return __spreadProps$4(__spreadValues$9({}, result), {
|
|
391
391
|
data: parsedResponse,
|
|
392
392
|
hasError: !!(parsedResponse == null ? void 0 : parsedResponse.exceptions) || !!(parsedResponse == null ? void 0 : parsedResponse.sysExceptions),
|
|
393
393
|
hasMessages: !!(parsedResponse == null ? void 0 : parsedResponse.sysMessages)
|
|
@@ -404,7 +404,7 @@ function post(par1, par2) {
|
|
|
404
404
|
return __async$2(this, null, function* () {
|
|
405
405
|
const actualUrl = typeof par1 !== "string" ? makeApiaUrl() : par1;
|
|
406
406
|
const configParameter = typeof par1 === "string" ? par2 != null ? par2 : defaultConfig : par1;
|
|
407
|
-
const behaveConfig = __spreadProps$4(__spreadValues$
|
|
407
|
+
const behaveConfig = __spreadProps$4(__spreadValues$9({}, getConfig(configParameter)), {
|
|
408
408
|
postData: configParameter.postDataTreatement === "stringify" ? QueryString.stringify(
|
|
409
409
|
configParameter.postData,
|
|
410
410
|
configParameter.stringifyOptions
|
|
@@ -495,7 +495,7 @@ function makeApiaUrl(props) {
|
|
|
495
495
|
"avoidTabId",
|
|
496
496
|
"tabId"
|
|
497
497
|
]);
|
|
498
|
-
actualQueryData = __spreadValues$
|
|
498
|
+
actualQueryData = __spreadValues$9({}, rest);
|
|
499
499
|
}
|
|
500
500
|
const queryString = QueryString.stringify(
|
|
501
501
|
actualQueryData,
|
|
@@ -532,19 +532,19 @@ function makeApiaUrl(props) {
|
|
|
532
532
|
return `${contextWord ? "/" : ""}${contextWord}/${actualAjaxUrl}?${timestamp}${!(props == null ? void 0 : props.preventAsXmlParameter) ? "asXml=true&" : ""}${(props == null ? void 0 : props.queryString) ? `${props.queryString}&` : ""}${queryString ? `${queryString}&` : ""}${tabId}`;
|
|
533
533
|
}
|
|
534
534
|
|
|
535
|
-
var __defProp$
|
|
536
|
-
var __getOwnPropSymbols$
|
|
537
|
-
var __hasOwnProp$
|
|
538
|
-
var __propIsEnum$
|
|
539
|
-
var __defNormalProp$
|
|
540
|
-
var __spreadValues$
|
|
535
|
+
var __defProp$8 = Object.defineProperty;
|
|
536
|
+
var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
|
|
537
|
+
var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
|
|
538
|
+
var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
|
|
539
|
+
var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
540
|
+
var __spreadValues$8 = (a, b) => {
|
|
541
541
|
for (var prop in b || (b = {}))
|
|
542
|
-
if (__hasOwnProp$
|
|
543
|
-
__defNormalProp$
|
|
544
|
-
if (__getOwnPropSymbols$
|
|
545
|
-
for (var prop of __getOwnPropSymbols$
|
|
546
|
-
if (__propIsEnum$
|
|
547
|
-
__defNormalProp$
|
|
542
|
+
if (__hasOwnProp$8.call(b, prop))
|
|
543
|
+
__defNormalProp$8(a, prop, b[prop]);
|
|
544
|
+
if (__getOwnPropSymbols$8)
|
|
545
|
+
for (var prop of __getOwnPropSymbols$8(b)) {
|
|
546
|
+
if (__propIsEnum$8.call(b, prop))
|
|
547
|
+
__defNormalProp$8(a, prop, b[prop]);
|
|
548
548
|
}
|
|
549
549
|
return a;
|
|
550
550
|
};
|
|
@@ -555,7 +555,7 @@ const ApiaApiCheckbox = (props) => {
|
|
|
555
555
|
[element.class]
|
|
556
556
|
);
|
|
557
557
|
const validationRules = React__default.useMemo(
|
|
558
|
-
() => __spreadValues$
|
|
558
|
+
() => __spreadValues$8({
|
|
559
559
|
required: element.mandatory
|
|
560
560
|
}, classToValidate(element.class)),
|
|
561
561
|
[element.class, element.mandatory]
|
|
@@ -580,19 +580,19 @@ const ApiaApiCheckbox = (props) => {
|
|
|
580
580
|
);
|
|
581
581
|
};
|
|
582
582
|
|
|
583
|
-
var __defProp$
|
|
584
|
-
var __getOwnPropSymbols$
|
|
585
|
-
var __hasOwnProp$
|
|
586
|
-
var __propIsEnum$
|
|
587
|
-
var __defNormalProp$
|
|
588
|
-
var __spreadValues$
|
|
583
|
+
var __defProp$7 = Object.defineProperty;
|
|
584
|
+
var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
|
|
585
|
+
var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
|
|
586
|
+
var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
|
|
587
|
+
var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
588
|
+
var __spreadValues$7 = (a, b) => {
|
|
589
589
|
for (var prop in b || (b = {}))
|
|
590
|
-
if (__hasOwnProp$
|
|
591
|
-
__defNormalProp$
|
|
592
|
-
if (__getOwnPropSymbols$
|
|
593
|
-
for (var prop of __getOwnPropSymbols$
|
|
594
|
-
if (__propIsEnum$
|
|
595
|
-
__defNormalProp$
|
|
590
|
+
if (__hasOwnProp$7.call(b, prop))
|
|
591
|
+
__defNormalProp$7(a, prop, b[prop]);
|
|
592
|
+
if (__getOwnPropSymbols$7)
|
|
593
|
+
for (var prop of __getOwnPropSymbols$7(b)) {
|
|
594
|
+
if (__propIsEnum$7.call(b, prop))
|
|
595
|
+
__defNormalProp$7(a, prop, b[prop]);
|
|
596
596
|
}
|
|
597
597
|
return a;
|
|
598
598
|
};
|
|
@@ -603,7 +603,7 @@ const ApiaApiFileInput = (props) => {
|
|
|
603
603
|
[element.class]
|
|
604
604
|
);
|
|
605
605
|
const validationRules = React__default.useMemo(
|
|
606
|
-
() => __spreadValues$
|
|
606
|
+
() => __spreadValues$7({
|
|
607
607
|
required: element.mandatory
|
|
608
608
|
}, classToValidate(element.class)),
|
|
609
609
|
[element.class, element.mandatory]
|
|
@@ -623,51 +623,51 @@ const ApiaApiFileInput = (props) => {
|
|
|
623
623
|
};
|
|
624
624
|
ApiaApiFileInput.displayName = "ApiaApiFileInput";
|
|
625
625
|
|
|
626
|
-
var __defProp$
|
|
626
|
+
var __defProp$6 = Object.defineProperty;
|
|
627
627
|
var __defProps$3 = Object.defineProperties;
|
|
628
628
|
var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
|
|
629
|
-
var __getOwnPropSymbols$
|
|
630
|
-
var __hasOwnProp$
|
|
631
|
-
var __propIsEnum$
|
|
632
|
-
var __defNormalProp$
|
|
633
|
-
var __spreadValues$
|
|
629
|
+
var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
|
|
630
|
+
var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
|
|
631
|
+
var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
|
|
632
|
+
var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
633
|
+
var __spreadValues$6 = (a, b) => {
|
|
634
634
|
for (var prop in b || (b = {}))
|
|
635
|
-
if (__hasOwnProp$
|
|
636
|
-
__defNormalProp$
|
|
637
|
-
if (__getOwnPropSymbols$
|
|
638
|
-
for (var prop of __getOwnPropSymbols$
|
|
639
|
-
if (__propIsEnum$
|
|
640
|
-
__defNormalProp$
|
|
635
|
+
if (__hasOwnProp$6.call(b, prop))
|
|
636
|
+
__defNormalProp$6(a, prop, b[prop]);
|
|
637
|
+
if (__getOwnPropSymbols$6)
|
|
638
|
+
for (var prop of __getOwnPropSymbols$6(b)) {
|
|
639
|
+
if (__propIsEnum$6.call(b, prop))
|
|
640
|
+
__defNormalProp$6(a, prop, b[prop]);
|
|
641
641
|
}
|
|
642
642
|
return a;
|
|
643
643
|
};
|
|
644
644
|
var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
|
|
645
|
-
const
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
);
|
|
665
|
-
}
|
|
666
|
-
});
|
|
645
|
+
const getModal = (path) => {
|
|
646
|
+
return React__default.lazy(() => {
|
|
647
|
+
return new Promise((resolve) => {
|
|
648
|
+
import(
|
|
649
|
+
/* webpackChunkName: "handlerModal" */
|
|
650
|
+
/* webpackInclude: /\.tsx?$/ */
|
|
651
|
+
`/api/modals/${path}`
|
|
652
|
+
).then((result) => {
|
|
653
|
+
resolve(
|
|
654
|
+
result
|
|
655
|
+
);
|
|
656
|
+
}).catch((error) => {
|
|
657
|
+
resolve({
|
|
658
|
+
default: () => {
|
|
659
|
+
console.error(error);
|
|
660
|
+
throw new Error(
|
|
661
|
+
`The above error ocurred at component ApiaApiHandler/${path}, does it exist?`
|
|
662
|
+
);
|
|
663
|
+
}
|
|
667
664
|
});
|
|
668
665
|
});
|
|
669
666
|
});
|
|
670
|
-
}
|
|
667
|
+
});
|
|
668
|
+
};
|
|
669
|
+
const ApiaApiInput = (props) => {
|
|
670
|
+
const element = React__default.useMemo(() => props.element, [props.element]);
|
|
671
671
|
const [Submodal, setSubmodal] = React__default.useState(null);
|
|
672
672
|
useMount(() => {
|
|
673
673
|
if (element.modalFunction) {
|
|
@@ -683,7 +683,7 @@ const ApiaApiInput = (props) => {
|
|
|
683
683
|
[element.class, element.type]
|
|
684
684
|
);
|
|
685
685
|
const validationRules = React__default.useMemo(
|
|
686
|
-
() => __spreadValues$
|
|
686
|
+
() => __spreadValues$6({
|
|
687
687
|
required: element.mandatory,
|
|
688
688
|
maxLength: element.maxlength ? Number(element.maxlength) : void 0,
|
|
689
689
|
pattern: element.regExp,
|
|
@@ -719,7 +719,7 @@ const ApiaApiInput = (props) => {
|
|
|
719
719
|
);
|
|
720
720
|
if (element.modalFunction) {
|
|
721
721
|
if (Submodal) {
|
|
722
|
-
return /* @__PURE__ */ jsx(React__default.Suspense, { children: /* @__PURE__ */ jsx(Submodal, __spreadProps$3(__spreadValues$
|
|
722
|
+
return /* @__PURE__ */ jsx(React__default.Suspense, { children: /* @__PURE__ */ jsx(Submodal, __spreadProps$3(__spreadValues$6({}, props), { element })) });
|
|
723
723
|
}
|
|
724
724
|
return null;
|
|
725
725
|
}
|
|
@@ -744,19 +744,19 @@ const ApiaApiInput = (props) => {
|
|
|
744
744
|
};
|
|
745
745
|
ApiaApiInput.displayName = "ApiaApiInput";
|
|
746
746
|
|
|
747
|
-
var __defProp$
|
|
748
|
-
var __getOwnPropSymbols$
|
|
749
|
-
var __hasOwnProp$
|
|
750
|
-
var __propIsEnum$
|
|
751
|
-
var __defNormalProp$
|
|
752
|
-
var __spreadValues$
|
|
747
|
+
var __defProp$5 = Object.defineProperty;
|
|
748
|
+
var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
|
|
749
|
+
var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
|
|
750
|
+
var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
|
|
751
|
+
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
752
|
+
var __spreadValues$5 = (a, b) => {
|
|
753
753
|
for (var prop in b || (b = {}))
|
|
754
|
-
if (__hasOwnProp$
|
|
755
|
-
__defNormalProp$
|
|
756
|
-
if (__getOwnPropSymbols$
|
|
757
|
-
for (var prop of __getOwnPropSymbols$
|
|
758
|
-
if (__propIsEnum$
|
|
759
|
-
__defNormalProp$
|
|
754
|
+
if (__hasOwnProp$5.call(b, prop))
|
|
755
|
+
__defNormalProp$5(a, prop, b[prop]);
|
|
756
|
+
if (__getOwnPropSymbols$5)
|
|
757
|
+
for (var prop of __getOwnPropSymbols$5(b)) {
|
|
758
|
+
if (__propIsEnum$5.call(b, prop))
|
|
759
|
+
__defNormalProp$5(a, prop, b[prop]);
|
|
760
760
|
}
|
|
761
761
|
return a;
|
|
762
762
|
};
|
|
@@ -777,7 +777,7 @@ const ApiaApiRadio = (props) => {
|
|
|
777
777
|
[(_a = element.options) == null ? void 0 : _a.option]
|
|
778
778
|
);
|
|
779
779
|
const validationRules = React__default.useMemo(
|
|
780
|
-
() => __spreadValues$
|
|
780
|
+
() => __spreadValues$5({
|
|
781
781
|
required: element.mandatory
|
|
782
782
|
}, classToValidate(element.class)),
|
|
783
783
|
[element.class, element.mandatory]
|
|
@@ -799,19 +799,19 @@ const ApiaApiRadio = (props) => {
|
|
|
799
799
|
};
|
|
800
800
|
ApiaApiRadio.displayName = "ApiaApiRadio";
|
|
801
801
|
|
|
802
|
-
var __defProp$
|
|
803
|
-
var __getOwnPropSymbols$
|
|
804
|
-
var __hasOwnProp$
|
|
805
|
-
var __propIsEnum$
|
|
806
|
-
var __defNormalProp$
|
|
807
|
-
var __spreadValues$
|
|
802
|
+
var __defProp$4 = Object.defineProperty;
|
|
803
|
+
var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
|
|
804
|
+
var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
|
|
805
|
+
var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
|
|
806
|
+
var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
807
|
+
var __spreadValues$4 = (a, b) => {
|
|
808
808
|
for (var prop in b || (b = {}))
|
|
809
|
-
if (__hasOwnProp$
|
|
810
|
-
__defNormalProp$
|
|
811
|
-
if (__getOwnPropSymbols$
|
|
812
|
-
for (var prop of __getOwnPropSymbols$
|
|
813
|
-
if (__propIsEnum$
|
|
814
|
-
__defNormalProp$
|
|
809
|
+
if (__hasOwnProp$4.call(b, prop))
|
|
810
|
+
__defNormalProp$4(a, prop, b[prop]);
|
|
811
|
+
if (__getOwnPropSymbols$4)
|
|
812
|
+
for (var prop of __getOwnPropSymbols$4(b)) {
|
|
813
|
+
if (__propIsEnum$4.call(b, prop))
|
|
814
|
+
__defNormalProp$4(a, prop, b[prop]);
|
|
815
815
|
}
|
|
816
816
|
return a;
|
|
817
817
|
};
|
|
@@ -830,7 +830,7 @@ const ApiaApiSelect = (props) => {
|
|
|
830
830
|
})
|
|
831
831
|
);
|
|
832
832
|
const validationRules = React__default.useMemo(
|
|
833
|
-
() => __spreadValues$
|
|
833
|
+
() => __spreadValues$4({
|
|
834
834
|
required: element.mandatory
|
|
835
835
|
}, classToValidate(element.class)),
|
|
836
836
|
[element.class, element.mandatory]
|
|
@@ -874,6 +874,65 @@ const ApiaApiSelect = (props) => {
|
|
|
874
874
|
};
|
|
875
875
|
ApiaApiSelect.displayName = "ApiaApiSelect";
|
|
876
876
|
|
|
877
|
+
var __defProp$3 = Object.defineProperty;
|
|
878
|
+
var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
|
|
879
|
+
var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
|
|
880
|
+
var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
|
|
881
|
+
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
882
|
+
var __spreadValues$3 = (a, b) => {
|
|
883
|
+
for (var prop in b || (b = {}))
|
|
884
|
+
if (__hasOwnProp$3.call(b, prop))
|
|
885
|
+
__defNormalProp$3(a, prop, b[prop]);
|
|
886
|
+
if (__getOwnPropSymbols$3)
|
|
887
|
+
for (var prop of __getOwnPropSymbols$3(b)) {
|
|
888
|
+
if (__propIsEnum$3.call(b, prop))
|
|
889
|
+
__defNormalProp$3(a, prop, b[prop]);
|
|
890
|
+
}
|
|
891
|
+
return a;
|
|
892
|
+
};
|
|
893
|
+
const ApiaApiTextArea = (props) => {
|
|
894
|
+
const element = React__default.useMemo(() => props.element, [props.element]);
|
|
895
|
+
const className = React__default.useMemo(
|
|
896
|
+
() => element.class ? `handler__textarea ${element.class}` : "handler__textarea",
|
|
897
|
+
[element.class]
|
|
898
|
+
);
|
|
899
|
+
const validationRules = React__default.useMemo(
|
|
900
|
+
() => __spreadValues$3({
|
|
901
|
+
required: element.mandatory,
|
|
902
|
+
maxLength: element.maxlength ? Number(element.maxlength) : void 0,
|
|
903
|
+
pattern: element.regExp,
|
|
904
|
+
patternMessage: element.regExpMessage
|
|
905
|
+
}, classToValidate(element.class)),
|
|
906
|
+
[
|
|
907
|
+
element.class,
|
|
908
|
+
element.mandatory,
|
|
909
|
+
element.maxlength,
|
|
910
|
+
element.regExp,
|
|
911
|
+
element.regExpMessage
|
|
912
|
+
]
|
|
913
|
+
);
|
|
914
|
+
const validationFunction = React__default.useMemo(
|
|
915
|
+
() => classToValidationFunction(element.class),
|
|
916
|
+
[element.class]
|
|
917
|
+
);
|
|
918
|
+
return /* @__PURE__ */ jsx(
|
|
919
|
+
Textarea,
|
|
920
|
+
{
|
|
921
|
+
className,
|
|
922
|
+
name: element.id || element.name,
|
|
923
|
+
label: element.text,
|
|
924
|
+
title: element.title || element.text,
|
|
925
|
+
value: element.value,
|
|
926
|
+
readOnly: element.readonly,
|
|
927
|
+
disabled: element.disabled,
|
|
928
|
+
validationFunction,
|
|
929
|
+
validationRules,
|
|
930
|
+
onChange: element.onChange
|
|
931
|
+
}
|
|
932
|
+
);
|
|
933
|
+
};
|
|
934
|
+
ApiaApiTextArea.displayName = "ApiaApiTextArea";
|
|
935
|
+
|
|
877
936
|
var __defProp$2 = Object.defineProperty;
|
|
878
937
|
var __defProps$2 = Object.defineProperties;
|
|
879
938
|
var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
|
|
@@ -1047,6 +1106,14 @@ const NonMemoizedApiaApiFieldsContainer = (props) => {
|
|
|
1047
1106
|
}),
|
|
1048
1107
|
element.sectionElementId
|
|
1049
1108
|
);
|
|
1109
|
+
case "textarea":
|
|
1110
|
+
return /* @__PURE__ */ jsx(
|
|
1111
|
+
ApiaApiTextArea,
|
|
1112
|
+
__spreadProps$2(__spreadValues$2({}, props), {
|
|
1113
|
+
element
|
|
1114
|
+
}),
|
|
1115
|
+
element.sectionElementId
|
|
1116
|
+
);
|
|
1050
1117
|
case "empty":
|
|
1051
1118
|
return /* @__PURE__ */ jsx(Box, { className: "spacer" }, element.sectionElementId);
|
|
1052
1119
|
default:
|
|
@@ -1232,7 +1299,11 @@ const NonMemoizedApiaApiButtonsContainer = (props) => {
|
|
|
1232
1299
|
modalConfiguration,
|
|
1233
1300
|
methodsPath
|
|
1234
1301
|
}).finally(() => {
|
|
1302
|
+
var _a3;
|
|
1235
1303
|
runButtonMethod();
|
|
1304
|
+
if ((_a3 = props == null ? void 0 : props.definition) == null ? void 0 : _a3.form.closeOnSubmit) {
|
|
1305
|
+
props.close();
|
|
1306
|
+
}
|
|
1236
1307
|
});
|
|
1237
1308
|
} else {
|
|
1238
1309
|
runButtonMethod();
|
|
@@ -1697,4 +1768,4 @@ const ApiaApiHandlerNonMemoized = () => {
|
|
|
1697
1768
|
};
|
|
1698
1769
|
const ApiaApiHandler = React.memo(ApiaApiHandlerNonMemoized);
|
|
1699
1770
|
|
|
1700
|
-
export { ApiaApi, ApiaApiHandler, makeApiaUrl };
|
|
1771
|
+
export { ApiaApi, ApiaApiHandler, getFunction, getModal, makeApiaUrl };
|