@teselagen/ui 0.7.36 → 0.8.2

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.
Files changed (167) hide show
  1. package/DataTable/EditabelCell.d.ts +7 -0
  2. package/DataTable/defaultProps.d.ts +43 -0
  3. package/DataTable/utils/computePresets.d.ts +1 -0
  4. package/DataTable/utils/useDeepEqualMemo.d.ts +1 -0
  5. package/DataTable/utils/useTableParams.d.ts +49 -0
  6. package/index.cjs.js +30 -9
  7. package/index.es.js +30 -9
  8. package/package.json +1 -1
  9. package/src/AdvancedOptions.spec.js +26 -0
  10. package/src/AsyncValidateFieldSpinner/index.js +12 -0
  11. package/src/BlueprintError/index.js +14 -0
  12. package/src/BounceLoader/index.js +16 -0
  13. package/src/BounceLoader/style.css +45 -0
  14. package/src/CollapsibleCard/index.js +68 -0
  15. package/src/CollapsibleCard/style.css +23 -0
  16. package/src/DNALoader/index.js +20 -0
  17. package/src/DNALoader/style.css +251 -0
  18. package/src/DataTable/Columns.jsx +945 -0
  19. package/src/DataTable/EditabelCell.jsx +44 -0
  20. package/src/DataTable/EditableCell.js +44 -0
  21. package/src/DataTable/RenderCell.js +191 -0
  22. package/{RenderCell.js → src/DataTable/RenderCell.jsx} +1 -1
  23. package/src/DataTable/defaultProps.js +45 -0
  24. package/src/DataTable/index.js +3244 -0
  25. package/src/DataTable/style.css +608 -0
  26. package/src/DataTable/utils/computePresets.js +42 -0
  27. package/src/DataTable/utils/index.js +55 -0
  28. package/src/DataTable/utils/useDeepEqualMemo.js +10 -0
  29. package/src/DataTable/utils/useTableParams.js +361 -0
  30. package/src/DialogFooter/index.js +86 -0
  31. package/src/DialogFooter/style.css +9 -0
  32. package/src/FormComponents/index.js +1266 -0
  33. package/src/FormComponents/style.css +275 -0
  34. package/src/FormComponents/utils.js +6 -0
  35. package/src/HotkeysDialog/index.js +79 -0
  36. package/src/HotkeysDialog/style.css +54 -0
  37. package/src/InfoHelper/index.js +78 -0
  38. package/src/InfoHelper/style.css +7 -0
  39. package/src/IntentText/index.js +18 -0
  40. package/src/Loading/index.js +70 -0
  41. package/src/Loading/style.css +4 -0
  42. package/src/MenuBar/index.js +423 -0
  43. package/src/MenuBar/style.css +45 -0
  44. package/src/PromptUnsavedChanges/index.js +38 -0
  45. package/src/ResizableDraggableDialog/index.js +141 -0
  46. package/src/ResizableDraggableDialog/style.css +42 -0
  47. package/src/ScrollToTop/index.js +72 -0
  48. package/src/TagSelect/index.js +69 -0
  49. package/src/TagSelect/style.css +13 -0
  50. package/src/TgHtmlSelect/index.js +20 -0
  51. package/src/TgSelect/index.js +537 -0
  52. package/src/TgSelect/style.css +61 -0
  53. package/src/TgSuggest/index.js +124 -0
  54. package/src/Timeline/index.js +15 -0
  55. package/src/Timeline/style.css +29 -0
  56. package/src/enhancers/withDialog/index.js +196 -0
  57. package/src/index.js +87 -0
  58. package/src/showConfirmationDialog/index.js +148 -0
  59. package/src/style.css +265 -0
  60. package/{isBeingCalledExcessively.js → src/utils/isBeingCalledExcessively.js} +0 -2
  61. package/style.css +10508 -0
  62. /package/{AdvancedOptions.js → src/AdvancedOptions.js} +0 -0
  63. /package/{AssignDefaultsModeContext.js → src/AssignDefaultsModeContext.js} +0 -0
  64. /package/{CellDragHandle.js → src/DataTable/CellDragHandle.js} +0 -0
  65. /package/{ColumnFilterMenu.js → src/DataTable/ColumnFilterMenu.js} +0 -0
  66. /package/{Columns.js → src/DataTable/Columns.js} +0 -0
  67. /package/{DisabledLoadingComponent.js → src/DataTable/DisabledLoadingComponent.js} +0 -0
  68. /package/{DisplayOptions.js → src/DataTable/DisplayOptions.js} +0 -0
  69. /package/{DropdownCell.js → src/DataTable/DropdownCell.js} +0 -0
  70. /package/{EditableCell.js → src/DataTable/EditabelCell.js} +0 -0
  71. /package/{FilterAndSortMenu.js → src/DataTable/FilterAndSortMenu.js} +0 -0
  72. /package/{PagingTool.js → src/DataTable/PagingTool.js} +0 -0
  73. /package/{SearchBar.js → src/DataTable/SearchBar.js} +0 -0
  74. /package/{SortableColumns.js → src/DataTable/SortableColumns.js} +0 -0
  75. /package/{TableFormTrackerContext.js → src/DataTable/TableFormTrackerContext.js} +0 -0
  76. /package/{ThComponent.js → src/DataTable/ThComponent.js} +0 -0
  77. /package/{dataTableEnhancer.js → src/DataTable/dataTableEnhancer.js} +0 -0
  78. /package/{defaultFormatters.js → src/DataTable/defaultFormatters.js} +0 -0
  79. /package/{defaultValidators.js → src/DataTable/defaultValidators.js} +0 -0
  80. /package/{editCellHelper.js → src/DataTable/editCellHelper.js} +0 -0
  81. /package/{getCellVal.js → src/DataTable/getCellVal.js} +0 -0
  82. /package/{getVals.js → src/DataTable/getVals.js} +0 -0
  83. /package/{isTruthy.js → src/DataTable/isTruthy.js} +0 -0
  84. /package/{isValueEmpty.js → src/DataTable/isValueEmpty.js} +0 -0
  85. /package/{convertSchema.js → src/DataTable/utils/convertSchema.js} +0 -0
  86. /package/{formatPasteData.js → src/DataTable/utils/formatPasteData.js} +0 -0
  87. /package/{getAllRows.js → src/DataTable/utils/getAllRows.js} +0 -0
  88. /package/{getCellCopyText.js → src/DataTable/utils/getCellCopyText.js} +0 -0
  89. /package/{getCellInfo.js → src/DataTable/utils/getCellInfo.js} +0 -0
  90. /package/{getFieldPathToField.js → src/DataTable/utils/getFieldPathToField.js} +0 -0
  91. /package/{getIdOrCodeOrIndex.js → src/DataTable/utils/getIdOrCodeOrIndex.js} +0 -0
  92. /package/{getLastSelectedEntity.js → src/DataTable/utils/getLastSelectedEntity.js} +0 -0
  93. /package/{getNewEntToSelect.js → src/DataTable/utils/getNewEntToSelect.js} +0 -0
  94. /package/{getRowCopyText.js → src/DataTable/utils/getRowCopyText.js} +0 -0
  95. /package/{getTableConfigFromStorage.js → src/DataTable/utils/getTableConfigFromStorage.js} +0 -0
  96. /package/{handleCopyColumn.js → src/DataTable/utils/handleCopyColumn.js} +0 -0
  97. /package/{handleCopyHelper.js → src/DataTable/utils/handleCopyHelper.js} +0 -0
  98. /package/{handleCopyRows.js → src/DataTable/utils/handleCopyRows.js} +0 -0
  99. /package/{handleCopyTable.js → src/DataTable/utils/handleCopyTable.js} +0 -0
  100. /package/{isBottomRightCornerOfRectangle.js → src/DataTable/utils/isBottomRightCornerOfRectangle.js} +0 -0
  101. /package/{isEntityClean.js → src/DataTable/utils/isEntityClean.js} +0 -0
  102. /package/{primarySelectedValue.js → src/DataTable/utils/primarySelectedValue.js} +0 -0
  103. /package/{queryParams.js → src/DataTable/utils/queryParams.js} +0 -0
  104. /package/{removeCleanRows.js → src/DataTable/utils/removeCleanRows.js} +0 -0
  105. /package/{rowClick.js → src/DataTable/utils/rowClick.js} +0 -0
  106. /package/{selection.js → src/DataTable/utils/selection.js} +0 -0
  107. /package/{useTableEntities.js → src/DataTable/utils/useTableEntities.js} +0 -0
  108. /package/{utils.js → src/DataTable/utils/utils.js} +0 -0
  109. /package/{withSelectedEntities.js → src/DataTable/utils/withSelectedEntities.js} +0 -0
  110. /package/{withTableParams.js → src/DataTable/utils/withTableParams.js} +0 -0
  111. /package/{validateTableWideErrors.js → src/DataTable/validateTableWideErrors.js} +0 -0
  112. /package/{viewColumn.js → src/DataTable/viewColumn.js} +0 -0
  113. /package/{DropdownButton.js → src/DropdownButton.js} +0 -0
  114. /package/{FillWindow.css → src/FillWindow.css} +0 -0
  115. /package/{FillWindow.js → src/FillWindow.js} +0 -0
  116. /package/{FormSeparator.js → src/FormComponents/FormSeparator.js} +0 -0
  117. /package/{LoadingDots.js → src/FormComponents/LoadingDots.js} +0 -0
  118. /package/{Uploader.js → src/FormComponents/Uploader.js} +0 -0
  119. /package/{getNewName.js → src/FormComponents/getNewName.js} +0 -0
  120. /package/{itemUpload.js → src/FormComponents/itemUpload.js} +0 -0
  121. /package/{sortify.js → src/FormComponents/sortify.js} +0 -0
  122. /package/{tryToMatchSchemas.js → src/FormComponents/tryToMatchSchemas.js} +0 -0
  123. /package/{MatchHeaders.js → src/MatchHeaders.js} +0 -0
  124. /package/{SimpleStepViz.js → src/SimpleStepViz.js} +0 -0
  125. /package/{Tag.js → src/Tag.js} +0 -0
  126. /package/{TimelineEvent.js → src/Timeline/TimelineEvent.js} +0 -0
  127. /package/{UploadCsvWizard.css → src/UploadCsvWizard.css} +0 -0
  128. /package/{UploadCsvWizard.js → src/UploadCsvWizard.js} +0 -0
  129. /package/{autoTooltip.js → src/autoTooltip.js} +0 -0
  130. /package/{constants.js → src/constants.js} +0 -0
  131. /package/{customIcons.js → src/customIcons.js} +0 -0
  132. /package/{tg_modalState.js → src/enhancers/withDialog/tg_modalState.js} +0 -0
  133. /package/{withField.js → src/enhancers/withField.js} +0 -0
  134. /package/{withFields.js → src/enhancers/withFields.js} +0 -0
  135. /package/{withLocalStorage.js → src/enhancers/withLocalStorage.js} +0 -0
  136. /package/{rerenderOnWindowResize.js → src/rerenderOnWindowResize.js} +0 -0
  137. /package/{showAppSpinner.js → src/showAppSpinner.js} +0 -0
  138. /package/{showDialogOnDocBody.js → src/showDialogOnDocBody.js} +0 -0
  139. /package/{throwFormError.js → src/throwFormError.js} +0 -0
  140. /package/{toastr.js → src/toastr.js} +0 -0
  141. /package/{typeToCommonType.js → src/typeToCommonType.js} +0 -0
  142. /package/{useDialog.js → src/useDialog.js} +0 -0
  143. /package/{adHoc.js → src/utils/adHoc.js} +0 -0
  144. /package/{basicHandleActionsWithFullState.js → src/utils/basicHandleActionsWithFullState.js} +0 -0
  145. /package/{browserUtils.js → src/utils/browserUtils.js} +0 -0
  146. /package/{combineReducersWithFullState.js → src/utils/combineReducersWithFullState.js} +0 -0
  147. /package/{commandControls.js → src/utils/commandControls.js} +0 -0
  148. /package/{commandUtils.js → src/utils/commandUtils.js} +0 -0
  149. /package/{determineBlackOrWhiteTextColor.js → src/utils/determineBlackOrWhiteTextColor.js} +0 -0
  150. /package/{getDayjsFormatter.js → src/utils/getDayjsFormatter.js} +0 -0
  151. /package/{getTextFromEl.js → src/utils/getTextFromEl.js} +0 -0
  152. /package/{handlerHelpers.js → src/utils/handlerHelpers.js} +0 -0
  153. /package/{index.js → src/utils/hooks/index.js} +0 -0
  154. /package/{useDeepEqualMemo.js → src/utils/hooks/useDeepEqualMemo.js} +0 -0
  155. /package/{useStableReference.js → src/utils/hooks/useStableReference.js} +0 -0
  156. /package/{hotkeyUtils.js → src/utils/hotkeyUtils.js} +0 -0
  157. /package/{menuUtils.js → src/utils/menuUtils.js} +0 -0
  158. /package/{popoverOverflowModifiers.js → src/utils/popoverOverflowModifiers.js} +0 -0
  159. /package/{pureNoFunc.js → src/utils/pureNoFunc.js} +0 -0
  160. /package/{renderOnDoc.js → src/utils/renderOnDoc.js} +0 -0
  161. /package/{showProgressToast.js → src/utils/showProgressToast.js} +0 -0
  162. /package/{tagUtils.js → src/utils/tagUtils.js} +0 -0
  163. /package/{tgFormValues.js → src/utils/tgFormValues.js} +0 -0
  164. /package/{useTraceUpdate.js → src/utils/useTraceUpdate.js} +0 -0
  165. /package/{withSelectTableRecords.js → src/utils/withSelectTableRecords.js} +0 -0
  166. /package/{withStore.js → src/utils/withStore.js} +0 -0
  167. /package/{wrapDialog.js → src/wrapDialog.js} +0 -0
