@gradio/dataframe 0.18.4 → 0.18.6

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 CHANGED
@@ -1,5 +1,19 @@
1
1
  # @gradio/dataframe
2
2
 
3
+ ## 0.18.6
4
+
5
+ ### Features
6
+
7
+ - [#11688](https://github.com/gradio-app/gradio/pull/11688) [`56f3f09`](https://github.com/gradio-app/gradio/commit/56f3f09b6c629a5719088806dbbb37f272d8d4f5) - Fix column header logic in gr.Dataframe. Thanks @hannahblair!
8
+
9
+ ## 0.18.5
10
+
11
+ ### Dependency updates
12
+
13
+ - @gradio/upload@0.16.13
14
+ - @gradio/client@1.16.0
15
+ - @gradio/button@0.5.9
16
+
3
17
  ## 0.18.4
4
18
 
5
19
  ### Fixes
@@ -839,3 +839,37 @@
839
839
  column_widths: ["200px", "200px", "200px"]
840
840
  }}
841
841
  />
842
+
843
+ <Story
844
+ name="Dataframe column addition test"
845
+ args={{
846
+ values: [
847
+ ["Alice", 25],
848
+ ["Bob", 30],
849
+ ["Carol", 22]
850
+ ],
851
+ headers: ["Name", "Age"],
852
+ label: "Column Addition Test",
853
+ col_count: [2, "dynamic"],
854
+ row_count: [3, "dynamic"],
855
+ editable: true
856
+ }}
857
+ play={async ({ canvasElement }) => {
858
+ const canvas = within(canvasElement);
859
+ const user = userEvent.setup();
860
+
861
+ const header_menu_button = canvas.getAllByLabelText("Open cell menu")[0];
862
+ await user.click(header_menu_button);
863
+
864
+ const add_column_button = canvas.getByText("Add column to the right");
865
+ await user.click(add_column_button);
866
+
867
+ const new_header = canvas.getAllByText("Header 3")[0];
868
+ await user.keyboard("{Enter}");
869
+
870
+ const input = canvas.getByRole("textbox");
871
+ await user.clear(input);
872
+ await user.type(input, "New Column");
873
+ await user.keyboard("{Enter}");
874
+ }}
875
+ />
@@ -20,9 +20,7 @@ function create_actions(state, context) {
20
20
  return new_data;
21
21
  };
22
22
  const add_col = (data, headers, make_id, index) => {
23
- const new_headers = context.headers
24
- ? [...headers.map((h) => context.headers[headers.indexOf(h)].value)]
25
- : [...headers, `Header ${headers.length + 1}`];
23
+ const new_headers = [...headers, `Header ${headers.length + 1}`];
26
24
  const new_data = data.map((row) => [...row, { value: "", id: make_id() }]);
27
25
  if (index !== undefined) {
28
26
  new_headers.splice(index, 0, new_headers.pop());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradio/dataframe",
3
- "version": "0.18.4",
3
+ "version": "0.18.6",
4
4
  "description": "Gradio UI packages",
5
5
  "type": "module",
6
6
  "author": "",
@@ -18,14 +18,14 @@
18
18
  "katex": "^0.16.7",
19
19
  "marked": "^12.0.0",
20
20
  "@gradio/atoms": "^0.16.3",
21
+ "@gradio/button": "^0.5.9",
21
22
  "@gradio/checkbox": "^0.4.26",
22
- "@gradio/button": "^0.5.8",
23
- "@gradio/client": "^1.15.7",
24
- "@gradio/icons": "^0.12.0",
23
+ "@gradio/client": "^1.16.0",
25
24
  "@gradio/markdown-code": "^0.5.0",
26
25
  "@gradio/statustracker": "^0.10.15",
27
- "@gradio/upload": "^0.16.12",
28
- "@gradio/utils": "^0.10.2"
26
+ "@gradio/upload": "^0.16.13",
27
+ "@gradio/utils": "^0.10.2",
28
+ "@gradio/icons": "^0.12.0"
29
29
  },
30
30
  "exports": {
31
31
  ".": {
@@ -220,9 +220,7 @@ function create_actions(
220
220
  make_id: () => string,
221
221
  index?: number
222
222
  ): { data: any[][]; headers: string[] } => {
223
- const new_headers = context.headers
224
- ? [...headers.map((h) => context.headers![headers.indexOf(h)].value)]
225
- : [...headers, `Header ${headers.length + 1}`];
223
+ const new_headers = [...headers, `Header ${headers.length + 1}`];
226
224
  const new_data = data.map((row) => [...row, { value: "", id: make_id() }]);
227
225
  if (index !== undefined) {
228
226
  new_headers.splice(index, 0, new_headers.pop()!);