@apia/api 4.0.24 → 4.0.26
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 +80 -83
- package/dist/index.js +610 -516
- package/dist/index.js.map +1 -1
- package/package.json +9 -9
package/dist/index.js
CHANGED
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from '@apia/theme/jsx-runtime';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import React__default, { createContext, useState, useCallback, useEffect, useId,
|
|
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 } from '@apia/theme';
|
|
5
|
-
import { debugDispatcher, parseXmlAsync, EventEmitter, arrayOrArray, useMount, encrypt, noNaN, getIndex, getLabel, StatefulEmitter, focus, focusSelector, useLatest } from '@apia/util';
|
|
5
|
+
import { debugDispatcher, parseXmlAsync, EventEmitter, arrayOrArray, useMount, encrypt, noNaN, getIndex, getLabel, StatefulEmitter, focus, focusSelector, useLatest, useIntermediateValue, 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
|
-
import { Accordion, AccordionItem, useModal, LabelBox, SimpleButton, ApiaUtil, Modal, ProgressBar } from '@apia/components';
|
|
8
|
+
import { Accordion, AccordionItem, useModal, LabelBox, SimpleButton, ApiaUtil, Modal, ProgressBar, DateInput } from '@apia/components';
|
|
9
9
|
import axios from 'axios';
|
|
10
10
|
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, getResponsiveTableContext, TableLoadingContext, makeController2, responsiveTableActions, TableContextReproducer } from '@apia/table';
|
|
15
|
-
import { makeObservable, observable, reaction, toJS, action } from 'mobx';
|
|
14
|
+
import { ResponsiveTableContext, ResponsiveTable, Pagination, Sort, Responsive, Additional, responsiveTableStore, useResponsiveTableContext, getResponsiveTableContext, TableLoadingContext, defaultLabels, makeController2, responsiveTableActions, TableContextReproducer } from '@apia/table';
|
|
15
|
+
import { makeObservable, observable, reaction, toJS, action, computed } from 'mobx';
|
|
16
16
|
import { observer } from 'mobx-react-lite';
|
|
17
|
-
import {
|
|
18
|
-
import { Icon } from '@apia/icons';
|
|
17
|
+
import { Icon, FileIcon } from '@apia/icons';
|
|
19
18
|
|
|
20
19
|
const ApiaApiId = createContext("apiaApi");
|
|
21
20
|
const ApiaApiContext = ({
|
|
@@ -3226,60 +3225,113 @@ const ApiaApiHandler = React.memo(ApiaApiHandlerNonMemoized);
|
|
|
3226
3225
|
const units = ["B", "KB", "MB", "GB"];
|
|
3227
3226
|
const RangeFilterRenderer = observer(
|
|
3228
3227
|
({ filter, state }) => {
|
|
3229
|
-
const
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3228
|
+
const multiplier = useRef(1);
|
|
3229
|
+
const lastEmittedHigh = useRef(null);
|
|
3230
|
+
const lastEmittedLow = useRef(null);
|
|
3231
|
+
const lastEmittedMultiplier = useRef(1);
|
|
3232
|
+
if (lastEmittedLow.current !== state.value) {
|
|
3233
|
+
lastEmittedLow.current = state.value;
|
|
3234
|
+
lastEmittedHigh.current = state.valueTo || "";
|
|
3235
|
+
}
|
|
3236
|
+
const emitLow = (currentValue) => {
|
|
3237
|
+
const numberValue = currentValue ?? "";
|
|
3238
|
+
if (lastEmittedLow.current === numberValue && lastEmittedMultiplier.current === multiplier.current) {
|
|
3239
|
+
return;
|
|
3240
|
+
}
|
|
3241
|
+
lastEmittedLow.current = numberValue;
|
|
3242
|
+
lastEmittedMultiplier.current = multiplier.current;
|
|
3243
|
+
const emitValue = numberValue;
|
|
3244
|
+
state.value = emitValue;
|
|
3245
|
+
state.multiplier = multiplier.current;
|
|
3246
|
+
};
|
|
3247
|
+
const emitHigh = (currentValue) => {
|
|
3248
|
+
const numberValue = currentValue ?? "";
|
|
3249
|
+
if (lastEmittedHigh.current === numberValue && lastEmittedMultiplier.current === multiplier.current) {
|
|
3250
|
+
return;
|
|
3251
|
+
}
|
|
3252
|
+
lastEmittedHigh.current = numberValue;
|
|
3253
|
+
lastEmittedMultiplier.current = multiplier.current;
|
|
3254
|
+
const emitValue = numberValue;
|
|
3255
|
+
state.valueTo = emitValue;
|
|
3256
|
+
state.multiplier = multiplier.current;
|
|
3257
|
+
};
|
|
3258
|
+
const [lowValue, setLowValue] = useIntermediateValue(state.value);
|
|
3259
|
+
const [highValue, setHighValue] = useIntermediateValue(state.valueTo);
|
|
3260
|
+
const [unit, setUnit] = useIntermediateValue(state.multiplier);
|
|
3261
|
+
return /* @__PURE__ */ jsxs(
|
|
3262
|
+
Box,
|
|
3263
|
+
{
|
|
3264
|
+
className: `ApiaFilter__Range`,
|
|
3265
|
+
...getVariant("layout.common.components.filters.rangeFilter"),
|
|
3266
|
+
children: [
|
|
3267
|
+
/* @__PURE__ */ jsx(Box, { className: "ApiaFilter__Range__Low", children: /* @__PURE__ */ jsx(
|
|
3268
|
+
Input$1,
|
|
3269
|
+
{
|
|
3270
|
+
onChange: ({ target: { value: currentValue } }) => {
|
|
3271
|
+
setLowValue(currentValue);
|
|
3272
|
+
emitLow(currentValue);
|
|
3273
|
+
},
|
|
3274
|
+
onBlur: ({ target: { value: currentValue } }) => {
|
|
3275
|
+
emitLow(currentValue);
|
|
3276
|
+
},
|
|
3277
|
+
onKeyDown: ({ code, target }) => {
|
|
3278
|
+
if (code === "Enter") {
|
|
3279
|
+
emitLow(target.value);
|
|
3280
|
+
}
|
|
3281
|
+
},
|
|
3282
|
+
value: lowValue
|
|
3243
3283
|
}
|
|
3244
|
-
},
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3284
|
+
) }),
|
|
3285
|
+
" - ",
|
|
3286
|
+
/* @__PURE__ */ jsx(Box, { className: "ApiaFilter__Range__High", children: /* @__PURE__ */ jsx(
|
|
3287
|
+
Input$1,
|
|
3288
|
+
{
|
|
3289
|
+
onChange: ({ target: { value: currentValue } }) => {
|
|
3290
|
+
setHighValue(currentValue);
|
|
3291
|
+
emitHigh(currentValue);
|
|
3292
|
+
},
|
|
3293
|
+
onBlur: ({ target: { value: currentValue } }) => {
|
|
3294
|
+
emitHigh(currentValue);
|
|
3295
|
+
},
|
|
3296
|
+
onKeyDown: ({ code, target }) => {
|
|
3297
|
+
if (code === "Enter") {
|
|
3298
|
+
emitHigh(target.value);
|
|
3299
|
+
}
|
|
3300
|
+
},
|
|
3301
|
+
value: highValue
|
|
3302
|
+
}
|
|
3303
|
+
) }),
|
|
3304
|
+
filter.isSize && /* @__PURE__ */ jsx(
|
|
3305
|
+
Select$1,
|
|
3306
|
+
{
|
|
3307
|
+
className: "ApiaFilter__Range__UnitSelector",
|
|
3308
|
+
onChange: (ev) => {
|
|
3309
|
+
const unit2 = ev.target.value;
|
|
3310
|
+
const index = units.indexOf(unit2);
|
|
3311
|
+
if (index !== -1) {
|
|
3312
|
+
multiplier.current = 2 ** (index * 10);
|
|
3313
|
+
setUnit(multiplier.current);
|
|
3314
|
+
emitLow(lastEmittedLow.current ?? "");
|
|
3315
|
+
}
|
|
3316
|
+
},
|
|
3317
|
+
value: units[Math.log2(unit || 1) / 10],
|
|
3318
|
+
children: units.map((c) => /* @__PURE__ */ jsx("option", { value: c, children: c }, c))
|
|
3319
|
+
}
|
|
3320
|
+
)
|
|
3321
|
+
]
|
|
3322
|
+
}
|
|
3323
|
+
);
|
|
3270
3324
|
}
|
|
3271
3325
|
);
|
|
3272
3326
|
|
|
3273
3327
|
const SelectFilterRenderer = observer(
|
|
3274
3328
|
({ filter, state }) => {
|
|
3275
|
-
const { onFilterChange } = useResponsiveTableContext();
|
|
3276
3329
|
return /* @__PURE__ */ jsx(
|
|
3277
3330
|
Select$1,
|
|
3278
3331
|
{
|
|
3279
3332
|
value: state.value,
|
|
3280
3333
|
onChange: (ev) => {
|
|
3281
3334
|
state.value = ev.target.value;
|
|
3282
|
-
onFilterChange?.(filter);
|
|
3283
3335
|
},
|
|
3284
3336
|
children: arrayOrArray(filter.options).map((c) => /* @__PURE__ */ jsx("option", { value: c.value, children: c.label }, c.value))
|
|
3285
3337
|
}
|
|
@@ -3310,20 +3362,43 @@ const InputFilterRenderer = observer(
|
|
|
3310
3362
|
}
|
|
3311
3363
|
);
|
|
3312
3364
|
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3365
|
+
const DateFilterRenderer = observer(
|
|
3366
|
+
({ filter, state }) => {
|
|
3367
|
+
const { onFilterBlur, onFilterPressEnter } = useResponsiveTableContext();
|
|
3368
|
+
return /* @__PURE__ */ jsx(
|
|
3369
|
+
DateInput,
|
|
3370
|
+
{
|
|
3371
|
+
value: state.value,
|
|
3372
|
+
onChange: (date) => {
|
|
3373
|
+
state.value = date;
|
|
3374
|
+
},
|
|
3375
|
+
onKeyDown: (ev) => {
|
|
3376
|
+
if (ev.code === "Enter") {
|
|
3377
|
+
onFilterPressEnter?.(filter);
|
|
3378
|
+
}
|
|
3379
|
+
},
|
|
3380
|
+
onBlur: () => {
|
|
3381
|
+
onFilterBlur?.(filter);
|
|
3382
|
+
}
|
|
3383
|
+
}
|
|
3384
|
+
);
|
|
3385
|
+
}
|
|
3386
|
+
);
|
|
3387
|
+
|
|
3388
|
+
var __defProp$5 = Object.defineProperty;
|
|
3389
|
+
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3390
|
+
var __publicField$5 = (obj, key, value) => {
|
|
3391
|
+
__defNormalProp$5(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
3317
3392
|
return value;
|
|
3318
3393
|
};
|
|
3319
3394
|
class Filter {
|
|
3320
3395
|
constructor(properties) {
|
|
3321
|
-
__publicField$
|
|
3322
|
-
__publicField$
|
|
3396
|
+
__publicField$5(this, "tableName");
|
|
3397
|
+
__publicField$5(this, "filterState", {
|
|
3323
3398
|
runAutomatically: false,
|
|
3324
3399
|
value: ""
|
|
3325
3400
|
});
|
|
3326
|
-
__publicField$
|
|
3401
|
+
__publicField$5(this, "Component", observer(({ filter }) => {
|
|
3327
3402
|
const { name } = useResponsiveTableContext();
|
|
3328
3403
|
this.tableName = name;
|
|
3329
3404
|
if (this.filterState.isRange) {
|
|
@@ -3332,6 +3407,9 @@ class Filter {
|
|
|
3332
3407
|
if (arrayOrArray(this.filterState.options).length > 0) {
|
|
3333
3408
|
return this.getSelectRenderer({ filter });
|
|
3334
3409
|
}
|
|
3410
|
+
if (this.filterState.type === "D") {
|
|
3411
|
+
return this.getDateRenderer({ filter });
|
|
3412
|
+
}
|
|
3335
3413
|
return this.getInputRenderer({ filter });
|
|
3336
3414
|
}));
|
|
3337
3415
|
Object.assign(this.filterState, properties);
|
|
@@ -3347,6 +3425,28 @@ class Filter {
|
|
|
3347
3425
|
}
|
|
3348
3426
|
}
|
|
3349
3427
|
);
|
|
3428
|
+
reaction(
|
|
3429
|
+
() => this.filterState.valueTo,
|
|
3430
|
+
() => {
|
|
3431
|
+
if (this.tableName) {
|
|
3432
|
+
getResponsiveTableContext(this.tableName).onFilterChange?.({
|
|
3433
|
+
id: properties.id,
|
|
3434
|
+
column: properties.column
|
|
3435
|
+
});
|
|
3436
|
+
}
|
|
3437
|
+
}
|
|
3438
|
+
);
|
|
3439
|
+
reaction(
|
|
3440
|
+
() => this.filterState.multiplier,
|
|
3441
|
+
() => {
|
|
3442
|
+
if (this.tableName) {
|
|
3443
|
+
getResponsiveTableContext(this.tableName).onFilterChange?.({
|
|
3444
|
+
id: properties.id,
|
|
3445
|
+
column: properties.column
|
|
3446
|
+
});
|
|
3447
|
+
}
|
|
3448
|
+
}
|
|
3449
|
+
);
|
|
3350
3450
|
}
|
|
3351
3451
|
focus() {
|
|
3352
3452
|
}
|
|
@@ -3359,82 +3459,8 @@ class Filter {
|
|
|
3359
3459
|
getRangeRenderer({ filter }) {
|
|
3360
3460
|
return /* @__PURE__ */ jsx(RangeFilterRenderer, { filter, state: this.filterState });
|
|
3361
3461
|
}
|
|
3362
|
-
}
|
|
3363
|
-
|
|
3364
|
-
const FilterTypesComponent = observer(
|
|
3365
|
-
({ filterTypes }) => {
|
|
3366
|
-
return /* @__PURE__ */ jsx(Fragment, { children: filterTypes.conditions.map((f, idx) => {
|
|
3367
|
-
const options = arrayOrArray(f.options.option);
|
|
3368
|
-
return /* @__PURE__ */ jsxs(Label, { children: [
|
|
3369
|
-
/* @__PURE__ */ jsxs(Box, { as: "span", children: [
|
|
3370
|
-
f.text,
|
|
3371
|
-
":"
|
|
3372
|
-
] }),
|
|
3373
|
-
/* @__PURE__ */ jsx(
|
|
3374
|
-
Select$1,
|
|
3375
|
-
{
|
|
3376
|
-
title: f.title,
|
|
3377
|
-
onChange: (ev) => {
|
|
3378
|
-
const selectedValue = ev.target.value;
|
|
3379
|
-
filterTypes.conditions[idx].value = selectedValue;
|
|
3380
|
-
filterTypes.setFilterOptions();
|
|
3381
|
-
},
|
|
3382
|
-
disabled: f.readonly || f.disabled,
|
|
3383
|
-
value: f.value,
|
|
3384
|
-
children: options.map((option) => {
|
|
3385
|
-
return /* @__PURE__ */ jsx("option", { value: option.value, children: option.content }, option.value);
|
|
3386
|
-
})
|
|
3387
|
-
}
|
|
3388
|
-
)
|
|
3389
|
-
] }, f.name);
|
|
3390
|
-
}) });
|
|
3391
|
-
}
|
|
3392
|
-
);
|
|
3393
|
-
|
|
3394
|
-
var __defProp$5 = Object.defineProperty;
|
|
3395
|
-
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3396
|
-
var __publicField$5 = (obj, key, value) => {
|
|
3397
|
-
__defNormalProp$5(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
3398
|
-
return value;
|
|
3399
|
-
};
|
|
3400
|
-
class FilterTypes {
|
|
3401
|
-
constructor() {
|
|
3402
|
-
__publicField$5(this, "conditions", []);
|
|
3403
|
-
__publicField$5(this, "Component", () => /* @__PURE__ */ jsx(FilterTypesComponent, { filterTypes: this }));
|
|
3404
|
-
makeObservable(this, {
|
|
3405
|
-
conditions: observable
|
|
3406
|
-
});
|
|
3407
|
-
}
|
|
3408
|
-
async getFilterTypes() {
|
|
3409
|
-
const result = await ApiaApi.post(
|
|
3410
|
-
makeApiaUrl({
|
|
3411
|
-
ajaxUrl: "apia.query.ModalAction.run?",
|
|
3412
|
-
action: "filterOptions"
|
|
3413
|
-
})
|
|
3414
|
-
);
|
|
3415
|
-
if (!result?.data?.form?.elements?.element)
|
|
3416
|
-
return;
|
|
3417
|
-
this.conditions = arrayOrArray(result.data.form.elements.element);
|
|
3418
|
-
}
|
|
3419
|
-
async initialLoad() {
|
|
3420
|
-
await this.getFilterTypes();
|
|
3421
|
-
}
|
|
3422
|
-
async setFilterOptions() {
|
|
3423
|
-
const result = await ApiaApi.post(
|
|
3424
|
-
makeApiaUrl({
|
|
3425
|
-
ajaxUrl: "apia.query.ModalAction.run?",
|
|
3426
|
-
action: "setFilterOptions"
|
|
3427
|
-
}),
|
|
3428
|
-
{
|
|
3429
|
-
postData: this.conditions.reduce((acc, c) => {
|
|
3430
|
-
acc[c.id] = c.value;
|
|
3431
|
-
return acc;
|
|
3432
|
-
}, {}),
|
|
3433
|
-
postDataTreatement: "stringify"
|
|
3434
|
-
}
|
|
3435
|
-
);
|
|
3436
|
-
if (!result)
|
|
3437
|
-
return;
|
|
3462
|
+
getDateRenderer({ filter }) {
|
|
3463
|
+
return /* @__PURE__ */ jsx(DateFilterRenderer, { filter, state: this.filterState });
|
|
3438
3464
|
}
|
|
3439
3465
|
}
|
|
3440
3466
|
|
|
@@ -3449,13 +3475,12 @@ class TableController {
|
|
|
3449
3475
|
constructor(initialState) {
|
|
3450
3476
|
__publicField$4(this, "emitter", new EventEmitter());
|
|
3451
3477
|
__publicField$4(this, "tableName", `TableController${controllerCount++}`);
|
|
3452
|
-
__publicField$4(this, "tableSelectionController");
|
|
3453
3478
|
__publicField$4(this, "controllerComponent", () => null);
|
|
3454
|
-
__publicField$4(this, "filterTypes", new FilterTypes());
|
|
3455
3479
|
__publicField$4(this, "state", {
|
|
3456
|
-
|
|
3480
|
+
finishedFirstLoad: false,
|
|
3457
3481
|
columns: /* @__PURE__ */ new Map(),
|
|
3458
3482
|
filters: /* @__PURE__ */ new Map(),
|
|
3483
|
+
isLoading: false,
|
|
3459
3484
|
pagination: { currentPage: 0, totalPages: 0, totalRecords: 0 },
|
|
3460
3485
|
props: {},
|
|
3461
3486
|
rows: []
|
|
@@ -3464,44 +3489,57 @@ class TableController {
|
|
|
3464
3489
|
return /* @__PURE__ */ jsx(
|
|
3465
3490
|
TableLoadingContext.Provider,
|
|
3466
3491
|
{
|
|
3467
|
-
value: { current: this.state.
|
|
3492
|
+
value: { current: this.state.finishedFirstLoad },
|
|
3468
3493
|
children: /* @__PURE__ */ jsx(this.TableContext, { children })
|
|
3469
3494
|
}
|
|
3470
3495
|
);
|
|
3471
3496
|
}));
|
|
3472
|
-
__publicField$4(this, "TableContext",
|
|
3473
|
-
|
|
3474
|
-
|
|
3475
|
-
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
this.emitter,
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
3497
|
+
__publicField$4(this, "TableContext", observer(
|
|
3498
|
+
({ children }) => {
|
|
3499
|
+
const state = this.state;
|
|
3500
|
+
const props = toJS(state.props);
|
|
3501
|
+
const columns = useMemo(
|
|
3502
|
+
() => [...toJS(state.columns).values()],
|
|
3503
|
+
[state.columns]
|
|
3504
|
+
);
|
|
3505
|
+
return /* @__PURE__ */ jsx(
|
|
3506
|
+
ResponsiveTableContext,
|
|
3507
|
+
{
|
|
3508
|
+
...props,
|
|
3509
|
+
columns,
|
|
3510
|
+
rows: useMemo(() => [], []),
|
|
3511
|
+
filters: useMemo(() => this.parseFilters(), [this.state.filters]),
|
|
3512
|
+
FiltersRenderer: useCallback(
|
|
3513
|
+
(filterId) => this.state.filters.get(filterId).Component,
|
|
3514
|
+
[]
|
|
3515
|
+
),
|
|
3516
|
+
customLabels: {
|
|
3517
|
+
noRegisters: this.state.finishedFirstLoad ? defaultLabels.noRegisters : ""
|
|
3518
|
+
},
|
|
3519
|
+
name: this.tableName,
|
|
3520
|
+
SelectionHandler: this.controllerComponent,
|
|
3521
|
+
onSortChange: this.emitter.emit.bind(this.emitter, "onSortChange"),
|
|
3522
|
+
onChangeSelection: this.emitter.emit.bind(
|
|
3523
|
+
this.emitter,
|
|
3524
|
+
"onChangeSelection"
|
|
3525
|
+
),
|
|
3526
|
+
onFilterBlur: this.emitter.emit.bind(this.emitter, "onFilterBlur"),
|
|
3527
|
+
onFilterChange: this.emitter.emit.bind(
|
|
3528
|
+
this.emitter,
|
|
3529
|
+
"onFilterChange"
|
|
3530
|
+
),
|
|
3531
|
+
onFilterPressEnter: this.emitter.emit.bind(
|
|
3532
|
+
this.emitter,
|
|
3533
|
+
"onFilterPressEnter"
|
|
3534
|
+
),
|
|
3535
|
+
onRowClick: this.emitter.emit.bind(this.emitter, "onRowClick"),
|
|
3536
|
+
onSelectRows: this.emitter.emit.bind(this.emitter, "onSelectRows"),
|
|
3537
|
+
isLoading: this.state.isLoading,
|
|
3538
|
+
children
|
|
3539
|
+
}
|
|
3540
|
+
);
|
|
3541
|
+
}
|
|
3542
|
+
));
|
|
3505
3543
|
__publicField$4(this, "Pagination", observer(() => {
|
|
3506
3544
|
return /* @__PURE__ */ jsx(
|
|
3507
3545
|
Pagination,
|
|
@@ -3510,7 +3548,9 @@ class TableController {
|
|
|
3510
3548
|
pageCount: this.state.pagination.totalPages,
|
|
3511
3549
|
recordsCount: this.state.pagination.totalRecords,
|
|
3512
3550
|
onPageChange: this.emitter.emit.bind(this.emitter, "onPage"),
|
|
3513
|
-
onRefresh: this.emitter.emit.bind(this.emitter, "onRefresh", null)
|
|
3551
|
+
onRefresh: this.emitter.emit.bind(this.emitter, "onRefresh", null),
|
|
3552
|
+
isLoading: this.state.isLoading,
|
|
3553
|
+
hideMaximizeButton: true
|
|
3514
3554
|
}
|
|
3515
3555
|
);
|
|
3516
3556
|
}));
|
|
@@ -3519,8 +3559,7 @@ class TableController {
|
|
|
3519
3559
|
state: observable,
|
|
3520
3560
|
updateState: action
|
|
3521
3561
|
});
|
|
3522
|
-
const [
|
|
3523
|
-
this.tableSelectionController = controller;
|
|
3562
|
+
const [, controllerComponent] = makeController2(this.tableName);
|
|
3524
3563
|
this.controllerComponent = controllerComponent;
|
|
3525
3564
|
if (initialState) {
|
|
3526
3565
|
Object.assign(this.state, initialState);
|
|
@@ -3565,12 +3604,14 @@ class TableController {
|
|
|
3565
3604
|
parseFilters() {
|
|
3566
3605
|
return [...toJS(this.state.filters).values()].map((c) => {
|
|
3567
3606
|
return {
|
|
3607
|
+
...c.filterState,
|
|
3568
3608
|
id: c.filterState.id,
|
|
3569
|
-
column: c.filterState.column,
|
|
3609
|
+
column: c.filterState.isAdditional ? "" : c.filterState.column,
|
|
3570
3610
|
asAdditional: c.filterState.isAdditional || this.state.columns.get(c.filterState.column || "")?.hidden,
|
|
3571
3611
|
options: c.filterState.options,
|
|
3572
3612
|
detectOnChange: c.filterState.runAutomatically,
|
|
3573
|
-
runAutomatically: c.filterState.runAutomatically
|
|
3613
|
+
runAutomatically: c.filterState.runAutomatically,
|
|
3614
|
+
title: c.filterState.title
|
|
3574
3615
|
};
|
|
3575
3616
|
});
|
|
3576
3617
|
}
|
|
@@ -3605,23 +3646,62 @@ class QueryController {
|
|
|
3605
3646
|
this.ajaxUrl = ajaxUrl;
|
|
3606
3647
|
__publicField$3(this, "hasInited", false);
|
|
3607
3648
|
__publicField$3(this, "initializing", false);
|
|
3649
|
+
__publicField$3(this, "mutex", new Mutex());
|
|
3608
3650
|
__publicField$3(this, "structure", null);
|
|
3609
3651
|
__publicField$3(this, "tableController");
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
*/
|
|
3613
|
-
__publicField$3(this, "executeRefresh", throttle(
|
|
3614
|
-
async () => {
|
|
3615
|
-
await this.actualRefreshMethod();
|
|
3616
|
-
},
|
|
3617
|
-
300,
|
|
3618
|
-
{ leading: false, trailing: true }
|
|
3619
|
-
));
|
|
3652
|
+
__publicField$3(this, "conditions", []);
|
|
3653
|
+
__publicField$3(this, "timeout", -1);
|
|
3620
3654
|
this.tableController = this.buildTableController();
|
|
3621
3655
|
this.initEvents();
|
|
3656
|
+
makeObservable(this, { conditions: observable, isLoading: computed });
|
|
3657
|
+
reaction(
|
|
3658
|
+
() => this.mutex.isBusy,
|
|
3659
|
+
() => this.tableController.state.isLoading = this.mutex.isBusy
|
|
3660
|
+
);
|
|
3661
|
+
}
|
|
3662
|
+
async actualRefreshMethod() {
|
|
3663
|
+
const newValues = this.getFiltersValuesMap();
|
|
3664
|
+
if (!this.areRequiredFilters()) {
|
|
3665
|
+
await this.mutex.acquire();
|
|
3666
|
+
try {
|
|
3667
|
+
this.tableController.state.finishedFirstLoad = false;
|
|
3668
|
+
const refresh = await ApiaApi.post(
|
|
3669
|
+
makeApiaUrl(this.getRefreshParameters()),
|
|
3670
|
+
{
|
|
3671
|
+
postData: newValues,
|
|
3672
|
+
postDataTreatement: "stringify",
|
|
3673
|
+
stringifyOptions: { arrayFormat: "repeat" }
|
|
3674
|
+
}
|
|
3675
|
+
);
|
|
3676
|
+
this.parseRefreshResponse(refresh?.data);
|
|
3677
|
+
} finally {
|
|
3678
|
+
this.tableController.state.finishedFirstLoad = true;
|
|
3679
|
+
this.mutex.release();
|
|
3680
|
+
}
|
|
3681
|
+
}
|
|
3682
|
+
}
|
|
3683
|
+
areRequiredFilters() {
|
|
3684
|
+
return !![...this.tableController.state.filters.values()].find(
|
|
3685
|
+
(c) => c.filterState.required && !c.filterState.value && !c.filterState.isHidden
|
|
3686
|
+
);
|
|
3687
|
+
}
|
|
3688
|
+
buildTableController() {
|
|
3689
|
+
return new TableController();
|
|
3690
|
+
}
|
|
3691
|
+
async clearFilters() {
|
|
3692
|
+
this.tableController.state.filters.forEach((c) => {
|
|
3693
|
+
c.filterState.value = "";
|
|
3694
|
+
c.filterState.valueTo = "";
|
|
3695
|
+
});
|
|
3696
|
+
}
|
|
3697
|
+
executeRefresh() {
|
|
3698
|
+
clearTimeout(this.timeout);
|
|
3699
|
+
this.timeout = setTimeout(() => {
|
|
3700
|
+
this.actualRefreshMethod();
|
|
3701
|
+
}, 300);
|
|
3622
3702
|
}
|
|
3623
3703
|
getTableControllerDefaultProps() {
|
|
3624
|
-
return {};
|
|
3704
|
+
return { statesColumns: [] };
|
|
3625
3705
|
}
|
|
3626
3706
|
getEventsHandlers() {
|
|
3627
3707
|
return {
|
|
@@ -3643,21 +3723,20 @@ class QueryController {
|
|
|
3643
3723
|
onSelectRows: (_ev) => {
|
|
3644
3724
|
},
|
|
3645
3725
|
onSortChange: (ev) => {
|
|
3646
|
-
|
|
3726
|
+
const isDesc = ["Up", "Desc", "D"].includes(ev.sortValue ?? "A");
|
|
3727
|
+
const col = this.tableController.state?.columns.get(ev.column.name);
|
|
3728
|
+
if (col) {
|
|
3729
|
+
col.currentSorting = isDesc ? "D" : "A";
|
|
3730
|
+
this.tableController.state.columns = new Map(
|
|
3731
|
+
this.tableController.state.columns
|
|
3732
|
+
);
|
|
3733
|
+
}
|
|
3734
|
+
this.sort(String(ev.columnIndex), isDesc ? "Des" : "Asc");
|
|
3647
3735
|
},
|
|
3648
3736
|
onPage: this.page.bind(this),
|
|
3649
3737
|
onRefresh: () => this.refresh(true)
|
|
3650
3738
|
};
|
|
3651
3739
|
}
|
|
3652
|
-
buildTableController() {
|
|
3653
|
-
return new TableController();
|
|
3654
|
-
}
|
|
3655
|
-
initEvents() {
|
|
3656
|
-
const handlers = this.getEventsHandlers();
|
|
3657
|
-
Object.entries(handlers).forEach(([eventName, handler]) => {
|
|
3658
|
-
this.tableController.on(eventName, handler.bind(this));
|
|
3659
|
-
});
|
|
3660
|
-
}
|
|
3661
3740
|
getLoadStructureParameters() {
|
|
3662
3741
|
return {
|
|
3663
3742
|
ajaxUrl: this.ajaxUrl,
|
|
@@ -3676,13 +3755,16 @@ class QueryController {
|
|
|
3676
3755
|
getFiltersValuesMap() {
|
|
3677
3756
|
return [...this.tableController.state.filters.values()].reduce((result, filterWrapper) => {
|
|
3678
3757
|
const { id, value, filterToId, valueTo } = filterWrapper.filterState;
|
|
3679
|
-
result[id] = value;
|
|
3680
|
-
if (filterToId !== void 0 && valueTo
|
|
3681
|
-
result[filterToId] = valueTo;
|
|
3758
|
+
result[id] = filterWrapper.filterState.multiplier ? value * filterWrapper.filterState.multiplier : value;
|
|
3759
|
+
if (filterToId !== void 0 && valueTo) {
|
|
3760
|
+
result[filterToId] = filterWrapper.filterState.multiplier ? valueTo * filterWrapper.filterState.multiplier : valueTo;
|
|
3682
3761
|
}
|
|
3683
3762
|
return result;
|
|
3684
3763
|
}, {});
|
|
3685
3764
|
}
|
|
3765
|
+
get isLoading() {
|
|
3766
|
+
return this.mutex.isBusy;
|
|
3767
|
+
}
|
|
3686
3768
|
getPageParameters() {
|
|
3687
3769
|
return {
|
|
3688
3770
|
ajaxUrl: this.ajaxUrl,
|
|
@@ -3704,6 +3786,62 @@ class QueryController {
|
|
|
3704
3786
|
orderJustThisColumn: true
|
|
3705
3787
|
};
|
|
3706
3788
|
}
|
|
3789
|
+
async getStructure() {
|
|
3790
|
+
const result = await ApiaApi.post(
|
|
3791
|
+
makeApiaUrl(this.getLoadStructureParameters())
|
|
3792
|
+
);
|
|
3793
|
+
if (!result?.data) {
|
|
3794
|
+
throw new Error("Cannot load Input query structure");
|
|
3795
|
+
}
|
|
3796
|
+
return this.parseLoadStructureResponse(result.data);
|
|
3797
|
+
}
|
|
3798
|
+
initEvents() {
|
|
3799
|
+
const handlers = this.getEventsHandlers();
|
|
3800
|
+
Object.entries(handlers).forEach(([eventName, handler]) => {
|
|
3801
|
+
this.tableController.on(eventName, handler.bind(this));
|
|
3802
|
+
});
|
|
3803
|
+
}
|
|
3804
|
+
async initialLoad() {
|
|
3805
|
+
if (this.initializing && !this.hasInited) {
|
|
3806
|
+
throw new Error("Cannot initialize the query twice");
|
|
3807
|
+
}
|
|
3808
|
+
this.initializing = true;
|
|
3809
|
+
if (!this.hasInited) {
|
|
3810
|
+
const structure = await this.getStructure();
|
|
3811
|
+
this.structure = structure;
|
|
3812
|
+
this.parseStructure(structure);
|
|
3813
|
+
this.tableController.updateState({
|
|
3814
|
+
props: this.getTableControllerDefaultProps()
|
|
3815
|
+
});
|
|
3816
|
+
this.hasInited = true;
|
|
3817
|
+
this.initializing = false;
|
|
3818
|
+
this.loadFilterTypes();
|
|
3819
|
+
}
|
|
3820
|
+
}
|
|
3821
|
+
async loadFilterTypes() {
|
|
3822
|
+
if (!this.structure?.hideFilterTypes) {
|
|
3823
|
+
const result = await ApiaApi.post(
|
|
3824
|
+
makeApiaUrl({
|
|
3825
|
+
ajaxUrl: "apia.query.ModalAction.run?",
|
|
3826
|
+
action: "filterOptions"
|
|
3827
|
+
})
|
|
3828
|
+
);
|
|
3829
|
+
if (result?.data?.form?.elements?.element) {
|
|
3830
|
+
this.conditions = arrayOrArray(result.data.form.elements.element);
|
|
3831
|
+
}
|
|
3832
|
+
}
|
|
3833
|
+
}
|
|
3834
|
+
async page(num) {
|
|
3835
|
+
await this.mutex.acquire();
|
|
3836
|
+
try {
|
|
3837
|
+
const page = await ApiaApi.post(
|
|
3838
|
+
makeApiaUrl({ ...this.getPageParameters(), pageNumber: num })
|
|
3839
|
+
);
|
|
3840
|
+
this.parseRefreshResponse(page?.data);
|
|
3841
|
+
} finally {
|
|
3842
|
+
this.mutex.release();
|
|
3843
|
+
}
|
|
3844
|
+
}
|
|
3707
3845
|
parseLoadStructureResponse(response) {
|
|
3708
3846
|
const typedResponse = response;
|
|
3709
3847
|
const retrievedColumns = arrayOrArray(typedResponse.columns.column);
|
|
@@ -3713,11 +3851,11 @@ class QueryController {
|
|
|
3713
3851
|
label: c.title,
|
|
3714
3852
|
name: c.name,
|
|
3715
3853
|
additionalData: c,
|
|
3716
|
-
allowSorting: c.enableOrder
|
|
3854
|
+
allowSorting: c.enableOrder !== false,
|
|
3717
3855
|
ariaLabel: c.title,
|
|
3718
3856
|
currentSorting: c.order,
|
|
3719
|
-
hidden: c.hide === "1",
|
|
3720
|
-
hideFromAccordion: c.hide ===
|
|
3857
|
+
hidden: c.hide === true || c.hide == "1",
|
|
3858
|
+
hideFromAccordion: c.hide === true,
|
|
3721
3859
|
id: c.name,
|
|
3722
3860
|
showAsAdditional: c.asMoreInformation,
|
|
3723
3861
|
title: c.toolTip,
|
|
@@ -3725,13 +3863,13 @@ class QueryController {
|
|
|
3725
3863
|
};
|
|
3726
3864
|
return column;
|
|
3727
3865
|
}),
|
|
3728
|
-
description: typedResponse.queryData
|
|
3866
|
+
description: typedResponse.queryData?.description,
|
|
3729
3867
|
filters: arrayOrArray(typedResponse.filters.filter).filter((f) => !!f.column).map((f, i) => {
|
|
3730
3868
|
const filter = {
|
|
3731
|
-
id: `filter${String(i + 1)}`,
|
|
3869
|
+
id: f.id ?? `filter${String(i + 1)}`,
|
|
3732
3870
|
// Id generado en APIA
|
|
3733
|
-
value: f.currentValue,
|
|
3734
3871
|
filterToId: f?.filterToId,
|
|
3872
|
+
value: f.currentValue,
|
|
3735
3873
|
valueTo: f?.filterToValue,
|
|
3736
3874
|
avoidLabel: false,
|
|
3737
3875
|
column: f.column,
|
|
@@ -3754,7 +3892,7 @@ class QueryController {
|
|
|
3754
3892
|
(c) => c.asMoreInformation
|
|
3755
3893
|
),
|
|
3756
3894
|
isDynamic: false,
|
|
3757
|
-
title: typedResponse.queryData
|
|
3895
|
+
title: typedResponse.queryData?.title,
|
|
3758
3896
|
openFiltersAutomatically: typedResponse.filters.openFiltersAutomatically,
|
|
3759
3897
|
runFiltersAutomatically: typedResponse.filters.runFiltersAutomatically,
|
|
3760
3898
|
hideFilterTypes: typedResponse.filters.hideFilterTypes
|
|
@@ -3780,20 +3918,11 @@ class QueryController {
|
|
|
3780
3918
|
}))
|
|
3781
3919
|
].filter(Boolean),
|
|
3782
3920
|
className: r.classToAdd,
|
|
3783
|
-
id: r.id
|
|
3921
|
+
id: r.id ?? uniqueId$1("row")
|
|
3784
3922
|
};
|
|
3785
3923
|
})
|
|
3786
3924
|
]);
|
|
3787
3925
|
}
|
|
3788
|
-
async getStructure() {
|
|
3789
|
-
const result = await ApiaApi.post(
|
|
3790
|
-
makeApiaUrl(this.getLoadStructureParameters())
|
|
3791
|
-
);
|
|
3792
|
-
if (!result?.data) {
|
|
3793
|
-
throw new Error("Cannot load Input query structure");
|
|
3794
|
-
}
|
|
3795
|
-
return this.parseLoadStructureResponse(result.data);
|
|
3796
|
-
}
|
|
3797
3926
|
parseStructure(structure) {
|
|
3798
3927
|
const columns = new Map(
|
|
3799
3928
|
arrayOrArray(structure.columns).map((c) => [c.name, c])
|
|
@@ -3803,139 +3932,156 @@ class QueryController {
|
|
|
3803
3932
|
return [f.id, new Filter(f)];
|
|
3804
3933
|
})
|
|
3805
3934
|
);
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
}
|
|
3811
|
-
updatePageState(pageInfo) {
|
|
3812
|
-
const currentPage = Number(pageInfo?.currentPage ?? 0);
|
|
3813
|
-
const totalPages = Number(pageInfo?.pageCount ?? 0);
|
|
3814
|
-
const totalRecords = Number(pageInfo?.totalRecords ?? 0);
|
|
3815
|
-
this.tableController.updateState({
|
|
3816
|
-
pagination: { currentPage, totalPages, totalRecords }
|
|
3817
|
-
});
|
|
3818
|
-
}
|
|
3819
|
-
updateRows(rows) {
|
|
3820
|
-
this.tableController.state.rows = rows;
|
|
3821
|
-
}
|
|
3822
|
-
async clearFilters() {
|
|
3823
|
-
const result = await ApiaApi.post(
|
|
3824
|
-
makeApiaUrl({ ...this.getClearFiltersParameters() })
|
|
3825
|
-
);
|
|
3826
|
-
if (!result?.data)
|
|
3827
|
-
return;
|
|
3828
|
-
const structure = this.parseLoadStructureResponse(result.data);
|
|
3829
|
-
this.parseStructure(structure);
|
|
3830
|
-
this.refresh();
|
|
3831
|
-
}
|
|
3832
|
-
async initialLoad() {
|
|
3833
|
-
if (this.initializing && !this.hasInited) {
|
|
3834
|
-
throw new Error("Cannot initialize the query twice");
|
|
3935
|
+
if (columns.size) {
|
|
3936
|
+
this.tableController.updateState({
|
|
3937
|
+
columns
|
|
3938
|
+
});
|
|
3835
3939
|
}
|
|
3836
|
-
|
|
3837
|
-
if (!this.hasInited) {
|
|
3838
|
-
this.structure = await this.getStructure();
|
|
3839
|
-
this.parseStructure(this.structure);
|
|
3940
|
+
if (filters.size) {
|
|
3840
3941
|
this.tableController.updateState({
|
|
3841
|
-
|
|
3942
|
+
filters
|
|
3842
3943
|
});
|
|
3843
|
-
this.hasInited = true;
|
|
3844
|
-
this.initializing = false;
|
|
3845
3944
|
}
|
|
3846
3945
|
}
|
|
3847
|
-
async
|
|
3848
|
-
|
|
3849
|
-
makeApiaUrl({ ...this.getPageParameters(), pageNumber: num })
|
|
3850
|
-
);
|
|
3851
|
-
this.parseRefreshResponse(page?.data);
|
|
3946
|
+
async refresh(now = true) {
|
|
3947
|
+
return now ? this.actualRefreshMethod() : this.executeRefresh();
|
|
3852
3948
|
}
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
(
|
|
3949
|
+
async setFilterOptions() {
|
|
3950
|
+
await ApiaApi.post(
|
|
3951
|
+
makeApiaUrl({
|
|
3952
|
+
ajaxUrl: this.ajaxUrl,
|
|
3953
|
+
action: "setFilterOptions"
|
|
3954
|
+
}),
|
|
3955
|
+
{
|
|
3956
|
+
postData: this.conditions.reduce((acc, c) => {
|
|
3957
|
+
acc[c.id] = c.value;
|
|
3958
|
+
return acc;
|
|
3959
|
+
}, {}),
|
|
3960
|
+
postDataTreatement: "stringify"
|
|
3961
|
+
}
|
|
3856
3962
|
);
|
|
3857
3963
|
}
|
|
3858
|
-
async
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
{
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
}
|
|
3964
|
+
async sort(column, orderType) {
|
|
3965
|
+
await this.mutex.acquire();
|
|
3966
|
+
try {
|
|
3967
|
+
const result = await ApiaApi.post(
|
|
3968
|
+
makeApiaUrl({
|
|
3969
|
+
...this.getSortParameters(),
|
|
3970
|
+
orderBy: column,
|
|
3971
|
+
orderType
|
|
3972
|
+
})
|
|
3867
3973
|
);
|
|
3868
|
-
|
|
3974
|
+
if (result?.data) {
|
|
3975
|
+
const structure = this.parseLoadStructureResponse(result.data);
|
|
3976
|
+
this.parseStructure(structure);
|
|
3977
|
+
this.parseRefreshResponse(result.data);
|
|
3978
|
+
}
|
|
3979
|
+
} finally {
|
|
3980
|
+
this.mutex.release();
|
|
3869
3981
|
}
|
|
3870
3982
|
}
|
|
3871
|
-
|
|
3872
|
-
|
|
3983
|
+
updatePageState(pageInfo) {
|
|
3984
|
+
const currentPage = Number(pageInfo?.currentPage ?? 0);
|
|
3985
|
+
const totalPages = Number(pageInfo?.pageCount ?? 0);
|
|
3986
|
+
const totalRecords = Number(pageInfo?.totalRecords ?? 0);
|
|
3987
|
+
this.tableController.updateState({
|
|
3988
|
+
pagination: { currentPage, totalPages, totalRecords }
|
|
3989
|
+
});
|
|
3873
3990
|
}
|
|
3874
|
-
|
|
3875
|
-
|
|
3876
|
-
makeApiaUrl({ ...this.getSortParameters(), orderBy: column })
|
|
3877
|
-
);
|
|
3878
|
-
if (result?.data) {
|
|
3879
|
-
const structure = this.parseLoadStructureResponse(result.data);
|
|
3880
|
-
this.parseStructure(structure);
|
|
3881
|
-
}
|
|
3882
|
-
this.refresh();
|
|
3991
|
+
updateRows(rows) {
|
|
3992
|
+
this.tableController.state.rows = rows;
|
|
3883
3993
|
}
|
|
3884
3994
|
}
|
|
3885
3995
|
|
|
3996
|
+
const FilterTypesComponent = observer(
|
|
3997
|
+
({ queryController }) => {
|
|
3998
|
+
return /* @__PURE__ */ jsx(Fragment, { children: queryController.conditions.map((f, idx) => {
|
|
3999
|
+
const options = arrayOrArray(f.options.option);
|
|
4000
|
+
return /* @__PURE__ */ jsxs(Label, { children: [
|
|
4001
|
+
/* @__PURE__ */ jsxs(Box, { as: "span", children: [
|
|
4002
|
+
f.text,
|
|
4003
|
+
":"
|
|
4004
|
+
] }),
|
|
4005
|
+
/* @__PURE__ */ jsx(
|
|
4006
|
+
Select$1,
|
|
4007
|
+
{
|
|
4008
|
+
title: f.title,
|
|
4009
|
+
onChange: (ev) => {
|
|
4010
|
+
const selectedValue = ev.target.value;
|
|
4011
|
+
queryController.conditions[idx].value = selectedValue;
|
|
4012
|
+
queryController.setFilterOptions();
|
|
4013
|
+
},
|
|
4014
|
+
disabled: f.readonly || f.disabled,
|
|
4015
|
+
value: f.value,
|
|
4016
|
+
children: options.map((option) => {
|
|
4017
|
+
return /* @__PURE__ */ jsx("option", { value: option.value, children: option.content }, option.value);
|
|
4018
|
+
})
|
|
4019
|
+
}
|
|
4020
|
+
)
|
|
4021
|
+
] }, f.name);
|
|
4022
|
+
}) });
|
|
4023
|
+
}
|
|
4024
|
+
);
|
|
4025
|
+
|
|
3886
4026
|
const AdditionalFiltersComponent = ({
|
|
3887
|
-
|
|
4027
|
+
queryController
|
|
3888
4028
|
}) => {
|
|
3889
4029
|
const filterTitle = getLabel("sbtFilters").text;
|
|
3890
4030
|
const sortTitle = getLabel("titOrderBy").text;
|
|
3891
4031
|
const filterTypes = getLabel("btnFilterType").text;
|
|
3892
|
-
const hasAdditional = !![
|
|
3893
|
-
(
|
|
3894
|
-
);
|
|
3895
|
-
const hasFilters = !![
|
|
3896
|
-
|
|
3897
|
-
);
|
|
3898
|
-
const hasSortable = !![
|
|
3899
|
-
(
|
|
4032
|
+
const hasAdditional = !![
|
|
4033
|
+
...queryController.tableController.state.filters.values()
|
|
4034
|
+
].find((f) => f.filterState.isAdditional || !f.filterState.column);
|
|
4035
|
+
const hasFilters = !![
|
|
4036
|
+
...queryController.tableController.state.filters.values()
|
|
4037
|
+
].find((f) => !f.filterState.isAdditional && f.filterState.column);
|
|
4038
|
+
const hasSortable = !![
|
|
4039
|
+
...queryController.tableController.state.columns.values()
|
|
4040
|
+
].find((c) => c.allowSorting !== false);
|
|
4041
|
+
return /* @__PURE__ */ jsx(
|
|
4042
|
+
TableContextReproducer,
|
|
4043
|
+
{
|
|
4044
|
+
tableName: queryController.tableController.getTableName(),
|
|
4045
|
+
children: /* @__PURE__ */ jsxs(Accordion, { className: "additionalFiltersContent", singleExpand: true, children: [
|
|
4046
|
+
hasFilters && /* @__PURE__ */ jsx(
|
|
4047
|
+
AccordionItem,
|
|
4048
|
+
{
|
|
4049
|
+
id: "Responsive",
|
|
4050
|
+
defaultExpanded: true,
|
|
4051
|
+
buttonProps: { ariaLabel: filterTitle, label: filterTitle },
|
|
4052
|
+
children: /* @__PURE__ */ jsx(Responsive, {})
|
|
4053
|
+
}
|
|
4054
|
+
),
|
|
4055
|
+
hasAdditional && /* @__PURE__ */ jsx(
|
|
4056
|
+
AccordionItem,
|
|
4057
|
+
{
|
|
4058
|
+
id: "Additional",
|
|
4059
|
+
buttonProps: {
|
|
4060
|
+
ariaLabel: window.ADDITIONAL_FILTERS_LABEL,
|
|
4061
|
+
label: window.ADDITIONAL_FILTERS_LABEL
|
|
4062
|
+
},
|
|
4063
|
+
children: /* @__PURE__ */ jsx(Additional, {})
|
|
4064
|
+
}
|
|
4065
|
+
),
|
|
4066
|
+
hasSortable && /* @__PURE__ */ jsx(
|
|
4067
|
+
AccordionItem,
|
|
4068
|
+
{
|
|
4069
|
+
id: "Sort",
|
|
4070
|
+
buttonProps: { ariaLabel: sortTitle, label: sortTitle },
|
|
4071
|
+
children: /* @__PURE__ */ jsx(Sort, {})
|
|
4072
|
+
}
|
|
4073
|
+
),
|
|
4074
|
+
hasFilters && !queryController.structure?.hideFilterTypes && /* @__PURE__ */ jsx(
|
|
4075
|
+
AccordionItem,
|
|
4076
|
+
{
|
|
4077
|
+
id: "FilterTypes",
|
|
4078
|
+
buttonProps: { ariaLabel: filterTypes, label: filterTypes },
|
|
4079
|
+
children: /* @__PURE__ */ jsx(FilterTypesComponent, { queryController })
|
|
4080
|
+
}
|
|
4081
|
+
)
|
|
4082
|
+
] })
|
|
4083
|
+
}
|
|
3900
4084
|
);
|
|
3901
|
-
return /* @__PURE__ */ jsx(TableContextReproducer, { tableName: tableController.getTableName(), children: /* @__PURE__ */ jsxs(Accordion, { className: "additionalFiltersContent", singleExpand: true, children: [
|
|
3902
|
-
hasFilters && /* @__PURE__ */ jsx(
|
|
3903
|
-
AccordionItem,
|
|
3904
|
-
{
|
|
3905
|
-
id: "Responsive",
|
|
3906
|
-
defaultExpanded: true,
|
|
3907
|
-
buttonProps: { ariaLabel: filterTitle, label: filterTitle },
|
|
3908
|
-
children: /* @__PURE__ */ jsx(Responsive, {})
|
|
3909
|
-
}
|
|
3910
|
-
),
|
|
3911
|
-
hasAdditional && /* @__PURE__ */ jsx(
|
|
3912
|
-
AccordionItem,
|
|
3913
|
-
{
|
|
3914
|
-
id: "Additional",
|
|
3915
|
-
buttonProps: {
|
|
3916
|
-
ariaLabel: "todo: additional",
|
|
3917
|
-
label: "todo:additional"
|
|
3918
|
-
},
|
|
3919
|
-
children: /* @__PURE__ */ jsx(Additional, {})
|
|
3920
|
-
}
|
|
3921
|
-
),
|
|
3922
|
-
hasSortable && /* @__PURE__ */ jsx(
|
|
3923
|
-
AccordionItem,
|
|
3924
|
-
{
|
|
3925
|
-
id: "Sort",
|
|
3926
|
-
buttonProps: { ariaLabel: sortTitle, label: sortTitle },
|
|
3927
|
-
children: /* @__PURE__ */ jsx(Sort, {})
|
|
3928
|
-
}
|
|
3929
|
-
),
|
|
3930
|
-
hasFilters && /* @__PURE__ */ jsx(
|
|
3931
|
-
AccordionItem,
|
|
3932
|
-
{
|
|
3933
|
-
id: "FilterTypes",
|
|
3934
|
-
buttonProps: { ariaLabel: filterTypes, label: filterTypes },
|
|
3935
|
-
children: /* @__PURE__ */ jsx(tableController.filterTypes.Component, {})
|
|
3936
|
-
}
|
|
3937
|
-
)
|
|
3938
|
-
] }) });
|
|
3939
4085
|
};
|
|
3940
4086
|
|
|
3941
4087
|
var __defProp$2 = Object.defineProperty;
|
|
@@ -3944,6 +4090,34 @@ var __publicField$2 = (obj, key, value) => {
|
|
|
3944
4090
|
__defNormalProp$2(obj, key + "" , value);
|
|
3945
4091
|
return value;
|
|
3946
4092
|
};
|
|
4093
|
+
const ButtonsBar = observer(
|
|
4094
|
+
({ queryController }) => {
|
|
4095
|
+
return /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", flexDirection: "row", gap: "10px" }, children: [
|
|
4096
|
+
/* @__PURE__ */ jsx(
|
|
4097
|
+
SimpleButton,
|
|
4098
|
+
{
|
|
4099
|
+
variant: "primary-sm",
|
|
4100
|
+
onClick: () => {
|
|
4101
|
+
queryController.refresh();
|
|
4102
|
+
},
|
|
4103
|
+
disabled: queryController.isLoading,
|
|
4104
|
+
children: getLabel("btnSearch").text
|
|
4105
|
+
}
|
|
4106
|
+
),
|
|
4107
|
+
/* @__PURE__ */ jsx(
|
|
4108
|
+
SimpleButton,
|
|
4109
|
+
{
|
|
4110
|
+
variant: "outline-sm",
|
|
4111
|
+
onClick: () => {
|
|
4112
|
+
queryController.clearFilters();
|
|
4113
|
+
},
|
|
4114
|
+
disabled: queryController.isLoading,
|
|
4115
|
+
children: getLabel("btnClearFilter").text
|
|
4116
|
+
}
|
|
4117
|
+
)
|
|
4118
|
+
] });
|
|
4119
|
+
}
|
|
4120
|
+
);
|
|
3947
4121
|
class AdditionalFiltersModal {
|
|
3948
4122
|
constructor(queryController) {
|
|
3949
4123
|
this.queryController = queryController;
|
|
@@ -3951,39 +4125,13 @@ class AdditionalFiltersModal {
|
|
|
3951
4125
|
}
|
|
3952
4126
|
getModalDefinition() {
|
|
3953
4127
|
return {
|
|
3954
|
-
children: /* @__PURE__ */ jsx(
|
|
3955
|
-
AdditionalFiltersComponent,
|
|
3956
|
-
{
|
|
3957
|
-
tableController: this.queryController.tableController
|
|
3958
|
-
}
|
|
3959
|
-
),
|
|
4128
|
+
children: /* @__PURE__ */ jsx(AdditionalFiltersComponent, { queryController: this.queryController }),
|
|
3960
4129
|
onConfirm: () => {
|
|
3961
4130
|
},
|
|
3962
4131
|
confirmProps: {
|
|
3963
4132
|
hideConfirmButton: true,
|
|
3964
4133
|
hideCancelButton: true,
|
|
3965
|
-
additionalButtonsOnRight: /* @__PURE__ */
|
|
3966
|
-
/* @__PURE__ */ jsx(
|
|
3967
|
-
SimpleButton,
|
|
3968
|
-
{
|
|
3969
|
-
variant: "primary-sm",
|
|
3970
|
-
onClick: () => {
|
|
3971
|
-
this.queryController.refresh();
|
|
3972
|
-
},
|
|
3973
|
-
children: getLabel("btnSearch").text
|
|
3974
|
-
}
|
|
3975
|
-
),
|
|
3976
|
-
/* @__PURE__ */ jsx(
|
|
3977
|
-
SimpleButton,
|
|
3978
|
-
{
|
|
3979
|
-
variant: "outline-sm",
|
|
3980
|
-
onClick: () => {
|
|
3981
|
-
this.queryController.clearFilters();
|
|
3982
|
-
},
|
|
3983
|
-
children: getLabel("btnClearFilter").text
|
|
3984
|
-
}
|
|
3985
|
-
)
|
|
3986
|
-
] })
|
|
4134
|
+
additionalButtonsOnRight: /* @__PURE__ */ jsx(ButtonsBar, { queryController: this.queryController })
|
|
3987
4135
|
},
|
|
3988
4136
|
draggable: true,
|
|
3989
4137
|
variant: "layout.common.modals.apiaFinder.additionalFiltersModal",
|
|
@@ -3991,7 +4139,6 @@ class AdditionalFiltersModal {
|
|
|
3991
4139
|
};
|
|
3992
4140
|
}
|
|
3993
4141
|
async openModal(properties) {
|
|
3994
|
-
this.queryController.tableController.filterTypes.initialLoad();
|
|
3995
4142
|
this.modalHandler = ApiaUtil.instance.modals.open({
|
|
3996
4143
|
...this.getModalDefinition(),
|
|
3997
4144
|
...properties
|
|
@@ -4009,7 +4156,8 @@ var __publicField$1 = (obj, key, value) => {
|
|
|
4009
4156
|
return value;
|
|
4010
4157
|
};
|
|
4011
4158
|
class QueryModalController {
|
|
4012
|
-
constructor(queryController) {
|
|
4159
|
+
constructor(queryController, title) {
|
|
4160
|
+
this.title = title;
|
|
4013
4161
|
__publicField$1(this, "emitter", new EventEmitter());
|
|
4014
4162
|
__publicField$1(this, "queryController");
|
|
4015
4163
|
__publicField$1(this, "modalHandler", null);
|
|
@@ -4041,7 +4189,7 @@ class QueryModalController {
|
|
|
4041
4189
|
/* @__PURE__ */ jsx(tableController.Table, {}),
|
|
4042
4190
|
/* @__PURE__ */ jsx(tableController.Pagination, {})
|
|
4043
4191
|
] }),
|
|
4044
|
-
title: structure?.title,
|
|
4192
|
+
title: this.title ?? structure?.title,
|
|
4045
4193
|
onConfirm: () => {
|
|
4046
4194
|
this.onConfirm();
|
|
4047
4195
|
},
|
|
@@ -4054,16 +4202,6 @@ class QueryModalController {
|
|
|
4054
4202
|
cancelButtonText: getLabel("btnCan").text
|
|
4055
4203
|
},
|
|
4056
4204
|
NavBar: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4057
|
-
/* @__PURE__ */ jsx(
|
|
4058
|
-
SimpleButton,
|
|
4059
|
-
{
|
|
4060
|
-
variant: "primary-sm",
|
|
4061
|
-
onClick: () => {
|
|
4062
|
-
this.queryController.refresh();
|
|
4063
|
-
},
|
|
4064
|
-
children: getLabel("btnSearch").text
|
|
4065
|
-
}
|
|
4066
|
-
),
|
|
4067
4205
|
/* @__PURE__ */ jsx(
|
|
4068
4206
|
SimpleButton,
|
|
4069
4207
|
{
|
|
@@ -4132,6 +4270,9 @@ class GenericListQuery extends QueryController {
|
|
|
4132
4270
|
super(ajaxUrl);
|
|
4133
4271
|
this.ajaxUrl = ajaxUrl;
|
|
4134
4272
|
}
|
|
4273
|
+
getClearFiltersParameters() {
|
|
4274
|
+
return { ...super.getClearFiltersParameters(), action: "filter" };
|
|
4275
|
+
}
|
|
4135
4276
|
getTableControllerDefaultProps() {
|
|
4136
4277
|
return {
|
|
4137
4278
|
...super.getTableControllerDefaultProps(),
|
|
@@ -4142,93 +4283,30 @@ class GenericListQuery extends QueryController {
|
|
|
4142
4283
|
return { ...super.getLoadStructureParameters(), action: "filter" };
|
|
4143
4284
|
}
|
|
4144
4285
|
getRefreshParameters() {
|
|
4145
|
-
return { ...super.getRefreshParameters() };
|
|
4146
|
-
}
|
|
4147
|
-
getSortParameters() {
|
|
4148
|
-
return {
|
|
4149
|
-
...super.getSortParameters()
|
|
4150
|
-
};
|
|
4151
|
-
}
|
|
4152
|
-
getFilterParameters() {
|
|
4153
4286
|
return {
|
|
4154
|
-
|
|
4287
|
+
...super.getRefreshParameters(),
|
|
4155
4288
|
action: "filter",
|
|
4156
|
-
react: true,
|
|
4157
4289
|
isAjax: true
|
|
4158
4290
|
};
|
|
4159
4291
|
}
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
}
|
|
4163
|
-
async filter() {
|
|
4164
|
-
const filterResult = await ApiaApi.post(
|
|
4165
|
-
makeApiaUrl(this.getFilterParameters()),
|
|
4166
|
-
{
|
|
4167
|
-
postData: {
|
|
4168
|
-
...super.getFiltersValuesMap(),
|
|
4169
|
-
externalUser: false,
|
|
4170
|
-
selectOnlyOne: false,
|
|
4171
|
-
globalAndEnv: true,
|
|
4172
|
-
hierarchy: false,
|
|
4173
|
-
forOrgUnit: false,
|
|
4174
|
-
forCurrentEnv: false
|
|
4175
|
-
},
|
|
4176
|
-
postDataTreatement: "stringify",
|
|
4177
|
-
stringifyOptions: { arrayFormat: "repeat" }
|
|
4178
|
-
}
|
|
4179
|
-
);
|
|
4180
|
-
if (!filterResult?.data)
|
|
4292
|
+
parseRefreshResponse(response) {
|
|
4293
|
+
if (!response)
|
|
4181
4294
|
return;
|
|
4182
|
-
const structure = this.parseLoadStructureResponse(
|
|
4295
|
+
const structure = this.parseLoadStructureResponse(response);
|
|
4183
4296
|
this.parseStructure(structure);
|
|
4184
4297
|
setTimeout(() => {
|
|
4185
|
-
|
|
4186
|
-
},
|
|
4298
|
+
super.parseRefreshResponse(response);
|
|
4299
|
+
}, 0);
|
|
4187
4300
|
}
|
|
4188
4301
|
parseLoadStructureResponse(response) {
|
|
4189
4302
|
const typedResponse = response;
|
|
4190
|
-
|
|
4191
|
-
typedResponse.function
|
|
4192
|
-
|
|
4193
|
-
|
|
4194
|
-
|
|
4195
|
-
|
|
4196
|
-
|
|
4197
|
-
columns: retrievedColumns.map((c) => {
|
|
4198
|
-
const column = {
|
|
4199
|
-
label: c.label,
|
|
4200
|
-
name: c.name
|
|
4201
|
-
};
|
|
4202
|
-
return column;
|
|
4203
|
-
}),
|
|
4204
|
-
filters: arrayOrArray(retrievedFilters).map((f, i) => {
|
|
4205
|
-
const filter = {
|
|
4206
|
-
id: `filter${String(i + 1)}`,
|
|
4207
|
-
value: f.value,
|
|
4208
|
-
avoidLabel: false,
|
|
4209
|
-
isHidden: f.isHidden,
|
|
4210
|
-
column: f.column,
|
|
4211
|
-
title: f.title,
|
|
4212
|
-
tooltip: f.tooltip,
|
|
4213
|
-
type: f.type,
|
|
4214
|
-
onChange: () => {
|
|
4215
|
-
},
|
|
4216
|
-
options: [],
|
|
4217
|
-
placeholder: f.title,
|
|
4218
|
-
readonly: f.readonly,
|
|
4219
|
-
required: f.required
|
|
4220
|
-
};
|
|
4221
|
-
return filter;
|
|
4222
|
-
}),
|
|
4223
|
-
description: "",
|
|
4224
|
-
hasAdditionalInformation: false,
|
|
4225
|
-
hideFilterTypes: false,
|
|
4226
|
-
isDynamic: false,
|
|
4227
|
-
openFiltersAutomatically: false,
|
|
4228
|
-
runFiltersAutomatically: false,
|
|
4229
|
-
title: ""
|
|
4230
|
-
};
|
|
4231
|
-
return returnObject;
|
|
4303
|
+
return super.parseLoadStructureResponse({
|
|
4304
|
+
columns: { ...typedResponse.function.messages.result.columns },
|
|
4305
|
+
filters: {
|
|
4306
|
+
...typedResponse.function.messages.result.filters,
|
|
4307
|
+
runFiltersAutomatically: true
|
|
4308
|
+
}
|
|
4309
|
+
});
|
|
4232
4310
|
}
|
|
4233
4311
|
async initialLoad() {
|
|
4234
4312
|
this.tableController.updateState({
|
|
@@ -4236,28 +4314,47 @@ class GenericListQuery extends QueryController {
|
|
|
4236
4314
|
});
|
|
4237
4315
|
await this.refresh();
|
|
4238
4316
|
}
|
|
4239
|
-
|
|
4240
|
-
|
|
4317
|
+
}
|
|
4318
|
+
|
|
4319
|
+
class UsersQuery extends GenericListQuery {
|
|
4320
|
+
constructor() {
|
|
4321
|
+
super("apia.modals.UsersAction.run");
|
|
4241
4322
|
}
|
|
4242
|
-
|
|
4243
|
-
|
|
4244
|
-
|
|
4245
|
-
|
|
4246
|
-
|
|
4247
|
-
|
|
4248
|
-
|
|
4249
|
-
|
|
4250
|
-
|
|
4323
|
+
getFiltersValuesMap() {
|
|
4324
|
+
return {
|
|
4325
|
+
...super.getFiltersValuesMap(),
|
|
4326
|
+
externalUser: false,
|
|
4327
|
+
selectOnlyOne: false,
|
|
4328
|
+
globalAndEnv: true,
|
|
4329
|
+
hierarchy: false,
|
|
4330
|
+
forOrgUnit: false,
|
|
4331
|
+
forCurrentEnv: false
|
|
4332
|
+
};
|
|
4251
4333
|
}
|
|
4252
4334
|
}
|
|
4335
|
+
const makeApiaUsersModal2 = () => new QueryModalController(new UsersQuery());
|
|
4253
4336
|
|
|
4254
|
-
|
|
4255
|
-
|
|
4256
|
-
);
|
|
4257
|
-
|
|
4258
|
-
|
|
4259
|
-
|
|
4260
|
-
)
|
|
4337
|
+
class PoolsQuery extends GenericListQuery {
|
|
4338
|
+
constructor() {
|
|
4339
|
+
super("apia.modals.PoolsAction.run");
|
|
4340
|
+
}
|
|
4341
|
+
getFiltersValuesMap() {
|
|
4342
|
+
return {
|
|
4343
|
+
...super.getFiltersValuesMap(),
|
|
4344
|
+
showAutogenerated: false,
|
|
4345
|
+
showNotAutogenerated: false,
|
|
4346
|
+
showCurrentEnv: true,
|
|
4347
|
+
showGlobal: true,
|
|
4348
|
+
selectOnlyOne: false,
|
|
4349
|
+
forHierarchy: false,
|
|
4350
|
+
showOnlyPoolsInHierarchy: false,
|
|
4351
|
+
showOnlyPoolsOutsideHierarchy: false,
|
|
4352
|
+
refreshParameters: false,
|
|
4353
|
+
fetchAllInHierarchy: false
|
|
4354
|
+
};
|
|
4355
|
+
}
|
|
4356
|
+
}
|
|
4357
|
+
const makeApiaPoolsModals2 = () => new QueryModalController(new PoolsQuery());
|
|
4261
4358
|
|
|
4262
4359
|
var __defProp = Object.defineProperty;
|
|
4263
4360
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
@@ -4288,9 +4385,11 @@ class MonDocQuery extends QueryController {
|
|
|
4288
4385
|
]
|
|
4289
4386
|
};
|
|
4290
4387
|
}
|
|
4388
|
+
async loadFilterTypes() {
|
|
4389
|
+
}
|
|
4291
4390
|
processFilterChangeEvent(ev) {
|
|
4292
4391
|
this.tableController.state.filters.get(ev.id);
|
|
4293
|
-
this.
|
|
4392
|
+
this.refresh();
|
|
4294
4393
|
}
|
|
4295
4394
|
getLoadStructureParameters() {
|
|
4296
4395
|
return {
|
|
@@ -4302,22 +4401,16 @@ class MonDocQuery extends QueryController {
|
|
|
4302
4401
|
...this.dynamicParams
|
|
4303
4402
|
};
|
|
4304
4403
|
}
|
|
4305
|
-
getRefreshParameters() {
|
|
4306
|
-
return { ...super.getRefreshParameters() };
|
|
4307
|
-
}
|
|
4308
|
-
getSortParameters() {
|
|
4309
|
-
return {
|
|
4310
|
-
...super.getSortParameters()
|
|
4311
|
-
};
|
|
4312
|
-
}
|
|
4313
4404
|
setDynamicParams(params) {
|
|
4314
4405
|
this.dynamicParams = params;
|
|
4315
4406
|
}
|
|
4316
|
-
|
|
4407
|
+
getClearFiltersParameters() {
|
|
4408
|
+
return { ...super.getClearFiltersParameters(), action: "filter" };
|
|
4409
|
+
}
|
|
4410
|
+
getRefreshParameters() {
|
|
4317
4411
|
return {
|
|
4318
|
-
|
|
4412
|
+
...super.getRefreshParameters(),
|
|
4319
4413
|
action: "filter",
|
|
4320
|
-
react: true,
|
|
4321
4414
|
isAjax: true
|
|
4322
4415
|
};
|
|
4323
4416
|
}
|
|
@@ -4325,36 +4418,50 @@ class MonDocQuery extends QueryController {
|
|
|
4325
4418
|
return {
|
|
4326
4419
|
...super.getEventsHandlers(),
|
|
4327
4420
|
onFilterChange: () => {
|
|
4328
|
-
this.
|
|
4421
|
+
this.refresh(false);
|
|
4329
4422
|
}
|
|
4330
4423
|
};
|
|
4331
4424
|
}
|
|
4332
|
-
async filter() {
|
|
4333
|
-
const filterResult = await ApiaApi.post(
|
|
4334
|
-
makeApiaUrl(this.getFilterParameters()),
|
|
4335
|
-
{
|
|
4336
|
-
postData: {
|
|
4337
|
-
...super.getFiltersValuesMap()
|
|
4338
|
-
},
|
|
4339
|
-
postDataTreatement: "stringify",
|
|
4340
|
-
stringifyOptions: { arrayFormat: "repeat" }
|
|
4341
|
-
}
|
|
4342
|
-
);
|
|
4343
|
-
if (!filterResult?.data)
|
|
4344
|
-
return;
|
|
4345
|
-
setTimeout(() => {
|
|
4346
|
-
this.parseRefreshResponse(filterResult.data);
|
|
4347
|
-
}, 200);
|
|
4348
|
-
}
|
|
4349
4425
|
parseRefreshResponse(response) {
|
|
4350
|
-
const rows = response?.function?.messages?.result?.table?.row;
|
|
4426
|
+
const rows = arrayOrArray(response?.function?.messages?.result?.table?.row);
|
|
4351
4427
|
const pageState = response?.function.messages.result.pageInfo;
|
|
4352
4428
|
this.updatePageState(pageState);
|
|
4353
4429
|
this.updateRows([
|
|
4354
|
-
...
|
|
4355
|
-
(r)
|
|
4430
|
+
...rows.map((r) => {
|
|
4431
|
+
const cells = arrayOrArray(r.cell);
|
|
4432
|
+
const fileName = typeof cells[1] === "string" ? cells[1] : typeof cells[1] === "object" && cells[1] ? cells[1].content : "";
|
|
4433
|
+
return {
|
|
4356
4434
|
rowProps: r,
|
|
4435
|
+
isLocked: r.docLock,
|
|
4436
|
+
states: [
|
|
4437
|
+
{
|
|
4438
|
+
Icon: () => /* @__PURE__ */ jsx(
|
|
4439
|
+
Icon,
|
|
4440
|
+
{
|
|
4441
|
+
title: getLabel("lblLockedDocument").text,
|
|
4442
|
+
icon: "Locked",
|
|
4443
|
+
sx: { display: r.docLock ? "block" : "none" }
|
|
4444
|
+
}
|
|
4445
|
+
),
|
|
4446
|
+
tooltip: ""
|
|
4447
|
+
},
|
|
4448
|
+
{
|
|
4449
|
+
Icon: () => /* @__PURE__ */ jsx(
|
|
4450
|
+
Icon,
|
|
4451
|
+
{
|
|
4452
|
+
title: getLabel("lblReadOnly").text,
|
|
4453
|
+
icon: "Readonly",
|
|
4454
|
+
size: 22,
|
|
4455
|
+
sx: { display: r.uneditableTR ? "block" : "none" }
|
|
4456
|
+
}
|
|
4457
|
+
),
|
|
4458
|
+
tooltip: ""
|
|
4459
|
+
}
|
|
4460
|
+
],
|
|
4357
4461
|
cells: [
|
|
4462
|
+
{
|
|
4463
|
+
children: /* @__PURE__ */ jsx(FileIcon, { docName: fileName })
|
|
4464
|
+
},
|
|
4358
4465
|
...arrayOrArray(r.cell).map((c) => {
|
|
4359
4466
|
if (typeof c === "string") {
|
|
4360
4467
|
return { children: c };
|
|
@@ -4370,9 +4477,10 @@ class MonDocQuery extends QueryController {
|
|
|
4370
4477
|
return { children: c };
|
|
4371
4478
|
})
|
|
4372
4479
|
],
|
|
4373
|
-
id: r?.id
|
|
4374
|
-
|
|
4375
|
-
|
|
4480
|
+
id: r?.id,
|
|
4481
|
+
className: `${r.boldType ? "bold" : ""} ${r["expired-doc"] ? "expired" : ""} `
|
|
4482
|
+
};
|
|
4483
|
+
})
|
|
4376
4484
|
]);
|
|
4377
4485
|
}
|
|
4378
4486
|
parseLoadStructureResponse(response) {
|
|
@@ -4381,17 +4489,15 @@ class MonDocQuery extends QueryController {
|
|
|
4381
4489
|
const retrievedFilters = arrayOrArray(typedResponse.filters);
|
|
4382
4490
|
const returnObject = {
|
|
4383
4491
|
columns: retrievedColumns.map((c) => {
|
|
4384
|
-
if (c.name === "docFile")
|
|
4385
|
-
return null;
|
|
4386
4492
|
const column = {
|
|
4387
4493
|
label: c.label,
|
|
4388
4494
|
name: c.name,
|
|
4389
4495
|
allowSorting: c.allowSorting,
|
|
4390
4496
|
dataSortBy: c.dataSortBy,
|
|
4391
|
-
minWidth: "25%",
|
|
4392
4497
|
sort: c.sort,
|
|
4393
4498
|
toolTip: c.toolTip,
|
|
4394
|
-
|
|
4499
|
+
minWidth: c.name === "docFile" ? "50px" : "25%",
|
|
4500
|
+
width: c.name === "docFile" ? "50px" : "25%"
|
|
4395
4501
|
};
|
|
4396
4502
|
return column;
|
|
4397
4503
|
}).filter((c) => c !== null),
|
|
@@ -4415,8 +4521,6 @@ class MonDocQuery extends QueryController {
|
|
|
4415
4521
|
placeholder: f.title,
|
|
4416
4522
|
isRange: f.isRange,
|
|
4417
4523
|
isSize: f.isSize
|
|
4418
|
-
// readonly: f.readonly,
|
|
4419
|
-
// required: f.required,
|
|
4420
4524
|
};
|
|
4421
4525
|
return filter;
|
|
4422
4526
|
}),
|
|
@@ -4430,17 +4534,8 @@ class MonDocQuery extends QueryController {
|
|
|
4430
4534
|
};
|
|
4431
4535
|
return returnObject;
|
|
4432
4536
|
}
|
|
4433
|
-
async sort(column) {
|
|
4434
|
-
const result = await ApiaApi.post(
|
|
4435
|
-
makeApiaUrl({ ...this.getSortParameters(), orderBy: column })
|
|
4436
|
-
);
|
|
4437
|
-
if (result?.data) {
|
|
4438
|
-
this.parseRefreshResponse(result.data);
|
|
4439
|
-
}
|
|
4440
|
-
return super.refresh();
|
|
4441
|
-
}
|
|
4442
4537
|
}
|
|
4443
|
-
class
|
|
4538
|
+
class ApiaMonDocModal2 extends QueryModalController {
|
|
4444
4539
|
constructor() {
|
|
4445
4540
|
super(new MonDocQuery("/apia.execution.CustMonDocumentAction.run"));
|
|
4446
4541
|
}
|
|
@@ -4451,7 +4546,6 @@ class ApiaMonDocModal extends QueryModalController {
|
|
|
4451
4546
|
return super.openModal(properties);
|
|
4452
4547
|
}
|
|
4453
4548
|
}
|
|
4454
|
-
const ApiaMonDocModal2 = new ApiaMonDocModal();
|
|
4455
4549
|
|
|
4456
|
-
export { ApiaApi, ApiaApiHandler, ApiaMonDocModal2,
|
|
4550
|
+
export { ApiaApi, ApiaApiHandler, ApiaMonDocModal2, GenericListQuery, QueryController, QueryModalController, getFunction, getModal, isHtmlResponse, isXmlResponse, makeApiaPoolsModals2, makeApiaUrl, makeApiaUsersModal2, parseSuccessfulResponse };
|
|
4457
4551
|
//# sourceMappingURL=index.js.map
|