@apia/api 4.0.44 → 4.0.45
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 +22 -55
- package/dist/index.js +9 -30
- package/dist/index.js.map +1 -1
- package/package.json +9 -9
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import react__default from 'react';
|
|
3
3
|
import { AxiosResponse, AxiosRequestConfig } from 'axios';
|
|
4
4
|
import * as _apia_util from '@apia/util';
|
|
5
|
-
import { TModify,
|
|
6
|
-
import { notify } from '@apia/notifications';
|
|
5
|
+
import { TModify, TApiaLoad, TApiaFormElement, TApiaFilterOption, TApiaFilter, Mutex, TApiaFunction, TApiaFunctionPageInfo, EventEmitter, UnSubscriber } from '@apia/util';
|
|
6
|
+
import { TNotificationMessage, notify } from '@apia/notifications';
|
|
7
7
|
import { TModal, TOpenModal, ApiaUtilModalHandler } from '@apia/components';
|
|
8
8
|
import QueryString from 'qs';
|
|
9
9
|
import { TResponsiveTableColumn, TResponsiveTableContextProps, TResponsiveTableRowsSelectionEvent, TResponsiveTableSortChangeEvent, TResponsiveTableRow } from '@apia/table';
|
|
@@ -15,13 +15,13 @@ declare function isXmlResponse(response: AxiosResponse<unknown>): RegExpMatchArr
|
|
|
15
15
|
declare function isHtmlResponse(response: AxiosResponse<unknown>): RegExpMatchArray | null;
|
|
16
16
|
declare const parseSuccessfulResponse: <LoadType extends Record<string, unknown>>(response: AxiosResponse<string>, currentUrl: string, outerBehaveConfig?: IApiaApiRequestConfig<LoadType>) => Promise<(LoadType & {
|
|
17
17
|
sysMessages: {
|
|
18
|
-
message: TApiaMessage | TApiaMessage[];
|
|
18
|
+
message: _apia_util.TApiaMessage | _apia_util.TApiaMessage[];
|
|
19
19
|
} | undefined;
|
|
20
20
|
exceptions: {
|
|
21
|
-
exception: TApiaMessage | TApiaMessage[];
|
|
21
|
+
exception: _apia_util.TApiaMessage | _apia_util.TApiaMessage[];
|
|
22
22
|
} | undefined;
|
|
23
23
|
sysExceptions: {
|
|
24
|
-
exception: TApiaMessage | TApiaMessage[];
|
|
24
|
+
exception: _apia_util.TApiaMessage | _apia_util.TApiaMessage[];
|
|
25
25
|
} | undefined;
|
|
26
26
|
}) | null>;
|
|
27
27
|
type TApiaApiAxiosResponse<LoadType> = AxiosResponse<LoadType | null> & {
|
|
@@ -205,36 +205,6 @@ interface IApiaApiRequestConfig<DataType> extends IApiaApiConsoleConfig {
|
|
|
205
205
|
stringifyOptions?: QueryString.IStringifyOptions;
|
|
206
206
|
validateResponse?: (response: AxiosResponse<DataType | null>) => Promise<boolean | string> | boolean | string;
|
|
207
207
|
}
|
|
208
|
-
interface TApiaMessage {
|
|
209
|
-
text: string;
|
|
210
|
-
label?: string;
|
|
211
|
-
}
|
|
212
|
-
type TApiaLoad<T extends Record<string, unknown> = TApiaLoadForm> = {
|
|
213
|
-
canClose: boolean;
|
|
214
|
-
type: string;
|
|
215
|
-
} & T;
|
|
216
|
-
interface TMessage {
|
|
217
|
-
text: string;
|
|
218
|
-
content?: string;
|
|
219
|
-
title?: string;
|
|
220
|
-
type?: string;
|
|
221
|
-
}
|
|
222
|
-
interface TNotificationMessage {
|
|
223
|
-
onClose?: string;
|
|
224
|
-
sysMessages?: {
|
|
225
|
-
message: TMessage | TMessage[];
|
|
226
|
-
};
|
|
227
|
-
sysExceptions?: {
|
|
228
|
-
exception: TMessage | TMessage[];
|
|
229
|
-
};
|
|
230
|
-
exceptions?: {
|
|
231
|
-
exception: TMessage | TMessage[];
|
|
232
|
-
};
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
type TApiaApiSectionElement = TApiaFormElement & {
|
|
236
|
-
sectionElementId: string;
|
|
237
|
-
};
|
|
238
208
|
|
|
239
209
|
type TMethod = {
|
|
240
210
|
name: string;
|
|
@@ -248,7 +218,6 @@ type TMethod = {
|
|
|
248
218
|
};
|
|
249
219
|
type TApiaApiMethodHandler = {
|
|
250
220
|
alert: typeof notify;
|
|
251
|
-
assignForm: (newForm: TApiaLoad) => unknown;
|
|
252
221
|
close: () => void;
|
|
253
222
|
configuration?: THandleConfiguration;
|
|
254
223
|
formDefinition: TApiaLoad;
|
|
@@ -256,14 +225,14 @@ type TApiaApiMethodHandler = {
|
|
|
256
225
|
reset: () => void;
|
|
257
226
|
setError: typeof notify;
|
|
258
227
|
setMessage: (message: Record<string, unknown>) => unknown;
|
|
259
|
-
setState:
|
|
228
|
+
setState: react.Dispatch<react.SetStateAction<IApiaApiHandlerState>>;
|
|
260
229
|
state: IApiaApiHandlerState;
|
|
261
230
|
setValue: (name: string, value: string) => void;
|
|
262
231
|
};
|
|
263
232
|
type TApiaApiMethod = (handler: TApiaApiMethodHandler, props: TMethod['props']) => Promise<void> | void;
|
|
264
233
|
type TApiaApiField = TApiaApiMethodHandler & {
|
|
265
234
|
element: TModify<TApiaFormElement, {
|
|
266
|
-
onChange:
|
|
235
|
+
onChange: react.ChangeEventHandler;
|
|
267
236
|
}>;
|
|
268
237
|
};
|
|
269
238
|
type TStoredApiaApiMethod = (props?: TMethod['props']) => unknown;
|
|
@@ -278,8 +247,6 @@ interface IModalConfig {
|
|
|
278
247
|
onMessage?: (message: Record<string, unknown>) => unknown;
|
|
279
248
|
onMessageClose?: () => unknown;
|
|
280
249
|
onSubmitted?: (handler: TApiaApiMethodHandler, response: AxiosResponse<Record<string, unknown> | null> | null) => unknown;
|
|
281
|
-
fieldsRenderer?: (element: TApiaApiSectionElement) => React$1.FC<Pick<TApiaApiMethodHandler, 'assignForm'>> | null;
|
|
282
|
-
onFieldChange?: (element: TApiaApiSectionElement, handler: TApiaApiMethodHandler) => unknown;
|
|
283
250
|
}
|
|
284
251
|
type THandleConfiguration = Partial<Pick<IApiaApiRequestConfig<unknown>, 'modalConfiguration' | 'methodsPath' | 'setModalProps'>>;
|
|
285
252
|
interface IApiaApiHandlerState {
|
|
@@ -290,7 +257,7 @@ interface IApiaApiHandlerState {
|
|
|
290
257
|
errors: Record<string, string>;
|
|
291
258
|
windowIndex: number;
|
|
292
259
|
}
|
|
293
|
-
declare const ApiaApiHandler:
|
|
260
|
+
declare const ApiaApiHandler: react.MemoExoticComponent<() => react.JSX.Element>;
|
|
294
261
|
|
|
295
262
|
declare global {
|
|
296
263
|
interface Window {
|
|
@@ -305,7 +272,7 @@ declare global {
|
|
|
305
272
|
* Permite cargar en forma asíncrona un modal que se encuentre dentro del
|
|
306
273
|
* directorio /api/modals
|
|
307
274
|
* */
|
|
308
|
-
declare const getModal: (path: string) =>
|
|
275
|
+
declare const getModal: (path: string) => react__default.LazyExoticComponent<react__default.ComponentType<TApiaApiField>>;
|
|
309
276
|
|
|
310
277
|
type TFilter = {
|
|
311
278
|
avoidLabel?: boolean;
|
|
@@ -362,12 +329,12 @@ declare class Filter {
|
|
|
362
329
|
filterState: TFilter;
|
|
363
330
|
focus(): void;
|
|
364
331
|
constructor(properties: TFilter);
|
|
365
|
-
getInputRenderer():
|
|
366
|
-
getSelectRenderer():
|
|
367
|
-
getRangeRenderer():
|
|
368
|
-
getDateRenderer():
|
|
369
|
-
getDoubleRenderer():
|
|
370
|
-
Component: (() =>
|
|
332
|
+
getInputRenderer(): react.JSX.Element;
|
|
333
|
+
getSelectRenderer(): react.JSX.Element;
|
|
334
|
+
getRangeRenderer(): react.JSX.Element;
|
|
335
|
+
getDateRenderer(): react.JSX.Element;
|
|
336
|
+
getDoubleRenderer(): react.JSX.Element;
|
|
337
|
+
Component: (() => react.JSX.Element) & {
|
|
371
338
|
displayName: string;
|
|
372
339
|
};
|
|
373
340
|
}
|
|
@@ -408,15 +375,15 @@ declare class TableController {
|
|
|
408
375
|
private parseFilters;
|
|
409
376
|
Context: (({ children }: {
|
|
410
377
|
children: React.ReactNode;
|
|
411
|
-
}) =>
|
|
378
|
+
}) => react.JSX.Element) & {
|
|
412
379
|
displayName: string;
|
|
413
380
|
};
|
|
414
381
|
private TableContext;
|
|
415
382
|
getTableName(): string;
|
|
416
|
-
Pagination: (() =>
|
|
383
|
+
Pagination: (() => react.JSX.Element) & {
|
|
417
384
|
displayName: string;
|
|
418
385
|
};
|
|
419
|
-
Table:
|
|
386
|
+
Table: react.MemoExoticComponent<react.ForwardRefExoticComponent<theme_ui.BoxProps & react.RefAttributes<HTMLDivElement>>>;
|
|
420
387
|
on<K extends keyof TableControllerEvents>(ev: K, cb: (e: TableControllerEvents[K]) => unknown): _apia_util.UnSubscriber;
|
|
421
388
|
updateFilters(newFilters: Filter[]): void;
|
|
422
389
|
updateState(newState: Partial<TableControllerState> | ((currentState: TableControllerState) => void)): void;
|
|
@@ -495,12 +462,12 @@ declare class QueryController {
|
|
|
495
462
|
columns: TResponsiveTableColumn[];
|
|
496
463
|
filters: TFilter[];
|
|
497
464
|
};
|
|
498
|
-
protected parseRefreshResponse(response?:
|
|
465
|
+
protected parseRefreshResponse(response?: TApiaFunction | null): void;
|
|
499
466
|
protected parseStructure(structure: ReturnType<QueryController['parseLoadStructureResponse']>): void;
|
|
500
467
|
refresh(now?: boolean): Promise<void>;
|
|
501
468
|
setFilterOptions(): Promise<void>;
|
|
502
469
|
sort(column: string, orderType: 'Asc' | 'Des'): Promise<void>;
|
|
503
|
-
protected updatePageState(pageInfo?:
|
|
470
|
+
protected updatePageState(pageInfo?: TApiaFunctionPageInfo): void;
|
|
504
471
|
protected updateRows(rows: TResponsiveTableRow[]): void;
|
|
505
472
|
}
|
|
506
473
|
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { jsx, jsxs, Fragment } from '@apia/theme/jsx-runtime';
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import React__default, { createContext, useState, useCallback, useEffect, useId, useRef, useMemo } from 'react';
|
|
4
4
|
import { Box, Label, spacing, getVariant, Input as Input$1, Select as Select$1, Spinner } from '@apia/theme';
|
|
5
|
-
import { debugDispatcher, parseXmlAsync, arrayOrArray, EventEmitter, useMount, encrypt, noNaN, getIndex,
|
|
5
|
+
import { debugDispatcher, parseXmlAsync, arrayOrArray, EventEmitter, useMount, encrypt, noNaN, getIndex, getLabel, StatefulEmitter, focus, focusSelector, useLatest, useIntermediateValue, formatMessage, getDateFormat, Mutex, uniqueId as uniqueId$1 } from '@apia/util';
|
|
6
6
|
import { notify, getNotificationMessageObj, dispatchNotifications } from '@apia/notifications';
|
|
7
7
|
import { classToValidate, Checkbox, FileInput, classToValidationFunction, Input, Radio, Select, Textarea, useFormContext, validationsStore, hasSucceedFormValidation, Form } from '@apia/validations';
|
|
8
8
|
import { Accordion, AccordionItem, useModal, LabelBox, SimpleButton, ApiaUtil, Modal, ProgressBar, DateInput, AutocompleteController, Autocomplete, IconButton } from '@apia/components';
|
|
@@ -10,7 +10,7 @@ import axios, { AxiosError } from 'axios';
|
|
|
10
10
|
import merge from 'lodash-es/merge';
|
|
11
11
|
import QueryString from 'qs';
|
|
12
12
|
import { session } from '@apia/session';
|
|
13
|
-
import uniqueId
|
|
13
|
+
import uniqueId from 'lodash-es/uniqueId';
|
|
14
14
|
import { ResponsiveTableContext, ResponsiveTable, Pagination, Sort, Responsive, Additional, responsiveTableStore, useResponsiveTableContext, getResponsiveTableContext, TableLoadingContext, defaultLabels, makeController2, responsiveTableActions, TableContextReproducer, Grouped, makeAsyncRenderer } from '@apia/table';
|
|
15
15
|
import { makeObservable, observable, reaction, toJS, action, computed } from 'mobx';
|
|
16
16
|
import { observer } from 'mobx-react-lite';
|
|
@@ -1064,7 +1064,6 @@ const ApiaEnvironmentsModal = (props) => {
|
|
|
1064
1064
|
/* @__PURE__ */ jsx(Box, { className: "pagination__wrapper", children: /* @__PURE__ */ jsx(
|
|
1065
1065
|
Pagination,
|
|
1066
1066
|
{
|
|
1067
|
-
listId: uniqueId("apiaenvsmodal"),
|
|
1068
1067
|
currentPage: state.currentPage,
|
|
1069
1068
|
onPageChange: handlePageChange,
|
|
1070
1069
|
onRefresh: handleRefresh,
|
|
@@ -1412,7 +1411,6 @@ const ApiaTasksModal = (props) => {
|
|
|
1412
1411
|
/* @__PURE__ */ jsx(Box, { className: "pagination__wrapper", children: /* @__PURE__ */ jsx(
|
|
1413
1412
|
Pagination,
|
|
1414
1413
|
{
|
|
1415
|
-
listId: uniqueId("apiatasksmodal"),
|
|
1416
1414
|
currentPage: state.currentPage,
|
|
1417
1415
|
onPageChange: handlePageChange,
|
|
1418
1416
|
onRefresh: handleRefresh,
|
|
@@ -1724,7 +1722,6 @@ const ApiaProcessesModal = (props) => {
|
|
|
1724
1722
|
/* @__PURE__ */ jsx(Box, { className: "pagination__wrapper", children: /* @__PURE__ */ jsx(
|
|
1725
1723
|
Pagination,
|
|
1726
1724
|
{
|
|
1727
|
-
listId: uniqueId("apiaprocessesmodal"),
|
|
1728
1725
|
currentPage: state.currentPage,
|
|
1729
1726
|
onPageChange: handlePageChange,
|
|
1730
1727
|
onRefresh: handleRefresh,
|
|
@@ -2037,7 +2034,6 @@ const ApiaPoolsModal = (props) => {
|
|
|
2037
2034
|
/* @__PURE__ */ jsx(Box, { className: "pagination__wrapper", children: /* @__PURE__ */ jsx(
|
|
2038
2035
|
Pagination,
|
|
2039
2036
|
{
|
|
2040
|
-
listId: uniqueId("apiapoolsmodal"),
|
|
2041
2037
|
currentPage: state.currentPage,
|
|
2042
2038
|
onPageChange: handlePageChange,
|
|
2043
2039
|
onRefresh: handleRefresh,
|
|
@@ -2344,7 +2340,6 @@ const ApiaUsersModal = (props) => {
|
|
|
2344
2340
|
Pagination,
|
|
2345
2341
|
{
|
|
2346
2342
|
currentPage: state.currentPage,
|
|
2347
|
-
listId: uniqueId("apiausersmodal"),
|
|
2348
2343
|
onPageChange: handlePageChange,
|
|
2349
2344
|
onRefresh: handleRefresh,
|
|
2350
2345
|
pageCount: state.pageCount,
|
|
@@ -2549,7 +2544,7 @@ const parseApiaApiSections = (elements) => {
|
|
|
2549
2544
|
sectionElements: removeEndingSpacers(elements.slice(start, end)).map(
|
|
2550
2545
|
(currentElement) => ({
|
|
2551
2546
|
...currentElement,
|
|
2552
|
-
sectionElementId: `sectionElement_${currentElement.id || currentElement.name || uniqueId
|
|
2547
|
+
sectionElementId: `sectionElement_${currentElement.id || currentElement.name || uniqueId()}`
|
|
2553
2548
|
})
|
|
2554
2549
|
)
|
|
2555
2550
|
});
|
|
@@ -2573,19 +2568,9 @@ const NonMemoizedApiaApiFieldsContainer = (props) => {
|
|
|
2573
2568
|
{
|
|
2574
2569
|
className: isVisible ? "handler__form__elements__section__content" : `handler__form__elements__section__content handler__hidden`,
|
|
2575
2570
|
children: sectionElements.map((current) => {
|
|
2576
|
-
const Renderer = props.configuration?.modalConfiguration?.fieldsRenderer?.(
|
|
2577
|
-
current
|
|
2578
|
-
);
|
|
2579
|
-
if (Renderer) {
|
|
2580
|
-
return /* @__PURE__ */ jsx(Renderer, { assignForm: props.assignForm });
|
|
2581
|
-
}
|
|
2582
2571
|
const element = {
|
|
2583
2572
|
...current,
|
|
2584
|
-
onChange(
|
|
2585
|
-
props.configuration?.modalConfiguration?.onFieldChange?.(
|
|
2586
|
-
{ ...current, value: ev.target.value },
|
|
2587
|
-
props
|
|
2588
|
-
);
|
|
2573
|
+
onChange() {
|
|
2589
2574
|
getFunction(current.onChange, props).then((onChangeMethod) => {
|
|
2590
2575
|
if (onChangeMethod) {
|
|
2591
2576
|
onChangeMethod();
|
|
@@ -2656,8 +2641,6 @@ const NonMemoizedApiaApiFieldsContainer = (props) => {
|
|
|
2656
2641
|
case "hidden":
|
|
2657
2642
|
case "password":
|
|
2658
2643
|
case "text":
|
|
2659
|
-
case "date":
|
|
2660
|
-
case "number":
|
|
2661
2644
|
return /* @__PURE__ */ jsx(
|
|
2662
2645
|
ApiaApiInput,
|
|
2663
2646
|
{
|
|
@@ -2772,7 +2755,7 @@ ApiaApiFieldsContainer.displayName = "ApiaApiFieldsContainer";
|
|
|
2772
2755
|
const parseButtons = (buttons) => {
|
|
2773
2756
|
return buttons.map((currentButton) => ({
|
|
2774
2757
|
...currentButton,
|
|
2775
|
-
buttonKey: uniqueId
|
|
2758
|
+
buttonKey: uniqueId(),
|
|
2776
2759
|
type: ["submitAjax", "submit"].includes(currentButton.type) ? "submit" : "button"
|
|
2777
2760
|
}));
|
|
2778
2761
|
};
|
|
@@ -3137,11 +3120,7 @@ const ApiaApiHandlerNonMemoized = () => {
|
|
|
3137
3120
|
},
|
|
3138
3121
|
setState,
|
|
3139
3122
|
state,
|
|
3140
|
-
setValue
|
|
3141
|
-
assignForm: currentFormDispatcher.emit.bind(
|
|
3142
|
-
currentFormDispatcher,
|
|
3143
|
-
"form"
|
|
3144
|
-
)
|
|
3123
|
+
setValue
|
|
3145
3124
|
};
|
|
3146
3125
|
return newHandler;
|
|
3147
3126
|
}, [close, configuration, currentForm, setError, state, setValue]);
|
|
@@ -4150,7 +4129,7 @@ class QueryController {
|
|
|
4150
4129
|
}))
|
|
4151
4130
|
].filter(Boolean),
|
|
4152
4131
|
className: r.classToAdd,
|
|
4153
|
-
id: r.id ?? uniqueId("row")
|
|
4132
|
+
id: r.id ?? uniqueId$1("row")
|
|
4154
4133
|
};
|
|
4155
4134
|
})
|
|
4156
4135
|
]);
|
|
@@ -4771,7 +4750,7 @@ class MonDocQuery extends QueryController {
|
|
|
4771
4750
|
};
|
|
4772
4751
|
}
|
|
4773
4752
|
addFreeMetadataFilter(filter) {
|
|
4774
|
-
const id = uniqueId();
|
|
4753
|
+
const id = uniqueId$1();
|
|
4775
4754
|
const actualFilter = filter || {
|
|
4776
4755
|
id,
|
|
4777
4756
|
group: "lblFreeMetadata",
|
|
@@ -4825,7 +4804,7 @@ class MonDocQuery extends QueryController {
|
|
|
4825
4804
|
});
|
|
4826
4805
|
this.tableController.updateFilters(metadataFilters);
|
|
4827
4806
|
if (metadataFilters.length > 0) {
|
|
4828
|
-
const id = uniqueId();
|
|
4807
|
+
const id = uniqueId$1();
|
|
4829
4808
|
const metadataFilter = {
|
|
4830
4809
|
id,
|
|
4831
4810
|
group: "lblFreeMetadata",
|