datastake-daf 0.6.402 → 0.6.404
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/components/index.js +13 -12
- package/dist/hooks/index.js +8 -8
- package/dist/utils/index.js +13 -12
- package/package.json +1 -1
- package/src/@daf/utils/filters.js +85 -89
package/dist/components/index.js
CHANGED
|
@@ -46938,13 +46938,13 @@ const getType = namespace => {
|
|
|
46938
46938
|
}
|
|
46939
46939
|
};
|
|
46940
46940
|
|
|
46941
|
-
const defaultFilterKeys = [
|
|
46941
|
+
const defaultFilterKeys = ["search", "sortDir", "sortBy", "timeframe", "activeTab"];
|
|
46942
46942
|
function hasJsonStructure(str) {
|
|
46943
|
-
if (typeof str !==
|
|
46943
|
+
if (typeof str !== "string") return false;
|
|
46944
46944
|
try {
|
|
46945
46945
|
const result = JSON.parse(str);
|
|
46946
46946
|
const type = Object.prototype.toString.call(result);
|
|
46947
|
-
return type ===
|
|
46947
|
+
return type === "[object Object]" || type === "[object Array]";
|
|
46948
46948
|
} catch (err) {
|
|
46949
46949
|
return false;
|
|
46950
46950
|
}
|
|
@@ -46966,16 +46966,16 @@ const getDefaultActiveFilters = (params, selectFiltersConfig, defaultPageSize, d
|
|
|
46966
46966
|
}
|
|
46967
46967
|
}
|
|
46968
46968
|
});
|
|
46969
|
-
if (params.has(
|
|
46969
|
+
if (params.has("searchParams")) {
|
|
46970
46970
|
try {
|
|
46971
|
-
o.searchParams = JSON.parse(params.get(
|
|
46971
|
+
o.searchParams = JSON.parse(params.get("searchParams"));
|
|
46972
46972
|
} catch (e) {
|
|
46973
|
-
o.searchParams = params.get(
|
|
46973
|
+
o.searchParams = params.get("searchParams").split(",");
|
|
46974
46974
|
}
|
|
46975
46975
|
}
|
|
46976
46976
|
if (doPagination) {
|
|
46977
|
-
o.page = Number(params.get(
|
|
46978
|
-
o.pageSize = Number(params.get(
|
|
46977
|
+
o.page = Number(params.get("page")) || 1;
|
|
46978
|
+
o.pageSize = Number(params.get("pageSize")) || defaultPageSize;
|
|
46979
46979
|
}
|
|
46980
46980
|
Object.keys(selectFiltersConfig).forEach(k => {
|
|
46981
46981
|
if (params.has(k)) {
|
|
@@ -46988,7 +46988,8 @@ const getDefaultActiveFilters = (params, selectFiltersConfig, defaultPageSize, d
|
|
|
46988
46988
|
});
|
|
46989
46989
|
return o;
|
|
46990
46990
|
};
|
|
46991
|
-
const
|
|
46991
|
+
const NEW_PAGINATION_APPS = ["nashiriki"];
|
|
46992
|
+
const filterParams = (value, module) => {
|
|
46992
46993
|
const {
|
|
46993
46994
|
activeFilters,
|
|
46994
46995
|
...rest
|
|
@@ -47004,8 +47005,8 @@ const filterParams = value => {
|
|
|
47004
47005
|
} = activeFilters || {};
|
|
47005
47006
|
const params = {};
|
|
47006
47007
|
params.pagination = JSON.stringify({
|
|
47007
|
-
skip: page,
|
|
47008
|
-
take: pageSize
|
|
47008
|
+
[NEW_PAGINATION_APPS.includes(module) ? "skip" : "page"]: page,
|
|
47009
|
+
[NEW_PAGINATION_APPS.includes(module) ? "take" : "pageSize"]: pageSize
|
|
47009
47010
|
});
|
|
47010
47011
|
if (search && searchParams) {
|
|
47011
47012
|
params.search = JSON.stringify({
|
|
@@ -47020,7 +47021,7 @@ const filterParams = value => {
|
|
|
47020
47021
|
});
|
|
47021
47022
|
}
|
|
47022
47023
|
if (Object.keys(filters).length) {
|
|
47023
|
-
if (value.sourceId && value.sourceId ===
|
|
47024
|
+
if (value.sourceId && value.sourceId === "overview") {
|
|
47024
47025
|
params.filters = JSON.stringify(filters);
|
|
47025
47026
|
} else {
|
|
47026
47027
|
params.filters = JSON.stringify({
|
package/dist/hooks/index.js
CHANGED
|
@@ -12,13 +12,13 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
12
12
|
|
|
13
13
|
var L__default = /*#__PURE__*/_interopDefaultLegacy(L);
|
|
14
14
|
|
|
15
|
-
const defaultFilterKeys = [
|
|
15
|
+
const defaultFilterKeys = ["search", "sortDir", "sortBy", "timeframe", "activeTab"];
|
|
16
16
|
function hasJsonStructure(str) {
|
|
17
|
-
if (typeof str !==
|
|
17
|
+
if (typeof str !== "string") return false;
|
|
18
18
|
try {
|
|
19
19
|
const result = JSON.parse(str);
|
|
20
20
|
const type = Object.prototype.toString.call(result);
|
|
21
|
-
return type ===
|
|
21
|
+
return type === "[object Object]" || type === "[object Array]";
|
|
22
22
|
} catch (err) {
|
|
23
23
|
return false;
|
|
24
24
|
}
|
|
@@ -40,16 +40,16 @@ const getDefaultActiveFilters = (params, selectFiltersConfig, defaultPageSize, d
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
});
|
|
43
|
-
if (params.has(
|
|
43
|
+
if (params.has("searchParams")) {
|
|
44
44
|
try {
|
|
45
|
-
o.searchParams = JSON.parse(params.get(
|
|
45
|
+
o.searchParams = JSON.parse(params.get("searchParams"));
|
|
46
46
|
} catch (e) {
|
|
47
|
-
o.searchParams = params.get(
|
|
47
|
+
o.searchParams = params.get("searchParams").split(",");
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
if (doPagination) {
|
|
51
|
-
o.page = Number(params.get(
|
|
52
|
-
o.pageSize = Number(params.get(
|
|
51
|
+
o.page = Number(params.get("page")) || 1;
|
|
52
|
+
o.pageSize = Number(params.get("pageSize")) || defaultPageSize;
|
|
53
53
|
}
|
|
54
54
|
Object.keys(selectFiltersConfig).forEach(k => {
|
|
55
55
|
if (params.has(k)) {
|
package/dist/utils/index.js
CHANGED
|
@@ -6045,13 +6045,13 @@ const editErrorHandler = ({
|
|
|
6045
6045
|
}
|
|
6046
6046
|
};
|
|
6047
6047
|
|
|
6048
|
-
const defaultFilterKeys = [
|
|
6048
|
+
const defaultFilterKeys = ["search", "sortDir", "sortBy", "timeframe", "activeTab"];
|
|
6049
6049
|
function hasJsonStructure(str) {
|
|
6050
|
-
if (typeof str !==
|
|
6050
|
+
if (typeof str !== "string") return false;
|
|
6051
6051
|
try {
|
|
6052
6052
|
const result = JSON.parse(str);
|
|
6053
6053
|
const type = Object.prototype.toString.call(result);
|
|
6054
|
-
return type ===
|
|
6054
|
+
return type === "[object Object]" || type === "[object Array]";
|
|
6055
6055
|
} catch (err) {
|
|
6056
6056
|
return false;
|
|
6057
6057
|
}
|
|
@@ -6073,16 +6073,16 @@ const getDefaultActiveFilters = (params, selectFiltersConfig, defaultPageSize, d
|
|
|
6073
6073
|
}
|
|
6074
6074
|
}
|
|
6075
6075
|
});
|
|
6076
|
-
if (params.has(
|
|
6076
|
+
if (params.has("searchParams")) {
|
|
6077
6077
|
try {
|
|
6078
|
-
o.searchParams = JSON.parse(params.get(
|
|
6078
|
+
o.searchParams = JSON.parse(params.get("searchParams"));
|
|
6079
6079
|
} catch (e) {
|
|
6080
|
-
o.searchParams = params.get(
|
|
6080
|
+
o.searchParams = params.get("searchParams").split(",");
|
|
6081
6081
|
}
|
|
6082
6082
|
}
|
|
6083
6083
|
if (doPagination) {
|
|
6084
|
-
o.page = Number(params.get(
|
|
6085
|
-
o.pageSize = Number(params.get(
|
|
6084
|
+
o.page = Number(params.get("page")) || 1;
|
|
6085
|
+
o.pageSize = Number(params.get("pageSize")) || defaultPageSize;
|
|
6086
6086
|
}
|
|
6087
6087
|
Object.keys(selectFiltersConfig).forEach(k => {
|
|
6088
6088
|
if (params.has(k)) {
|
|
@@ -6095,7 +6095,8 @@ const getDefaultActiveFilters = (params, selectFiltersConfig, defaultPageSize, d
|
|
|
6095
6095
|
});
|
|
6096
6096
|
return o;
|
|
6097
6097
|
};
|
|
6098
|
-
const
|
|
6098
|
+
const NEW_PAGINATION_APPS = ["nashiriki"];
|
|
6099
|
+
const filterParams = (value, module) => {
|
|
6099
6100
|
const {
|
|
6100
6101
|
activeFilters,
|
|
6101
6102
|
...rest
|
|
@@ -6111,8 +6112,8 @@ const filterParams = value => {
|
|
|
6111
6112
|
} = activeFilters || {};
|
|
6112
6113
|
const params = {};
|
|
6113
6114
|
params.pagination = JSON.stringify({
|
|
6114
|
-
skip: page,
|
|
6115
|
-
take: pageSize
|
|
6115
|
+
[NEW_PAGINATION_APPS.includes(module) ? "skip" : "page"]: page,
|
|
6116
|
+
[NEW_PAGINATION_APPS.includes(module) ? "take" : "pageSize"]: pageSize
|
|
6116
6117
|
});
|
|
6117
6118
|
if (search && searchParams) {
|
|
6118
6119
|
params.search = JSON.stringify({
|
|
@@ -6127,7 +6128,7 @@ const filterParams = value => {
|
|
|
6127
6128
|
});
|
|
6128
6129
|
}
|
|
6129
6130
|
if (Object.keys(filters).length) {
|
|
6130
|
-
if (value.sourceId && value.sourceId ===
|
|
6131
|
+
if (value.sourceId && value.sourceId === "overview") {
|
|
6131
6132
|
params.filters = JSON.stringify(filters);
|
|
6132
6133
|
} else {
|
|
6133
6134
|
params.filters = JSON.stringify({
|
package/package.json
CHANGED
|
@@ -1,106 +1,102 @@
|
|
|
1
|
-
export const defaultFilterKeys = [
|
|
1
|
+
export const defaultFilterKeys = ["search", "sortDir", "sortBy", "timeframe", "activeTab"];
|
|
2
2
|
|
|
3
3
|
function hasJsonStructure(str) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
4
|
+
if (typeof str !== "string") return false;
|
|
5
|
+
try {
|
|
6
|
+
const result = JSON.parse(str);
|
|
7
|
+
const type = Object.prototype.toString.call(result);
|
|
8
|
+
return type === "[object Object]" || type === "[object Array]";
|
|
9
|
+
} catch (err) {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
13
12
|
}
|
|
14
13
|
|
|
15
|
-
export const getDefaultActiveFilters = (
|
|
16
|
-
|
|
14
|
+
export const getDefaultActiveFilters = (
|
|
15
|
+
params,
|
|
16
|
+
selectFiltersConfig,
|
|
17
|
+
defaultPageSize,
|
|
18
|
+
defaultFilters = {},
|
|
19
|
+
doPagination,
|
|
20
|
+
) => {
|
|
21
|
+
const o = {};
|
|
17
22
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
23
|
+
defaultFilterKeys.forEach((k) => {
|
|
24
|
+
if (params.has(k)) {
|
|
25
|
+
if (hasJsonStructure(params.get(k))) {
|
|
26
|
+
o[k] = JSON.parse(params.get(k));
|
|
27
|
+
} else {
|
|
28
|
+
o[k] = params.get(k);
|
|
29
|
+
}
|
|
30
|
+
} else if (defaultFilters[k]) {
|
|
31
|
+
if (hasJsonStructure(defaultFilters[k])) {
|
|
32
|
+
o[k] = JSON.parse(defaultFilters[k]);
|
|
33
|
+
} else {
|
|
34
|
+
o[k] = defaultFilters[k];
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
});
|
|
33
38
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
if (params.has("searchParams")) {
|
|
40
|
+
try {
|
|
41
|
+
o.searchParams = JSON.parse(params.get("searchParams"));
|
|
42
|
+
} catch (e) {
|
|
43
|
+
o.searchParams = params.get("searchParams").split(",");
|
|
44
|
+
}
|
|
45
|
+
}
|
|
41
46
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
47
|
+
if (doPagination) {
|
|
48
|
+
o.page = Number(params.get("page")) || 1;
|
|
49
|
+
o.pageSize = Number(params.get("pageSize")) || defaultPageSize;
|
|
50
|
+
}
|
|
46
51
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
52
|
+
Object.keys(selectFiltersConfig).forEach((k) => {
|
|
53
|
+
if (params.has(k)) {
|
|
54
|
+
if (hasJsonStructure(params.get(k))) {
|
|
55
|
+
o[k] = JSON.parse(params.get(k));
|
|
56
|
+
} else {
|
|
57
|
+
o[k] = params.get(k);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
});
|
|
56
61
|
|
|
57
|
-
|
|
58
|
-
}
|
|
62
|
+
return o;
|
|
63
|
+
};
|
|
59
64
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
...rest
|
|
64
|
-
} = value;
|
|
65
|
+
const NEW_PAGINATION_APPS = ["nashiriki"];
|
|
66
|
+
export const filterParams = (value, module) => {
|
|
67
|
+
const { activeFilters, ...rest } = value;
|
|
65
68
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
pageSize,
|
|
69
|
-
sortDir,
|
|
70
|
-
sortBy,
|
|
71
|
-
search,
|
|
72
|
-
searchParams,
|
|
73
|
-
...filters
|
|
74
|
-
} = activeFilters || {};
|
|
69
|
+
const { page, pageSize, sortDir, sortBy, search, searchParams, ...filters } =
|
|
70
|
+
activeFilters || {};
|
|
75
71
|
|
|
76
|
-
|
|
72
|
+
const params = {};
|
|
77
73
|
|
|
78
|
-
|
|
79
|
-
skip: page,
|
|
80
|
-
take: pageSize,
|
|
81
|
-
|
|
74
|
+
params.pagination = JSON.stringify({
|
|
75
|
+
[NEW_PAGINATION_APPS.includes(module) ? "skip" : "page"]: page,
|
|
76
|
+
[NEW_PAGINATION_APPS.includes(module) ? "take" : "pageSize"]: pageSize,
|
|
77
|
+
});
|
|
82
78
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
79
|
+
if (search && searchParams) {
|
|
80
|
+
params.search = JSON.stringify({
|
|
81
|
+
qs: search,
|
|
82
|
+
fields: searchParams,
|
|
83
|
+
});
|
|
84
|
+
}
|
|
89
85
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
86
|
+
if (sortDir && sortBy) {
|
|
87
|
+
params.sort = JSON.stringify({
|
|
88
|
+
dir: sortDir,
|
|
89
|
+
by: sortBy,
|
|
90
|
+
});
|
|
91
|
+
}
|
|
96
92
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
93
|
+
if (Object.keys(filters).length) {
|
|
94
|
+
if (value.sourceId && value.sourceId === "overview") {
|
|
95
|
+
params.filters = JSON.stringify(filters);
|
|
96
|
+
} else {
|
|
97
|
+
params.filters = JSON.stringify({ ...filters, authorId: undefined });
|
|
98
|
+
}
|
|
99
|
+
}
|
|
104
100
|
|
|
105
|
-
|
|
106
|
-
};
|
|
101
|
+
return { ...rest, ...params };
|
|
102
|
+
};
|