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