@gramlot/gramlot 0.3.27 → 0.3.31
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/assets/icons/chart.svg +1 -0
- package/dist/components/audio/__init__.py +13 -0
- package/dist/components/audio/assets/collection.js +3 -0
- package/dist/components/audio/assets/index.js +3 -0
- package/dist/components/audio/commands.json +7 -0
- package/dist/components/audio/grammar.json +335 -0
- package/dist/components/charts/__init__.py +13 -0
- package/dist/components/charts/assets/collection.js +47 -0
- package/dist/components/charts/assets/files/55ea01207028f76d844678511f29fc800f8a1e67a8a0fe80470128677847ad32-echarts-gl.txt +29 -0
- package/dist/components/charts/assets/files/63727832aaf62004a2b249c933e327f3c90caf49e41a72f4bf436edf632cbda8-vega.txt +27 -0
- package/dist/components/charts/assets/files/8c45d9eaf50c2f72dd9c7ab9ef440788ba58a3538484b5c51c1f17d5128752e7-plotly.txt +21 -0
- package/dist/components/charts/assets/files/8f989229699b4fe2f1a0432d0e9edc338a8a911e250e2d1b01ecd770a5f5b1bd-uplot.txt +21 -0
- package/dist/components/charts/assets/files/c8fa058cba98f7f288b5d8fa4116f441d6dacb25b96da859e518c973fff41d0c-claygl.txt +23 -0
- package/dist/components/charts/assets/index.js +3 -0
- package/dist/components/charts/assets/modules/chunk-2CCTLZE7.js +76 -0
- package/dist/components/charts/assets/modules/chunk-RMRBEYTI.js +1 -0
- package/dist/components/charts/assets/modules/echarts-gl-CXVTZA6G.js +4409 -0
- package/dist/components/charts/assets/modules/plotly.min-4LB7HE7P.js +3596 -0
- package/dist/components/charts/assets/modules/uPlot.esm-5JJNHHRF.js +3 -0
- package/dist/components/charts/assets/modules/uPlot.min-N3E3FA74.js +1 -0
- package/dist/components/charts/assets/modules/vega.module-2QCOVQ3A.js +13 -0
- package/dist/components/charts/commands.json +7 -0
- package/dist/components/charts/grammar.json +1113 -0
- package/dist/components/chat/__init__.py +1 -1
- package/dist/components/chat/assets/collection.js +3 -3
- package/dist/components/chat/assets/index.js +1 -1
- package/dist/components/drawing/__init__.py +15 -0
- package/dist/components/drawing/assets/collection.js +28 -0
- package/dist/components/drawing/assets/index.js +3 -0
- package/dist/components/drawing/commands.json +7 -0
- package/dist/components/drawing/grammar.json +110 -0
- package/dist/components/editors/__init__.py +2 -2
- package/dist/components/editors/assets/collection.js +18 -18
- package/dist/components/editors/assets/index.js +1 -1
- package/dist/components/editors/assets/modules/{prose-mirror-engine-GMZPJPNN.js → prose-mirror-engine-DQEAEIMV.js} +2 -2
- package/dist/components/editors/grammar.json +150 -0
- package/dist/components/grid/__init__.py +2 -2
- package/dist/components/grid/assets/collection.js +71 -34
- package/dist/components/grid/assets/files/0a1df3a083d0c010560aa342e87959c8c1070e6fd54545741f083f22d0c8b551-fflate.txt +21 -0
- package/dist/components/grid/assets/files/8cf9b31947daf7adb4a7a00a037459e58241af050cd0a603bfcf1756e533f75e-write-excel-file.txt +21 -0
- package/dist/components/grid/assets/index.js +1 -1
- package/dist/components/grid/assets/modules/browser-LVJHKBBV.js +19 -0
- package/dist/components/grid/assets/modules/chunk-RMRBEYTI.js +1 -0
- package/dist/components/grid/commands.json +42 -1
- package/dist/components/grid/grammar.json +650 -10
- package/dist/components/grouplets/__init__.py +1 -1
- package/dist/components/grouplets/assets/collection.js +3 -3
- package/dist/components/grouplets/assets/index.js +1 -1
- package/dist/components/inputs/__init__.py +3 -2
- package/dist/components/inputs/assets/collection.js +38 -23
- package/dist/components/inputs/assets/index.js +1 -1
- package/dist/components/inputs/grammar.json +1533 -321
- package/dist/components/layout/__init__.py +1 -1
- package/dist/components/layout/assets/collection.js +27 -23
- package/dist/components/layout/assets/index.js +1 -1
- package/dist/components/layout/grammar.json +85 -0
- package/dist/components/selection_trial/__init__.py +1 -1
- package/dist/components/selection_trial/assets/collection.js +3 -3
- package/dist/components/selection_trial/assets/index.js +1 -1
- package/dist/components/tree/__init__.py +1 -1
- package/dist/components/tree/assets/collection.js +11 -11
- package/dist/components/tree/assets/index.js +1 -1
- package/dist/components/tree/grammar.json +126 -0
- package/dist/components/typst/__init__.py +1 -1
- package/dist/components/typst/assets/collection.js +2 -2
- package/dist/components/typst/assets/index.js +1 -1
- package/dist/components/uploads/__init__.py +1 -1
- package/dist/components/uploads/assets/collection.js +8 -8
- package/dist/components/uploads/assets/index.js +1 -1
- package/dist/components/vizabi/__init__.py +13 -0
- package/dist/components/vizabi/assets/collection.js +22 -0
- package/dist/components/vizabi/assets/index.js +3 -0
- package/dist/components/vizabi/commands.json +7 -0
- package/dist/components/vizabi/grammar.json +128 -0
- package/dist/gramlot.js +944 -193
- package/dist/gramlot.min.js +85 -53
- package/dist/standard-collections.js +2 -0
- package/package.json +13 -4
- package/src/binding/grid-struct.js +5 -2
- package/src/binding/runtime.js +12 -1
- package/src/bootstrap.js +1 -1
- package/src/builder/gramlot-builder.d.ts +15 -2
- package/src/builder/gramlot-builder.js +116 -8
- package/src/builder/source.js +42 -1
- package/src/components/audio-analysis-session.js +65 -0
- package/src/components/audio.js +44 -0
- package/src/components/bases.js +6 -4
- package/src/components/border-container.js +6 -3
- package/src/components/buttons.js +47 -3
- package/src/components/chart-bar3d-options.js +30 -0
- package/src/components/chart-controls.js +83 -0
- package/src/components/chart-data-view.js +52 -0
- package/src/components/chart-data.js +42 -0
- package/src/components/chart-domains.js +46 -0
- package/src/components/chart-engines/echarts-options.js +50 -0
- package/src/components/chart-engines/echarts.js +82 -0
- package/src/components/chart-engines/index.js +22 -0
- package/src/components/chart-engines/plotly-map.js +34 -0
- package/src/components/chart-engines/plotly-spatial.js +35 -0
- package/src/components/chart-engines/plotly.js +138 -0
- package/src/components/chart-engines/uplot.js +57 -0
- package/src/components/chart-engines/vega.js +101 -0
- package/src/components/chart-fields.js +110 -0
- package/src/components/chart-geographic-options.js +47 -0
- package/src/components/chart-geojson.js +60 -0
- package/src/components/chart-geometry.js +11 -0
- package/src/components/chart-map-anchors.js +24 -0
- package/src/components/chart-map-bar3d-options.js +41 -0
- package/src/components/chart-map-data.js +25 -0
- package/src/components/chart-map-labels.js +8 -0
- package/src/components/chart-map-options.js +20 -0
- package/src/components/chart-pane.js +91 -0
- package/src/components/chart-renderer.js +58 -0
- package/src/components/chart-sample-view.js +32 -0
- package/src/components/chart-spatial-options.js +40 -0
- package/src/components/chart-time.js +84 -0
- package/src/components/chart-timeline.js +70 -0
- package/src/components/chart-types/area.js +2 -0
- package/src/components/chart-types/bar.js +2 -0
- package/src/components/chart-types/bar3D.js +2 -0
- package/src/components/chart-types/donut.js +2 -0
- package/src/components/chart-types/horizontalBar.js +2 -0
- package/src/components/chart-types/index.js +26 -0
- package/src/components/chart-types/line.js +2 -0
- package/src/components/chart-types/line3D.js +2 -0
- package/src/components/chart-types/lines3D.js +2 -0
- package/src/components/chart-types/map.js +2 -0
- package/src/components/chart-types/map3D.js +2 -0
- package/src/components/chart-types/mapBar3D.js +2 -0
- package/src/components/chart-types/pie.js +2 -0
- package/src/components/chart-types/polygons3D.js +2 -0
- package/src/components/chart-types/scatter.js +2 -0
- package/src/components/chart-types/scatter3D.js +2 -0
- package/src/components/chart-types/stackedArea.js +2 -0
- package/src/components/chart-types/stackedBar.js +2 -0
- package/src/components/chart-types/surface.js +2 -0
- package/src/components/charts.js +152 -0
- package/src/components/check-box-text-editor.js +88 -0
- package/src/components/check-box-text.js +193 -0
- package/src/components/check-box-tree.js +62 -0
- package/src/components/choice-editor.js +7 -5
- package/src/components/choice-field-styles.js +14 -0
- package/src/components/choices.js +5 -0
- package/src/components/drawing.js +199 -0
- package/src/components/grid-check-sets.js +98 -0
- package/src/components/grid-column-filters.js +198 -0
- package/src/components/grid-footer.js +120 -0
- package/src/components/grid-formulas.js +403 -0
- package/src/components/grid-grammar.json +131 -2
- package/src/components/grid-header-interaction.js +3 -1
- package/src/components/grid-rows.js +2 -2
- package/src/components/grid-search-box.js +38 -22
- package/src/components/grid-search-styles.js +13 -14
- package/src/components/grid-search.js +8 -1
- package/src/components/grid-selection.js +118 -0
- package/src/components/grid-structure.js +36 -5
- package/src/components/grid-styles.js +37 -1
- package/src/components/grid-tools.js +229 -0
- package/src/components/grid.js +223 -15
- package/src/components/image-uploader.js +2 -2
- package/src/components/inputs.js +19 -10
- package/src/components/labelbox.js +5 -1
- package/src/components/licenses/claygl.txt +23 -0
- package/src/components/licenses/echarts-gl.txt +29 -0
- package/src/components/licenses/fflate.txt +21 -0
- package/src/components/licenses/plotly.txt +21 -0
- package/src/components/licenses/uplot.txt +21 -0
- package/src/components/licenses/vega.txt +27 -0
- package/src/components/licenses/write-excel-file.txt +21 -0
- package/src/components/menus.js +19 -11
- package/src/components/toolbar-overflow.js +12 -8
- package/src/components/tree.js +30 -8
- package/src/components/typed-editor.js +14 -3
- package/src/components/vizabi-session.js +66 -0
- package/src/components/vizabi.js +66 -0
- package/src/components/window-surface.js +20 -9
- package/src/components/windows.js +1 -1
- package/src/editing-session.d.ts +2 -0
- package/src/editing-session.js +35 -3
- package/src/gramlot.d.ts +1 -0
- package/src/gramlot.js +2 -0
- package/src/handlers/device-handler.js +32 -32
- package/src/handlers/source-handler.d.ts +2 -2
- package/src/ide-documents.js +19 -3
- package/src/ide-runtime.d.ts +1 -0
- package/src/ide-runtime.js +45 -31
- package/src/index.d.ts +1 -0
- package/src/renderer/drag-drop.js +1 -0
- package/src/renderer/gramlot-renderer.d.ts +2 -0
- package/src/renderer/gramlot-renderer.js +5 -4
- package/src/server/assets.d.ts +3 -0
- package/src/server/assets.js +9 -0
- package/src/server/gramlot-server.d.ts +1 -1
- package/src/server/gramlot-server.js +2 -1
- package/src/server/index.d.ts +1 -1
- package/src/server/index.js +1 -1
- package/src/server/visual-editor.js +17 -17
- package/src/stores/bag-collection-store.js +14 -5
- package/src/stores/bag-collection-view.js +80 -18
- package/src/stores/collection-filter.js +2 -1
- package/src/stores/column-filter.js +49 -0
- package/src/stores/id-set.js +10 -0
- package/src/view/controls.js +8 -0
- package/src/view/html.js +10 -1
- package/src/view/label-menu.js +61 -0
- package/src/view/labelbox.js +15 -2
- package/themes/gramlot-base/theme.css +6 -0
- package/tools/gramlot-tools-inspector.js +169 -505
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import {defineComponent} from './registry.js';
|
|
2
|
+
import {Labelbox} from './labelbox.js';
|
|
2
3
|
import {Container} from './container.js';
|
|
3
4
|
import {gridSearch, searchColumns} from './grid-search.js';
|
|
4
5
|
import {SVG_NS} from '../renderer/attributes.js';
|
|
5
6
|
import {positionPopup} from './popup.js';
|
|
6
|
-
import {gridSearchStyles} from './grid-search-styles.js';
|
|
7
|
+
import {gridSearchStyles, gridSearchLabelStyle} from './grid-search-styles.js';
|
|
7
8
|
|
|
8
9
|
/** FrameGrid's search slot. The collection view owns the accepted filter. */
|
|
9
10
|
export const SearchBox = defineComponent({
|
|
10
|
-
name:'searchBox', tag:'gramlot-search-box', base:Container, sourceContext:true,
|
|
11
|
-
parameters:{searchOn:{dtype:['B','T'], default:true, binding:'read'},
|
|
11
|
+
name:'searchBox', tag:'gramlot-search-box', base:Container, sourceContext:true, mixins:[Labelbox],
|
|
12
|
+
parameters:{lbl_position:{dtype:'T',default:'L',binding:'read'},searchLiteral:{dtype:'B',default:false,binding:'read'},searchHelp:{dtype:'B',default:false,binding:'read'},searchOn:{dtype:['B','T'], default:true, binding:'read'},
|
|
12
13
|
searchTime:{dtype:'R', nullable:true, default:null, binding:'write'}},
|
|
13
14
|
implementation:Base => class extends Base {
|
|
14
15
|
#context; #grid; #release; #releaseView; #view; #timer = null;
|
|
15
|
-
#
|
|
16
|
+
#input; #error; #info; #help; #helpText; #filterSignature; #bag;
|
|
16
17
|
constructor() {
|
|
17
18
|
super();
|
|
18
19
|
const doc = this.ownerDocument;
|
|
@@ -22,22 +23,19 @@ export const SearchBox = defineComponent({
|
|
|
22
23
|
const svg = doc.createElementNS(SVG_NS,'svg'); svg.setAttribute('viewBox','0 0 24 24'); svg.setAttribute('aria-hidden','true');
|
|
23
24
|
const shape = doc.createElementNS(SVG_NS,'path'); shape.setAttribute('d',path); svg.append(shape); return svg;
|
|
24
25
|
};
|
|
25
|
-
this.#field = doc.createElement('select'); this.#field.setAttribute('aria-label','Search column');
|
|
26
26
|
this.#input = doc.createElement('input'); this.#input.type = 'text'; this.#input.setAttribute('role','searchbox'); this.#input.setAttribute('aria-label','Filter rows');
|
|
27
27
|
this.#input.setAttribute('aria-describedby','search-error');
|
|
28
28
|
this.#input.placeholder = ' ';
|
|
29
29
|
const clear = doc.createElement('button'); clear.type = 'button'; clear.title = 'Clear filter'; clear.setAttribute('aria-label','Clear filter'); clear.append(icon('M6 6L18 18M18 6L6 18'));
|
|
30
30
|
this.#error = doc.createElement('span'); this.#error.id = 'search-error'; this.#error.className = 'error'; this.#error.setAttribute('role','alert');
|
|
31
|
-
const choice = doc.createElement('span'); choice.className = 'column-choice';
|
|
32
|
-
choice.append(this.#field,icon('M7 10L12 15L17 10'));
|
|
33
31
|
const entry = doc.createElement('span'); entry.className = 'search-entry';
|
|
34
32
|
const lens = icon('M21 21L16 16M18 10A8 8 0 1 1 2 10A8 8 0 0 1 18 10'); lens.classList.add('search-lens');
|
|
35
33
|
clear.className = 'clear';
|
|
36
|
-
const info = doc.createElement('button'); info.type = 'button'; info.className = 'info';
|
|
34
|
+
const info = this.#info = doc.createElement('button'); info.type = 'button'; info.className = 'info'; info.hidden = true;
|
|
37
35
|
info.setAttribute('aria-label','Search instructions'); info.title = 'Search instructions';
|
|
38
36
|
info.setAttribute('aria-haspopup','dialog'); info.setAttribute('aria-expanded','false'); info.setAttribute('aria-controls','search-help');
|
|
39
37
|
info.append(icon('M21 12A9 9 0 1 1 3 12A9 9 0 0 1 21 12M12 11V17M12 7V7.1'));
|
|
40
|
-
const help = doc.createElement('div'); help.id = 'search-help'; help.className = 'search-help';
|
|
38
|
+
const help = this.#help = doc.createElement('div'); help.id = 'search-help'; help.className = 'search-help';
|
|
41
39
|
help.setAttribute('popover','auto'); help.setAttribute('role','dialog'); help.setAttribute('aria-label','Search instructions');
|
|
42
40
|
const heading = doc.createElement('strong'); heading.textContent = 'Search instructions';
|
|
43
41
|
this.#helpText = doc.createElement('p');
|
|
@@ -49,7 +47,7 @@ export const SearchBox = defineComponent({
|
|
|
49
47
|
});
|
|
50
48
|
help.addEventListener('toggle', () => info.setAttribute('aria-expanded',String(help.matches(':popover-open'))));
|
|
51
49
|
entry.append(lens,this.#input,clear,info);
|
|
52
|
-
this.control.replaceChildren(
|
|
50
|
+
this.control.replaceChildren(entry,this.#error);
|
|
53
51
|
this.shadowRoot.append(style);
|
|
54
52
|
this.#input.addEventListener('input', () => {
|
|
55
53
|
this.#cancel(); this.#timer = doc.defaultView.setTimeout(() => { this.#timer = null; this.#apply(); },100);
|
|
@@ -59,9 +57,17 @@ export const SearchBox = defineComponent({
|
|
|
59
57
|
if (event.key === 'Enter') { event.preventDefault(); this.#cancel(); this.#apply(); }
|
|
60
58
|
if (event.key === 'Escape') { event.preventDefault(); this.#clear(); }
|
|
61
59
|
});
|
|
62
|
-
this.#field.addEventListener('change', () => this.#clear());
|
|
63
60
|
clear.addEventListener('click', () => {this.#clear(); this.#input.focus();});
|
|
64
61
|
}
|
|
62
|
+
setLabelbox(layout) {
|
|
63
|
+
super.setLabelbox(layout);
|
|
64
|
+
layout.box.classList.add('gramlot-search-labelbox');
|
|
65
|
+
const style = this.ownerDocument.createElement('style');
|
|
66
|
+
style.textContent = gridSearchLabelStyle;
|
|
67
|
+
layout.box.prepend(style);
|
|
68
|
+
}
|
|
69
|
+
focus(options) { this.#input.focus(options); }
|
|
70
|
+
clear() { this.#clear(); }
|
|
65
71
|
setSourceContext(context) {
|
|
66
72
|
this.#context = context;
|
|
67
73
|
const target = context.frameRecipient();
|
|
@@ -69,8 +75,16 @@ export const SearchBox = defineComponent({
|
|
|
69
75
|
this.#grid = gridSearch(target);
|
|
70
76
|
}
|
|
71
77
|
projectAttributes(attrs, adapt) {
|
|
78
|
+
const previous = this.parameters?.lbl_value;
|
|
72
79
|
const rest = super.projectAttributes(attrs, adapt);
|
|
73
|
-
|
|
80
|
+
const wasVisible = !this.#info.hidden;
|
|
81
|
+
this.#info.hidden = !this.parameters.searchHelp;
|
|
82
|
+
if (wasVisible && this.#info.hidden && this.#help.matches(':popover-open')) this.#help.hidePopover();
|
|
83
|
+
if (this.isConnected) {
|
|
84
|
+
this.#configure();
|
|
85
|
+
if (previous != null && previous !== this.parameters.lbl_value
|
|
86
|
+
&& this.#view?.filter?.columns.join('+') !== this.parameters.lbl_value) this.#clear();
|
|
87
|
+
}
|
|
74
88
|
return rest;
|
|
75
89
|
}
|
|
76
90
|
connectedCallback() {
|
|
@@ -92,12 +106,13 @@ export const SearchBox = defineComponent({
|
|
|
92
106
|
this.#filterSignature = undefined;
|
|
93
107
|
this.#releaseView = this.#view.subscribe(() => this.#sync());
|
|
94
108
|
}
|
|
95
|
-
const previous = this.#field.value;
|
|
96
109
|
const options = searchColumns(this.parameters.searchOn,this.#grid.columns);
|
|
97
|
-
this.#
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
110
|
+
const node = this.#context.sourceNode;
|
|
111
|
+
const values = options.map(({field,name}) => `${field}:${name}`).join(',');
|
|
112
|
+
const value = options.some(option => option.field === this.parameters.lbl_value)
|
|
113
|
+
? this.parameters.lbl_value : options[0]?.field ?? '';
|
|
114
|
+
if (node.getAttr('lbl_values') !== values) node.setAttr({lbl_values:values});
|
|
115
|
+
if (this.parameters.lbl_value !== value) this.box.labelbox.choose(value);
|
|
101
116
|
this.#input.disabled = !options.length;
|
|
102
117
|
this.#sync(); this.#hint();
|
|
103
118
|
}
|
|
@@ -108,17 +123,18 @@ export const SearchBox = defineComponent({
|
|
|
108
123
|
if (this.#filterSignature === signature) return;
|
|
109
124
|
this.#filterSignature = signature;
|
|
110
125
|
this.#cancel(); this.#input.value = filter?.value ?? '';
|
|
111
|
-
if (filter
|
|
126
|
+
if (filter && this.parameters.lbl_value !== filter.columns.join('+'))
|
|
127
|
+
this.box.labelbox.choose(filter.columns.join('+'));
|
|
112
128
|
this.#error.textContent = ''; this.#input.removeAttribute('aria-invalid'); this.#hint();
|
|
113
129
|
}
|
|
114
130
|
#dtype() {
|
|
115
|
-
const column = this.#grid.columns.find(column => column.field === this
|
|
131
|
+
const column = this.#grid.columns.find(column => column.field === this.parameters.lbl_value);
|
|
116
132
|
return ['L','R','N','D'].includes(column?.dtype) ? column.dtype : 'T';
|
|
117
133
|
}
|
|
118
134
|
#hint() {
|
|
119
135
|
const dtype = this.#dtype();
|
|
120
136
|
this.#helpText.textContent = dtype === 'T'
|
|
121
|
-
? 'Type a word to find it anywhere. Text is case-insensitive. You can also use expressions: lamp|desk matches either word; ^lamp matches the start.'
|
|
137
|
+
? this.parameters.searchLiteral ? 'Type literal text to find it anywhere. Matching is case-insensitive.' : 'Type a word to find it anywhere. Text is case-insensitive. You can also use expressions: lamp|desk matches either word; ^lamp matches the start.'
|
|
122
138
|
: dtype === 'D'
|
|
123
139
|
? 'Compare dates: = 2026-10-15, >= 2026-10-15 or < 2026-10-15. ISO dates and your browser’s local date notation are accepted.'
|
|
124
140
|
: 'Compare numbers: = 12, > 100, <= 50 or ! 0 (not equal). Decimal punctuation follows your browser locale.';
|
|
@@ -129,8 +145,8 @@ export const SearchBox = defineComponent({
|
|
|
129
145
|
try {
|
|
130
146
|
const value = this.#input.value;
|
|
131
147
|
const started = performance.now();
|
|
132
|
-
this.#view.applyFilter(value.trim() ? {value, columns:this
|
|
133
|
-
locale:this.#context.locale,
|
|
148
|
+
this.#view.applyFilter(value.trim() ? {value, columns:this.parameters.lbl_value.split('+'), dtype:this.#dtype(),
|
|
149
|
+
...(this.parameters.searchLiteral ? {literal:true} : {}), locale:this.#context.locale,
|
|
134
150
|
timeZone:this.#context.timeZone} : null);
|
|
135
151
|
this.#context.writeParameter('searchTime', performance.now() - started);
|
|
136
152
|
this.#error.textContent = ''; this.#input.removeAttribute('aria-invalid');
|
|
@@ -1,30 +1,29 @@
|
|
|
1
1
|
/** Search capsule: uses shared field, surface and focus tokens in every theme. */
|
|
2
|
+
export const gridSearchLabelStyle = `.gramlot-search-labelbox{inline-size:var(--gramlot-search-width,240px);max-inline-size:100%;font-size:var(--gramlot-search-font-size,12px)}`;
|
|
2
3
|
export const gridSearchStyles = `
|
|
3
|
-
:host{display:inline-block;inline-size:
|
|
4
|
-
.control-box{display:flex;align-items:stretch;position:relative;min-block-size:var(--gramlot-
|
|
4
|
+
:host{display:inline-block;inline-size:100%;font-size:var(--gramlot-search-font-size,12px);max-inline-size:100%;min-inline-size:0}
|
|
5
|
+
.control-box{display:flex;align-items:stretch;position:relative;min-block-size:max(var(--gramlot-search-height,26px),var(--gramlot-touch-target,0px));
|
|
5
6
|
border:1px solid var(--gramlot-border,GrayText);border-radius:999px;
|
|
6
7
|
background:var(--gramlot-field-background,Canvas);color:var(--gramlot-ink,CanvasText);
|
|
7
8
|
transition:border-color .15s}
|
|
8
9
|
.control-box:hover{border-color:var(--gramlot-border-control,GrayText)}
|
|
9
10
|
.control-box:focus-within{border-color:var(--gramlot-border-control,GrayText)}
|
|
10
|
-
|
|
11
|
-
.column-choice{display:flex;align-items:center;background:var(--gramlot-surface-subtle,ButtonFace);border-radius:999px 0 0 999px;position:relative;flex:0 1 auto;max-inline-size:42%;border-inline-end:1px solid var(--gramlot-border,GrayText)}
|
|
12
|
-
select{display:block;appearance:none;inline-size:100%;padding:.35rem 1.8rem .35rem .85rem;
|
|
13
|
-
border-radius:999px;font-size:.9em;color:var(--gramlot-text-secondary,GrayText);cursor:pointer;text-overflow:ellipsis}
|
|
14
|
-
select option{background:var(--gramlot-field-background,Canvas);color:var(--gramlot-ink,CanvasText)}
|
|
15
|
-
.column-choice>svg{position:absolute;inset-inline-end:.55rem;inset-block-start:50%;transform:translateY(-50%);pointer-events:none;color:var(--gramlot-text-secondary,GrayText);width:.8rem;height:.8rem}
|
|
11
|
+
input,button{font:inherit;color:inherit;min-inline-size:0;border:0;background:transparent}
|
|
16
12
|
.search-entry{position:relative;display:flex;align-items:center;flex:1;min-inline-size:0}
|
|
17
13
|
.search-lens{position:absolute;inset-inline-start:.65rem;pointer-events:none;color:var(--gramlot-text-secondary,GrayText);opacity:.6}
|
|
18
|
-
input{inline-size:100%;min-block-size:var(--gramlot-
|
|
14
|
+
input{inline-size:100%;min-block-size:max(var(--gramlot-search-height,26px),var(--gramlot-touch-target,0px));padding:2px calc(2 * max(24px,var(--gramlot-touch-target,0px)) + 4px) 2px 26px;border-radius:999px;outline:none}
|
|
19
15
|
input::placeholder{color:var(--gramlot-text-secondary,GrayText);opacity:.75}
|
|
20
16
|
input:disabled{opacity:.5}
|
|
21
17
|
.clear,.info{position:absolute;display:grid;place-items:center;padding:.3rem;
|
|
22
|
-
inline-size:
|
|
23
|
-
.clear{inset-inline-end:
|
|
24
|
-
.info{
|
|
18
|
+
inline-size:max(24px,var(--gramlot-touch-target,0px));block-size:max(24px,var(--gramlot-touch-target,0px));border-radius:50%;color:var(--gramlot-text-secondary,GrayText);cursor:pointer}
|
|
19
|
+
.clear{inset-inline-end:calc(max(24px,var(--gramlot-touch-target,0px)) + 2px)}
|
|
20
|
+
.info[hidden]{display:none}
|
|
21
|
+
.search-entry:has(.info[hidden]) .clear{inset-inline-end:2px}
|
|
22
|
+
.search-entry:has(.info[hidden]) input{padding-inline-end:calc(max(24px,var(--gramlot-touch-target,0px)) + 4px)}
|
|
23
|
+
.info{inset-inline-end:2px;opacity:.7}
|
|
25
24
|
.clear:hover,.info:hover{color:var(--gramlot-ink,CanvasText);background:var(--gramlot-surface-subtle,ButtonFace)}
|
|
26
25
|
input:placeholder-shown~.clear{display:none}
|
|
27
|
-
|
|
26
|
+
button:focus-visible{outline:1px solid var(--gramlot-text-secondary,GrayText);outline-offset:-3px}
|
|
28
27
|
svg{width:1rem;height:1rem;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round;flex:none}
|
|
29
28
|
.control-box:has([aria-invalid=true]){border-color:var(--gramlot-error,Mark)}
|
|
30
29
|
.error{position:absolute;inset-block-start:calc(100% + .35rem);inset-inline:0;z-index:1;
|
|
@@ -36,7 +35,7 @@ svg{width:1rem;height:1rem;fill:none;stroke:currentColor;stroke-width:1.7;stroke
|
|
|
36
35
|
max-block-size:var(--gramlot-popup-available-height,80vh);overflow:auto;padding:1rem;
|
|
37
36
|
border:1px solid var(--gramlot-border,GrayText);border-radius:var(--gramlot-radius-lg,.75rem);
|
|
38
37
|
background:var(--gramlot-surface,Canvas);color:var(--gramlot-ink,CanvasText);
|
|
39
|
-
box-shadow:var(--gramlot-shadow,0 3px 12px #0002);font:inherit;font-size
|
|
38
|
+
box-shadow:var(--gramlot-shadow,0 3px 12px #0002);font:inherit;font-size:inherit;line-height:1.5}
|
|
40
39
|
.search-help p{margin:.6rem 0 0}.search-help p:last-child{color:var(--gramlot-text-secondary,GrayText)}
|
|
41
40
|
@media(prefers-reduced-motion:reduce){.control-box{transition:none}}
|
|
42
41
|
`;
|
|
@@ -9,6 +9,13 @@ export class GridSearch {
|
|
|
9
9
|
this.view = view; this.#bag = view.bag; this.columns = columns;
|
|
10
10
|
for (const listener of this.#listeners) listener();
|
|
11
11
|
}
|
|
12
|
+
detach(view) {
|
|
13
|
+
if (this.view !== view) return;
|
|
14
|
+
this.view = null;
|
|
15
|
+
this.#bag = null;
|
|
16
|
+
this.columns = [];
|
|
17
|
+
for (const listener of this.#listeners) listener();
|
|
18
|
+
}
|
|
12
19
|
subscribe(listener) { this.#listeners.add(listener); return () => this.#listeners.delete(listener); }
|
|
13
20
|
}
|
|
14
21
|
|
|
@@ -22,7 +29,7 @@ export function gridSearch(node) {
|
|
|
22
29
|
export function searchColumns(searchOn, columns) {
|
|
23
30
|
if (searchOn === true || typeof searchOn === 'string' && searchOn.startsWith('*')) {
|
|
24
31
|
const allowed = searchOn === true ? columns : columns.filter(column => searchOn.slice(1).includes(column.dtype ?? 'T'));
|
|
25
|
-
return allowed.length ? [{field:allowed.map(column => column.field).join('+'), name:'All columns'},
|
|
32
|
+
return allowed.length ? [...(allowed.length > 1 ? [{field:allowed.map(column => column.field).join('+'), name:'All columns'}] : []),
|
|
26
33
|
...allowed.map(column => ({field:column.field, name:column.name}))] : [];
|
|
27
34
|
}
|
|
28
35
|
if (typeof searchOn !== 'string' || !searchOn.trim()) throw new TypeError('searchOn requires true or a column list');
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import {Bag} from '@gramlot/gramlot';
|
|
2
|
+
|
|
3
|
+
export const SELECTION_MODES = Object.freeze(['none', 'single', 'multi']);
|
|
4
|
+
|
|
5
|
+
// Write parameters published on every selection change, each only when declared (legacy names).
|
|
6
|
+
const PUBLISHED = ['selectedId', 'selectedIndex', 'selectedLabel', 'selectedPkeys', 'selectedRowidx', 'selectedNodes', 'selectedRowData'];
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Row selection of one grid (legacy genro_grid.js selection publication). The identity of a row is
|
|
10
|
+
* its node label in both row modes, as the legacy Bag store identifier `nodelabel`. Selected rows are
|
|
11
|
+
* the visible rows of the view: a row leaving the view (filter, deletion) leaves the selection;
|
|
12
|
+
* sorting keeps it.
|
|
13
|
+
*/
|
|
14
|
+
export class GridSelection {
|
|
15
|
+
#context;
|
|
16
|
+
#host;
|
|
17
|
+
#selected = new Set();
|
|
18
|
+
#current = null;
|
|
19
|
+
#anchor = null;
|
|
20
|
+
|
|
21
|
+
/** `host` gives `view()`, `store()` (BagCollectionStore), `mode()` and `rowData(node)` (plain field values). */
|
|
22
|
+
constructor(context, host) {
|
|
23
|
+
this.#context = context;
|
|
24
|
+
this.#host = host;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
get source() { return this.#context.sourceNode; }
|
|
28
|
+
get mode() { return this.#host.mode(); }
|
|
29
|
+
get current() { return this.#current; }
|
|
30
|
+
isSelected(node) { return this.#selected.has(node); }
|
|
31
|
+
/** Selected rows in view order. */
|
|
32
|
+
get nodes() { return this.#host.view().getRows().filter(node => this.#selected.has(node)); }
|
|
33
|
+
|
|
34
|
+
/** Click or keyboard selection of `node`: `toggle` (Ctrl/Cmd) and `range` (Shift) apply in multi mode. */
|
|
35
|
+
select(node, {toggle = false, range = false} = {}) {
|
|
36
|
+
if (this.mode === 'none') return;
|
|
37
|
+
const rows = this.#host.view().getRows();
|
|
38
|
+
if (this.mode === 'multi' && range && this.#anchor !== null && rows.includes(this.#anchor)) {
|
|
39
|
+
const [from, to] = [rows.indexOf(this.#anchor), rows.indexOf(node)].sort((a, b) => a - b);
|
|
40
|
+
this.#apply(new Set(rows.slice(from, to + 1)), node, this.#anchor);
|
|
41
|
+
} else if (this.mode === 'multi' && toggle) {
|
|
42
|
+
const selected = new Set(this.#selected);
|
|
43
|
+
if (selected.has(node)) selected.delete(node); else selected.add(node);
|
|
44
|
+
this.#apply(selected, selected.has(node) ? node : this.nodes.find(row => selected.has(row)) ?? null, node);
|
|
45
|
+
} else this.#apply(new Set([node]), node, node);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** Up/Down: move the current row by `step`; `extend` (Shift, multi mode) extends from the anchor. */
|
|
49
|
+
move(step, extend = false) {
|
|
50
|
+
if (this.mode === 'none') return null;
|
|
51
|
+
const rows = this.#host.view().getRows();
|
|
52
|
+
if (!rows.length) return null;
|
|
53
|
+
const index = this.#current === null ? (step > 0 ? -1 : rows.length) : rows.indexOf(this.#current);
|
|
54
|
+
const next = rows[Math.max(0, Math.min(rows.length - 1, index + step))];
|
|
55
|
+
this.select(next, {range:extend});
|
|
56
|
+
return next;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** Ctrl/Cmd+A in multi mode: every visible row. */
|
|
60
|
+
selectAll() {
|
|
61
|
+
if (this.mode !== 'multi') return;
|
|
62
|
+
const rows = this.#host.view().getRows();
|
|
63
|
+
this.#apply(new Set(rows), this.#current ?? rows[0] ?? null, this.#anchor ?? rows[0] ?? null);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** Keep only visible rows (after a filter, deletion or store replacement); publishes when it changes. */
|
|
67
|
+
prune() {
|
|
68
|
+
// selectionMode 'none' keeps no selection.
|
|
69
|
+
const visible = new Set(this.mode === 'none' ? [] : this.#host.view().getRows());
|
|
70
|
+
if ([...this.#selected].every(node => visible.has(node)) && (this.#current === null || visible.has(this.#current))) return;
|
|
71
|
+
const selected = new Set([...this.#selected].filter(node => visible.has(node)));
|
|
72
|
+
this.#apply(selected, visible.has(this.#current) ? this.#current : null, visible.has(this.#anchor) ? this.#anchor : null);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** The absolute Data paths this grid publishes the selection to. */
|
|
76
|
+
paths() {
|
|
77
|
+
const names = Object.keys(this.source.getAttr()).filter(name => PUBLISHED.includes(name) || name.startsWith('selected_'));
|
|
78
|
+
return [this.source.absDatapath('.selectionLength'), ...names.map(name => this.source.absDatapath(this.source.getAttr(name)))];
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
#apply(selected, current, anchor) {
|
|
82
|
+
this.#selected = selected; this.#current = current; this.#anchor = anchor;
|
|
83
|
+
this.publish();
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/** Publish the selection to the declared Data paths, `.selectionLength` and `onSelectedRow`. */
|
|
87
|
+
publish() {
|
|
88
|
+
const store = this.#host.store(), view = this.#host.view(), nodes = this.nodes, current = this.#current;
|
|
89
|
+
const idx = current === null ? -1 : view.getRows().indexOf(current);
|
|
90
|
+
const selectedId = current === null ? null : current.label;
|
|
91
|
+
const selectedPkeys = nodes.map(node => node.label);
|
|
92
|
+
const resident = store.getRows();
|
|
93
|
+
const values = {
|
|
94
|
+
selectedId, selectedIndex:idx < 0 ? null : idx, selectedLabel:selectedId, selectedPkeys,
|
|
95
|
+
selectedRowidx:nodes.map(node => resident.indexOf(node)).join(','),
|
|
96
|
+
selectedNodes:() => {
|
|
97
|
+
const bag = new Bag();
|
|
98
|
+
for (const node of nodes) bag.setItem(node.label, null, this.#host.rowData(node));
|
|
99
|
+
return bag;
|
|
100
|
+
},
|
|
101
|
+
selectedRowData:() => current === null ? null : new Bag(this.#host.rowData(current)),
|
|
102
|
+
};
|
|
103
|
+
for (const name of PUBLISHED) {
|
|
104
|
+
if (this.source.getAttr(name) == null) continue;
|
|
105
|
+
const value = typeof values[name] === 'function' ? values[name]() : values[name];
|
|
106
|
+
this.#context.writeParameter(name, value);
|
|
107
|
+
// Legacy: the selectedNodes Data node carries the row count as attribute `count`.
|
|
108
|
+
if (name === 'selectedNodes') this.source.rootBuilder.binding.data.getNode(this.source.absDatapath(this.source.getAttr(name))).setAttr({count:nodes.length});
|
|
109
|
+
}
|
|
110
|
+
for (const name of Object.keys(this.source.getAttr())) {
|
|
111
|
+
if (!name.startsWith('selected_')) continue;
|
|
112
|
+
const field = name.slice('selected_'.length);
|
|
113
|
+
this.#context.writeParameter(name, [...new Set(nodes.map(node => store.value(node, field)))].join(','));
|
|
114
|
+
}
|
|
115
|
+
if (this.source.getRelativeData('.selectionLength') !== nodes.length) this.source.setRelativeData('.selectionLength', nodes.length);
|
|
116
|
+
this.#context.publish('onSelectedRow', {idx, selectedId, selectedPkeys});
|
|
117
|
+
}
|
|
118
|
+
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import {Bag} from '@gramlot/gramlot';
|
|
2
|
+
import {formulaDefinitions} from './grid-formulas.js';
|
|
2
3
|
|
|
3
4
|
const TYPES = new Set(['T', 'B', 'L', 'R', 'N', 'D', 'H', 'DHZ']);
|
|
4
|
-
const COLUMN_KEYS = new Set(['tag', 'field', 'name', 'dtype', 'width', 'align', 'format', 'columnset', 'white_space', 'max_height', 'edit'
|
|
5
|
+
const COLUMN_KEYS = new Set(['tag', 'field', 'name', 'title', 'dtype', 'width', 'align', 'format', 'columnset', 'white_space', 'max_height', 'edit', 'check', 'checked', 'checkedField',
|
|
6
|
+
'formula', 'calculated', 'hidden', 'totalize', 'footer_value', 'footer_format']);
|
|
7
|
+
const FORMULA_PARAMETER = /^formula_[A-Za-z_$][\w$]*$/;
|
|
5
8
|
const GROUP_KEYS = new Set(['tag', 'code', 'name', 'background', 'color']);
|
|
6
9
|
|
|
7
10
|
/** Legacy Data contract: ordered cells and independent columnset definitions. */
|
|
@@ -26,9 +29,10 @@ export class GridStructure {
|
|
|
26
29
|
}
|
|
27
30
|
this.columns = [];
|
|
28
31
|
this.groups = [];
|
|
32
|
+
const declared = [];
|
|
29
33
|
for (const node of cells.getNodes()) {
|
|
30
34
|
const attrs = node.getAttr();
|
|
31
|
-
requireKeys(attrs, COLUMN_KEYS);
|
|
35
|
+
requireKeys(attrs, COLUMN_KEYS, FORMULA_PARAMETER);
|
|
32
36
|
if (attrs.tag !== 'cell' || node.staticValue != null || node.resolver) throw new TypeError('grid cell must be a scalar declaration');
|
|
33
37
|
requireIdentity(attrs.field, 'field');
|
|
34
38
|
if (fields.has(attrs.field)) throw new TypeError(`Duplicate grid field: ${attrs.field}`);
|
|
@@ -43,10 +47,22 @@ export class GridStructure {
|
|
|
43
47
|
throw new TypeError('grid max_height requires a nonnegative CSS length (px, em or rem)');
|
|
44
48
|
}
|
|
45
49
|
if (attrs.white_space != null && !['normal','nowrap','pre-wrap'].includes(attrs.white_space)) throw new TypeError('grid white_space requires normal, nowrap or pre-wrap');
|
|
46
|
-
for (const key of ['name', 'format']) if (attrs[key] != null && typeof attrs[key] !== 'string') throw new TypeError(`grid ${key} must be text`);
|
|
50
|
+
for (const key of ['name', 'title', 'format']) if (attrs[key] != null && typeof attrs[key] !== 'string') throw new TypeError(`grid ${key} must be text`);
|
|
47
51
|
if (attrs.edit != null && typeof attrs.edit !== 'boolean' && (typeof attrs.edit !== 'object' || Array.isArray(attrs.edit))) throw new TypeError('grid edit requires a boolean or editor options');
|
|
52
|
+
if (attrs.check != null || attrs.checked != null || attrs.checkedField != null) {
|
|
53
|
+
if (!['multiple','single'].includes(attrs.check) || typeof attrs.checked !== 'string' ||
|
|
54
|
+
!attrs.checked.startsWith('^') || attrs.checked.length < 2 || attrs.checked.includes('?')) {
|
|
55
|
+
throw new TypeError('grid check requires single or multiple and checked=^DataPath');
|
|
56
|
+
}
|
|
57
|
+
requireIdentity(attrs.checkedField, 'checkedField');
|
|
58
|
+
if (attrs.edit) throw new TypeError('external check sets cannot edit row fields');
|
|
59
|
+
}
|
|
60
|
+
requireFormulaAttributes(attrs);
|
|
48
61
|
const column = Object.freeze({...attrs, name: attrs.name ?? attrs.field,
|
|
49
62
|
align: attrs.align ?? (['L', 'R', 'N'].includes(attrs.dtype) ? 'end' : 'start')});
|
|
63
|
+
declared.push(column);
|
|
64
|
+
// A hidden column is not displayed; its formula still calculates.
|
|
65
|
+
if (attrs.hidden) continue;
|
|
50
66
|
this.columns.push(column);
|
|
51
67
|
const code = attrs.columnset ?? null;
|
|
52
68
|
let run = this.groups.at(-1);
|
|
@@ -57,6 +73,8 @@ export class GridStructure {
|
|
|
57
73
|
run.columns.push(column);
|
|
58
74
|
}
|
|
59
75
|
if (!this.columns.length) throw new TypeError('grid struct requires at least one column');
|
|
76
|
+
this.fields = Object.freeze([...fields]);
|
|
77
|
+
this.formulas = formulaDefinitions(declared);
|
|
60
78
|
for (const group of this.groups) { Object.freeze(group.columns); Object.freeze(group); }
|
|
61
79
|
Object.freeze(this.columns); Object.freeze(this.groups); Object.freeze(this);
|
|
62
80
|
}
|
|
@@ -80,8 +98,21 @@ function branch(bag, label) {
|
|
|
80
98
|
if (!node || node.resolver || !(node.staticValue instanceof Bag)) throw new TypeError(`grid struct requires Bag ${label}`);
|
|
81
99
|
return node.staticValue;
|
|
82
100
|
}
|
|
83
|
-
function requireKeys(attrs, allowed) {
|
|
84
|
-
for (const key of Object.keys(attrs))
|
|
101
|
+
function requireKeys(attrs, allowed, pattern = null) {
|
|
102
|
+
for (const key of Object.keys(attrs)) {
|
|
103
|
+
if (!allowed.has(key) && !pattern?.test(key)) throw new TypeError(`Unsupported grid struct attribute: ${key}`);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
function requireFormulaAttributes(attrs) {
|
|
107
|
+
if (attrs.formula != null && (typeof attrs.formula !== 'string' || !attrs.formula.trim())) throw new TypeError('grid formula must be nonempty text');
|
|
108
|
+
if (attrs.formula == null && (attrs.calculated != null || Object.keys(attrs).some(key => key.startsWith('formula_')))) {
|
|
109
|
+
throw new TypeError(`grid ${attrs.field}: calculated and formula_<name> require a formula`);
|
|
110
|
+
}
|
|
111
|
+
for (const key of ['calculated', 'hidden']) if (attrs[key] != null && typeof attrs[key] !== 'boolean') throw new TypeError(`grid ${key} must be a boolean`);
|
|
112
|
+
if (attrs.totalize != null && typeof attrs.totalize !== 'boolean' && (typeof attrs.totalize !== 'string' || !attrs.totalize)) {
|
|
113
|
+
throw new TypeError('grid totalize requires a boolean or a Data path');
|
|
114
|
+
}
|
|
115
|
+
for (const key of ['footer_value', 'footer_format']) if (attrs[key] != null && typeof attrs[key] !== 'string') throw new TypeError(`grid ${key} must be text`);
|
|
85
116
|
}
|
|
86
117
|
function requireIdentity(value, label) {
|
|
87
118
|
if (typeof value !== 'string' || !/^[A-Za-z_][A-Za-z0-9_]*$/.test(value)) throw new TypeError(`grid ${label} requires a simple field identifier`);
|
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
* A JS stylesheet module keeps the same source usable in Node and browser builds.
|
|
3
3
|
*/
|
|
4
4
|
export const gridStyles = `
|
|
5
|
+
.column-filter{position:absolute;inset-inline-end:8px;top:50%;transform:translateY(-50%);border:0;background:transparent;color:inherit;cursor:pointer;padding:2px;margin-inline-start:4px;vertical-align:middle;line-height:0;opacity:.6}
|
|
6
|
+
th:has(.column-filter){padding-inline-end:28px}
|
|
7
|
+
.column-filter svg{width:13px;height:13px;fill:none;stroke:currentColor;stroke-width:1.5}
|
|
8
|
+
.column-filter.active{opacity:1;color:var(--gramlot-action,Highlight)}
|
|
9
|
+
.column-filter.active svg{fill:currentColor}
|
|
10
|
+
.column-filtered{box-shadow:inset 0 -2px var(--gramlot-action,Highlight)}
|
|
11
|
+
.column-filter:focus-visible{outline:2px solid var(--gramlot-focus-ring,Highlight)}
|
|
12
|
+
.column-filter-panel{position:fixed;inset:auto;margin:0;padding:0;border:1px solid var(--gramlot-border,GrayText);border-radius:8px;background:var(--gramlot-surface,Canvas);color:var(--gramlot-ink,CanvasText);font:inherit;box-shadow:0 8px 24px #0003;width:310px;max-width:var(--gramlot-popup-available-width);max-height:var(--gramlot-popup-available-height);overflow:auto}
|
|
13
|
+
.column-filter-panel slot{display:contents}
|
|
14
|
+
|
|
5
15
|
.control-box{position:relative}
|
|
6
16
|
.cell-editor{
|
|
7
17
|
position:absolute;z-index:4;height:min(var(--grid-editor-height),var(--grid-cell-max-height,var(--grid-editor-height)));
|
|
@@ -44,7 +54,16 @@ export const gridStyles = `
|
|
|
44
54
|
background: var(--gramlot-grid-header-background, var(--gramlot-surface-subtle, ButtonFace));
|
|
45
55
|
border-block-end: 1px solid var(--gramlot-grid-border-color, var(--gramlot-border, ButtonBorder));
|
|
46
56
|
}
|
|
47
|
-
.header-viewport { overflow: hidden; min-inline-size: 0; }
|
|
57
|
+
.header-viewport, .footer-viewport { overflow: hidden; min-inline-size: 0; }
|
|
58
|
+
.footer-frame {
|
|
59
|
+
flex: none;
|
|
60
|
+
min-inline-size: 0;
|
|
61
|
+
padding-inline-end: var(--grid-scrollbar-width, 0px);
|
|
62
|
+
background: var(--gramlot-grid-header-background, var(--gramlot-surface-subtle, ButtonFace));
|
|
63
|
+
border-block-start: 1px solid var(--gramlot-grid-border-color, var(--gramlot-border, ButtonBorder));
|
|
64
|
+
font-weight: var(--gramlot-grid-header-weight, 600);
|
|
65
|
+
}
|
|
66
|
+
.footer-frame td[aria-invalid=true] { color: var(--gramlot-error, #b3261e); }
|
|
48
67
|
.body-frame {
|
|
49
68
|
flex: 1 1 auto;
|
|
50
69
|
min-block-size: 0;
|
|
@@ -140,6 +159,9 @@ export const gridStyles = `
|
|
|
140
159
|
block-size: var(--gramlot-grid-row-height, 2rem);
|
|
141
160
|
border-block-end: 1px solid var(--gramlot-grid-row-border-color, var(--gramlot-border, ButtonBorder));
|
|
142
161
|
}
|
|
162
|
+
.cell-color-swatch { display:inline-block;vertical-align:middle;width:100%;max-width:48px;height:14px;
|
|
163
|
+
border:1px solid var(--gramlot-border-control,#888);border-radius:3px; }
|
|
164
|
+
.cell-color-swatch[hidden] { display:none; }
|
|
143
165
|
td[data-field] { padding: 0; }
|
|
144
166
|
.cell-content {
|
|
145
167
|
padding: var(--gramlot-grid-cell-padding, .3rem .6rem);
|
|
@@ -147,10 +169,21 @@ export const gridStyles = `
|
|
|
147
169
|
text-overflow: ellipsis;
|
|
148
170
|
max-height: var(--grid-cell-max-height, none);
|
|
149
171
|
}
|
|
172
|
+
td.check-cell { vertical-align: middle; }
|
|
173
|
+
.check-cell > .cell-content {
|
|
174
|
+
display: flex;
|
|
175
|
+
align-items: center;
|
|
176
|
+
justify-content: center;
|
|
177
|
+
padding: 0;
|
|
178
|
+
min-block-size: calc(var(--gramlot-grid-row-height, 2rem) - 1px);
|
|
179
|
+
text-overflow: clip;
|
|
180
|
+
}
|
|
181
|
+
.grid-set-check { margin: 0; flex: none; }
|
|
150
182
|
.cell-scroll { overflow: auto; overscroll-behavior: contain; }
|
|
151
183
|
.cell-scroll:focus-visible { outline: 1px solid var(--gramlot-focus-ring, Highlight); outline-offset: -1px; }
|
|
152
184
|
tbody tr { background: var(--gramlot-grid-background, var(--gramlot-surface, Canvas)); }
|
|
153
185
|
tbody tr.alternate { background: var(--gramlot-grid-row-alt-background, var(--gramlot-surface-subtle, Canvas)); }
|
|
186
|
+
tbody tr[aria-selected=true] { background: var(--gramlot-grid-selected-background, var(--gramlot-selected, Highlight)); }
|
|
154
187
|
tbody tr:hover { background: var(--gramlot-grid-row-hover-background, var(--gramlot-selected, Highlight)); }
|
|
155
188
|
th[data-field] { padding-inline-end: 14px; cursor: grab; user-select: none; }
|
|
156
189
|
th[data-field]:hover { background-color: color-mix(in srgb, var(--gramlot-grid-header-background) 92%, var(--gramlot-grid-header-color)); }
|
|
@@ -206,5 +239,8 @@ export const gridStyles = `
|
|
|
206
239
|
tbody tr[data-row-drop=before] > * { box-shadow: inset 0 2px var(--gramlot-focus-ring, Highlight); }
|
|
207
240
|
tbody tr[data-row-drop=after] > * { box-shadow: inset 0 -2px var(--gramlot-focus-ring, Highlight); }
|
|
208
241
|
.numeric { font-variant-numeric: tabular-nums; }
|
|
242
|
+
tbody .filtered-numbering {
|
|
243
|
+
background: var(--gramlot-grid-filtered-numbering-background, var(--gramlot-warning-background, Mark));
|
|
244
|
+
}
|
|
209
245
|
.empty { text-align: center; color: var(--gramlot-text-secondary, GrayText); }
|
|
210
246
|
`;
|