@macrostrat/data-sheet 3.1.0 → 4.0.0-dev1
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 +5 -0
- package/dist/actions/builtin.cjs +56 -0
- package/dist/actions/builtin.cjs.map +1 -0
- package/dist/actions/builtin.d.ts +15 -0
- package/dist/actions/builtin.js +56 -0
- package/dist/actions/builtin.js.map +1 -0
- package/dist/actions/clipboard.cjs +250 -0
- package/dist/actions/clipboard.cjs.map +1 -0
- package/dist/actions/clipboard.d.ts +42 -0
- package/dist/actions/clipboard.js +250 -0
- package/dist/actions/clipboard.js.map +1 -0
- package/dist/actions/filters.cjs +123 -0
- package/dist/actions/filters.cjs.map +1 -0
- package/dist/actions/filters.d.ts +6 -0
- package/dist/actions/filters.js +123 -0
- package/dist/actions/filters.js.map +1 -0
- package/dist/actions/index.d.ts +6 -0
- package/dist/actions/selection.cjs +194 -0
- package/dist/actions/selection.cjs.map +1 -0
- package/dist/actions/selection.d.ts +40 -0
- package/dist/actions/selection.js +192 -0
- package/dist/actions/selection.js.map +1 -0
- package/dist/actions/toolbar.cjs +171 -0
- package/dist/actions/toolbar.cjs.map +1 -0
- package/dist/actions/toolbar.d.ts +10 -0
- package/dist/actions/toolbar.js +171 -0
- package/dist/actions/toolbar.js.map +1 -0
- package/dist/actions/toolbar.module.sass.cjs +22 -0
- package/dist/actions/toolbar.module.sass.cjs.map +1 -0
- package/dist/actions/toolbar.module.sass.js +20 -0
- package/dist/actions/toolbar.module.sass.js.map +1 -0
- package/dist/actions/types.d.ts +143 -0
- package/dist/cell-renderer.cjs +44 -41
- package/dist/cell-renderer.cjs.map +1 -1
- package/dist/cell-renderer.d.ts +1 -6
- package/dist/cell-renderer.js +45 -42
- package/dist/cell-renderer.js.map +1 -1
- package/dist/components/actions.module.sass.cjs +3 -3
- package/dist/components/actions.module.sass.js +2 -2
- package/dist/components/colors.cjs +20 -16
- package/dist/components/colors.cjs.map +1 -1
- package/dist/components/colors.d.ts +4 -3
- package/dist/components/colors.js +20 -16
- package/dist/components/colors.js.map +1 -1
- package/dist/components/editor-popup.cjs +4 -3
- package/dist/components/editor-popup.cjs.map +1 -1
- package/dist/components/editor-popup.js +4 -3
- package/dist/components/editor-popup.js.map +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/main.module.sass.cjs +12 -12
- package/dist/components/main.module.sass.js +11 -11
- package/dist/components/text-areas.cjs +23 -18
- package/dist/components/text-areas.cjs.map +1 -1
- package/dist/components/text-areas.d.ts +8 -4
- package/dist/components/text-areas.js +20 -13
- package/dist/components/text-areas.js.map +1 -1
- package/dist/components/view-info.cjs +18 -0
- package/dist/components/view-info.cjs.map +1 -0
- package/dist/components/view-info.d.ts +1 -0
- package/dist/components/view-info.js +18 -0
- package/dist/components/view-info.js.map +1 -0
- package/dist/core.cjs +184 -156
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.ts +14 -1
- package/dist/core.js +187 -157
- package/dist/core.js.map +1 -1
- package/dist/data-sheet.css +181 -43
- package/dist/index.cjs +43 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +43 -10
- package/dist/index.js.map +1 -1
- package/dist/main.module.sass.cjs +15 -14
- package/dist/main.module.sass.cjs.map +1 -1
- package/dist/main.module.sass.js +14 -13
- package/dist/main.module.sass.js.map +1 -1
- package/dist/notifications.cjs +19 -0
- package/dist/notifications.cjs.map +1 -0
- package/dist/notifications.d.ts +9 -0
- package/dist/notifications.js +19 -0
- package/dist/notifications.js.map +1 -0
- package/dist/postgrest-table/data-loaders.cjs +181 -104
- package/dist/postgrest-table/data-loaders.cjs.map +1 -1
- package/dist/postgrest-table/data-loaders.d.ts +52 -28
- package/dist/postgrest-table/data-loaders.js +181 -104
- package/dist/postgrest-table/data-loaders.js.map +1 -1
- package/dist/postgrest-table/index.cjs +205 -79
- package/dist/postgrest-table/index.cjs.map +1 -1
- package/dist/postgrest-table/index.d.ts +13 -16
- package/dist/postgrest-table/index.js +186 -58
- package/dist/postgrest-table/index.js.map +1 -1
- package/dist/postgrest-table/lazy-loader-table.cjs +18 -17
- package/dist/postgrest-table/lazy-loader-table.cjs.map +1 -1
- package/dist/postgrest-table/lazy-loader-table.d.ts +1 -1
- package/dist/postgrest-table/lazy-loader-table.js +17 -14
- package/dist/postgrest-table/lazy-loader-table.js.map +1 -1
- package/dist/postgrest-table/loading-utils.cjs +16 -0
- package/dist/postgrest-table/loading-utils.cjs.map +1 -0
- package/dist/postgrest-table/loading-utils.d.ts +13 -0
- package/dist/postgrest-table/loading-utils.js +16 -0
- package/dist/postgrest-table/loading-utils.js.map +1 -0
- package/dist/postgrest-table/main.module.sass.cjs +18 -13
- package/dist/postgrest-table/main.module.sass.cjs.map +1 -1
- package/dist/postgrest-table/main.module.sass.js +18 -13
- package/dist/postgrest-table/main.module.sass.js.map +1 -1
- package/dist/provider.cjs +58 -26
- package/dist/provider.cjs.map +1 -1
- package/dist/provider.js +57 -23
- package/dist/provider.js.map +1 -1
- package/dist/renderers/column-header-cell-postgrest.cjs +216 -0
- package/dist/renderers/column-header-cell-postgrest.cjs.map +1 -0
- package/dist/renderers/column-header-cell-postgrest.d.ts +13 -0
- package/dist/renderers/column-header-cell-postgrest.js +216 -0
- package/dist/renderers/column-header-cell-postgrest.js.map +1 -0
- package/dist/renderers/column-header-cell-postgrest.module.sass.cjs +23 -0
- package/dist/renderers/column-header-cell-postgrest.module.sass.cjs.map +1 -0
- package/dist/renderers/column-header-cell-postgrest.module.sass.js +22 -0
- package/dist/renderers/column-header-cell-postgrest.module.sass.js.map +1 -0
- package/dist/renderers/column-header-cell.cjs +103 -0
- package/dist/renderers/column-header-cell.cjs.map +1 -0
- package/dist/renderers/column-header-cell.d.ts +30 -0
- package/dist/renderers/column-header-cell.js +101 -0
- package/dist/renderers/column-header-cell.js.map +1 -0
- package/dist/renderers/index.d.ts +2 -0
- package/dist/table-updates/data-parameter.d.ts +14 -0
- package/dist/table-updates/filter.d.ts +16 -0
- package/dist/table-updates/index.d.ts +19 -0
- package/dist/types.cjs +9 -0
- package/dist/types.cjs.map +1 -0
- package/dist/types.d.ts +58 -4
- package/dist/types.js +9 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/column-spec.cjs +9 -1
- package/dist/utils/column-spec.cjs.map +1 -1
- package/dist/utils/column-spec.d.ts +21 -0
- package/dist/utils/column-spec.js +9 -1
- package/dist/utils/column-spec.js.map +1 -1
- package/dist/utils/key-handling.cjs +141 -52
- package/dist/utils/key-handling.cjs.map +1 -1
- package/dist/utils/key-handling.d.ts +2 -3
- package/dist/utils/key-handling.js +142 -53
- package/dist/utils/key-handling.js.map +1 -1
- package/dist/zustand-store.cjs +216 -51
- package/dist/zustand-store.cjs.map +1 -1
- package/dist/zustand-store.js +197 -32
- package/dist/zustand-store.js.map +1 -1
- package/package.json +3 -3
- package/src/actions/builtin.ts +65 -0
- package/src/actions/clipboard.ts +350 -0
- package/src/actions/filters.ts +150 -0
- package/src/actions/index.ts +6 -0
- package/src/actions/selection.ts +271 -0
- package/src/actions/toolbar.module.sass +30 -0
- package/src/actions/toolbar.ts +212 -0
- package/src/actions/types.ts +159 -0
- package/src/cell-renderer.ts +55 -51
- package/src/components/colors.ts +22 -19
- package/src/components/editor-popup.ts +3 -2
- package/src/components/index.ts +1 -0
- package/src/components/main.module.sass +1 -0
- package/src/components/text-areas.ts +34 -19
- package/src/components/view-info.ts +17 -0
- package/src/core.ts +243 -170
- package/src/index.ts +1 -0
- package/src/main.module.sass +14 -2
- package/src/notifications.ts +22 -0
- package/src/postgrest-table/data-loaders.ts +300 -201
- package/src/postgrest-table/index.ts +258 -84
- package/src/postgrest-table/lazy-loader-table.ts +18 -17
- package/src/postgrest-table/loading-utils.ts +49 -0
- package/src/postgrest-table/main.module.sass +16 -0
- package/src/provider.ts +63 -20
- package/src/renderers/column-header-cell-postgrest.module.sass +71 -0
- package/src/renderers/column-header-cell-postgrest.ts +282 -0
- package/src/renderers/column-header-cell.ts +388 -0
- package/src/renderers/index.ts +2 -0
- package/src/table-updates/data-parameter.ts +44 -0
- package/src/table-updates/filter.ts +124 -0
- package/src/table-updates/index.ts +239 -0
- package/src/types.ts +58 -3
- package/src/utils/column-spec.ts +47 -0
- package/src/utils/key-handling.ts +181 -72
- package/src/zustand-store.ts +241 -36
- package/dist/provider.d.ts +0 -15
package/dist/cell-renderer.d.ts
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
1
|
import { ColumnSpec } from './utils';
|
|
2
2
|
import { DataSheetStore } from './types.ts';
|
|
3
|
-
export declare function basicCellRenderer<T>(rowIndex: number, colIndex: number, columnSpec: ColumnSpec, state: DataSheetStore<T>, autoFocusEditor?: boolean): any;
|
|
4
|
-
export declare function BaseCell({ children, value, ...rest }: {
|
|
5
|
-
[x: string]: any;
|
|
6
|
-
children: any;
|
|
7
|
-
value: any;
|
|
8
|
-
}): import('react').DetailedReactHTMLElement<import('react').InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
|
|
3
|
+
export declare function basicCellRenderer<T>(rowIndex: number, colIndex: number, columnSpec: ColumnSpec, state: DataSheetStore<T>, autoFocusEditor?: boolean, filteredRowIndices?: number[] | null): any;
|
package/dist/cell-renderer.js
CHANGED
|
@@ -1,39 +1,38 @@
|
|
|
1
|
+
import { TableElementStatus } from "./types.js";
|
|
1
2
|
import h from "./main.module.sass.js";
|
|
3
|
+
import { useState, useEffect } from "react";
|
|
2
4
|
import { singleFocusedCell } from "./zustand-store.js";
|
|
3
5
|
import { Cell } from "@blueprintjs/table";
|
|
4
|
-
import {
|
|
6
|
+
import { ctx, useSelector } from "./provider.js";
|
|
5
7
|
import { EditorPopup } from "./components/editor-popup.js";
|
|
6
8
|
import { editorKeyHandlerAtom } from "./utils/key-handling.js";
|
|
7
|
-
function basicCellRenderer(rowIndex, colIndex, columnSpec, state, autoFocusEditor = true) {
|
|
9
|
+
function basicCellRenderer(rowIndex, colIndex, columnSpec, state, autoFocusEditor = true, filteredRowIndices) {
|
|
10
|
+
const dataRowIndex = filteredRowIndices != null ? filteredRowIndices[rowIndex] ?? rowIndex : rowIndex;
|
|
8
11
|
const data = state.data;
|
|
9
12
|
const updatedData = state.updatedData;
|
|
10
|
-
const isDeleted = state.
|
|
11
|
-
const row = data[
|
|
13
|
+
const isDeleted = state.rowStatus[dataRowIndex] == TableElementStatus.DELETED;
|
|
14
|
+
const row = data[dataRowIndex] ?? updatedData[dataRowIndex];
|
|
12
15
|
const loading = row == null;
|
|
13
16
|
const col = columnSpec;
|
|
14
17
|
const _topLeftCell = state.topLeftCell;
|
|
15
18
|
const onCellEdited = state.onCellEdited;
|
|
16
|
-
const value = updatedData[
|
|
17
|
-
const
|
|
19
|
+
const value = updatedData[dataRowIndex]?.[col.key] ?? data[dataRowIndex]?.[col.key];
|
|
20
|
+
const isEmpty = value == null || value === "";
|
|
21
|
+
const _renderedValue = isEmpty ? null : col.valueRenderer?.(value) ?? value;
|
|
18
22
|
let style = col.style ?? {};
|
|
19
23
|
if (isDeleted) {
|
|
20
|
-
style =
|
|
21
|
-
|
|
22
|
-
opacity: 0.5,
|
|
23
|
-
textDecoration: "line-through"
|
|
24
|
-
};
|
|
24
|
+
style.opacity = 0.5;
|
|
25
|
+
style.textDecoration = "line-through";
|
|
25
26
|
}
|
|
26
27
|
const editable = (col.editable ?? state.editable) && !isDeleted;
|
|
27
28
|
const topLeft = _topLeftCell?.col === colIndex && _topLeftCell?.row === rowIndex;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
const edited = updatedData[rowIndex]?.[col.key] != null;
|
|
29
|
+
const tableIsEditable = state.editable;
|
|
30
|
+
const edited = updatedData[dataRowIndex]?.[col.key] != null || state.rowStatus[dataRowIndex] === TableElementStatus.ADDED;
|
|
32
31
|
let intent = edited ? "success" : void 0;
|
|
33
32
|
if (isDeleted) {
|
|
34
33
|
intent = "danger";
|
|
35
34
|
}
|
|
36
|
-
const _Cell = col.cellComponent ??
|
|
35
|
+
const _Cell = col.cellComponent ?? Cell;
|
|
37
36
|
let inlineEditor = editable ? col.inlineEditor ?? true : false;
|
|
38
37
|
if (!topLeft) {
|
|
39
38
|
return h(
|
|
@@ -43,15 +42,12 @@ function basicCellRenderer(rowIndex, colIndex, columnSpec, state, autoFocusEdito
|
|
|
43
42
|
loading,
|
|
44
43
|
value,
|
|
45
44
|
style,
|
|
46
|
-
|
|
45
|
+
disabled: tableIsEditable && !editable,
|
|
46
|
+
interactive: false
|
|
47
47
|
},
|
|
48
48
|
_renderedValue
|
|
49
49
|
);
|
|
50
50
|
}
|
|
51
|
-
let hiddenInput = h(EditorInput, {
|
|
52
|
-
className: "hidden-input",
|
|
53
|
-
autoFocus: true
|
|
54
|
-
});
|
|
55
51
|
let cellContents = _renderedValue;
|
|
56
52
|
let _dataEditor = null;
|
|
57
53
|
let className = null;
|
|
@@ -66,9 +62,13 @@ function basicCellRenderer(rowIndex, colIndex, columnSpec, state, autoFocusEdito
|
|
|
66
62
|
h(col.dataEditor, {
|
|
67
63
|
value,
|
|
68
64
|
editable,
|
|
65
|
+
isEdited: edited,
|
|
69
66
|
onChange(value2) {
|
|
70
67
|
if (!editable) return;
|
|
71
68
|
state.onSelectionEdited(value2);
|
|
69
|
+
},
|
|
70
|
+
resetValue() {
|
|
71
|
+
state.resetChanges();
|
|
72
72
|
}
|
|
73
73
|
})
|
|
74
74
|
]
|
|
@@ -78,20 +78,23 @@ function basicCellRenderer(rowIndex, colIndex, columnSpec, state, autoFocusEdito
|
|
|
78
78
|
if (_dataEditor != null) {
|
|
79
79
|
cellContents = _dataEditor;
|
|
80
80
|
}
|
|
81
|
+
const className2 = "value-viewer-cell";
|
|
81
82
|
return h(
|
|
82
83
|
_Cell,
|
|
83
84
|
{
|
|
84
85
|
intent,
|
|
85
86
|
value,
|
|
86
|
-
style
|
|
87
|
+
style,
|
|
88
|
+
className: className2,
|
|
89
|
+
interactive: false
|
|
87
90
|
},
|
|
88
91
|
cellContents
|
|
89
92
|
);
|
|
90
93
|
}
|
|
91
94
|
const onChange = (e) => {
|
|
92
95
|
if (!editable) return;
|
|
93
|
-
if (
|
|
94
|
-
onCellEdited(
|
|
96
|
+
if (_renderedValue === e.target.value) return;
|
|
97
|
+
onCellEdited(dataRowIndex, col.key, e.target.value);
|
|
95
98
|
};
|
|
96
99
|
const isSingleCellSelection = singleFocusedCell(state.selection) != null;
|
|
97
100
|
let _inlineEditor = null;
|
|
@@ -109,14 +112,16 @@ function basicCellRenderer(rowIndex, colIndex, columnSpec, state, autoFocusEdito
|
|
|
109
112
|
} else {
|
|
110
113
|
_inlineEditor = inlineEditor;
|
|
111
114
|
}
|
|
115
|
+
h(EditorInput, {
|
|
116
|
+
className: "hidden-input",
|
|
117
|
+
autoFocus: true
|
|
118
|
+
});
|
|
112
119
|
if (_dataEditor != null) {
|
|
113
120
|
className = "editor-cell";
|
|
114
121
|
cellContents = _dataEditor;
|
|
115
|
-
hiddenInput = null;
|
|
116
122
|
} else if (_inlineEditor != null) {
|
|
117
123
|
cellContents = _inlineEditor;
|
|
118
124
|
className = "input-cell";
|
|
119
|
-
hiddenInput = null;
|
|
120
125
|
}
|
|
121
126
|
return h(
|
|
122
127
|
_Cell,
|
|
@@ -124,39 +129,37 @@ function basicCellRenderer(rowIndex, colIndex, columnSpec, state, autoFocusEdito
|
|
|
124
129
|
intent,
|
|
125
130
|
value,
|
|
126
131
|
className,
|
|
127
|
-
style
|
|
132
|
+
style,
|
|
133
|
+
interactive: true
|
|
128
134
|
//truncated: false,
|
|
129
135
|
},
|
|
130
136
|
[
|
|
131
137
|
cellContents,
|
|
132
|
-
h.if(editable && isSingleCellSelection)(DragHandle)
|
|
133
|
-
hiddenInput
|
|
138
|
+
h.if(editable && isSingleCellSelection)(DragHandle)
|
|
139
|
+
//hiddenInput,
|
|
134
140
|
]
|
|
135
141
|
);
|
|
136
142
|
}
|
|
137
143
|
function EditorInput(props) {
|
|
138
|
-
const
|
|
144
|
+
const { value, onChange, ...rest } = props;
|
|
145
|
+
const onKeyDown = ctx.useValue(editorKeyHandlerAtom);
|
|
146
|
+
const [_value, setValue] = useState(value);
|
|
147
|
+
useEffect(() => {
|
|
148
|
+
setValue(value);
|
|
149
|
+
}, [value]);
|
|
139
150
|
return h("input", {
|
|
140
151
|
onKeyDown,
|
|
141
|
-
|
|
152
|
+
onBlur: onChange,
|
|
153
|
+
value: _value ?? value,
|
|
154
|
+
onChange: (e) => setValue(e.target.value),
|
|
155
|
+
...rest
|
|
142
156
|
});
|
|
143
157
|
}
|
|
144
158
|
function DragHandle() {
|
|
145
159
|
const onMouseDown = useSelector((state) => state.onDragValue);
|
|
146
160
|
return h("div.corner-drag-handle", { onMouseDown });
|
|
147
161
|
}
|
|
148
|
-
function BaseCell({ children, value, ...rest }) {
|
|
149
|
-
return h(
|
|
150
|
-
Cell,
|
|
151
|
-
{
|
|
152
|
-
interactive: true,
|
|
153
|
-
...rest
|
|
154
|
-
},
|
|
155
|
-
children
|
|
156
|
-
);
|
|
157
|
-
}
|
|
158
162
|
export {
|
|
159
|
-
BaseCell,
|
|
160
163
|
basicCellRenderer
|
|
161
164
|
};
|
|
162
165
|
//# sourceMappingURL=cell-renderer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cell-renderer.js","sources":["../src/cell-renderer.ts"],"sourcesContent":["import { ColumnSpec, editorKeyHandlerAtom } from \"./utils\";\nimport { DataSheetStore } from \"./types.ts\";\nimport h from \"./main.module.sass\";\nimport { ReactNode } from \"react\";\nimport { EditorPopup } from \"./components\";\nimport { singleFocusedCell } from \"./zustand-store.ts\";\nimport { Cell } from \"@blueprintjs/table\";\nimport {
|
|
1
|
+
{"version":3,"file":"cell-renderer.js","sources":["../src/cell-renderer.ts"],"sourcesContent":["import { ColumnSpec, editorKeyHandlerAtom } from \"./utils\";\nimport { DataSheetStore, TableElementStatus } from \"./types.ts\";\nimport h from \"./main.module.sass\";\nimport { ReactNode, useEffect, useState } from \"react\";\nimport { EditorPopup } from \"./components\";\nimport { singleFocusedCell } from \"./zustand-store.ts\";\nimport { Cell } from \"@blueprintjs/table\";\nimport { ctx, useSelector } from \"./provider.ts\";\n\nexport function basicCellRenderer<T>(\n rowIndex: number,\n colIndex: number,\n columnSpec: ColumnSpec,\n state: DataSheetStore<T>,\n autoFocusEditor = true,\n filteredRowIndices?: number[] | null,\n): any {\n // When filters are active, `rowIndex` is the visible row position.\n // Map it to the actual data index for data access.\n const dataRowIndex =\n filteredRowIndices != null\n ? (filteredRowIndices[rowIndex] ?? rowIndex)\n : rowIndex;\n\n const data = state.data;\n const updatedData = state.updatedData;\n\n const isDeleted = state.rowStatus[dataRowIndex] == TableElementStatus.DELETED;\n\n const row = data[dataRowIndex] ?? updatedData[dataRowIndex];\n const loading = row == null;\n const col = columnSpec;\n\n const _topLeftCell = state.topLeftCell;\n const onCellEdited = state.onCellEdited;\n\n const value: T | undefined =\n updatedData[dataRowIndex]?.[col.key] ?? data[dataRowIndex]?.[col.key];\n const isEmpty = value == null || value === \"\";\n const _renderedValue = isEmpty ? null : (col.valueRenderer?.(value) ?? value);\n\n let style = col.style ?? {};\n\n if (isDeleted) {\n style.opacity = 0.5;\n style.textDecoration = \"line-through\";\n }\n\n const editable = (col.editable ?? state.editable) && !isDeleted;\n\n // topLeftCell stores visible row indices, so compare with the visible rowIndex\n const topLeft =\n _topLeftCell?.col === colIndex && _topLeftCell?.row === rowIndex;\n\n const tableIsEditable = state.editable;\n\n const edited =\n updatedData[dataRowIndex]?.[col.key] != null ||\n state.rowStatus[dataRowIndex] === TableElementStatus.ADDED;\n let intent = edited ? \"success\" : undefined;\n if (isDeleted) {\n intent = \"danger\";\n }\n\n const _Cell = col.cellComponent ?? Cell;\n\n let inlineEditor = editable ? (col.inlineEditor ?? true) : false;\n\n if (!topLeft) {\n return h(\n _Cell,\n {\n intent,\n loading,\n value,\n style,\n disabled: tableIsEditable && !editable,\n interactive: false,\n },\n _renderedValue,\n );\n }\n\n // The rest is for the top-left cell of a selection or the focused cell\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 isEdited: edited,\n onChange(value) {\n if (!editable) return;\n state.onSelectionEdited(value);\n },\n resetValue() {\n state.resetChanges();\n },\n }),\n ],\n );\n }\n\n if (!editable) {\n if (_dataEditor != null) {\n cellContents = _dataEditor;\n }\n const className = \"value-viewer-cell\";\n\n return h(\n _Cell,\n {\n intent,\n value,\n style,\n className,\n interactive: false,\n },\n cellContents,\n );\n }\n\n /* The remaining logic covers cells that are focused and editable */\n\n const onChange = (e) => {\n if (!editable) return;\n if (_renderedValue === e.target.value) return;\n // Use dataRowIndex for the actual data mutation\n onCellEdited(dataRowIndex, 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(EditorInput, {\n className: \"main-editor\",\n value: _value ?? \"\",\n autoFocus: autoFocusEditor,\n onChange,\n });\n } else {\n // If inlineEditor is a ReactNode, we use it directly\n _inlineEditor = inlineEditor as ReactNode;\n }\n\n let hiddenInput: React.ReactNode = h(EditorInput, {\n className: \"hidden-input\",\n autoFocus: true,\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 interactive: true,\n //truncated: false,\n },\n [\n cellContents,\n h.if(editable && isSingleCellSelection)(DragHandle),\n //hiddenInput,\n ],\n );\n}\n\nfunction EditorInput(props) {\n const { value, onChange, ...rest } = props;\n const onKeyDown = ctx.useValue(editorKeyHandlerAtom);\n const [_value, setValue] = useState(value);\n useEffect(() => {\n setValue(value);\n }, [value]);\n return h(\"input\", {\n onKeyDown,\n onBlur: onChange,\n value: _value ?? value,\n onChange: (e) => setValue(e.target.value),\n ...rest,\n });\n}\n\nfunction DragHandle() {\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 onMouseDown = useSelector((state) => state.onDragValue);\n return h(\"div.corner-drag-handle\", { onMouseDown });\n}\n"],"names":["value","className"],"mappings":"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"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const
|
|
2
|
+
const h$1 = require("@macrostrat/hyper");
|
|
3
3
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
4
|
-
const
|
|
4
|
+
const h__default = /* @__PURE__ */ _interopDefault(h$1);
|
|
5
5
|
const styles = {
|
|
6
6
|
"table-actions": "_table-actions_1xz9a_1",
|
|
7
7
|
"table-action": "_table-action_1xz9a_1"
|
|
8
8
|
};
|
|
9
|
-
let h =
|
|
9
|
+
let h = h__default.default.styled(styles);
|
|
10
10
|
Object.assign(h, styles);
|
|
11
11
|
module.exports = h;
|
|
12
12
|
//# sourceMappingURL=actions.module.sass.cjs.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import h$1 from "@macrostrat/hyper";
|
|
2
2
|
const styles = {
|
|
3
3
|
"table-actions": "_table-actions_1xz9a_1",
|
|
4
4
|
"table-action": "_table-action_1xz9a_1"
|
|
5
5
|
};
|
|
6
|
-
let h =
|
|
6
|
+
let h = h$1.styled(styles);
|
|
7
7
|
Object.assign(h, styles);
|
|
8
8
|
export {
|
|
9
9
|
h as default
|
|
@@ -6,6 +6,7 @@ const main_module = require("./main.module.sass.cjs");
|
|
|
6
6
|
const colorUtils = require("@macrostrat/color-utils");
|
|
7
7
|
const underscore = require("underscore");
|
|
8
8
|
const classNames = require("classnames");
|
|
9
|
+
const react = require("react");
|
|
9
10
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
10
11
|
const classNames__default = /* @__PURE__ */ _interopDefault(classNames);
|
|
11
12
|
const ColorPicker = uiComponents.ColorPicker2;
|
|
@@ -20,29 +21,32 @@ function ColorCell({
|
|
|
20
21
|
}) {
|
|
21
22
|
const darkMode = uiComponents.useInDarkMode();
|
|
22
23
|
const _className = classNames__default.default(className, "color-cell");
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
const _style = react.useMemo(() => {
|
|
25
|
+
let mainColor = "var(--text-color)";
|
|
26
|
+
let backgroundColor = value;
|
|
27
|
+
if (adjustLuminance) {
|
|
28
|
+
let colors = colorCombo(value, darkMode, 0.05);
|
|
29
|
+
if (colors != null) {
|
|
30
|
+
mainColor = colors.mainColor;
|
|
31
|
+
backgroundColor = colors.backgroundColor;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
if (intent != null) {
|
|
35
|
+
mainColor = void 0;
|
|
30
36
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
37
|
+
return {
|
|
38
|
+
...style,
|
|
39
|
+
color: mainColor,
|
|
40
|
+
backgroundColor
|
|
41
|
+
};
|
|
42
|
+
}, [value, intent, adjustLuminance, darkMode, style]);
|
|
35
43
|
return main_module.default(
|
|
36
44
|
table.Cell,
|
|
37
45
|
{
|
|
38
46
|
intent,
|
|
39
47
|
className: _className,
|
|
40
48
|
...rest,
|
|
41
|
-
style:
|
|
42
|
-
color: mainColor,
|
|
43
|
-
backgroundColor,
|
|
44
|
-
...style
|
|
45
|
-
}
|
|
49
|
+
style: _style
|
|
46
50
|
},
|
|
47
51
|
children
|
|
48
52
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"colors.cjs","sources":["../../src/components/colors.ts"],"sourcesContent":["import { Cell } from \"@blueprintjs/table\";\nimport { useInDarkMode } from \"@macrostrat/ui-components\";\nimport h 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\nexport function ColorCell({\n value,\n children,\n style,\n intent,\n adjustLuminance = true,\n className,\n ...rest\n}) {\n const darkMode = useInDarkMode();\n
|
|
1
|
+
{"version":3,"file":"colors.cjs","sources":["../../src/components/colors.ts"],"sourcesContent":["import { Cell } from \"@blueprintjs/table\";\nimport { useInDarkMode } from \"@macrostrat/ui-components\";\nimport h from \"./main.module.sass\";\nimport { getLuminanceAdjustedColorScheme } from \"@macrostrat/color-utils\";\nimport { memoize } from \"underscore\";\nimport classNames from \"classnames\";\nimport { ColorPicker2 } from \"@macrostrat/ui-components\";\nimport { useMemo } from \"react\";\n\nexport const ColorPicker = ColorPicker2;\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 const _className = classNames(className, \"color-cell\");\n const _style = useMemo(() => {\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 {\n ...style,\n color: mainColor,\n backgroundColor,\n };\n }, [value, intent, adjustLuminance, darkMode, style]);\n\n return h(\n Cell,\n {\n intent,\n className: _className,\n ...rest,\n style: _style,\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":["ColorPicker2","useInDarkMode","classNames","useMemo","h","Cell","memoize","getLuminanceAdjustedColorScheme"],"mappings":";;;;;;;;;;;AASO,MAAM,cAAcA,aAAAA;AAEpB,SAAS,UAAU;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,kBAAkB;AAAA,EAClB;AAAA,EACA,GAAG;AACL,GAAG;AACD,QAAM,WAAWC,aAAAA,cAAA;AACjB,QAAM,aAAaC,oBAAAA,QAAW,WAAW,YAAY;AACrD,QAAM,SAASC,MAAAA,QAAQ,MAAM;AAC3B,QAAI,YAAY;AAChB,QAAI,kBAAkB;AAEtB,QAAI,iBAAiB;AAEnB,UAAI,SAAS,WAAW,OAAO,UAAU,IAAI;AAC7C,UAAI,UAAU,MAAM;AAClB,oBAAY,OAAO;AACnB,0BAAkB,OAAO;AAAA,MAC3B;AAAA,IACF;AAEA,QAAI,UAAU,MAAM;AAElB,kBAAY;AAAA,IACd;AAEA,WAAO;AAAA,MACL,GAAG;AAAA,MACH,OAAO;AAAA,MACP;AAAA,IAAA;AAAA,EAEJ,GAAG,CAAC,OAAO,QAAQ,iBAAiB,UAAU,KAAK,CAAC;AAEpD,SAAOC,YAAAA;AAAAA,IACLC,MAAAA;AAAAA,IACA;AAAA,MACE;AAAA,MACA,WAAW;AAAA,MACX,GAAG;AAAA,MACH,OAAO;AAAA,IAAA;AAAA,IAET;AAAA,EAAA;AAEJ;AAEO,SAAS,oBAAoB,OAAO;AACzC,SAAOD,YAAAA,QAAE,+BAA+B;AAAA,IACtCA,YAAAA,QAAE,qBAAqB;AAAA,MACrB,OAAO,EAAE,iBAAiB,MAAA;AAAA,IAAM,CACjC;AAAA,IACDA,YAAAA,QAAE,mBAAmB,KAAK;AAAA,EAAA,CAC3B;AACH;AAEA,MAAM,aAAaE,WAAAA,QAAQC,0CAA+B;;;;"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Cell } from '@blueprintjs/table';
|
|
2
|
+
import { ColorPicker2 } from '../../../ui-components/src/index.ts';
|
|
2
3
|
export declare const ColorPicker: typeof ColorPicker2;
|
|
3
4
|
export declare function ColorCell({ value, children, style, intent, adjustLuminance, className, ...rest }: {
|
|
4
5
|
[x: string]: any;
|
|
@@ -6,7 +7,7 @@ export declare function ColorCell({ value, children, style, intent, adjustLumina
|
|
|
6
7
|
children: any;
|
|
7
8
|
style: any;
|
|
8
9
|
intent: any;
|
|
9
|
-
adjustLuminance?: boolean;
|
|
10
|
+
adjustLuminance?: boolean | undefined;
|
|
10
11
|
className: any;
|
|
11
|
-
}): import('react').
|
|
12
|
+
}): import('react').ComponentElement<import('@blueprintjs/table').CellProps, Cell>;
|
|
12
13
|
export declare function colorSwatchRenderer(value: any): import('react').DOMElement<import('react').DOMAttributes<Element>, Element>;
|
|
@@ -4,6 +4,7 @@ import h from "./main.module.sass.js";
|
|
|
4
4
|
import { getLuminanceAdjustedColorScheme } from "@macrostrat/color-utils";
|
|
5
5
|
import { memoize } from "underscore";
|
|
6
6
|
import classNames from "classnames";
|
|
7
|
+
import { useMemo } from "react";
|
|
7
8
|
const ColorPicker = ColorPicker2;
|
|
8
9
|
function ColorCell({
|
|
9
10
|
value,
|
|
@@ -16,29 +17,32 @@ function ColorCell({
|
|
|
16
17
|
}) {
|
|
17
18
|
const darkMode = useInDarkMode();
|
|
18
19
|
const _className = classNames(className, "color-cell");
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
const _style = useMemo(() => {
|
|
21
|
+
let mainColor = "var(--text-color)";
|
|
22
|
+
let backgroundColor = value;
|
|
23
|
+
if (adjustLuminance) {
|
|
24
|
+
let colors = colorCombo(value, darkMode, 0.05);
|
|
25
|
+
if (colors != null) {
|
|
26
|
+
mainColor = colors.mainColor;
|
|
27
|
+
backgroundColor = colors.backgroundColor;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
if (intent != null) {
|
|
31
|
+
mainColor = void 0;
|
|
26
32
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
33
|
+
return {
|
|
34
|
+
...style,
|
|
35
|
+
color: mainColor,
|
|
36
|
+
backgroundColor
|
|
37
|
+
};
|
|
38
|
+
}, [value, intent, adjustLuminance, darkMode, style]);
|
|
31
39
|
return h(
|
|
32
40
|
Cell,
|
|
33
41
|
{
|
|
34
42
|
intent,
|
|
35
43
|
className: _className,
|
|
36
44
|
...rest,
|
|
37
|
-
style:
|
|
38
|
-
color: mainColor,
|
|
39
|
-
backgroundColor,
|
|
40
|
-
...style
|
|
41
|
-
}
|
|
45
|
+
style: _style
|
|
42
46
|
},
|
|
43
47
|
children
|
|
44
48
|
);
|
|
@@ -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 h 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\nexport function ColorCell({\n value,\n children,\n style,\n intent,\n adjustLuminance = true,\n className,\n ...rest\n}) {\n const darkMode = useInDarkMode();\n
|
|
1
|
+
{"version":3,"file":"colors.js","sources":["../../src/components/colors.ts"],"sourcesContent":["import { Cell } from \"@blueprintjs/table\";\nimport { useInDarkMode } from \"@macrostrat/ui-components\";\nimport h from \"./main.module.sass\";\nimport { getLuminanceAdjustedColorScheme } from \"@macrostrat/color-utils\";\nimport { memoize } from \"underscore\";\nimport classNames from \"classnames\";\nimport { ColorPicker2 } from \"@macrostrat/ui-components\";\nimport { useMemo } from \"react\";\n\nexport const ColorPicker = ColorPicker2;\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 const _className = classNames(className, \"color-cell\");\n const _style = useMemo(() => {\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 {\n ...style,\n color: mainColor,\n backgroundColor,\n };\n }, [value, intent, adjustLuminance, darkMode, style]);\n\n return h(\n Cell,\n {\n intent,\n className: _className,\n ...rest,\n style: _style,\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;AAEpB,SAAS,UAAU;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,kBAAkB;AAAA,EAClB;AAAA,EACA,GAAG;AACL,GAAG;AACD,QAAM,WAAW,cAAA;AACjB,QAAM,aAAa,WAAW,WAAW,YAAY;AACrD,QAAM,SAAS,QAAQ,MAAM;AAC3B,QAAI,YAAY;AAChB,QAAI,kBAAkB;AAEtB,QAAI,iBAAiB;AAEnB,UAAI,SAAS,WAAW,OAAO,UAAU,IAAI;AAC7C,UAAI,UAAU,MAAM;AAClB,oBAAY,OAAO;AACnB,0BAAkB,OAAO;AAAA,MAC3B;AAAA,IACF;AAEA,QAAI,UAAU,MAAM;AAElB,kBAAY;AAAA,IACd;AAEA,WAAO;AAAA,MACL,GAAG;AAAA,MACH,OAAO;AAAA,MACP;AAAA,IAAA;AAAA,EAEJ,GAAG,CAAC,OAAO,QAAQ,iBAAiB,UAAU,KAAK,CAAC;AAEpD,SAAO;AAAA,IACL;AAAA,IACA;AAAA,MACE;AAAA,MACA,WAAW;AAAA,MACX,GAAG;AAAA,MACH,OAAO;AAAA,IAAA;AAAA,IAET;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;"}
|
|
@@ -49,18 +49,19 @@ function EditorPopup(props) {
|
|
|
49
49
|
enforceFocus: false,
|
|
50
50
|
autoFocus: false,
|
|
51
51
|
animation: "minimal",
|
|
52
|
+
//arrow: false,
|
|
52
53
|
lazy: true,
|
|
53
54
|
// modifiers: {
|
|
54
55
|
// offset: { enabled: true, options: { offset: [0, 8] } },
|
|
55
56
|
// },
|
|
56
57
|
placement,
|
|
57
58
|
interactionKind: "hover-target",
|
|
58
|
-
isOpen
|
|
59
|
+
isOpen
|
|
59
60
|
// Portal must be used to avoid issues with the editor being clipped to the bounds of the cell
|
|
60
|
-
usePortal: true
|
|
61
|
+
//usePortal: true,
|
|
61
62
|
},
|
|
62
63
|
main_module.default(
|
|
63
|
-
"span.editor-popup-target
|
|
64
|
+
"span.editor-popup-target",
|
|
64
65
|
{
|
|
65
66
|
className: targetClassName,
|
|
66
67
|
onClick: () => setIsOpen(!isOpen),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor-popup.cjs","sources":["../../src/components/editor-popup.ts"],"sourcesContent":["import { ErrorBoundary } from \"@macrostrat/ui-components\";\nimport { PopoverNext } from \"@blueprintjs/core\";\nimport h from \"./main.module.sass\";\nimport { useRef, useState } from \"react\";\nimport { useSelector } from \"../provider\";\n\nexport function EditorPopup(props) {\n const {\n children,\n targetClassName,\n autoFocus,\n valueViewer,\n placement = \"right-start\",\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 defaultValue: \"\",\n autoFocus: true,\n onKeyDown: keyHandler,\n }),\n ]);\n\n return h(\n PopoverNext,\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 animation: \"minimal\",\n lazy: true,\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
|
|
1
|
+
{"version":3,"file":"editor-popup.cjs","sources":["../../src/components/editor-popup.ts"],"sourcesContent":["import { ErrorBoundary } from \"@macrostrat/ui-components\";\nimport { PopoverNext } from \"@blueprintjs/core\";\nimport h from \"./main.module.sass\";\nimport { useRef, useState } from \"react\";\nimport { useSelector } from \"../provider\";\n\nexport function EditorPopup(props) {\n const {\n children,\n targetClassName,\n autoFocus,\n valueViewer,\n placement = \"right-start\",\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 defaultValue: \"\",\n autoFocus: true,\n onKeyDown: keyHandler,\n }),\n ]);\n\n return h(\n PopoverNext,\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 animation: \"minimal\",\n //arrow: false,\n lazy: true,\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\",\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":["useState","useSelector","useRef","h","PopoverNext","ErrorBoundary"],"mappings":";;;;;;;AAMO,SAAS,YAAY,OAAO;AACjC,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,YAAY;AAAA,EAAA,IACV;AAEJ,QAAM,CAAC,QAAQ,SAAS,IAAIA,MAAAA,SAAS,SAAS;AAC9C,QAAM,aAAaC,SAAAA,YAAY,CAAC,UAAU,MAAM,UAAU;AAE1D,QAAM,MAAMC,MAAAA,OAAO,IAAI;AAEvB,QAAM,eAAeC,YAAAA,QAAE;AAAA,IACrBA,YAAAA,QAAE,oCAAoC,WAAW;AAAA,IACjDA,YAAAA,QAAE,uBAAuB;AAAA,MACvB,cAAc;AAAA,MACd,WAAW;AAAA,MACX,WAAW;AAAA,IAAA,CACZ;AAAA,EAAA,CACF;AAED,SAAOA,YAAAA;AAAAA,IACLC,KAAAA;AAAAA,IACA;AAAA,MACE,SAASD,YAAAA;AAAAA,QACP;AAAA,QACA;AAAA,UACE,YAAY,KAAK;AACf,gBAAI,YAAY,yBAAA;AAAA,UAClB;AAAA,UACA,UAAU,KAAK;AACb,gBAAI,IAAI,QAAQ,UAAU;AACxB,kBAAI,QAAQ;AACV,0BAAU,KAAK;AAAA,cACjB;AACA,kBAAI,gBAAA;AACJ,kBAAI,eAAA;AACJ;AAAA,YACF;AAAA,UAEF;AAAA,QAAA;AAAA,QAEFA,oBAAEE,aAAAA,eAAe,MAAM,QAAQ;AAAA,MAAA;AAAA,MAEjC,cAAc;AAAA,MACd,WAAW;AAAA,MACX,WAAW;AAAA;AAAA,MAEX,MAAM;AAAA;AAAA;AAAA;AAAA,MAIN;AAAA,MACA,iBAAiB;AAAA,MACjB;AAAA;AAAA;AAAA,IAAA;AAAA,IAIFF,YAAAA;AAAAA,MACE;AAAA,MACA;AAAA,QACE,WAAW;AAAA,QACX,SAAS,MAAM,UAAU,CAAC,MAAM;AAAA,QAChC;AAAA,MAAA;AAAA;AAAA,MAGF,SAAS,cAAe,gBAAgB;AAAA,IAAA;AAAA,EAC1C;AAEJ;;"}
|
|
@@ -47,18 +47,19 @@ function EditorPopup(props) {
|
|
|
47
47
|
enforceFocus: false,
|
|
48
48
|
autoFocus: false,
|
|
49
49
|
animation: "minimal",
|
|
50
|
+
//arrow: false,
|
|
50
51
|
lazy: true,
|
|
51
52
|
// modifiers: {
|
|
52
53
|
// offset: { enabled: true, options: { offset: [0, 8] } },
|
|
53
54
|
// },
|
|
54
55
|
placement,
|
|
55
56
|
interactionKind: "hover-target",
|
|
56
|
-
isOpen
|
|
57
|
+
isOpen
|
|
57
58
|
// Portal must be used to avoid issues with the editor being clipped to the bounds of the cell
|
|
58
|
-
usePortal: true
|
|
59
|
+
//usePortal: true,
|
|
59
60
|
},
|
|
60
61
|
h(
|
|
61
|
-
"span.editor-popup-target
|
|
62
|
+
"span.editor-popup-target",
|
|
62
63
|
{
|
|
63
64
|
className: targetClassName,
|
|
64
65
|
onClick: () => setIsOpen(!isOpen),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor-popup.js","sources":["../../src/components/editor-popup.ts"],"sourcesContent":["import { ErrorBoundary } from \"@macrostrat/ui-components\";\nimport { PopoverNext } from \"@blueprintjs/core\";\nimport h from \"./main.module.sass\";\nimport { useRef, useState } from \"react\";\nimport { useSelector } from \"../provider\";\n\nexport function EditorPopup(props) {\n const {\n children,\n targetClassName,\n autoFocus,\n valueViewer,\n placement = \"right-start\",\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 defaultValue: \"\",\n autoFocus: true,\n onKeyDown: keyHandler,\n }),\n ]);\n\n return h(\n PopoverNext,\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 animation: \"minimal\",\n lazy: true,\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
|
|
1
|
+
{"version":3,"file":"editor-popup.js","sources":["../../src/components/editor-popup.ts"],"sourcesContent":["import { ErrorBoundary } from \"@macrostrat/ui-components\";\nimport { PopoverNext } from \"@blueprintjs/core\";\nimport h from \"./main.module.sass\";\nimport { useRef, useState } from \"react\";\nimport { useSelector } from \"../provider\";\n\nexport function EditorPopup(props) {\n const {\n children,\n targetClassName,\n autoFocus,\n valueViewer,\n placement = \"right-start\",\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 defaultValue: \"\",\n autoFocus: true,\n onKeyDown: keyHandler,\n }),\n ]);\n\n return h(\n PopoverNext,\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 animation: \"minimal\",\n //arrow: false,\n lazy: true,\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\",\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":";;;;;AAMO,SAAS,YAAY,OAAO;AACjC,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,YAAY;AAAA,EAAA,IACV;AAEJ,QAAM,CAAC,QAAQ,SAAS,IAAI,SAAS,SAAS;AAC9C,QAAM,aAAa,YAAY,CAAC,UAAU,MAAM,UAAU;AAE1D,QAAM,MAAM,OAAO,IAAI;AAEvB,QAAM,eAAe,EAAE;AAAA,IACrB,EAAE,oCAAoC,WAAW;AAAA,IACjD,EAAE,uBAAuB;AAAA,MACvB,cAAc;AAAA,MACd,WAAW;AAAA,MACX,WAAW;AAAA,IAAA,CACZ;AAAA,EAAA,CACF;AAED,SAAO;AAAA,IACL;AAAA,IACA;AAAA,MACE,SAAS;AAAA,QACP;AAAA,QACA;AAAA,UACE,YAAY,KAAK;AACf,gBAAI,YAAY,yBAAA;AAAA,UAClB;AAAA,UACA,UAAU,KAAK;AACb,gBAAI,IAAI,QAAQ,UAAU;AACxB,kBAAI,QAAQ;AACV,0BAAU,KAAK;AAAA,cACjB;AACA,kBAAI,gBAAA;AACJ,kBAAI,eAAA;AACJ;AAAA,YACF;AAAA,UAEF;AAAA,QAAA;AAAA,QAEF,EAAE,eAAe,MAAM,QAAQ;AAAA,MAAA;AAAA,MAEjC,cAAc;AAAA,MACd,WAAW;AAAA,MACX,WAAW;AAAA;AAAA,MAEX,MAAM;AAAA;AAAA;AAAA;AAAA,MAIN;AAAA,MACA,iBAAiB;AAAA,MACjB;AAAA;AAAA;AAAA,IAAA;AAAA,IAIF;AAAA,MACE;AAAA,MACA;AAAA,QACE,WAAW;AAAA,QACX,SAAS,MAAM,UAAU,CAAC,MAAM;AAAA,QAChC;AAAA,MAAA;AAAA;AAAA,MAGF,SAAS,cAAe,gBAAgB;AAAA,IAAA;AAAA,EAC1C;AAEJ;"}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
-
const
|
|
3
|
+
const h$1 = require("@macrostrat/hyper");
|
|
4
4
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
5
|
-
const
|
|
6
|
-
const tools = "
|
|
5
|
+
const h__default = /* @__PURE__ */ _interopDefault(h$1);
|
|
6
|
+
const tools = "_tools_19ibd_24";
|
|
7
7
|
const styles = {
|
|
8
|
-
"interaction-barrier": "_interaction-
|
|
9
|
-
"editor-popup-target": "_editor-popup-
|
|
10
|
-
"editable-text-area": "_editable-text-
|
|
8
|
+
"interaction-barrier": "_interaction-barrier_19ibd_1",
|
|
9
|
+
"editor-popup-target": "_editor-popup-target_19ibd_5",
|
|
10
|
+
"editable-text-area": "_editable-text-area_19ibd_15",
|
|
11
11
|
tools,
|
|
12
|
-
"hidden-editor": "_hidden-
|
|
13
|
-
"editor-value": "_editor-
|
|
14
|
-
"color-swatch": "_color-
|
|
15
|
-
"color-swatch-container": "_color-swatch-
|
|
16
|
-
"color-name": "_color-
|
|
12
|
+
"hidden-editor": "_hidden-editor_19ibd_31",
|
|
13
|
+
"editor-value": "_editor-value_19ibd_35",
|
|
14
|
+
"color-swatch": "_color-swatch_19ibd_43",
|
|
15
|
+
"color-swatch-container": "_color-swatch-container_19ibd_50",
|
|
16
|
+
"color-name": "_color-name_19ibd_62"
|
|
17
17
|
};
|
|
18
|
-
let h =
|
|
18
|
+
let h = h__default.default.styled(styles);
|
|
19
19
|
Object.assign(h, styles);
|
|
20
20
|
exports.default = h;
|
|
21
21
|
exports.tools = tools;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
const tools = "
|
|
1
|
+
import h$1 from "@macrostrat/hyper";
|
|
2
|
+
const tools = "_tools_19ibd_24";
|
|
3
3
|
const styles = {
|
|
4
|
-
"interaction-barrier": "_interaction-
|
|
5
|
-
"editor-popup-target": "_editor-popup-
|
|
6
|
-
"editable-text-area": "_editable-text-
|
|
4
|
+
"interaction-barrier": "_interaction-barrier_19ibd_1",
|
|
5
|
+
"editor-popup-target": "_editor-popup-target_19ibd_5",
|
|
6
|
+
"editable-text-area": "_editable-text-area_19ibd_15",
|
|
7
7
|
tools,
|
|
8
|
-
"hidden-editor": "_hidden-
|
|
9
|
-
"editor-value": "_editor-
|
|
10
|
-
"color-swatch": "_color-
|
|
11
|
-
"color-swatch-container": "_color-swatch-
|
|
12
|
-
"color-name": "_color-
|
|
8
|
+
"hidden-editor": "_hidden-editor_19ibd_31",
|
|
9
|
+
"editor-value": "_editor-value_19ibd_35",
|
|
10
|
+
"color-swatch": "_color-swatch_19ibd_43",
|
|
11
|
+
"color-swatch-container": "_color-swatch-container_19ibd_50",
|
|
12
|
+
"color-name": "_color-name_19ibd_62"
|
|
13
13
|
};
|
|
14
|
-
let h =
|
|
14
|
+
let h = h$1.styled(styles);
|
|
15
15
|
Object.assign(h, styles);
|
|
16
16
|
export {
|
|
17
17
|
h as default,
|