datastake-daf 0.6.263 → 0.6.265
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 +89 -249
- package/package.json +2 -2
- package/src/@daf/core/components/Dashboard/Map/helper.js +7 -0
- package/src/@daf/core/components/Dashboard/Map/hook.js +2 -0
- package/src/@daf/core/components/Dashboard/Map/index.jsx +159 -165
- package/src/@daf/core/components/Dashboard/Map/storyConfig3.js +6 -0
- package/src/@daf/core/components/EditForm/components/ajaxSelect.js +1 -1
- package/src/@daf/core/components/EditForm/storyConfig2.js +97 -354
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "datastake-daf",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.265",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@ant-design/icons": "^5.2.5",
|
|
6
6
|
"@antv/g2": "^5.1.1",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"buffer": "^6.0.3",
|
|
16
16
|
"countries-list": "^2.6.1",
|
|
17
17
|
"country-city-location": "^1.0.13",
|
|
18
|
-
"datastake-daf": "0.6.
|
|
18
|
+
"datastake-daf": "^0.6.263",
|
|
19
19
|
"dayjs": "^1.11.12",
|
|
20
20
|
"deepmerge": "^4.3.1",
|
|
21
21
|
"dot-object": "^2.1.5",
|
|
@@ -20,6 +20,7 @@ export function useMapHelper({
|
|
|
20
20
|
mapCenter,
|
|
21
21
|
allData,
|
|
22
22
|
renderTooltip,
|
|
23
|
+
renderTooltipTags,
|
|
23
24
|
onClickLink,
|
|
24
25
|
link,
|
|
25
26
|
tooltipAsText,
|
|
@@ -158,6 +159,7 @@ export function useMapHelper({
|
|
|
158
159
|
title: data.name,
|
|
159
160
|
subTitle: data.type,
|
|
160
161
|
items: renderTooltip({ ...data, totals }),
|
|
162
|
+
tags: renderTooltipTags(data),
|
|
161
163
|
link,
|
|
162
164
|
total: data.sources,
|
|
163
165
|
onClickLink: () => onClickLink(data),
|
|
@@ -194,6 +196,7 @@ export function useMapHelper({
|
|
|
194
196
|
{renderTooltipHtml({
|
|
195
197
|
title: data.name,
|
|
196
198
|
items: renderTooltip(data),
|
|
199
|
+
tags: renderTooltipTags(data),
|
|
197
200
|
link,
|
|
198
201
|
total: data.sources,
|
|
199
202
|
onClickLink: () => onClickLink(data),
|
|
@@ -230,6 +233,7 @@ export function useMapHelper({
|
|
|
230
233
|
data={data}
|
|
231
234
|
title={data.name}
|
|
232
235
|
renderTooltip={renderTooltip}
|
|
236
|
+
renderTooltipTags={renderTooltipTags}
|
|
233
237
|
link={link}
|
|
234
238
|
onClickLink={onClickLink}
|
|
235
239
|
activeStakeholder={activeStakeholder}
|
|
@@ -270,6 +274,7 @@ export function useMapHelper({
|
|
|
270
274
|
link,
|
|
271
275
|
onClickLink: () => onClickLink(data),
|
|
272
276
|
items: renderTooltip(data),
|
|
277
|
+
tags: renderTooltipTags(data),
|
|
273
278
|
})}
|
|
274
279
|
</>,
|
|
275
280
|
);
|
|
@@ -336,6 +341,7 @@ export function useMapHelper({
|
|
|
336
341
|
link,
|
|
337
342
|
onClickLink: () => onClickLink(data),
|
|
338
343
|
items: renderTooltip(data),
|
|
344
|
+
tags: renderTooltipTags(data),
|
|
339
345
|
})}
|
|
340
346
|
</>,
|
|
341
347
|
);
|
|
@@ -370,6 +376,7 @@ export function useMapHelper({
|
|
|
370
376
|
[
|
|
371
377
|
mapRef,
|
|
372
378
|
renderTooltip,
|
|
379
|
+
renderTooltipTags,
|
|
373
380
|
tooltipAsText,
|
|
374
381
|
onClickLink,
|
|
375
382
|
zoom,
|
|
@@ -18,6 +18,7 @@ export const useMap = ({
|
|
|
18
18
|
polygon,
|
|
19
19
|
app,
|
|
20
20
|
renderTooltip,
|
|
21
|
+
renderTooltipTags,
|
|
21
22
|
mapConfig,
|
|
22
23
|
tooltipAsText,
|
|
23
24
|
renderMarker,
|
|
@@ -136,6 +137,7 @@ export const useMap = ({
|
|
|
136
137
|
allData,
|
|
137
138
|
mapCenter,
|
|
138
139
|
renderTooltip,
|
|
140
|
+
renderTooltipTags,
|
|
139
141
|
onClickLink,
|
|
140
142
|
link,
|
|
141
143
|
tooltipAsText,
|
|
@@ -92,180 +92,174 @@ import Filters from "../../Filters/FloatingFilters/index.js";
|
|
|
92
92
|
*/
|
|
93
93
|
|
|
94
94
|
function Map({
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
95
|
+
isPdf = false,
|
|
96
|
+
data = [],
|
|
97
|
+
user = null,
|
|
98
|
+
app = "sbg",
|
|
99
|
+
polygon = null,
|
|
100
|
+
t = (s) => s,
|
|
101
|
+
onClickLink = () => {},
|
|
102
|
+
link,
|
|
103
|
+
siderTitle = "Mine Description",
|
|
104
|
+
renderTooltip = () => [],
|
|
105
|
+
renderTooltipTags = () => {},
|
|
106
|
+
mapConfig = {},
|
|
107
|
+
emptyDescriptionText = "No description provided",
|
|
108
|
+
tooltipAsText = false,
|
|
109
|
+
primaryLink = false,
|
|
110
|
+
renderSider = null,
|
|
111
|
+
renderMarker = null,
|
|
112
|
+
type = "default",
|
|
113
|
+
showSider = true,
|
|
114
|
+
filtersConfig,
|
|
115
|
+
onFilterChange = () => {},
|
|
116
|
+
isSatellite = false,
|
|
117
|
+
nameAsSiderTitle = false,
|
|
117
118
|
}) {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
119
|
+
// Map data to include marker coordinates
|
|
120
|
+
const mappedData = useMemo(
|
|
121
|
+
() =>
|
|
122
|
+
data.map((d) => ({
|
|
123
|
+
...d,
|
|
124
|
+
marker: { lat: d?.gps?.latitude, lng: d?.gps?.longitude },
|
|
125
|
+
})),
|
|
126
|
+
[data],
|
|
127
|
+
);
|
|
127
128
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
129
|
+
// Use custom hook to configure map functionality
|
|
130
|
+
const { container, activeMarker, mapOptionsButtonsConfig } = useMap({
|
|
131
|
+
data: mappedData,
|
|
132
|
+
user,
|
|
133
|
+
polygon,
|
|
134
|
+
t,
|
|
135
|
+
app,
|
|
136
|
+
renderTooltip,
|
|
137
|
+
renderTooltipTags,
|
|
138
|
+
onClickLink,
|
|
139
|
+
link,
|
|
140
|
+
mapConfig,
|
|
141
|
+
tooltipAsText,
|
|
142
|
+
renderMarker,
|
|
143
|
+
type,
|
|
144
|
+
isSatellite,
|
|
145
|
+
});
|
|
144
146
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
<Filters
|
|
152
|
-
t={t}
|
|
153
|
-
filtersConfig={filtersConfig}
|
|
154
|
-
onFilterChange={onFilterChange}
|
|
155
|
-
/>
|
|
156
|
-
) : null}
|
|
147
|
+
return (
|
|
148
|
+
<ComponentWithFocus>
|
|
149
|
+
<Style className={formatClassname([showSider && activeMarker && "with-sider"])}>
|
|
150
|
+
{filtersConfig ? (
|
|
151
|
+
<Filters t={t} filtersConfig={filtersConfig} onFilterChange={onFilterChange} />
|
|
152
|
+
) : null}
|
|
157
153
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
</div>
|
|
197
|
-
</div>
|
|
154
|
+
{/* Map container */}
|
|
155
|
+
<div
|
|
156
|
+
id="map"
|
|
157
|
+
className={tooltipAsText ? "tooltip-text" : "tooltip-daf"}
|
|
158
|
+
ref={container}
|
|
159
|
+
/>
|
|
160
|
+
{/* Control buttons */}
|
|
161
|
+
{isPdf ? null : (
|
|
162
|
+
<div className="map-control-buttons">
|
|
163
|
+
{mapOptionsButtonsConfig.map((c, i) => (
|
|
164
|
+
<button onClick={c.handler} key={i.toString()}>
|
|
165
|
+
{c.icon}
|
|
166
|
+
</button>
|
|
167
|
+
))}
|
|
168
|
+
</div>
|
|
169
|
+
)}
|
|
170
|
+
{/* Sidebar for active marker */}
|
|
171
|
+
{activeMarker && showSider ? (
|
|
172
|
+
<div className="sider">
|
|
173
|
+
<div className="sider-header flex">
|
|
174
|
+
<div className="flex flex-column justify-center">
|
|
175
|
+
<h2>{nameAsSiderTitle ? activeMarker.data.name : t(siderTitle)}</h2>
|
|
176
|
+
</div>
|
|
177
|
+
<div className="flex flex-column justify-center">
|
|
178
|
+
<Button
|
|
179
|
+
type={primaryLink ? "primary" : "default"}
|
|
180
|
+
size="sm"
|
|
181
|
+
onClick={() => onClickLink(activeMarker.data)}
|
|
182
|
+
>
|
|
183
|
+
<CustomIcon
|
|
184
|
+
name="ArrowUpRight"
|
|
185
|
+
width={20}
|
|
186
|
+
height={20}
|
|
187
|
+
color={primaryLink ? "white" : "#6C737F"}
|
|
188
|
+
/>
|
|
189
|
+
</Button>
|
|
190
|
+
</div>
|
|
191
|
+
</div>
|
|
198
192
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
193
|
+
{/* Render custom sider or default content */}
|
|
194
|
+
{typeof renderSider === "function" ? (
|
|
195
|
+
<div className="sider-body">{renderSider(activeMarker)}</div>
|
|
196
|
+
) : (
|
|
197
|
+
<div className="sider-body">
|
|
198
|
+
{/* Documents Carousel */}
|
|
199
|
+
{activeMarker?.data?.documents?.length ? (
|
|
200
|
+
<Carousel className="carousel">
|
|
201
|
+
{activeMarker.data.documents.map((v, i) => (
|
|
202
|
+
<div key={i}>
|
|
203
|
+
<Image height={169} width="100%" src={v.url} />
|
|
204
|
+
</div>
|
|
205
|
+
))}
|
|
206
|
+
</Carousel>
|
|
207
|
+
) : (
|
|
208
|
+
<div className="placeholder flex justify-center">
|
|
209
|
+
<div className="flex flex-column justify-center">
|
|
210
|
+
<svg
|
|
211
|
+
width="106"
|
|
212
|
+
height="94"
|
|
213
|
+
viewBox="0 0 106 94"
|
|
214
|
+
fill="none"
|
|
215
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
216
|
+
>
|
|
217
|
+
<path
|
|
218
|
+
d="M88.0001 92.165H93.0519C97.9078 92.165 100.336 92.165 101.674 91.1525C102.84 90.2705 103.561 88.9224 103.649 87.463C103.749 85.7878 102.402 83.7676 99.7083 79.7274L84.6565 57.1496C82.4309 53.8111 81.318 52.1419 79.9154 51.5603C78.6892 51.0517 77.311 51.0517 76.0847 51.5603C74.6821 52.1419 73.5693 53.8111 71.3437 57.1496L67.6227 62.731M88.0001 92.165L49.5776 36.6659C47.3679 33.4741 46.2631 31.8782 44.883 31.3172C43.6757 30.8264 42.3245 30.8264 41.1172 31.3172C39.7371 31.8782 38.6323 33.4741 36.4225 36.6659L6.69109 79.6113C3.87596 83.6776 2.46839 85.7108 2.54853 87.4017C2.61832 88.8743 3.33442 90.241 4.50545 91.1366C5.8501 92.165 8.32294 92.165 13.2686 92.165H88.0001ZM98.0001 17.165C98.0001 25.4492 91.2843 32.165 83.0001 32.165C74.7158 32.165 68.0001 25.4492 68.0001 17.165C68.0001 8.88071 74.7158 2.16498 83.0001 2.16498C91.2843 2.16498 98.0001 8.88071 98.0001 17.165Z"
|
|
219
|
+
stroke="#F3F4F6"
|
|
220
|
+
strokeWidth="3.5"
|
|
221
|
+
strokeLinecap="round"
|
|
222
|
+
strokeLinejoin="round"
|
|
223
|
+
/>
|
|
224
|
+
</svg>
|
|
225
|
+
</div>
|
|
226
|
+
</div>
|
|
227
|
+
)}
|
|
234
228
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
229
|
+
<div className="p-cont">
|
|
230
|
+
<p className="mt-4">
|
|
231
|
+
{activeMarker?.data?.description || t(emptyDescriptionText)}
|
|
232
|
+
</p>
|
|
233
|
+
</div>
|
|
234
|
+
</div>
|
|
235
|
+
)}
|
|
236
|
+
</div>
|
|
237
|
+
) : null}
|
|
238
|
+
</Style>
|
|
239
|
+
</ComponentWithFocus>
|
|
240
|
+
);
|
|
247
241
|
}
|
|
248
242
|
|
|
249
243
|
Map.propTypes = {
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
244
|
+
data: PropTypes.object,
|
|
245
|
+
user: PropTypes.any,
|
|
246
|
+
app: PropTypes.string,
|
|
247
|
+
polygon: PropTypes.any,
|
|
248
|
+
t: PropTypes.func,
|
|
249
|
+
onClickLink: PropTypes.func,
|
|
250
|
+
siderTitle: PropTypes.string,
|
|
251
|
+
emptyDescriptionText: PropTypes.string,
|
|
252
|
+
isPdf: PropTypes.any,
|
|
253
|
+
mapConfig: PropTypes.any,
|
|
254
|
+
tooltipAsText: PropTypes.any,
|
|
255
|
+
primaryLink: PropTypes.any,
|
|
256
|
+
renderSider: PropTypes.any,
|
|
257
|
+
renderMarker: PropTypes.any,
|
|
258
|
+
type: PropTypes.any,
|
|
259
|
+
showSider: PropTypes.any,
|
|
260
|
+
filtersConfig: PropTypes.any,
|
|
261
|
+
onFilterChange: PropTypes.any,
|
|
262
|
+
nameAsSiderTitle: PropTypes.bool,
|
|
269
263
|
};
|
|
270
264
|
|
|
271
265
|
export default Map;
|
|
@@ -71,7 +71,7 @@ export function AjaxSelectMain({
|
|
|
71
71
|
const [isFetchWithThisFilter, setIsFetchWithThisFilter] = useState(false);
|
|
72
72
|
const url = getApiBaseUrl();
|
|
73
73
|
|
|
74
|
-
const queryOptionsApps = ["kota", "nashiriki", "straatos"];
|
|
74
|
+
const queryOptionsApps = ["kota", "nashiriki", "straatos" ];
|
|
75
75
|
const queryOptionsAppEndpoints = {
|
|
76
76
|
kota: `query/options`,
|
|
77
77
|
nashiriki: "query",
|