@apia/api 4.0.15 → 4.0.17
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 +46 -21
- package/dist/index.js +214 -93
- package/dist/index.js.map +1 -1
- package/package.json +12 -10
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
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, TApiaLoad, TApiaFormElement, TApiaFilterOption, TApiaFilter, TApiaFunction, TApiaFunctionPageInfo } from '@apia/util';
|
|
5
|
+
import { TModify, TApiaLoad, TApiaFormElement, TApiaFilterOption, TApiaFilter, TApiaFunction, TApiaFunctionPageInfo, EventEmitter, UnSubscriber } from '@apia/util';
|
|
6
6
|
import { TNotificationMessage, notify } from '@apia/notifications';
|
|
7
7
|
import { TModal, TOpenModal, ApiaUtilModalHandler } from '@apia/components';
|
|
8
8
|
import QueryString from 'qs';
|
|
@@ -225,14 +225,14 @@ type TApiaApiMethodHandler = {
|
|
|
225
225
|
reset: () => void;
|
|
226
226
|
setError: typeof notify;
|
|
227
227
|
setMessage: (message: Record<string, unknown>) => unknown;
|
|
228
|
-
setState:
|
|
228
|
+
setState: react.Dispatch<react.SetStateAction<IApiaApiHandlerState>>;
|
|
229
229
|
state: IApiaApiHandlerState;
|
|
230
230
|
setValue: (name: string, value: string) => void;
|
|
231
231
|
};
|
|
232
232
|
type TApiaApiMethod = (handler: TApiaApiMethodHandler, props: TMethod['props']) => Promise<void> | void;
|
|
233
233
|
type TApiaApiField = TApiaApiMethodHandler & {
|
|
234
234
|
element: TModify<TApiaFormElement, {
|
|
235
|
-
onChange:
|
|
235
|
+
onChange: react.ChangeEventHandler;
|
|
236
236
|
}>;
|
|
237
237
|
};
|
|
238
238
|
type TStoredApiaApiMethod = (props?: TMethod['props']) => unknown;
|
|
@@ -257,7 +257,7 @@ interface IApiaApiHandlerState {
|
|
|
257
257
|
errors: Record<string, string>;
|
|
258
258
|
windowIndex: number;
|
|
259
259
|
}
|
|
260
|
-
declare const ApiaApiHandler:
|
|
260
|
+
declare const ApiaApiHandler: react.MemoExoticComponent<() => react.JSX.Element>;
|
|
261
261
|
|
|
262
262
|
declare global {
|
|
263
263
|
interface Window {
|
|
@@ -272,13 +272,14 @@ declare global {
|
|
|
272
272
|
* Permite cargar en forma asíncrona un modal que se encuentre dentro del
|
|
273
273
|
* directorio /api/modals
|
|
274
274
|
* */
|
|
275
|
-
declare const getModal: (path: string) =>
|
|
275
|
+
declare const getModal: (path: string) => react__default.LazyExoticComponent<react__default.ComponentType<TApiaApiField>>;
|
|
276
276
|
|
|
277
277
|
type TFilter = {
|
|
278
278
|
avoidLabel?: boolean;
|
|
279
279
|
column?: string;
|
|
280
280
|
errorMessage?: string;
|
|
281
281
|
id: string;
|
|
282
|
+
filterToId?: string;
|
|
282
283
|
isAdditional?: boolean;
|
|
283
284
|
isHidden?: boolean;
|
|
284
285
|
onChange?: (queryController: QueryController) => unknown;
|
|
@@ -292,18 +293,27 @@ type TFilter = {
|
|
|
292
293
|
isRange?: boolean;
|
|
293
294
|
type?: 'date' | 'D' | 'S' | 'number' | 'N' | 'apiaNumber' | 'triple' | 'dateHour';
|
|
294
295
|
value: any;
|
|
296
|
+
valueTo?: any;
|
|
295
297
|
isSize?: boolean;
|
|
296
298
|
};
|
|
297
299
|
|
|
298
|
-
type FilterState = TFilter;
|
|
299
300
|
declare class Filter {
|
|
300
|
-
|
|
301
|
-
filterState:
|
|
301
|
+
protected tableName?: string;
|
|
302
|
+
filterState: TFilter;
|
|
302
303
|
focus(): void;
|
|
303
304
|
constructor(properties: TFilter);
|
|
305
|
+
getInputRenderer({ filter }: {
|
|
306
|
+
filter: TApiaFilter;
|
|
307
|
+
}): react.JSX.Element;
|
|
308
|
+
getSelectRenderer({ filter }: {
|
|
309
|
+
filter: TApiaFilter;
|
|
310
|
+
}): react.JSX.Element;
|
|
311
|
+
getRangeRenderer({ filter }: {
|
|
312
|
+
filter: TApiaFilter;
|
|
313
|
+
}): react.JSX.Element;
|
|
304
314
|
Component: (({ filter }: {
|
|
305
315
|
filter: TApiaFilter;
|
|
306
|
-
}) =>
|
|
316
|
+
}) => react.JSX.Element) & {
|
|
307
317
|
displayName: string;
|
|
308
318
|
};
|
|
309
319
|
}
|
|
@@ -356,7 +366,7 @@ declare class FilterTypes {
|
|
|
356
366
|
conditions: TFilterTypesElementConditions[];
|
|
357
367
|
constructor();
|
|
358
368
|
protected getFilterTypes(): Promise<void>;
|
|
359
|
-
Component: () =>
|
|
369
|
+
Component: () => react.JSX.Element;
|
|
360
370
|
initialLoad(): Promise<void>;
|
|
361
371
|
setFilterOptions(): Promise<void>;
|
|
362
372
|
}
|
|
@@ -373,12 +383,12 @@ declare class TableController {
|
|
|
373
383
|
private parseFilters;
|
|
374
384
|
Context: ({ children }: {
|
|
375
385
|
children: React.ReactNode;
|
|
376
|
-
}) =>
|
|
386
|
+
}) => react.JSX.Element;
|
|
377
387
|
getTableName(): string;
|
|
378
|
-
Pagination: (() =>
|
|
388
|
+
Pagination: (() => react.JSX.Element) & {
|
|
379
389
|
displayName: string;
|
|
380
390
|
};
|
|
381
|
-
Table:
|
|
391
|
+
Table: react.MemoExoticComponent<react.ForwardRefExoticComponent<theme_ui.BoxProps & react.RefAttributes<HTMLDivElement>>>;
|
|
382
392
|
on<K extends keyof TableControllerEvents>(ev: K, cb: (e: TableControllerEvents[K]) => unknown): _apia_util.UnSubscriber;
|
|
383
393
|
updateState(newState: Partial<TableControllerState> | ((currentState: TableControllerState) => void)): void;
|
|
384
394
|
}
|
|
@@ -400,6 +410,19 @@ declare class QueryController {
|
|
|
400
410
|
private initializing;
|
|
401
411
|
structure: QueryControllerStructure | null;
|
|
402
412
|
tableController: TableController;
|
|
413
|
+
getTableControllerDefaultProps(): {};
|
|
414
|
+
protected getEventsHandlers(): {
|
|
415
|
+
onChangeSelection: (ev: TResponsiveTableRowsSelectionEvent) => void;
|
|
416
|
+
onFilterBlur: (_ev: TApiaFilter) => void;
|
|
417
|
+
onFilterChange: (_ev: TApiaFilter) => void;
|
|
418
|
+
onFilterPressEnter: (_ev: TApiaFilter) => void;
|
|
419
|
+
onRowClick: (_ev: TResponsiveTableRowsSelectionEvent[number]) => void;
|
|
420
|
+
onSelectRows: (_ev: TResponsiveTableRowsSelectionEvent) => void;
|
|
421
|
+
onSortChange: (ev: TResponsiveTableSortChangeEvent) => void;
|
|
422
|
+
onPage: (num: number) => Promise<void>;
|
|
423
|
+
onRefresh: () => Promise<void | undefined>;
|
|
424
|
+
};
|
|
425
|
+
protected buildTableController(): TableController;
|
|
403
426
|
constructor(ajaxUrl: string);
|
|
404
427
|
protected initEvents(): void;
|
|
405
428
|
protected getLoadStructureParameters(): Record<string, unknown>;
|
|
@@ -431,17 +454,19 @@ type QueryModalControllerEvents = Pick<TableControllerEvents, 'onSelectRows'> &
|
|
|
431
454
|
cancel: null;
|
|
432
455
|
};
|
|
433
456
|
declare class QueryModalController {
|
|
434
|
-
|
|
457
|
+
protected emitter: EventEmitter<QueryModalControllerEvents>;
|
|
435
458
|
protected queryController: QueryController;
|
|
436
459
|
private modalHandler;
|
|
437
|
-
|
|
460
|
+
protected currentSelection: TResponsiveTableRowsSelectionEvent | null;
|
|
438
461
|
private additionalFiltersController;
|
|
439
462
|
constructor(queryController: QueryController);
|
|
440
463
|
protected getModalDefinition(): TOpenModal;
|
|
441
464
|
getQueryController(): QueryController;
|
|
442
|
-
|
|
443
|
-
openModal(properties?: TOpenModal): Promise<
|
|
465
|
+
protected on<K extends keyof QueryModalControllerEvents>(ev: K, cb: (e: QueryModalControllerEvents[K]) => unknown): UnSubscriber;
|
|
466
|
+
openModal<T = QueryModalControllerEvents['onSelectRows']>(properties?: TOpenModal): Promise<T>;
|
|
444
467
|
getModalHandler(): ApiaUtilModalHandler | null;
|
|
468
|
+
protected onConfirm(): void;
|
|
469
|
+
protected onConfirmResolve<T>(): Promise<T>;
|
|
445
470
|
}
|
|
446
471
|
|
|
447
472
|
declare const ApiaUsersModal2: QueryModalController;
|
|
@@ -455,9 +480,9 @@ type TOpenMonDocModal = {
|
|
|
455
480
|
};
|
|
456
481
|
declare class ApiaMonDocModal extends QueryModalController {
|
|
457
482
|
constructor();
|
|
458
|
-
openModal(properties: TOpenModal & {
|
|
483
|
+
openModal<T = TResponsiveTableRowsSelectionEvent>(properties: TOpenModal & {
|
|
459
484
|
monitorProperties: TOpenMonDocModal;
|
|
460
|
-
}): Promise<
|
|
485
|
+
}): Promise<T>;
|
|
461
486
|
}
|
|
462
487
|
declare const ApiaMonDocModal2: ApiaMonDocModal;
|
|
463
488
|
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
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 } from 'react';
|
|
4
|
-
import { Box, Label, spacing, getVariant,
|
|
4
|
+
import { Box, Label, spacing, getVariant, Input as Input$1, Select as Select$1 } from '@apia/theme';
|
|
5
5
|
import { debugDispatcher, parseXmlAsync, EventEmitter, arrayOrArray, useMount, encrypt, noNaN, getIndex, getLabel, StatefulEmitter, focus, focusSelector, useLatest } 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';
|
|
@@ -11,10 +11,11 @@ import merge from 'lodash-es/merge';
|
|
|
11
11
|
import QueryString from 'qs';
|
|
12
12
|
import { session } from '@apia/session';
|
|
13
13
|
import uniqueId from 'lodash-es/uniqueId';
|
|
14
|
-
import { ResponsiveTableContext, ResponsiveTable, Pagination, Sort, Responsive, Additional, responsiveTableStore, useResponsiveTableContext,
|
|
14
|
+
import { ResponsiveTableContext, ResponsiveTable, Pagination, Sort, Responsive, Additional, responsiveTableStore, useResponsiveTableContext, getResponsiveTableContext, makeController2, responsiveTableActions, TableContextReproducer } from '@apia/table';
|
|
15
15
|
import { makeObservable, observable, reaction, action, toJS } from 'mobx';
|
|
16
16
|
import { observer } from 'mobx-react-lite';
|
|
17
17
|
import { throttle } from 'lodash-es';
|
|
18
|
+
import { Icon } from '@apia/icons';
|
|
18
19
|
|
|
19
20
|
const ApiaApiId = createContext("apiaApi");
|
|
20
21
|
const ApiaApiContext = ({
|
|
@@ -3222,6 +3223,93 @@ const ApiaApiHandlerNonMemoized = () => {
|
|
|
3222
3223
|
};
|
|
3223
3224
|
const ApiaApiHandler = React.memo(ApiaApiHandlerNonMemoized);
|
|
3224
3225
|
|
|
3226
|
+
const units = ["B", "KB", "MB", "GB"];
|
|
3227
|
+
const RangeFilterRenderer = observer(
|
|
3228
|
+
({ filter, state }) => {
|
|
3229
|
+
const { onFilterBlur, onFilterPressEnter, onFilterChange } = useResponsiveTableContext();
|
|
3230
|
+
return /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", gap: 2, alignItems: "center" }, children: [
|
|
3231
|
+
/* @__PURE__ */ jsx(
|
|
3232
|
+
Input$1,
|
|
3233
|
+
{
|
|
3234
|
+
id: "range-filter-from",
|
|
3235
|
+
value: state.value,
|
|
3236
|
+
onChange: (ev) => {
|
|
3237
|
+
state.value = ev.target.value;
|
|
3238
|
+
onFilterChange?.(filter);
|
|
3239
|
+
},
|
|
3240
|
+
onKeyDown: (ev) => {
|
|
3241
|
+
if (ev.code === "Enter") {
|
|
3242
|
+
onFilterPressEnter?.(filter);
|
|
3243
|
+
}
|
|
3244
|
+
},
|
|
3245
|
+
onBlur: () => {
|
|
3246
|
+
onFilterBlur?.(filter);
|
|
3247
|
+
}
|
|
3248
|
+
}
|
|
3249
|
+
),
|
|
3250
|
+
"-",
|
|
3251
|
+
/* @__PURE__ */ jsx(
|
|
3252
|
+
Input$1,
|
|
3253
|
+
{
|
|
3254
|
+
tabIndex: 0,
|
|
3255
|
+
id: "range-filter-to",
|
|
3256
|
+
value: state.valueTo || "",
|
|
3257
|
+
onChange: (e) => state.valueTo = e.target.value
|
|
3258
|
+
}
|
|
3259
|
+
),
|
|
3260
|
+
/* @__PURE__ */ jsx(
|
|
3261
|
+
Select$1,
|
|
3262
|
+
{
|
|
3263
|
+
onChange: (ev) => {
|
|
3264
|
+
},
|
|
3265
|
+
value: units[Math.log(1) / 10],
|
|
3266
|
+
children: units.map((c) => /* @__PURE__ */ jsx("option", { value: c, children: c }, c))
|
|
3267
|
+
}
|
|
3268
|
+
)
|
|
3269
|
+
] });
|
|
3270
|
+
}
|
|
3271
|
+
);
|
|
3272
|
+
|
|
3273
|
+
const SelectFilterRenderer = observer(
|
|
3274
|
+
({ filter, state }) => {
|
|
3275
|
+
const { onFilterChange } = useResponsiveTableContext();
|
|
3276
|
+
return /* @__PURE__ */ jsx(
|
|
3277
|
+
Select$1,
|
|
3278
|
+
{
|
|
3279
|
+
value: state.value,
|
|
3280
|
+
onChange: (ev) => {
|
|
3281
|
+
state.value = ev.target.value;
|
|
3282
|
+
onFilterChange?.(filter);
|
|
3283
|
+
},
|
|
3284
|
+
children: arrayOrArray(filter.options).map((c) => /* @__PURE__ */ jsx("option", { value: c.value, children: c.label }, c.value))
|
|
3285
|
+
}
|
|
3286
|
+
);
|
|
3287
|
+
}
|
|
3288
|
+
);
|
|
3289
|
+
|
|
3290
|
+
const InputFilterRenderer = observer(
|
|
3291
|
+
({ filter, state }) => {
|
|
3292
|
+
const { onFilterBlur, onFilterPressEnter } = useResponsiveTableContext();
|
|
3293
|
+
return /* @__PURE__ */ jsx(
|
|
3294
|
+
Input$1,
|
|
3295
|
+
{
|
|
3296
|
+
value: state.value,
|
|
3297
|
+
onChange: (ev) => {
|
|
3298
|
+
state.value = ev.target.value;
|
|
3299
|
+
},
|
|
3300
|
+
onKeyDown: (ev) => {
|
|
3301
|
+
if (ev.code === "Enter") {
|
|
3302
|
+
onFilterPressEnter?.(filter);
|
|
3303
|
+
}
|
|
3304
|
+
},
|
|
3305
|
+
onBlur: () => {
|
|
3306
|
+
onFilterBlur?.(filter);
|
|
3307
|
+
}
|
|
3308
|
+
}
|
|
3309
|
+
);
|
|
3310
|
+
}
|
|
3311
|
+
);
|
|
3312
|
+
|
|
3225
3313
|
var __defProp$7 = Object.defineProperty;
|
|
3226
3314
|
var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3227
3315
|
var __publicField$7 = (obj, key, value) => {
|
|
@@ -3236,50 +3324,15 @@ class Filter {
|
|
|
3236
3324
|
value: ""
|
|
3237
3325
|
});
|
|
3238
3326
|
__publicField$7(this, "Component", observer(({ filter }) => {
|
|
3239
|
-
const {
|
|
3327
|
+
const { name } = useResponsiveTableContext();
|
|
3240
3328
|
this.tableName = name;
|
|
3241
|
-
if (this.filterState
|
|
3242
|
-
return
|
|
3243
|
-
RangeFilter,
|
|
3244
|
-
{
|
|
3245
|
-
filter: {
|
|
3246
|
-
...filter,
|
|
3247
|
-
currentValue: this.filterState.value,
|
|
3248
|
-
isSize: this.filterState.isSize
|
|
3249
|
-
}
|
|
3250
|
-
}
|
|
3251
|
-
);
|
|
3329
|
+
if (this.filterState.isRange) {
|
|
3330
|
+
return this.getRangeRenderer({ filter });
|
|
3252
3331
|
}
|
|
3253
|
-
if (
|
|
3254
|
-
return
|
|
3255
|
-
Select$1,
|
|
3256
|
-
{
|
|
3257
|
-
value: this.filterState.value,
|
|
3258
|
-
onChange: (ev) => {
|
|
3259
|
-
this.filterState.value = ev.target.value;
|
|
3260
|
-
onFilterChange?.(filter);
|
|
3261
|
-
},
|
|
3262
|
-
children: filter.options.map((c) => /* @__PURE__ */ jsx("option", { value: c.value, children: c.label }, c.value))
|
|
3263
|
-
}
|
|
3264
|
-
);
|
|
3332
|
+
if (this.filterState.options) {
|
|
3333
|
+
return this.getSelectRenderer({ filter });
|
|
3265
3334
|
}
|
|
3266
|
-
return
|
|
3267
|
-
Input$1,
|
|
3268
|
-
{
|
|
3269
|
-
value: this.filterState.value,
|
|
3270
|
-
onChange: (ev) => {
|
|
3271
|
-
this.filterState.value = ev.target.value;
|
|
3272
|
-
},
|
|
3273
|
-
onKeyDown: (ev) => {
|
|
3274
|
-
if (ev.code === "Enter") {
|
|
3275
|
-
onFilterPressEnter?.(filter);
|
|
3276
|
-
}
|
|
3277
|
-
},
|
|
3278
|
-
onBlur: () => {
|
|
3279
|
-
onFilterBlur?.(filter);
|
|
3280
|
-
}
|
|
3281
|
-
}
|
|
3282
|
-
);
|
|
3335
|
+
return this.getInputRenderer({ filter });
|
|
3283
3336
|
}));
|
|
3284
3337
|
Object.assign(this.filterState, properties);
|
|
3285
3338
|
makeObservable(this, { filterState: observable });
|
|
@@ -3297,6 +3350,15 @@ class Filter {
|
|
|
3297
3350
|
}
|
|
3298
3351
|
focus() {
|
|
3299
3352
|
}
|
|
3353
|
+
getInputRenderer({ filter }) {
|
|
3354
|
+
return /* @__PURE__ */ jsx(InputFilterRenderer, { filter, state: this.filterState });
|
|
3355
|
+
}
|
|
3356
|
+
getSelectRenderer({ filter }) {
|
|
3357
|
+
return /* @__PURE__ */ jsx(SelectFilterRenderer, { filter, state: this.filterState });
|
|
3358
|
+
}
|
|
3359
|
+
getRangeRenderer({ filter }) {
|
|
3360
|
+
return /* @__PURE__ */ jsx(RangeFilterRenderer, { filter, state: this.filterState });
|
|
3361
|
+
}
|
|
3300
3362
|
}
|
|
3301
3363
|
|
|
3302
3364
|
const FilterTypesComponent = observer(
|
|
@@ -3496,7 +3558,9 @@ class TableController {
|
|
|
3496
3558
|
id: c.filterState.id,
|
|
3497
3559
|
column: c.filterState.column,
|
|
3498
3560
|
asAdditional: c.filterState.isAdditional || this.state.columns.get(c.filterState.column || "")?.hidden,
|
|
3499
|
-
options: c.filterState.options
|
|
3561
|
+
options: c.filterState.options,
|
|
3562
|
+
detectOnChange: c.filterState.runAutomatically,
|
|
3563
|
+
runAutomatically: c.filterState.runAutomatically
|
|
3500
3564
|
};
|
|
3501
3565
|
});
|
|
3502
3566
|
}
|
|
@@ -3527,7 +3591,7 @@ class QueryController {
|
|
|
3527
3591
|
__publicField$4(this, "hasInited", false);
|
|
3528
3592
|
__publicField$4(this, "initializing", false);
|
|
3529
3593
|
__publicField$4(this, "structure", null);
|
|
3530
|
-
__publicField$4(this, "tableController"
|
|
3594
|
+
__publicField$4(this, "tableController");
|
|
3531
3595
|
/**
|
|
3532
3596
|
* Allows to throttle calls to actual refresh method.
|
|
3533
3597
|
*/
|
|
@@ -3538,29 +3602,46 @@ class QueryController {
|
|
|
3538
3602
|
300,
|
|
3539
3603
|
{ leading: false, trailing: true }
|
|
3540
3604
|
));
|
|
3605
|
+
this.tableController = this.buildTableController();
|
|
3541
3606
|
this.initEvents();
|
|
3542
3607
|
}
|
|
3608
|
+
getTableControllerDefaultProps() {
|
|
3609
|
+
return {};
|
|
3610
|
+
}
|
|
3611
|
+
getEventsHandlers() {
|
|
3612
|
+
return {
|
|
3613
|
+
onChangeSelection: (ev) => {
|
|
3614
|
+
},
|
|
3615
|
+
onFilterBlur: (_ev) => {
|
|
3616
|
+
},
|
|
3617
|
+
onFilterChange: (_ev) => {
|
|
3618
|
+
const filter = this.tableController.state.filters.get(_ev.id);
|
|
3619
|
+
if (filter?.filterState.runAutomatically) {
|
|
3620
|
+
this.refresh(false);
|
|
3621
|
+
}
|
|
3622
|
+
},
|
|
3623
|
+
onFilterPressEnter: (_ev) => {
|
|
3624
|
+
this.refresh(true);
|
|
3625
|
+
},
|
|
3626
|
+
onRowClick: (_ev) => {
|
|
3627
|
+
},
|
|
3628
|
+
onSelectRows: (_ev) => {
|
|
3629
|
+
},
|
|
3630
|
+
onSortChange: (ev) => {
|
|
3631
|
+
this.sort(String(ev.columnIndex));
|
|
3632
|
+
},
|
|
3633
|
+
onPage: this.page.bind(this),
|
|
3634
|
+
onRefresh: () => this.refresh(true)
|
|
3635
|
+
};
|
|
3636
|
+
}
|
|
3637
|
+
buildTableController() {
|
|
3638
|
+
return new TableController();
|
|
3639
|
+
}
|
|
3543
3640
|
initEvents() {
|
|
3544
|
-
this.
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
});
|
|
3548
|
-
this.tableController.on("onFilterChange", (ev) => {
|
|
3549
|
-
const filter = this.tableController.state.filters.get(ev.id);
|
|
3550
|
-
if (filter?.filterState.runAutomatically) {
|
|
3551
|
-
this.refresh(false);
|
|
3552
|
-
}
|
|
3553
|
-
});
|
|
3554
|
-
this.tableController.on("onFilterPressEnter", () => this.refresh(true));
|
|
3555
|
-
this.tableController.on("onRowClick", (ev) => {
|
|
3556
|
-
});
|
|
3557
|
-
this.tableController.on("onSelectRows", (ev) => {
|
|
3558
|
-
});
|
|
3559
|
-
this.tableController.on("onSortChange", (ev) => {
|
|
3560
|
-
this.sort(ev.column.name);
|
|
3641
|
+
const handlers = this.getEventsHandlers();
|
|
3642
|
+
Object.entries(handlers).forEach(([eventName, handler]) => {
|
|
3643
|
+
this.tableController.on(eventName, handler.bind(this));
|
|
3561
3644
|
});
|
|
3562
|
-
this.tableController.on("onPage", this.page.bind(this));
|
|
3563
|
-
this.tableController.on("onRefresh", () => this.refresh(true));
|
|
3564
3645
|
}
|
|
3565
3646
|
getLoadStructureParameters() {
|
|
3566
3647
|
return {
|
|
@@ -3578,7 +3659,14 @@ class QueryController {
|
|
|
3578
3659
|
};
|
|
3579
3660
|
}
|
|
3580
3661
|
getFiltersValuesMap() {
|
|
3581
|
-
return [...this.tableController.state.filters.values()].reduce((
|
|
3662
|
+
return [...this.tableController.state.filters.values()].reduce((result, filterWrapper) => {
|
|
3663
|
+
const { id, value, filterToId, valueTo } = filterWrapper.filterState;
|
|
3664
|
+
result[id] = value;
|
|
3665
|
+
if (filterToId !== void 0 && valueTo !== void 0) {
|
|
3666
|
+
result[filterToId] = valueTo;
|
|
3667
|
+
}
|
|
3668
|
+
return result;
|
|
3669
|
+
}, {});
|
|
3582
3670
|
}
|
|
3583
3671
|
getPageParameters() {
|
|
3584
3672
|
return {
|
|
@@ -3628,6 +3716,8 @@ class QueryController {
|
|
|
3628
3716
|
id: `filter${String(i + 1)}`,
|
|
3629
3717
|
// Id generado en APIA
|
|
3630
3718
|
value: f.currentValue,
|
|
3719
|
+
filterToId: f?.filterToId,
|
|
3720
|
+
valueTo: f?.filterToValue,
|
|
3631
3721
|
avoidLabel: false,
|
|
3632
3722
|
column: f.column,
|
|
3633
3723
|
isAdditional: f.asAdditional,
|
|
@@ -3692,9 +3782,14 @@ class QueryController {
|
|
|
3692
3782
|
arrayOrArray(structure.columns).map((c) => [c.name, c])
|
|
3693
3783
|
);
|
|
3694
3784
|
const filters = new Map(
|
|
3695
|
-
arrayOrArray(structure.filters).map((f) =>
|
|
3785
|
+
arrayOrArray(structure.filters).map((f) => {
|
|
3786
|
+
return [f.id, new Filter(f)];
|
|
3787
|
+
})
|
|
3696
3788
|
);
|
|
3697
|
-
this.tableController.updateState({
|
|
3789
|
+
this.tableController.updateState({
|
|
3790
|
+
columns,
|
|
3791
|
+
filters
|
|
3792
|
+
});
|
|
3698
3793
|
}
|
|
3699
3794
|
updatePageState(pageInfo) {
|
|
3700
3795
|
const currentPage = Number(pageInfo?.currentPage ?? 0);
|
|
@@ -3725,6 +3820,9 @@ class QueryController {
|
|
|
3725
3820
|
if (!this.hasInited) {
|
|
3726
3821
|
this.structure = await this.getStructure();
|
|
3727
3822
|
this.parseStructure(this.structure);
|
|
3823
|
+
this.tableController.updateState({
|
|
3824
|
+
props: this.getTableControllerDefaultProps()
|
|
3825
|
+
});
|
|
3728
3826
|
this.hasInited = true;
|
|
3729
3827
|
this.initializing = false;
|
|
3730
3828
|
}
|
|
@@ -3928,7 +4026,7 @@ class QueryModalController {
|
|
|
3928
4026
|
] }),
|
|
3929
4027
|
title: structure?.title,
|
|
3930
4028
|
onConfirm: () => {
|
|
3931
|
-
this.
|
|
4029
|
+
this.onConfirm();
|
|
3932
4030
|
},
|
|
3933
4031
|
onCancel: () => {
|
|
3934
4032
|
this.additionalFiltersController.closeModal();
|
|
@@ -3985,6 +4083,15 @@ class QueryModalController {
|
|
|
3985
4083
|
...this.getModalDefinition(),
|
|
3986
4084
|
...properties
|
|
3987
4085
|
});
|
|
4086
|
+
return this.onConfirmResolve();
|
|
4087
|
+
}
|
|
4088
|
+
getModalHandler() {
|
|
4089
|
+
return this.modalHandler;
|
|
4090
|
+
}
|
|
4091
|
+
onConfirm() {
|
|
4092
|
+
this.emitter.emit("onSelectRows", this.currentSelection || []);
|
|
4093
|
+
}
|
|
4094
|
+
onConfirmResolve() {
|
|
3988
4095
|
return new Promise((resolve) => {
|
|
3989
4096
|
let uns1 = () => {
|
|
3990
4097
|
}, uns2 = () => {
|
|
@@ -4001,9 +4108,6 @@ class QueryModalController {
|
|
|
4001
4108
|
});
|
|
4002
4109
|
});
|
|
4003
4110
|
}
|
|
4004
|
-
getModalHandler() {
|
|
4005
|
-
return this.modalHandler;
|
|
4006
|
-
}
|
|
4007
4111
|
}
|
|
4008
4112
|
|
|
4009
4113
|
var __defProp$1 = Object.defineProperty;
|
|
@@ -4150,17 +4254,26 @@ class MonDocQuery extends QueryController {
|
|
|
4150
4254
|
this.ajaxUrl = ajaxUrl;
|
|
4151
4255
|
__publicField(this, "dynamicParams", {});
|
|
4152
4256
|
}
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
|
|
4257
|
+
getTableControllerDefaultProps() {
|
|
4258
|
+
return {
|
|
4259
|
+
...super.getTableControllerDefaultProps(),
|
|
4260
|
+
isMultiple: false,
|
|
4261
|
+
reserveColumnsForStates: 2,
|
|
4262
|
+
statesColumns: [
|
|
4263
|
+
{
|
|
4264
|
+
Icon: () => /* @__PURE__ */ jsx(Icon, { icon: "Locked", title: "" }),
|
|
4265
|
+
tooltip: getLabel("titDocLock").text
|
|
4266
|
+
},
|
|
4267
|
+
{
|
|
4268
|
+
Icon: () => /* @__PURE__ */ jsx(Icon, { icon: "Readonly", title: "", size: 22 }),
|
|
4269
|
+
tooltip: getLabel("lblReadOnly").text
|
|
4270
|
+
}
|
|
4271
|
+
]
|
|
4272
|
+
};
|
|
4273
|
+
}
|
|
4274
|
+
processFilterChangeEvent(ev) {
|
|
4275
|
+
this.tableController.state.filters.get(ev.id);
|
|
4276
|
+
this.filter();
|
|
4164
4277
|
}
|
|
4165
4278
|
getLoadStructureParameters() {
|
|
4166
4279
|
return {
|
|
@@ -4191,6 +4304,14 @@ class MonDocQuery extends QueryController {
|
|
|
4191
4304
|
isAjax: true
|
|
4192
4305
|
};
|
|
4193
4306
|
}
|
|
4307
|
+
getEventsHandlers() {
|
|
4308
|
+
return {
|
|
4309
|
+
...super.getEventsHandlers(),
|
|
4310
|
+
onFilterChange: () => {
|
|
4311
|
+
this.filter();
|
|
4312
|
+
}
|
|
4313
|
+
};
|
|
4314
|
+
}
|
|
4194
4315
|
async filter() {
|
|
4195
4316
|
const filterResult = await ApiaApi.post(
|
|
4196
4317
|
makeApiaUrl(this.getFilterParameters()),
|
|
@@ -4204,8 +4325,6 @@ class MonDocQuery extends QueryController {
|
|
|
4204
4325
|
);
|
|
4205
4326
|
if (!filterResult?.data)
|
|
4206
4327
|
return;
|
|
4207
|
-
const structure = this.parseLoadStructureResponse(filterResult.data);
|
|
4208
|
-
this.parseStructure(structure);
|
|
4209
4328
|
setTimeout(() => {
|
|
4210
4329
|
this.parseRefreshResponse(filterResult.data);
|
|
4211
4330
|
}, 200);
|
|
@@ -4219,7 +4338,6 @@ class MonDocQuery extends QueryController {
|
|
|
4219
4338
|
(r) => ({
|
|
4220
4339
|
rowProps: r,
|
|
4221
4340
|
cells: [
|
|
4222
|
-
{},
|
|
4223
4341
|
...arrayOrArray(r.cell).map((c) => {
|
|
4224
4342
|
if (typeof c === "string") {
|
|
4225
4343
|
return { children: c };
|
|
@@ -4246,21 +4364,25 @@ class MonDocQuery extends QueryController {
|
|
|
4246
4364
|
const retrievedFilters = arrayOrArray(typedResponse.filters);
|
|
4247
4365
|
const returnObject = {
|
|
4248
4366
|
columns: retrievedColumns.map((c) => {
|
|
4367
|
+
if (c.name === "docFile")
|
|
4368
|
+
return null;
|
|
4249
4369
|
const column = {
|
|
4250
4370
|
label: c.label,
|
|
4251
4371
|
name: c.name,
|
|
4252
4372
|
allowSorting: c.allowSorting,
|
|
4253
4373
|
dataSortBy: c.dataSortBy,
|
|
4254
|
-
minWidth:
|
|
4374
|
+
minWidth: "25%",
|
|
4255
4375
|
sort: c.sort,
|
|
4256
4376
|
toolTip: c.toolTip,
|
|
4257
|
-
width:
|
|
4377
|
+
width: "25%"
|
|
4258
4378
|
};
|
|
4259
4379
|
return column;
|
|
4260
|
-
}),
|
|
4261
|
-
filters: arrayOrArray(retrievedFilters).map((f
|
|
4380
|
+
}).filter((c) => c !== null),
|
|
4381
|
+
filters: arrayOrArray(retrievedFilters).map((f) => {
|
|
4262
4382
|
const filter = {
|
|
4263
|
-
id:
|
|
4383
|
+
id: f.id,
|
|
4384
|
+
filterToId: f?.filterToId,
|
|
4385
|
+
valueTo: f?.filterToValue,
|
|
4264
4386
|
value: f.currentValue,
|
|
4265
4387
|
avoidLabel: false,
|
|
4266
4388
|
column: f.column,
|
|
@@ -4286,7 +4408,7 @@ class MonDocQuery extends QueryController {
|
|
|
4286
4408
|
hideFilterTypes: false,
|
|
4287
4409
|
isDynamic: false,
|
|
4288
4410
|
openFiltersAutomatically: false,
|
|
4289
|
-
runFiltersAutomatically:
|
|
4411
|
+
runFiltersAutomatically: true,
|
|
4290
4412
|
title: ""
|
|
4291
4413
|
};
|
|
4292
4414
|
return returnObject;
|
|
@@ -4296,8 +4418,7 @@ class MonDocQuery extends QueryController {
|
|
|
4296
4418
|
makeApiaUrl({ ...this.getSortParameters(), orderBy: column })
|
|
4297
4419
|
);
|
|
4298
4420
|
if (result?.data) {
|
|
4299
|
-
|
|
4300
|
-
this.parseStructure(structure);
|
|
4421
|
+
this.parseRefreshResponse(result.data);
|
|
4301
4422
|
}
|
|
4302
4423
|
return super.refresh();
|
|
4303
4424
|
}
|