@macrostrat/data-sheet 3.0.2 → 3.0.3
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/CHANGELOG.md +12 -0
- package/dist/components/actions.js +2 -2
- package/dist/components/actions.js.map +1 -1
- package/dist/components/actions.module.sass.cjs +7 -2
- package/dist/components/actions.module.sass.cjs.map +1 -1
- package/dist/components/actions.module.sass.js +5 -2
- package/dist/components/actions.module.sass.js.map +1 -1
- package/dist/components/colors.js +2 -2
- package/dist/components/colors.js.map +1 -1
- package/dist/components/editor-popup.js +2 -2
- package/dist/components/editor-popup.js.map +1 -1
- package/dist/components/main.module.sass.cjs +6 -1
- package/dist/components/main.module.sass.cjs.map +1 -1
- package/dist/components/main.module.sass.js +4 -1
- package/dist/components/main.module.sass.js.map +1 -1
- package/dist/components/text-areas.js +2 -2
- package/dist/components/text-areas.js.map +1 -1
- package/dist/core.js +2 -2
- package/dist/core.js.map +1 -1
- package/dist/main.module.sass.cjs +6 -1
- package/dist/main.module.sass.cjs.map +1 -1
- package/dist/main.module.sass.js +4 -1
- package/dist/main.module.sass.js.map +1 -1
- package/dist/postgrest-table/index.js +2 -2
- package/dist/postgrest-table/index.js.map +1 -1
- package/dist/postgrest-table/main.module.sass.cjs +6 -1
- package/dist/postgrest-table/main.module.sass.cjs.map +1 -1
- package/dist/postgrest-table/main.module.sass.js +4 -1
- package/dist/postgrest-table/main.module.sass.js.map +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [3.0.3] - 2026-04-04 [_changes_](https://github.com/UW-Macrostrat/web-components/compare/@macrostrat/data-sheet-v3.0.2...@macrostrat/data-sheet-v3.0.3)
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated [BlueprintJS](https://blueprintjs.com) dependencies to latest `6.x.x`
|
|
8
|
+
series
|
|
9
|
+
[fa23ec06](https://github.com/UW-Macrostrat/web-components/commit/fa23ec06a42fefa638f1b95bdb68473f2fc9615b)
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
[fa23ec06](https://github.com/UW-Macrostrat/web-components/commit/fa23ec06a42fefa638f1b95bdb68473f2fc9615b)
|
|
12
|
+
- @macrostrat/data-components@1.1.4
|
|
13
|
+
- @macrostrat/ui-components@5.0.6
|
|
14
|
+
|
|
3
15
|
All notable changes to this project will be documented in this file. The format
|
|
4
16
|
is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this
|
|
5
17
|
project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import hyper from "@macrostrat/hyper";
|
|
2
|
-
import
|
|
3
|
-
const h = hyper.styled(
|
|
2
|
+
import h$1 from "./actions.module.sass.js";
|
|
3
|
+
const h = hyper.styled(h$1);
|
|
4
4
|
function DataSheetActionsRow(props) {
|
|
5
5
|
return h("div.table-actions", props.children);
|
|
6
6
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions.js","sources":["../../src/components/actions.ts"],"sourcesContent":["import hyper from \"@macrostrat/hyper\";\nimport style from \"./actions.module.sass\";\nconst h = hyper.styled(style);\n\nexport function DataSheetActionsRow(props) {\n return h(\"div.table-actions\", props.children);\n}\n\nexport function DataSheetAction(props) {\n return h(\"div.table-action\", props.children);\n}\n"],"names":[],"mappings":";;AAEA,MAAM,IAAI,MAAM,
|
|
1
|
+
{"version":3,"file":"actions.js","sources":["../../src/components/actions.ts"],"sourcesContent":["import hyper from \"@macrostrat/hyper\";\nimport style from \"./actions.module.sass\";\nconst h = hyper.styled(style);\n\nexport function DataSheetActionsRow(props) {\n return h(\"div.table-actions\", props.children);\n}\n\nexport function DataSheetAction(props) {\n return h(\"div.table-action\", props.children);\n}\n"],"names":["style"],"mappings":";;AAEA,MAAM,IAAI,MAAM,OAAOA,GAAK;AAErB,SAAS,oBAAoB,OAAO;AACzC,SAAO,EAAE,qBAAqB,MAAM,QAAQ;AAC9C;AAEO,SAAS,gBAAgB,OAAO;AACrC,SAAO,EAAE,oBAAoB,MAAM,QAAQ;AAC7C;"}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const
|
|
2
|
+
const hyper = require("@macrostrat/hyper");
|
|
3
|
+
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
4
|
+
const hyper__default = /* @__PURE__ */ _interopDefault(hyper);
|
|
5
|
+
const styles = {
|
|
3
6
|
"table-actions": "_table-actions_1xz9a_1",
|
|
4
7
|
"table-action": "_table-action_1xz9a_1"
|
|
5
8
|
};
|
|
6
|
-
|
|
9
|
+
let h = hyper__default.default.styled(styles);
|
|
10
|
+
Object.assign(h, styles);
|
|
11
|
+
module.exports = h;
|
|
7
12
|
//# sourceMappingURL=actions.module.sass.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions.module.sass.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"actions.module.sass.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;"}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import hyper from "@macrostrat/hyper";
|
|
2
|
+
const styles = {
|
|
2
3
|
"table-actions": "_table-actions_1xz9a_1",
|
|
3
4
|
"table-action": "_table-action_1xz9a_1"
|
|
4
5
|
};
|
|
6
|
+
let h = hyper.styled(styles);
|
|
7
|
+
Object.assign(h, styles);
|
|
5
8
|
export {
|
|
6
|
-
|
|
9
|
+
h as default
|
|
7
10
|
};
|
|
8
11
|
//# sourceMappingURL=actions.module.sass.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions.module.sass.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"actions.module.sass.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Cell } from "@blueprintjs/table";
|
|
2
2
|
import { ColorPicker2, useInDarkMode } from "@macrostrat/ui-components";
|
|
3
3
|
import hyper from "@macrostrat/hyper";
|
|
4
|
-
import
|
|
4
|
+
import h$1 from "./main.module.sass.js";
|
|
5
5
|
import { getLuminanceAdjustedColorScheme } from "@macrostrat/color-utils";
|
|
6
6
|
import { memoize } from "underscore";
|
|
7
7
|
import classNames from "classnames";
|
|
8
8
|
const ColorPicker = ColorPicker2;
|
|
9
|
-
const h = hyper.styled(
|
|
9
|
+
const h = hyper.styled(h$1);
|
|
10
10
|
function ColorCell({
|
|
11
11
|
value,
|
|
12
12
|
children,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"colors.js","sources":["../../src/components/colors.ts"],"sourcesContent":["import { Cell } from \"@blueprintjs/table\";\nimport { useInDarkMode } from \"@macrostrat/ui-components\";\nimport hyper from \"@macrostrat/hyper\";\nimport styles from \"./main.module.sass\";\nimport { getLuminanceAdjustedColorScheme } from \"@macrostrat/color-utils\";\nimport { memoize } from \"underscore\";\nimport classNames from \"classnames\";\nimport { ColorPicker2 } from \"@macrostrat/ui-components\";\n\nexport const ColorPicker = ColorPicker2;\n\nconst h = hyper.styled(styles);\n\nexport function ColorCell({\n value,\n children,\n style,\n intent,\n adjustLuminance = true,\n className,\n ...rest\n}) {\n const darkMode = useInDarkMode();\n\n const _className = classNames(className, \"color-cell\");\n\n let mainColor = \"var(--text-color)\";\n let backgroundColor = value;\n\n if (adjustLuminance) {\n // If adjustLuminance is true, get the color scheme based on the value\n let colors = colorCombo(value, darkMode, 0.05);\n if (colors != null) {\n mainColor = colors.mainColor;\n backgroundColor = colors.backgroundColor;\n }\n }\n\n if (intent != null) {\n // If an intent is specified, override the main color\n mainColor = undefined;\n }\n\n return h(\n Cell,\n {\n intent,\n className: _className,\n ...rest,\n style: {\n color: mainColor,\n backgroundColor,\n ...style,\n },\n },\n children,\n );\n}\n\nexport function colorSwatchRenderer(value) {\n return h(\"span.color-swatch-container\", [\n h(\"span.color-swatch\", {\n style: { backgroundColor: value },\n }),\n h(\"span.color-name\", value),\n ]);\n}\n\nconst colorCombo = memoize(getLuminanceAdjustedColorScheme);\n"],"names":[],"mappings":";;;;;;;AASO,MAAM,cAAc;AAE3B,MAAM,IAAI,MAAM,
|
|
1
|
+
{"version":3,"file":"colors.js","sources":["../../src/components/colors.ts"],"sourcesContent":["import { Cell } from \"@blueprintjs/table\";\nimport { useInDarkMode } from \"@macrostrat/ui-components\";\nimport hyper from \"@macrostrat/hyper\";\nimport styles from \"./main.module.sass\";\nimport { getLuminanceAdjustedColorScheme } from \"@macrostrat/color-utils\";\nimport { memoize } from \"underscore\";\nimport classNames from \"classnames\";\nimport { ColorPicker2 } from \"@macrostrat/ui-components\";\n\nexport const ColorPicker = ColorPicker2;\n\nconst h = hyper.styled(styles);\n\nexport function ColorCell({\n value,\n children,\n style,\n intent,\n adjustLuminance = true,\n className,\n ...rest\n}) {\n const darkMode = useInDarkMode();\n\n const _className = classNames(className, \"color-cell\");\n\n let mainColor = \"var(--text-color)\";\n let backgroundColor = value;\n\n if (adjustLuminance) {\n // If adjustLuminance is true, get the color scheme based on the value\n let colors = colorCombo(value, darkMode, 0.05);\n if (colors != null) {\n mainColor = colors.mainColor;\n backgroundColor = colors.backgroundColor;\n }\n }\n\n if (intent != null) {\n // If an intent is specified, override the main color\n mainColor = undefined;\n }\n\n return h(\n Cell,\n {\n intent,\n className: _className,\n ...rest,\n style: {\n color: mainColor,\n backgroundColor,\n ...style,\n },\n },\n children,\n );\n}\n\nexport function colorSwatchRenderer(value) {\n return h(\"span.color-swatch-container\", [\n h(\"span.color-swatch\", {\n style: { backgroundColor: value },\n }),\n h(\"span.color-name\", value),\n ]);\n}\n\nconst colorCombo = memoize(getLuminanceAdjustedColorScheme);\n"],"names":["styles"],"mappings":";;;;;;;AASO,MAAM,cAAc;AAE3B,MAAM,IAAI,MAAM,OAAOA,GAAM;AAEtB,SAAS,UAAU;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,kBAAkB;AAAA,EAClB;AAAA,EACA,GAAG;AACL,GAAG;AACD,QAAM,WAAW,cAAA;AAEjB,QAAM,aAAa,WAAW,WAAW,YAAY;AAErD,MAAI,YAAY;AAChB,MAAI,kBAAkB;AAEtB,MAAI,iBAAiB;AAEnB,QAAI,SAAS,WAAW,OAAO,UAAU,IAAI;AAC7C,QAAI,UAAU,MAAM;AAClB,kBAAY,OAAO;AACnB,wBAAkB,OAAO;AAAA,IAC3B;AAAA,EACF;AAEA,MAAI,UAAU,MAAM;AAElB,gBAAY;AAAA,EACd;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,MACE;AAAA,MACA,WAAW;AAAA,MACX,GAAG;AAAA,MACH,OAAO;AAAA,QACL,OAAO;AAAA,QACP;AAAA,QACA,GAAG;AAAA,MAAA;AAAA,IACL;AAAA,IAEF;AAAA,EAAA;AAEJ;AAEO,SAAS,oBAAoB,OAAO;AACzC,SAAO,EAAE,+BAA+B;AAAA,IACtC,EAAE,qBAAqB;AAAA,MACrB,OAAO,EAAE,iBAAiB,MAAA;AAAA,IAAM,CACjC;AAAA,IACD,EAAE,mBAAmB,KAAK;AAAA,EAAA,CAC3B;AACH;AAEA,MAAM,aAAa,QAAQ,+BAA+B;"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import hyper from "@macrostrat/hyper";
|
|
2
2
|
import { ErrorBoundary } from "@macrostrat/ui-components";
|
|
3
3
|
import { Popover } from "@blueprintjs/core";
|
|
4
|
-
import
|
|
4
|
+
import h$1 from "./main.module.sass.js";
|
|
5
5
|
import { useState, useRef } from "react";
|
|
6
6
|
import { useSelector } from "../provider.js";
|
|
7
|
-
const h = hyper.styled(
|
|
7
|
+
const h = hyper.styled(h$1);
|
|
8
8
|
function EditorPopup(props) {
|
|
9
9
|
const {
|
|
10
10
|
children,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor-popup.js","sources":["../../src/components/editor-popup.ts"],"sourcesContent":["import hyper from \"@macrostrat/hyper\";\nimport { ErrorBoundary } from \"@macrostrat/ui-components\";\nimport { Popover } from \"@blueprintjs/core\";\nimport styles from \"./main.module.sass\";\nimport { useRef, useState } from \"react\";\nimport { useSelector } from \"../provider\";\n\nconst h = hyper.styled(styles);\n\nexport function EditorPopup(props) {\n const {\n children,\n targetClassName,\n autoFocus,\n valueViewer,\n placement = \"right-start\",\n minimal = true,\n } = props;\n\n const [isOpen, setIsOpen] = useState(autoFocus);\n const keyHandler = useSelector((state) => state.keyHandler);\n\n const ref = useRef(null);\n\n const inlineEditor = h([\n h(\"span.editor-value.bp6-table-cell\", valueViewer),\n h(\"input.hidden-editor\", {\n value: \"\",\n autoFocus: true,\n onKeyDown: keyHandler,\n }),\n ]);\n\n return h(\n Popover,\n {\n content: h(\n \"div.interaction-barrier\",\n {\n onMouseDown(evt) {\n evt.nativeEvent.stopImmediatePropagation();\n },\n onKeyDown(evt) {\n if (evt.key === \"Escape\") {\n if (isOpen) {\n setIsOpen(false);\n }\n evt.stopPropagation();\n evt.preventDefault();\n return;\n }\n // Climb over the interaction barrier to propagate the key event to the table\n },\n },\n h(ErrorBoundary, null, children),\n ),\n enforceFocus: false,\n autoFocus: false,\n minimal,\n modifiers: {\n offset: { enabled: true, options: { offset: [0, 8] } },\n },\n placement,\n interactionKind: \"hover-target\",\n isOpen,\n // Portal must be used to avoid issues with the editor being clipped to the bounds of the cell\n usePortal: true,\n },\n h(\n \"span.editor-popup-target.bp6-table-cell\",\n {\n className: targetClassName,\n onClick: () => setIsOpen(!isOpen),\n ref,\n },\n // If the editor is open, show the inline editor, otherwise show the value viewer\n isOpen ? valueViewer : (inlineEditor ?? valueViewer),\n ),\n );\n}\n"],"names":[],"mappings":";;;;;;AAOA,MAAM,IAAI,MAAM,
|
|
1
|
+
{"version":3,"file":"editor-popup.js","sources":["../../src/components/editor-popup.ts"],"sourcesContent":["import hyper from \"@macrostrat/hyper\";\nimport { ErrorBoundary } from \"@macrostrat/ui-components\";\nimport { Popover } from \"@blueprintjs/core\";\nimport styles from \"./main.module.sass\";\nimport { useRef, useState } from \"react\";\nimport { useSelector } from \"../provider\";\n\nconst h = hyper.styled(styles);\n\nexport function EditorPopup(props) {\n const {\n children,\n targetClassName,\n autoFocus,\n valueViewer,\n placement = \"right-start\",\n minimal = true,\n } = props;\n\n const [isOpen, setIsOpen] = useState(autoFocus);\n const keyHandler = useSelector((state) => state.keyHandler);\n\n const ref = useRef(null);\n\n const inlineEditor = h([\n h(\"span.editor-value.bp6-table-cell\", valueViewer),\n h(\"input.hidden-editor\", {\n value: \"\",\n autoFocus: true,\n onKeyDown: keyHandler,\n }),\n ]);\n\n return h(\n Popover,\n {\n content: h(\n \"div.interaction-barrier\",\n {\n onMouseDown(evt) {\n evt.nativeEvent.stopImmediatePropagation();\n },\n onKeyDown(evt) {\n if (evt.key === \"Escape\") {\n if (isOpen) {\n setIsOpen(false);\n }\n evt.stopPropagation();\n evt.preventDefault();\n return;\n }\n // Climb over the interaction barrier to propagate the key event to the table\n },\n },\n h(ErrorBoundary, null, children),\n ),\n enforceFocus: false,\n autoFocus: false,\n minimal,\n modifiers: {\n offset: { enabled: true, options: { offset: [0, 8] } },\n },\n placement,\n interactionKind: \"hover-target\",\n isOpen,\n // Portal must be used to avoid issues with the editor being clipped to the bounds of the cell\n usePortal: true,\n },\n h(\n \"span.editor-popup-target.bp6-table-cell\",\n {\n className: targetClassName,\n onClick: () => setIsOpen(!isOpen),\n ref,\n },\n // If the editor is open, show the inline editor, otherwise show the value viewer\n isOpen ? valueViewer : (inlineEditor ?? valueViewer),\n ),\n );\n}\n"],"names":["styles"],"mappings":";;;;;;AAOA,MAAM,IAAI,MAAM,OAAOA,GAAM;AAEtB,SAAS,YAAY,OAAO;AACjC,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,I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(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
const hyper = require("@macrostrat/hyper");
|
|
4
|
+
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
5
|
+
const hyper__default = /* @__PURE__ */ _interopDefault(hyper);
|
|
3
6
|
const tools = "_tools_utey8_23";
|
|
4
7
|
const styles = {
|
|
5
8
|
"interaction-barrier": "_interaction-barrier_utey8_1",
|
|
@@ -12,6 +15,8 @@ const styles = {
|
|
|
12
15
|
"color-swatch-container": "_color-swatch-container_utey8_49",
|
|
13
16
|
"color-name": "_color-name_utey8_61"
|
|
14
17
|
};
|
|
15
|
-
|
|
18
|
+
let h = hyper__default.default.styled(styles);
|
|
19
|
+
Object.assign(h, styles);
|
|
20
|
+
exports.default = h;
|
|
16
21
|
exports.tools = tools;
|
|
17
22
|
//# sourceMappingURL=main.module.sass.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.module.sass.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"main.module.sass.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import hyper from "@macrostrat/hyper";
|
|
1
2
|
const tools = "_tools_utey8_23";
|
|
2
3
|
const styles = {
|
|
3
4
|
"interaction-barrier": "_interaction-barrier_utey8_1",
|
|
@@ -10,8 +11,10 @@ const styles = {
|
|
|
10
11
|
"color-swatch-container": "_color-swatch-container_utey8_49",
|
|
11
12
|
"color-name": "_color-name_utey8_61"
|
|
12
13
|
};
|
|
14
|
+
let h = hyper.styled(styles);
|
|
15
|
+
Object.assign(h, styles);
|
|
13
16
|
export {
|
|
14
|
-
|
|
17
|
+
h as default,
|
|
15
18
|
tools
|
|
16
19
|
};
|
|
17
20
|
//# sourceMappingURL=main.module.sass.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.module.sass.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"main.module.sass.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import hyper from "@macrostrat/hyper";
|
|
2
|
-
import
|
|
2
|
+
import h$1 from "./main.module.sass.js";
|
|
3
3
|
import { Button } from "@blueprintjs/core";
|
|
4
4
|
import { useRef, useEffect } from "react";
|
|
5
5
|
import { multiLineTextKeyHandler } from "../utils/key-handling.js";
|
|
6
|
-
const h = hyper.styled(
|
|
6
|
+
const h = hyper.styled(h$1);
|
|
7
7
|
function EditableTextArea({ value, onChange }) {
|
|
8
8
|
const ref = useRef(null);
|
|
9
9
|
useEffect(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-areas.js","sources":["../../src/components/text-areas.ts"],"sourcesContent":["import hyper from \"@macrostrat/hyper\";\nimport styles from \"./main.module.sass\";\nimport { Button } from \"@blueprintjs/core\";\nimport { useEffect, useRef } from \"react\";\nimport { multiLineTextKeyHandler } from \"../utils\";\n\nconst h = hyper.styled(styles);\n\nexport function EditableTextArea({ value, onChange }) {\n const ref = useRef(null);\n\n useEffect(() => {\n if (ref.current == null) return;\n ref.current.focus();\n // Get the current value\n const val = ref.current.value;\n // Move the cursor to the end of the text\n ref.current.setSelectionRange(val.length, val.length);\n }, []);\n\n return h(\"div.editable-text-area\", [\n h(\"textarea.bp6-input\", {\n ref,\n value: value ?? \"\",\n onChange: (evt) => onChange(evt.target.value),\n onKeyDown: multiLineTextKeyHandler,\n }),\n h(\"div.tools\", [\n h(Button, {\n icon: \"key-enter\",\n minimal: true,\n small: true,\n onClick() {\n // Get cursor position\n let _value = value ?? \"\";\n\n const cursorPos = ref.current.selectionStart ?? _value.length;\n // Insert a newline at the cursor position\n onChange(_value.slice(0, cursorPos) + \"\\n\" + _value.slice(cursorPos));\n // Re-focus the textarea\n ref.current.focus();\n // Move the cursor to the end of the line\n ref.current.setSelectionRange(cursorPos + 1, cursorPos + 1);\n },\n }),\n ]),\n ]);\n}\n"],"names":[],"mappings":";;;;;AAMA,MAAM,IAAI,MAAM,
|
|
1
|
+
{"version":3,"file":"text-areas.js","sources":["../../src/components/text-areas.ts"],"sourcesContent":["import hyper from \"@macrostrat/hyper\";\nimport styles from \"./main.module.sass\";\nimport { Button } from \"@blueprintjs/core\";\nimport { useEffect, useRef } from \"react\";\nimport { multiLineTextKeyHandler } from \"../utils\";\n\nconst h = hyper.styled(styles);\n\nexport function EditableTextArea({ value, onChange }) {\n const ref = useRef(null);\n\n useEffect(() => {\n if (ref.current == null) return;\n ref.current.focus();\n // Get the current value\n const val = ref.current.value;\n // Move the cursor to the end of the text\n ref.current.setSelectionRange(val.length, val.length);\n }, []);\n\n return h(\"div.editable-text-area\", [\n h(\"textarea.bp6-input\", {\n ref,\n value: value ?? \"\",\n onChange: (evt) => onChange(evt.target.value),\n onKeyDown: multiLineTextKeyHandler,\n }),\n h(\"div.tools\", [\n h(Button, {\n icon: \"key-enter\",\n minimal: true,\n small: true,\n onClick() {\n // Get cursor position\n let _value = value ?? \"\";\n\n const cursorPos = ref.current.selectionStart ?? _value.length;\n // Insert a newline at the cursor position\n onChange(_value.slice(0, cursorPos) + \"\\n\" + _value.slice(cursorPos));\n // Re-focus the textarea\n ref.current.focus();\n // Move the cursor to the end of the line\n ref.current.setSelectionRange(cursorPos + 1, cursorPos + 1);\n },\n }),\n ]),\n ]);\n}\n"],"names":["styles"],"mappings":";;;;;AAMA,MAAM,IAAI,MAAM,OAAOA,GAAM;AAEtB,SAAS,iBAAiB,EAAE,OAAO,YAAY;AACpD,QAAM,MAAM,OAAO,IAAI;AAEvB,YAAU,MAAM;AACd,QAAI,IAAI,WAAW,KAAM;AACzB,QAAI,QAAQ,MAAA;AAEZ,UAAM,MAAM,IAAI,QAAQ;AAExB,QAAI,QAAQ,kBAAkB,IAAI,QAAQ,IAAI,MAAM;AAAA,EACtD,GAAG,CAAA,CAAE;AAEL,SAAO,EAAE,0BAA0B;AAAA,IACjC,EAAE,sBAAsB;AAAA,MACtB;AAAA,MACA,OAAO,SAAS;AAAA,MAChB,UAAU,CAAC,QAAQ,SAAS,IAAI,OAAO,KAAK;AAAA,MAC5C,WAAW;AAAA,IAAA,CACZ;AAAA,IACD,EAAE,aAAa;AAAA,MACb,EAAE,QAAQ;AAAA,QACR,MAAM;AAAA,QACN,SAAS;AAAA,QACT,OAAO;AAAA,QACP,UAAU;AAER,cAAI,SAAS,SAAS;AAEtB,gBAAM,YAAY,IAAI,QAAQ,kBAAkB,OAAO;AAEvD,mBAAS,OAAO,MAAM,GAAG,SAAS,IAAI,OAAO,OAAO,MAAM,SAAS,CAAC;AAEpE,cAAI,QAAQ,MAAA;AAEZ,cAAI,QAAQ,kBAAkB,YAAY,GAAG,YAAY,CAAC;AAAA,QAC5D;AAAA,MAAA,CACD;AAAA,IAAA,CACF;AAAA,EAAA,CACF;AACH;"}
|
package/dist/core.js
CHANGED
|
@@ -5,11 +5,11 @@ import { Cell as Cell2 } from "@blueprintjs/table";
|
|
|
5
5
|
import hyper from "@macrostrat/hyper";
|
|
6
6
|
import update from "immutability-helper";
|
|
7
7
|
import { useState, useMemo, useCallback, useEffect } from "react";
|
|
8
|
-
import
|
|
8
|
+
import h$1 from "./main.module.sass.js";
|
|
9
9
|
import { DataSheetProvider, useSelector, useStoreAPI, singleFocusedCell } from "./provider.js";
|
|
10
10
|
import { DataSheetAction } from "./components/actions.js";
|
|
11
11
|
import { EditorPopup } from "./components/editor-popup.js";
|
|
12
|
-
const h = hyper.styled(
|
|
12
|
+
const h = hyper.styled(h$1);
|
|
13
13
|
var DataSheetDensity = /* @__PURE__ */ ((DataSheetDensity2) => {
|
|
14
14
|
DataSheetDensity2["HIGH"] = "high";
|
|
15
15
|
DataSheetDensity2["MEDIUM"] = "medium";
|
package/dist/core.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.js","sources":["../src/core.ts"],"sourcesContent":["import {\n Button,\n ButtonGroup,\n HotkeysProvider,\n InputGroup,\n Intent,\n} from \"@blueprintjs/core\";\nimport { Cell, Column, Region, RowHeaderCell, Table } from \"@blueprintjs/table\";\nimport \"@blueprintjs/table/lib/css/table.css\";\nimport hyper from \"@macrostrat/hyper\";\nimport update from \"immutability-helper\";\nimport { ReactNode, useCallback, useEffect, useMemo, useState } from \"react\";\nimport { EditorPopup, DataSheetAction } from \"./components\";\nimport styles from \"./main.module.sass\";\nimport {\n DataSheetProvider,\n DataSheetProviderProps,\n DataSheetStore,\n singleFocusedCell,\n useSelector,\n useStoreAPI,\n VisibleCells,\n} from \"./provider\";\nimport { ColumnSpec } from \"./utils\";\n\nconst h = hyper.styled(styles);\n\n// More on component templates: https://storybook.js.org/docs/react/writing-stories/introduction#using-args\n\n// TODO: add a \"copy to selection\" tool (the little square in the bottom right corner of a cell)\n// This should copy the value of a cell (or a set of cells in the same row) downwards.\n\nexport enum DataSheetDensity {\n HIGH = \"high\",\n MEDIUM = \"medium\",\n LOW = \"low\",\n}\n\ninterface DataSheetInternalProps<T> {\n onVisibleCellsChange?: (visibleCells: VisibleCells) => void;\n onSaveData?: (updatedData: any[], data: T[]) => void;\n onUpdateData?: (updatedData: any[], data: T[]) => void;\n onDeleteRows?: (selection: Region[]) => void;\n verbose?: boolean;\n enableColumnReordering?: boolean;\n enableFocusedCell?: boolean;\n dataSheetActions?: ReactNode | null;\n editable?: boolean;\n autoFocusEditor?: boolean;\n density?: DataSheetDensity;\n}\n\ntype DataSheetProps<T> = DataSheetProviderProps<T> & DataSheetInternalProps<T>;\n\nexport function DataSheet<T>(props: DataSheetProps<T>) {\n const {\n data,\n columnSpec,\n columnSpecOptions,\n editable = true,\n enableColumnReordering = false,\n enableFocusedCell = false,\n defaultColumnWidth = 150,\n ...rest\n } = props;\n\n return h(\n HotkeysProvider,\n h(\n DataSheetProvider<T>,\n {\n data,\n columnSpec,\n columnSpecOptions: columnSpecOptions,\n enableColumnReordering,\n defaultColumnWidth,\n editable,\n ...rest,\n },\n h(_DataSheet, {\n ...rest,\n editable,\n enableColumnReordering,\n enableFocusedCell,\n }),\n ),\n );\n}\n\nfunction _DataSheet<T>({\n onVisibleCellsChange,\n enableColumnReordering,\n onSaveData,\n onUpdateData,\n onDeleteRows,\n verbose = false,\n dataSheetActions = null,\n enableFocusedCell,\n autoFocusEditor = true,\n density = DataSheetDensity.HIGH,\n}: DataSheetInternalProps<T>) {\n /**\n * @param data: The data to be displayed in the table\n * @param columnSpec: The specification for all columns in the table. If not provided, the column spec will be generated from the data.\n * @param columnSpecOptions: Options for generating a column spec from data\n */\n\n // For now, we only consider a single cell \"focused\" when we have one cell selected.\n // Multi-cell selections have a different set of \"bulk\" actions.\n const selectedRegions = useSelector<T>((state) => state.selection);\n\n const data = useSelector((state) => state.data);\n const editable = useSelector((state) => state.editable);\n\n const deletedRows = useSelector((state) => state.deletedRows);\n\n const focusedCell = useSelector((state) => state.focusedCell);\n\n const ref = useSelector((state) => state.tableRef);\n\n const columnSpec = useSelector((state) => state.columnSpec);\n\n // A sparse array to hold updates\n // TODO: create a \"changeset\" concept to facilitate undo/redo\n const updatedData = useSelector((state) => state.updatedData);\n const setUpdatedData = useSelector((state) => state.setUpdatedData);\n\n const onSelection = useSelector((state) => state.onSelection);\n\n const storeAPI = useStoreAPI<T>();\n\n const _onSaveData = useMemo(() => {\n if (onSaveData == null) return null;\n return () => {\n onSaveData(updatedData, data);\n setUpdatedData([]);\n };\n }, [updatedData, data, onSaveData]);\n\n const setVisibleCells = useSelector((state) => state.setVisibleCells);\n\n const _onVisibleCellsChange = useCallback(\n (visibleCells: VisibleCells) => {\n setVisibleCells(visibleCells);\n onVisibleCellsChange?.(visibleCells);\n },\n [onVisibleCellsChange, setVisibleCells],\n );\n\n const onAddRow = useCallback(() => {\n setUpdatedData((updatedData: any[]): any[] => {\n const ix = Math.max(updatedData.length, data.length);\n const addRowSpec = { [ix]: { $set: {} } };\n const newUpdatedData = update(updatedData, addRowSpec);\n return newUpdatedData;\n });\n }, [setUpdatedData]);\n\n const deleteSelectedRows = useSelector((state) => state.deleteSelectedRows);\n const _onDeleteRows = useCallback(() => {\n deleteSelectedRows();\n onDeleteRows?.(selectedRegions);\n }, [onDeleteRows, selectedRegions, deleteSelectedRows]);\n\n useEffect(() => {\n if (!verbose) return;\n console.log(\"Updated data\", updatedData);\n }, [updatedData]);\n\n useEffect(() => {\n onUpdateData?.(updatedData, data);\n }, [onUpdateData, data, updatedData]);\n\n useEffect(() => {\n if (!verbose) return;\n console.log(\"Selected regions\", selectedRegions);\n }, [selectedRegions]);\n\n const nDeletionCandidates = useMemo(\n () => getRowsToDelete(selectedRegions).length,\n [selectedRegions],\n );\n\n const columnWidths = useSelector((state) => state.columnWidths);\n\n const numRows = Math.max(updatedData.length, data.length);\n\n let className = `${density}-density`;\n\n let rowHeight = 20;\n let defaultColumnWidth = 150;\n let style = {\n \"--data-sheet-row-height\": \"20px\",\n \"--data-sheet-font-size\": \"12px\",\n };\n if (density === DataSheetDensity.MEDIUM) {\n rowHeight = 24;\n style = {\n \"--data-sheet-row-height\": \"24px\",\n \"--data-sheet-font-size\": \"14px\",\n };\n } else if (density === DataSheetDensity.LOW) {\n rowHeight = 30;\n style = {\n \"--data-sheet-row-height\": \"30px\",\n \"--data-sheet-font-size\": \"18px\",\n };\n }\n\n const children = useMemo(\n () =>\n columnSpec.map((col, colIndex) => {\n return h(Column, {\n name: col.name,\n cellRenderer: (rowIndex) => {\n const state = storeAPI.getState();\n return basicCellRenderer<T>(\n rowIndex,\n colIndex,\n col,\n state,\n autoFocusEditor,\n );\n },\n });\n }),\n [columnSpec, storeAPI, autoFocusEditor],\n );\n\n const onColumnWidthChanged = useSelector(\n (state) => state.onColumnWidthChanged,\n );\n\n const rowHeaderCellRenderer = useCallback(\n (rowIndex: number) => {\n let style = null;\n if (deletedRows.has(rowIndex)) {\n style = {\n opacity: 0.5,\n textDecoration: \"line-through\",\n };\n }\n return h(RowHeaderCell, {\n index: rowIndex,\n name: `${rowIndex + 1}`,\n style,\n });\n },\n [deletedRows],\n );\n\n const onKeyDown = useSelector((state) => state.tableKeyHandler);\n\n if (data == null) return null;\n\n return h(\"div.data-sheet-container\", { className, style }, [\n h.if(editable)(DataSheetEditToolbar, {\n onSaveData: _onSaveData,\n onDeleteRows: nDeletionCandidates > 0 ? _onDeleteRows : null,\n }),\n dataSheetActions,\n h(\n \"div.data-sheet-holder\",\n { onKeyDown },\n h(\n // @ts-expect-error\n Table,\n {\n ref,\n numRows,\n className: \"data-sheet\",\n enableFocusedCell,\n enableColumnReordering,\n //onColumnsReordered,\n focusedCell,\n selectedRegions,\n defaultRowHeight: rowHeight,\n minRowHeight: rowHeight,\n columnWidths,\n onColumnWidthChanged,\n onSelection,\n // The cell renderer is memoized internally based on these data dependencies\n cellRendererDependencies: [\n data,\n //selection,\n updatedData,\n focusedCell,\n deletedRows,\n ],\n onVisibleCellsChange: _onVisibleCellsChange,\n rowHeaderCellRenderer,\n },\n children,\n ),\n ),\n ]);\n}\n\nfunction basicCellRenderer<T>(\n rowIndex: number,\n colIndex: number,\n columnSpec: ColumnSpec,\n state: DataSheetStore<T>,\n autoFocusEditor = true,\n): any {\n const data = state.data;\n const updatedData = state.updatedData;\n\n const isDeleted = state.deletedRows.has(rowIndex);\n\n const row = data[rowIndex] ?? updatedData[rowIndex];\n const loading = row == null;\n const col = columnSpec;\n\n const focusedCell = state.focusedCell;\n const _topLeftCell = state.topLeftCell;\n const onCellEdited = state.onCellEdited;\n const clearSelection = state.clearSelection;\n\n const value = updatedData[rowIndex]?.[col.key] ?? data[rowIndex]?.[col.key];\n const _renderedValue = col.valueRenderer?.(value) ?? value;\n\n let style = col.style ?? {};\n if (isDeleted) {\n style = {\n ...style,\n opacity: 0.5,\n textDecoration: \"line-through\",\n };\n }\n\n const focused =\n focusedCell?.col === colIndex && focusedCell?.row === rowIndex;\n\n const editable = (col.editable ?? state.editable) && !isDeleted;\n\n // Top left cell of a ranged selection\n const topLeft =\n _topLeftCell?.col === colIndex && _topLeftCell?.row === rowIndex;\n\n if (!editable && state.editable) {\n // If the cell is not editable but the sheet is editable, we want to differentiate\n // between editable and non-editable cells.\n style.color = \"var(--secondary-color)\";\n }\n\n const edited = updatedData[rowIndex]?.[col.key] != null;\n let intent = edited ? \"success\" : undefined;\n if (isDeleted) {\n intent = \"danger\";\n }\n\n const _Cell = col.cellComponent ?? BaseCell;\n\n let inlineEditor = editable ? (col.inlineEditor ?? true) : false;\n\n if (!topLeft) {\n // This should be the case for every cell except the focused one\n return h(\n _Cell,\n {\n intent,\n loading,\n value,\n style,\n isDeleted,\n },\n _renderedValue,\n );\n }\n\n // The rest is for the top-left cell of a selection or the focused cell\n\n // Hidden input to capture key events\n let hiddenInput = h(\"input.hidden-input\", {\n autoFocus: true,\n onKeyDown: state.editorKeyHandler,\n });\n\n let cellContents: ReactNode = _renderedValue;\n\n let _dataEditor = null;\n let className = null;\n\n if (col.dataEditor != null) {\n _dataEditor = h(\n EditorPopup,\n {\n autoFocus: autoFocusEditor,\n valueViewer: _renderedValue,\n },\n [\n h(col.dataEditor, {\n value,\n editable,\n onChange(value) {\n if (!editable) return;\n state.onSelectionEdited(value);\n },\n }),\n ],\n );\n }\n\n if (!editable) {\n // Most cells are not focused and don't need to be editable.\n // This will be the rendering logic for almost all cells\n\n if (_dataEditor != null) {\n cellContents = _dataEditor;\n }\n\n return h(\n _Cell,\n {\n intent,\n value,\n style,\n },\n cellContents,\n );\n // Could probably put the hidden input elsewhere,\n }\n\n /* The remaining logic covers cells that are focused and editable */\n\n const onChange = (e) => {\n if (!editable) return;\n if (value === e.target.value) return;\n onCellEdited(rowIndex, col.key, e.target.value);\n };\n\n const isSingleCellSelection = singleFocusedCell(state.selection) != null;\n\n let _inlineEditor: ReactNode = null;\n if (typeof inlineEditor == \"boolean\") {\n let _value = value;\n if (\n typeof _renderedValue === \"string\" ||\n typeof _renderedValue === \"number\" ||\n _renderedValue == null\n ) {\n _value = _renderedValue;\n }\n _inlineEditor = h(\"input.main-editor\", {\n value: _value ?? \"\",\n autoFocus: autoFocusEditor,\n onChange,\n onKeyDown: state.editorKeyHandler,\n });\n } else {\n // If inlineEditor is a ReactNode, we use it directly\n _inlineEditor = inlineEditor as ReactNode;\n }\n\n if (_dataEditor != null) {\n className = \"editor-cell\";\n cellContents = _dataEditor;\n hiddenInput = null;\n } else if (_inlineEditor != null) {\n cellContents = _inlineEditor;\n className = \"input-cell\";\n hiddenInput = null;\n }\n\n // Hidden html input\n return h(\n _Cell,\n {\n intent,\n value,\n className,\n style,\n //truncated: false,\n },\n [\n cellContents,\n h.if(editable && isSingleCellSelection)(DragHandle, {\n focusedCell,\n }),\n hiddenInput,\n ],\n );\n}\n\nfunction DragHandle({ focusedCell }) {\n // TODO: we might want to drag multiple columns in some cases\n // This should be on the last cell of a selection\n const onDragValue = useSelector((state) => state.onDragValue);\n\n return h(\"div.corner-drag-handle\", {\n onMouseDown(e) {\n onDragValue(focusedCell);\n e.preventDefault();\n },\n });\n}\n\nfunction DataSheetEditToolbar({ onSaveData, onDeleteRows }) {\n const selection = useSelector((state) => state.selection);\n const resetChanges = useSelector((state) => state.resetChanges);\n const hasUpdates = useSelector((state) => state.hasUpdates);\n\n return h(\"div.data-sheet-toolbar\", [\n h(ButtonGroup, { minimal: true }, [\n h(AddRowButton),\n h(\n Button,\n {\n intent: Intent.DANGER,\n disabled: onDeleteRows == null,\n onClick() {\n onDeleteRows?.();\n },\n },\n \"Delete\",\n ),\n ]),\n h(\"div.spacer\"),\n h(ButtonGroup, [\n h(\n Button,\n {\n intent: Intent.WARNING,\n disabled: !hasUpdates,\n onClick: resetChanges,\n },\n \"Reset\",\n ),\n h.if(onSaveData != null)(\n Button,\n {\n intent: Intent.SUCCESS,\n icon: \"floppy-disk\",\n disabled: !hasUpdates,\n onClick: onSaveData,\n },\n \"Save\",\n ),\n ]),\n ]);\n}\n\nexport function ScrollToRowControl() {\n const [value, setValue] = useState(\"\");\n const scrollToRow = useSelector((state) => state.scrollToRow);\n\n return h(DataSheetAction, [\n h(InputGroup, {\n type: \"number\",\n placeholder: \"Row number\",\n value,\n onValueChange(value) {\n setValue(value);\n },\n }),\n h(\n Button,\n {\n icon: \"arrow-right\",\n onClick() {\n const row = parseInt(value);\n scrollToRow(row - 1);\n },\n },\n \"Scroll to row\",\n ),\n ]);\n}\n\nfunction AddRowButton() {\n const addRow = useSelector((state) => state.addRow);\n return h(\n Button,\n {\n icon: \"plus\",\n onClick: addRow,\n },\n \"Add row\",\n );\n}\n\nexport function BaseCell({ children, value, ...rest }) {\n return h(\n Cell,\n {\n interactive: true,\n ...rest,\n },\n children,\n );\n}\n\nexport { Cell };\n\nexport function getRowsToDelete(selection) {\n let rowIndices: number[] = [];\n for (const sel of selection) {\n // This isn't a full-row selection\n if (sel.cols != null) continue;\n if (sel.rows == null) continue;\n const [startIndex, endIndex] = sel.rows;\n for (let i = startIndex; i <= endIndex; i++) {\n rowIndices.push(i);\n }\n }\n return rowIndices;\n}\n"],"names":["DataSheetDensity","updatedData","style","value"],"mappings":";;;;;;;;;;;AAyBA,MAAM,IAAI,MAAM,OAAO,MAAM;AAOtB,IAAK,qCAAAA,sBAAL;AACLA,oBAAA,MAAA,IAAO;AACPA,oBAAA,QAAA,IAAS;AACTA,oBAAA,KAAA,IAAM;AAHI,SAAAA;AAAA,GAAA,oBAAA,CAAA,CAAA;AAsBL,SAAS,UAAa,OAA0B;AACrD,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA,WAAW;AAAA,IACX,yBAAyB;AAAA,IACzB,oBAAoB;AAAA,IACpB,qBAAqB;AAAA,IACrB,GAAG;AAAA,EAAA,IACD;AAEJ,SAAO;AAAA,IACL;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,QACE;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,GAAG;AAAA,MAAA;AAAA,MAEL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A;AAC3B,aAAW,OAAO,WAAW;AAE3B,QAAI,IAAI,QAAQ,KAAM;AACtB,QAAI,IAAI,QAAQ,KAAM;AACtB,UAAM,CAAC,YAAY,QAAQ,IAAI,IAAI;AACnC,aAAS,IAAI,YAAY,KAAK,UAAU,KAAK;AAC3C,iBAAW,KAAK,CAAC;AAAA,IACnB;AAAA,EACF;AACA,SAAO;AACT;"}
|
|
1
|
+
{"version":3,"file":"core.js","sources":["../src/core.ts"],"sourcesContent":["import {\n Button,\n ButtonGroup,\n HotkeysProvider,\n InputGroup,\n Intent,\n} from \"@blueprintjs/core\";\nimport { Cell, Column, Region, RowHeaderCell, Table } from \"@blueprintjs/table\";\nimport \"@blueprintjs/table/lib/css/table.css\";\nimport hyper from \"@macrostrat/hyper\";\nimport update from \"immutability-helper\";\nimport { ReactNode, useCallback, useEffect, useMemo, useState } from \"react\";\nimport { EditorPopup, DataSheetAction } from \"./components\";\nimport styles from \"./main.module.sass\";\nimport {\n DataSheetProvider,\n DataSheetProviderProps,\n DataSheetStore,\n singleFocusedCell,\n useSelector,\n useStoreAPI,\n VisibleCells,\n} from \"./provider\";\nimport { ColumnSpec } from \"./utils\";\n\nconst h = hyper.styled(styles);\n\n// More on component templates: https://storybook.js.org/docs/react/writing-stories/introduction#using-args\n\n// TODO: add a \"copy to selection\" tool (the little square in the bottom right corner of a cell)\n// This should copy the value of a cell (or a set of cells in the same row) downwards.\n\nexport enum DataSheetDensity {\n HIGH = \"high\",\n MEDIUM = \"medium\",\n LOW = \"low\",\n}\n\ninterface DataSheetInternalProps<T> {\n onVisibleCellsChange?: (visibleCells: VisibleCells) => void;\n onSaveData?: (updatedData: any[], data: T[]) => void;\n onUpdateData?: (updatedData: any[], data: T[]) => void;\n onDeleteRows?: (selection: Region[]) => void;\n verbose?: boolean;\n enableColumnReordering?: boolean;\n enableFocusedCell?: boolean;\n dataSheetActions?: ReactNode | null;\n editable?: boolean;\n autoFocusEditor?: boolean;\n density?: DataSheetDensity;\n}\n\ntype DataSheetProps<T> = DataSheetProviderProps<T> & DataSheetInternalProps<T>;\n\nexport function DataSheet<T>(props: DataSheetProps<T>) {\n const {\n data,\n columnSpec,\n columnSpecOptions,\n editable = true,\n enableColumnReordering = false,\n enableFocusedCell = false,\n defaultColumnWidth = 150,\n ...rest\n } = props;\n\n return h(\n HotkeysProvider,\n h(\n DataSheetProvider<T>,\n {\n data,\n columnSpec,\n columnSpecOptions: columnSpecOptions,\n enableColumnReordering,\n defaultColumnWidth,\n editable,\n ...rest,\n },\n h(_DataSheet, {\n ...rest,\n editable,\n enableColumnReordering,\n enableFocusedCell,\n }),\n ),\n );\n}\n\nfunction _DataSheet<T>({\n onVisibleCellsChange,\n enableColumnReordering,\n onSaveData,\n onUpdateData,\n onDeleteRows,\n verbose = false,\n dataSheetActions = null,\n enableFocusedCell,\n autoFocusEditor = true,\n density = DataSheetDensity.HIGH,\n}: DataSheetInternalProps<T>) {\n /**\n * @param data: The data to be displayed in the table\n * @param columnSpec: The specification for all columns in the table. If not provided, the column spec will be generated from the data.\n * @param columnSpecOptions: Options for generating a column spec from data\n */\n\n // For now, we only consider a single cell \"focused\" when we have one cell selected.\n // Multi-cell selections have a different set of \"bulk\" actions.\n const selectedRegions = useSelector<T>((state) => state.selection);\n\n const data = useSelector((state) => state.data);\n const editable = useSelector((state) => state.editable);\n\n const deletedRows = useSelector((state) => state.deletedRows);\n\n const focusedCell = useSelector((state) => state.focusedCell);\n\n const ref = useSelector((state) => state.tableRef);\n\n const columnSpec = useSelector((state) => state.columnSpec);\n\n // A sparse array to hold updates\n // TODO: create a \"changeset\" concept to facilitate undo/redo\n const updatedData = useSelector((state) => state.updatedData);\n const setUpdatedData = useSelector((state) => state.setUpdatedData);\n\n const onSelection = useSelector((state) => state.onSelection);\n\n const storeAPI = useStoreAPI<T>();\n\n const _onSaveData = useMemo(() => {\n if (onSaveData == null) return null;\n return () => {\n onSaveData(updatedData, data);\n setUpdatedData([]);\n };\n }, [updatedData, data, onSaveData]);\n\n const setVisibleCells = useSelector((state) => state.setVisibleCells);\n\n const _onVisibleCellsChange = useCallback(\n (visibleCells: VisibleCells) => {\n setVisibleCells(visibleCells);\n onVisibleCellsChange?.(visibleCells);\n },\n [onVisibleCellsChange, setVisibleCells],\n );\n\n const onAddRow = useCallback(() => {\n setUpdatedData((updatedData: any[]): any[] => {\n const ix = Math.max(updatedData.length, data.length);\n const addRowSpec = { [ix]: { $set: {} } };\n const newUpdatedData = update(updatedData, addRowSpec);\n return newUpdatedData;\n });\n }, [setUpdatedData]);\n\n const deleteSelectedRows = useSelector((state) => state.deleteSelectedRows);\n const _onDeleteRows = useCallback(() => {\n deleteSelectedRows();\n onDeleteRows?.(selectedRegions);\n }, [onDeleteRows, selectedRegions, deleteSelectedRows]);\n\n useEffect(() => {\n if (!verbose) return;\n console.log(\"Updated data\", updatedData);\n }, [updatedData]);\n\n useEffect(() => {\n onUpdateData?.(updatedData, data);\n }, [onUpdateData, data, updatedData]);\n\n useEffect(() => {\n if (!verbose) return;\n console.log(\"Selected regions\", selectedRegions);\n }, [selectedRegions]);\n\n const nDeletionCandidates = useMemo(\n () => getRowsToDelete(selectedRegions).length,\n [selectedRegions],\n );\n\n const columnWidths = useSelector((state) => state.columnWidths);\n\n const numRows = Math.max(updatedData.length, data.length);\n\n let className = `${density}-density`;\n\n let rowHeight = 20;\n let defaultColumnWidth = 150;\n let style = {\n \"--data-sheet-row-height\": \"20px\",\n \"--data-sheet-font-size\": \"12px\",\n };\n if (density === DataSheetDensity.MEDIUM) {\n rowHeight = 24;\n style = {\n \"--data-sheet-row-height\": \"24px\",\n \"--data-sheet-font-size\": \"14px\",\n };\n } else if (density === DataSheetDensity.LOW) {\n rowHeight = 30;\n style = {\n \"--data-sheet-row-height\": \"30px\",\n \"--data-sheet-font-size\": \"18px\",\n };\n }\n\n const children = useMemo(\n () =>\n columnSpec.map((col, colIndex) => {\n return h(Column, {\n name: col.name,\n cellRenderer: (rowIndex) => {\n const state = storeAPI.getState();\n return basicCellRenderer<T>(\n rowIndex,\n colIndex,\n col,\n state,\n autoFocusEditor,\n );\n },\n });\n }),\n [columnSpec, storeAPI, autoFocusEditor],\n );\n\n const onColumnWidthChanged = useSelector(\n (state) => state.onColumnWidthChanged,\n );\n\n const rowHeaderCellRenderer = useCallback(\n (rowIndex: number) => {\n let style = null;\n if (deletedRows.has(rowIndex)) {\n style = {\n opacity: 0.5,\n textDecoration: \"line-through\",\n };\n }\n return h(RowHeaderCell, {\n index: rowIndex,\n name: `${rowIndex + 1}`,\n style,\n });\n },\n [deletedRows],\n );\n\n const onKeyDown = useSelector((state) => state.tableKeyHandler);\n\n if (data == null) return null;\n\n return h(\"div.data-sheet-container\", { className, style }, [\n h.if(editable)(DataSheetEditToolbar, {\n onSaveData: _onSaveData,\n onDeleteRows: nDeletionCandidates > 0 ? _onDeleteRows : null,\n }),\n dataSheetActions,\n h(\n \"div.data-sheet-holder\",\n { onKeyDown },\n h(\n // @ts-expect-error\n Table,\n {\n ref,\n numRows,\n className: \"data-sheet\",\n enableFocusedCell,\n enableColumnReordering,\n //onColumnsReordered,\n focusedCell,\n selectedRegions,\n defaultRowHeight: rowHeight,\n minRowHeight: rowHeight,\n columnWidths,\n onColumnWidthChanged,\n onSelection,\n // The cell renderer is memoized internally based on these data dependencies\n cellRendererDependencies: [\n data,\n //selection,\n updatedData,\n focusedCell,\n deletedRows,\n ],\n onVisibleCellsChange: _onVisibleCellsChange,\n rowHeaderCellRenderer,\n },\n children,\n ),\n ),\n ]);\n}\n\nfunction basicCellRenderer<T>(\n rowIndex: number,\n colIndex: number,\n columnSpec: ColumnSpec,\n state: DataSheetStore<T>,\n autoFocusEditor = true,\n): any {\n const data = state.data;\n const updatedData = state.updatedData;\n\n const isDeleted = state.deletedRows.has(rowIndex);\n\n const row = data[rowIndex] ?? updatedData[rowIndex];\n const loading = row == null;\n const col = columnSpec;\n\n const focusedCell = state.focusedCell;\n const _topLeftCell = state.topLeftCell;\n const onCellEdited = state.onCellEdited;\n const clearSelection = state.clearSelection;\n\n const value = updatedData[rowIndex]?.[col.key] ?? data[rowIndex]?.[col.key];\n const _renderedValue = col.valueRenderer?.(value) ?? value;\n\n let style = col.style ?? {};\n if (isDeleted) {\n style = {\n ...style,\n opacity: 0.5,\n textDecoration: \"line-through\",\n };\n }\n\n const focused =\n focusedCell?.col === colIndex && focusedCell?.row === rowIndex;\n\n const editable = (col.editable ?? state.editable) && !isDeleted;\n\n // Top left cell of a ranged selection\n const topLeft =\n _topLeftCell?.col === colIndex && _topLeftCell?.row === rowIndex;\n\n if (!editable && state.editable) {\n // If the cell is not editable but the sheet is editable, we want to differentiate\n // between editable and non-editable cells.\n style.color = \"var(--secondary-color)\";\n }\n\n const edited = updatedData[rowIndex]?.[col.key] != null;\n let intent = edited ? \"success\" : undefined;\n if (isDeleted) {\n intent = \"danger\";\n }\n\n const _Cell = col.cellComponent ?? BaseCell;\n\n let inlineEditor = editable ? (col.inlineEditor ?? true) : false;\n\n if (!topLeft) {\n // This should be the case for every cell except the focused one\n return h(\n _Cell,\n {\n intent,\n loading,\n value,\n style,\n isDeleted,\n },\n _renderedValue,\n );\n }\n\n // The rest is for the top-left cell of a selection or the focused cell\n\n // Hidden input to capture key events\n let hiddenInput = h(\"input.hidden-input\", {\n autoFocus: true,\n onKeyDown: state.editorKeyHandler,\n });\n\n let cellContents: ReactNode = _renderedValue;\n\n let _dataEditor = null;\n let className = null;\n\n if (col.dataEditor != null) {\n _dataEditor = h(\n EditorPopup,\n {\n autoFocus: autoFocusEditor,\n valueViewer: _renderedValue,\n },\n [\n h(col.dataEditor, {\n value,\n editable,\n onChange(value) {\n if (!editable) return;\n state.onSelectionEdited(value);\n },\n }),\n ],\n );\n }\n\n if (!editable) {\n // Most cells are not focused and don't need to be editable.\n // This will be the rendering logic for almost all cells\n\n if (_dataEditor != null) {\n cellContents = _dataEditor;\n }\n\n return h(\n _Cell,\n {\n intent,\n value,\n style,\n },\n cellContents,\n );\n // Could probably put the hidden input elsewhere,\n }\n\n /* The remaining logic covers cells that are focused and editable */\n\n const onChange = (e) => {\n if (!editable) return;\n if (value === e.target.value) return;\n onCellEdited(rowIndex, col.key, e.target.value);\n };\n\n const isSingleCellSelection = singleFocusedCell(state.selection) != null;\n\n let _inlineEditor: ReactNode = null;\n if (typeof inlineEditor == \"boolean\") {\n let _value = value;\n if (\n typeof _renderedValue === \"string\" ||\n typeof _renderedValue === \"number\" ||\n _renderedValue == null\n ) {\n _value = _renderedValue;\n }\n _inlineEditor = h(\"input.main-editor\", {\n value: _value ?? \"\",\n autoFocus: autoFocusEditor,\n onChange,\n onKeyDown: state.editorKeyHandler,\n });\n } else {\n // If inlineEditor is a ReactNode, we use it directly\n _inlineEditor = inlineEditor as ReactNode;\n }\n\n if (_dataEditor != null) {\n className = \"editor-cell\";\n cellContents = _dataEditor;\n hiddenInput = null;\n } else if (_inlineEditor != null) {\n cellContents = _inlineEditor;\n className = \"input-cell\";\n hiddenInput = null;\n }\n\n // Hidden html input\n return h(\n _Cell,\n {\n intent,\n value,\n className,\n style,\n //truncated: false,\n },\n [\n cellContents,\n h.if(editable && isSingleCellSelection)(DragHandle, {\n focusedCell,\n }),\n hiddenInput,\n ],\n );\n}\n\nfunction DragHandle({ focusedCell }) {\n // TODO: we might want to drag multiple columns in some cases\n // This should be on the last cell of a selection\n const onDragValue = useSelector((state) => state.onDragValue);\n\n return h(\"div.corner-drag-handle\", {\n onMouseDown(e) {\n onDragValue(focusedCell);\n e.preventDefault();\n },\n });\n}\n\nfunction DataSheetEditToolbar({ onSaveData, onDeleteRows }) {\n const selection = useSelector((state) => state.selection);\n const resetChanges = useSelector((state) => state.resetChanges);\n const hasUpdates = useSelector((state) => state.hasUpdates);\n\n return h(\"div.data-sheet-toolbar\", [\n h(ButtonGroup, { minimal: true }, [\n h(AddRowButton),\n h(\n Button,\n {\n intent: Intent.DANGER,\n disabled: onDeleteRows == null,\n onClick() {\n onDeleteRows?.();\n },\n },\n \"Delete\",\n ),\n ]),\n h(\"div.spacer\"),\n h(ButtonGroup, [\n h(\n Button,\n {\n intent: Intent.WARNING,\n disabled: !hasUpdates,\n onClick: resetChanges,\n },\n \"Reset\",\n ),\n h.if(onSaveData != null)(\n Button,\n {\n intent: Intent.SUCCESS,\n icon: \"floppy-disk\",\n disabled: !hasUpdates,\n onClick: onSaveData,\n },\n \"Save\",\n ),\n ]),\n ]);\n}\n\nexport function ScrollToRowControl() {\n const [value, setValue] = useState(\"\");\n const scrollToRow = useSelector((state) => state.scrollToRow);\n\n return h(DataSheetAction, [\n h(InputGroup, {\n type: \"number\",\n placeholder: \"Row number\",\n value,\n onValueChange(value) {\n setValue(value);\n },\n }),\n h(\n Button,\n {\n icon: \"arrow-right\",\n onClick() {\n const row = parseInt(value);\n scrollToRow(row - 1);\n },\n },\n \"Scroll to row\",\n ),\n ]);\n}\n\nfunction AddRowButton() {\n const addRow = useSelector((state) => state.addRow);\n return h(\n Button,\n {\n icon: \"plus\",\n onClick: addRow,\n },\n \"Add row\",\n );\n}\n\nexport function BaseCell({ children, value, ...rest }) {\n return h(\n Cell,\n {\n interactive: true,\n ...rest,\n },\n children,\n );\n}\n\nexport { Cell };\n\nexport function getRowsToDelete(selection) {\n let rowIndices: number[] = [];\n for (const sel of selection) {\n // This isn't a full-row selection\n if (sel.cols != null) continue;\n if (sel.rows == null) continue;\n const [startIndex, endIndex] = sel.rows;\n for (let i = startIndex; i <= endIndex; i++) {\n rowIndices.push(i);\n }\n }\n return rowIndices;\n}\n"],"names":["styles","DataSheetDensity","updatedData","style","value"],"mappings":";;;;;;;;;;;AAyBA,MAAM,IAAI,MAAM,OAAOA,GAAM;AAOtB,IAAK,qCAAAC,sBAAL;AACLA,oBAAA,MAAA,IAAO;AACPA,oBAAA,QAAA,IAAS;AACTA,oBAAA,KAAA,IAAM;AAHI,SAAAA;AAAA,GAAA,oBAAA,CAAA,CAAA;AAsBL,SAAS,UAAa,OAA0B;AACrD,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA,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ACN,SAAS;AAAA,IAAA;AAAA,IAEX;AAAA,EAAA;AAEJ;AAEO,SAAS,SAAS,EAAE,UAAU,OAAO,GAAG,QAAQ;AACrD,SAAO;AAAA,IACL;AAAA,IACA;AAAA,MACE,aAAa;AAAA,MACb,GAAG;AAAA,IAAA;AAAA,IAEL;AAAA,EAAA;AAEJ;AAIO,SAAS,gBAAgB,WAAW;AACzC,MAAI,aAAuB,CAAA;AAC3B,aAAW,OAAO,WAAW;AAE3B,QAAI,IAAI,QAAQ,KAAM;AACtB,QAAI,IAAI,QAAQ,KAAM;AACtB,UAAM,CAAC,YAAY,QAAQ,IAAI,IAAI;AACnC,aAAS,IAAI,YAAY,KAAK,UAAU,KAAK;AAC3C,iBAAW,KAAK,CAAC;AAAA,IACnB;AAAA,EACF;AACA,SAAO;AACT;"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
const hyper = require("@macrostrat/hyper");
|
|
4
|
+
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
5
|
+
const hyper__default = /* @__PURE__ */ _interopDefault(hyper);
|
|
3
6
|
const spacer = "_spacer_tr5j5_94";
|
|
4
7
|
const styles = {
|
|
5
8
|
"data-sheet-container": "_data-sheet-container_tr5j5_1",
|
|
@@ -14,6 +17,8 @@ const styles = {
|
|
|
14
17
|
spacer,
|
|
15
18
|
"table-control": "_table-control_tr5j5_98"
|
|
16
19
|
};
|
|
17
|
-
|
|
20
|
+
let h = hyper__default.default.styled(styles);
|
|
21
|
+
Object.assign(h, styles);
|
|
22
|
+
exports.default = h;
|
|
18
23
|
exports.spacer = spacer;
|
|
19
24
|
//# sourceMappingURL=main.module.sass.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.module.sass.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"main.module.sass.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/main.module.sass.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import hyper from "@macrostrat/hyper";
|
|
1
2
|
const spacer = "_spacer_tr5j5_94";
|
|
2
3
|
const styles = {
|
|
3
4
|
"data-sheet-container": "_data-sheet-container_tr5j5_1",
|
|
@@ -12,8 +13,10 @@ const styles = {
|
|
|
12
13
|
spacer,
|
|
13
14
|
"table-control": "_table-control_tr5j5_98"
|
|
14
15
|
};
|
|
16
|
+
let h = hyper.styled(styles);
|
|
17
|
+
Object.assign(h, styles);
|
|
15
18
|
export {
|
|
16
|
-
|
|
19
|
+
h as default,
|
|
17
20
|
spacer
|
|
18
21
|
};
|
|
19
22
|
//# sourceMappingURL=main.module.sass.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.module.sass.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"main.module.sass.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { HotkeysProvider, InputGroup, Spinner } from "@blueprintjs/core";
|
|
2
2
|
import hyper from "@macrostrat/hyper";
|
|
3
|
-
import
|
|
3
|
+
import h$1 from "./main.module.sass.js";
|
|
4
4
|
import { DataSheet, getRowsToDelete } from "../core.js";
|
|
5
5
|
import { LithologyTag, Tag, TagSize } from "@macrostrat/data-components";
|
|
6
6
|
import { usePostgRESTLazyLoader } from "./data-loaders.js";
|
|
7
7
|
import { useState, useCallback } from "react";
|
|
8
8
|
import { ErrorBoundary, ToasterContext, useToaster, useAPIResult } from "@macrostrat/ui-components";
|
|
9
9
|
import { ColorCell } from "../components/colors.js";
|
|
10
|
-
const h = hyper.styled(
|
|
10
|
+
const h = hyper.styled(h$1);
|
|
11
11
|
function PostgRESTTableView(props) {
|
|
12
12
|
return h(
|
|
13
13
|
ErrorBoundary,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/postgrest-table/index.ts"],"sourcesContent":["import { HotkeysProvider, OverlayToaster } from \"@blueprintjs/core\";\nimport hyper from \"@macrostrat/hyper\";\nimport styles from \"./main.module.sass\";\nimport { DataSheet, getRowsToDelete } from \"../core\"; //getRowsToDelete\nimport { LithologyTag, Tag, TagSize } from \"@macrostrat/data-components\";\nimport { PostgrestOrder, usePostgRESTLazyLoader } from \"./data-loaders\";\nimport { Spinner, InputGroup } from \"@blueprintjs/core\";\n\nexport * from \"./data-loaders\";\nimport { useCallback, useState, useRef } from \"react\";\nimport {\n ErrorBoundary,\n ToasterContext,\n useAPIResult,\n useToaster,\n} from \"@macrostrat/ui-components\";\nimport { Spec } from \"immutability-helper\";\nimport { DataSheetProviderProps } from \"../provider\";\nimport { PostgrestFilterBuilder } from \"@supabase/postgrest-js\";\nimport type {\n GenericFunction,\n GenericTable,\n GenericView,\n} from \"@supabase/postgrest-js/dist/cjs/index\";\nimport { ColorCell } from \"../components\";\n\nconst h = hyper.styled(styles);\n\nexport type GenericSchema = {\n Tables: Record<string, GenericTable>;\n Views: Record<string, GenericView>;\n Functions: Record<string, GenericFunction>;\n};\n\ninterface PostgRESTTableViewProps<\n T extends object,\n> extends DataSheetProviderProps<T> {\n endpoint: string;\n table: string;\n columnOptions?: any;\n order?: PostgrestOrder<T>;\n columns?: string;\n editable?: boolean;\n identityKey?: string;\n enableFullTableSearch?: boolean;\n dataSheetActions?: any;\n filter(\n query: PostgrestFilterBuilder<T, any, any>,\n ): PostgrestFilterBuilder<T, any, any>;\n}\n\nexport function PostgRESTTableView<T>(props: PostgRESTTableViewProps<T>) {\n return h(\n ErrorBoundary,\n h(HotkeysProvider, h(ToasterContext, h(_PostgRESTTableView, props))),\n );\n}\n\nconst successResponses = [200, 201];\n\nfunction _PostgRESTTableView<T>({\n endpoint,\n table,\n columnOptions,\n order,\n columns,\n editable = false,\n filter = undefined,\n enableFullTableSearch = false,\n dataSheetActions,\n identityKey = \"id\",\n ...rest\n}: PostgRESTTableViewProps<T>) {\n const [input, setInput] = useState(\"\");\n\n if (enableFullTableSearch) {\n const columnList = columns ?? getColumnList(endpoint, table);\n\n filter = (query) => {\n const urlParams = new URLSearchParams(query.url.search);\n urlParams.delete(\"or\");\n query.url.search = urlParams.toString() ? `?${urlParams.toString()}` : \"\";\n\n if (input.length > 2 && enableFullTableSearch) {\n const conditions = columnList?.map((col) => `${col}.ilike.*${input}*`);\n\n return query.or(conditions.join(\",\"));\n }\n\n return query;\n };\n }\n\n const { data, onScroll, dispatch, client } = usePostgRESTLazyLoader(\n endpoint,\n table,\n {\n order: order ?? { key: identityKey, ascending: true },\n columns,\n filter,\n },\n );\n\n const toaster = useToaster();\n\n const finishResponse = useCallback(\n (promisedResult, changes) => {\n wrapWithErrorHandling(toaster, promisedResult).then((res) => {\n if (res == null) {\n throw new Error(\"Could not complete action\");\n } else {\n // Merge new data with old data\n console.log(\"Updating data\", changes);\n dispatch({ type: \"update-data\", changes });\n }\n });\n },\n [dispatch, toaster],\n );\n\n if (data == null) {\n return h(Spinner);\n }\n\n return h(\"div.data-sheet-outer\", [\n h(DataSheet, {\n ...rest,\n dataSheetActions: enableFullTableSearch\n ? h(SearchAction, { input, setInput, dispatch })\n : dataSheetActions,\n data,\n columnSpecOptions: columnOptions ?? {},\n editable,\n onVisibleCellsChange: onScroll,\n onDeleteRows(selection) {\n if (!editable) return;\n\n const rowIndices = getRowsToDelete(selection);\n\n const ids = rowIndices.map((i) => data[i][identityKey]);\n\n dispatch({ type: \"start-loading\" });\n\n let query = client.delete().in(identityKey, ids);\n\n query = filter?.(query) ?? query;\n\n finishResponse(query, { $delete: Array.from(rowIndices.keys()) });\n },\n onSaveData(updates, data) {\n if (!editable) return;\n\n // Augment updates with primary key\n\n let changes: Spec<any[]> = {};\n let updateRows: any[] = [];\n for (let [key, update] of Object.entries(updates)) {\n const value = { ...data[key], ...update };\n updateRows.push(value);\n changes[key] = { $set: value };\n }\n\n dispatch({ type: \"start-loading\" });\n\n // Save data\n let query = client.upsert(updateRows, { defaultToNull: false });\n\n query = filter?.(query) ?? query;\n\n finishResponse(query, changes);\n },\n }),\n ]);\n}\n\nexport function notifyOnError(toaster: OverlayToaster, error: any) {\n console.error(error);\n const { message, status, code, details } = error;\n\n let errorDetails = null;\n\n if (details != null) {\n if (typeof details === \"string\") {\n errorDetails = h(\"p.error-details\", details);\n } else {\n errorDetails = h(\"div.error-details\", [\n h(\"h4\", \"Error details\"),\n h(\"pre\", JSON.stringify(details, null, 2)),\n ]);\n }\n }\n\n toaster.show({\n message: h([\n h.if(status != null)([h(\"code.bp6-code\", status), \" \"]),\n h.if(code != null)([h(\"code.bp6-code\", code), \" \"]),\n message ?? \"An error occurred\",\n errorDetails,\n ]),\n intent: \"danger\",\n });\n}\n\ninterface PromiseResult {\n error?: Error;\n}\n\nexport async function wrapWithErrorHandling<T extends PromiseResult>(\n toaster: OverlayToaster,\n fnPromise: Promise<T>,\n): Promise<T | null> {\n try {\n const p = await fnPromise;\n if (p.error != null) {\n // Rethrow error\n throw p.error;\n }\n return p;\n } catch (err) {\n notifyOnError(toaster, err);\n return null;\n }\n}\n\nexport function LongTextViewer({ value, onChange }) {\n return h(\"div.long-text\", value);\n}\n\nexport function IntervalCell({ value, children, ...rest }) {\n return h(ColorCell, { value: value?.color, ...rest }, value?.name);\n}\n\nexport function lithologyRenderer(value) {\n return h(\n \"span.tag-cell-content.liths\",\n value?.map((d) => h(LithologyTag, { data: d, key: d.id })),\n );\n}\n\nexport function ExpandedLithologies({ value, onChange }) {\n if (value == null) return h(\"div.basis-panel\", \"No lithologies\");\n return h(\"div.basis-panel\", [\n h(\"table\", [\n h(\"thead\", h(\"tr\", [h(\"th\", \"Lithology\"), h(\"th\", \"Source\")])),\n h(\n \"tbody\",\n value.map((d) => {\n return h(\"tr\", { key: d.id }, [\n h(\"td\", h(LithologyTag, { data: d })),\n h(\n \"td.basis-col\",\n d.basis_col?.map((d) => {\n return h(Tag, {\n size: TagSize.Small,\n key: d,\n name: h([h(\"span.tag-header\", \"Column\"), \" \", h(\"code\", d)]),\n });\n }),\n ),\n ]);\n }),\n ),\n ]),\n ]);\n}\n\nexport function SearchAction({ input, setInput, dispatch }) {\n return h(InputGroup, {\n type: \"search\",\n placeholder: \"Search table...\",\n value: input,\n onChange(event) {\n const search = event.target.value;\n if (search.length > 2 || (input.length === 3 && search.length < 3)) {\n dispatch({ type: \"reset\" });\n }\n setInput(search.toLowerCase());\n },\n });\n}\n\nfunction getColumnList(endpoint: string, table: string) {\n const url = `${endpoint}/${table}?select=*&limit=1`;\n const res = useAPIResult(url);\n\n if (!res || !Array.isArray(res) || res.length === 0) return [];\n\n const sampleRow = res[0];\n\n return Object.entries(sampleRow)\n .filter(([_, value]) => {\n return typeof value === \"string\";\n })\n .map(([key]) => key);\n}\n"],"names":["data","d"],"mappings":";;;;;;;;;AA0BA,MAAM,IAAI,MAAM,OAAO,MAAM;AAyBtB,SAAS,mBAAsB,OAAmC;AACvE,SAAO;AAAA,IACL;AAAA,IACA,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,qBAAqB,KAAK,CAAC,CAAC;AAAA,EAAA;AAEvE;AAIA,SAAS,oBAAuB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX,SAAS;AAAA,EACT,wBAAwB;AAAA,EACxB;AAAA,EACA,cAAc;AAAA,EACd,GAAG;AACL,GAA+B;AAC7B,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAS,EAAE;AAErC,MAAI,uBAAuB;AACzB,UAAM,aAAa,WAAW,cAAc,UAAU,KAAK;AAE3D,aAAS,CAAC,UAAU;AAClB,YAAM,YAAY,IAAI,gBAAgB,MAAM,IAAI,MAAM;AACtD,gBAAU,OAAO,IAAI;AACrB,YAAM,IAAI,SAAS,UAAU,SAAA,IA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OAAM;AACtB,uBAAO,EAAE,KAAK;AAAA,kBACZ,MAAM,QAAQ;AAAA,kBACd,KAAKA;AAAAA,kBACL,MAAM,EAAE,CAAC,EAAE,mBAAmB,QAAQ,GAAG,KAAK,EAAE,QAAQA,EAAC,CAAC,CAAC;AAAA,gBAAA,CAC5D;AAAA,cACH,CAAC;AAAA,YAAA;AAAA,UACH,CACD;AAAA,QACH,CAAC;AAAA,MAAA;AAAA,IACH,CACD;AAAA,EAAA,CACF;AACH;AAEO,SAAS,aAAa,EAAE,OAAO,UAAU,YAAY;AAC1D,SAAO,EAAE,YAAY;AAAA,IACnB,MAAM;AAAA,IACN,aAAa;AAAA,IACb,OAAO;AAAA,IACP,SAAS,OAAO;AACd,YAAM,SAAS,MAAM,OAAO;AAC5B,UAAI,OAAO,SAAS,KAAM,MAAM,WAAW,KAAK,OAAO,SAAS,GAAI;AAClE,iBAAS,EAAE,MAAM,SAAS;AAAA,MAC5B;AACA,eAAS,OAAO,aAAa;AAAA,IAC/B;AAAA,EAAA,CACD;AACH;AAEA,SAAS,cAAc,UAAkB,OAAe;AACtD,QAAM,MAAM,GAAG,QAAQ,IAAI,KAAK;AAChC,QAAM,MAAM,aAAa,GAAG;AAE5B,MAAI,CAAC,OAAO,CAAC,MAAM,QAAQ,GAAG,KAAK,IAAI,WAAW,EAAG,QAAO,CAAA;AAE5D,QAAM,YAAY,IAAI,CAAC;AAEvB,SAAO,OAAO,QAAQ,SAAS,EAC5B,OAAO,CAAC,CAAC,GAAG,KAAK,MAAM;AACtB,WAAO,OAAO,UAAU;AAAA,EAC1B,CAAC,EACA,IAAI,CAAC,CAAC,GAAG,MAAM,GAAG;AACvB;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/postgrest-table/index.ts"],"sourcesContent":["import { HotkeysProvider, OverlayToaster } from \"@blueprintjs/core\";\nimport hyper from \"@macrostrat/hyper\";\nimport styles from \"./main.module.sass\";\nimport { DataSheet, getRowsToDelete } from \"../core\"; //getRowsToDelete\nimport { LithologyTag, Tag, TagSize } from \"@macrostrat/data-components\";\nimport { PostgrestOrder, usePostgRESTLazyLoader } from \"./data-loaders\";\nimport { Spinner, InputGroup } from \"@blueprintjs/core\";\n\nexport * from \"./data-loaders\";\nimport { useCallback, useState, useRef } from \"react\";\nimport {\n ErrorBoundary,\n ToasterContext,\n useAPIResult,\n useToaster,\n} from \"@macrostrat/ui-components\";\nimport { Spec } from \"immutability-helper\";\nimport { DataSheetProviderProps } from \"../provider\";\nimport { PostgrestFilterBuilder } from \"@supabase/postgrest-js\";\nimport type {\n GenericFunction,\n GenericTable,\n GenericView,\n} from \"@supabase/postgrest-js/dist/cjs/index\";\nimport { ColorCell } from \"../components\";\n\nconst h = hyper.styled(styles);\n\nexport type GenericSchema = {\n Tables: Record<string, GenericTable>;\n Views: Record<string, GenericView>;\n Functions: Record<string, GenericFunction>;\n};\n\ninterface PostgRESTTableViewProps<\n T extends object,\n> extends DataSheetProviderProps<T> {\n endpoint: string;\n table: string;\n columnOptions?: any;\n order?: PostgrestOrder<T>;\n columns?: string;\n editable?: boolean;\n identityKey?: string;\n enableFullTableSearch?: boolean;\n dataSheetActions?: any;\n filter(\n query: PostgrestFilterBuilder<T, any, any>,\n ): PostgrestFilterBuilder<T, any, any>;\n}\n\nexport function PostgRESTTableView<T>(props: PostgRESTTableViewProps<T>) {\n return h(\n ErrorBoundary,\n h(HotkeysProvider, h(ToasterContext, h(_PostgRESTTableView, props))),\n );\n}\n\nconst successResponses = [200, 201];\n\nfunction _PostgRESTTableView<T>({\n endpoint,\n table,\n columnOptions,\n order,\n columns,\n editable = false,\n filter = undefined,\n enableFullTableSearch = false,\n dataSheetActions,\n identityKey = \"id\",\n ...rest\n}: PostgRESTTableViewProps<T>) {\n const [input, setInput] = useState(\"\");\n\n if (enableFullTableSearch) {\n const columnList = columns ?? getColumnList(endpoint, table);\n\n filter = (query) => {\n const urlParams = new URLSearchParams(query.url.search);\n urlParams.delete(\"or\");\n query.url.search = urlParams.toString() ? `?${urlParams.toString()}` : \"\";\n\n if (input.length > 2 && enableFullTableSearch) {\n const conditions = columnList?.map((col) => `${col}.ilike.*${input}*`);\n\n return query.or(conditions.join(\",\"));\n }\n\n return query;\n };\n }\n\n const { data, onScroll, dispatch, client } = usePostgRESTLazyLoader(\n endpoint,\n table,\n {\n order: order ?? { key: identityKey, ascending: true },\n columns,\n filter,\n },\n );\n\n const toaster = useToaster();\n\n const finishResponse = useCallback(\n (promisedResult, changes) => {\n wrapWithErrorHandling(toaster, promisedResult).then((res) => {\n if (res == null) {\n throw new Error(\"Could not complete action\");\n } else {\n // Merge new data with old data\n console.log(\"Updating data\", changes);\n dispatch({ type: \"update-data\", changes });\n }\n });\n },\n [dispatch, toaster],\n );\n\n if (data == null) {\n return h(Spinner);\n }\n\n return h(\"div.data-sheet-outer\", [\n h(DataSheet, {\n ...rest,\n dataSheetActions: enableFullTableSearch\n ? h(SearchAction, { input, setInput, dispatch })\n : dataSheetActions,\n data,\n columnSpecOptions: columnOptions ?? {},\n editable,\n onVisibleCellsChange: onScroll,\n onDeleteRows(selection) {\n if (!editable) return;\n\n const rowIndices = getRowsToDelete(selection);\n\n const ids = rowIndices.map((i) => data[i][identityKey]);\n\n dispatch({ type: \"start-loading\" });\n\n let query = client.delete().in(identityKey, ids);\n\n query = filter?.(query) ?? query;\n\n finishResponse(query, { $delete: Array.from(rowIndices.keys()) });\n },\n onSaveData(updates, data) {\n if (!editable) return;\n\n // Augment updates with primary key\n\n let changes: Spec<any[]> = {};\n let updateRows: any[] = [];\n for (let [key, update] of Object.entries(updates)) {\n const value = { ...data[key], ...update };\n updateRows.push(value);\n changes[key] = { $set: value };\n }\n\n dispatch({ type: \"start-loading\" });\n\n // Save data\n let query = client.upsert(updateRows, { defaultToNull: false });\n\n query = filter?.(query) ?? query;\n\n finishResponse(query, changes);\n },\n }),\n ]);\n}\n\nexport function notifyOnError(toaster: OverlayToaster, error: any) {\n console.error(error);\n const { message, status, code, details } = error;\n\n let errorDetails = null;\n\n if (details != null) {\n if (typeof details === \"string\") {\n errorDetails = h(\"p.error-details\", details);\n } else {\n errorDetails = h(\"div.error-details\", [\n h(\"h4\", \"Error details\"),\n h(\"pre\", JSON.stringify(details, null, 2)),\n ]);\n }\n }\n\n toaster.show({\n message: h([\n h.if(status != null)([h(\"code.bp6-code\", status), \" \"]),\n h.if(code != null)([h(\"code.bp6-code\", code), \" \"]),\n message ?? \"An error occurred\",\n errorDetails,\n ]),\n intent: \"danger\",\n });\n}\n\ninterface PromiseResult {\n error?: Error;\n}\n\nexport async function wrapWithErrorHandling<T extends PromiseResult>(\n toaster: OverlayToaster,\n fnPromise: Promise<T>,\n): Promise<T | null> {\n try {\n const p = await fnPromise;\n if (p.error != null) {\n // Rethrow error\n throw p.error;\n }\n return p;\n } catch (err) {\n notifyOnError(toaster, err);\n return null;\n }\n}\n\nexport function LongTextViewer({ value, onChange }) {\n return h(\"div.long-text\", value);\n}\n\nexport function IntervalCell({ value, children, ...rest }) {\n return h(ColorCell, { value: value?.color, ...rest }, value?.name);\n}\n\nexport function lithologyRenderer(value) {\n return h(\n \"span.tag-cell-content.liths\",\n value?.map((d) => h(LithologyTag, { data: d, key: d.id })),\n );\n}\n\nexport function ExpandedLithologies({ value, onChange }) {\n if (value == null) return h(\"div.basis-panel\", \"No lithologies\");\n return h(\"div.basis-panel\", [\n h(\"table\", [\n h(\"thead\", h(\"tr\", [h(\"th\", \"Lithology\"), h(\"th\", \"Source\")])),\n h(\n \"tbody\",\n value.map((d) => {\n return h(\"tr\", { key: d.id }, [\n h(\"td\", h(LithologyTag, { data: d })),\n h(\n \"td.basis-col\",\n d.basis_col?.map((d) => {\n return h(Tag, {\n size: TagSize.Small,\n key: d,\n name: h([h(\"span.tag-header\", \"Column\"), \" \", h(\"code\", d)]),\n });\n }),\n ),\n ]);\n }),\n ),\n ]),\n ]);\n}\n\nexport function SearchAction({ input, setInput, dispatch }) {\n return h(InputGroup, {\n type: \"search\",\n placeholder: \"Search table...\",\n value: input,\n onChange(event) {\n const search = event.target.value;\n if (search.length > 2 || (input.length === 3 && search.length < 3)) {\n dispatch({ type: \"reset\" });\n }\n setInput(search.toLowerCase());\n },\n });\n}\n\nfunction getColumnList(endpoint: string, table: string) {\n const url = `${endpoint}/${table}?select=*&limit=1`;\n const res = useAPIResult(url);\n\n if (!res || !Array.isArray(res) || res.length === 0) return [];\n\n const sampleRow = res[0];\n\n return Object.entries(sampleRow)\n .filter(([_, value]) => {\n return typeof value === \"string\";\n })\n .map(([key]) => key);\n}\n"],"names":["styles","data","d"],"mappings":";;;;;;;;;AA0BA,MAAM,IAAI,MAAM,OAAOA,GAAM;AAyBtB,SAAS,mBAAsB,OAAmC;AACvE,SAAO;AAAA,IACL;AAAA,IACA,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,qBAAqB,KAAK,CAAC,CAAC;AAAA,EAAA;AAEvE;AAIA,SAAS,oBAAuB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX,SAAS;AAAA,EACT,wBAAwB;AAAA,EACxB;AAAA,EACA,cAAc;AAAA,EACd,GAAG;AACL,GAA+B;AAC7B,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAS,EAAE;AAErC,MAAI,uBAAuB;AACzB,UAAM,aAAa,WAAW,cAAc,UAAU,KAAK;AAE3D,aAAS,CAAC,UAAU;AAClB,YAAM,YAAY,IAAI,gBAAgB,MAAM,IAAI,MAAM;AACtD,gBAAU,OAAO,IAAI;AACrB,YAAM,IAAI,SAAS,UAAU,SAAA,IAAa,IAAI,UAAU,SAAA,CAAU,KAAK;AAEvE,UAAI,MAAM,SAAS,KAAK,uBAAuB;AAC7C,cAAM,aAAa,YAAY,IAAI,CAAC,QAAQ,GAAG,GAAG,WAAW,KAAK,GAAG;AAErE,eAAO,MAAM,GAAG,WAAW,KAAK,GAAG,CAAC;AAAA,MACtC;AAEA,aAAO;AAAA,IACT;AAAA,EACF;AAEA,QA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AAC;AAAA,MAAA;AAAA,IACH,CACD;AAAA,EAAA,CACF;AACH;AAEO,SAAS,aAAa,EAAE,OAAO,UAAU,YAAY;AAC1D,SAAO,EAAE,YAAY;AAAA,IACnB,MAAM;AAAA,IACN,aAAa;AAAA,IACb,OAAO;AAAA,IACP,SAAS,OAAO;AACd,YAAM,SAAS,MAAM,OAAO;AAC5B,UAAI,OAAO,SAAS,KAAM,MAAM,WAAW,KAAK,OAAO,SAAS,GAAI;AAClE,iBAAS,EAAE,MAAM,SAAS;AAAA,MAC5B;AACA,eAAS,OAAO,aAAa;AAAA,IAC/B;AAAA,EAAA,CACD;AACH;AAEA,SAAS,cAAc,UAAkB,OAAe;AACtD,QAAM,MAAM,GAAG,QAAQ,IAAI,KAAK;AAChC,QAAM,MAAM,aAAa,GAAG;AAE5B,MAAI,CAAC,OAAO,CAAC,MAAM,QAAQ,GAAG,KAAK,IAAI,WAAW,EAAG,QAAO,CAAA;AAE5D,QAAM,YAAY,IAAI,CAAC;AAEvB,SAAO,OAAO,QAAQ,SAAS,EAC5B,OAAO,CAAC,CAAC,GAAG,KAAK,MAAM;AACtB,WAAO,OAAO,UAAU;AAAA,EAC1B,CAAC,EACA,IAAI,CAAC,CAAC,GAAG,MAAM,GAAG;AACvB;"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
const hyper = require("@macrostrat/hyper");
|
|
4
|
+
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
5
|
+
const hyper__default = /* @__PURE__ */ _interopDefault(hyper);
|
|
3
6
|
const lithology = "_lithology_12ust_1";
|
|
4
7
|
const description = "_description_12ust_34";
|
|
5
8
|
const liths = "_liths_12ust_49";
|
|
@@ -15,7 +18,9 @@ const styles = {
|
|
|
15
18
|
"data-sheet-outer": "_data-sheet-outer_12ust_53",
|
|
16
19
|
"tag-cell-content": "_tag-cell-content_12ust_60"
|
|
17
20
|
};
|
|
18
|
-
|
|
21
|
+
let h = hyper__default.default.styled(styles);
|
|
22
|
+
Object.assign(h, styles);
|
|
23
|
+
exports.default = h;
|
|
19
24
|
exports.description = description;
|
|
20
25
|
exports.lithology = lithology;
|
|
21
26
|
exports.liths = liths;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.module.sass.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"main.module.sass.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import hyper from "@macrostrat/hyper";
|
|
1
2
|
const lithology = "_lithology_12ust_1";
|
|
2
3
|
const description = "_description_12ust_34";
|
|
3
4
|
const liths = "_liths_12ust_49";
|
|
@@ -13,8 +14,10 @@ const styles = {
|
|
|
13
14
|
"data-sheet-outer": "_data-sheet-outer_12ust_53",
|
|
14
15
|
"tag-cell-content": "_tag-cell-content_12ust_60"
|
|
15
16
|
};
|
|
17
|
+
let h = hyper.styled(styles);
|
|
18
|
+
Object.assign(h, styles);
|
|
16
19
|
export {
|
|
17
|
-
|
|
20
|
+
h as default,
|
|
18
21
|
description,
|
|
19
22
|
lithology,
|
|
20
23
|
liths
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.module.sass.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"main.module.sass.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@macrostrat/data-sheet",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.3",
|
|
4
4
|
"description": "Scalable data sheet with optional editing capabilities",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -46,12 +46,12 @@
|
|
|
46
46
|
"react": "^18.0.0||^19.0.0"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@blueprintjs/core": "^6.
|
|
50
|
-
"@blueprintjs/table": "^6.0.
|
|
49
|
+
"@blueprintjs/core": "^6.11.3",
|
|
50
|
+
"@blueprintjs/table": "^6.0.23",
|
|
51
51
|
"@macrostrat/color-utils": "^1.2.1",
|
|
52
|
-
"@macrostrat/data-components": "^1.
|
|
52
|
+
"@macrostrat/data-components": "^1.1.4",
|
|
53
53
|
"@macrostrat/hyper": "^3.0.6",
|
|
54
|
-
"@macrostrat/ui-components": "^5.0.
|
|
54
|
+
"@macrostrat/ui-components": "^5.0.6",
|
|
55
55
|
"@supabase/postgrest-js": "^1.17.7",
|
|
56
56
|
"@types/underscore": "^1.13.0",
|
|
57
57
|
"classnames": "^2.5.1",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"zustand-computed": "^2.1.0"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
|
-
"@macrostrat/web-components-bundler": "1.0.
|
|
64
|
+
"@macrostrat/web-components-bundler": "1.0.1"
|
|
65
65
|
},
|
|
66
66
|
"publishConfig": {
|
|
67
67
|
"access": "public"
|