@@ -0,0 +1,7 @@
1
+ export function EditableCell({ cancelEdit, dataTest, finishEdit, isNumeric, initialValue }: {
2
+ cancelEdit: any;
3
+ dataTest: any;
4
+ finishEdit: any;
5
+ isNumeric: any;
6
+ initialValue: any;
7
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,43 @@
1
+ import { noop } from 'lodash-es';
2
+ declare namespace _default {
3
+ export { noop as addFilters };
4
+ export let className: string;
5
+ export { noop as clearFilters };
6
+ export { noop as contextMenu };
7
+ export let disabled: boolean;
8
+ export let entities: never[];
9
+ export let extraClasses: string;
10
+ export let filters: never[];
11
+ export let isCopyable: boolean;
12
+ export { noop as isEntityDisabled };
13
+ export let isLoading: boolean;
14
+ export let isSimple: boolean;
15
+ export let isSingleSelect: boolean;
16
+ export let maxHeight: number;
17
+ export let noHeader: boolean;
18
+ export let noSelect: boolean;
19
+ export let noUserSelect: boolean;
20
+ export { noop as onDeselect };
21
+ export { noop as onMultiRowSelect };
22
+ export { noop as onRowClick };
23
+ export { noop as onRowSelect };
24
+ export { noop as onSingleRowSelect };
25
+ export let page: number;
26
+ export let pageSize: number;
27
+ export let reduxFormExpandedEntityIdMap: {};
28
+ export let reduxFormSearchInput: string;
29
+ export let reduxFormSelectedEntityIdMap: {};
30
+ export { noop as removeSingleFilter };
31
+ export let resized: never[];
32
+ export { noop as resizePersist };
33
+ export { noop as setFilter };
34
+ export { noop as setOrder };
35
+ export { noop as setPage };
36
+ export { noop as setPageSize };
37
+ export { noop as setSearchTerm };
38
+ export let showCount: boolean;
39
+ export let style: {};
40
+ export let withCheckboxes: boolean;
41
+ export let withSort: boolean;
42
+ }
43
+ export default _default;
@@ -0,0 +1 @@
1
+ export default function computePresets(props?: {}): import('lodash').Dictionary<any>;
@@ -0,0 +1 @@
1
+ export function useDeepEqualMemo(value: any): undefined;
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Note all these options can be passed at Design Time or at Runtime (like reduxForm())
3
+ *
4
+ * @export
5
+ *
6
+ * @param {compOrOpts} compOrOpts
7
+ * @typedef {object} compOrOpts
8
+ * @property {*string} formName - required unique identifier for the table
9
+ * @property {Object | Function} schema - The data table schema or a function returning it. The function wll be called with props as the argument.
10
+ * @property {boolean} urlConnected - whether the table should connect to/update the URL
11
+ * @property {boolean} withSelectedEntities - whether or not to pass the selected entities
12
+ * @property {boolean} isCodeModel - whether the model is keyed by code instead of id in the db
13
+ * @property {object} defaults - tableParam defaults such as pageSize, filter, etc
14
+ * @property {boolean} noOrderError - won't console an error if an order is not found on schema
15
+ */
16
+ export default function useTableParams(props: any): any;
17
+ /**
18
+ * Note all these options can be passed at Design Time or at Runtime (like reduxForm())
19
+ */
20
+ export type compOrOpts = {
21
+ /**
22
+ * } formName - required unique identifier for the table
23
+ */
24
+ string: any;
25
+ /**
26
+ * - The data table schema or a function returning it. The function wll be called with props as the argument.
27
+ */
28
+ schema: Object | Function;
29
+ /**
30
+ * - whether the table should connect to/update the URL
31
+ */
32
+ urlConnected: boolean;
33
+ /**
34
+ * - whether or not to pass the selected entities
35
+ */
36
+ withSelectedEntities: boolean;
37
+ /**
38
+ * - whether the model is keyed by code instead of id in the db
39
+ */
40
+ isCodeModel: boolean;
41
+ /**
42
+ * - tableParam defaults such as pageSize, filter, etc
43
+ */
44
+ defaults: object;
45
+ /**
46
+ * - won't console an error if an order is not found on schema
47
+ */
48
+ noOrderError: boolean;
49
+ };
package/index.cjs.js CHANGED
@@ -15848,7 +15848,6 @@ var itemSizeEstimator = /* @__PURE__ */ __name(function itemSizeEstimator2() {
15848
15848
  return 41.36;
15849
15849
  }, "itemSizeEstimator");
15850
15850
  var ReactTableDefaults = defaultProps;
15851
- var VIRTUALIZE_CUTOFF_LENGTH = 200;
15852
15851
  var ReactTable = function(_Methods) {
15853
15852
  _inherits$8(ReactTable2, _Methods);
15854
15853
  function ReactTable2(props) {
@@ -16434,7 +16433,7 @@ var ReactTable = function(_Methods) {
16434
16433
  minWidth: rowMinWidth + "px"
16435
16434
  })
16436
16435
  }, tBodyProps.rest),
16437
- _this2.props.noVirtual || pageRows.length < VIRTUALIZE_CUTOFF_LENGTH ? pageRows.map(function(d2, i2) {
16436
+ pageRows.length < 200 ? pageRows.map(function(d2, i2) {
16438
16437
  return makePageRow(d2, i2);
16439
16438
  }) : React.createElement(ReactList, {
16440
16439
  type: "variable",
@@ -51116,10 +51115,10 @@ const RenderCell = /* @__PURE__ */ __name(({
51116
51115
  return (_c = (_b = (_a2 = state.form) == null ? void 0 : _a2[formName]) == null ? void 0 : _b.values) == null ? void 0 : _c.reduxFormEditingCell;
51117
51116
  }
51118
51117
  );
51119
- const initialValue = reactRedux.useSelector(
51118
+ const shouldEditableCellInputBeCleared = reactRedux.useSelector(
51120
51119
  (state) => {
51121
51120
  var _a2, _b, _c;
51122
- return (_c = (_b = (_a2 = state.form) == null ? void 0 : _a2[formName]) == null ? void 0 : _b.values) == null ? void 0 : _c.reduxFormInitialValue;
51121
+ return (_c = (_b = (_a2 = state.form) == null ? void 0 : _a2[formName]) == null ? void 0 : _b.values) == null ? void 0 : _c.shouldEditableCellInputBeCleared;
51123
51122
  }
51124
51123
  );
51125
51124
  const [row] = args;
@@ -51172,7 +51171,7 @@ const RenderCell = /* @__PURE__ */ __name(({
51172
51171
  dataTest,
51173
51172
  cancelEdit: cancelCellEdit,
51174
51173
  isNumeric: column.type === "number",
51175
- initialValue: initialValue || text2,
51174
+ initialValue: shouldEditableCellInputBeCleared ? void 0 : text2,
51176
51175
  finishEdit: /* @__PURE__ */ __name((newVal) => {
51177
51176
  finishCellEdit(cellId, newVal);
51178
51177
  }, "finishEdit")
@@ -57035,8 +57034,12 @@ const DataTable = /* @__PURE__ */ __name((_I) => {
57035
57034
  }
57036
57035
  }, [selectedCells]);
57037
57036
  const startCellEdit = React.useCallback(
57038
- (cellId, initialValue) => {
57039
- change("reduxFormInitialValue", initialValue);
57037
+ (cellId, shouldClear) => {
57038
+ if (shouldClear) {
57039
+ change("shouldEditableCellInputBeCleared", true);
57040
+ } else {
57041
+ change("shouldEditableCellInputBeCleared", false);
57042
+ }
57040
57043
  change("reduxFormEditingCell", (prev) => {
57041
57044
  if (prev === cellId) return cellId;
57042
57045
  setSelectedCells((prev2) => {
@@ -58697,12 +58700,30 @@ const DataTable = /* @__PURE__ */ __name((_I) => {
58697
58700
  const rowDisabled = isEntityDisabled(entity);
58698
58701
  const isNum = (_g = e.code) == null ? void 0 : _g.startsWith("Digit");
58699
58702
  const isLetter = (_h = e.code) == null ? void 0 : _h.startsWith("Key");
58700
- if (!isNum && !isLetter) {
58703
+ const allowedSpecialChars = [
58704
+ "Minus",
58705
+ "Equal",
58706
+ "Backquote",
58707
+ "BracketLeft",
58708
+ "BracketRight",
58709
+ "Backslash",
58710
+ "IntlBackslash",
58711
+ "Semicolon",
58712
+ "Quote",
58713
+ "Comma",
58714
+ "Period",
58715
+ "Slash",
58716
+ "IntlRo",
58717
+ "IntlYen",
58718
+ "Space"
58719
+ ];
58720
+ const isSpecialChar = allowedSpecialChars.includes(e.code);
58721
+ if (!isNum && !isLetter && !isSpecialChar) {
58701
58722
  return;
58702
58723
  }
58703
58724
  if (rowDisabled) return;
58704
58725
  e.stopPropagation();
58705
- startCellEdit(primarySelectedCellId, e.key);
58726
+ startCellEdit(primarySelectedCellId, true);
58706
58727
  }, "onKeyDown")
58707
58728
  }),
58708
58729
  isCellEditable && entities.length > 50 && // test for this!!
package/index.es.js CHANGED
@@ -15830,7 +15830,6 @@ var itemSizeEstimator = /* @__PURE__ */ __name(function itemSizeEstimator2() {
15830
15830
  return 41.36;
15831
15831
  }, "itemSizeEstimator");
15832
15832
  var ReactTableDefaults = defaultProps;
15833
- var VIRTUALIZE_CUTOFF_LENGTH = 200;
15834
15833
  var ReactTable = function(_Methods) {
15835
15834
  _inherits$8(ReactTable2, _Methods);
15836
15835
  function ReactTable2(props) {
@@ -16416,7 +16415,7 @@ var ReactTable = function(_Methods) {
16416
16415
  minWidth: rowMinWidth + "px"
16417
16416
  })
16418
16417
  }, tBodyProps.rest),
16419
- _this2.props.noVirtual || pageRows.length < VIRTUALIZE_CUTOFF_LENGTH ? pageRows.map(function(d2, i2) {
16418
+ pageRows.length < 200 ? pageRows.map(function(d2, i2) {
16420
16419
  return makePageRow(d2, i2);
16421
16420
  }) : React__default.createElement(ReactList, {
16422
16421
  type: "variable",
@@ -51098,10 +51097,10 @@ const RenderCell = /* @__PURE__ */ __name(({
51098
51097
  return (_c = (_b = (_a2 = state.form) == null ? void 0 : _a2[formName]) == null ? void 0 : _b.values) == null ? void 0 : _c.reduxFormEditingCell;
51099
51098
  }
51100
51099
  );
51101
- const initialValue = useSelector(
51100
+ const shouldEditableCellInputBeCleared = useSelector(
51102
51101
  (state) => {
51103
51102
  var _a2, _b, _c;
51104
- return (_c = (_b = (_a2 = state.form) == null ? void 0 : _a2[formName]) == null ? void 0 : _b.values) == null ? void 0 : _c.reduxFormInitialValue;
51103
+ return (_c = (_b = (_a2 = state.form) == null ? void 0 : _a2[formName]) == null ? void 0 : _b.values) == null ? void 0 : _c.shouldEditableCellInputBeCleared;
51105
51104
  }
51106
51105
  );
51107
51106
  const [row] = args;
@@ -51154,7 +51153,7 @@ const RenderCell = /* @__PURE__ */ __name(({
51154
51153
  dataTest,
51155
51154
  cancelEdit: cancelCellEdit,
51156
51155
  isNumeric: column.type === "number",
51157
- initialValue: initialValue || text2,
51156
+ initialValue: shouldEditableCellInputBeCleared ? void 0 : text2,
51158
51157
  finishEdit: /* @__PURE__ */ __name((newVal) => {
51159
51158
  finishCellEdit(cellId, newVal);
51160
51159
  }, "finishEdit")
@@ -57017,8 +57016,12 @@ const DataTable = /* @__PURE__ */ __name((_I) => {
57017
57016
  }
57018
57017
  }, [selectedCells]);
57019
57018
  const startCellEdit = useCallback(
57020
- (cellId, initialValue) => {
57021
- change$1("reduxFormInitialValue", initialValue);
57019
+ (cellId, shouldClear) => {
57020
+ if (shouldClear) {
57021
+ change$1("shouldEditableCellInputBeCleared", true);
57022
+ } else {
57023
+ change$1("shouldEditableCellInputBeCleared", false);
57024
+ }
57022
57025
  change$1("reduxFormEditingCell", (prev) => {
57023
57026
  if (prev === cellId) return cellId;
57024
57027
  setSelectedCells((prev2) => {
@@ -58679,12 +58682,30 @@ const DataTable = /* @__PURE__ */ __name((_I) => {
58679
58682
  const rowDisabled = isEntityDisabled(entity);
58680
58683
  const isNum = (_g = e.code) == null ? void 0 : _g.startsWith("Digit");
58681
58684
  const isLetter = (_h = e.code) == null ? void 0 : _h.startsWith("Key");
58682
- if (!isNum && !isLetter) {
58685
+ const allowedSpecialChars = [
58686
+ "Minus",
58687
+ "Equal",
58688
+ "Backquote",
58689
+ "BracketLeft",
58690
+ "BracketRight",
58691
+ "Backslash",
58692
+ "IntlBackslash",
58693
+ "Semicolon",
58694
+ "Quote",
58695
+ "Comma",
58696
+ "Period",
58697
+ "Slash",
58698
+ "IntlRo",
58699
+ "IntlYen",
58700
+ "Space"
58701
+ ];
58702
+ const isSpecialChar = allowedSpecialChars.includes(e.code);
58703
+ if (!isNum && !isLetter && !isSpecialChar) {
58683
58704
  return;
58684
58705
  }
58685
58706
  if (rowDisabled) return;
58686
58707
  e.stopPropagation();
58687
- startCellEdit(primarySelectedCellId, e.key);
58708
+ startCellEdit(primarySelectedCellId, true);
58688
58709
  }, "onKeyDown")
58689
58710
  }),
58690
58711
  isCellEditable && entities.length > 50 && // test for this!!
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teselagen/ui",
3
- "version": "0.7.36",
3
+ "version": "0.8.2",
4
4
  "main": "./src/index.js",
5
5
  "type": "module",
6
6
  "exports": {
@@ -0,0 +1,26 @@
1
+ import React from "react";
2
+ import { render, fireEvent } from "@testing-library/react";
3
+ import AdvancedOptions from "./AdvancedOptions";
4
+
5
+ describe("AdvancedOptions", () => {
6
+ test("renders correctly with given props and default state", () => {
7
+ const { queryByText, container } = render(
8
+ <AdvancedOptions label="Test Label" content="Test Content" />
9
+ );
10
+ expect(queryByText("Test Label")).toBeInTheDocument();
11
+ expect(queryByText("Test Content")).not.toBeInTheDocument();
12
+
13
+ expect(
14
+ container.querySelector(".bp3-icon-caret-right")
15
+ ).toBeInTheDocument();
16
+ });
17
+
18
+ test("toggles content when clicked", () => {
19
+ const { getByText, queryByText, container } = render(
20
+ <AdvancedOptions label="Test Label" content="Test Content" />
21
+ );
22
+ fireEvent.click(getByText("Test Label"));
23
+ expect(queryByText("Test Content")).toBeInTheDocument();
24
+ expect(container.querySelector(".bp3-icon-caret-down")).toBeInTheDocument();
25
+ });
26
+ });
@@ -0,0 +1,12 @@
1
+ /* Copyright (C) 2018 TeselaGen Biotechnology, Inc. */
2
+
3
+ import React from "react";
4
+ import { Spinner } from "@blueprintjs/core";
5
+
6
+ export default function AsyncValidateFieldSpinner({ validating }) {
7
+ if (validating) {
8
+ return <Spinner size="18" />;
9
+ } else {
10
+ return null;
11
+ }
12
+ }
@@ -0,0 +1,14 @@
1
+ import React from "react";
2
+ import { Classes } from "@blueprintjs/core";
3
+ import classNames from "classnames";
4
+
5
+ export default function BlueprintError({ error }) {
6
+ if (!error) return null;
7
+ return (
8
+ <div className={classNames(Classes.FORM_GROUP, Classes.INTENT_DANGER)}>
9
+ <div className={classNames(Classes.FORM_HELPER_TEXT, "preserve-newline")}>
10
+ {error}
11
+ </div>
12
+ </div>
13
+ );
14
+ }
@@ -0,0 +1,16 @@
1
+ /* taken from http://tobiasahlin.com/spinkit/ */
2
+ import React from "react";
3
+ import classNames from "classnames";
4
+ import "./style.css";
5
+
6
+ export function BounceLoader({ style, className }) {
7
+ return (
8
+ <div className={classNames("tg-bounce-loader", className)} style={style}>
9
+ <div className="rect1" />
10
+ <div className="rect2" />
11
+ <div className="rect3" />
12
+ <div className="rect4" />
13
+ <div className="rect5" />
14
+ </div>
15
+ );
16
+ }
@@ -0,0 +1,45 @@
1
+ .tg-bounce-loader {
2
+ width: 50px;
3
+ height: 40px;
4
+ text-align: center;
5
+ font-size: 10px;
6
+ display: flex;
7
+ align-items: center;
8
+ }
9
+
10
+ .tg-bounce-loader > div {
11
+ background-color: #006cab;
12
+ height: 100%;
13
+ max-height: 30px;
14
+ width: 6px;
15
+ display: inline-block;
16
+ margin-right: 3px;
17
+ animation: sk-stretchdelay 1.2s infinite ease-in-out;
18
+ }
19
+
20
+ .tg-bounce-loader .rect2 {
21
+ animation-delay: -1.1s;
22
+ }
23
+
24
+ .tg-bounce-loader .rect3 {
25
+ animation-delay: -1s;
26
+ }
27
+
28
+ .tg-bounce-loader .rect4 {
29
+ animation-delay: -0.9s;
30
+ }
31
+
32
+ .tg-bounce-loader .rect5 {
33
+ animation-delay: -0.8s;
34
+ }
35
+
36
+ @keyframes sk-stretchdelay {
37
+ 0%,
38
+ 40%,
39
+ 100% {
40
+ transform: scaleY(0.4);
41
+ }
42
+ 20% {
43
+ transform: scaleY(1);
44
+ }
45
+ }
@@ -0,0 +1,68 @@
1
+ import React, { useState } from "react";
2
+ import { Button, Classes, Icon } from "@blueprintjs/core";
3
+ import classNames from "classnames";
4
+ import "./style.css";
5
+
6
+ export default function CollapsibleCard({
7
+ title,
8
+ icon,
9
+ openTitleElements,
10
+ noCard = false,
11
+ className,
12
+ style,
13
+ children,
14
+ initialClosed = false,
15
+ toggle,
16
+ isOpen
17
+ }) {
18
+ let [open, setOpen] = useState(!initialClosed);
19
+ if (isOpen !== undefined) open = isOpen;
20
+
21
+ const toggleCardInfo = () => {
22
+ if (toggle) toggle();
23
+ else {
24
+ setOpen(!open);
25
+ }
26
+ };
27
+
28
+ return (
29
+ <div
30
+ className={classNames({ "tg-card": !noCard, open }, className)}
31
+ style={{
32
+ paddingTop: 10,
33
+ paddingBottom: 10,
34
+ paddingLeft: 15,
35
+ paddingRight: 15,
36
+ ...style
37
+ }}
38
+ >
39
+ <div className="tg-card-header" style={{ marginBottom: 8 }}>
40
+ <div className="tg-card-header-title">
41
+ {icon && <Icon icon={icon} />}
42
+ <h6
43
+ style={{
44
+ marginBottom: 0,
45
+ marginRight: 10,
46
+ marginLeft: 10
47
+ }}
48
+ >
49
+ {title}
50
+ </h6>
51
+ <div>{open && openTitleElements}</div>
52
+ </div>
53
+ <div>
54
+ <Button
55
+ icon={open ? "minimize" : "maximize"}
56
+ className={classNames(
57
+ Classes.MINIMAL,
58
+ "info-btn",
59
+ "tg-collapse-toggle"
60
+ )}
61
+ onClick={toggleCardInfo}
62
+ />
63
+ </div>
64
+ </div>
65
+ {open && children}
66
+ </div>
67
+ );
68
+ }
@@ -0,0 +1,23 @@
1
+ /* Use in the place of .bp3-card */
2
+ .tg-card {
3
+ padding: 20px;
4
+ margin-bottom: 20px;
5
+ border-radius: 5px;
6
+ background: white;
7
+ box-shadow:
8
+ 0 1px 3px rgba(0, 0, 0, 0.12),
9
+ 0 1px 2px rgba(0, 0, 0, 0.18);
10
+ }
11
+
12
+ .tg-card-header {
13
+ display: flex;
14
+ flex-direction: row;
15
+ justify-content: space-between;
16
+ align-items: center;
17
+ }
18
+
19
+ .tg-card-header-title {
20
+ display: flex;
21
+ flex-direction: row;
22
+ align-items: center;
23
+ }
@@ -0,0 +1,20 @@
1
+ import React from "react";
2
+ import classNames from "classnames";
3
+ import "./style.css";
4
+
5
+ export default function DNALoader({ style, className }) {
6
+ return (
7
+ <div className={classNames("dna-loader", className)} style={style}>
8
+ <div className="nucleobase" />
9
+ <div className="nucleobase" />
10
+ <div className="nucleobase" />
11
+ <div className="nucleobase" />
12
+ <div className="nucleobase" />
13
+ <div className="nucleobase" />
14
+ <div className="nucleobase" />
15
+ <div className="nucleobase" />
16
+ <div className="nucleobase" />
17
+ <div className="nucleobase" />
18
+ </div>
19
+ );
20
+ }