datastake-daf 0.6.318 → 0.6.319
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/.env +8 -0
- package/.vscode/settings.json +13 -0
- package/dist/components/index.js +31 -27
- package/package.json +1 -1
- package/src/@daf/core/components/Dashboard/Map/index.jsx +2 -2
- package/src/@daf/core/components/DynamicForm/DynamicForm.stories.js +63 -63
- package/src/@daf/core/components/DynamicForm/storyConfig.js +70 -90
- package/src/@daf/core/components/EditForm/form.jsx +2 -0
package/.env
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"cSpell.words": ["cukura"],
|
|
3
|
+
"files.autoSave": "afterDelay",
|
|
4
|
+
"editor.wordWrap": "on",
|
|
5
|
+
"editor.autoClosingBrackets": "always",
|
|
6
|
+
"editor.autoClosingComments": "always",
|
|
7
|
+
"editor.autoClosingQuotes": "always",
|
|
8
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
|
9
|
+
"editor.formatOnPaste": true,
|
|
10
|
+
"editor.formatOnSave": true,
|
|
11
|
+
"notebook.defaultFormatter": "esbenp.prettier-vscode",
|
|
12
|
+
"javascript.format.semicolons": "insert"
|
|
13
|
+
}
|
package/dist/components/index.js
CHANGED
|
@@ -12666,7 +12666,7 @@ const {
|
|
|
12666
12666
|
Paragraph: Paragraph$1
|
|
12667
12667
|
} = antd.Typography;
|
|
12668
12668
|
const checkHasActiveFilterValues = filtersConfig => {
|
|
12669
|
-
if (!
|
|
12669
|
+
if (!filtersConfig?.filtersConfig || !filtersConfig?.selectedFilters) return false;
|
|
12670
12670
|
const filterConfigKeys = Object.keys(filtersConfig.filtersConfig);
|
|
12671
12671
|
const selectedFilters = filtersConfig.selectedFilters;
|
|
12672
12672
|
return filterConfigKeys.some(key => {
|
|
@@ -12674,28 +12674,27 @@ const checkHasActiveFilterValues = filtersConfig => {
|
|
|
12674
12674
|
return value !== undefined && value !== null && value !== "";
|
|
12675
12675
|
});
|
|
12676
12676
|
};
|
|
12677
|
-
const useHeader =
|
|
12678
|
-
|
|
12679
|
-
|
|
12680
|
-
|
|
12681
|
-
|
|
12682
|
-
|
|
12683
|
-
|
|
12684
|
-
|
|
12685
|
-
|
|
12686
|
-
|
|
12687
|
-
|
|
12688
|
-
|
|
12689
|
-
|
|
12690
|
-
|
|
12691
|
-
|
|
12692
|
-
|
|
12693
|
-
|
|
12694
|
-
|
|
12695
|
-
|
|
12696
|
-
|
|
12697
|
-
|
|
12698
|
-
const hasActiveFilterValues = React.useMemo(() => checkHasActiveFilterValues(filtersConfig), [filtersConfig === null || filtersConfig === void 0 ? void 0 : filtersConfig.filtersConfig, filtersConfig === null || filtersConfig === void 0 ? void 0 : filtersConfig.selectedFilters]);
|
|
12677
|
+
const useHeader = ({
|
|
12678
|
+
title = "",
|
|
12679
|
+
tooltip = "",
|
|
12680
|
+
supportText = "",
|
|
12681
|
+
tags = [],
|
|
12682
|
+
actionButtons: _actionButtons = [],
|
|
12683
|
+
titleTooltip,
|
|
12684
|
+
className,
|
|
12685
|
+
addedHeader = null,
|
|
12686
|
+
addedHeaderFirst,
|
|
12687
|
+
extraButtons: _extraButtons = [],
|
|
12688
|
+
onDownload,
|
|
12689
|
+
downloadDisabled,
|
|
12690
|
+
goBackTo,
|
|
12691
|
+
loading,
|
|
12692
|
+
renderExtraComponents,
|
|
12693
|
+
app = "",
|
|
12694
|
+
isViewMode = false,
|
|
12695
|
+
filtersConfig = {}
|
|
12696
|
+
}) => {
|
|
12697
|
+
const hasActiveFilterValues = React.useMemo(() => checkHasActiveFilterValues(filtersConfig), [filtersConfig?.filtersConfig, filtersConfig?.selectedFilters]);
|
|
12699
12698
|
const [showFilters, setShowFilters] = React.useState(() => checkHasActiveFilterValues(filtersConfig));
|
|
12700
12699
|
const hasFilters = filtersConfig && Object.keys(filtersConfig).length > 0;
|
|
12701
12700
|
React.useEffect(() => {
|
|
@@ -12738,9 +12737,9 @@ const useHeader = _ref => {
|
|
|
12738
12737
|
const buttonCont = React.useRef();
|
|
12739
12738
|
const [mainContWidth, setMainContWidth] = React.useState(600);
|
|
12740
12739
|
const [buttonContWidth, setButtonContWidth] = React.useState(0);
|
|
12741
|
-
const hasSupportText = !!
|
|
12742
|
-
const hasTags = !!
|
|
12743
|
-
const hasButtons = !!(actionButtons
|
|
12740
|
+
const hasSupportText = !!supportText?.length;
|
|
12741
|
+
const hasTags = !!tags?.length;
|
|
12742
|
+
const hasButtons = !!(actionButtons?.length || extraButtons?.length);
|
|
12744
12743
|
React.useEffect(() => {
|
|
12745
12744
|
const mainContObserver = new ResizeObserver(entries => {
|
|
12746
12745
|
const _mainEntry = entries[0];
|
|
@@ -19093,7 +19092,11 @@ function Map$3(_ref) {
|
|
|
19093
19092
|
siderTitle = "Mine Description",
|
|
19094
19093
|
renderTooltip = () => [],
|
|
19095
19094
|
renderTooltipTags = () => {},
|
|
19096
|
-
mapConfig = {
|
|
19095
|
+
mapConfig = {
|
|
19096
|
+
maxZoom: 18,
|
|
19097
|
+
center: [13, -15],
|
|
19098
|
+
zoom: 5
|
|
19099
|
+
},
|
|
19097
19100
|
emptyDescriptionText = "No description provided",
|
|
19098
19101
|
tooltipAsText = false,
|
|
19099
19102
|
primaryLink = false,
|
|
@@ -34533,6 +34536,7 @@ const EditForm = _ref => {
|
|
|
34533
34536
|
}, id);
|
|
34534
34537
|
}
|
|
34535
34538
|
};
|
|
34539
|
+
console.log("values", values);
|
|
34536
34540
|
return /*#__PURE__*/jsxRuntime.jsxs(EditProvider, {
|
|
34537
34541
|
t: t,
|
|
34538
34542
|
isReview: isReview,
|
package/package.json
CHANGED
|
@@ -103,7 +103,7 @@ function Map({
|
|
|
103
103
|
siderTitle = "Mine Description",
|
|
104
104
|
renderTooltip = () => [],
|
|
105
105
|
renderTooltipTags = () => {},
|
|
106
|
-
mapConfig = {},
|
|
106
|
+
mapConfig = { maxZoom: 18, center: [13, -15], zoom: 5 },
|
|
107
107
|
emptyDescriptionText = "No description provided",
|
|
108
108
|
tooltipAsText = false,
|
|
109
109
|
primaryLink = false,
|
|
@@ -134,7 +134,7 @@ function Map({
|
|
|
134
134
|
t,
|
|
135
135
|
app,
|
|
136
136
|
renderTooltip,
|
|
137
|
-
|
|
137
|
+
renderTooltipTags,
|
|
138
138
|
onClickLink,
|
|
139
139
|
link,
|
|
140
140
|
mapConfig,
|
|
@@ -1,75 +1,75 @@
|
|
|
1
1
|
/* eslint-disable react/jsx-filename-extension */
|
|
2
|
-
import
|
|
3
|
-
import DynamicForm from
|
|
4
|
-
import ThemeLayout from
|
|
5
|
-
import { Form } from
|
|
6
|
-
import { useCallback, useState } from
|
|
7
|
-
import { storyData } from
|
|
2
|
+
import "./_index.scss";
|
|
3
|
+
import DynamicForm from "./index.jsx";
|
|
4
|
+
import ThemeLayout from "../ThemeLayout";
|
|
5
|
+
import { Form } from "antd";
|
|
6
|
+
import { useCallback, useState } from "react";
|
|
7
|
+
import { storyData } from "./storyConfig.js";
|
|
8
8
|
// import Modal from '../Modal/index';
|
|
9
9
|
// import { Drawer } from 'antd';
|
|
10
10
|
|
|
11
11
|
const EForm = () => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
const [MainForm] = Form.useForm();
|
|
13
|
+
const [ajaxForms, setAjaxForms] = useState({});
|
|
14
|
+
const [ajaxOptions, setAjaxOptions] = useState({});
|
|
15
|
+
const [open, setOpen] = useState(true);
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
const changeAjaxForms = useCallback((key, value) => {
|
|
18
|
+
setAjaxForms((prev) => ({ ...prev, [key]: value }));
|
|
19
|
+
}, []);
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
const changeAjaxOptions = useCallback((key, value) => {
|
|
22
|
+
setAjaxOptions((prev) => ({ ...prev, [key]: value }));
|
|
23
|
+
}, []);
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
25
|
+
return (
|
|
26
|
+
<div>
|
|
27
|
+
<DynamicForm
|
|
28
|
+
alertErrorsConfig={{
|
|
29
|
+
country: {
|
|
30
|
+
message: "Error Test",
|
|
31
|
+
onClose: () => alert(1),
|
|
32
|
+
},
|
|
33
|
+
}}
|
|
34
|
+
goTo={() => {}}
|
|
35
|
+
ajaxForms={ajaxForms}
|
|
36
|
+
changeAjaxForms={changeAjaxForms}
|
|
37
|
+
ajaxOptions={ajaxOptions}
|
|
38
|
+
user={{ language: "en" }}
|
|
39
|
+
changeAjaxOptions={changeAjaxOptions}
|
|
40
|
+
app="sbg"
|
|
41
|
+
query={null}
|
|
42
|
+
MainForm={MainForm}
|
|
43
|
+
form={storyData.form}
|
|
44
|
+
data={storyData.data}
|
|
45
|
+
getAppHeader={storyData.getAppHeader}
|
|
46
|
+
getApiBaseUrl={storyData.getApiBaseUrl}
|
|
47
|
+
submit={(payload) => {
|
|
48
|
+
console.log("submit", payload);
|
|
49
|
+
setOpen(false);
|
|
50
|
+
}}
|
|
51
|
+
staticWidth="720px"
|
|
52
|
+
/>
|
|
53
|
+
</div>
|
|
54
|
+
);
|
|
55
|
+
};
|
|
56
56
|
|
|
57
57
|
export default {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
58
|
+
title: "Form/DynamicForm",
|
|
59
|
+
component: DynamicForm,
|
|
60
|
+
tags: ["autodocs"],
|
|
61
|
+
decorators: [
|
|
62
|
+
() => (
|
|
63
|
+
<div style={{ margin: "3em" }}>
|
|
64
|
+
<ThemeLayout>
|
|
65
|
+
<EForm />
|
|
66
|
+
</ThemeLayout>
|
|
67
|
+
</div>
|
|
68
|
+
),
|
|
69
|
+
],
|
|
70
|
+
};
|
|
71
71
|
|
|
72
72
|
export const Primary = {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
73
|
+
name: "Edit Form",
|
|
74
|
+
args: {},
|
|
75
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const getApiBaseUrl = () => "http://192.168.4.
|
|
1
|
+
const getApiBaseUrl = () => "http://192.168.4.252:3022";
|
|
2
2
|
|
|
3
3
|
const getAppHeader = () => ({
|
|
4
|
-
Application: "
|
|
4
|
+
Application: "nashiriki",
|
|
5
5
|
Language: "en",
|
|
6
6
|
});
|
|
7
7
|
|
|
@@ -12,115 +12,95 @@ export const storyData = {
|
|
|
12
12
|
form: {
|
|
13
13
|
id: "identification",
|
|
14
14
|
position: 1,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
|
|
16
|
+
areaOfInfluence: {
|
|
17
|
+
_id: "68d699bcab72f002b8f04a9e",
|
|
18
|
+
id: "d9db4b4d-a7bb-43d7-bdeb-e64bb38d41d1",
|
|
19
|
+
dataId: "areaOfInfluence",
|
|
19
20
|
section: "identification",
|
|
20
|
-
type: "
|
|
21
|
+
type: "drawTerritory",
|
|
21
22
|
meta: {
|
|
22
|
-
|
|
23
|
+
comment: true,
|
|
23
24
|
notApplicable: false,
|
|
24
25
|
notAvailable: false,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
mandatory: true,
|
|
28
|
-
disableEdit: {
|
|
29
|
-
create: false,
|
|
30
|
-
edit: true,
|
|
31
|
-
},
|
|
26
|
+
mandatory: false,
|
|
27
|
+
group: "identification",
|
|
32
28
|
},
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
29
|
+
|
|
30
|
+
position: 6,
|
|
31
|
+
description:
|
|
32
|
+
"The area of influence is the area where actions of this armed group are happening",
|
|
33
|
+
scope: ["armedGroups", "location", "conflictArea"],
|
|
34
|
+
label: "Perimeter",
|
|
35
|
+
createdAt: "2025-09-26T13:48:44.363Z",
|
|
36
|
+
updatedAt: "2025-09-26T13:48:44.363Z",
|
|
38
37
|
__v: 0,
|
|
39
38
|
},
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
|
|
40
|
+
locationId: {
|
|
41
|
+
_id: "68d699bcab72f002b8f04ab8",
|
|
42
|
+
id: "956303f0-7a0f-40e1-ba9d-21df5079a833",
|
|
43
|
+
dataId: "locationId",
|
|
44
44
|
section: "identification",
|
|
45
|
-
type: "
|
|
45
|
+
type: "ajaxSelect",
|
|
46
46
|
meta: {
|
|
47
|
-
entity: "Location",
|
|
48
|
-
namespace: "location",
|
|
49
|
-
formScope: "activityMine",
|
|
50
|
-
path: "associatedMine",
|
|
51
|
-
maxRepeat: 1,
|
|
52
47
|
comment: false,
|
|
53
|
-
createUserVersion: false,
|
|
54
|
-
linkOptions: {
|
|
55
|
-
global: true,
|
|
56
|
-
},
|
|
57
48
|
notApplicable: false,
|
|
58
|
-
notAvailable:
|
|
59
|
-
|
|
60
|
-
path: "associatedSubjects",
|
|
61
|
-
nature: "activity",
|
|
62
|
-
},
|
|
63
|
-
ajaxOptionsKey: "id",
|
|
64
|
-
mandatory: true,
|
|
65
|
-
versioning: true,
|
|
66
|
-
disableEdit: {
|
|
67
|
-
create: false,
|
|
68
|
-
edit: true,
|
|
69
|
-
},
|
|
70
|
-
tableKeys: ["datastakeId", "locationId"],
|
|
71
|
-
optionsView: {
|
|
72
|
-
editInputType: "ajaxSelect",
|
|
73
|
-
editInputKey: "locationId",
|
|
74
|
-
onViewInputType: "table",
|
|
75
|
-
},
|
|
76
|
-
application: "sbg",
|
|
77
|
-
noAddNew: true,
|
|
78
|
-
call: 'LOCATION::getOptions({\n "ownAccount": "true",\n "category": "mineSite"\n })::{\n "label": "name",\n "name": "name",\n "value": "_id",\n "datastakeId": "datastakeId",\n "gps": "gps",\n "_id": "_id",\n "id": "id",\n "parent": "parent",\n "administrativeLevel1": "administrativeLevel1",\n "administrativeLevel2": "administrativeLevel2",\n "category":"category",\n "users": "users",\n "country": "country"\n }::["datastakeId", "gps", "administrativeLevel1", "administrativeLevel2", "category","parent", "_id"]',
|
|
79
|
-
},
|
|
80
|
-
position: 2,
|
|
81
|
-
scope: ["modalActivity", "activityInfo", "modalFromMineSection"],
|
|
82
|
-
label: {
|
|
83
|
-
"scope is modalActivity": "Mine",
|
|
84
|
-
"scope not modalActivity": "Associated Mine",
|
|
85
|
-
},
|
|
86
|
-
createdAt: "2025-08-08T15:54:02.839Z",
|
|
87
|
-
updatedAt: "2025-08-08T15:54:02.839Z",
|
|
88
|
-
__v: 0,
|
|
89
|
-
},
|
|
90
|
-
type: {
|
|
91
|
-
_id: "68961d98fb2b209b19efa495",
|
|
92
|
-
id: "8e421077-c542-46c0-a515-151cf2741f7d",
|
|
93
|
-
dataId: "type",
|
|
94
|
-
section: "identification",
|
|
95
|
-
type: "select",
|
|
96
|
-
meta: {
|
|
49
|
+
notAvailable: true,
|
|
50
|
+
application: "nashiriki",
|
|
97
51
|
group: "identification",
|
|
98
|
-
notApplicable: false,
|
|
99
|
-
notAvailable: false,
|
|
100
|
-
comment: false,
|
|
101
|
-
versioning: true,
|
|
102
52
|
mandatory: true,
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
53
|
+
onNewSetValueKey: "name",
|
|
54
|
+
store: {
|
|
55
|
+
location: {
|
|
56
|
+
path: "name",
|
|
57
|
+
global: true,
|
|
58
|
+
},
|
|
107
59
|
},
|
|
60
|
+
call: 'LOCATION::getOptions({\n "country": "country",\n "category": "category",\n "administrativeLevel1": "administrativeLevel1",\n "administrativeLevel2": "administrativeLevel2"\n })::{\n "label": "name",\n "value": "_id",\n "datastakeId": "datastakeId",\n "gps": "gps",\n "_id": "_id",\n "parent": "parent",\n "administrativeLevel1": "administrativeLevel1",\n "administrativeLevel2": "administrativeLevel2",\n "category":"category",\n "users": "users",\n "country": "country"\n }::["datastakeId", "gps", "administrativeLevel1", "administrativeLevel2", "category", "parent", "country", "_id"]',
|
|
108
61
|
},
|
|
109
|
-
position:
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
62
|
+
position: 5,
|
|
63
|
+
dataLink: {
|
|
64
|
+
entity: "Location",
|
|
65
|
+
createUserVersion: true,
|
|
66
|
+
createNew: true,
|
|
67
|
+
collection: "nashiriki.global_location",
|
|
68
|
+
formNamespace: "location",
|
|
69
|
+
keys: [
|
|
70
|
+
"name",
|
|
71
|
+
"country",
|
|
72
|
+
"category",
|
|
73
|
+
"administrativeLevel1",
|
|
74
|
+
"administrativeLevel2",
|
|
75
|
+
],
|
|
76
|
+
},
|
|
77
|
+
rules: [
|
|
113
78
|
{
|
|
114
|
-
|
|
115
|
-
|
|
79
|
+
required: true,
|
|
80
|
+
message: "errors::field is required",
|
|
116
81
|
},
|
|
117
82
|
],
|
|
118
|
-
|
|
119
|
-
|
|
83
|
+
scope: [
|
|
84
|
+
"nashirikiOperatorLocation",
|
|
85
|
+
"nashirikiWorkerLocation",
|
|
86
|
+
"modalNashiriki",
|
|
87
|
+
"locationAssociatedVillage",
|
|
88
|
+
"locationAssociatedExportTown",
|
|
89
|
+
"workerPlaceOfBirth",
|
|
90
|
+
"armedGroups",
|
|
91
|
+
"locationSupplierTrade",
|
|
92
|
+
"modal",
|
|
93
|
+
"location",
|
|
94
|
+
"conflictArea",
|
|
95
|
+
],
|
|
96
|
+
label: "Name of the location",
|
|
97
|
+
tableLabel: "Name",
|
|
98
|
+
createdAt: "2025-09-26T13:48:44.502Z",
|
|
99
|
+
updatedAt: "2025-09-26T13:48:44.502Z",
|
|
120
100
|
__v: 0,
|
|
121
101
|
},
|
|
122
102
|
label: "Identification",
|
|
123
|
-
subTitle: "
|
|
103
|
+
subTitle: "Identification",
|
|
124
104
|
},
|
|
125
105
|
},
|
|
126
106
|
data: {
|