@overmap-ai/core 1.0.57 → 1.0.58-asset-description.1

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.
@@ -4064,6 +4064,24 @@ var __publicField = (obj, key, value) => {
4064
4064
  }
4065
4065
  )
4066
4066
  );
4067
+ const selectFormSubmissionsByIssues = restructureCreateSelectorWithArgs(
4068
+ toolkit.createSelector(
4069
+ [selectFormSubmissions, (_state, issueIds) => issueIds],
4070
+ (submissions, issueIds) => {
4071
+ var _a2;
4072
+ const issueSubmissions = {};
4073
+ for (const issueId of issueIds) {
4074
+ issueSubmissions[issueId] = [];
4075
+ }
4076
+ for (const submission of submissions) {
4077
+ if (submission.issue && issueIds.includes(submission.issue)) {
4078
+ (_a2 = issueSubmissions[submission.issue]) == null ? void 0 : _a2.push(submission);
4079
+ }
4080
+ }
4081
+ return issueSubmissions;
4082
+ }
4083
+ )
4084
+ );
4067
4085
  const selectFormSubmissionsOfAsset = restructureCreateSelectorWithArgs(
4068
4086
  toolkit.createSelector(
4069
4087
  [selectFormSubmissions, (_state, assetId) => assetId],
@@ -8769,6 +8787,12 @@ var __publicField = (obj, key, value) => {
8769
8787
  getFormValidators() {
8770
8788
  return [...this.formValidators];
8771
8789
  }
8790
+ encodeValueToJson(value) {
8791
+ return JSON.stringify(value);
8792
+ }
8793
+ decodeJsonToValue(json) {
8794
+ return JSON.parse(json);
8795
+ }
8772
8796
  }
8773
8797
  __publicField(BaseField, "fieldTypeName");
8774
8798
  __publicField(BaseField, "fieldTypeDescription");
@@ -13042,7 +13066,7 @@ var __publicField = (obj, key, value) => {
13042
13066
  );
13043
13067
  const handleChange = React.useCallback(
13044
13068
  (e) => {
13045
- if (value.findIndex((option) => option.value === e.target.value.trim()) >= 0) {
13069
+ if (value.findIndex((option) => option === e.target.value.trim()) >= 0) {
13046
13070
  setInternalError("All options must be unique");
13047
13071
  } else if (!e.target.value) {
13048
13072
  setInternalError("Option cannot be empty");
@@ -13061,7 +13085,7 @@ var __publicField = (obj, key, value) => {
13061
13085
  return;
13062
13086
  }
13063
13087
  const trimmedValue = intermediateValue.trim();
13064
- setValueAndTouched([...value, { value: trimmedValue, label: trimmedValue }]);
13088
+ setValueAndTouched([...value, trimmedValue]);
13065
13089
  setIntermediateValue("");
13066
13090
  }, [intermediateValue, internalError, setValueAndTouched, value]);
13067
13091
  const handleKeyDown = React.useCallback(
@@ -13131,7 +13155,7 @@ var __publicField = (obj, key, value) => {
13131
13155
  value.map((option, index2) => /* @__PURE__ */ jsxRuntime.jsx(
13132
13156
  dnd.Draggable,
13133
13157
  {
13134
- draggableId: `${option.value}-draggable`,
13158
+ draggableId: `${option}-draggable`,
13135
13159
  index: index2,
13136
13160
  isDragDisabled: disabled,
13137
13161
  children: ({ draggableProps, dragHandleProps, innerRef }) => /* @__PURE__ */ jsxRuntime.jsx(
@@ -13146,7 +13170,7 @@ var __publicField = (obj, key, value) => {
13146
13170
  mb: "1",
13147
13171
  asChild: true,
13148
13172
  children: /* @__PURE__ */ jsxRuntime.jsxs(blocks.Badge, { color: "gray", size: "2", children: [
13149
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: option.label }),
13173
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: option }),
13150
13174
  /* @__PURE__ */ jsxRuntime.jsx(
13151
13175
  blocks.IconButton,
13152
13176
  {
@@ -13166,7 +13190,7 @@ var __publicField = (obj, key, value) => {
13166
13190
  }
13167
13191
  )
13168
13192
  },
13169
- option.value
13193
+ option
13170
13194
  )),
13171
13195
  droppableProvided.placeholder
13172
13196
  ] }) })
@@ -13423,7 +13447,7 @@ var __publicField = (obj, key, value) => {
13423
13447
  severity,
13424
13448
  inputId,
13425
13449
  labelId,
13426
- label: showInputOnly ? label : "",
13450
+ label,
13427
13451
  image: showInputOnly ? void 0 : field.image,
13428
13452
  flexProps: { direction: "column", justify: "start", align: "start", gap: "1" },
13429
13453
  children: [
@@ -14841,6 +14865,27 @@ var __publicField = (obj, key, value) => {
14841
14865
  meta: { readonly }
14842
14866
  };
14843
14867
  }
14868
+ function decodeFormValues(schema, values) {
14869
+ let allFields = [];
14870
+ for (const field of schema.fields) {
14871
+ if (field instanceof FieldSection) {
14872
+ allFields = allFields.concat(field.fields);
14873
+ } else {
14874
+ if (!(field instanceof BaseField)) {
14875
+ throw new Error("Invalid field type");
14876
+ }
14877
+ allFields.push(field);
14878
+ }
14879
+ }
14880
+ const result = {};
14881
+ for (const field of allFields) {
14882
+ if (!(field.identifier in values))
14883
+ ;
14884
+ const value = values[field.identifier];
14885
+ result[field.identifier] = field.decodeJsonToValue(value);
14886
+ }
14887
+ return result;
14888
+ }
14844
14889
  function valueIsFile(v) {
14845
14890
  return Array.isArray(v) && v.some((v2) => v2 instanceof File || v2 instanceof Promise);
14846
14891
  }
@@ -16622,6 +16667,7 @@ var __publicField = (obj, key, value) => {
16622
16667
  StringInput,
16623
16668
  TextField,
16624
16669
  TextInput,
16670
+ decodeFormValues,
16625
16671
  deserialize,
16626
16672
  deserializeField,
16627
16673
  emptyBaseField,
@@ -16829,6 +16875,7 @@ var __publicField = (obj, key, value) => {
16829
16875
  exports2.coordinatesToUrlText = coordinatesToUrlText;
16830
16876
  exports2.createOfflineAction = createOfflineAction;
16831
16877
  exports2.createPointMarker = createPointMarker;
16878
+ exports2.decodeFormValues = decodeFormValues;
16832
16879
  exports2.defaultBadgeColor = defaultBadgeColor;
16833
16880
  exports2.defaultStore = defaultStore;
16834
16881
  exports2.deleteAssetType = deleteAssetType;
@@ -17078,6 +17125,7 @@ var __publicField = (obj, key, value) => {
17078
17125
  exports2.selectFormSubmissions = selectFormSubmissions;
17079
17126
  exports2.selectFormSubmissionsByAssets = selectFormSubmissionsByAssets;
17080
17127
  exports2.selectFormSubmissionsByFormRevisions = selectFormSubmissionsByFormRevisions;
17128
+ exports2.selectFormSubmissionsByIssues = selectFormSubmissionsByIssues;
17081
17129
  exports2.selectFormSubmissionsMapping = selectFormSubmissionsMapping;
17082
17130
  exports2.selectFormSubmissionsOfAsset = selectFormSubmissionsOfAsset;
17083
17131
  exports2.selectFormSubmissionsOfForm = selectFormSubmissionsOfForm;