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 ADDED
@@ -0,0 +1,8 @@
1
+ REACT_APP_API_KEY=
2
+ REACT_APP_AUTH_DOMAIN=
3
+ REACT_APP_PROJECT_ID=
4
+ REACT_APP_STORAGE_BUCKED=
5
+ REACT_APP_SENDER_ID=
6
+ REACT_APP_APP_ID=
7
+ REACT_APP_MEASUREMENT_ID=
8
+ REACT_APP_VAPID_KEY=
@@ -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
+ }
@@ -12666,7 +12666,7 @@ const {
12666
12666
  Paragraph: Paragraph$1
12667
12667
  } = antd.Typography;
12668
12668
  const checkHasActiveFilterValues = filtersConfig => {
12669
- if (!(filtersConfig !== null && filtersConfig !== void 0 && filtersConfig.filtersConfig) || !(filtersConfig !== null && filtersConfig !== void 0 && filtersConfig.selectedFilters)) return false;
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 = _ref => {
12678
- let {
12679
- title = "",
12680
- tooltip = "",
12681
- supportText = "",
12682
- tags = [],
12683
- actionButtons: _actionButtons = [],
12684
- titleTooltip,
12685
- className,
12686
- addedHeader = null,
12687
- addedHeaderFirst,
12688
- extraButtons: _extraButtons = [],
12689
- onDownload,
12690
- downloadDisabled,
12691
- goBackTo,
12692
- loading,
12693
- renderExtraComponents,
12694
- app = "",
12695
- isViewMode = false,
12696
- filtersConfig = {}
12697
- } = _ref;
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 = !!(supportText !== null && supportText !== void 0 && supportText.length);
12742
- const hasTags = !!(tags !== null && tags !== void 0 && tags.length);
12743
- const hasButtons = !!(actionButtons !== null && actionButtons !== void 0 && actionButtons.length || extraButtons !== null && extraButtons !== void 0 && extraButtons.length);
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "datastake-daf",
3
- "version": "0.6.318",
3
+ "version": "0.6.319",
4
4
  "dependencies": {
5
5
  "@ant-design/icons": "^5.2.5",
6
6
  "@antv/g2": "^5.1.1",
@@ -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
- renderTooltipTags,
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 './_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';
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
- const [MainForm] = Form.useForm();
13
- const [ajaxForms, setAjaxForms] = useState({});
14
- const [ajaxOptions, setAjaxOptions] = useState({});
15
- const [open, setOpen] = useState(true);
12
+ const [MainForm] = Form.useForm();
13
+ const [ajaxForms, setAjaxForms] = useState({});
14
+ const [ajaxOptions, setAjaxOptions] = useState({});
15
+ const [open, setOpen] = useState(true);
16
16
 
17
- const changeAjaxForms = useCallback((key, value) => {
18
- setAjaxForms((prev) => ({ ...prev, [key]: value }));
19
- }, []);
17
+ const changeAjaxForms = useCallback((key, value) => {
18
+ setAjaxForms((prev) => ({ ...prev, [key]: value }));
19
+ }, []);
20
20
 
21
- const changeAjaxOptions = useCallback((key, value) => {
22
- setAjaxOptions((prev) => ({ ...prev, [key]: value }));
23
- }, []);
21
+ const changeAjaxOptions = useCallback((key, value) => {
22
+ setAjaxOptions((prev) => ({ ...prev, [key]: value }));
23
+ }, []);
24
24
 
25
- return (
26
- <div
27
- >
28
- <DynamicForm
29
- alertErrorsConfig={{
30
- country: {
31
- message: 'Error Test',
32
- onClose: () => alert(1)
33
- }
34
- }}
35
- goTo={() => { }}
36
- ajaxForms={ajaxForms}
37
- changeAjaxForms={changeAjaxForms}
38
- ajaxOptions={ajaxOptions}
39
- user={{ language: 'en' }}
40
- changeAjaxOptions={changeAjaxOptions}
41
- app="sbg"
42
- query={null}
43
- MainForm={MainForm}
44
- form={storyData.form}
45
- data={storyData.data}
46
- getAppHeader={storyData.getAppHeader}
47
- getApiBaseUrl={storyData.getApiBaseUrl}
48
- submit={() => {
49
- setOpen(false)
50
- }}
51
- staticWidth="720px"
52
- />
53
- </div>
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
- 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
- }
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
- name: 'Edit Form',
74
- args: {},
75
- }
73
+ name: "Edit Form",
74
+ args: {},
75
+ };
@@ -1,7 +1,7 @@
1
- const getApiBaseUrl = () => "http://192.168.4.64:4020";
1
+ const getApiBaseUrl = () => "http://192.168.4.252:3022";
2
2
 
3
3
  const getAppHeader = () => ({
4
- Application: "sbg",
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
- date: {
16
- _id: "68961d98fb2b209b19efa48d",
17
- id: "5dc1382e-5229-448f-9712-0835b6ad5baf",
18
- dataId: "date",
15
+
16
+ areaOfInfluence: {
17
+ _id: "68d699bcab72f002b8f04a9e",
18
+ id: "d9db4b4d-a7bb-43d7-bdeb-e64bb38d41d1",
19
+ dataId: "areaOfInfluence",
19
20
  section: "identification",
20
- type: "date",
21
+ type: "drawTerritory",
21
22
  meta: {
22
- group: "identification",
23
+ comment: true,
23
24
  notApplicable: false,
24
25
  notAvailable: false,
25
- comment: false,
26
- versioning: true,
27
- mandatory: true,
28
- disableEdit: {
29
- create: false,
30
- edit: true,
31
- },
26
+ mandatory: false,
27
+ group: "identification",
32
28
  },
33
- position: 3,
34
- scope: ["modalActivity", "activityInfo", "modalFromMineSection"],
35
- label: "Date",
36
- createdAt: "2025-08-08T15:54:02.839Z",
37
- updatedAt: "2025-08-08T15:54:02.839Z",
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
- mine: {
41
- _id: "68961d98fb2b209b19efa493",
42
- id: "a17546cc-9bf7-4d6f-b5c9-122349c9a62c",
43
- dataId: "mine",
39
+
40
+ locationId: {
41
+ _id: "68d699bcab72f002b8f04ab8",
42
+ id: "956303f0-7a0f-40e1-ba9d-21df5079a833",
43
+ dataId: "locationId",
44
44
  section: "identification",
45
- type: "dataLink",
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: false,
59
- automaticLinking: {
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
- defaultValue: "visit",
104
- disableEdit: {
105
- create: false,
106
- edit: true,
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: 1,
110
- scope: ["modalActivity", "activityInfo"],
111
- label: "Type",
112
- options: [
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
- label: "Visit",
115
- value: "visit",
79
+ required: true,
80
+ message: "errors::field is required",
116
81
  },
117
82
  ],
118
- createdAt: "2025-08-08T15:54:04.374Z",
119
- updatedAt: "2025-08-08T15:54:04.374Z",
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: "Identificación",
103
+ subTitle: "Identification",
124
104
  },
125
105
  },
126
106
  data: {
@@ -560,6 +560,8 @@ export const EditForm = ({
560
560
  }
561
561
  };
562
562
 
563
+ console.log("values", values);
564
+
563
565
  return (
564
566
  <EditProvider
565
567
  t={t}