datastake-daf 0.6.485 → 0.6.487

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.
@@ -12390,26 +12390,7 @@ function ComponentWithFocus(_ref) {
12390
12390
  }
12391
12391
  }
12392
12392
  }
12393
- }, [placeholderIsVisible, unFocus] // Add unFocus to dependencies
12394
- );
12395
-
12396
- // Add wheel event handler
12397
- const handleWheel = React.useCallback(() => {
12398
- if (placeholderIsVisible) {
12399
- setPlaceholderIsVisible(false);
12400
- }
12401
12393
  }, [placeholderIsVisible]);
12402
- React.useEffect(() => {
12403
- document.addEventListener("mousemove", checkMouse);
12404
- return () => document.removeEventListener("mousemove", checkMouse); // Fix typo
12405
- }, [checkMouse]);
12406
- React.useEffect(() => {
12407
- if (ref.current) {
12408
- const element = ref.current;
12409
- element.addEventListener("wheel", handleWheel);
12410
- return () => element.removeEventListener("wheel", handleWheel);
12411
- }
12412
- }, [handleWheel]);
12413
12394
  React.useEffect(() => {
12414
12395
  document.addEventListener("mousemove", checkMouse);
12415
12396
  return () => document.removeEventListener("mousemov", checkMouse);
@@ -42927,6 +42908,15 @@ const checkCondition = (condition, repeatValues, formsValue) => {
42927
42908
  };
42928
42909
  function showHideInput(input, formsValue, repeatIndex, repeatValues, setValues, ref) {
42929
42910
  if (input?.meta?.hidden === true) {
42911
+ // Set default value for hidden fields
42912
+ if (input?.meta?.defaultValue !== undefined && !propHasValue(formsValue[ref])) {
42913
+ formsValue[ref] = input.meta.defaultValue;
42914
+ if (setValues && typeof setValues === 'function') {
42915
+ setValues({
42916
+ ...formsValue
42917
+ });
42918
+ }
42919
+ }
42930
42920
  return false;
42931
42921
  }
42932
42922
  if (input.showIf) {
@@ -45413,6 +45403,34 @@ function DynamicForm(_ref) {
45413
45403
  // MainForm.resetFields();
45414
45404
  }
45415
45405
  }, [data]);
45406
+
45407
+ // Initialize default values for hidden fields
45408
+ React.useEffect(() => {
45409
+ if (Object.keys(form).length > 0) {
45410
+ const updatedValues = _objectSpread2({}, values);
45411
+ let hasChanges = false;
45412
+
45413
+ // Process all form fields to set default values for hidden fields
45414
+ Object.keys(form).forEach(formKey => {
45415
+ Object.keys(form[formKey]).forEach(fieldKey => {
45416
+ var _field$meta, _field$meta2;
45417
+ const field = form[formKey][fieldKey];
45418
+ if ((field === null || field === void 0 || (_field$meta = field.meta) === null || _field$meta === void 0 ? void 0 : _field$meta.hidden) === true && (field === null || field === void 0 || (_field$meta2 = field.meta) === null || _field$meta2 === void 0 ? void 0 : _field$meta2.defaultValue) !== undefined) {
45419
+ const fieldId = field.dataId || fieldKey;
45420
+ if (!propHasValue(updatedValues[fieldId])) {
45421
+ updatedValues[fieldId] = field.meta.defaultValue;
45422
+ hasChanges = true;
45423
+ }
45424
+ }
45425
+ });
45426
+ });
45427
+ if (hasChanges) {
45428
+ setValues(updatedValues);
45429
+ // Also set the values in the Ant Design form
45430
+ MainForm.setFieldsValue(updatedValues);
45431
+ }
45432
+ }
45433
+ }, [form]);
45416
45434
  const setSelectedForm = id => {
45417
45435
  setForms(Forms.map(form => {
45418
45436
  id === form.id ? form.selected = true : form.selected = false;
@@ -45449,7 +45467,7 @@ function DynamicForm(_ref) {
45449
45467
  }).every(key => key);
45450
45468
  };
45451
45469
  const getData = (name, input, value, commentValue, path, disabledPath) => {
45452
- var _input$meta, _input$meta2, _input$meta3, _input$meta4, _input$meta5, _input$meta6, _input$meta7, _input$meta8, _input$meta9, _input$meta10;
45470
+ var _input$meta, _input$meta2, _input$meta3, _input$meta4, _input$meta5, _input$meta6, _input$meta7, _input$meta8, _input$meta9, _input$meta10, _input$meta11, _input$meta12;
45453
45471
  const props = {
45454
45472
  // placeholder: input.labelHint ? input.labelHint : getInputLabel(input, values, true),
45455
45473
  placeholder: input.labelHint,
@@ -45486,9 +45504,16 @@ function DynamicForm(_ref) {
45486
45504
  }
45487
45505
  value = fileList;
45488
45506
  }
45507
+ // Handle default values for hidden fields
45508
+ if ((input === null || input === void 0 || (_input$meta7 = input.meta) === null || _input$meta7 === void 0 ? void 0 : _input$meta7.hidden) === true && (input === null || input === void 0 || (_input$meta8 = input.meta) === null || _input$meta8 === void 0 ? void 0 : _input$meta8.defaultValue) !== undefined && !propHasValue(value)) {
45509
+ value = input.meta.defaultValue;
45510
+ if (typeof path === 'string') {
45511
+ dot__default["default"].str(path, value, values);
45512
+ }
45513
+ }
45489
45514
  const config = {
45490
45515
  name,
45491
- call: input.call ? input.call : input === null || input === void 0 || (_input$meta7 = input.meta) === null || _input$meta7 === void 0 ? void 0 : _input$meta7.call,
45516
+ call: input.call ? input.call : input === null || input === void 0 || (_input$meta9 = input.meta) === null || _input$meta9 === void 0 ? void 0 : _input$meta9.call,
45492
45517
  automaticallyLink: input.automaticallyLink,
45493
45518
  props,
45494
45519
  formsValue: values,
@@ -45500,8 +45525,8 @@ function DynamicForm(_ref) {
45500
45525
  updateOptions: input.updateOptions || false,
45501
45526
  options: input.options,
45502
45527
  optionGroup: input.optionGroup,
45503
- optionsFilter: input === null || input === void 0 || (_input$meta8 = input.meta) === null || _input$meta8 === void 0 ? void 0 : _input$meta8.optionsFilter,
45504
- filterCond: input === null || input === void 0 || (_input$meta9 = input.meta) === null || _input$meta9 === void 0 ? void 0 : _input$meta9.filterCond,
45528
+ optionsFilter: input === null || input === void 0 || (_input$meta10 = input.meta) === null || _input$meta10 === void 0 ? void 0 : _input$meta10.optionsFilter,
45529
+ filterCond: input === null || input === void 0 || (_input$meta11 = input.meta) === null || _input$meta11 === void 0 ? void 0 : _input$meta11.filterCond,
45505
45530
  disableOtherFields: input.disableOtherFields,
45506
45531
  updateOtherFields: input.updateOtherFields,
45507
45532
  repeatLabel: input.repeatLabel,
@@ -45511,7 +45536,7 @@ function DynamicForm(_ref) {
45511
45536
  restricted: input.restricted || false,
45512
45537
  totalMax: input.totalMax,
45513
45538
  country: input.country || undefined,
45514
- address: (input === null || input === void 0 || (_input$meta10 = input.meta) === null || _input$meta10 === void 0 ? void 0 : _input$meta10.address) || undefined,
45539
+ address: (input === null || input === void 0 || (_input$meta12 = input.meta) === null || _input$meta12 === void 0 ? void 0 : _input$meta12.address) || undefined,
45515
45540
  stakeholderId: input.stakeholderId,
45516
45541
  preSelected,
45517
45542
  addressData,
@@ -0,0 +1,330 @@
1
+ /* Isolated Mapbox GL CSS - Scoped to prevent Leaflet conflicts */
2
+
3
+ /* Mapbox GL Core Styles - Scoped with .mapbox-gl-scope */
4
+ .mapbox-gl-scope .mapboxgl-map {
5
+ font: 12px/20px Helvetica Neue, Arial, Helvetica, sans-serif;
6
+ overflow: hidden;
7
+ position: relative;
8
+ -webkit-tap-highlight-color: rgb(0 0 0/0);
9
+ }
10
+
11
+ .mapbox-gl-scope .mapboxgl-canvas {
12
+ left: 0;
13
+ position: absolute;
14
+ top: 0;
15
+ }
16
+
17
+ .mapbox-gl-scope .mapboxgl-map:-webkit-full-screen {
18
+ height: 100%;
19
+ width: 100%;
20
+ }
21
+
22
+ .mapbox-gl-scope .mapboxgl-canary {
23
+ background-color: salmon;
24
+ }
25
+
26
+ .mapbox-gl-scope .mapboxgl-canvas-container.mapboxgl-interactive,
27
+ .mapbox-gl-scope .mapboxgl-ctrl-group button.mapboxgl-ctrl-compass {
28
+ cursor: grab;
29
+ -webkit-user-select: none;
30
+ user-select: none;
31
+ }
32
+
33
+ .mapbox-gl-scope .mapboxgl-canvas-container.mapboxgl-interactive.mapboxgl-track-pointer {
34
+ cursor: pointer;
35
+ }
36
+
37
+ .mapbox-gl-scope .mapboxgl-canvas-container.mapboxgl-interactive:active,
38
+ .mapbox-gl-scope .mapboxgl-ctrl-group button.mapboxgl-ctrl-compass:active {
39
+ cursor: grabbing;
40
+ }
41
+
42
+ .mapbox-gl-scope .mapboxgl-canvas-container.mapboxgl-touch-zoom-rotate,
43
+ .mapbox-gl-scope .mapboxgl-canvas-container.mapboxgl-touch-zoom-rotate .mapboxgl-canvas {
44
+ touch-action: pan-x pan-y;
45
+ }
46
+
47
+ .mapbox-gl-scope .mapboxgl-canvas-container.mapboxgl-touch-drag-pan,
48
+ .mapbox-gl-scope .mapboxgl-canvas-container.mapboxgl-touch-drag-pan .mapboxgl-canvas {
49
+ touch-action: pinch-zoom;
50
+ }
51
+
52
+ .mapbox-gl-scope .mapboxgl-canvas-container.mapboxgl-touch-zoom-rotate.mapboxgl-touch-drag-pan,
53
+ .mapbox-gl-scope .mapboxgl-canvas-container.mapboxgl-touch-zoom-rotate.mapboxgl-touch-drag-pan .mapboxgl-canvas {
54
+ touch-action: none;
55
+ }
56
+
57
+ /* Control positioning */
58
+ .mapbox-gl-scope .mapboxgl-ctrl-bottom,
59
+ .mapbox-gl-scope .mapboxgl-ctrl-bottom-left,
60
+ .mapbox-gl-scope .mapboxgl-ctrl-bottom-right,
61
+ .mapbox-gl-scope .mapboxgl-ctrl-left,
62
+ .mapbox-gl-scope .mapboxgl-ctrl-right,
63
+ .mapbox-gl-scope .mapboxgl-ctrl-top,
64
+ .mapbox-gl-scope .mapboxgl-ctrl-top-left,
65
+ .mapbox-gl-scope .mapboxgl-ctrl-top-right {
66
+ pointer-events: none;
67
+ position: absolute;
68
+ z-index: 2;
69
+ }
70
+
71
+ .mapbox-gl-scope .mapboxgl-ctrl-top-left {
72
+ left: 0;
73
+ top: 0;
74
+ }
75
+
76
+ .mapbox-gl-scope .mapboxgl-ctrl-top {
77
+ left: 50%;
78
+ top: 0;
79
+ transform: translateX(-50%);
80
+ }
81
+
82
+ .mapbox-gl-scope .mapboxgl-ctrl-top-right {
83
+ right: 0;
84
+ top: 0;
85
+ }
86
+
87
+ .mapbox-gl-scope .mapboxgl-ctrl-right {
88
+ right: 0;
89
+ top: 50%;
90
+ transform: translateY(-50%);
91
+ }
92
+
93
+ .mapbox-gl-scope .mapboxgl-ctrl-bottom-right {
94
+ bottom: 0;
95
+ right: 0;
96
+ }
97
+
98
+ .mapbox-gl-scope .mapboxgl-ctrl-bottom {
99
+ bottom: 0;
100
+ left: 50%;
101
+ transform: translateX(-50%);
102
+ }
103
+
104
+ .mapbox-gl-scope .mapboxgl-ctrl-bottom-left {
105
+ bottom: 0;
106
+ left: 0;
107
+ }
108
+
109
+ .mapbox-gl-scope .mapboxgl-ctrl-left {
110
+ left: 0;
111
+ top: 50%;
112
+ transform: translateY(-50%);
113
+ }
114
+
115
+ .mapbox-gl-scope .mapboxgl-ctrl {
116
+ clear: both;
117
+ pointer-events: auto;
118
+ transform: translate(0);
119
+ }
120
+
121
+ .mapbox-gl-scope .mapboxgl-ctrl-top-left .mapboxgl-ctrl {
122
+ float: left;
123
+ margin: 10px 0 0 10px;
124
+ }
125
+
126
+ .mapbox-gl-scope .mapboxgl-ctrl-top .mapboxgl-ctrl {
127
+ float: left;
128
+ margin: 10px 0;
129
+ }
130
+
131
+ .mapbox-gl-scope .mapboxgl-ctrl-top-right .mapboxgl-ctrl {
132
+ float: right;
133
+ margin: 10px 10px 0 0;
134
+ }
135
+
136
+ .mapbox-gl-scope .mapboxgl-ctrl-bottom-right .mapboxgl-ctrl,
137
+ .mapbox-gl-scope .mapboxgl-ctrl-right .mapboxgl-ctrl {
138
+ float: right;
139
+ margin: 0 10px 10px 0;
140
+ }
141
+
142
+ .mapbox-gl-scope .mapboxgl-ctrl-bottom .mapboxgl-ctrl {
143
+ float: left;
144
+ margin: 10px 0;
145
+ }
146
+
147
+ .mapbox-gl-scope .mapboxgl-ctrl-bottom-left .mapboxgl-ctrl,
148
+ .mapbox-gl-scope .mapboxgl-ctrl-left .mapboxgl-ctrl {
149
+ float: left;
150
+ margin: 0 0 10px 10px;
151
+ }
152
+
153
+ /* Control group styling */
154
+ .mapbox-gl-scope .mapboxgl-ctrl-group {
155
+ background: #fff;
156
+ border-radius: 4px;
157
+ }
158
+
159
+ .mapbox-gl-scope .mapboxgl-ctrl-group:not(:empty) {
160
+ box-shadow: 0 0 0 2px #0000001a;
161
+ }
162
+
163
+ .mapbox-gl-scope .mapboxgl-ctrl-group button {
164
+ background-color: initial;
165
+ border: 0;
166
+ box-sizing: border-box;
167
+ cursor: pointer;
168
+ display: block;
169
+ height: 29px;
170
+ outline: none;
171
+ overflow: hidden;
172
+ padding: 0;
173
+ width: 29px;
174
+ }
175
+
176
+ .mapbox-gl-scope .mapboxgl-ctrl-group button+button {
177
+ border-top: 1px solid #ddd;
178
+ }
179
+
180
+ .mapbox-gl-scope .mapboxgl-ctrl button .mapboxgl-ctrl-icon {
181
+ background-position: 50%;
182
+ background-repeat: no-repeat;
183
+ display: block;
184
+ height: 100%;
185
+ width: 100%;
186
+ }
187
+
188
+ .mapbox-gl-scope .mapboxgl-ctrl-attrib-button:focus,
189
+ .mapbox-gl-scope .mapboxgl-ctrl-group button:focus {
190
+ box-shadow: 0 0 2px 2px #0096ff;
191
+ }
192
+
193
+ .mapbox-gl-scope .mapboxgl-ctrl button:disabled {
194
+ cursor: not-allowed;
195
+ }
196
+
197
+ .mapbox-gl-scope .mapboxgl-ctrl button:disabled .mapboxgl-ctrl-icon {
198
+ opacity: .25;
199
+ }
200
+
201
+ .mapbox-gl-scope .mapboxgl-ctrl-group button:first-child {
202
+ border-radius: 4px 4px 0 0;
203
+ }
204
+
205
+ .mapbox-gl-scope .mapboxgl-ctrl-group button:last-child {
206
+ border-radius: 0 0 4px 4px;
207
+ }
208
+
209
+ .mapbox-gl-scope .mapboxgl-ctrl-group button:only-child {
210
+ border-radius: inherit;
211
+ }
212
+
213
+ .mapbox-gl-scope .mapboxgl-ctrl button:not(:disabled):hover {
214
+ background-color: #0000000d;
215
+ }
216
+
217
+ /* Marker styles */
218
+ .mapbox-gl-scope .mapboxgl-marker {
219
+ position: absolute;
220
+ z-index: 1;
221
+ }
222
+
223
+ .mapbox-gl-scope .mapboxgl-marker svg {
224
+ display: block;
225
+ }
226
+
227
+ /* Popup styles */
228
+ .mapbox-gl-scope .mapboxgl-popup {
229
+ position: absolute;
230
+ text-align: center;
231
+ margin-bottom: 20px;
232
+ }
233
+
234
+ .mapbox-gl-scope .mapboxgl-popup-content-wrapper {
235
+ padding: 1px;
236
+ text-align: left;
237
+ border-radius: 12px;
238
+ }
239
+
240
+ .mapbox-gl-scope .mapboxgl-popup-content {
241
+ margin: 13px 24px 13px 20px;
242
+ line-height: 1.3;
243
+ font-size: 13px;
244
+ min-height: 1px;
245
+ }
246
+
247
+ .mapbox-gl-scope .mapboxgl-popup-content p {
248
+ margin: 17px 0;
249
+ }
250
+
251
+ .mapbox-gl-scope .mapboxgl-popup-tip-container {
252
+ width: 40px;
253
+ height: 20px;
254
+ position: absolute;
255
+ left: 50%;
256
+ margin-top: -1px;
257
+ margin-left: -20px;
258
+ overflow: hidden;
259
+ pointer-events: none;
260
+ }
261
+
262
+ .mapbox-gl-scope .mapboxgl-popup-tip {
263
+ width: 17px;
264
+ height: 17px;
265
+ padding: 1px;
266
+ margin: -10px auto 0;
267
+ pointer-events: auto;
268
+ -webkit-transform: rotate(45deg);
269
+ -moz-transform: rotate(45deg);
270
+ -ms-transform: rotate(45deg);
271
+ transform: rotate(45deg);
272
+ }
273
+
274
+ .mapbox-gl-scope .mapboxgl-popup-content-wrapper,
275
+ .mapbox-gl-scope .mapboxgl-popup-tip {
276
+ background: white;
277
+ color: #333;
278
+ box-shadow: 0 3px 14px rgba(0, 0, 0, 0.4);
279
+ }
280
+
281
+ .mapbox-gl-scope .mapboxgl-popup-close-button {
282
+ position: absolute;
283
+ top: 0;
284
+ right: 0;
285
+ border: none;
286
+ text-align: center;
287
+ width: 24px;
288
+ height: 24px;
289
+ font: 16px/24px Tahoma, Verdana, sans-serif;
290
+ color: #757575;
291
+ text-decoration: none;
292
+ background: transparent;
293
+ }
294
+
295
+ .mapbox-gl-scope .mapboxgl-popup-close-button:hover,
296
+ .mapbox-gl-scope .mapboxgl-popup-close-button:focus {
297
+ color: #585858;
298
+ }
299
+
300
+ /* Attribution */
301
+ .mapbox-gl-scope .mapboxgl-ctrl-attribution {
302
+ background: #fff;
303
+ background: rgba(255, 255, 255, 0.8);
304
+ margin: 0;
305
+ }
306
+
307
+ .mapbox-gl-scope .mapboxgl-ctrl-attribution,
308
+ .mapbox-gl-scope .mapboxgl-ctrl-scale-line {
309
+ padding: 0 5px;
310
+ color: #333;
311
+ line-height: 1.4;
312
+ }
313
+
314
+ .mapbox-gl-scope .mapboxgl-ctrl-attribution a {
315
+ text-decoration: none;
316
+ }
317
+
318
+ .mapbox-gl-scope .mapboxgl-ctrl-attribution a:hover,
319
+ .mapbox-gl-scope .mapboxgl-ctrl-attribution a:focus {
320
+ text-decoration: underline;
321
+ }
322
+
323
+ /* Hide attribution by default */
324
+ .mapbox-gl-scope .mapboxgl-ctrl-attribution {
325
+ display: none !important;
326
+ }
327
+
328
+ .mapbox-gl-scope .mapboxgl-ctrl-logo {
329
+ display: none !important;
330
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "datastake-daf",
3
- "version": "0.6.485",
3
+ "version": "0.6.487",
4
4
  "dependencies": {
5
5
  "@ant-design/icons": "^5.2.5",
6
6
  "@antv/g2": "^5.1.1",
@@ -71,28 +71,8 @@ export default function ComponentWithFocus({
71
71
  }
72
72
  }
73
73
  },
74
- [placeholderIsVisible, unFocus], // Add unFocus to dependencies
74
+ [placeholderIsVisible],
75
75
  );
76
-
77
- // Add wheel event handler
78
- const handleWheel = useCallback(() => {
79
- if (placeholderIsVisible) {
80
- setPlaceholderIsVisible(false);
81
- }
82
- }, [placeholderIsVisible]);
83
-
84
- useEffect(() => {
85
- document.addEventListener("mousemove", checkMouse);
86
- return () => document.removeEventListener("mousemove", checkMouse); // Fix typo
87
- }, [checkMouse]);
88
-
89
- useEffect(() => {
90
- if (ref.current) {
91
- const element = ref.current;
92
- element.addEventListener("wheel", handleWheel);
93
- return () => element.removeEventListener("wheel", handleWheel);
94
- }
95
- }, [handleWheel]);
96
76
 
97
77
  useEffect(() => {
98
78
  document.addEventListener("mousemove", checkMouse);
@@ -89,6 +89,13 @@ export const checkCondition = (condition, repeatValues, formsValue) => {
89
89
  };
90
90
  export function showHideInput(input, formsValue, repeatIndex, repeatValues, setValues, ref) {
91
91
  if (input?.meta?.hidden === true) {
92
+ // Set default value for hidden fields
93
+ if (input?.meta?.defaultValue !== undefined && !propHasValue(formsValue[ref])) {
94
+ formsValue[ref] = input.meta.defaultValue;
95
+ if (setValues && typeof setValues === 'function') {
96
+ setValues({ ...formsValue });
97
+ }
98
+ }
92
99
  return false;
93
100
  }
94
101
  if (input.showIf) {
@@ -168,6 +168,34 @@ export default function DynamicForm({
168
168
  }
169
169
  }, [data]);
170
170
 
171
+ // Initialize default values for hidden fields
172
+ useEffect(() => {
173
+ if (Object.keys(form).length > 0) {
174
+ const updatedValues = { ...values };
175
+ let hasChanges = false;
176
+
177
+ // Process all form fields to set default values for hidden fields
178
+ Object.keys(form).forEach(formKey => {
179
+ Object.keys(form[formKey]).forEach(fieldKey => {
180
+ const field = form[formKey][fieldKey];
181
+ if (field?.meta?.hidden === true && field?.meta?.defaultValue !== undefined) {
182
+ const fieldId = field.dataId || fieldKey;
183
+ if (!propHasValue(updatedValues[fieldId])) {
184
+ updatedValues[fieldId] = field.meta.defaultValue;
185
+ hasChanges = true;
186
+ }
187
+ }
188
+ });
189
+ });
190
+
191
+ if (hasChanges) {
192
+ setValues(updatedValues);
193
+ // Also set the values in the Ant Design form
194
+ MainForm.setFieldsValue(updatedValues);
195
+ }
196
+ }
197
+ }, [form]);
198
+
171
199
  const setSelectedForm = (id) => {
172
200
  setForms(Forms.map(form => {
173
201
  (id === form.id)
@@ -267,6 +295,14 @@ export default function DynamicForm({
267
295
  }
268
296
  value = fileList;
269
297
  }
298
+ // Handle default values for hidden fields
299
+ if (input?.meta?.hidden === true && input?.meta?.defaultValue !== undefined && !propHasValue(value)) {
300
+ value = input.meta.defaultValue;
301
+ if (typeof path === 'string') {
302
+ dot.str(path, value, values);
303
+ }
304
+ }
305
+
270
306
  const config = {
271
307
  name,
272
308
  call: input.call ? input.call : input?.meta?.call,