@teselagen/ove 0.7.29 → 0.7.30-beta.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.
package/index.umd.js CHANGED
@@ -43051,6 +43051,7 @@ ${latestSubscriptionCallbackError.current.stack}
43051
43051
  return 41.36;
43052
43052
  }, "itemSizeEstimator");
43053
43053
  var ReactTableDefaults = defaultProps$1;
43054
+ var VIRTUALIZE_CUTOFF_LENGTH = 200;
43054
43055
  var ReactTable = function(_Methods) {
43055
43056
  _inherits$8(ReactTable2, _Methods);
43056
43057
  function ReactTable2(props) {
@@ -43636,7 +43637,7 @@ ${latestSubscriptionCallbackError.current.stack}
43636
43637
  minWidth: rowMinWidth + "px"
43637
43638
  })
43638
43639
  }, tBodyProps.rest),
43639
- pageRows.length < 200 ? pageRows.map(function(d2, i2) {
43640
+ _this2.props.noVirtual || pageRows.length < VIRTUALIZE_CUTOFF_LENGTH ? pageRows.map(function(d2, i2) {
43640
43641
  return makePageRow(d2, i2);
43641
43642
  }) : React.createElement(ReactList, {
43642
43643
  type: "variable",
@@ -43740,7 +43741,7 @@ ${latestSubscriptionCallbackError.current.stack}
43740
43741
  const getSelectedRowsFromEntities = /* @__PURE__ */ __name((entities, idMap) => {
43741
43742
  if (!idMap) return [];
43742
43743
  return entities.reduce((acc, entity, i2) => {
43743
- return idMap[getIdOrCodeOrIndex(entity, i2)] ? acc.concat(i2) : acc;
43744
+ return idMap[getIdOrCodeOrIndex(entity, i2)] ? acc.concat([i2]) : acc;
43744
43745
  }, []);
43745
43746
  }, "getSelectedRowsFromEntities");
43746
43747
  const removeCleanRows = /* @__PURE__ */ __name((entities, cellValidation) => {
@@ -43859,9 +43860,9 @@ ${latestSubscriptionCallbackError.current.stack}
43859
43860
  var _a2;
43860
43861
  return (_a2 = str == null ? void 0 : str.replace) == null ? void 0 : _a2.call(str, getNumberStrAtEnd(str), "");
43861
43862
  }, "stripNumberAtEnd");
43862
- const getAllRows = /* @__PURE__ */ __name((e2) => {
43863
- const el = e2.target.querySelector(".data-table-container") ? e2.target.querySelector(".data-table-container") : e2.target.closest(".data-table-container");
43864
- const allRowEls = el.querySelectorAll(".rt-tr");
43863
+ const getAllRows = /* @__PURE__ */ __name((tableRef) => {
43864
+ var _a2, _b2;
43865
+ const allRowEls = (_b2 = (_a2 = tableRef.current) == null ? void 0 : _a2.tableRef) == null ? void 0 : _b2.querySelectorAll(".rt-tr");
43865
43866
  if (!allRowEls || !allRowEls.length) {
43866
43867
  return;
43867
43868
  }
@@ -44128,14 +44129,14 @@ ${latestSubscriptionCallbackError.current.stack}
44128
44129
  handleCopyHelper(textToCopy, jsonToCopy, onFinishMsg || "Row Copied");
44129
44130
  }
44130
44131
  }, "handleCopyRows");
44131
- const handleCopyColumn = /* @__PURE__ */ __name((e2, cellWrapper, selectedRecords) => {
44132
+ const handleCopyColumn = /* @__PURE__ */ __name((tableRef, cellWrapper, selectedRecords) => {
44132
44133
  const specificColumn = cellWrapper.getAttribute("data-test");
44133
- let rowElsToCopy = getAllRows(e2);
44134
+ let rowElsToCopy = getAllRows(tableRef);
44134
44135
  if (!rowElsToCopy) return;
44135
44136
  if (selectedRecords) {
44136
- const ids2 = selectedRecords.map((e22) => {
44137
+ const ids2 = selectedRecords.map((e2) => {
44137
44138
  var _a2;
44138
- return (_a2 = getIdOrCodeOrIndex(e22)) == null ? void 0 : _a2.toString();
44139
+ return (_a2 = getIdOrCodeOrIndex(e2)) == null ? void 0 : _a2.toString();
44139
44140
  });
44140
44141
  rowElsToCopy = Array.from(rowElsToCopy).filter((rowEl) => {
44141
44142
  var _a2;
@@ -44168,9 +44169,9 @@ ${latestSubscriptionCallbackError.current.stack}
44168
44169
  const isBottomRight = i2 === lastRowIndex && cellIndex === lastCellIndex;
44169
44170
  return isBottomRight;
44170
44171
  }, "isBottomRightCornerOfRectangle");
44171
- const handleCopyTable = /* @__PURE__ */ __name((e2, opts2) => {
44172
+ const handleCopyTable = /* @__PURE__ */ __name((tableRef, opts2) => {
44172
44173
  try {
44173
- const allRowEls = getAllRows(e2);
44174
+ const allRowEls = getAllRows(tableRef);
44174
44175
  if (!allRowEls) return;
44175
44176
  handleCopyRows(allRowEls, __spreadProps(__spreadValues({}, opts2), {
44176
44177
  onFinishMsg: "Table Copied"
@@ -44207,13 +44208,15 @@ ${latestSubscriptionCallbackError.current.stack}
44207
44208
  },
44208
44209
  [dispatch, tableFormName]
44209
44210
  );
44210
- const { allOrderedEntities, selectedEntities } = useSelector((state2) => {
44211
- var _a2, _b2, _c2, _d2, _e, _f;
44212
- return {
44213
- allOrderedEntities: (_c2 = (_b2 = (_a2 = state2.form) == null ? void 0 : _a2[tableFormName]) == null ? void 0 : _b2.values) == null ? void 0 : _c2.allOrderedEntities,
44214
- selectedEntities: (_f = (_e = (_d2 = state2.form) == null ? void 0 : _d2[tableFormName]) == null ? void 0 : _e.values) == null ? void 0 : _f.reduxFormSelectedEntityIdMap
44215
- };
44216
- });
44211
+ const { allOrderedEntities, selectedEntities } = useSelector(
44212
+ (state2) => {
44213
+ var _a2, _b2, _c2, _d2, _e, _f;
44214
+ return {
44215
+ allOrderedEntities: (_c2 = (_b2 = (_a2 = state2.form) == null ? void 0 : _a2[tableFormName]) == null ? void 0 : _b2.values) == null ? void 0 : _c2.allOrderedEntities,
44216
+ selectedEntities: (_f = (_e = (_d2 = state2.form) == null ? void 0 : _d2[tableFormName]) == null ? void 0 : _e.values) == null ? void 0 : _f.reduxFormSelectedEntityIdMap
44217
+ };
44218
+ }
44219
+ );
44217
44220
  return { selectTableEntities, allOrderedEntities, selectedEntities };
44218
44221
  }, "useTableEntities");
44219
44222
  const useDeepEqualMemo = /* @__PURE__ */ __name((value) => {
@@ -65945,7 +65948,7 @@ ${latestSubscriptionCallbackError.current.stack}
65945
65948
  ));
65946
65949
  }, "render")
65947
65950
  });
65948
- function convertSchema(schema2) {
65951
+ const convertSchema = /* @__PURE__ */ __name((schema2) => {
65949
65952
  let schemaToUse = schema2;
65950
65953
  if (!schemaToUse.fields && Array.isArray(schema2)) {
65951
65954
  schemaToUse = {
@@ -65954,35 +65957,26 @@ ${latestSubscriptionCallbackError.current.stack}
65954
65957
  }
65955
65958
  schemaToUse = __spreadValues({}, schemaToUse);
65956
65959
  schemaToUse.fields = schemaToUse.fields.map((field, i2) => {
65957
- let fieldToUse = field;
65958
65960
  if (typeof field === "string") {
65959
- fieldToUse = {
65961
+ return {
65960
65962
  displayName: startCase(camelCase(field)),
65961
65963
  path: field,
65962
65964
  type: "string"
65963
65965
  };
65964
- } else if (!field.type) {
65965
- fieldToUse = __spreadProps(__spreadValues({}, field), {
65966
- type: "string"
65967
- });
65968
- }
65969
- if (!fieldToUse.displayName) {
65970
- fieldToUse = __spreadProps(__spreadValues({}, fieldToUse), {
65971
- displayName: startCase(camelCase(fieldToUse.path))
65972
- });
65973
- }
65974
- if (!fieldToUse.path) {
65975
- fieldToUse = __spreadProps(__spreadValues({}, fieldToUse), {
65976
- filterDisabled: true,
65977
- sortDisabled: true,
65978
- path: "fake-path" + i2
65979
- });
65966
+ } else {
65967
+ const fieldToUse = __spreadValues({}, field);
65968
+ fieldToUse.type = fieldToUse.type || "string";
65969
+ fieldToUse.displayName = fieldToUse.displayName || startCase(camelCase(fieldToUse.path || ""));
65970
+ if (!fieldToUse.path) {
65971
+ fieldToUse.filterDisabled = true;
65972
+ fieldToUse.sortDisabled = true;
65973
+ fieldToUse.path = "fake-path" + i2;
65974
+ }
65975
+ return fieldToUse;
65980
65976
  }
65981
- return fieldToUse;
65982
65977
  });
65983
65978
  return schemaToUse;
65984
- }
65985
- __name(convertSchema, "convertSchema");
65979
+ }, "convertSchema");
65986
65980
  const TableFormTrackerContext = React.createContext({
65987
65981
  formNames: [],
65988
65982
  // eslint-disable-next-line @typescript-eslint/no-empty-function
@@ -85060,6 +85054,7 @@ ${latestSubscriptionCallbackError.current.stack}
85060
85054
  );
85061
85055
  const tableRef = reactExports.useRef();
85062
85056
  const alreadySelected = reactExports.useRef(false);
85057
+ const [noVirtual, setNoVirtual] = reactExports.useState(false);
85063
85058
  const [onlyShowRowsWErrors, setOnlyShowRowsWErrors] = reactExports.useState(false);
85064
85059
  const [entitiesUndoRedoStack, setEntitiesUndoRedoStack] = reactExports.useState({
85065
85060
  currentVersion: 0
@@ -85901,76 +85896,94 @@ ${latestSubscriptionCallbackError.current.stack}
85901
85896
  updateEntitiesHelper,
85902
85897
  updateValidation
85903
85898
  ]);
85904
- const handleCopySelectedCells = reactExports.useCallback(
85905
- (e2) => {
85906
- if (isEmpty$1(selectedCells)) return;
85907
- const pathToIndex = getFieldPathToIndex(schema2);
85908
- const entityIdToEntity = getEntityIdToEntity(entities);
85909
- const selectionGrid = [];
85910
- let firstRowIndex;
85911
- let firstCellIndex;
85912
- Object.keys(selectedCells).forEach((key) => {
85913
- const [rowId, path2] = key.split(":");
85914
- const eInfo = entityIdToEntity[rowId];
85915
- if (eInfo) {
85916
- if (firstRowIndex === void 0 || eInfo.i < firstRowIndex) {
85917
- firstRowIndex = eInfo.i;
85918
- }
85919
- if (!selectionGrid[eInfo.i]) {
85920
- selectionGrid[eInfo.i] = [];
85921
- }
85922
- const cellIndex = pathToIndex[path2];
85923
- if (firstCellIndex === void 0 || cellIndex < firstCellIndex) {
85924
- firstCellIndex = cellIndex;
85925
- }
85926
- selectionGrid[eInfo.i][cellIndex] = true;
85927
- }
85928
- });
85929
- if (firstRowIndex === void 0) return;
85930
- const allRows = getAllRows(e2);
85931
- let fullCellText = "";
85932
- const fullJson = [];
85933
- times(selectionGrid.length, (i2) => {
85934
- const row = selectionGrid[i2];
85935
- if (fullCellText) {
85936
- fullCellText += "\n";
85899
+ const waitUntilAllRowsAreRendered = reactExports.useCallback(() => {
85900
+ return new Promise((resolve) => {
85901
+ const interval = setInterval(() => {
85902
+ var _a3, _b2;
85903
+ const allRowEls = (_b2 = (_a3 = tableRef.current) == null ? void 0 : _a3.tableRef) == null ? void 0 : _b2.querySelectorAll(".rt-tr-group");
85904
+ if ((allRowEls == null ? void 0 : allRowEls.length) === entities.length) {
85905
+ clearInterval(interval);
85906
+ resolve();
85937
85907
  }
85938
- if (!row) {
85939
- return;
85940
- } else {
85941
- const jsonRow = [];
85942
- let [rowCopyText, json] = getRowCopyText(allRows[i2 + 1]);
85943
- rowCopyText = rowCopyText.split(" ");
85944
- times(row.length, (i22) => {
85945
- const cell = row[i22];
85946
- if (cell) {
85947
- fullCellText += rowCopyText[i22];
85948
- jsonRow.push(json[i22]);
85949
- }
85950
- if (i22 !== row.length - 1 && i22 >= firstCellIndex)
85951
- fullCellText += " ";
85952
- });
85953
- fullJson.push(jsonRow);
85908
+ }, 50);
85909
+ });
85910
+ }, []);
85911
+ const handleCopySelectedCells = reactExports.useCallback(() => __async(this, null, function* () {
85912
+ if (isEmpty$1(selectedCells)) return;
85913
+ if (entities.length > VIRTUALIZE_CUTOFF_LENGTH) {
85914
+ setNoVirtual(true);
85915
+ yield waitUntilAllRowsAreRendered();
85916
+ }
85917
+ const pathToIndex = getFieldPathToIndex(schema2);
85918
+ const entityIdToEntity = getEntityIdToEntity(entities);
85919
+ const selectionGrid = [];
85920
+ let firstRowIndex;
85921
+ let firstCellIndex;
85922
+ Object.keys(selectedCells).forEach((key) => {
85923
+ const [rowId, path2] = key.split(":");
85924
+ const eInfo = entityIdToEntity[rowId];
85925
+ if (eInfo) {
85926
+ if (firstRowIndex === void 0 || eInfo.i < firstRowIndex) {
85927
+ firstRowIndex = eInfo.i;
85928
+ }
85929
+ if (!selectionGrid[eInfo.i]) {
85930
+ selectionGrid[eInfo.i] = [];
85931
+ }
85932
+ const cellIndex = pathToIndex[path2];
85933
+ if (firstCellIndex === void 0 || cellIndex < firstCellIndex) {
85934
+ firstCellIndex = cellIndex;
85954
85935
  }
85955
- });
85956
- if (!fullCellText) return window.toastr.warning("No text to copy");
85957
- handleCopyHelper(fullCellText, fullJson, "Selected cells copied");
85958
- },
85959
- [entities, selectedCells, schema2]
85960
- );
85936
+ selectionGrid[eInfo.i][cellIndex] = true;
85937
+ }
85938
+ });
85939
+ if (firstRowIndex === void 0) return;
85940
+ const allRows = getAllRows(tableRef);
85941
+ let fullCellText = "";
85942
+ const fullJson = [];
85943
+ times(selectionGrid.length, (i2) => {
85944
+ const row = selectionGrid[i2];
85945
+ if (fullCellText) {
85946
+ fullCellText += "\n";
85947
+ }
85948
+ if (!row) {
85949
+ return;
85950
+ } else {
85951
+ const jsonRow = [];
85952
+ let [rowCopyText, json] = getRowCopyText(allRows[i2 + 1]);
85953
+ rowCopyText = rowCopyText.split(" ");
85954
+ times(row.length, (i22) => {
85955
+ const cell = row[i22];
85956
+ if (cell) {
85957
+ fullCellText += rowCopyText[i22];
85958
+ jsonRow.push(json[i22]);
85959
+ }
85960
+ if (i22 !== row.length - 1 && i22 >= firstCellIndex) fullCellText += " ";
85961
+ });
85962
+ fullJson.push(jsonRow);
85963
+ }
85964
+ });
85965
+ if (!fullCellText) return window.toastr.warning("No text to copy");
85966
+ handleCopyHelper(fullCellText, fullJson, "Selected cells copied");
85967
+ setNoVirtual(false);
85968
+ }), [entities, selectedCells, schema2, waitUntilAllRowsAreRendered]);
85961
85969
  const handleCopySelectedRows = reactExports.useCallback(
85962
- (selectedRecords, e2) => {
85963
- const idToIndex = entities.reduce((acc, e22, i2) => {
85964
- acc[e22.id || e22.code] = i2;
85970
+ (selectedRecords) => __async(this, null, function* () {
85971
+ if (entities.length > VIRTUALIZE_CUTOFF_LENGTH) {
85972
+ setNoVirtual(true);
85973
+ yield waitUntilAllRowsAreRendered();
85974
+ }
85975
+ const idToIndex = entities.reduce((acc, e2, i2) => {
85976
+ acc[e2.id || e2.code] = i2;
85965
85977
  return acc;
85966
85978
  }, {});
85967
85979
  const rowNumbersToCopy = selectedRecords.map((rec) => idToIndex[rec.id || rec.code] + 1).sort();
85968
85980
  if (!rowNumbersToCopy.length) return;
85969
85981
  rowNumbersToCopy.unshift(0);
85970
85982
  try {
85971
- const allRowEls = getAllRows(e2);
85983
+ const allRowEls = getAllRows(tableRef);
85972
85984
  if (!allRowEls) return;
85973
85985
  const rowEls = rowNumbersToCopy.map((i2) => allRowEls[i2]);
85986
+ if (window.Cypress) window.Cypress.__copiedRowsLength = rowEls.length;
85974
85987
  handleCopyRows(rowEls, {
85975
85988
  onFinishMsg: "Selected rows copied"
85976
85989
  });
@@ -85978,8 +85991,9 @@ ${latestSubscriptionCallbackError.current.stack}
85978
85991
  console.error(`error:`, error);
85979
85992
  window.toastr.error("Error copying rows.");
85980
85993
  }
85981
- },
85982
- [entities]
85994
+ setNoVirtual(false);
85995
+ }),
85996
+ [entities, waitUntilAllRowsAreRendered]
85983
85997
  );
85984
85998
  const handleCopyHotkey = reactExports.useCallback(
85985
85999
  (e2) => {
@@ -86746,7 +86760,7 @@ ${latestSubscriptionCallbackError.current.stack}
86746
86760
  {
86747
86761
  key: "copyColumn",
86748
86762
  onClick: /* @__PURE__ */ __name(() => {
86749
- handleCopyColumn(e2, cellWrapper);
86763
+ handleCopyColumn(tableRef, cellWrapper);
86750
86764
  }, "onClick"),
86751
86765
  text: "Column"
86752
86766
  }
@@ -86759,7 +86773,7 @@ ${latestSubscriptionCallbackError.current.stack}
86759
86773
  {
86760
86774
  key: "copyColumnSelected",
86761
86775
  onClick: /* @__PURE__ */ __name(() => {
86762
- handleCopyColumn(e2, cellWrapper, selectedRecords);
86776
+ handleCopyColumn(tableRef, cellWrapper, selectedRecords);
86763
86777
  }, "onClick"),
86764
86778
  text: "Column (Selected)"
86765
86779
  }
@@ -86802,7 +86816,7 @@ ${latestSubscriptionCallbackError.current.stack}
86802
86816
  {
86803
86817
  key: "copyFullTableRows",
86804
86818
  onClick: /* @__PURE__ */ __name(() => {
86805
- handleCopyTable(e2);
86819
+ handleCopyTable(tableRef);
86806
86820
  }, "onClick"),
86807
86821
  text: "Table"
86808
86822
  }
@@ -87339,6 +87353,7 @@ ${latestSubscriptionCallbackError.current.stack}
87339
87353
  __spreadValues({
87340
87354
  data: filteredEnts,
87341
87355
  ref: tableRef,
87356
+ noVirtual,
87342
87357
  className: classNames$1({
87343
87358
  isCellEditable,
87344
87359
  "tg-table-loading": isLoading,
@@ -87406,7 +87421,8 @@ ${latestSubscriptionCallbackError.current.stack}
87406
87421
  resizePersist,
87407
87422
  resized,
87408
87423
  rowsToShow,
87409
- style2
87424
+ style2,
87425
+ noVirtual
87410
87426
  ]
87411
87427
  );
87412
87428
  return /* @__PURE__ */ React.createElement("div", { tabIndex: "1", onKeyDown: handleKeyDown, onKeyUp: handleKeyUp }, /* @__PURE__ */ React.createElement(
@@ -87689,8 +87705,8 @@ ${latestSubscriptionCallbackError.current.stack}
87689
87705
  ), /* @__PURE__ */ React.createElement(
87690
87706
  Button,
87691
87707
  {
87692
- onClick: /* @__PURE__ */ __name((e2) => {
87693
- handleCopyTable(e2, { isDownload: true });
87708
+ onClick: /* @__PURE__ */ __name(() => {
87709
+ handleCopyTable(tableRef, { isDownload: true });
87694
87710
  }, "onClick"),
87695
87711
  "data-tip": "Download Table as CSV",
87696
87712
  minimal: true,
@@ -105909,6 +105925,7 @@ ${latestSubscriptionCallbackError.current.stack}
105909
105925
  "updateAmbiguousOrLiteral"
105910
105926
  );
105911
105927
  const updateDnaOrAA = createMetaAction("updateDnaOrAA");
105928
+ const updateMismatchesAllowed = createMetaAction("updateMismatchesAllowed");
105912
105929
  const updateMatchNumber = createMetaAction("updateMatchNumber");
105913
105930
  const findTool = createMergedDefaultStateReducer(
105914
105931
  {
@@ -105940,6 +105957,12 @@ ${latestSubscriptionCallbackError.current.stack}
105940
105957
  dnaOrAA: payload
105941
105958
  });
105942
105959
  },
105960
+ [updateMismatchesAllowed]: (state2, payload) => {
105961
+ return __spreadProps(__spreadValues({}, state2), {
105962
+ matchNumber: 0,
105963
+ mismatchesAllowed: payload
105964
+ });
105965
+ },
105943
105966
  [updateSearchText]: (state2, payload) => {
105944
105967
  return __spreadProps(__spreadValues({}, state2), {
105945
105968
  matchNumber: 0,
@@ -105959,6 +105982,7 @@ ${latestSubscriptionCallbackError.current.stack}
105959
105982
  dnaOrAA: "DNA",
105960
105983
  ambiguousOrLiteral: "LITERAL",
105961
105984
  highlightAll: false,
105985
+ mismatchesAllowed: 0,
105962
105986
  matchNumber: 0
105963
105987
  }
105964
105988
  );
@@ -105971,6 +105995,7 @@ ${latestSubscriptionCallbackError.current.stack}
105971
105995
  updateAmbiguousOrLiteral,
105972
105996
  updateDnaOrAA,
105973
105997
  updateMatchNumber,
105998
+ updateMismatchesAllowed,
105974
105999
  updateSearchText
105975
106000
  }, Symbol.toStringTag, { value: "Module" }));
105976
106001
  const openToolbarItemUpdate = createMetaAction("openToolbarItemUpdate");
@@ -112806,6 +112831,36 @@ ${latestSubscriptionCallbackError.current.stack}
112806
112831
  });
112807
112832
  }
112808
112833
  __name(addSizeIdName, "addSizeIdName");
112834
+ function findApproxMatches(searchSeq, targetSeq, maxMismatches, circular2 = false) {
112835
+ const matches = [];
112836
+ const lenA = searchSeq.length;
112837
+ const lenB = targetSeq.length;
112838
+ const targetSeqExtended = circular2 ? targetSeq + targetSeq.slice(0, lenA - 1) : targetSeq;
112839
+ const limit = circular2 ? lenB : lenB - lenA + 1;
112840
+ for (let i2 = 0; i2 < limit; i2++) {
112841
+ const window2 = targetSeqExtended.slice(i2, i2 + lenA);
112842
+ let mismatchCount = 0;
112843
+ const mismatchPositions = [];
112844
+ for (let j2 = 0; j2 < lenA; j2++) {
112845
+ if (searchSeq[j2] !== window2[j2]) {
112846
+ mismatchPositions.push(j2);
112847
+ mismatchCount++;
112848
+ if (mismatchCount > maxMismatches) break;
112849
+ }
112850
+ }
112851
+ if (mismatchCount <= maxMismatches) {
112852
+ matches.push({
112853
+ index: i2,
112854
+ match: window2,
112855
+ mismatchPositions,
112856
+ numMismatches: mismatchPositions.length
112857
+ // Keep for backwards compatibility
112858
+ });
112859
+ }
112860
+ }
112861
+ return matches;
112862
+ }
112863
+ __name(findApproxMatches, "findApproxMatches");
112809
112864
  var spliceString$1;
112810
112865
  var hasRequiredSpliceString;
112811
112866
  function requireSpliceString() {
@@ -134469,7 +134524,7 @@ ${seq.sequence}
134469
134524
  }
134470
134525
  __name(translationsRawSelector, "translationsRawSelector");
134471
134526
  const translationsRawSelector$1 = createSelector(sequenceDataSelector, translationsRawSelector);
134472
- function searchLayersSelector(sequence2, isCircular, isOpen2, searchString, ambiguousOrLiteral, dnaOrAA, isProtein2, proteinSequence) {
134527
+ function searchLayersSelector(sequence2, isCircular, isOpen2, searchString, ambiguousOrLiteral, dnaOrAA, isProtein2, proteinSequence, mismatchesAllowed) {
134473
134528
  if (!searchString || !isOpen2) {
134474
134529
  return [];
134475
134530
  }
@@ -134497,6 +134552,26 @@ ${seq.sequence}
134497
134552
  });
134498
134553
  });
134499
134554
  }
134555
+ if (dnaOrAA === "DNA" && ambiguousOrLiteral === "LITERAL" && mismatchesAllowed > 0) {
134556
+ const approxMatches = findApproxMatches(
134557
+ searchString,
134558
+ sequence2,
134559
+ mismatchesAllowed,
134560
+ isCircular
134561
+ );
134562
+ const matches2 = approxMatches.map((match) => ({
134563
+ start: match.index,
134564
+ end: match.index + match.match.length - 1,
134565
+ matchedString: match.match,
134566
+ mismatchPositions: match.mismatchPositions,
134567
+ numMismatches: match.numMismatches,
134568
+ isSearchLayer: true,
134569
+ forward: true
134570
+ })).sort((a2, b3) => a2.start - b3.start);
134571
+ return matches2.map((match) => __spreadProps(__spreadValues({}, match), {
134572
+ className: "veSearchLayer"
134573
+ }));
134574
+ }
134500
134575
  const matches = findSequenceMatches(sequence2, searchString, {
134501
134576
  isCircular,
134502
134577
  isAmbiguous: ambiguousOrLiteral === "AMBIGUOUS",
@@ -134521,6 +134596,7 @@ ${seq.sequence}
134521
134596
  (state2) => state2.findTool && state2.findTool.dnaOrAA,
134522
134597
  (state2) => state2.sequenceData.isProtein,
134523
134598
  (state2) => state2.sequenceData.proteinSequence,
134599
+ (state2) => state2.findTool && state2.findTool.mismatchesAllowed,
134524
134600
  searchLayersSelector
134525
134601
  );
134526
134602
  const translationSearchMatchesSelector = createSelector(
@@ -145525,26 +145601,49 @@ ${seq.sequence}
145525
145601
  )
145526
145602
  ];
145527
145603
  }
145528
- return [
145529
- /* @__PURE__ */ React.createElement(
145604
+ const selectionElement = /* @__PURE__ */ React.createElement(
145605
+ "div",
145606
+ {
145607
+ onClick: _onClick,
145608
+ title: selectionMessage,
145609
+ onContextMenu: onSelectionContextMenu,
145610
+ key,
145611
+ className: classNameToPass + " veSelectionLayer veRowViewSelectionLayer notCaret " + (isTrueStart ? " isTrueStart " : "") + (isTrueEnd ? " isTrueEnd " : ""),
145612
+ style: __spreadProps(__spreadValues({
145613
+ width,
145614
+ left: leftMargin + xStart
145615
+ }, style2), {
145616
+ background: color2 || topLevelColor,
145617
+ height
145618
+ })
145619
+ }
145620
+ );
145621
+ let mismatchElements = [];
145622
+ if (selectionLayer2.mismatchPositions && selectionLayer2.mismatchPositions.length > 0) {
145623
+ const relativeToOverlap = selectionLayer2.mismatchPositions.filter((pos) => {
145624
+ const absPos = pos + selectionLayer2.start;
145625
+ return absPos >= overlap.start && absPos <= overlap.end;
145626
+ }).map((pos) => {
145627
+ return pos - (overlap.start - selectionLayer2.start);
145628
+ });
145629
+ mismatchElements = relativeToOverlap.map((pos, i2) => /* @__PURE__ */ React.createElement(
145530
145630
  "div",
145531
145631
  {
145532
- onClick: _onClick,
145533
- title: selectionMessage,
145534
- onContextMenu: onSelectionContextMenu,
145535
- key,
145536
- className: classNameToPass + " veSelectionLayer veRowViewSelectionLayer notCaret " + (isTrueStart ? " isTrueStart " : "") + (isTrueEnd ? " isTrueEnd " : ""),
145537
- style: __spreadProps(__spreadValues({
145538
- width,
145539
- left: leftMargin + xStart
145540
- }, style2), {
145541
- background: color2 || topLevelColor,
145542
- height
145543
- })
145632
+ key: `${key}-mismatch-${i2}`,
145633
+ className: "veSelectionLayer veMismatchLayer notCaret",
145634
+ style: {
145635
+ width: charWidth2,
145636
+ left: leftMargin + xStart + pos * charWidth2,
145637
+ top: 0,
145638
+ height: height || "100%",
145639
+ background: "red",
145640
+ position: "absolute",
145641
+ opacity: 0.5
145642
+ }
145544
145643
  }
145545
- ),
145546
- ...caretSvgs
145547
- ];
145644
+ ));
145645
+ }
145646
+ return [selectionElement, ...mismatchElements, ...caretSvgs];
145548
145647
  });
145549
145648
  } else {
145550
145649
  return null;
@@ -150367,7 +150466,7 @@ Part of ${annotation.translationType} Translation from BPs ${annotation.start +
150367
150466
  input.click();
150368
150467
  }
150369
150468
  __name(showFileDialog, "showFileDialog");
150370
- const version = "0.7.28";
150469
+ const version = "0.7.29";
150371
150470
  const packageJson = {
150372
150471
  version
150373
150472
  };
@@ -175591,6 +175690,7 @@ ${seqDataToCopy}\r
175591
175690
  annotationVisibilityShow: annotationVisibilityShow2,
175592
175691
  updateAmbiguousOrLiteral: updateAmbiguousOrLiteral2,
175593
175692
  updateDnaOrAA: updateDnaOrAA2,
175693
+ updateMismatchesAllowed: updateMismatchesAllowed2,
175594
175694
  updateMatchNumber: _updateMatchNumber,
175595
175695
  selectionLayerUpdate: selectionLayerUpdate2,
175596
175696
  annotationSearchMatches,
@@ -175603,6 +175703,7 @@ ${seqDataToCopy}\r
175603
175703
  ambiguousOrLiteral,
175604
175704
  matchesTotal = 0,
175605
175705
  matchNumber = 0,
175706
+ mismatchesAllowed = 0,
175606
175707
  isInline
175607
175708
  } = findTool2;
175608
175709
  const updateMatchNumber2 = /* @__PURE__ */ __name((...args) => {
@@ -175642,6 +175743,30 @@ ${seqDataToCopy}\r
175642
175743
  }, "onChange")
175643
175744
  }
175644
175745
  ), /* @__PURE__ */ React.createElement(InfoHelper, { style: { marginLeft: 10 } }, /* @__PURE__ */ React.createElement("div", null, "Ambiguous substitutions:", /* @__PURE__ */ React.createElement("div", { style: { display: "flex", fontSize: 12 } }, /* @__PURE__ */ React.createElement("div", { style: { marginRight: 20 } }, /* @__PURE__ */ React.createElement("div", { style: { fontSize: 14, marginBottom: 4, marginTop: 5 } }, "DNA:"), /* @__PURE__ */ React.createElement("div", null, "M: AC"), /* @__PURE__ */ React.createElement("div", null, "R: AG"), /* @__PURE__ */ React.createElement("div", null, "W: AT"), /* @__PURE__ */ React.createElement("div", null, "S: CG"), /* @__PURE__ */ React.createElement("div", null, "Y: CT"), /* @__PURE__ */ React.createElement("div", null, "K: GT"), /* @__PURE__ */ React.createElement("div", null, "V: ACG"), /* @__PURE__ */ React.createElement("div", null, "H: ACT"), /* @__PURE__ */ React.createElement("div", null, "D: AGT"), /* @__PURE__ */ React.createElement("div", null, "B: CGT"), /* @__PURE__ */ React.createElement("div", null, "X: GATC"), /* @__PURE__ */ React.createElement("div", null, "N: GATC"), /* @__PURE__ */ React.createElement("div", null, "*: any")), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("div", { style: { fontSize: 14, marginBottom: 4, marginTop: 5 } }, "AA:"), /* @__PURE__ */ React.createElement("div", null, "B: ND"), /* @__PURE__ */ React.createElement("div", null, "J: IL"), /* @__PURE__ */ React.createElement("div", null, "X: ACDEFGHIKLMNPQRSTVWY"), /* @__PURE__ */ React.createElement("div", null, "Z: QE"), /* @__PURE__ */ React.createElement("div", null, "*: any")))))),
175746
+ /* @__PURE__ */ React.createElement(
175747
+ "div",
175748
+ {
175749
+ key: "mismatchesAllowed",
175750
+ style: { marginTop: "8px", display: "flex", alignItems: "center" }
175751
+ },
175752
+ /* @__PURE__ */ React.createElement("label", { style: { marginRight: "8px" } }, "Mismatches Allowed:"),
175753
+ /* @__PURE__ */ React.createElement(
175754
+ NumericInput,
175755
+ {
175756
+ min: 0,
175757
+ max: 10,
175758
+ className: "tg-mismatches-allowed-input",
175759
+ style: { width: "60px" },
175760
+ value: mismatchesAllowed,
175761
+ disabled: dnaOrAA !== "DNA" || ambiguousOrLiteral !== "LITERAL",
175762
+ onValueChange: /* @__PURE__ */ __name((value) => {
175763
+ const newValue = Math.max(0, parseInt(value, 10) || 0);
175764
+ updateMismatchesAllowed2(newValue);
175765
+ }, "onValueChange")
175766
+ }
175767
+ ),
175768
+ /* @__PURE__ */ React.createElement(InfoHelper, { style: { marginLeft: 10 } }, /* @__PURE__ */ React.createElement("div", null, "Number of mismatches allowed when searching DNA sequences with literal matching.", /* @__PURE__ */ React.createElement("br", null), /* @__PURE__ */ React.createElement("br", null), "Higher values may slow down search performance."))
175769
+ ),
175645
175770
  /* @__PURE__ */ React.createElement(
175646
175771
  Switch,
175647
175772
  {
package/ove.css CHANGED
@@ -10689,6 +10689,14 @@ li.bp3-menu-divider:last-child {
10689
10689
  top: -2px;
10690
10690
  position: absolute;
10691
10691
  z-index: 10;
10692
+ display: flex;
10693
+ align-items: center;
10694
+ justify-content: center;
10695
+ font-family: monospace;
10696
+ }
10697
+
10698
+ .veMismatchLayer {
10699
+ z-index: 11; /* Ensure mismatch layers appear on top of normal selection layer */
10692
10700
  }
10693
10701
 
10694
10702
  .veCaret {
@@ -11847,9 +11855,14 @@ path.partWithSelectedTag {
11847
11855
  border-right-color: yellow !important;
11848
11856
  }
11849
11857
  .veSearchLayerActive {
11850
- stroke: red !important;
11851
- fill: red !important;
11852
- background: red !important;
11858
+ stroke: green !important;
11859
+ fill: green !important;
11860
+ background: green !important;
11861
+ }
11862
+ .veMismatchedBase {
11863
+ color: red !important;
11864
+ font-weight: bold;
11865
+ background-color: rgba(255, 0, 0, 0.3);
11853
11866
  }
11854
11867
  .notCaret.veSearchLayerBottomStrand:after {
11855
11868
  content: "";