@jsenv/navi 0.10.1 → 0.11.0
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/dist/jsenv_navi.js +13858 -23295
- package/dist/jsenv_navi.js.map +1281 -0
- package/package.json +5 -7
- package/index.js +0 -122
- package/src/action_private_properties.js +0 -11
- package/src/action_proxy_test.html +0 -353
- package/src/action_run_states.js +0 -5
- package/src/actions.js +0 -1401
- package/src/browser_integration/browser_integration.js +0 -216
- package/src/browser_integration/document_back_and_forward.js +0 -17
- package/src/browser_integration/document_loading_signal.js +0 -100
- package/src/browser_integration/document_state_signal.js +0 -9
- package/src/browser_integration/document_url_signal.js +0 -9
- package/src/browser_integration/use_is_visited.js +0 -19
- package/src/browser_integration/via_history.js +0 -232
- package/src/browser_integration/via_navigation.js +0 -168
- package/src/components/action_execution/form_context.js +0 -5
- package/src/components/action_execution/render_actionable_component.jsx +0 -29
- package/src/components/action_execution/use_action.js +0 -99
- package/src/components/action_execution/use_execute_action.js +0 -177
- package/src/components/action_execution/use_run_on_mount.js +0 -9
- package/src/components/action_renderer.jsx +0 -125
- package/src/components/callout/callout.js +0 -990
- package/src/components/callout/callout_demo.html +0 -201
- package/src/components/callout/test_dynamic_positioning.html +0 -161
- package/src/components/callout/test_html_document_iframe.html +0 -182
- package/src/components/demos/0_button_demo.html +0 -707
- package/src/components/demos/10_column_reordering_debug.html +0 -277
- package/src/components/demos/11_table_selection_debug.html +0 -432
- package/src/components/demos/1_checkbox_demo.html +0 -754
- package/src/components/demos/2_input_textual_demo.html +0 -286
- package/src/components/demos/3_radio_demo.html +0 -874
- package/src/components/demos/4_select_demo.html +0 -100
- package/src/components/demos/5_list_scrollable_demo.html +0 -153
- package/src/components/demos/6_tablist_demo.html +0 -77
- package/src/components/demos/7_table_selection_demo.html +0 -176
- package/src/components/demos/8_table_fixed_headers_demo.html +0 -584
- package/src/components/demos/9_table_column_drag_demo.html +0 -325
- package/src/components/demos/action/0_button_demo.html +0 -204
- package/src/components/demos/action/10_shortcuts_demo.html +0 -189
- package/src/components/demos/action/11_nested_shortcuts_demo.xhtml +0 -401
- package/src/components/demos/action/1_input_text_demo.html +0 -876
- package/src/components/demos/action/2_form_multiple.html +0 -303
- package/src/components/demos/action/3_details_demo.html +0 -203
- package/src/components/demos/action/4_input_checkbox_demo.html +0 -731
- package/src/components/demos/action/5_input_checkbox_state_demo.html +0 -270
- package/src/components/demos/action/6_checkbox_list_demo.html +0 -341
- package/src/components/demos/action/7_radio_list_demo.html +0 -357
- package/src/components/demos/action/8_editable_demo.html +0 -431
- package/src/components/demos/action/9_link_demo.html +0 -194
- package/src/components/demos/demo.md +0 -0
- package/src/components/demos/route/basic/basic.html +0 -14
- package/src/components/demos/route/basic/basic_route_demo.jsx +0 -224
- package/src/components/demos/route/multi/multi.html +0 -14
- package/src/components/demos/route/multi/multi_route_demo.jsx +0 -277
- package/src/components/demos/ui_transition/0_action_renderer_ui_transition_demo.html +0 -695
- package/src/components/demos/ui_transition/1_nested_ui_transition_demo.html +0 -429
- package/src/components/demos/ui_transition/2_height_transition_test.html +0 -295
- package/src/components/details/details.jsx +0 -245
- package/src/components/details/summary_marker.jsx +0 -141
- package/src/components/edition/editable.jsx +0 -186
- package/src/components/error_boundary_context.js +0 -9
- package/src/components/field/README.md +0 -247
- package/src/components/field/button.jsx +0 -429
- package/src/components/field/checkbox_list.jsx +0 -185
- package/src/components/field/collect_form_element_values.js +0 -82
- package/src/components/field/custom_field.js +0 -106
- package/src/components/field/form.jsx +0 -209
- package/src/components/field/input.jsx +0 -16
- package/src/components/field/input_checkbox.jsx +0 -434
- package/src/components/field/input_radio.jsx +0 -432
- package/src/components/field/input_textual.jsx +0 -389
- package/src/components/field/label.jsx +0 -46
- package/src/components/field/radio_list.jsx +0 -183
- package/src/components/field/select.jsx +0 -256
- package/src/components/field/use_action_events.js +0 -132
- package/src/components/field/use_form_events.js +0 -59
- package/src/components/field/use_ui_state_controller.js +0 -506
- package/src/components/item_tracker/README.md +0 -461
- package/src/components/item_tracker/use_isolated_item_tracker.jsx +0 -209
- package/src/components/item_tracker/use_isolated_item_tracker_demo.html +0 -148
- package/src/components/item_tracker/use_isolated_item_tracker_demo.jsx +0 -460
- package/src/components/item_tracker/use_item_tracker.jsx +0 -143
- package/src/components/item_tracker/use_item_tracker_demo.html +0 -207
- package/src/components/item_tracker/use_item_tracker_demo.jsx +0 -216
- package/src/components/keyboard_shortcuts/active_keyboard_shortcuts.jsx +0 -87
- package/src/components/keyboard_shortcuts/aria_key_shortcuts.js +0 -61
- package/src/components/keyboard_shortcuts/keyboard_key_meta.js +0 -17
- package/src/components/keyboard_shortcuts/keyboard_shortcuts.js +0 -371
- package/src/components/keyboard_shortcuts/os.js +0 -9
- package/src/components/layout/demos/demo_flex.html +0 -638
- package/src/components/layout/demos/demo_layout_style_buttons.html +0 -351
- package/src/components/layout/demos/demo_layout_style_input.html +0 -226
- package/src/components/layout/demos/demo_layout_style_text.html +0 -514
- package/src/components/layout/flex.jsx +0 -109
- package/src/components/layout/layout_context.jsx +0 -3
- package/src/components/layout/spacing.jsx +0 -20
- package/src/components/layout/use_layout_style.js +0 -249
- package/src/components/link/link.jsx +0 -267
- package/src/components/link/link_with_icon.jsx +0 -52
- package/src/components/loader/loader_background.jsx +0 -372
- package/src/components/loader/loading_spinner.jsx +0 -68
- package/src/components/loader/network_speed.js +0 -83
- package/src/components/loader/rectangle_loading.jsx +0 -244
- package/src/components/props_composition/demos/demo_with_props_style.html +0 -81
- package/src/components/props_composition/with_props_class_name.js +0 -37
- package/src/components/props_composition/with_props_style.js +0 -26
- package/src/components/route.jsx +0 -19
- package/src/components/selection/selection.jsx +0 -1583
- package/src/components/svg/font_sized_svg.jsx +0 -59
- package/src/components/svg/icon_and_text.jsx +0 -21
- package/src/components/svg/svg_mask_overlay.jsx +0 -105
- package/src/components/table/drag/table_drag.jsx +0 -506
- package/src/components/table/resize/table_resize.jsx +0 -650
- package/src/components/table/resize/table_size.js +0 -43
- package/src/components/table/selection/table_selection.js +0 -106
- package/src/components/table/selection/table_selection.jsx +0 -203
- package/src/components/table/sticky/sticky_group.js +0 -354
- package/src/components/table/sticky/table_sticky.js +0 -25
- package/src/components/table/sticky/table_sticky.jsx +0 -501
- package/src/components/table/table.jsx +0 -721
- package/src/components/table/table_css.js +0 -211
- package/src/components/table/table_ui.jsx +0 -49
- package/src/components/table/use_cells_and_columns.js +0 -90
- package/src/components/table/use_object_array_to_cells.js +0 -46
- package/src/components/table/z_indexes.js +0 -23
- package/src/components/tablist/tablist.jsx +0 -99
- package/src/components/text/demos/demo_text_and_icon.html +0 -421
- package/src/components/text/overflow.jsx +0 -15
- package/src/components/text/text.jsx +0 -83
- package/src/components/text/text_and_count.jsx +0 -28
- package/src/components/ui_transition.jsx +0 -128
- package/src/components/use_auto_focus.js +0 -94
- package/src/components/use_batch_during_render.js +0 -33
- package/src/components/use_debounce_true.js +0 -31
- package/src/components/use_dependencies_diff.js +0 -35
- package/src/components/use_focus_group.js +0 -20
- package/src/components/use_initial_value.js +0 -78
- package/src/components/use_is_visited.js +0 -19
- package/src/components/use_ref_array.js +0 -38
- package/src/components/use_signal_sync.js +0 -50
- package/src/components/use_stable_callback.js +0 -68
- package/src/components/use_state_array.js +0 -47
- package/src/docs/actions.md +0 -250
- package/src/docs/demos/resource/action_status.jsx +0 -42
- package/src/docs/demos/resource/demo.md +0 -1
- package/src/docs/demos/resource/resource_demo_0.html +0 -84
- package/src/docs/demos/resource/resource_demo_10_post_gc.html +0 -364
- package/src/docs/demos/resource/resource_demo_11_describe_many.html +0 -362
- package/src/docs/demos/resource/resource_demo_2.html +0 -173
- package/src/docs/demos/resource/resource_demo_3_filtered_users.html +0 -415
- package/src/docs/demos/resource/resource_demo_4_details.html +0 -284
- package/src/docs/demos/resource/resource_demo_5_renderer_lazy.html +0 -115
- package/src/docs/demos/resource/resource_demo_6_gc.html +0 -217
- package/src/docs/demos/resource/resource_demo_7_child_gc.html +0 -240
- package/src/docs/demos/resource/resource_demo_8_proxy_gc.html +0 -319
- package/src/docs/demos/resource/resource_demo_9_describe_one.html +0 -472
- package/src/docs/demos/resource/tata.jsx +0 -3
- package/src/docs/demos/resource/toto.jsx +0 -3
- package/src/docs/demos/user_nav/user_nav.html +0 -12
- package/src/docs/demos/user_nav/user_nav.jsx +0 -330
- package/src/docs/resource_dependencies.md +0 -103
- package/src/docs/resource_with_params.md +0 -80
- package/src/navi_css_vars.js +0 -14
- package/src/notes.md +0 -34
- package/src/route/route.js +0 -596
- package/src/route/route.xtest.html +0 -228
- package/src/store/array_signal_store.js +0 -537
- package/src/store/local_storage_signal.js +0 -17
- package/src/store/resource_graph.js +0 -1304
- package/src/store/tests/resource_graph_autoreload_demo.html +0 -12
- package/src/store/tests/resource_graph_autoreload_demo.jsx +0 -964
- package/src/store/tests/resource_graph_dependencies.test_manual.js +0 -95
- package/src/store/value_in_local_storage.js +0 -187
- package/src/symbol_object_signal.js +0 -1
- package/src/use_action_data.js +0 -10
- package/src/use_action_status.js +0 -47
- package/src/utils/add_many_event_listeners.js +0 -15
- package/src/utils/array_add_remove.js +0 -61
- package/src/utils/array_signal.js +0 -15
- package/src/utils/compare_two_js_values.js +0 -172
- package/src/utils/execute_with_cleanup.js +0 -21
- package/src/utils/get_caller_info.js +0 -85
- package/src/utils/is_signal.js +0 -20
- package/src/utils/js_value_weak_map.js +0 -162
- package/src/utils/js_value_weak_map_demo.html +0 -690
- package/src/utils/merge_two_js_values.js +0 -53
- package/src/utils/stringify_for_display.js +0 -131
- package/src/utils/weak_effect.js +0 -48
- package/src/validation/constraints/confirm_constraint.js +0 -14
- package/src/validation/constraints/create_unique_value_constraint.js +0 -27
- package/src/validation/constraints/native_constraints.js +0 -338
- package/src/validation/constraints/readonly_constraint.js +0 -41
- package/src/validation/constraints/same_as_constraint.js +0 -42
- package/src/validation/constraints/single_space_constraint.js +0 -13
- package/src/validation/custom_constraint_validation.js +0 -793
- package/src/validation/custom_message.js +0 -18
- package/src/validation/demos/browser_style.png +0 -0
- package/src/validation/demos/demo_same_as_constraint.html +0 -259
- package/src/validation/demos/form_validation_demo.html +0 -142
- package/src/validation/demos/form_validation_demo_preact.html +0 -87
- package/src/validation/demos/form_validation_native_popover_demo.html +0 -168
- package/src/validation/demos/form_validation_vs_native_demo.html +0 -172
- package/src/validation/hooks/use_constraints.js +0 -23
- package/src/validation/hooks/use_custom_validation_ref.js +0 -73
- package/src/validation/hooks/use_validation_message.js +0 -19
- package/src/validation/input_change_effect.js +0 -106
|
@@ -1,277 +0,0 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<title>Column Reordering Debug Demo</title>
|
|
5
|
-
<meta charset="utf-8" />
|
|
6
|
-
<link rel="icon" href="data:," />
|
|
7
|
-
<style>
|
|
8
|
-
body {
|
|
9
|
-
font-family: Arial, sans-serif;
|
|
10
|
-
margin: 20px;
|
|
11
|
-
background: #f5f5f5;
|
|
12
|
-
}
|
|
13
|
-
.debug-section {
|
|
14
|
-
background: white;
|
|
15
|
-
padding: 15px;
|
|
16
|
-
margin: 10px 0;
|
|
17
|
-
border-radius: 4px;
|
|
18
|
-
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
|
19
|
-
}
|
|
20
|
-
.controls {
|
|
21
|
-
margin: 10px 0;
|
|
22
|
-
display: flex;
|
|
23
|
-
gap: 10px;
|
|
24
|
-
align-items: center;
|
|
25
|
-
}
|
|
26
|
-
button {
|
|
27
|
-
padding: 8px 16px;
|
|
28
|
-
border: none;
|
|
29
|
-
border-radius: 4px;
|
|
30
|
-
cursor: pointer;
|
|
31
|
-
font-size: 14px;
|
|
32
|
-
}
|
|
33
|
-
.btn-primary {
|
|
34
|
-
background: #007bff;
|
|
35
|
-
color: white;
|
|
36
|
-
}
|
|
37
|
-
.btn-success {
|
|
38
|
-
background: #28a745;
|
|
39
|
-
color: white;
|
|
40
|
-
}
|
|
41
|
-
.btn-warning {
|
|
42
|
-
background: #ffc107;
|
|
43
|
-
color: black;
|
|
44
|
-
}
|
|
45
|
-
.log {
|
|
46
|
-
background: #2d3748;
|
|
47
|
-
color: #68d391;
|
|
48
|
-
padding: 12px;
|
|
49
|
-
border-radius: 4px;
|
|
50
|
-
font-family: "Courier New", monospace;
|
|
51
|
-
font-size: 12px;
|
|
52
|
-
max-height: 300px;
|
|
53
|
-
overflow-y: auto;
|
|
54
|
-
white-space: pre-wrap;
|
|
55
|
-
margin: 10px 0;
|
|
56
|
-
}
|
|
57
|
-
.state-display {
|
|
58
|
-
background: #f7fafc;
|
|
59
|
-
border: 1px solid #e2e8f0;
|
|
60
|
-
border-radius: 4px;
|
|
61
|
-
padding: 12px;
|
|
62
|
-
margin: 10px 0;
|
|
63
|
-
}
|
|
64
|
-
pre {
|
|
65
|
-
margin: 0;
|
|
66
|
-
font-size: 12px;
|
|
67
|
-
}
|
|
68
|
-
</style>
|
|
69
|
-
</head>
|
|
70
|
-
|
|
71
|
-
<body>
|
|
72
|
-
<h1>Column Reordering Debug Demo</h1>
|
|
73
|
-
<p>
|
|
74
|
-
Simple demo with 3 columns and 1 row to debug column reordering issues.
|
|
75
|
-
</p>
|
|
76
|
-
|
|
77
|
-
<div class="debug-section">
|
|
78
|
-
<h2>Debug Log</h2>
|
|
79
|
-
<div id="log" class="log"></div>
|
|
80
|
-
<button onclick="clearLog()" class="btn-warning">Clear Log</button>
|
|
81
|
-
</div>
|
|
82
|
-
|
|
83
|
-
<div class="debug-section">
|
|
84
|
-
<h2>Demo</h2>
|
|
85
|
-
<div id="root"></div>
|
|
86
|
-
</div>
|
|
87
|
-
|
|
88
|
-
<script type="module" jsenv-type="module/jsx">
|
|
89
|
-
import { render } from "preact";
|
|
90
|
-
import { useState } from "preact/hooks";
|
|
91
|
-
/* eslint-disable no-unused-vars */
|
|
92
|
-
import {
|
|
93
|
-
Table,
|
|
94
|
-
Colgroup,
|
|
95
|
-
Col,
|
|
96
|
-
RowNumberCol,
|
|
97
|
-
Thead,
|
|
98
|
-
Tbody,
|
|
99
|
-
Tr,
|
|
100
|
-
TableCell,
|
|
101
|
-
RowNumberTableCell,
|
|
102
|
-
} from "../table/table.jsx";
|
|
103
|
-
/* eslint-enable no-unused-vars */
|
|
104
|
-
import { useCellsAndColumns } from "../table/use_cells_and_columns.js";
|
|
105
|
-
|
|
106
|
-
window.clearLog = () => {
|
|
107
|
-
document.getElementById("log").textContent = "";
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
const log = (message) => {
|
|
111
|
-
const timestamp = new Date().toLocaleTimeString();
|
|
112
|
-
const logElement = document.getElementById("log");
|
|
113
|
-
logElement.textContent += `[${timestamp}] ${message}\n`;
|
|
114
|
-
logElement.scrollTop = logElement.scrollHeight;
|
|
115
|
-
console.log(`[DEBUG] ${message}`);
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
// eslint-disable-next-line no-unused-vars
|
|
119
|
-
const ColumnReorderingDemo = () => {
|
|
120
|
-
// Initial column configuration
|
|
121
|
-
const [columnConfig] = useState([
|
|
122
|
-
{ id: "col1", name: "Column A", backgroundColor: "#ffebee" },
|
|
123
|
-
{ id: "col2", name: "Column B", backgroundColor: "#e8f5e8" },
|
|
124
|
-
{ id: "col3", name: "Column C", backgroundColor: "#e3f2fd" },
|
|
125
|
-
]);
|
|
126
|
-
|
|
127
|
-
// Simple single row of data
|
|
128
|
-
const initialCellData = [["A1", "B1", "C1"]];
|
|
129
|
-
const { cells, setCellValue, columns, setColumnOrder } =
|
|
130
|
-
useCellsAndColumns(initialCellData, columnConfig);
|
|
131
|
-
|
|
132
|
-
// Get current column order for logging and display
|
|
133
|
-
const columnOrderedIds = columns.map((col) => col.id);
|
|
134
|
-
|
|
135
|
-
log(`🎬 Demo render - columnOrder: [${columnOrderedIds.join(", ")}]`);
|
|
136
|
-
|
|
137
|
-
const handleColumnOrderChange = (newColumnOrder) => {
|
|
138
|
-
log(
|
|
139
|
-
`🔄 Column order changing from [${columnOrderedIds.join(", ")}] to [${newColumnOrder.join(", ")}]`,
|
|
140
|
-
);
|
|
141
|
-
setColumnOrder(newColumnOrder);
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
const handleCellEdit = ({ rowIndex, columnIndex }, value) => {
|
|
145
|
-
log(
|
|
146
|
-
`✏️ Cell edit: row=${rowIndex}, col=${columnIndex}, value="${value}"`,
|
|
147
|
-
);
|
|
148
|
-
setCellValue({ rowIndex, columnIndex }, value);
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
// Test buttons for manual reordering
|
|
152
|
-
const moveFirstToLast = () => {
|
|
153
|
-
const newOrder = [
|
|
154
|
-
columnOrderedIds[1],
|
|
155
|
-
columnOrderedIds[2],
|
|
156
|
-
columnOrderedIds[0],
|
|
157
|
-
];
|
|
158
|
-
handleColumnOrderChange(newOrder);
|
|
159
|
-
};
|
|
160
|
-
|
|
161
|
-
const moveLastToFirst = () => {
|
|
162
|
-
const newOrder = [
|
|
163
|
-
columnOrderedIds[2],
|
|
164
|
-
columnOrderedIds[0],
|
|
165
|
-
columnOrderedIds[1],
|
|
166
|
-
];
|
|
167
|
-
handleColumnOrderChange(newOrder);
|
|
168
|
-
};
|
|
169
|
-
|
|
170
|
-
const resetOrder = () => {
|
|
171
|
-
handleColumnOrderChange(["col1", "col2", "col3"]);
|
|
172
|
-
};
|
|
173
|
-
|
|
174
|
-
return (
|
|
175
|
-
<div>
|
|
176
|
-
<div className="controls">
|
|
177
|
-
<button onClick={moveFirstToLast} className="btn-primary">
|
|
178
|
-
Move First → Last
|
|
179
|
-
</button>
|
|
180
|
-
<button onClick={moveLastToFirst} className="btn-primary">
|
|
181
|
-
Move Last → First
|
|
182
|
-
</button>
|
|
183
|
-
<button onClick={resetOrder} className="btn-success">
|
|
184
|
-
Reset Order
|
|
185
|
-
</button>
|
|
186
|
-
</div>
|
|
187
|
-
|
|
188
|
-
<div className="state-display">
|
|
189
|
-
<h3>Current State</h3>
|
|
190
|
-
<div>
|
|
191
|
-
<strong>Column Order:</strong> [{columnOrderedIds.join(", ")}]
|
|
192
|
-
</div>
|
|
193
|
-
<div>
|
|
194
|
-
<strong>Cell Values:</strong>
|
|
195
|
-
</div>
|
|
196
|
-
<pre>{JSON.stringify(cells, null, 2)}</pre>
|
|
197
|
-
</div>
|
|
198
|
-
|
|
199
|
-
<Table
|
|
200
|
-
onColumnOrderChange={handleColumnOrderChange}
|
|
201
|
-
maxWidth={600}
|
|
202
|
-
maxHeight={400}
|
|
203
|
-
>
|
|
204
|
-
<Colgroup>
|
|
205
|
-
<RowNumberCol width={50} />
|
|
206
|
-
{columns.map((col) => {
|
|
207
|
-
log(`🏗️ Rendering Col: id=${col.id}, width=${col?.width}`);
|
|
208
|
-
return (
|
|
209
|
-
<Col
|
|
210
|
-
key={col.id}
|
|
211
|
-
id={col.id}
|
|
212
|
-
width={col?.width}
|
|
213
|
-
backgroundColor={col.backgroundColor}
|
|
214
|
-
/>
|
|
215
|
-
);
|
|
216
|
-
})}
|
|
217
|
-
</Colgroup>
|
|
218
|
-
|
|
219
|
-
<Thead>
|
|
220
|
-
<Tr>
|
|
221
|
-
<RowNumberTableCell />
|
|
222
|
-
{columns.map((col) => {
|
|
223
|
-
log(`🏗️ Rendering Header: id=${col.id}, name=${col?.name}`);
|
|
224
|
-
const rowId = "header";
|
|
225
|
-
const columnId = col.id;
|
|
226
|
-
const tableCellKey = `${columnId}-${rowId}`;
|
|
227
|
-
return (
|
|
228
|
-
<TableCell key={tableCellKey}>
|
|
229
|
-
{col?.name} (id: {col.id})
|
|
230
|
-
</TableCell>
|
|
231
|
-
);
|
|
232
|
-
})}
|
|
233
|
-
</Tr>
|
|
234
|
-
</Thead>
|
|
235
|
-
|
|
236
|
-
<Tbody>
|
|
237
|
-
{cells.map((rowValues, rowIndex) => (
|
|
238
|
-
<Tr key={rowIndex}>
|
|
239
|
-
<RowNumberTableCell />
|
|
240
|
-
{rowValues.map((cellValue, columnIndex) => {
|
|
241
|
-
log(
|
|
242
|
-
`🏗️ Rendering Cell: rowIndex=${rowIndex}, columnIndex=${columnIndex}, value="${cellValue}"`,
|
|
243
|
-
);
|
|
244
|
-
const rowId = rowIndex;
|
|
245
|
-
const columnId = columns[columnIndex].id;
|
|
246
|
-
// const tableCellKey = columnId;
|
|
247
|
-
const tableCellKey = `${columnId}-${rowId}`;
|
|
248
|
-
return (
|
|
249
|
-
<TableCell
|
|
250
|
-
key={tableCellKey}
|
|
251
|
-
action={(value) =>
|
|
252
|
-
handleCellEdit({ rowIndex, columnIndex }, value)
|
|
253
|
-
}
|
|
254
|
-
>
|
|
255
|
-
{cellValue}
|
|
256
|
-
</TableCell>
|
|
257
|
-
);
|
|
258
|
-
})}
|
|
259
|
-
</Tr>
|
|
260
|
-
))}
|
|
261
|
-
</Tbody>
|
|
262
|
-
</Table>
|
|
263
|
-
|
|
264
|
-
<div className="state-display">
|
|
265
|
-
<h3>Column Configuration</h3>
|
|
266
|
-
<pre>{JSON.stringify(columnConfig, null, 2)}</pre>
|
|
267
|
-
</div>
|
|
268
|
-
</div>
|
|
269
|
-
);
|
|
270
|
-
};
|
|
271
|
-
|
|
272
|
-
// Initial render
|
|
273
|
-
log("🚀 Starting Column Reordering Demo");
|
|
274
|
-
render(<ColumnReorderingDemo />, document.getElementById("root"));
|
|
275
|
-
</script>
|
|
276
|
-
</body>
|
|
277
|
-
</html>
|
|
@@ -1,432 +0,0 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<title>Table Selection Debug Demo</title>
|
|
5
|
-
<meta charset="utf-8" />
|
|
6
|
-
<link rel="icon" href="data:," />
|
|
7
|
-
<style>
|
|
8
|
-
body {
|
|
9
|
-
font-family: Arial, sans-serif;
|
|
10
|
-
margin: 20px;
|
|
11
|
-
background: #f5f5f5;
|
|
12
|
-
}
|
|
13
|
-
.debug-section {
|
|
14
|
-
background: white;
|
|
15
|
-
padding: 15px;
|
|
16
|
-
margin: 10px 0;
|
|
17
|
-
border-radius: 4px;
|
|
18
|
-
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
|
19
|
-
}
|
|
20
|
-
.controls {
|
|
21
|
-
margin: 10px 0;
|
|
22
|
-
display: flex;
|
|
23
|
-
gap: 10px;
|
|
24
|
-
align-items: center;
|
|
25
|
-
flex-wrap: wrap;
|
|
26
|
-
}
|
|
27
|
-
button {
|
|
28
|
-
padding: 8px 16px;
|
|
29
|
-
border: none;
|
|
30
|
-
border-radius: 4px;
|
|
31
|
-
cursor: pointer;
|
|
32
|
-
font-size: 14px;
|
|
33
|
-
}
|
|
34
|
-
.btn-primary {
|
|
35
|
-
background: #007bff;
|
|
36
|
-
color: white;
|
|
37
|
-
}
|
|
38
|
-
.btn-success {
|
|
39
|
-
background: #28a745;
|
|
40
|
-
color: white;
|
|
41
|
-
}
|
|
42
|
-
.btn-warning {
|
|
43
|
-
background: #ffc107;
|
|
44
|
-
color: black;
|
|
45
|
-
}
|
|
46
|
-
.btn-danger {
|
|
47
|
-
background: #dc3545;
|
|
48
|
-
color: white;
|
|
49
|
-
}
|
|
50
|
-
.log {
|
|
51
|
-
background: #2d3748;
|
|
52
|
-
color: #68d391;
|
|
53
|
-
padding: 12px;
|
|
54
|
-
border-radius: 4px;
|
|
55
|
-
font-family: "Courier New", monospace;
|
|
56
|
-
font-size: 12px;
|
|
57
|
-
max-height: 300px;
|
|
58
|
-
overflow-y: auto;
|
|
59
|
-
white-space: pre-wrap;
|
|
60
|
-
margin: 10px 0;
|
|
61
|
-
}
|
|
62
|
-
.state-display {
|
|
63
|
-
background: #f7fafc;
|
|
64
|
-
border: 1px solid #e2e8f0;
|
|
65
|
-
border-radius: 4px;
|
|
66
|
-
padding: 12px;
|
|
67
|
-
margin: 10px 0;
|
|
68
|
-
}
|
|
69
|
-
pre {
|
|
70
|
-
margin: 0;
|
|
71
|
-
font-size: 12px;
|
|
72
|
-
}
|
|
73
|
-
.selection-info {
|
|
74
|
-
background: #fff3cd;
|
|
75
|
-
border: 1px solid #ffeeba;
|
|
76
|
-
border-radius: 4px;
|
|
77
|
-
padding: 10px;
|
|
78
|
-
margin: 10px 0;
|
|
79
|
-
}
|
|
80
|
-
.coordinate-buttons {
|
|
81
|
-
display: grid;
|
|
82
|
-
grid-template-columns: repeat(3, 1fr);
|
|
83
|
-
gap: 5px;
|
|
84
|
-
max-width: 250px;
|
|
85
|
-
}
|
|
86
|
-
.coord-label {
|
|
87
|
-
font-weight: bold;
|
|
88
|
-
text-align: center;
|
|
89
|
-
background: #e9ecef;
|
|
90
|
-
padding: 5px;
|
|
91
|
-
border-radius: 3px;
|
|
92
|
-
}
|
|
93
|
-
</style>
|
|
94
|
-
</head>
|
|
95
|
-
|
|
96
|
-
<body>
|
|
97
|
-
<h1>Table Selection Debug Demo</h1>
|
|
98
|
-
<p>Simple 2x2 table to debug selection behavior and external control.</p>
|
|
99
|
-
|
|
100
|
-
<div class="debug-section">
|
|
101
|
-
<h2>External Selection Controls</h2>
|
|
102
|
-
<div class="controls">
|
|
103
|
-
<button id="select-none" class="btn-danger">Clear Selection</button>
|
|
104
|
-
<button id="select-all" class="btn-primary">Select All</button>
|
|
105
|
-
<button id="select-row-0" class="btn-primary">Select Row 0</button>
|
|
106
|
-
<button id="select-row-1" class="btn-primary">Select Row 1</button>
|
|
107
|
-
<button id="select-col-0" class="btn-primary">Select Column 0</button>
|
|
108
|
-
<button id="select-col-1" class="btn-primary">Select Column 1</button>
|
|
109
|
-
</div>
|
|
110
|
-
|
|
111
|
-
<h3>Select Individual Cells</h3>
|
|
112
|
-
<div class="coordinate-buttons">
|
|
113
|
-
<button id="select-header-rownumber" class="btn-success">Row#</button>
|
|
114
|
-
<button id="select-header-0" class="btn-success">H(0)</button>
|
|
115
|
-
<button id="select-header-1" class="btn-success">H(1)</button>
|
|
116
|
-
<button id="select-rownumber-0" class="btn-success">R#1</button>
|
|
117
|
-
<button id="select-0-0" class="btn-success">(1,1)</button>
|
|
118
|
-
<button id="select-0-1" class="btn-success">(1,2)</button>
|
|
119
|
-
<button id="select-rownumber-1" class="btn-success">R#2</button>
|
|
120
|
-
<button id="select-1-0" class="btn-success">(2,1)</button>
|
|
121
|
-
<button id="select-1-1" class="btn-success">(2,2)</button>
|
|
122
|
-
</div>
|
|
123
|
-
</div>
|
|
124
|
-
|
|
125
|
-
<div class="debug-section">
|
|
126
|
-
<h2>Demo Table (2x2)</h2>
|
|
127
|
-
<div id="root"></div>
|
|
128
|
-
</div>
|
|
129
|
-
|
|
130
|
-
<div class="debug-section">
|
|
131
|
-
<h2>Selection State</h2>
|
|
132
|
-
<div id="selection-state" class="selection-info">
|
|
133
|
-
No selection data yet...
|
|
134
|
-
</div>
|
|
135
|
-
</div>
|
|
136
|
-
|
|
137
|
-
<div class="debug-section">
|
|
138
|
-
<h2>Debug Log</h2>
|
|
139
|
-
<div id="log" class="log"></div>
|
|
140
|
-
<button onclick="clearLog()" class="btn-warning">Clear Log</button>
|
|
141
|
-
</div>
|
|
142
|
-
|
|
143
|
-
<script type="module" jsenv-type="module/jsx">
|
|
144
|
-
import { render } from "preact";
|
|
145
|
-
import { useState, useEffect } from "preact/hooks";
|
|
146
|
-
/* eslint-disable no-unused-vars */
|
|
147
|
-
import {
|
|
148
|
-
Table,
|
|
149
|
-
Colgroup,
|
|
150
|
-
Col,
|
|
151
|
-
RowNumberCol,
|
|
152
|
-
Thead,
|
|
153
|
-
Tbody,
|
|
154
|
-
Tr,
|
|
155
|
-
TableCell,
|
|
156
|
-
RowNumberTableCell,
|
|
157
|
-
} from "../table/table.jsx";
|
|
158
|
-
/* eslint-enable no-unused-vars */
|
|
159
|
-
import { useCellsAndColumns } from "../table/use_cells_and_columns.js";
|
|
160
|
-
import {
|
|
161
|
-
stringifyTableSelectionValue,
|
|
162
|
-
isCellSelected,
|
|
163
|
-
} from "../table/selection/table_selection.js";
|
|
164
|
-
|
|
165
|
-
window.clearLog = () => {
|
|
166
|
-
document.getElementById("log").textContent = "";
|
|
167
|
-
};
|
|
168
|
-
|
|
169
|
-
const log = (message) => {
|
|
170
|
-
const timestamp = new Date().toLocaleTimeString();
|
|
171
|
-
const logElement = document.getElementById("log");
|
|
172
|
-
logElement.textContent += `[${timestamp}] ${message}\n`;
|
|
173
|
-
logElement.scrollTop = logElement.scrollHeight;
|
|
174
|
-
console.log(`[DEBUG] ${message}`);
|
|
175
|
-
};
|
|
176
|
-
|
|
177
|
-
const updateSelectionDisplay = (selection) => {
|
|
178
|
-
const selectionElement = document.getElementById("selection-state");
|
|
179
|
-
if (!selection || selection.size === 0) {
|
|
180
|
-
selectionElement.innerHTML = "<strong>No selection</strong>";
|
|
181
|
-
return;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
const selectionArray = Array.from(selection);
|
|
185
|
-
const cellSelections = [];
|
|
186
|
-
const rowSelections = [];
|
|
187
|
-
const columnSelections = [];
|
|
188
|
-
|
|
189
|
-
selectionArray.forEach((item) => {
|
|
190
|
-
if (item.startsWith("row:")) {
|
|
191
|
-
rowSelections.push(item.slice(4));
|
|
192
|
-
} else if (item.startsWith("column:")) {
|
|
193
|
-
columnSelections.push(item.slice(7));
|
|
194
|
-
} else {
|
|
195
|
-
cellSelections.push(`(${item})`);
|
|
196
|
-
}
|
|
197
|
-
});
|
|
198
|
-
|
|
199
|
-
let displayParts = [];
|
|
200
|
-
if (cellSelections.length > 0)
|
|
201
|
-
displayParts.push(`Cells: ${cellSelections.join(", ")}`);
|
|
202
|
-
if (rowSelections.length > 0)
|
|
203
|
-
displayParts.push(`Rows: ${rowSelections.join(", ")}`);
|
|
204
|
-
if (columnSelections.length > 0)
|
|
205
|
-
displayParts.push(`Columns: ${columnSelections.join(", ")}`);
|
|
206
|
-
|
|
207
|
-
selectionElement.innerHTML = `
|
|
208
|
-
<strong>Selection:</strong> ${displayParts.join(" | ")}<br>
|
|
209
|
-
<strong>Total count:</strong> ${selection.size}<br>
|
|
210
|
-
<strong>Raw values:</strong> ${selectionArray.join(", ")}
|
|
211
|
-
`;
|
|
212
|
-
};
|
|
213
|
-
|
|
214
|
-
// eslint-disable-next-line no-unused-vars
|
|
215
|
-
const TableSelectionDemo = () => {
|
|
216
|
-
// Simple 2x2 table configuration
|
|
217
|
-
const [columnConfig] = useState([
|
|
218
|
-
{ id: "col1", name: "Column A" },
|
|
219
|
-
{ id: "col2", name: "Column B" },
|
|
220
|
-
]);
|
|
221
|
-
|
|
222
|
-
// 2x2 cell data
|
|
223
|
-
const initialCellData = [
|
|
224
|
-
["A1", "B1"],
|
|
225
|
-
["A2", "B2"],
|
|
226
|
-
];
|
|
227
|
-
|
|
228
|
-
const { cells, setCellValue, columns } = useCellsAndColumns(
|
|
229
|
-
initialCellData,
|
|
230
|
-
columnConfig,
|
|
231
|
-
);
|
|
232
|
-
|
|
233
|
-
// Selection state (controlled from outside)
|
|
234
|
-
const [selectedCells, setSelectedCells] = useState([]);
|
|
235
|
-
|
|
236
|
-
// Log selection changes
|
|
237
|
-
useEffect(() => {
|
|
238
|
-
log(
|
|
239
|
-
`🎯 Selection changed: ${Array.from(selectedCells).join(", ") || "none"}`,
|
|
240
|
-
);
|
|
241
|
-
updateSelectionDisplay(selectedCells);
|
|
242
|
-
}, [selectedCells]);
|
|
243
|
-
|
|
244
|
-
const handleCellEdit = ({ rowIndex, columnIndex }, value) => {
|
|
245
|
-
log(
|
|
246
|
-
`✏️ Cell edit: row=${rowIndex}, col=${columnIndex}, value="${value}"`,
|
|
247
|
-
);
|
|
248
|
-
setCellValue({ rowIndex, columnIndex }, value);
|
|
249
|
-
};
|
|
250
|
-
|
|
251
|
-
const handleSelectionChange = (newSelection) => {
|
|
252
|
-
log(`🔄 Selection changing from internal table interaction`);
|
|
253
|
-
setSelectedCells(newSelection);
|
|
254
|
-
};
|
|
255
|
-
|
|
256
|
-
// External control functions
|
|
257
|
-
const selectNone = () => {
|
|
258
|
-
log(`🚫 External: Clear selection`);
|
|
259
|
-
setSelectedCells([]);
|
|
260
|
-
};
|
|
261
|
-
|
|
262
|
-
const selectAll = () => {
|
|
263
|
-
log(`📱 External: Select all cells`);
|
|
264
|
-
const allCells = [
|
|
265
|
-
stringifyTableSelectionValue("cell", {
|
|
266
|
-
rowIndex: 0,
|
|
267
|
-
columnIndex: 0,
|
|
268
|
-
}),
|
|
269
|
-
stringifyTableSelectionValue("cell", {
|
|
270
|
-
rowIndex: 0,
|
|
271
|
-
columnIndex: 1,
|
|
272
|
-
}),
|
|
273
|
-
stringifyTableSelectionValue("cell", {
|
|
274
|
-
rowIndex: 1,
|
|
275
|
-
columnIndex: 0,
|
|
276
|
-
}),
|
|
277
|
-
stringifyTableSelectionValue("cell", {
|
|
278
|
-
rowIndex: 1,
|
|
279
|
-
columnIndex: 1,
|
|
280
|
-
}),
|
|
281
|
-
];
|
|
282
|
-
setSelectedCells(allCells);
|
|
283
|
-
};
|
|
284
|
-
|
|
285
|
-
const selectRow = (rowIndex) => {
|
|
286
|
-
log(`📏 External: Select row ${rowIndex}`);
|
|
287
|
-
const rowValue = stringifyTableSelectionValue("row", rowIndex);
|
|
288
|
-
setSelectedCells([rowValue]);
|
|
289
|
-
};
|
|
290
|
-
|
|
291
|
-
const selectColumn = (columnIndex) => {
|
|
292
|
-
log(`📐 External: Select column ${columnIndex}`);
|
|
293
|
-
const columnValue = stringifyTableSelectionValue(
|
|
294
|
-
"column",
|
|
295
|
-
columnIndex,
|
|
296
|
-
);
|
|
297
|
-
setSelectedCells([columnValue]);
|
|
298
|
-
};
|
|
299
|
-
|
|
300
|
-
const selectCell = (rowIndex, columnIndex) => {
|
|
301
|
-
log(`🎯 External: Select single cell (${rowIndex},${columnIndex})`);
|
|
302
|
-
const cellValue = stringifyTableSelectionValue("cell", {
|
|
303
|
-
rowIndex,
|
|
304
|
-
columnIndex,
|
|
305
|
-
});
|
|
306
|
-
setSelectedCells([cellValue]);
|
|
307
|
-
};
|
|
308
|
-
|
|
309
|
-
const selectHeaderCell = (columnIndex) => {
|
|
310
|
-
log(`📋 External: Select header cell for column ${columnIndex}`);
|
|
311
|
-
// Headers are at row index -1 in the visual table
|
|
312
|
-
const headerValue = stringifyTableSelectionValue("cell", {
|
|
313
|
-
rowIndex: 0,
|
|
314
|
-
columnIndex,
|
|
315
|
-
});
|
|
316
|
-
setSelectedCells([headerValue]);
|
|
317
|
-
};
|
|
318
|
-
|
|
319
|
-
const selectRowNumberCell = (rowIndex) => {
|
|
320
|
-
log(`🔢 External: Select row number cell for row ${rowIndex}`);
|
|
321
|
-
// Row numbers are at column index -1 in the visual table
|
|
322
|
-
const rowNumberValue = stringifyTableSelectionValue("cell", {
|
|
323
|
-
rowIndex,
|
|
324
|
-
columnIndex: 0,
|
|
325
|
-
});
|
|
326
|
-
setSelectedCells([rowNumberValue]);
|
|
327
|
-
};
|
|
328
|
-
|
|
329
|
-
const selectHeaderRowNumberCell = () => {
|
|
330
|
-
log(`🏠 External: Select header row number cell`);
|
|
331
|
-
// Corner cell is at (-1, -1) in the visual table
|
|
332
|
-
const cornerValue = stringifyTableSelectionValue("cell", {
|
|
333
|
-
rowIndex: 0,
|
|
334
|
-
columnIndex: 0,
|
|
335
|
-
});
|
|
336
|
-
setSelectedCells([cornerValue]);
|
|
337
|
-
};
|
|
338
|
-
|
|
339
|
-
// Setup external control button handlers
|
|
340
|
-
useEffect(() => {
|
|
341
|
-
const setupButton = (id, handler) => {
|
|
342
|
-
const button = document.getElementById(id);
|
|
343
|
-
if (button) {
|
|
344
|
-
button.onclick = handler;
|
|
345
|
-
}
|
|
346
|
-
};
|
|
347
|
-
|
|
348
|
-
setupButton("select-none", selectNone);
|
|
349
|
-
setupButton("select-all", selectAll);
|
|
350
|
-
setupButton("select-row-0", () => selectRow(0));
|
|
351
|
-
setupButton("select-row-1", () => selectRow(1));
|
|
352
|
-
setupButton("select-col-0", () => selectColumn(0));
|
|
353
|
-
setupButton("select-col-1", () => selectColumn(1));
|
|
354
|
-
setupButton("select-0-0", () => selectCell(1, 1));
|
|
355
|
-
setupButton("select-0-1", () => selectCell(1, 2));
|
|
356
|
-
setupButton("select-1-0", () => selectCell(2, 1));
|
|
357
|
-
setupButton("select-1-1", () => selectCell(2, 2));
|
|
358
|
-
// Header cells: visual column 0 and 1 at header row -1
|
|
359
|
-
setupButton("select-header-rownumber", selectHeaderRowNumberCell);
|
|
360
|
-
setupButton("select-header-0", () => selectHeaderCell(1));
|
|
361
|
-
setupButton("select-header-1", () => selectHeaderCell(2));
|
|
362
|
-
// Row number cells: visual row 0 and 1 at row number column -1
|
|
363
|
-
setupButton("select-rownumber-0", () => selectRowNumberCell(1));
|
|
364
|
-
setupButton("select-rownumber-1", () => selectRowNumberCell(2));
|
|
365
|
-
}, []);
|
|
366
|
-
|
|
367
|
-
log(`🎬 Demo render - cells: ${cells.length}x${cells[0]?.length}`);
|
|
368
|
-
|
|
369
|
-
return (
|
|
370
|
-
<div>
|
|
371
|
-
<Table
|
|
372
|
-
selection={selectedCells}
|
|
373
|
-
onSelectionChange={handleSelectionChange}
|
|
374
|
-
maxWidth={400}
|
|
375
|
-
maxHeight={300}
|
|
376
|
-
>
|
|
377
|
-
<Colgroup>
|
|
378
|
-
<RowNumberCol width={60} />
|
|
379
|
-
{columns.map((col) => {
|
|
380
|
-
log(`🏗️ Rendering Col: id=${col.id}`);
|
|
381
|
-
return <Col key={col.id} id={col.id} width={120} />;
|
|
382
|
-
})}
|
|
383
|
-
</Colgroup>
|
|
384
|
-
|
|
385
|
-
<Thead>
|
|
386
|
-
<Tr>
|
|
387
|
-
<RowNumberTableCell />
|
|
388
|
-
{columns.map((col) => {
|
|
389
|
-
log(`🏗️ Rendering Header: id=${col.id}, name=${col?.name}`);
|
|
390
|
-
return <TableCell key={col.id}>{col?.name}</TableCell>;
|
|
391
|
-
})}
|
|
392
|
-
</Tr>
|
|
393
|
-
</Thead>
|
|
394
|
-
|
|
395
|
-
<Tbody>
|
|
396
|
-
{cells.map((rowValues, rowIndex) => (
|
|
397
|
-
<Tr key={rowIndex}>
|
|
398
|
-
<RowNumberTableCell />
|
|
399
|
-
{rowValues.map((cellValue, columnIndex) => {
|
|
400
|
-
const isSelected = isCellSelected(selectedCells, {
|
|
401
|
-
rowIndex,
|
|
402
|
-
columnIndex,
|
|
403
|
-
});
|
|
404
|
-
log(
|
|
405
|
-
`🏗️ Rendering Cell: (${rowIndex},${columnIndex}) value="${cellValue}" selected=${isSelected}`,
|
|
406
|
-
);
|
|
407
|
-
return (
|
|
408
|
-
<TableCell
|
|
409
|
-
key={columnIndex}
|
|
410
|
-
action={(value) =>
|
|
411
|
-
handleCellEdit({ rowIndex, columnIndex }, value)
|
|
412
|
-
}
|
|
413
|
-
backgroundColor="yellow"
|
|
414
|
-
>
|
|
415
|
-
{cellValue}
|
|
416
|
-
</TableCell>
|
|
417
|
-
);
|
|
418
|
-
})}
|
|
419
|
-
</Tr>
|
|
420
|
-
))}
|
|
421
|
-
</Tbody>
|
|
422
|
-
</Table>
|
|
423
|
-
</div>
|
|
424
|
-
);
|
|
425
|
-
};
|
|
426
|
-
|
|
427
|
-
// Initial render
|
|
428
|
-
log("🚀 Starting Table Selection Demo");
|
|
429
|
-
render(<TableSelectionDemo />, document.getElementById("root"));
|
|
430
|
-
</script>
|
|
431
|
-
</body>
|
|
432
|
-
</html>
|