datastake-daf 0.6.832 → 0.6.834
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/build/favicon.ico +0 -0
- package/build/logo192.png +0 -0
- package/build/logo512.png +0 -0
- package/build/manifest.json +25 -0
- package/build/robots.txt +3 -0
- package/dist/components/index.js +2138 -2046
- package/dist/pages/index.js +40 -31
- package/dist/utils/index.js +3 -3
- package/package.json +1 -1
- package/src/@daf/core/components/AuthForm/index.jsx +2 -0
- package/src/@daf/core/components/Screens/Admin/AdminScreens/Documents.jsx +4 -0
- package/src/@daf/core/components/Screens/Admin/AdminScreens/Events.jsx +4 -0
- package/src/@daf/core/components/Screens/Admin/AdminScreens/Location.jsx +4 -0
- package/src/@daf/core/components/Screens/Admin/AdminScreens/Subjects.jsx +4 -0
- package/src/@daf/core/components/Screens/Admin/AdminTables/DocumentsTable/helper.js +19 -29
- package/src/@daf/core/components/Screens/Admin/AdminTables/DocumentsTable/index.jsx +16 -3
- package/src/@daf/core/components/Screens/Admin/AdminTables/EventsTable/helper.js +15 -20
- package/src/@daf/core/components/Screens/Admin/AdminTables/EventsTable/index.jsx +13 -4
- package/src/@daf/core/components/Screens/Admin/AdminTables/LocationTable/helper.js +114 -29
- package/src/@daf/core/components/Screens/Admin/AdminTables/LocationTable/index.jsx +16 -3
- package/src/@daf/core/components/Screens/Admin/AdminTables/SubjectsTable/helper.js +29 -29
- package/src/@daf/core/components/Screens/Admin/AdminTables/SubjectsTable/index.jsx +16 -3
- package/src/@daf/core/components/Screens/Admin/AdminTables/hook.js +1 -0
- package/src/@daf/core/components/UI/SingleTruncatedLine/index.jsx +25 -0
- package/src/@daf/pages/Edit/index.jsx +7 -1
- package/src/@daf/pages/Events/Activities/columns.js +5 -2
- package/src/@daf/pages/Summary/Minesite/components/MineSiteDetails/config.js +4 -35
- package/src/helpers/dataFetch.js +3 -3
- package/src/index.js +1 -0
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
export const
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
}
|
|
1
|
+
export const getFiltersConfig = ({t}) => {
|
|
2
|
+
return {
|
|
3
|
+
country: {
|
|
4
|
+
type: 'select',
|
|
5
|
+
placeholder: t('Country'),
|
|
6
|
+
style: { flex: 1 },
|
|
7
|
+
labelStyle: { flex: 1 },
|
|
8
|
+
getLabel: (option) => option.label,
|
|
9
|
+
getValue: (option) => option.value,
|
|
10
|
+
},
|
|
11
|
+
category:{
|
|
12
|
+
type: 'select',
|
|
13
|
+
label: 'Category',
|
|
14
|
+
placeholder: (t) => `${t('Filter by')} ${t('Category').toLowerCase()}`,
|
|
15
|
+
style: { flex: 1 },
|
|
16
|
+
labelStyle: { flex: 1 },
|
|
17
|
+
getLabel: (option) => option.label,
|
|
18
|
+
getValue: (option) => option.value,
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const getFilterOptions = (options, t) => {
|
|
24
|
+
const { countries, category, categoriesOptions } = options || {};
|
|
25
|
+
return {
|
|
26
|
+
country: countries || [],
|
|
27
|
+
category: categoriesOptions || category || [],
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
30
|
|
|
31
31
|
export const filtersConfig = {
|
|
32
32
|
name: "",
|
|
@@ -5,7 +5,8 @@ import DAFTable from "../../../../Table/index.jsx";
|
|
|
5
5
|
import { theme, Tag, message } from "antd";
|
|
6
6
|
import CustomIcon from "../../../../Icon/CustomIcon.jsx";
|
|
7
7
|
import {
|
|
8
|
-
|
|
8
|
+
getFiltersConfig,
|
|
9
|
+
getFilterOptions,
|
|
9
10
|
filtersConfig,
|
|
10
11
|
defaultUrlParams,
|
|
11
12
|
checkboxConfig,
|
|
@@ -33,6 +34,8 @@ export default function SubjectsTable({
|
|
|
33
34
|
refetchTrigger,
|
|
34
35
|
user,
|
|
35
36
|
options,
|
|
37
|
+
APP,
|
|
38
|
+
apiUrl
|
|
36
39
|
}) {
|
|
37
40
|
const [showFilters, setShowFilters] = useState(false);
|
|
38
41
|
const [hasError, setHasError] = useState(false);
|
|
@@ -40,6 +43,14 @@ export default function SubjectsTable({
|
|
|
40
43
|
const { token } = useToken();
|
|
41
44
|
const [isCombineModalOpen, setIsModalOpen] = useState(false);
|
|
42
45
|
|
|
46
|
+
const selectFiltersConfig = useMemo(() => {
|
|
47
|
+
return getFiltersConfig({t});
|
|
48
|
+
}, [t]);
|
|
49
|
+
|
|
50
|
+
const filterOptions = useMemo(() => {
|
|
51
|
+
return getFilterOptions(options, t);
|
|
52
|
+
}, [options, t]);
|
|
53
|
+
|
|
43
54
|
const {
|
|
44
55
|
filter,
|
|
45
56
|
activeTab,
|
|
@@ -104,7 +115,7 @@ export default function SubjectsTable({
|
|
|
104
115
|
hasError={hasError}
|
|
105
116
|
setHasError={setHasError}
|
|
106
117
|
canClearSearch={canClearSearch}
|
|
107
|
-
selectOptions={
|
|
118
|
+
selectOptions={filterOptions}
|
|
108
119
|
checkboxConfig={checkboxConfig}
|
|
109
120
|
defaultTableFilters={{}}
|
|
110
121
|
breadcrumbs={breadcrumbs}
|
|
@@ -133,7 +144,7 @@ export default function SubjectsTable({
|
|
|
133
144
|
hideOnLoading={false}
|
|
134
145
|
pagination={filter.pagination}
|
|
135
146
|
rowKey="id"
|
|
136
|
-
selectOptions={
|
|
147
|
+
selectOptions={filterOptions}
|
|
137
148
|
doEmptyRows
|
|
138
149
|
setShowFilters={setShowFilters}
|
|
139
150
|
filtersConfig={selectFiltersConfig}
|
|
@@ -141,6 +152,8 @@ export default function SubjectsTable({
|
|
|
141
152
|
showFilters={showFilters}
|
|
142
153
|
defaultFilters={filter.defaultFilters}
|
|
143
154
|
onChange={filter.onTableChange}
|
|
155
|
+
app={APP}
|
|
156
|
+
apiUrl={apiUrl}
|
|
144
157
|
/>
|
|
145
158
|
</AdminTable>
|
|
146
159
|
|
|
@@ -124,6 +124,7 @@ export const useGetParams = ({location}) => {
|
|
|
124
124
|
...(Object.keys(rest)?.length > 0 && rest ),
|
|
125
125
|
...(Object.keys(cleanSearchParams)?.length > 0 && { search: cleanSearchParams }),
|
|
126
126
|
tab: activeTab,
|
|
127
|
+
...(activeTab === "deleted" && {status: 'deleted'})
|
|
127
128
|
}
|
|
128
129
|
}, [location.search]);
|
|
129
130
|
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Tooltip } from 'antd';
|
|
3
|
+
|
|
4
|
+
const SingleTruncatedLine = ({data = []}) => {
|
|
5
|
+
const displayText = data?.join(", ");
|
|
6
|
+
const tooltipText = data?.join("\n");
|
|
7
|
+
|
|
8
|
+
return (
|
|
9
|
+
<Tooltip title={<div style={{ whiteSpace: "pre-line" }}>{tooltipText}</div>}>
|
|
10
|
+
<div
|
|
11
|
+
style={{
|
|
12
|
+
fontWeight: "normal",
|
|
13
|
+
overflow: "hidden",
|
|
14
|
+
textOverflow: "ellipsis",
|
|
15
|
+
whiteSpace: "nowrap",
|
|
16
|
+
maxWidth: "100%"
|
|
17
|
+
}}
|
|
18
|
+
>
|
|
19
|
+
{displayText}
|
|
20
|
+
</div>
|
|
21
|
+
</Tooltip>
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export default SingleTruncatedLine
|
|
@@ -137,6 +137,12 @@ const Edit = ({
|
|
|
137
137
|
namespaceOverrides,
|
|
138
138
|
});
|
|
139
139
|
|
|
140
|
+
useEffect(() => {
|
|
141
|
+
if (data?.id && !canEdit) {
|
|
142
|
+
goTo(getViewLink());
|
|
143
|
+
}
|
|
144
|
+
}, [canEdit, goTo, getViewLink, namespace, data?.id]);
|
|
145
|
+
|
|
140
146
|
const action = useMemo(() => actionMap?.[namespaceConfig?.action], [namespaceConfig?.action, actionMap]);
|
|
141
147
|
|
|
142
148
|
const namespaceGet = {
|
|
@@ -237,7 +243,7 @@ const Edit = ({
|
|
|
237
243
|
{
|
|
238
244
|
tooltip: t("Save"),
|
|
239
245
|
onClick: () => onSubmitData(true),
|
|
240
|
-
disabled: !isChanged,
|
|
246
|
+
disabled: !isChanged || !canEdit,
|
|
241
247
|
type: "primary",
|
|
242
248
|
icon: "Save",
|
|
243
249
|
},
|
|
@@ -109,9 +109,12 @@ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink,
|
|
|
109
109
|
if (all.empty) {
|
|
110
110
|
return <div className="daf-default-cell" />
|
|
111
111
|
}
|
|
112
|
-
|
|
112
|
+
const subjectMap = {
|
|
113
|
+
"corrective-actions": "correctiveActions",
|
|
114
|
+
"activities": "activity",
|
|
115
|
+
}
|
|
113
116
|
const eventCategory = findOptions(v, data?.options?.eventCategoryOptions || data?.options?.categoryOptions);
|
|
114
|
-
const categoryValue = getEventCategoryBySubject(eventCategory,
|
|
117
|
+
const categoryValue = getEventCategoryBySubject(eventCategory, subjectMap[subject], true);
|
|
115
118
|
|
|
116
119
|
return categoryValue ? <Tooltip title={categoryValue}>{categoryValue}</Tooltip> : '-';
|
|
117
120
|
},
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Tag, Tooltip } from "antd";
|
|
3
3
|
import { getTagColor } from "../../../../../utils/productTag.js";
|
|
4
|
+
import SingleTruncatedLine from "../../../../../core/components/UI/SingleTruncatedLine/index.jsx";
|
|
4
5
|
|
|
5
6
|
export function getKeyIndicatorsConfig({ t, data }) {
|
|
6
7
|
return [
|
|
@@ -11,20 +12,8 @@ export function getKeyIndicatorsConfig({ t, data }) {
|
|
|
11
12
|
if (validExtractionPoints?.length === 0 || !validExtractionPoints) {
|
|
12
13
|
return "-";
|
|
13
14
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
{validExtractionPoints?.map((method, index) => {
|
|
17
|
-
return (
|
|
18
|
-
<React.Fragment key={method}>
|
|
19
|
-
<Tooltip title={method}>
|
|
20
|
-
<span style={{ fontWeight: "normal"}}>{method}</span>
|
|
21
|
-
</Tooltip>
|
|
22
|
-
{index < validExtractionPoints.length - 1 && ", "}
|
|
23
|
-
</React.Fragment>
|
|
24
|
-
);
|
|
25
|
-
})}
|
|
26
|
-
</div>
|
|
27
|
-
);
|
|
15
|
+
|
|
16
|
+
return <SingleTruncatedLine data={validExtractionPoints} />;
|
|
28
17
|
},
|
|
29
18
|
},
|
|
30
19
|
{
|
|
@@ -35,27 +24,7 @@ export function getKeyIndicatorsConfig({ t, data }) {
|
|
|
35
24
|
return "-";
|
|
36
25
|
}
|
|
37
26
|
|
|
38
|
-
return
|
|
39
|
-
<div>
|
|
40
|
-
{validProducts?.map((product, index) => {
|
|
41
|
-
return (
|
|
42
|
-
<React.Fragment key={product}>
|
|
43
|
-
<Tooltip title={product}>
|
|
44
|
-
<span
|
|
45
|
-
style={{
|
|
46
|
-
fontWeight: "normal",
|
|
47
|
-
color: getTagColor(product)
|
|
48
|
-
}}
|
|
49
|
-
>
|
|
50
|
-
{product}
|
|
51
|
-
</span>
|
|
52
|
-
</Tooltip>
|
|
53
|
-
{index < validProducts.length - 1 && ", "}
|
|
54
|
-
</React.Fragment>
|
|
55
|
-
);
|
|
56
|
-
})}
|
|
57
|
-
</div>
|
|
58
|
-
);
|
|
27
|
+
return <SingleTruncatedLine data={validProducts} />
|
|
59
28
|
},
|
|
60
29
|
},
|
|
61
30
|
{
|
package/src/helpers/dataFetch.js
CHANGED
|
@@ -11,9 +11,9 @@ export const formatDataForTable = (data, options) => {
|
|
|
11
11
|
|
|
12
12
|
return { ...rest, children };
|
|
13
13
|
}),
|
|
14
|
-
meta: dataObj
|
|
14
|
+
meta: dataObj?.meta,
|
|
15
15
|
},
|
|
16
|
-
|
|
17
|
-
totalItems:
|
|
16
|
+
options: options || {},
|
|
17
|
+
totalItems: dataObj?.meta?.total || dataObj?.data?.length || 0,
|
|
18
18
|
}
|
|
19
19
|
}
|
package/src/index.js
CHANGED
|
@@ -201,6 +201,7 @@ export { default as SDGIcons } from "./@daf/core/components/UI/SDGIcon/index.jsx
|
|
|
201
201
|
export { default as CountryFlag } from "./@daf/core/components/UI/CountryFlag/index.jsx"
|
|
202
202
|
export { default as KeyIndicatorNavigateLabel } from "./@daf/core/components/UI/KeyIndicatorNavigateLabel/index.jsx";
|
|
203
203
|
export { default as MissingTagButton } from "./@daf/core/components/UI/MissingTagButton/index.jsx";
|
|
204
|
+
export { default as SingleTruncatedLine } from "./@daf/core/components/UI/SingleTruncatedLine/index.jsx";
|
|
204
205
|
|
|
205
206
|
//Settings
|
|
206
207
|
export { default as Settings } from "./@daf/core/components/Screens/Settings/index.js";
|