@gradio/dataframe 0.17.5 → 0.17.7

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,31 @@
1
1
  # @gradio/dataframe
2
2
 
3
+ ## 0.17.7
4
+
5
+ ### Fixes
6
+
7
+ - [#11005](https://github.com/gradio-app/gradio/pull/11005) [`3def0ed`](https://github.com/gradio-app/gradio/commit/3def0ed9edc5a9194d69456948324ec4e2740b7d) - Ensure that the `.select()` event in `gr.DataFrame` carries the `.row_value` and `.col_value`. Thanks @abidlabs!
8
+
9
+ ### Dependency updates
10
+
11
+ - @gradio/statustracker@0.10.9
12
+ - @gradio/atoms@0.15.2
13
+ - @gradio/client@1.14.2
14
+ - @gradio/markdown-code@0.4.3
15
+ - @gradio/utils@0.10.2
16
+ - @gradio/button@0.4.15
17
+ - @gradio/upload@0.16.2
18
+
19
+ ## 0.17.6
20
+
21
+ ### Dependency updates
22
+
23
+ - @gradio/button@0.4.14
24
+ - @gradio/upload@0.16.1
25
+ - @gradio/atoms@0.15.1
26
+ - @gradio/statustracker@0.10.8
27
+ - @gradio/icons@0.12.0
28
+
3
29
  ## 0.17.5
4
30
 
5
31
  ### Fixes
@@ -95,6 +95,8 @@ $:
95
95
  onMount(() => {
96
96
  df_ctx.parent_element = parent;
97
97
  df_ctx.get_data_at = get_data_at;
98
+ df_ctx.get_column = get_column;
99
+ df_ctx.get_row = get_row;
98
100
  df_ctx.dispatch = dispatch;
99
101
  init_drag_handlers();
100
102
  const observer = new IntersectionObserver((entries) => {
@@ -146,6 +148,8 @@ onMount(() => {
146
148
  );
147
149
  });
148
150
  const get_data_at = (row, col) => data?.[row]?.[col]?.value;
151
+ const get_column = (col) => data?.map((row) => row[col]?.value) ?? [];
152
+ const get_row = (row) => data?.[row]?.map((cell) => cell.value) ?? [];
149
153
  $: {
150
154
  if (!dequal(headers, old_headers)) {
151
155
  _headers = make_headers(headers, col_count, els, make_id);
@@ -140,6 +140,8 @@ export interface DataFrameContext {
140
140
  }>;
141
141
  parent_element?: HTMLElement;
142
142
  get_data_at?: (row: number, col: number) => string | number;
143
+ get_column?: (col: number) => (string | number)[];
144
+ get_row?: (row: number) => (string | number)[];
143
145
  dispatch?: (e: "change" | "select" | "search", detail?: any) => void;
144
146
  }
145
147
  export declare function create_dataframe_context(config: DataFrameState["config"]): DataFrameContext;
@@ -237,6 +237,8 @@ function create_actions(state, context) {
237
237
  }
238
238
  context.dispatch?.("select", {
239
239
  index: [actual_row, col],
240
+ col_value: context.get_column(col),
241
+ row_value: context.get_row(actual_row),
240
242
  value: context.get_data_at(actual_row, col)
241
243
  });
242
244
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradio/dataframe",
3
- "version": "0.17.5",
3
+ "version": "0.17.7",
4
4
  "description": "Gradio UI packages",
5
5
  "type": "module",
6
6
  "author": "",
@@ -17,14 +17,14 @@
17
17
  "dompurify": "^3.0.3",
18
18
  "katex": "^0.16.7",
19
19
  "marked": "^12.0.0",
20
- "@gradio/atoms": "^0.15.0",
21
- "@gradio/button": "^0.4.13",
22
- "@gradio/icons": "^0.11.0",
23
- "@gradio/markdown-code": "^0.4.2",
24
- "@gradio/client": "^1.14.1",
25
- "@gradio/statustracker": "^0.10.7",
26
- "@gradio/upload": "^0.16.0",
27
- "@gradio/utils": "^0.10.1"
20
+ "@gradio/button": "^0.4.15",
21
+ "@gradio/icons": "^0.12.0",
22
+ "@gradio/atoms": "^0.15.2",
23
+ "@gradio/client": "^1.14.2",
24
+ "@gradio/markdown-code": "^0.4.3",
25
+ "@gradio/upload": "^0.16.2",
26
+ "@gradio/utils": "^0.10.2",
27
+ "@gradio/statustracker": "^0.10.9"
28
28
  },
29
29
  "exports": {
30
30
  ".": {
@@ -111,6 +111,8 @@
111
111
  onMount(() => {
112
112
  df_ctx.parent_element = parent;
113
113
  df_ctx.get_data_at = get_data_at;
114
+ df_ctx.get_column = get_column;
115
+ df_ctx.get_row = get_row;
114
116
  df_ctx.dispatch = dispatch;
115
117
  init_drag_handlers();
116
118
 
@@ -186,6 +188,12 @@
186
188
  const get_data_at = (row: number, col: number): string | number =>
187
189
  data?.[row]?.[col]?.value;
188
190
 
191
+ const get_column = (col: number): (string | number)[] =>
192
+ data?.map((row) => row[col]?.value) ?? [];
193
+
194
+ const get_row = (row: number): (string | number)[] =>
195
+ data?.[row]?.map((cell) => cell.value) ?? [];
196
+
189
197
  $: {
190
198
  if (!dequal(headers, old_headers)) {
191
199
  _headers = make_headers(headers, col_count, els, make_id);
@@ -155,6 +155,8 @@ export interface DataFrameContext {
155
155
  >;
156
156
  parent_element?: HTMLElement;
157
157
  get_data_at?: (row: number, col: number) => string | number;
158
+ get_column?: (col: number) => (string | number)[];
159
+ get_row?: (row: number) => (string | number)[];
158
160
  dispatch?: (e: "change" | "select" | "search", detail?: any) => void;
159
161
  }
160
162
 
@@ -467,6 +469,8 @@ function create_actions(
467
469
 
468
470
  context.dispatch?.("select", {
469
471
  index: [actual_row, col],
472
+ col_value: context.get_column!(col),
473
+ row_value: context.get_row!(actual_row),
470
474
  value: context.get_data_at!(actual_row, col)
471
475
  });
472
476
  },