@apia/api 4.0.9 → 4.0.13
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 +34 -46
- package/dist/index.js +748 -392
- package/dist/index.js.map +1 -1
- package/package.json +9 -9
package/dist/index.js
CHANGED
|
@@ -11,8 +11,8 @@ 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,
|
|
15
|
-
import { makeObservable, observable,
|
|
14
|
+
import { ResponsiveTableContext, ResponsiveTable, Pagination, Sort, Responsive, Additional, responsiveTableStore, useResponsiveTableContext, RangeFilter, getResponsiveTableContext, makeController2, responsiveTableActions, TableContextReproducer } from '@apia/table';
|
|
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
18
|
|
|
@@ -471,7 +471,9 @@ function makeApiaUrl(props) {
|
|
|
471
471
|
)?.[1];
|
|
472
472
|
return `${contextWord ? "/" : ""}${contextWord}/${actualAjaxUrl}?${timestamp}${!props?.preventAsXmlParameter ? "asXml=true&" : ""}${props?.queryString ? `${props.queryString}&` : ""}${queryString ? `${queryString}&` : ""}${tabId}`;
|
|
473
473
|
}
|
|
474
|
-
|
|
474
|
+
function getModal$1(name) {
|
|
475
|
+
return window[name];
|
|
476
|
+
}
|
|
475
477
|
|
|
476
478
|
const ApiaApiCheckbox = (props) => {
|
|
477
479
|
const element = React__default.useMemo(() => props.element, [props.element]);
|
|
@@ -819,7 +821,7 @@ const defaultFetcher = {
|
|
|
819
821
|
(filters ?? []).forEach((currentFilter) => {
|
|
820
822
|
filterValues[currentFilter.id] = currentFilter.currentValue;
|
|
821
823
|
});
|
|
822
|
-
const result = await ApiaApi
|
|
824
|
+
const result = await ApiaApi.post(
|
|
823
825
|
makeApiaUrl({
|
|
824
826
|
react: true,
|
|
825
827
|
action: "filter",
|
|
@@ -837,7 +839,7 @@ const defaultFetcher = {
|
|
|
837
839
|
return parseResult(result?.data);
|
|
838
840
|
},
|
|
839
841
|
async page({ page, path, requestConfig }) {
|
|
840
|
-
const result = await ApiaApi
|
|
842
|
+
const result = await ApiaApi.post(
|
|
841
843
|
makeApiaUrl({
|
|
842
844
|
react: true,
|
|
843
845
|
action: "page",
|
|
@@ -853,7 +855,7 @@ const defaultFetcher = {
|
|
|
853
855
|
return parseResult(result?.data);
|
|
854
856
|
},
|
|
855
857
|
async refresh({ path, requestConfig }) {
|
|
856
|
-
const result = await ApiaApi
|
|
858
|
+
const result = await ApiaApi.post(
|
|
857
859
|
makeApiaUrl({
|
|
858
860
|
react: true,
|
|
859
861
|
action: "refresh",
|
|
@@ -868,7 +870,7 @@ const defaultFetcher = {
|
|
|
868
870
|
return parseResult(result?.data);
|
|
869
871
|
},
|
|
870
872
|
async sort({ path, requestConfig, sort }) {
|
|
871
|
-
const result = await ApiaApi
|
|
873
|
+
const result = await ApiaApi.post(
|
|
872
874
|
makeApiaUrl({
|
|
873
875
|
react: true,
|
|
874
876
|
action: "sort",
|
|
@@ -913,7 +915,7 @@ function useFetcher(fetcher = defaultFetcher) {
|
|
|
913
915
|
|
|
914
916
|
const ApiaEnvironmentsModal = (props) => {
|
|
915
917
|
const [actualColumns, setColumns] = useState(
|
|
916
|
-
environmentsModal.columns.map((current) => ({
|
|
918
|
+
getModal$1("environmentsModal").columns.map((current) => ({
|
|
917
919
|
...current,
|
|
918
920
|
currentSorting: getIndex(
|
|
919
921
|
["A", "D", null],
|
|
@@ -925,7 +927,7 @@ const ApiaEnvironmentsModal = (props) => {
|
|
|
925
927
|
)
|
|
926
928
|
}))
|
|
927
929
|
);
|
|
928
|
-
const [filters, setFilters] = useState(environmentsModal.filters);
|
|
930
|
+
const [filters, setFilters] = useState(getModal$1("environmentsModal").filters);
|
|
929
931
|
const [state, setState] = useState(null);
|
|
930
932
|
const { fetcher } = useFetcher();
|
|
931
933
|
const filter = useCallback(
|
|
@@ -942,7 +944,7 @@ const ApiaEnvironmentsModal = (props) => {
|
|
|
942
944
|
fromGlobalDescAdm: false,
|
|
943
945
|
usrToUpdate: ""
|
|
944
946
|
},
|
|
945
|
-
path: environmentsModal.path,
|
|
947
|
+
path: getModal$1("environmentsModal").path,
|
|
946
948
|
requestConfig: {}
|
|
947
949
|
}).then((result) => {
|
|
948
950
|
if (result) {
|
|
@@ -984,7 +986,7 @@ const ApiaEnvironmentsModal = (props) => {
|
|
|
984
986
|
fetcher.sort({
|
|
985
987
|
sort: ev.columnIndex,
|
|
986
988
|
parameters: {},
|
|
987
|
-
path: environmentsModal.path,
|
|
989
|
+
path: getModal$1("environmentsModal").path,
|
|
988
990
|
requestConfig: {}
|
|
989
991
|
}).then((result) => {
|
|
990
992
|
if (result) {
|
|
@@ -1011,7 +1013,7 @@ const ApiaEnvironmentsModal = (props) => {
|
|
|
1011
1013
|
fetcher.page({
|
|
1012
1014
|
page,
|
|
1013
1015
|
parameters: {},
|
|
1014
|
-
path: environmentsModal.path
|
|
1016
|
+
path: getModal$1("environmentsModal").path
|
|
1015
1017
|
}).then((result) => {
|
|
1016
1018
|
if (result) {
|
|
1017
1019
|
setState(result);
|
|
@@ -1023,7 +1025,7 @@ const ApiaEnvironmentsModal = (props) => {
|
|
|
1023
1025
|
const handleRefresh = useCallback(() => {
|
|
1024
1026
|
fetcher.refresh({
|
|
1025
1027
|
parameters: {},
|
|
1026
|
-
path: environmentsModal.path
|
|
1028
|
+
path: getModal$1("environmentsModal").path
|
|
1027
1029
|
}).then((result) => {
|
|
1028
1030
|
if (result) {
|
|
1029
1031
|
setState(result);
|
|
@@ -1036,7 +1038,7 @@ const ApiaEnvironmentsModal = (props) => {
|
|
|
1036
1038
|
columns: actualColumns,
|
|
1037
1039
|
rows: state?.rows,
|
|
1038
1040
|
filters,
|
|
1039
|
-
name: props.tableName ?? environmentsModal.label,
|
|
1041
|
+
name: props.tableName ?? getModal$1("environmentsModal").label,
|
|
1040
1042
|
variant: "layout.common.modals.table",
|
|
1041
1043
|
onFilterChange: handleFilterChange,
|
|
1042
1044
|
onSortChange: handleSort,
|
|
@@ -1120,15 +1122,15 @@ const ApiaApiEnvironmentsModalField = (props) => {
|
|
|
1120
1122
|
} = useModal();
|
|
1121
1123
|
const id = useId();
|
|
1122
1124
|
const deleteFilters = useCallback(() => {
|
|
1123
|
-
const newFilters =
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
}
|
|
1131
|
-
);
|
|
1125
|
+
const newFilters = getModal$1(
|
|
1126
|
+
"environmentsModal"
|
|
1127
|
+
).filters?.map((currentFilter) => {
|
|
1128
|
+
return {
|
|
1129
|
+
...currentFilter,
|
|
1130
|
+
currentValue: "",
|
|
1131
|
+
deleteFiltersTimestamp: Date.now()
|
|
1132
|
+
};
|
|
1133
|
+
});
|
|
1132
1134
|
ApiaEnvironmentsModalEmitter.emit("deleteFilters", newFilters);
|
|
1133
1135
|
}, []);
|
|
1134
1136
|
useEffect(() => {
|
|
@@ -1211,7 +1213,7 @@ const ApiaApiEnvironmentsModalField = (props) => {
|
|
|
1211
1213
|
}
|
|
1212
1214
|
),
|
|
1213
1215
|
size: "xxl",
|
|
1214
|
-
title: environmentsModal.label,
|
|
1216
|
+
title: getModal$1("environmentsModal").label,
|
|
1215
1217
|
NavBar: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1216
1218
|
/* @__PURE__ */ jsx(
|
|
1217
1219
|
SimpleButton,
|
|
@@ -1261,7 +1263,7 @@ const ApiaApiEnvironmentsModalField = (props) => {
|
|
|
1261
1263
|
|
|
1262
1264
|
const ApiaTasksModal = (props) => {
|
|
1263
1265
|
const [actualColumns, setColumns] = useState(
|
|
1264
|
-
tasksModal.columns.map((current) => ({
|
|
1266
|
+
getModal$1("tasksModal").columns.map((current) => ({
|
|
1265
1267
|
...current,
|
|
1266
1268
|
currentSorting: getIndex(
|
|
1267
1269
|
["A", "D", null],
|
|
@@ -1273,7 +1275,7 @@ const ApiaTasksModal = (props) => {
|
|
|
1273
1275
|
)
|
|
1274
1276
|
}))
|
|
1275
1277
|
);
|
|
1276
|
-
const [filters, setFilters] = useState(tasksModal.filters);
|
|
1278
|
+
const [filters, setFilters] = useState(getModal$1("tasksModal").filters);
|
|
1277
1279
|
const [state, setState] = useState(null);
|
|
1278
1280
|
const { fetcher } = useFetcher();
|
|
1279
1281
|
const filter = useCallback(
|
|
@@ -1289,7 +1291,7 @@ const ApiaTasksModal = (props) => {
|
|
|
1289
1291
|
txtAdtSql: props.initialProps.adtInfo ?? "",
|
|
1290
1292
|
usrToUpdate: ""
|
|
1291
1293
|
},
|
|
1292
|
-
path: tasksModal.path,
|
|
1294
|
+
path: getModal$1("tasksModal").path,
|
|
1293
1295
|
requestConfig: {}
|
|
1294
1296
|
}).then((result) => {
|
|
1295
1297
|
if (result) {
|
|
@@ -1331,7 +1333,7 @@ const ApiaTasksModal = (props) => {
|
|
|
1331
1333
|
fetcher.sort({
|
|
1332
1334
|
sort: ev.columnIndex,
|
|
1333
1335
|
parameters: {},
|
|
1334
|
-
path: tasksModal.path,
|
|
1336
|
+
path: getModal$1("tasksModal").path,
|
|
1335
1337
|
requestConfig: {}
|
|
1336
1338
|
}).then((result) => {
|
|
1337
1339
|
if (result) {
|
|
@@ -1358,7 +1360,7 @@ const ApiaTasksModal = (props) => {
|
|
|
1358
1360
|
fetcher.page({
|
|
1359
1361
|
page,
|
|
1360
1362
|
parameters: {},
|
|
1361
|
-
path: tasksModal.path
|
|
1363
|
+
path: getModal$1("tasksModal").path
|
|
1362
1364
|
}).then((result) => {
|
|
1363
1365
|
if (result) {
|
|
1364
1366
|
setState(result);
|
|
@@ -1370,7 +1372,7 @@ const ApiaTasksModal = (props) => {
|
|
|
1370
1372
|
const handleRefresh = useCallback(() => {
|
|
1371
1373
|
fetcher.refresh({
|
|
1372
1374
|
parameters: {},
|
|
1373
|
-
path: tasksModal.path
|
|
1375
|
+
path: getModal$1("tasksModal").path
|
|
1374
1376
|
}).then((result) => {
|
|
1375
1377
|
if (result) {
|
|
1376
1378
|
setState(result);
|
|
@@ -1383,7 +1385,7 @@ const ApiaTasksModal = (props) => {
|
|
|
1383
1385
|
columns: actualColumns,
|
|
1384
1386
|
rows: state?.rows,
|
|
1385
1387
|
filters,
|
|
1386
|
-
name: props.tableName ?? tasksModal.label,
|
|
1388
|
+
name: props.tableName ?? getModal$1("tasksModal").label,
|
|
1387
1389
|
variant: "layout.common.modals.table",
|
|
1388
1390
|
onFilterChange: handleFilterChange,
|
|
1389
1391
|
onSortChange: handleSort,
|
|
@@ -1428,7 +1430,7 @@ const ApiaApiTasksModalField = (props) => {
|
|
|
1428
1430
|
} = useModal();
|
|
1429
1431
|
const id = useId();
|
|
1430
1432
|
const deleteFilters = useCallback(() => {
|
|
1431
|
-
const newFilters = tasksModal.filters?.map(
|
|
1433
|
+
const newFilters = getModal$1("tasksModal").filters?.map(
|
|
1432
1434
|
(currentFilter) => {
|
|
1433
1435
|
return {
|
|
1434
1436
|
...currentFilter,
|
|
@@ -1519,7 +1521,7 @@ const ApiaApiTasksModalField = (props) => {
|
|
|
1519
1521
|
}
|
|
1520
1522
|
),
|
|
1521
1523
|
size: "xxl",
|
|
1522
|
-
title:
|
|
1524
|
+
title: getModal$1("tasksModal").label,
|
|
1523
1525
|
NavBar: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1524
1526
|
/* @__PURE__ */ jsx(
|
|
1525
1527
|
SimpleButton,
|
|
@@ -1569,7 +1571,7 @@ const ApiaApiTasksModalField = (props) => {
|
|
|
1569
1571
|
|
|
1570
1572
|
const ApiaProcessesModal = (props) => {
|
|
1571
1573
|
const [actualColumns, setColumns] = useState(
|
|
1572
|
-
processesModal.columns.map((current) => ({
|
|
1574
|
+
getModal$1("processesModal").columns.map((current) => ({
|
|
1573
1575
|
...current,
|
|
1574
1576
|
currentSorting: getIndex(
|
|
1575
1577
|
["A", "D", null],
|
|
@@ -1581,7 +1583,7 @@ const ApiaProcessesModal = (props) => {
|
|
|
1581
1583
|
)
|
|
1582
1584
|
}))
|
|
1583
1585
|
);
|
|
1584
|
-
const [filters, setFilters] = useState(processesModal.filters);
|
|
1586
|
+
const [filters, setFilters] = useState(getModal$1("processesModal").filters);
|
|
1585
1587
|
const [state, setState] = useState(null);
|
|
1586
1588
|
const { fetcher } = useFetcher();
|
|
1587
1589
|
const filter = useCallback(
|
|
@@ -1600,7 +1602,7 @@ const ApiaProcessesModal = (props) => {
|
|
|
1600
1602
|
txtAdtSql: props.initialProps.adtInfo ?? "",
|
|
1601
1603
|
usrToUpdate: ""
|
|
1602
1604
|
},
|
|
1603
|
-
path: processesModal.path,
|
|
1605
|
+
path: getModal$1("processesModal").path,
|
|
1604
1606
|
requestConfig: {}
|
|
1605
1607
|
}).then((result) => {
|
|
1606
1608
|
if (result) {
|
|
@@ -1642,7 +1644,7 @@ const ApiaProcessesModal = (props) => {
|
|
|
1642
1644
|
fetcher.sort({
|
|
1643
1645
|
sort: ev.columnIndex,
|
|
1644
1646
|
parameters: {},
|
|
1645
|
-
path: processesModal.path,
|
|
1647
|
+
path: getModal$1("processesModal").path,
|
|
1646
1648
|
requestConfig: {}
|
|
1647
1649
|
}).then((result) => {
|
|
1648
1650
|
if (result) {
|
|
@@ -1669,7 +1671,7 @@ const ApiaProcessesModal = (props) => {
|
|
|
1669
1671
|
fetcher.page({
|
|
1670
1672
|
page,
|
|
1671
1673
|
parameters: {},
|
|
1672
|
-
path: processesModal.path
|
|
1674
|
+
path: getModal$1("processesModal").path
|
|
1673
1675
|
}).then((result) => {
|
|
1674
1676
|
if (result) {
|
|
1675
1677
|
setState(result);
|
|
@@ -1681,7 +1683,7 @@ const ApiaProcessesModal = (props) => {
|
|
|
1681
1683
|
const handleRefresh = useCallback(() => {
|
|
1682
1684
|
fetcher.refresh({
|
|
1683
1685
|
parameters: {},
|
|
1684
|
-
path: processesModal.path
|
|
1686
|
+
path: getModal$1("processesModal").path
|
|
1685
1687
|
}).then((result) => {
|
|
1686
1688
|
if (result) {
|
|
1687
1689
|
setState(result);
|
|
@@ -1694,7 +1696,7 @@ const ApiaProcessesModal = (props) => {
|
|
|
1694
1696
|
columns: actualColumns,
|
|
1695
1697
|
rows: state?.rows,
|
|
1696
1698
|
filters,
|
|
1697
|
-
name: props.tableName ?? processesModal.label,
|
|
1699
|
+
name: props.tableName ?? getModal$1("processesModal").label,
|
|
1698
1700
|
variant: "layout.common.modals.table",
|
|
1699
1701
|
onFilterChange: handleFilterChange,
|
|
1700
1702
|
onSortChange: handleSort,
|
|
@@ -1739,7 +1741,7 @@ const ApiaApiProcessesModalField = (props) => {
|
|
|
1739
1741
|
} = useModal();
|
|
1740
1742
|
const id = useId();
|
|
1741
1743
|
const deleteFilters = useCallback(() => {
|
|
1742
|
-
const newFilters = processesModal.filters?.map(
|
|
1744
|
+
const newFilters = getModal$1("processesModal").filters?.map(
|
|
1743
1745
|
(currentFilter) => {
|
|
1744
1746
|
return {
|
|
1745
1747
|
...currentFilter,
|
|
@@ -1830,7 +1832,7 @@ const ApiaApiProcessesModalField = (props) => {
|
|
|
1830
1832
|
}
|
|
1831
1833
|
),
|
|
1832
1834
|
size: "xxl",
|
|
1833
|
-
title: processesModal.label,
|
|
1835
|
+
title: getModal$1("processesModal").label,
|
|
1834
1836
|
NavBar: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1835
1837
|
/* @__PURE__ */ jsx(
|
|
1836
1838
|
SimpleButton,
|
|
@@ -1880,7 +1882,7 @@ const ApiaApiProcessesModalField = (props) => {
|
|
|
1880
1882
|
|
|
1881
1883
|
const ApiaPoolsModal = (props) => {
|
|
1882
1884
|
const [actualColumns, setColumns] = useState(
|
|
1883
|
-
poolsModal.columns.map((current) => ({
|
|
1885
|
+
getModal$1("poolsModal").columns.map((current) => ({
|
|
1884
1886
|
...current,
|
|
1885
1887
|
currentSorting: getIndex(
|
|
1886
1888
|
["A", "D", null],
|
|
@@ -1892,7 +1894,7 @@ const ApiaPoolsModal = (props) => {
|
|
|
1892
1894
|
)
|
|
1893
1895
|
}))
|
|
1894
1896
|
);
|
|
1895
|
-
const [filters, setFilters] = useState(poolsModal.filters);
|
|
1897
|
+
const [filters, setFilters] = useState(getModal$1("poolsModal").filters);
|
|
1896
1898
|
const [state, setState] = useState(null);
|
|
1897
1899
|
const { fetcher } = useFetcher();
|
|
1898
1900
|
const filter = useCallback(
|
|
@@ -1918,7 +1920,7 @@ const ApiaPoolsModal = (props) => {
|
|
|
1918
1920
|
fetchAllInHierarchy: false,
|
|
1919
1921
|
usrToUpdate: ""
|
|
1920
1922
|
},
|
|
1921
|
-
path: poolsModal.path,
|
|
1923
|
+
path: getModal$1("poolsModal").path,
|
|
1922
1924
|
requestConfig: {}
|
|
1923
1925
|
}).then((result) => {
|
|
1924
1926
|
if (result) {
|
|
@@ -1954,7 +1956,7 @@ const ApiaPoolsModal = (props) => {
|
|
|
1954
1956
|
fetcher.sort({
|
|
1955
1957
|
sort: ev.columnIndex,
|
|
1956
1958
|
parameters: {},
|
|
1957
|
-
path: poolsModal.path,
|
|
1959
|
+
path: getModal$1("poolsModal").path,
|
|
1958
1960
|
requestConfig: {}
|
|
1959
1961
|
}).then((result) => {
|
|
1960
1962
|
if (result) {
|
|
@@ -1981,7 +1983,7 @@ const ApiaPoolsModal = (props) => {
|
|
|
1981
1983
|
fetcher.page({
|
|
1982
1984
|
page,
|
|
1983
1985
|
parameters: {},
|
|
1984
|
-
path: poolsModal.path
|
|
1986
|
+
path: getModal$1("poolsModal").path
|
|
1985
1987
|
}).then((result) => {
|
|
1986
1988
|
if (result) {
|
|
1987
1989
|
setState(result);
|
|
@@ -1993,7 +1995,7 @@ const ApiaPoolsModal = (props) => {
|
|
|
1993
1995
|
const handleRefresh = useCallback(() => {
|
|
1994
1996
|
fetcher.refresh({
|
|
1995
1997
|
parameters: {},
|
|
1996
|
-
path: poolsModal.path
|
|
1998
|
+
path: getModal$1("poolsModal").path
|
|
1997
1999
|
}).then((result) => {
|
|
1998
2000
|
if (result) {
|
|
1999
2001
|
setState(result);
|
|
@@ -2006,7 +2008,7 @@ const ApiaPoolsModal = (props) => {
|
|
|
2006
2008
|
columns: actualColumns,
|
|
2007
2009
|
rows: state?.rows,
|
|
2008
2010
|
filters,
|
|
2009
|
-
name: props.tableName ?? poolsModal.label,
|
|
2011
|
+
name: props.tableName ?? getModal$1("poolsModal").label,
|
|
2010
2012
|
variant: "layout.common.modals.table",
|
|
2011
2013
|
onFilterChange: handleFilterChange,
|
|
2012
2014
|
onSortChange: handleSort,
|
|
@@ -2051,7 +2053,7 @@ const ApiaApiPoolsModalField = (props) => {
|
|
|
2051
2053
|
} = useModal();
|
|
2052
2054
|
const id = useId();
|
|
2053
2055
|
const deleteFilters = useCallback(() => {
|
|
2054
|
-
const newFilters = poolsModal.filters?.map(
|
|
2056
|
+
const newFilters = getModal$1("poolsModal").filters?.map(
|
|
2055
2057
|
(currentFilter) => {
|
|
2056
2058
|
return {
|
|
2057
2059
|
...currentFilter,
|
|
@@ -2142,7 +2144,7 @@ const ApiaApiPoolsModalField = (props) => {
|
|
|
2142
2144
|
}
|
|
2143
2145
|
),
|
|
2144
2146
|
size: "xxl",
|
|
2145
|
-
title: poolsModal.label,
|
|
2147
|
+
title: getModal$1("poolsModal").label,
|
|
2146
2148
|
NavBar: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2147
2149
|
/* @__PURE__ */ jsx(
|
|
2148
2150
|
SimpleButton,
|
|
@@ -2192,7 +2194,7 @@ const ApiaApiPoolsModalField = (props) => {
|
|
|
2192
2194
|
|
|
2193
2195
|
const ApiaUsersModal = (props) => {
|
|
2194
2196
|
const [actualColumns, setColumns] = useState(
|
|
2195
|
-
usersModal.columns.map((current) => ({
|
|
2197
|
+
getModal$1("usersModal").columns.map((current) => ({
|
|
2196
2198
|
...current,
|
|
2197
2199
|
currentSorting: getIndex(
|
|
2198
2200
|
["A", "D", null],
|
|
@@ -2204,7 +2206,7 @@ const ApiaUsersModal = (props) => {
|
|
|
2204
2206
|
)
|
|
2205
2207
|
}))
|
|
2206
2208
|
);
|
|
2207
|
-
const [filters, setFilters] = useState(usersModal.filters);
|
|
2209
|
+
const [filters, setFilters] = useState(getModal$1("usersModal").filters);
|
|
2208
2210
|
const [state, setState] = useState(null);
|
|
2209
2211
|
const { fetcher } = useFetcher();
|
|
2210
2212
|
const filter = useCallback(
|
|
@@ -2223,7 +2225,7 @@ const ApiaUsersModal = (props) => {
|
|
|
2223
2225
|
forOrgUnit: false,
|
|
2224
2226
|
forCurrentEnv: false
|
|
2225
2227
|
},
|
|
2226
|
-
path: usersModal.path,
|
|
2228
|
+
path: getModal$1("usersModal").path,
|
|
2227
2229
|
requestConfig: {}
|
|
2228
2230
|
}).then((result) => {
|
|
2229
2231
|
if (result) {
|
|
@@ -2259,7 +2261,7 @@ const ApiaUsersModal = (props) => {
|
|
|
2259
2261
|
fetcher.sort({
|
|
2260
2262
|
sort: ev.columnIndex,
|
|
2261
2263
|
parameters: {},
|
|
2262
|
-
path: usersModal.path,
|
|
2264
|
+
path: getModal$1("usersModal").path,
|
|
2263
2265
|
requestConfig: {}
|
|
2264
2266
|
}).then((result) => {
|
|
2265
2267
|
if (result) {
|
|
@@ -2286,7 +2288,7 @@ const ApiaUsersModal = (props) => {
|
|
|
2286
2288
|
fetcher.page({
|
|
2287
2289
|
page,
|
|
2288
2290
|
parameters: {},
|
|
2289
|
-
path: usersModal.path
|
|
2291
|
+
path: getModal$1("usersModal").path
|
|
2290
2292
|
}).then((result) => {
|
|
2291
2293
|
if (result) {
|
|
2292
2294
|
setState(result);
|
|
@@ -2298,7 +2300,7 @@ const ApiaUsersModal = (props) => {
|
|
|
2298
2300
|
const handleRefresh = useCallback(() => {
|
|
2299
2301
|
fetcher.refresh({
|
|
2300
2302
|
parameters: {},
|
|
2301
|
-
path: usersModal.path
|
|
2303
|
+
path: getModal$1("usersModal").path
|
|
2302
2304
|
}).then((result) => {
|
|
2303
2305
|
if (result) {
|
|
2304
2306
|
setState(result);
|
|
@@ -2311,7 +2313,7 @@ const ApiaUsersModal = (props) => {
|
|
|
2311
2313
|
columns: actualColumns,
|
|
2312
2314
|
rows: state?.rows,
|
|
2313
2315
|
filters,
|
|
2314
|
-
name: props.tableName ?? usersModal.label,
|
|
2316
|
+
name: props.tableName ?? getModal$1("usersModal").label,
|
|
2315
2317
|
variant: "layout.common.modals.table",
|
|
2316
2318
|
onFilterChange: handleFilterChange,
|
|
2317
2319
|
onSortChange: handleSort,
|
|
@@ -2354,7 +2356,7 @@ const ApiaApiUsersModalField = (props) => {
|
|
|
2354
2356
|
} = useModal();
|
|
2355
2357
|
const id = useId();
|
|
2356
2358
|
const deleteFilters = useCallback(() => {
|
|
2357
|
-
const newFilters = usersModal.filters?.map(
|
|
2359
|
+
const newFilters = getModal$1("usersModal").filters?.map(
|
|
2358
2360
|
(currentFilter) => {
|
|
2359
2361
|
return {
|
|
2360
2362
|
...currentFilter,
|
|
@@ -2445,7 +2447,7 @@ const ApiaApiUsersModalField = (props) => {
|
|
|
2445
2447
|
}
|
|
2446
2448
|
),
|
|
2447
2449
|
size: "xxl",
|
|
2448
|
-
title: usersModal.label,
|
|
2450
|
+
title: getModal$1("usersModal").label,
|
|
2449
2451
|
NavBar: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2450
2452
|
/* @__PURE__ */ jsx(
|
|
2451
2453
|
SimpleButton,
|
|
@@ -2569,7 +2571,7 @@ const NonMemoizedApiaApiFieldsContainer = (props) => {
|
|
|
2569
2571
|
Box,
|
|
2570
2572
|
{
|
|
2571
2573
|
...getVariant("layout.common.tables.information"),
|
|
2572
|
-
children: /* @__PURE__ */ jsxs("table",
|
|
2574
|
+
children: /* @__PURE__ */ jsxs(Box, { as: "table", sx: { width: "100%" }, children: [
|
|
2573
2575
|
/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsx("tr", { children: data.columns.map((column) => {
|
|
2574
2576
|
return /* @__PURE__ */ jsx("th", { children: column }, column);
|
|
2575
2577
|
}) }) }),
|
|
@@ -2806,7 +2808,7 @@ const NonMemoizedApiaApiButtonsContainer = (props) => {
|
|
|
2806
2808
|
...current,
|
|
2807
2809
|
isLoading: true
|
|
2808
2810
|
}));
|
|
2809
|
-
void ApiaApi
|
|
2811
|
+
void ApiaApi.post(url, {
|
|
2810
2812
|
postData: props.state.isMultipart ? formData : QueryString.stringify(
|
|
2811
2813
|
[...formData.entries(), ["isAjax", true]].reduce((accumulated, [name, value]) => {
|
|
2812
2814
|
const retValue = { ...accumulated };
|
|
@@ -2977,7 +2979,7 @@ const ApiaApiHandlerNonMemoized = () => {
|
|
|
2977
2979
|
...initialState,
|
|
2978
2980
|
windowIndex: -1
|
|
2979
2981
|
});
|
|
2980
|
-
const [
|
|
2982
|
+
const [currentForm, setCurrentForm] = React.useState(
|
|
2981
2983
|
void 0
|
|
2982
2984
|
);
|
|
2983
2985
|
React.useEffect(() => {
|
|
@@ -2987,9 +2989,9 @@ const ApiaApiHandlerNonMemoized = () => {
|
|
|
2987
2989
|
return validationsStore.setFieldValue(apiaApiForm, name, value);
|
|
2988
2990
|
}, []);
|
|
2989
2991
|
React.useEffect(() => {
|
|
2990
|
-
if (!
|
|
2992
|
+
if (!currentForm)
|
|
2991
2993
|
return;
|
|
2992
|
-
const elements = arrayOrArray(
|
|
2994
|
+
const elements = arrayOrArray(currentForm?.form?.elements?.element ?? []);
|
|
2993
2995
|
let isMultipart = false;
|
|
2994
2996
|
const elementsValues = Object.values(elements);
|
|
2995
2997
|
let i = 0;
|
|
@@ -3005,7 +3007,7 @@ const ApiaApiHandlerNonMemoized = () => {
|
|
|
3005
3007
|
isMultipart
|
|
3006
3008
|
};
|
|
3007
3009
|
});
|
|
3008
|
-
}, [
|
|
3010
|
+
}, [currentForm]);
|
|
3009
3011
|
const { show, onClose, ...modalHookProps } = useModal();
|
|
3010
3012
|
const close = React.useCallback(() => {
|
|
3011
3013
|
onClose();
|
|
@@ -3037,7 +3039,7 @@ const ApiaApiHandlerNonMemoized = () => {
|
|
|
3037
3039
|
() => ({
|
|
3038
3040
|
onClose: close,
|
|
3039
3041
|
id: apiaApiForm,
|
|
3040
|
-
title: configuration.current?.modalConfiguration?.modalTitle ??
|
|
3042
|
+
title: configuration.current?.modalConfiguration?.modalTitle ?? currentForm?.form.title,
|
|
3041
3043
|
size: "md-fixed",
|
|
3042
3044
|
shouldCloseOnEsc: !state.disabled,
|
|
3043
3045
|
shouldCloseOnOverlayClick: !state.disabled,
|
|
@@ -3046,7 +3048,7 @@ const ApiaApiHandlerNonMemoized = () => {
|
|
|
3046
3048
|
[
|
|
3047
3049
|
close,
|
|
3048
3050
|
configuration,
|
|
3049
|
-
|
|
3051
|
+
currentForm?.form.title,
|
|
3050
3052
|
initialFocusGetter,
|
|
3051
3053
|
state.disabled
|
|
3052
3054
|
]
|
|
@@ -3088,7 +3090,7 @@ const ApiaApiHandlerNonMemoized = () => {
|
|
|
3088
3090
|
alert,
|
|
3089
3091
|
close,
|
|
3090
3092
|
configuration: configuration.current,
|
|
3091
|
-
formDefinition:
|
|
3093
|
+
formDefinition: currentForm,
|
|
3092
3094
|
reset: () => {
|
|
3093
3095
|
return setState((currentState) => {
|
|
3094
3096
|
return {
|
|
@@ -3107,7 +3109,7 @@ const ApiaApiHandlerNonMemoized = () => {
|
|
|
3107
3109
|
setValue
|
|
3108
3110
|
};
|
|
3109
3111
|
return newHandler;
|
|
3110
|
-
}, [close, configuration,
|
|
3112
|
+
}, [close, configuration, currentForm, setError, state, setValue]);
|
|
3111
3113
|
const handler = getHandler();
|
|
3112
3114
|
const modalProps = getModalProps(handler);
|
|
3113
3115
|
const handleAction = React.useCallback(
|
|
@@ -3169,15 +3171,15 @@ const ApiaApiHandlerNonMemoized = () => {
|
|
|
3169
3171
|
};
|
|
3170
3172
|
}, [handleAction, handleFunction, handleMessage, state.windowIndex]);
|
|
3171
3173
|
React.useEffect(() => {
|
|
3172
|
-
if (
|
|
3174
|
+
if (currentForm) {
|
|
3173
3175
|
show();
|
|
3174
3176
|
}
|
|
3175
|
-
}, [
|
|
3177
|
+
}, [currentForm]);
|
|
3176
3178
|
const formRef = React.useCallback(
|
|
3177
3179
|
async (el) => {
|
|
3178
|
-
if (el &&
|
|
3180
|
+
if (el && currentForm?.form.onLoad) {
|
|
3179
3181
|
const method = await getFunction(
|
|
3180
|
-
`${
|
|
3182
|
+
`${currentForm?.form.onLoad}`,
|
|
3181
3183
|
getHandler()
|
|
3182
3184
|
);
|
|
3183
3185
|
if (method) {
|
|
@@ -3185,7 +3187,7 @@ const ApiaApiHandlerNonMemoized = () => {
|
|
|
3185
3187
|
}
|
|
3186
3188
|
}
|
|
3187
3189
|
},
|
|
3188
|
-
[
|
|
3190
|
+
[currentForm?.form.onLoad, getHandler]
|
|
3189
3191
|
);
|
|
3190
3192
|
return /* @__PURE__ */ jsx(ApiaApiContext$1, { id: apiaApiForm, children: /* @__PURE__ */ jsx(
|
|
3191
3193
|
Modal,
|
|
@@ -3193,7 +3195,7 @@ const ApiaApiHandlerNonMemoized = () => {
|
|
|
3193
3195
|
...modalProps,
|
|
3194
3196
|
ref: modalRef,
|
|
3195
3197
|
variant: "layout.common.modals.apiaApi",
|
|
3196
|
-
children:
|
|
3198
|
+
children: currentForm && /* @__PURE__ */ jsxs(
|
|
3197
3199
|
Form,
|
|
3198
3200
|
{
|
|
3199
3201
|
name: apiaApiForm,
|
|
@@ -3201,7 +3203,7 @@ const ApiaApiHandlerNonMemoized = () => {
|
|
|
3201
3203
|
avoidFieldsOverride: true,
|
|
3202
3204
|
className: "handler__form",
|
|
3203
3205
|
children: [
|
|
3204
|
-
/* @__PURE__ */ jsx(ApiaApiFieldsContainer, { definition:
|
|
3206
|
+
/* @__PURE__ */ jsx(ApiaApiFieldsContainer, { definition: currentForm, ...handler }),
|
|
3205
3207
|
state.isMultipart && state.progress > 0 && /* @__PURE__ */ jsx(Box, { className: "progressBox", children: /* @__PURE__ */ jsx(
|
|
3206
3208
|
ProgressBar,
|
|
3207
3209
|
{
|
|
@@ -3210,7 +3212,7 @@ const ApiaApiHandlerNonMemoized = () => {
|
|
|
3210
3212
|
loading: true
|
|
3211
3213
|
}
|
|
3212
3214
|
) }),
|
|
3213
|
-
/* @__PURE__ */ jsx(ApiaApiButtonsContainer, { definition:
|
|
3215
|
+
/* @__PURE__ */ jsx(ApiaApiButtonsContainer, { definition: currentForm, ...handler }),
|
|
3214
3216
|
/* @__PURE__ */ jsx(Box, { ref: formRef, sx: { display: "none" } })
|
|
3215
3217
|
]
|
|
3216
3218
|
}
|
|
@@ -3220,225 +3222,80 @@ const ApiaApiHandlerNonMemoized = () => {
|
|
|
3220
3222
|
};
|
|
3221
3223
|
const ApiaApiHandler = React.memo(ApiaApiHandlerNonMemoized);
|
|
3222
3224
|
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
const sortTitle = getLabel("titOrderBy").text;
|
|
3228
|
-
const filterTypes = getLabel("btnFilterType").text;
|
|
3229
|
-
const hasAdditional = !![...tableController.state.filters.values()].find(
|
|
3230
|
-
(f) => f.filterState.isAdditional
|
|
3231
|
-
);
|
|
3232
|
-
const hasFilters = !![...tableController.state.filters.values()].find(
|
|
3233
|
-
(f) => !f.filterState.isAdditional && f.filterState.column
|
|
3234
|
-
);
|
|
3235
|
-
const hasSortable = !![...tableController.state.columns.values()].find(
|
|
3236
|
-
(c) => c.allowSorting
|
|
3237
|
-
);
|
|
3238
|
-
return /* @__PURE__ */ jsx(TableContextReproducer, { tableName: tableController.getTableName(), children: /* @__PURE__ */ jsxs(Accordion, { className: "additionalFiltersContent", singleExpand: true, children: [
|
|
3239
|
-
hasFilters && /* @__PURE__ */ jsx(
|
|
3240
|
-
AccordionItem,
|
|
3241
|
-
{
|
|
3242
|
-
id: "Responsive",
|
|
3243
|
-
defaultExpanded: true,
|
|
3244
|
-
buttonProps: { ariaLabel: filterTitle, label: filterTitle },
|
|
3245
|
-
children: /* @__PURE__ */ jsx(Responsive, {})
|
|
3246
|
-
}
|
|
3247
|
-
),
|
|
3248
|
-
hasAdditional && /* @__PURE__ */ jsx(
|
|
3249
|
-
AccordionItem,
|
|
3250
|
-
{
|
|
3251
|
-
id: "Additional",
|
|
3252
|
-
buttonProps: {
|
|
3253
|
-
ariaLabel: "todo: additional",
|
|
3254
|
-
label: "todo:additional"
|
|
3255
|
-
},
|
|
3256
|
-
children: /* @__PURE__ */ jsx(Additional, {})
|
|
3257
|
-
}
|
|
3258
|
-
),
|
|
3259
|
-
hasSortable && /* @__PURE__ */ jsx(
|
|
3260
|
-
AccordionItem,
|
|
3261
|
-
{
|
|
3262
|
-
id: "Sort",
|
|
3263
|
-
buttonProps: { ariaLabel: sortTitle, label: sortTitle },
|
|
3264
|
-
children: /* @__PURE__ */ jsx(Sort, {})
|
|
3265
|
-
}
|
|
3266
|
-
),
|
|
3267
|
-
hasFilters && /* @__PURE__ */ jsx(
|
|
3268
|
-
AccordionItem,
|
|
3269
|
-
{
|
|
3270
|
-
id: "FilterTypes",
|
|
3271
|
-
buttonProps: { ariaLabel: filterTypes, label: filterTypes },
|
|
3272
|
-
children: /* @__PURE__ */ jsx(tableController.filterTypes.Component, {})
|
|
3273
|
-
}
|
|
3274
|
-
)
|
|
3275
|
-
] }) });
|
|
3276
|
-
};
|
|
3277
|
-
|
|
3278
|
-
var __defProp$5 = Object.defineProperty;
|
|
3279
|
-
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3280
|
-
var __publicField$5 = (obj, key, value) => {
|
|
3281
|
-
__defNormalProp$5(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
3282
|
-
return value;
|
|
3283
|
-
};
|
|
3284
|
-
class AdditionalFiltersModal {
|
|
3285
|
-
constructor(queryController) {
|
|
3286
|
-
this.queryController = queryController;
|
|
3287
|
-
__publicField$5(this, "modalHandler", null);
|
|
3288
|
-
}
|
|
3289
|
-
getModalDefinition() {
|
|
3290
|
-
return {
|
|
3291
|
-
children: /* @__PURE__ */ jsx(
|
|
3292
|
-
AdditionalFiltersComponent,
|
|
3293
|
-
{
|
|
3294
|
-
tableController: this.queryController.tableController
|
|
3295
|
-
}
|
|
3296
|
-
),
|
|
3297
|
-
onConfirm: () => {
|
|
3298
|
-
},
|
|
3299
|
-
confirmProps: {
|
|
3300
|
-
hideConfirmButton: true,
|
|
3301
|
-
hideCancelButton: true,
|
|
3302
|
-
additionalButtonsOnRight: /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", flexDirection: "row", gap: "10px" }, children: [
|
|
3303
|
-
/* @__PURE__ */ jsx(
|
|
3304
|
-
SimpleButton,
|
|
3305
|
-
{
|
|
3306
|
-
variant: "primary-sm",
|
|
3307
|
-
onClick: () => {
|
|
3308
|
-
this.queryController.refresh();
|
|
3309
|
-
},
|
|
3310
|
-
children: getLabel("btnSearch").text
|
|
3311
|
-
}
|
|
3312
|
-
),
|
|
3313
|
-
/* @__PURE__ */ jsx(
|
|
3314
|
-
SimpleButton,
|
|
3315
|
-
{
|
|
3316
|
-
variant: "outline-sm",
|
|
3317
|
-
onClick: () => {
|
|
3318
|
-
this.queryController.clearFilters();
|
|
3319
|
-
},
|
|
3320
|
-
children: getLabel("btnClearFilter").text
|
|
3321
|
-
}
|
|
3322
|
-
)
|
|
3323
|
-
] })
|
|
3324
|
-
},
|
|
3325
|
-
draggable: true,
|
|
3326
|
-
variant: "layout.common.modals.apiaFinder.additionalFiltersModal",
|
|
3327
|
-
size: "xl"
|
|
3328
|
-
};
|
|
3329
|
-
}
|
|
3330
|
-
async openModal(properties) {
|
|
3331
|
-
this.queryController.tableController.filterTypes.initialLoad();
|
|
3332
|
-
this.modalHandler = ApiaUtil.instance.modals.open({
|
|
3333
|
-
...this.getModalDefinition(),
|
|
3334
|
-
...properties
|
|
3335
|
-
});
|
|
3336
|
-
}
|
|
3337
|
-
closeModal() {
|
|
3338
|
-
this.modalHandler?.close();
|
|
3339
|
-
}
|
|
3340
|
-
}
|
|
3341
|
-
|
|
3342
|
-
var __defProp$4 = Object.defineProperty;
|
|
3343
|
-
var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3344
|
-
var __publicField$4 = (obj, key, value) => {
|
|
3345
|
-
__defNormalProp$4(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
3225
|
+
var __defProp$7 = Object.defineProperty;
|
|
3226
|
+
var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3227
|
+
var __publicField$7 = (obj, key, value) => {
|
|
3228
|
+
__defNormalProp$7(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
3346
3229
|
return value;
|
|
3347
3230
|
};
|
|
3348
|
-
class
|
|
3349
|
-
constructor(
|
|
3350
|
-
__publicField$
|
|
3351
|
-
__publicField$
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
__publicField$4(this, "additionalFiltersController");
|
|
3355
|
-
__publicField$4(this, "openModal", async (properties) => {
|
|
3356
|
-
await this.queryController.initialLoad();
|
|
3357
|
-
this.modalHandler = ApiaUtil.instance.modals.open({
|
|
3358
|
-
...this.getModalDefinition(),
|
|
3359
|
-
...properties
|
|
3360
|
-
});
|
|
3361
|
-
});
|
|
3362
|
-
if (!queryController) {
|
|
3363
|
-
throw new Error("QueryController instance is required");
|
|
3364
|
-
}
|
|
3365
|
-
this.queryController = queryController;
|
|
3366
|
-
this.additionalFiltersController = new AdditionalFiltersModal(
|
|
3367
|
-
this.queryController
|
|
3368
|
-
);
|
|
3369
|
-
this.queryController.tableController.state.props = {
|
|
3370
|
-
isMultiple: false
|
|
3371
|
-
};
|
|
3372
|
-
this.queryController.tableController.on("onSelectRows", (ev) => {
|
|
3373
|
-
this.emitter.emit("onSelectRows", ev);
|
|
3374
|
-
this.modalHandler?.close();
|
|
3375
|
-
});
|
|
3376
|
-
this.queryController.tableController.on("onChangeSelection", (ev) => {
|
|
3377
|
-
this.currentSelection = ev;
|
|
3231
|
+
class Filter {
|
|
3232
|
+
constructor(properties) {
|
|
3233
|
+
__publicField$7(this, "tableName");
|
|
3234
|
+
__publicField$7(this, "filterState", {
|
|
3235
|
+
runAutomatically: false,
|
|
3236
|
+
value: ""
|
|
3378
3237
|
});
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
/* @__PURE__ */ jsx(tableController.Table, {}),
|
|
3386
|
-
/* @__PURE__ */ jsx(tableController.Pagination, {})
|
|
3387
|
-
] }),
|
|
3388
|
-
title: structure?.title,
|
|
3389
|
-
onConfirm: () => {
|
|
3390
|
-
this.emitter.emit("onSelectRows", this.currentSelection || []);
|
|
3391
|
-
},
|
|
3392
|
-
onCancel: () => {
|
|
3393
|
-
this.additionalFiltersController.closeModal();
|
|
3394
|
-
},
|
|
3395
|
-
confirmProps: {
|
|
3396
|
-
confirmButtonText: getLabel("btnCon").text,
|
|
3397
|
-
cancelButtonText: getLabel("btnCan").text
|
|
3398
|
-
},
|
|
3399
|
-
NavBar: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3400
|
-
/* @__PURE__ */ jsx(
|
|
3401
|
-
SimpleButton,
|
|
3238
|
+
__publicField$7(this, "Component", observer(({ filter }) => {
|
|
3239
|
+
const { onFilterBlur, onFilterPressEnter, onFilterChange, name } = useResponsiveTableContext();
|
|
3240
|
+
this.tableName = name;
|
|
3241
|
+
if (this.filterState?.isRange) {
|
|
3242
|
+
return /* @__PURE__ */ jsx(
|
|
3243
|
+
RangeFilter,
|
|
3402
3244
|
{
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
this.
|
|
3406
|
-
|
|
3407
|
-
|
|
3245
|
+
filter: {
|
|
3246
|
+
...filter,
|
|
3247
|
+
currentValue: this.filterState.value,
|
|
3248
|
+
isSize: this.filterState.isSize
|
|
3249
|
+
}
|
|
3408
3250
|
}
|
|
3409
|
-
)
|
|
3410
|
-
|
|
3411
|
-
|
|
3251
|
+
);
|
|
3252
|
+
}
|
|
3253
|
+
if (filter.options) {
|
|
3254
|
+
return /* @__PURE__ */ jsx(
|
|
3255
|
+
Select$1,
|
|
3412
3256
|
{
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
|
|
3257
|
+
value: this.filterState.value,
|
|
3258
|
+
onChange: (ev) => {
|
|
3259
|
+
this.filterState.value = ev.target.value;
|
|
3260
|
+
onFilterChange?.(filter);
|
|
3417
3261
|
},
|
|
3418
|
-
children:
|
|
3262
|
+
children: filter.options.map((c) => /* @__PURE__ */ jsx("option", { value: c.value, children: c.label }, c.value))
|
|
3419
3263
|
}
|
|
3420
|
-
)
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
|
|
3264
|
+
);
|
|
3265
|
+
}
|
|
3266
|
+
return /* @__PURE__ */ jsx(
|
|
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);
|
|
3428
3280
|
}
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3281
|
+
}
|
|
3282
|
+
);
|
|
3283
|
+
}));
|
|
3284
|
+
Object.assign(this.filterState, properties);
|
|
3285
|
+
makeObservable(this, { filterState: observable });
|
|
3286
|
+
reaction(
|
|
3287
|
+
() => this.filterState.value,
|
|
3288
|
+
() => {
|
|
3289
|
+
if (this.tableName) {
|
|
3290
|
+
getResponsiveTableContext(this.tableName).onFilterChange?.({
|
|
3291
|
+
id: properties.id,
|
|
3292
|
+
column: properties.column
|
|
3293
|
+
});
|
|
3294
|
+
}
|
|
3295
|
+
}
|
|
3296
|
+
);
|
|
3439
3297
|
}
|
|
3440
|
-
|
|
3441
|
-
return this.modalHandler;
|
|
3298
|
+
focus() {
|
|
3442
3299
|
}
|
|
3443
3300
|
}
|
|
3444
3301
|
|
|
@@ -3472,22 +3329,22 @@ const FilterTypesComponent = observer(
|
|
|
3472
3329
|
}
|
|
3473
3330
|
);
|
|
3474
3331
|
|
|
3475
|
-
var __defProp$
|
|
3476
|
-
var __defNormalProp$
|
|
3477
|
-
var __publicField$
|
|
3478
|
-
__defNormalProp$
|
|
3332
|
+
var __defProp$6 = Object.defineProperty;
|
|
3333
|
+
var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3334
|
+
var __publicField$6 = (obj, key, value) => {
|
|
3335
|
+
__defNormalProp$6(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
3479
3336
|
return value;
|
|
3480
3337
|
};
|
|
3481
3338
|
class FilterTypes {
|
|
3482
3339
|
constructor() {
|
|
3483
|
-
__publicField$
|
|
3484
|
-
__publicField$
|
|
3340
|
+
__publicField$6(this, "conditions", []);
|
|
3341
|
+
__publicField$6(this, "Component", () => /* @__PURE__ */ jsx(FilterTypesComponent, { filterTypes: this }));
|
|
3485
3342
|
makeObservable(this, {
|
|
3486
3343
|
conditions: observable
|
|
3487
3344
|
});
|
|
3488
3345
|
}
|
|
3489
3346
|
async getFilterTypes() {
|
|
3490
|
-
const result = await ApiaApi
|
|
3347
|
+
const result = await ApiaApi.post(
|
|
3491
3348
|
makeApiaUrl({
|
|
3492
3349
|
ajaxUrl: "apia.query.ModalAction.run?",
|
|
3493
3350
|
action: "filterOptions"
|
|
@@ -3501,7 +3358,7 @@ class FilterTypes {
|
|
|
3501
3358
|
await this.getFilterTypes();
|
|
3502
3359
|
}
|
|
3503
3360
|
async setFilterOptions() {
|
|
3504
|
-
const result = await ApiaApi
|
|
3361
|
+
const result = await ApiaApi.post(
|
|
3505
3362
|
makeApiaUrl({
|
|
3506
3363
|
ajaxUrl: "apia.query.ModalAction.run?",
|
|
3507
3364
|
action: "setFilterOptions"
|
|
@@ -3519,28 +3376,28 @@ class FilterTypes {
|
|
|
3519
3376
|
}
|
|
3520
3377
|
}
|
|
3521
3378
|
|
|
3522
|
-
var __defProp$
|
|
3523
|
-
var __defNormalProp$
|
|
3524
|
-
var __publicField$
|
|
3525
|
-
__defNormalProp$
|
|
3379
|
+
var __defProp$5 = Object.defineProperty;
|
|
3380
|
+
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3381
|
+
var __publicField$5 = (obj, key, value) => {
|
|
3382
|
+
__defNormalProp$5(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
3526
3383
|
return value;
|
|
3527
3384
|
};
|
|
3528
3385
|
let controllerCount = 0;
|
|
3529
3386
|
class TableController {
|
|
3530
3387
|
constructor(initialState) {
|
|
3531
|
-
__publicField$
|
|
3532
|
-
__publicField$
|
|
3533
|
-
__publicField$
|
|
3534
|
-
__publicField$
|
|
3535
|
-
__publicField$
|
|
3536
|
-
__publicField$
|
|
3388
|
+
__publicField$5(this, "emitter", new EventEmitter());
|
|
3389
|
+
__publicField$5(this, "tableName", `TableController${controllerCount++}`);
|
|
3390
|
+
__publicField$5(this, "tableSelectionController");
|
|
3391
|
+
__publicField$5(this, "controllerComponent", () => null);
|
|
3392
|
+
__publicField$5(this, "filterTypes", new FilterTypes());
|
|
3393
|
+
__publicField$5(this, "state", {
|
|
3537
3394
|
columns: /* @__PURE__ */ new Map(),
|
|
3538
3395
|
filters: /* @__PURE__ */ new Map(),
|
|
3539
3396
|
pagination: { currentPage: 0, totalPages: 0, totalRecords: 0 },
|
|
3540
3397
|
props: {},
|
|
3541
3398
|
rows: []
|
|
3542
3399
|
});
|
|
3543
|
-
__publicField$
|
|
3400
|
+
__publicField$5(this, "Context", ({ children }) => {
|
|
3544
3401
|
const state = this.state;
|
|
3545
3402
|
const props = toJS(state.props);
|
|
3546
3403
|
return /* @__PURE__ */ jsx(
|
|
@@ -3573,7 +3430,7 @@ class TableController {
|
|
|
3573
3430
|
}
|
|
3574
3431
|
);
|
|
3575
3432
|
});
|
|
3576
|
-
__publicField$
|
|
3433
|
+
__publicField$5(this, "Pagination", observer(() => {
|
|
3577
3434
|
return /* @__PURE__ */ jsx(
|
|
3578
3435
|
Pagination,
|
|
3579
3436
|
{
|
|
@@ -3585,7 +3442,7 @@ class TableController {
|
|
|
3585
3442
|
}
|
|
3586
3443
|
);
|
|
3587
3444
|
}));
|
|
3588
|
-
__publicField$
|
|
3445
|
+
__publicField$5(this, "Table", ResponsiveTable);
|
|
3589
3446
|
makeObservable(this, {
|
|
3590
3447
|
state: observable,
|
|
3591
3448
|
updateState: action
|
|
@@ -3638,7 +3495,8 @@ class TableController {
|
|
|
3638
3495
|
return {
|
|
3639
3496
|
id: c.filterState.id,
|
|
3640
3497
|
column: c.filterState.column,
|
|
3641
|
-
asAdditional: c.filterState.isAdditional || this.state.columns.get(c.filterState.column || "")?.hidden
|
|
3498
|
+
asAdditional: c.filterState.isAdditional || this.state.columns.get(c.filterState.column || "")?.hidden,
|
|
3499
|
+
options: c.filterState.options
|
|
3642
3500
|
};
|
|
3643
3501
|
});
|
|
3644
3502
|
}
|
|
@@ -3657,87 +3515,25 @@ class TableController {
|
|
|
3657
3515
|
}
|
|
3658
3516
|
}
|
|
3659
3517
|
|
|
3660
|
-
var __defProp$
|
|
3661
|
-
var __defNormalProp$
|
|
3662
|
-
var __publicField$
|
|
3663
|
-
__defNormalProp$
|
|
3664
|
-
return value;
|
|
3665
|
-
};
|
|
3666
|
-
class Filter {
|
|
3667
|
-
constructor(properties) {
|
|
3668
|
-
__publicField$1(this, "tableName");
|
|
3669
|
-
__publicField$1(this, "filterState", {
|
|
3670
|
-
runAutomatically: false,
|
|
3671
|
-
value: ""
|
|
3672
|
-
});
|
|
3673
|
-
__publicField$1(this, "Component", observer(({ filter }) => {
|
|
3674
|
-
const { onFilterBlur, onFilterPressEnter, name } = useResponsiveTableContext();
|
|
3675
|
-
this.tableName = name;
|
|
3676
|
-
return /* @__PURE__ */ jsx(
|
|
3677
|
-
Input$1,
|
|
3678
|
-
{
|
|
3679
|
-
value: this.filterState.value,
|
|
3680
|
-
onChange: (ev) => {
|
|
3681
|
-
this.filterState.value = ev.target.value;
|
|
3682
|
-
},
|
|
3683
|
-
onKeyDown: (ev) => {
|
|
3684
|
-
if (ev.code === "Enter") {
|
|
3685
|
-
onFilterPressEnter?.(filter);
|
|
3686
|
-
}
|
|
3687
|
-
},
|
|
3688
|
-
onBlur: () => {
|
|
3689
|
-
onFilterBlur?.(filter);
|
|
3690
|
-
}
|
|
3691
|
-
}
|
|
3692
|
-
);
|
|
3693
|
-
}));
|
|
3694
|
-
Object.assign(this.filterState, properties);
|
|
3695
|
-
makeObservable(this, { filterState: observable });
|
|
3696
|
-
reaction(
|
|
3697
|
-
() => this.filterState.value,
|
|
3698
|
-
() => {
|
|
3699
|
-
if (this.tableName) {
|
|
3700
|
-
getResponsiveTableContext(this.tableName).onFilterChange?.({
|
|
3701
|
-
id: properties.id,
|
|
3702
|
-
column: properties.column
|
|
3703
|
-
});
|
|
3704
|
-
}
|
|
3705
|
-
}
|
|
3706
|
-
);
|
|
3707
|
-
}
|
|
3708
|
-
focus() {
|
|
3709
|
-
}
|
|
3710
|
-
}
|
|
3711
|
-
|
|
3712
|
-
var __defProp = Object.defineProperty;
|
|
3713
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3714
|
-
var __publicField = (obj, key, value) => {
|
|
3715
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
3518
|
+
var __defProp$4 = Object.defineProperty;
|
|
3519
|
+
var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3520
|
+
var __publicField$4 = (obj, key, value) => {
|
|
3521
|
+
__defNormalProp$4(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
3716
3522
|
return value;
|
|
3717
3523
|
};
|
|
3718
3524
|
class QueryController {
|
|
3719
3525
|
constructor(ajaxUrl) {
|
|
3720
3526
|
this.ajaxUrl = ajaxUrl;
|
|
3721
|
-
__publicField(this, "hasInited", false);
|
|
3722
|
-
__publicField(this, "initializing", false);
|
|
3723
|
-
__publicField(this, "structure", null);
|
|
3724
|
-
__publicField(this, "tableController", new TableController());
|
|
3527
|
+
__publicField$4(this, "hasInited", false);
|
|
3528
|
+
__publicField$4(this, "initializing", false);
|
|
3529
|
+
__publicField$4(this, "structure", null);
|
|
3530
|
+
__publicField$4(this, "tableController", new TableController());
|
|
3725
3531
|
/**
|
|
3726
3532
|
* Allows to throttle calls to actual refresh method.
|
|
3727
3533
|
*/
|
|
3728
|
-
__publicField(this, "executeRefresh", throttle(
|
|
3534
|
+
__publicField$4(this, "executeRefresh", throttle(
|
|
3729
3535
|
async () => {
|
|
3730
|
-
|
|
3731
|
-
const refresh = await ApiaApi$1.post(
|
|
3732
|
-
makeApiaUrl(this.getRefreshParameters()),
|
|
3733
|
-
{
|
|
3734
|
-
postData: this.getFiltersValuesMap(),
|
|
3735
|
-
postDataTreatement: "stringify",
|
|
3736
|
-
stringifyOptions: { arrayFormat: "repeat" }
|
|
3737
|
-
}
|
|
3738
|
-
);
|
|
3739
|
-
this.parseRefreshResponse(refresh?.data);
|
|
3740
|
-
}
|
|
3536
|
+
await this.actualRefreshMethod();
|
|
3741
3537
|
},
|
|
3742
3538
|
300,
|
|
3743
3539
|
{ leading: false, trailing: true }
|
|
@@ -3752,10 +3548,10 @@ class QueryController {
|
|
|
3752
3548
|
this.tableController.on("onFilterChange", (ev) => {
|
|
3753
3549
|
const filter = this.tableController.state.filters.get(ev.id);
|
|
3754
3550
|
if (filter?.filterState.runAutomatically) {
|
|
3755
|
-
this.refresh();
|
|
3551
|
+
this.refresh(false);
|
|
3756
3552
|
}
|
|
3757
3553
|
});
|
|
3758
|
-
this.tableController.on("onFilterPressEnter", this.refresh
|
|
3554
|
+
this.tableController.on("onFilterPressEnter", () => this.refresh(true));
|
|
3759
3555
|
this.tableController.on("onRowClick", (ev) => {
|
|
3760
3556
|
});
|
|
3761
3557
|
this.tableController.on("onSelectRows", (ev) => {
|
|
@@ -3764,7 +3560,7 @@ class QueryController {
|
|
|
3764
3560
|
this.sort(ev.column.name);
|
|
3765
3561
|
});
|
|
3766
3562
|
this.tableController.on("onPage", this.page.bind(this));
|
|
3767
|
-
this.tableController.on("onRefresh", this.refresh
|
|
3563
|
+
this.tableController.on("onRefresh", () => this.refresh(true));
|
|
3768
3564
|
}
|
|
3769
3565
|
getLoadStructureParameters() {
|
|
3770
3566
|
return {
|
|
@@ -3821,7 +3617,7 @@ class QueryController {
|
|
|
3821
3617
|
hideFromAccordion: c.hide === "1",
|
|
3822
3618
|
id: c.name,
|
|
3823
3619
|
showAsAdditional: c.asMoreInformation,
|
|
3824
|
-
title: c.
|
|
3620
|
+
title: c.toolTip,
|
|
3825
3621
|
width: c.width
|
|
3826
3622
|
};
|
|
3827
3623
|
return column;
|
|
@@ -3883,7 +3679,7 @@ class QueryController {
|
|
|
3883
3679
|
]);
|
|
3884
3680
|
}
|
|
3885
3681
|
async getStructure() {
|
|
3886
|
-
const result = await ApiaApi
|
|
3682
|
+
const result = await ApiaApi.post(
|
|
3887
3683
|
makeApiaUrl(this.getLoadStructureParameters())
|
|
3888
3684
|
);
|
|
3889
3685
|
if (!result?.data) {
|
|
@@ -3912,7 +3708,7 @@ class QueryController {
|
|
|
3912
3708
|
this.tableController.state.rows = rows;
|
|
3913
3709
|
}
|
|
3914
3710
|
async clearFilters() {
|
|
3915
|
-
const result = await ApiaApi
|
|
3711
|
+
const result = await ApiaApi.post(
|
|
3916
3712
|
makeApiaUrl({ ...this.getClearFiltersParameters() })
|
|
3917
3713
|
);
|
|
3918
3714
|
if (!result?.data)
|
|
@@ -3934,7 +3730,7 @@ class QueryController {
|
|
|
3934
3730
|
}
|
|
3935
3731
|
}
|
|
3936
3732
|
async page(num) {
|
|
3937
|
-
const page = await ApiaApi
|
|
3733
|
+
const page = await ApiaApi.post(
|
|
3938
3734
|
makeApiaUrl({ ...this.getPageParameters(), pageNumber: num })
|
|
3939
3735
|
);
|
|
3940
3736
|
this.parseRefreshResponse(page?.data);
|
|
@@ -3944,11 +3740,24 @@ class QueryController {
|
|
|
3944
3740
|
(c) => c.filterState.required && !c.filterState.value && !c.filterState.isHidden
|
|
3945
3741
|
);
|
|
3946
3742
|
}
|
|
3947
|
-
async
|
|
3948
|
-
|
|
3743
|
+
async actualRefreshMethod() {
|
|
3744
|
+
if (!this.areRequiredFilters()) {
|
|
3745
|
+
const refresh = await ApiaApi.post(
|
|
3746
|
+
makeApiaUrl(this.getRefreshParameters()),
|
|
3747
|
+
{
|
|
3748
|
+
postData: this.getFiltersValuesMap(),
|
|
3749
|
+
postDataTreatement: "stringify",
|
|
3750
|
+
stringifyOptions: { arrayFormat: "repeat" }
|
|
3751
|
+
}
|
|
3752
|
+
);
|
|
3753
|
+
this.parseRefreshResponse(refresh?.data);
|
|
3754
|
+
}
|
|
3755
|
+
}
|
|
3756
|
+
async refresh(now = true) {
|
|
3757
|
+
return now ? this.actualRefreshMethod() : this.executeRefresh();
|
|
3949
3758
|
}
|
|
3950
3759
|
async sort(column) {
|
|
3951
|
-
const result = await ApiaApi
|
|
3760
|
+
const result = await ApiaApi.post(
|
|
3952
3761
|
makeApiaUrl({ ...this.getSortParameters(), orderBy: column })
|
|
3953
3762
|
);
|
|
3954
3763
|
if (result?.data) {
|
|
@@ -3959,5 +3768,552 @@ class QueryController {
|
|
|
3959
3768
|
}
|
|
3960
3769
|
}
|
|
3961
3770
|
|
|
3962
|
-
|
|
3771
|
+
const AdditionalFiltersComponent = ({
|
|
3772
|
+
tableController
|
|
3773
|
+
}) => {
|
|
3774
|
+
const filterTitle = getLabel("sbtFilters").text;
|
|
3775
|
+
const sortTitle = getLabel("titOrderBy").text;
|
|
3776
|
+
const filterTypes = getLabel("btnFilterType").text;
|
|
3777
|
+
const hasAdditional = !![...tableController.state.filters.values()].find(
|
|
3778
|
+
(f) => f.filterState.isAdditional
|
|
3779
|
+
);
|
|
3780
|
+
const hasFilters = !![...tableController.state.filters.values()].find(
|
|
3781
|
+
(f) => !f.filterState.isAdditional && f.filterState.column
|
|
3782
|
+
);
|
|
3783
|
+
const hasSortable = !![...tableController.state.columns.values()].find(
|
|
3784
|
+
(c) => c.allowSorting
|
|
3785
|
+
);
|
|
3786
|
+
return /* @__PURE__ */ jsx(TableContextReproducer, { tableName: tableController.getTableName(), children: /* @__PURE__ */ jsxs(Accordion, { className: "additionalFiltersContent", singleExpand: true, children: [
|
|
3787
|
+
hasFilters && /* @__PURE__ */ jsx(
|
|
3788
|
+
AccordionItem,
|
|
3789
|
+
{
|
|
3790
|
+
id: "Responsive",
|
|
3791
|
+
defaultExpanded: true,
|
|
3792
|
+
buttonProps: { ariaLabel: filterTitle, label: filterTitle },
|
|
3793
|
+
children: /* @__PURE__ */ jsx(Responsive, {})
|
|
3794
|
+
}
|
|
3795
|
+
),
|
|
3796
|
+
hasAdditional && /* @__PURE__ */ jsx(
|
|
3797
|
+
AccordionItem,
|
|
3798
|
+
{
|
|
3799
|
+
id: "Additional",
|
|
3800
|
+
buttonProps: {
|
|
3801
|
+
ariaLabel: "todo: additional",
|
|
3802
|
+
label: "todo:additional"
|
|
3803
|
+
},
|
|
3804
|
+
children: /* @__PURE__ */ jsx(Additional, {})
|
|
3805
|
+
}
|
|
3806
|
+
),
|
|
3807
|
+
hasSortable && /* @__PURE__ */ jsx(
|
|
3808
|
+
AccordionItem,
|
|
3809
|
+
{
|
|
3810
|
+
id: "Sort",
|
|
3811
|
+
buttonProps: { ariaLabel: sortTitle, label: sortTitle },
|
|
3812
|
+
children: /* @__PURE__ */ jsx(Sort, {})
|
|
3813
|
+
}
|
|
3814
|
+
),
|
|
3815
|
+
hasFilters && /* @__PURE__ */ jsx(
|
|
3816
|
+
AccordionItem,
|
|
3817
|
+
{
|
|
3818
|
+
id: "FilterTypes",
|
|
3819
|
+
buttonProps: { ariaLabel: filterTypes, label: filterTypes },
|
|
3820
|
+
children: /* @__PURE__ */ jsx(tableController.filterTypes.Component, {})
|
|
3821
|
+
}
|
|
3822
|
+
)
|
|
3823
|
+
] }) });
|
|
3824
|
+
};
|
|
3825
|
+
|
|
3826
|
+
var __defProp$3 = Object.defineProperty;
|
|
3827
|
+
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3828
|
+
var __publicField$3 = (obj, key, value) => {
|
|
3829
|
+
__defNormalProp$3(obj, key + "" , value);
|
|
3830
|
+
return value;
|
|
3831
|
+
};
|
|
3832
|
+
class AdditionalFiltersModal {
|
|
3833
|
+
constructor(queryController) {
|
|
3834
|
+
this.queryController = queryController;
|
|
3835
|
+
__publicField$3(this, "modalHandler", null);
|
|
3836
|
+
}
|
|
3837
|
+
getModalDefinition() {
|
|
3838
|
+
return {
|
|
3839
|
+
children: /* @__PURE__ */ jsx(
|
|
3840
|
+
AdditionalFiltersComponent,
|
|
3841
|
+
{
|
|
3842
|
+
tableController: this.queryController.tableController
|
|
3843
|
+
}
|
|
3844
|
+
),
|
|
3845
|
+
onConfirm: () => {
|
|
3846
|
+
},
|
|
3847
|
+
confirmProps: {
|
|
3848
|
+
hideConfirmButton: true,
|
|
3849
|
+
hideCancelButton: true,
|
|
3850
|
+
additionalButtonsOnRight: /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", flexDirection: "row", gap: "10px" }, children: [
|
|
3851
|
+
/* @__PURE__ */ jsx(
|
|
3852
|
+
SimpleButton,
|
|
3853
|
+
{
|
|
3854
|
+
variant: "primary-sm",
|
|
3855
|
+
onClick: () => {
|
|
3856
|
+
this.queryController.refresh();
|
|
3857
|
+
},
|
|
3858
|
+
children: getLabel("btnSearch").text
|
|
3859
|
+
}
|
|
3860
|
+
),
|
|
3861
|
+
/* @__PURE__ */ jsx(
|
|
3862
|
+
SimpleButton,
|
|
3863
|
+
{
|
|
3864
|
+
variant: "outline-sm",
|
|
3865
|
+
onClick: () => {
|
|
3866
|
+
this.queryController.clearFilters();
|
|
3867
|
+
},
|
|
3868
|
+
children: getLabel("btnClearFilter").text
|
|
3869
|
+
}
|
|
3870
|
+
)
|
|
3871
|
+
] })
|
|
3872
|
+
},
|
|
3873
|
+
draggable: true,
|
|
3874
|
+
variant: "layout.common.modals.apiaFinder.additionalFiltersModal",
|
|
3875
|
+
size: "xl"
|
|
3876
|
+
};
|
|
3877
|
+
}
|
|
3878
|
+
async openModal(properties) {
|
|
3879
|
+
this.queryController.tableController.filterTypes.initialLoad();
|
|
3880
|
+
this.modalHandler = ApiaUtil.instance.modals.open({
|
|
3881
|
+
...this.getModalDefinition(),
|
|
3882
|
+
...properties
|
|
3883
|
+
});
|
|
3884
|
+
}
|
|
3885
|
+
closeModal() {
|
|
3886
|
+
this.modalHandler?.close();
|
|
3887
|
+
}
|
|
3888
|
+
}
|
|
3889
|
+
|
|
3890
|
+
var __defProp$2 = Object.defineProperty;
|
|
3891
|
+
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3892
|
+
var __publicField$2 = (obj, key, value) => {
|
|
3893
|
+
__defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
3894
|
+
return value;
|
|
3895
|
+
};
|
|
3896
|
+
class QueryModalController {
|
|
3897
|
+
constructor(queryController) {
|
|
3898
|
+
__publicField$2(this, "emitter", new EventEmitter());
|
|
3899
|
+
__publicField$2(this, "queryController");
|
|
3900
|
+
__publicField$2(this, "modalHandler", null);
|
|
3901
|
+
__publicField$2(this, "currentSelection", null);
|
|
3902
|
+
__publicField$2(this, "additionalFiltersController");
|
|
3903
|
+
if (!queryController) {
|
|
3904
|
+
throw new Error("QueryController instance is required");
|
|
3905
|
+
}
|
|
3906
|
+
this.queryController = queryController;
|
|
3907
|
+
this.additionalFiltersController = new AdditionalFiltersModal(
|
|
3908
|
+
this.queryController
|
|
3909
|
+
);
|
|
3910
|
+
this.queryController.tableController.state.props = {
|
|
3911
|
+
isMultiple: false
|
|
3912
|
+
};
|
|
3913
|
+
this.queryController.tableController.on("onSelectRows", (ev) => {
|
|
3914
|
+
this.emitter.emit("onSelectRows", ev);
|
|
3915
|
+
this.modalHandler?.close();
|
|
3916
|
+
});
|
|
3917
|
+
this.queryController.tableController.on("onChangeSelection", (ev) => {
|
|
3918
|
+
this.currentSelection = ev;
|
|
3919
|
+
});
|
|
3920
|
+
}
|
|
3921
|
+
getModalDefinition() {
|
|
3922
|
+
const tableController = this.queryController.tableController;
|
|
3923
|
+
const structure = this.queryController.structure;
|
|
3924
|
+
return {
|
|
3925
|
+
children: /* @__PURE__ */ jsxs(tableController.Context, { children: [
|
|
3926
|
+
/* @__PURE__ */ jsx(tableController.Table, {}),
|
|
3927
|
+
/* @__PURE__ */ jsx(tableController.Pagination, {})
|
|
3928
|
+
] }),
|
|
3929
|
+
title: structure?.title,
|
|
3930
|
+
onConfirm: () => {
|
|
3931
|
+
this.emitter.emit("onSelectRows", this.currentSelection || []);
|
|
3932
|
+
},
|
|
3933
|
+
onCancel: () => {
|
|
3934
|
+
this.additionalFiltersController.closeModal();
|
|
3935
|
+
this.emitter.emit("cancel", null);
|
|
3936
|
+
},
|
|
3937
|
+
confirmProps: {
|
|
3938
|
+
confirmButtonText: getLabel("btnCon").text,
|
|
3939
|
+
cancelButtonText: getLabel("btnCan").text
|
|
3940
|
+
},
|
|
3941
|
+
NavBar: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3942
|
+
/* @__PURE__ */ jsx(
|
|
3943
|
+
SimpleButton,
|
|
3944
|
+
{
|
|
3945
|
+
variant: "primary-sm",
|
|
3946
|
+
onClick: () => {
|
|
3947
|
+
this.queryController.refresh();
|
|
3948
|
+
},
|
|
3949
|
+
children: getLabel("btnSearch").text
|
|
3950
|
+
}
|
|
3951
|
+
),
|
|
3952
|
+
/* @__PURE__ */ jsx(
|
|
3953
|
+
SimpleButton,
|
|
3954
|
+
{
|
|
3955
|
+
size: "sm",
|
|
3956
|
+
variant: "outline",
|
|
3957
|
+
onClick: async () => {
|
|
3958
|
+
this.additionalFiltersController.openModal();
|
|
3959
|
+
},
|
|
3960
|
+
children: getLabel("titAdmAdtFilter").text
|
|
3961
|
+
}
|
|
3962
|
+
),
|
|
3963
|
+
/* @__PURE__ */ jsx(
|
|
3964
|
+
SimpleButton,
|
|
3965
|
+
{
|
|
3966
|
+
size: "sm",
|
|
3967
|
+
variant: "outline",
|
|
3968
|
+
onClick: () => this.queryController.clearFilters(),
|
|
3969
|
+
children: getLabel("btnClearFilter").text
|
|
3970
|
+
}
|
|
3971
|
+
)
|
|
3972
|
+
] }),
|
|
3973
|
+
size: "finder"
|
|
3974
|
+
};
|
|
3975
|
+
}
|
|
3976
|
+
getQueryController() {
|
|
3977
|
+
return this.queryController;
|
|
3978
|
+
}
|
|
3979
|
+
on(ev, cb) {
|
|
3980
|
+
return this.emitter.on(ev, cb);
|
|
3981
|
+
}
|
|
3982
|
+
async openModal(properties) {
|
|
3983
|
+
await this.queryController.initialLoad();
|
|
3984
|
+
this.modalHandler = ApiaUtil.instance.modals.open({
|
|
3985
|
+
...this.getModalDefinition(),
|
|
3986
|
+
...properties
|
|
3987
|
+
});
|
|
3988
|
+
return new Promise((resolve) => {
|
|
3989
|
+
let uns1 = () => {
|
|
3990
|
+
}, uns2 = () => {
|
|
3991
|
+
};
|
|
3992
|
+
uns1 = this.on("onSelectRows", (res) => {
|
|
3993
|
+
uns1();
|
|
3994
|
+
uns2();
|
|
3995
|
+
resolve(res);
|
|
3996
|
+
});
|
|
3997
|
+
uns2 = this.on("cancel", () => {
|
|
3998
|
+
uns1();
|
|
3999
|
+
uns2();
|
|
4000
|
+
resolve([]);
|
|
4001
|
+
});
|
|
4002
|
+
});
|
|
4003
|
+
}
|
|
4004
|
+
getModalHandler() {
|
|
4005
|
+
return this.modalHandler;
|
|
4006
|
+
}
|
|
4007
|
+
}
|
|
4008
|
+
|
|
4009
|
+
var __defProp$1 = Object.defineProperty;
|
|
4010
|
+
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4011
|
+
var __publicField$1 = (obj, key, value) => {
|
|
4012
|
+
__defNormalProp$1(obj, key + "" , value);
|
|
4013
|
+
return value;
|
|
4014
|
+
};
|
|
4015
|
+
class GenericListQuery extends QueryController {
|
|
4016
|
+
constructor(ajaxUrl) {
|
|
4017
|
+
super(ajaxUrl);
|
|
4018
|
+
this.ajaxUrl = ajaxUrl;
|
|
4019
|
+
__publicField$1(this, "tableController", new TableController({
|
|
4020
|
+
props: { isMultiple: true }
|
|
4021
|
+
}));
|
|
4022
|
+
}
|
|
4023
|
+
getLoadStructureParameters() {
|
|
4024
|
+
return { ...super.getLoadStructureParameters(), action: "filter" };
|
|
4025
|
+
}
|
|
4026
|
+
getRefreshParameters() {
|
|
4027
|
+
return { ...super.getRefreshParameters() };
|
|
4028
|
+
}
|
|
4029
|
+
getSortParameters() {
|
|
4030
|
+
return {
|
|
4031
|
+
...super.getSortParameters()
|
|
4032
|
+
};
|
|
4033
|
+
}
|
|
4034
|
+
getFilterParameters() {
|
|
4035
|
+
return {
|
|
4036
|
+
ajaxUrl: this.ajaxUrl,
|
|
4037
|
+
action: "filter",
|
|
4038
|
+
react: true,
|
|
4039
|
+
isAjax: true
|
|
4040
|
+
};
|
|
4041
|
+
}
|
|
4042
|
+
getFiltersValuesMap() {
|
|
4043
|
+
return {};
|
|
4044
|
+
}
|
|
4045
|
+
async filter() {
|
|
4046
|
+
const filterResult = await ApiaApi.post(
|
|
4047
|
+
makeApiaUrl(this.getFilterParameters()),
|
|
4048
|
+
{
|
|
4049
|
+
postData: {
|
|
4050
|
+
...super.getFiltersValuesMap(),
|
|
4051
|
+
externalUser: false,
|
|
4052
|
+
selectOnlyOne: false,
|
|
4053
|
+
globalAndEnv: true,
|
|
4054
|
+
hierarchy: false,
|
|
4055
|
+
forOrgUnit: false,
|
|
4056
|
+
forCurrentEnv: false
|
|
4057
|
+
},
|
|
4058
|
+
postDataTreatement: "stringify",
|
|
4059
|
+
stringifyOptions: { arrayFormat: "repeat" }
|
|
4060
|
+
}
|
|
4061
|
+
);
|
|
4062
|
+
if (!filterResult?.data)
|
|
4063
|
+
return;
|
|
4064
|
+
const structure = this.parseLoadStructureResponse(filterResult.data);
|
|
4065
|
+
this.parseStructure(structure);
|
|
4066
|
+
setTimeout(() => {
|
|
4067
|
+
this.parseRefreshResponse(filterResult.data);
|
|
4068
|
+
}, 200);
|
|
4069
|
+
}
|
|
4070
|
+
parseLoadStructureResponse(response) {
|
|
4071
|
+
const typedResponse = response;
|
|
4072
|
+
const retrievedColumns = arrayOrArray(
|
|
4073
|
+
typedResponse.function?.messages?.result?.columns?.column
|
|
4074
|
+
);
|
|
4075
|
+
const retrievedFilters = arrayOrArray(
|
|
4076
|
+
typedResponse.function?.messages?.result?.filters?.filter
|
|
4077
|
+
);
|
|
4078
|
+
const returnObject = {
|
|
4079
|
+
columns: retrievedColumns.map((c) => {
|
|
4080
|
+
const column = {
|
|
4081
|
+
label: c.label,
|
|
4082
|
+
name: c.name
|
|
4083
|
+
};
|
|
4084
|
+
return column;
|
|
4085
|
+
}),
|
|
4086
|
+
filters: arrayOrArray(retrievedFilters).map((f, i) => {
|
|
4087
|
+
const filter = {
|
|
4088
|
+
id: `filter${String(i + 1)}`,
|
|
4089
|
+
value: f.value,
|
|
4090
|
+
avoidLabel: false,
|
|
4091
|
+
isHidden: f.isHidden,
|
|
4092
|
+
column: f.column,
|
|
4093
|
+
title: f.title,
|
|
4094
|
+
tooltip: f.tooltip,
|
|
4095
|
+
type: f.type,
|
|
4096
|
+
onChange: () => {
|
|
4097
|
+
},
|
|
4098
|
+
options: [],
|
|
4099
|
+
placeholder: f.title,
|
|
4100
|
+
readonly: f.readonly,
|
|
4101
|
+
required: f.required
|
|
4102
|
+
};
|
|
4103
|
+
return filter;
|
|
4104
|
+
}),
|
|
4105
|
+
description: "",
|
|
4106
|
+
hasAdditionalInformation: false,
|
|
4107
|
+
hideFilterTypes: false,
|
|
4108
|
+
isDynamic: false,
|
|
4109
|
+
openFiltersAutomatically: false,
|
|
4110
|
+
runFiltersAutomatically: false,
|
|
4111
|
+
title: ""
|
|
4112
|
+
};
|
|
4113
|
+
return returnObject;
|
|
4114
|
+
}
|
|
4115
|
+
async initialLoad() {
|
|
4116
|
+
await this.refresh();
|
|
4117
|
+
}
|
|
4118
|
+
async refresh() {
|
|
4119
|
+
await this.filter();
|
|
4120
|
+
}
|
|
4121
|
+
async sort(column) {
|
|
4122
|
+
const result = await ApiaApi.post(
|
|
4123
|
+
makeApiaUrl({ ...this.getSortParameters(), orderBy: column })
|
|
4124
|
+
);
|
|
4125
|
+
if (result?.data) {
|
|
4126
|
+
const structure = this.parseLoadStructureResponse(result.data);
|
|
4127
|
+
this.parseStructure(structure);
|
|
4128
|
+
}
|
|
4129
|
+
return super.refresh();
|
|
4130
|
+
}
|
|
4131
|
+
}
|
|
4132
|
+
|
|
4133
|
+
const ApiaUsersModal2 = new QueryModalController(
|
|
4134
|
+
new GenericListQuery("apia.modals.UsersAction.run")
|
|
4135
|
+
);
|
|
4136
|
+
|
|
4137
|
+
const ApiaPoolsModals2 = new QueryModalController(
|
|
4138
|
+
new GenericListQuery("apia.modals.PoolsAction.run")
|
|
4139
|
+
);
|
|
4140
|
+
|
|
4141
|
+
var __defProp = Object.defineProperty;
|
|
4142
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4143
|
+
var __publicField = (obj, key, value) => {
|
|
4144
|
+
__defNormalProp(obj, key + "" , value);
|
|
4145
|
+
return value;
|
|
4146
|
+
};
|
|
4147
|
+
class MonDocQuery extends QueryController {
|
|
4148
|
+
constructor(ajaxUrl) {
|
|
4149
|
+
super(ajaxUrl);
|
|
4150
|
+
this.ajaxUrl = ajaxUrl;
|
|
4151
|
+
__publicField(this, "dynamicParams", {});
|
|
4152
|
+
}
|
|
4153
|
+
initEvents() {
|
|
4154
|
+
this.tableController = new TableController({
|
|
4155
|
+
props: { isMultiple: true }
|
|
4156
|
+
});
|
|
4157
|
+
super.initEvents();
|
|
4158
|
+
this.tableController.on("onFilterChange", (ev) => {
|
|
4159
|
+
const filter = this.tableController.state.filters.get(ev.id);
|
|
4160
|
+
if (filter?.filterState.runAutomatically) {
|
|
4161
|
+
this.filter();
|
|
4162
|
+
}
|
|
4163
|
+
});
|
|
4164
|
+
}
|
|
4165
|
+
getLoadStructureParameters() {
|
|
4166
|
+
return {
|
|
4167
|
+
ajaxUrl: this.ajaxUrl,
|
|
4168
|
+
action: "init",
|
|
4169
|
+
react: true,
|
|
4170
|
+
isAjax: true,
|
|
4171
|
+
forCusDocMonMdl: true,
|
|
4172
|
+
...this.dynamicParams
|
|
4173
|
+
};
|
|
4174
|
+
}
|
|
4175
|
+
getRefreshParameters() {
|
|
4176
|
+
return { ...super.getRefreshParameters() };
|
|
4177
|
+
}
|
|
4178
|
+
getSortParameters() {
|
|
4179
|
+
return {
|
|
4180
|
+
...super.getSortParameters()
|
|
4181
|
+
};
|
|
4182
|
+
}
|
|
4183
|
+
setDynamicParams(params) {
|
|
4184
|
+
this.dynamicParams = params;
|
|
4185
|
+
}
|
|
4186
|
+
getFilterParameters() {
|
|
4187
|
+
return {
|
|
4188
|
+
ajaxUrl: this.ajaxUrl,
|
|
4189
|
+
action: "filter",
|
|
4190
|
+
react: true,
|
|
4191
|
+
isAjax: true
|
|
4192
|
+
};
|
|
4193
|
+
}
|
|
4194
|
+
async filter() {
|
|
4195
|
+
const filterResult = await ApiaApi.post(
|
|
4196
|
+
makeApiaUrl(this.getFilterParameters()),
|
|
4197
|
+
{
|
|
4198
|
+
postData: {
|
|
4199
|
+
...super.getFiltersValuesMap()
|
|
4200
|
+
},
|
|
4201
|
+
postDataTreatement: "stringify",
|
|
4202
|
+
stringifyOptions: { arrayFormat: "repeat" }
|
|
4203
|
+
}
|
|
4204
|
+
);
|
|
4205
|
+
if (!filterResult?.data)
|
|
4206
|
+
return;
|
|
4207
|
+
const structure = this.parseLoadStructureResponse(filterResult.data);
|
|
4208
|
+
this.parseStructure(structure);
|
|
4209
|
+
setTimeout(() => {
|
|
4210
|
+
this.parseRefreshResponse(filterResult.data);
|
|
4211
|
+
}, 200);
|
|
4212
|
+
}
|
|
4213
|
+
parseRefreshResponse(response) {
|
|
4214
|
+
const rows = response?.function?.messages?.result?.table?.row;
|
|
4215
|
+
const pageState = response?.function.messages.result.pageInfo;
|
|
4216
|
+
this.updatePageState(pageState);
|
|
4217
|
+
this.updateRows([
|
|
4218
|
+
...arrayOrArray(rows).map(
|
|
4219
|
+
(r) => ({
|
|
4220
|
+
rowProps: r,
|
|
4221
|
+
cells: [
|
|
4222
|
+
{},
|
|
4223
|
+
...arrayOrArray(r.cell).map((c) => {
|
|
4224
|
+
if (typeof c === "string") {
|
|
4225
|
+
return { children: c };
|
|
4226
|
+
}
|
|
4227
|
+
if (c && typeof c === "object") {
|
|
4228
|
+
if ("content" in c) {
|
|
4229
|
+
return { children: c.content, className: c.classToAdd };
|
|
4230
|
+
}
|
|
4231
|
+
if ("elemType" in c) {
|
|
4232
|
+
return { children: c.elemType };
|
|
4233
|
+
}
|
|
4234
|
+
}
|
|
4235
|
+
return { children: c };
|
|
4236
|
+
})
|
|
4237
|
+
],
|
|
4238
|
+
id: r?.id
|
|
4239
|
+
})
|
|
4240
|
+
)
|
|
4241
|
+
]);
|
|
4242
|
+
}
|
|
4243
|
+
parseLoadStructureResponse(response) {
|
|
4244
|
+
const typedResponse = response;
|
|
4245
|
+
const retrievedColumns = arrayOrArray(typedResponse.columns);
|
|
4246
|
+
const retrievedFilters = arrayOrArray(typedResponse.filters);
|
|
4247
|
+
const returnObject = {
|
|
4248
|
+
columns: retrievedColumns.map((c) => {
|
|
4249
|
+
const column = {
|
|
4250
|
+
label: c.label,
|
|
4251
|
+
name: c.name,
|
|
4252
|
+
allowSorting: c.allowSorting,
|
|
4253
|
+
dataSortBy: c.dataSortBy,
|
|
4254
|
+
minWidth: c.minWidth ?? "100px",
|
|
4255
|
+
sort: c.sort,
|
|
4256
|
+
toolTip: c.toolTip,
|
|
4257
|
+
width: c.width
|
|
4258
|
+
};
|
|
4259
|
+
return column;
|
|
4260
|
+
}),
|
|
4261
|
+
filters: arrayOrArray(retrievedFilters).map((f, i) => {
|
|
4262
|
+
const filter = {
|
|
4263
|
+
id: `filter${String(i + 1)}`,
|
|
4264
|
+
value: f.currentValue,
|
|
4265
|
+
avoidLabel: false,
|
|
4266
|
+
column: f.column,
|
|
4267
|
+
title: f.title,
|
|
4268
|
+
tooltip: f.toolTip,
|
|
4269
|
+
type: f.options ? "date" : "S",
|
|
4270
|
+
onChange: () => {
|
|
4271
|
+
},
|
|
4272
|
+
options: f.options?.map((option) => ({
|
|
4273
|
+
label: option.label ?? "",
|
|
4274
|
+
value: option.value
|
|
4275
|
+
})),
|
|
4276
|
+
placeholder: f.title,
|
|
4277
|
+
isRange: f.isRange,
|
|
4278
|
+
isSize: f.isSize
|
|
4279
|
+
// readonly: f.readonly,
|
|
4280
|
+
// required: f.required,
|
|
4281
|
+
};
|
|
4282
|
+
return filter;
|
|
4283
|
+
}),
|
|
4284
|
+
description: "",
|
|
4285
|
+
hasAdditionalInformation: response.additionalInfoInTable,
|
|
4286
|
+
hideFilterTypes: false,
|
|
4287
|
+
isDynamic: false,
|
|
4288
|
+
openFiltersAutomatically: false,
|
|
4289
|
+
runFiltersAutomatically: false,
|
|
4290
|
+
title: ""
|
|
4291
|
+
};
|
|
4292
|
+
return returnObject;
|
|
4293
|
+
}
|
|
4294
|
+
async sort(column) {
|
|
4295
|
+
const result = await ApiaApi.post(
|
|
4296
|
+
makeApiaUrl({ ...this.getSortParameters(), orderBy: column })
|
|
4297
|
+
);
|
|
4298
|
+
if (result?.data) {
|
|
4299
|
+
const structure = this.parseLoadStructureResponse(result.data);
|
|
4300
|
+
this.parseStructure(structure);
|
|
4301
|
+
}
|
|
4302
|
+
return super.refresh();
|
|
4303
|
+
}
|
|
4304
|
+
}
|
|
4305
|
+
class ApiaMonDocModal extends QueryModalController {
|
|
4306
|
+
constructor() {
|
|
4307
|
+
super(new MonDocQuery("/apia.execution.CustMonDocumentAction.run"));
|
|
4308
|
+
}
|
|
4309
|
+
openModal(properties) {
|
|
4310
|
+
this.queryController.setDynamicParams(
|
|
4311
|
+
properties.monitorProperties
|
|
4312
|
+
);
|
|
4313
|
+
return super.openModal(properties);
|
|
4314
|
+
}
|
|
4315
|
+
}
|
|
4316
|
+
const ApiaMonDocModal2 = new ApiaMonDocModal();
|
|
4317
|
+
|
|
4318
|
+
export { ApiaApi, ApiaApiHandler, ApiaMonDocModal2, ApiaPoolsModals2, ApiaUsersModal2, QueryController, QueryModalController, getFunction, getModal, isHtmlResponse, isXmlResponse, makeApiaUrl, parseSuccessfulResponse };
|
|
3963
4319
|
//# sourceMappingURL=index.js.map
|