@overmap-ai/core 1.0.38-component-fields.10 → 1.0.38-component-fields.12
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/overmap-core.js
CHANGED
|
@@ -3241,31 +3241,11 @@ const selectSubmissionsForComponent = restructureCreateSelectorWithArgs(
|
|
|
3241
3241
|
const selectUserFormMapping = (state) => {
|
|
3242
3242
|
return state.userFormReducer.userForms;
|
|
3243
3243
|
};
|
|
3244
|
-
const
|
|
3244
|
+
const selectComponentTypeForm = restructureCreateSelectorWithArgs(
|
|
3245
3245
|
createSelector(
|
|
3246
3246
|
[selectUserFormMapping, (_state, componentTypeId) => componentTypeId],
|
|
3247
3247
|
(userForms, componentTypeId) => {
|
|
3248
|
-
return Object.values(userForms).
|
|
3249
|
-
return userForm.component_type === componentTypeId;
|
|
3250
|
-
});
|
|
3251
|
-
}
|
|
3252
|
-
)
|
|
3253
|
-
);
|
|
3254
|
-
const selectLatestRevisionsForComponentTypeForms = restructureCreateSelectorWithArgs(
|
|
3255
|
-
createSelector(
|
|
3256
|
-
[
|
|
3257
|
-
selectUserFormMapping,
|
|
3258
|
-
selectRevisionMapping,
|
|
3259
|
-
(_state, componentTypeId) => componentTypeId
|
|
3260
|
-
],
|
|
3261
|
-
(userForms, revisions, componentTypeId) => {
|
|
3262
|
-
const latestRevisions = [];
|
|
3263
|
-
for (const form of Object.values(userForms)) {
|
|
3264
|
-
if (form.component_type === componentTypeId) {
|
|
3265
|
-
latestRevisions.push(_selectLatestFormRevision(revisions, form.offline_id));
|
|
3266
|
-
}
|
|
3267
|
-
}
|
|
3268
|
-
return latestRevisions;
|
|
3248
|
+
return Object.values(userForms).find((userForm) => userForm.component_type === componentTypeId);
|
|
3269
3249
|
}
|
|
3270
3250
|
)
|
|
3271
3251
|
);
|
|
@@ -10421,6 +10401,10 @@ const FormBrowser = memo(
|
|
|
10421
10401
|
}, [filter, maxResults, ownerFilter]);
|
|
10422
10402
|
const userForms = useAppSelector(selectFilteredUserForms(ownerFilterOptions)) ?? [];
|
|
10423
10403
|
const userFormMapping = useAppSelector(selectUserFormMapping);
|
|
10404
|
+
const attachableUserForms = userForms.filter((form) => !form.component_type && !form.component_stage);
|
|
10405
|
+
const attachableUserFormMapping = Object.values(userFormMapping).filter(
|
|
10406
|
+
(form) => !form.component_type && !form.component_stage
|
|
10407
|
+
);
|
|
10424
10408
|
const handleToggleFavorite = useCallback(
|
|
10425
10409
|
(form) => {
|
|
10426
10410
|
if (form.favorite) {
|
|
@@ -10434,7 +10418,7 @@ const FormBrowser = memo(
|
|
|
10434
10418
|
const options = useMemo(() => {
|
|
10435
10419
|
const state = sdk.store.getState();
|
|
10436
10420
|
const accumulator = {};
|
|
10437
|
-
for (const form of
|
|
10421
|
+
for (const form of attachableUserFormMapping) {
|
|
10438
10422
|
const organization = selectOrganization(form.owner_organization || -1)(state);
|
|
10439
10423
|
if (organization) {
|
|
10440
10424
|
accumulator[`${orgOptionPrefix}${organization.id}`] = organization.name;
|
|
@@ -10445,13 +10429,13 @@ const FormBrowser = memo(
|
|
|
10445
10429
|
}
|
|
10446
10430
|
}
|
|
10447
10431
|
return Object.entries(accumulator).map(([value, label]) => ({ itemContent: label, value }));
|
|
10448
|
-
}, [
|
|
10432
|
+
}, [sdk.store, attachableUserFormMapping]);
|
|
10449
10433
|
const handleChange = useCallback((e) => {
|
|
10450
10434
|
setFilter(e.currentTarget.value);
|
|
10451
10435
|
}, []);
|
|
10452
|
-
const numberOfForms = useAppSelector(selectNumberOfUserForms)
|
|
10453
|
-
const numberOfHiddenForms = numberOfForms -
|
|
10454
|
-
const overflowMessage =
|
|
10436
|
+
const numberOfForms = useAppSelector(selectNumberOfUserForms) - (userForms.length - attachableUserForms.length);
|
|
10437
|
+
const numberOfHiddenForms = numberOfForms - attachableUserForms.length;
|
|
10438
|
+
const overflowMessage = attachableUserForms.length == maxResults && numberOfHiddenForms > 0 ? `Only the first ${maxResults} results are shown (${numberOfHiddenForms} hidden)` : numberOfHiddenForms > 0 && `${numberOfHiddenForms} hidden forms`;
|
|
10455
10439
|
return /* @__PURE__ */ jsxs(Flex, { ref, direction: "column", gap: "2", children: [
|
|
10456
10440
|
/* @__PURE__ */ jsxs(Flex, { gap: "2", grow: "1", children: [
|
|
10457
10441
|
/* @__PURE__ */ jsx(Box, { grow: "1", asChild: true, children: /* @__PURE__ */ jsx(TextField$1.Root, { size: "3", children: /* @__PURE__ */ jsx(TextField$1.Input, { placeholder: "Filter", value: filter, onChange: handleChange }) }) }),
|
|
@@ -10466,7 +10450,7 @@ const FormBrowser = memo(
|
|
|
10466
10450
|
}
|
|
10467
10451
|
)
|
|
10468
10452
|
] }),
|
|
10469
|
-
|
|
10453
|
+
attachableUserForms.length > 0 && /* @__PURE__ */ jsx(ButtonList.Root, { children: attachableUserForms.map((form) => /* @__PURE__ */ jsx(
|
|
10470
10454
|
FormBrowserEntry,
|
|
10471
10455
|
{
|
|
10472
10456
|
...entryProps,
|
|
@@ -12096,6 +12080,7 @@ export {
|
|
|
12096
12080
|
selectCompletedStages,
|
|
12097
12081
|
selectComponent,
|
|
12098
12082
|
selectComponentType,
|
|
12083
|
+
selectComponentTypeForm,
|
|
12099
12084
|
selectComponentTypeFromComponent,
|
|
12100
12085
|
selectComponentTypeFromComponents,
|
|
12101
12086
|
selectComponentTypes,
|
|
@@ -12120,7 +12105,6 @@ export {
|
|
|
12120
12105
|
selectFileAttachmentsOfIssue,
|
|
12121
12106
|
selectFilteredUserForms,
|
|
12122
12107
|
selectFormRevision,
|
|
12123
|
-
selectFormsForComponentType,
|
|
12124
12108
|
selectHiddenCategoryCount,
|
|
12125
12109
|
selectHiddenComponentTypeIds,
|
|
12126
12110
|
selectIsFetchingInitialData,
|
|
@@ -12135,7 +12119,6 @@ export {
|
|
|
12135
12119
|
selectLatestRetryTime,
|
|
12136
12120
|
selectLatestRevisionByFormId,
|
|
12137
12121
|
selectLatestRevisionsForComponentStageForms,
|
|
12138
|
-
selectLatestRevisionsForComponentTypeForms,
|
|
12139
12122
|
selectLatestRevisionsFromComponentTypeIds,
|
|
12140
12123
|
selectMainWorkspace,
|
|
12141
12124
|
selectMapStyle,
|