@perspective-dev/viewer 5.6.0 → 5.6.1

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.
Files changed (72) hide show
  1. package/dist/cdn/perspective-viewer.js +9 -9
  2. package/dist/cdn/perspective-viewer.js.map +4 -4
  3. package/dist/css/blueprint.css +1 -1
  4. package/dist/css/botanical.css +1 -1
  5. package/dist/css/dracula.css +1 -1
  6. package/dist/css/eggplant.css +1 -1
  7. package/dist/css/gruvbox-dark.css +1 -1
  8. package/dist/css/gruvbox.css +1 -1
  9. package/dist/css/intl/ar.css +1 -1
  10. package/dist/css/intl/de.css +1 -1
  11. package/dist/css/intl/es.css +1 -1
  12. package/dist/css/intl/fr.css +1 -1
  13. package/dist/css/intl/ja.css +1 -1
  14. package/dist/css/intl/pt.css +1 -1
  15. package/dist/css/intl/zh.css +1 -1
  16. package/dist/css/intl.css +1 -1
  17. package/dist/css/ledger.css +1 -1
  18. package/dist/css/monokai.css +1 -1
  19. package/dist/css/nord.css +1 -1
  20. package/dist/css/phosphor.css +1 -1
  21. package/dist/css/pro-dark.css +1 -1
  22. package/dist/css/pro.css +1 -1
  23. package/dist/css/solarized-dark.css +1 -1
  24. package/dist/css/solarized.css +1 -1
  25. package/dist/css/themes.css +1 -1
  26. package/dist/css/vaporwave.css +1 -1
  27. package/dist/css/velvet.css +1 -1
  28. package/dist/docs/perspective-docs.json +1 -1
  29. package/dist/esm/perspective-viewer.js +9 -9
  30. package/dist/esm/perspective-viewer.js.map +4 -4
  31. package/dist/esm/ts-rs/Layout.d.ts +2 -2
  32. package/dist/esm/ts-rs/Orientation.d.ts +2 -1
  33. package/dist/esm/ts-rs/SplitLayout.d.ts +13 -0
  34. package/dist/esm/ts-rs/TabLayout.d.ts +3 -0
  35. package/dist/esm/ts-rs/WorkspaceConfigUpdate.d.ts +2 -1
  36. package/dist/wasm/perspective-viewer.d.ts +16 -16
  37. package/dist/wasm/perspective-viewer.js +111 -111
  38. package/dist/wasm/perspective-viewer.wasm +0 -0
  39. package/dist/wasm/perspective-viewer.wasm.d.ts +16 -16
  40. package/package.json +7 -7
  41. package/src/rust/agent/preamble.md +2 -0
  42. package/src/rust/agent/tools.rs +280 -1
  43. package/src/rust/components/column_selector/config_selector.rs +1 -1
  44. package/src/rust/components/column_selector/filter_column.rs +2 -2
  45. package/src/rust/components/column_settings_sidebar/style_tab/symbol/row_selector.rs +1 -1
  46. package/src/rust/components/empty_row.rs +3 -3
  47. package/src/rust/components/filter_dropdown.rs +100 -101
  48. package/src/rust/components/main_panel/reconcile.rs +65 -28
  49. package/src/rust/components/main_panel/update.rs +8 -47
  50. package/src/rust/components/main_panel.rs +5 -16
  51. package/src/rust/config/workspace_config.rs +2 -1
  52. package/src/rust/js/regular_layout.rs +225 -3
  53. package/src/rust/tasks/sync_update_panels.rs +10 -19
  54. package/src/themes/intl/ar.css +1 -0
  55. package/src/themes/intl/de.css +1 -0
  56. package/src/themes/intl/es.css +1 -0
  57. package/src/themes/intl/fr.css +1 -0
  58. package/src/themes/intl/ja.css +1 -0
  59. package/src/themes/intl/pt.css +1 -0
  60. package/src/themes/intl/zh.css +1 -0
  61. package/src/themes/intl.css +1 -0
  62. package/src/ts/ts-rs/Layout.ts +2 -2
  63. package/src/ts/ts-rs/Orientation.ts +2 -1
  64. package/src/ts/ts-rs/SplitLayout.ts +17 -1
  65. package/src/ts/ts-rs/TabLayout.ts +3 -0
  66. package/src/ts/ts-rs/WorkspaceConfigUpdate.ts +2 -1
  67. /package/dist/wasm/snippets/{perspective-viewer-d0d525977a1acba2 → perspective-viewer-7fc45549159e01e4}/inline0.js +0 -0
  68. /package/dist/wasm/snippets/{perspective-viewer-d0d525977a1acba2 → perspective-viewer-7fc45549159e01e4}/inline1.js +0 -0
  69. /package/dist/wasm/snippets/{perspective-viewer-d0d525977a1acba2 → perspective-viewer-7fc45549159e01e4}/inline2.js +0 -0
  70. /package/dist/wasm/snippets/{perspective-viewer-d0d525977a1acba2 → perspective-viewer-7fc45549159e01e4}/inline3.js +0 -0
  71. /package/dist/wasm/snippets/{perspective-viewer-d0d525977a1acba2 → perspective-viewer-7fc45549159e01e4}/inline4.js +0 -0
  72. /package/dist/wasm/snippets/{perspective-viewer-d0d525977a1acba2 → perspective-viewer-7fc45549159e01e4}/inline5.js +0 -0
@@ -9,6 +9,8 @@ Workflow:
9
9
 
10
10
  Panels: the viewer is a dashboard that can hold multiple panels (independent side-by-side views). View tools act on the active panel unless you pass `panel`; manage the layout with `list_panels`, `add_panel`, `remove_panel` and `activate_panel`. `add_panel` takes the new panel's complete configuration up front - `table` and `columns` are required. To duplicate a panel, pass its `get_view_config` result to `add_panel`.
11
11
 
12
+ Dashboards: to build one, create each panel with `add_panel` (its complete config, including a short `title`), then arrange ALL panels in ONE `set_workspace` call whose `layout` names every panel id exactly once. A layout is nested `split-layout`s (`orientation` `horizontal` = side by side, `vertical` = stacked; `sizes` are fractions summing to 1, one per child) whose leaves are `tab-layout` stacks of panel ids - e.g. two charts side by side above a grid is a `vertical` split of [a `horizontal` split of the two charts, the grid]. Call `get_workspace` to read the current arrangement before changing it. A panel that reads a pivoted or filtered copy of a table needs that derived table to exist first: define it in `set_workspace`'s `derived_tables` (the complete set - keep existing entries), then `add_panel` with its name as `table`.
13
+
12
14
  Rules:
13
15
  - Column names in configs must match the schema exactly, including case.
14
16
  - A `set_view_config` or `add_panel` call that returns an error changed NOTHING - the viewer is exactly as it was, so there is nothing to undo.
@@ -122,11 +122,13 @@ fn panel_property() -> Value {
122
122
  /// config properties the AGENT contract requires beyond the public type
123
123
  /// (unioned into the definition's `required`, stated outright in the
124
124
  /// fallback) — the tool body must enforce the same fields at dispatch.
125
+ /// `omit` lists public properties the agent contract withholds.
125
126
  fn spliced_config(
126
127
  schemas: Option<&HashMap<String, Value>>,
127
128
  key: &str,
128
129
  description: &str,
129
130
  require: &[&str],
131
+ omit: &[&str],
130
132
  ) -> (Value, Option<Value>) {
131
133
  match schemas.and_then(|x| x.get(key)) {
132
134
  Some(schema) => {
@@ -141,7 +143,14 @@ fn spliced_config(
141
143
  .clone()
142
144
  .unwrap_or_else(|| json!({ "type": "object" }));
143
145
 
146
+ if let Some(properties) = config["properties"].as_object_mut() {
147
+ for field in omit {
148
+ properties.remove(*field);
149
+ }
150
+ }
151
+
144
152
  let mut required = config["required"].as_array().cloned().unwrap_or_default();
153
+ required.retain(|x| !omit.iter().any(|field| x == field));
145
154
  for field in require {
146
155
  if !required.iter().any(|x| x == field) {
147
156
  required.push(json!(field));
@@ -163,6 +172,8 @@ fn spliced_config(
163
172
  definitions.insert(key.to_owned(), original);
164
173
  }
165
174
 
175
+ let reachable = reachable_definitions(&config, &definitions);
176
+ definitions.retain(|name, _| reachable.contains(name));
166
177
  let definitions = (!definitions.is_empty()).then(|| Value::Object(definitions));
167
178
  (config, definitions)
168
179
  },
@@ -177,14 +188,59 @@ fn spliced_config(
177
188
  }
178
189
  }
179
190
 
191
+ fn definition_refs(node: &Value, out: &mut Vec<String>) {
192
+ match node {
193
+ Value::Object(map) => {
194
+ for (key, value) in map {
195
+ match value
196
+ .as_str()
197
+ .and_then(|x| x.strip_prefix("#/definitions/"))
198
+ {
199
+ Some(name) if key == "$ref" => out.push(name.to_owned()),
200
+ _ => definition_refs(value, out),
201
+ }
202
+ }
203
+ },
204
+ Value::Array(values) => {
205
+ for value in values {
206
+ definition_refs(value, out);
207
+ }
208
+ },
209
+ _ => {},
210
+ }
211
+ }
212
+
213
+ fn reachable_definitions(
214
+ root: &Value,
215
+ definitions: &serde_json::Map<String, Value>,
216
+ ) -> Vec<String> {
217
+ let mut pending = Vec::new();
218
+ definition_refs(root, &mut pending);
219
+ let mut reachable = Vec::new();
220
+ while let Some(name) = pending.pop() {
221
+ if reachable.contains(&name) {
222
+ continue;
223
+ }
224
+
225
+ if let Some(definition) = definitions.get(&name) {
226
+ definition_refs(definition, &mut pending);
227
+ }
228
+
229
+ reachable.push(name);
230
+ }
231
+
232
+ reachable
233
+ }
234
+
180
235
  fn config_parameters(
181
236
  schemas: Option<&HashMap<String, Value>>,
182
237
  key: &str,
183
238
  description: &str,
184
239
  with_panel: bool,
185
240
  require: &[&str],
241
+ omit: &[&str],
186
242
  ) -> Value {
187
- let (config, definitions) = spliced_config(schemas, key, description, require);
243
+ let (config, definitions) = spliced_config(schemas, key, description, require, omit);
188
244
  let mut properties = json!({ "config": config });
189
245
  if with_panel {
190
246
  properties["panel"] = panel_property();
@@ -253,6 +309,7 @@ static TOOLS: &[Tool] = &[
253
309
  "A partial ViewerConfigUpdate patch",
254
310
  true,
255
311
  &[],
312
+ &[],
256
313
  )
257
314
  },
258
315
  call: |elem, ctx, args| Box::pin(elem.tool_set_view_config(ctx, args)),
@@ -348,6 +405,7 @@ static TOOLS: &[Tool] = &[
348
405
  "The new panel's ViewerConfigInitial (`table` and `columns` required)",
349
406
  false,
350
407
  &["table", "columns"],
408
+ &[],
351
409
  )
352
410
  },
353
411
  call: |elem, ctx, args| Box::pin(elem.tool_add_panel(ctx, args)),
@@ -392,6 +450,45 @@ static TOOLS: &[Tool] = &[
392
450
  },
393
451
  call: |elem, ctx, args| Box::pin(elem.tool_activate_panel(ctx, args)),
394
452
  },
453
+ Tool {
454
+ name: "get_workspace",
455
+ description: "Get the dashboard's workspace state: the `layout` tree arranging the \
456
+ panels, each panel's `title`, `plugin` and `table`, the active panel, and \
457
+ the element-level `derived_tables`, `masters`, `global_filters` and \
458
+ `palette`. Call this before `set_workspace` - its `layout` must name every \
459
+ panel id listed here.",
460
+ entitlement: Entitlement::ReadView,
461
+ available: always,
462
+ parameters: |_| json!({ "type": "object", "properties": {} }),
463
+ call: |elem, ctx, args| Box::pin(elem.tool_get_workspace(ctx, args)),
464
+ },
465
+ Tool {
466
+ name: "set_workspace",
467
+ description: "Apply a field-wise update to the dashboard's workspace state; absent fields \
468
+ are unchanged and `null` resets. `layout` arranges the panels into a grid: \
469
+ nested `split-layout`s (`orientation` `horizontal` = side by side, \
470
+ `vertical` = stacked; `sizes` are fractions summing to 1, one per child) \
471
+ whose leaves are `tab-layout` stacks of panel ids, naming EVERY panel \
472
+ exactly once. `derived_tables` is the COMPLETE set of derived tables (keep \
473
+ existing entries), each a pivoted/filtered view of `table` that panels can \
474
+ then bind by name via add_panel. `masters` are panels whose row selection \
475
+ cross-filters the others through `global_filters`. Panels themselves are \
476
+ created and removed with add_panel / remove_panel. Returns the workspace \
477
+ state after the update.",
478
+ entitlement: Entitlement::ManageLayout,
479
+ available: always,
480
+ parameters: |schemas| {
481
+ config_parameters(
482
+ schemas,
483
+ "WorkspaceConfigUpdate",
484
+ "A partial WorkspaceConfigUpdate (`panels` excluded)",
485
+ false,
486
+ &[],
487
+ &["panels"],
488
+ )
489
+ },
490
+ call: |elem, ctx, args| Box::pin(elem.tool_set_workspace(ctx, args)),
491
+ },
395
492
  Tool {
396
493
  name: "search_docs",
397
494
  description: "Search the reference documentation: Perspective features, configuration \
@@ -577,6 +674,11 @@ struct PanelNameArgs {
577
674
  panel: String,
578
675
  }
579
676
 
677
+ #[derive(Deserialize)]
678
+ struct SetWorkspaceArgs {
679
+ config: serde_json::Map<String, Value>,
680
+ }
681
+
580
682
  #[derive(Deserialize)]
581
683
  struct SearchDocsArgs {
582
684
  query: String,
@@ -796,6 +898,29 @@ fn schema_object(schema: &ColumnConfigSchema) -> Value {
796
898
 
797
899
  const SEARCH_DOCS_LIMIT: usize = 4;
798
900
 
901
+ /// A `restoreWorkspace` update returning each field of `update` to its value
902
+ /// in the `saveWorkspace` token `snapshot`.
903
+ fn workspace_rollback(snapshot: &Value, update: &serde_json::Map<String, Value>) -> Value {
904
+ let mut rollback = serde_json::Map::new();
905
+ for key in update.keys() {
906
+ let saved = snapshot.get(key).filter(|x| !x.is_null()).cloned();
907
+ let value = match key.as_str() {
908
+ "layout" => saved,
909
+ "derived_tables" => Some(saved.unwrap_or_else(|| json!({}))),
910
+ "active" | "masters" | "global_filters" | "palette" => {
911
+ Some(saved.unwrap_or(Value::Null))
912
+ },
913
+ _ => None,
914
+ };
915
+
916
+ if let Some(value) = value {
917
+ rollback.insert(key.clone(), value);
918
+ }
919
+ }
920
+
921
+ Value::Object(rollback)
922
+ }
923
+
799
924
  /// Tool bodies and their shared helpers — plain (non-bindgen) methods.
800
925
  impl PerspectiveViewerElement {
801
926
  /// Resolve a tool's panel target: a named panel, or the active panel
@@ -1074,6 +1199,160 @@ impl PerspectiveViewerElement {
1074
1199
  client.get_hosted_table_names().await.ok()
1075
1200
  }
1076
1201
 
1202
+ async fn tool_get_workspace(&self, _ctx: &ToolCtx, _args: Value) -> Result<Value, ToolError> {
1203
+ let token = self.agent_save_workspace().await?;
1204
+ Ok(self.agent_workspace_summary(&token))
1205
+ }
1206
+
1207
+ /// Applies via the public `restoreWorkspace()`, restoring the touched
1208
+ /// fields from a `saveWorkspace()` snapshot on failure.
1209
+ async fn tool_set_workspace(&self, ctx: &ToolCtx, args: Value) -> Result<Value, ToolError> {
1210
+ let args: SetWorkspaceArgs = serde_json::from_value(args)?;
1211
+ if args.config.contains_key("panels") {
1212
+ return Err(ToolError(
1213
+ "`panels` cannot be set with set_workspace - create, configure and remove panels \
1214
+ with `add_panel`, `set_view_config` and `remove_panel`, then arrange them with \
1215
+ `layout`."
1216
+ .to_owned(),
1217
+ ));
1218
+ }
1219
+
1220
+ let snapshot = self.agent_save_workspace().await?;
1221
+ if let Some(derived) = args.config.get("derived_tables") {
1222
+ self.agent_check_derived(&snapshot, derived).await?;
1223
+ }
1224
+
1225
+ let update = Value::Object(args.config.clone());
1226
+ if let Err(err) = self.agent_restore_workspace(&update).await {
1227
+ let rollback = workspace_rollback(&snapshot, &args.config);
1228
+ if let Err(rollback_err) = self.agent_restore_workspace(&rollback).await {
1229
+ return Err(ToolError(format!(
1230
+ "{err} (restoring the previous workspace also failed: {rollback_err})"
1231
+ )));
1232
+ }
1233
+
1234
+ return Err(with_docs_hint(ctx, err));
1235
+ }
1236
+
1237
+ let token = self.agent_save_workspace().await?;
1238
+ Ok(self.agent_workspace_summary(&token))
1239
+ }
1240
+
1241
+ /// Reject a `derived_tables` set that drops a table a panel reads, or
1242
+ /// whose entries read a table that will not exist.
1243
+ async fn agent_check_derived(
1244
+ &self,
1245
+ snapshot: &Value,
1246
+ derived: &Value,
1247
+ ) -> Result<(), ToolError> {
1248
+ let Some(derived) = derived.as_object() else {
1249
+ return Ok(());
1250
+ };
1251
+
1252
+ let current = snapshot["derived_tables"]
1253
+ .as_object()
1254
+ .map(|x| x.keys().cloned().collect::<Vec<_>>())
1255
+ .unwrap_or_default();
1256
+
1257
+ let mut dropped = snapshot["panels"]
1258
+ .as_object()
1259
+ .into_iter()
1260
+ .flat_map(|panels| panels.values())
1261
+ .filter_map(|config| config["table"].as_str())
1262
+ .filter(|table| current.iter().any(|x| x == table) && !derived.contains_key(*table))
1263
+ .map(str::to_owned)
1264
+ .collect::<Vec<_>>();
1265
+
1266
+ dropped.sort();
1267
+ dropped.dedup();
1268
+ if !dropped.is_empty() {
1269
+ return Err(ToolError(format!(
1270
+ "`derived_tables` is the COMPLETE set of derived tables, not a patch: {dropped:?} \
1271
+ are read by panels and must stay in it (current derived tables: {current:?})"
1272
+ )));
1273
+ }
1274
+
1275
+ let Some(hosted) = self.agent_hosted_table_names().await else {
1276
+ return Ok(());
1277
+ };
1278
+
1279
+ let loaded = hosted
1280
+ .into_iter()
1281
+ .filter(|x| !current.contains(x))
1282
+ .collect::<Vec<_>>();
1283
+
1284
+ for (name, config) in derived {
1285
+ let Some(parent) = config["table"].as_str() else {
1286
+ continue;
1287
+ };
1288
+
1289
+ if !derived.contains_key(parent) && !loaded.iter().any(|x| x == parent) {
1290
+ return Err(ToolError(format!(
1291
+ "Derived table `{name}` reads unknown table `{parent}` - its `table` must be \
1292
+ a loaded table or another entry in `derived_tables` (loaded tables: \
1293
+ {loaded:?})"
1294
+ )));
1295
+ }
1296
+ }
1297
+
1298
+ Ok(())
1299
+ }
1300
+
1301
+ fn agent_workspace_summary(&self, token: &Value) -> Value {
1302
+ let panels = token["panels"]
1303
+ .as_object()
1304
+ .into_iter()
1305
+ .flatten()
1306
+ .map(|(id, config)| {
1307
+ (
1308
+ id.clone(),
1309
+ json!({
1310
+ "title": config["title"],
1311
+ "plugin": config["plugin"],
1312
+ "table": config["table"],
1313
+ }),
1314
+ )
1315
+ })
1316
+ .collect::<serde_json::Map<_, _>>();
1317
+
1318
+ let or = |key: &str, default: Value| {
1319
+ token
1320
+ .get(key)
1321
+ .filter(|x| !x.is_null())
1322
+ .cloned()
1323
+ .unwrap_or(default)
1324
+ };
1325
+
1326
+ json!({
1327
+ "active": self.agent_active_name(),
1328
+ "layout": token["layout"],
1329
+ "panels": panels,
1330
+ "derived_tables": or("derived_tables", json!({})),
1331
+ "masters": or("masters", json!([])),
1332
+ "global_filters": or("global_filters", json!([])),
1333
+ "palette": or("palette", json!({})),
1334
+ })
1335
+ }
1336
+
1337
+ async fn agent_save_workspace(&self) -> Result<Value, ToolError> {
1338
+ let options = js_sys::Object::new();
1339
+ js_sys::Reflect::set(&options, &JsValue::from_str("full_palette"), &JsValue::TRUE)?;
1340
+
1341
+ let saved = self.saveWorkspace(Some(options.unchecked_into()));
1342
+ let promise: js_sys::Promise = JsValue::from(saved).unchecked_into();
1343
+ let token = wasm_bindgen_futures::JsFuture::from(promise).await?;
1344
+ let json = String::from(js_sys::JSON::stringify(&token)?);
1345
+ Ok(serde_json::from_str(&json)?)
1346
+ }
1347
+
1348
+ async fn agent_restore_workspace(&self, update: &Value) -> Result<(), ToolError> {
1349
+ let js_update = js_sys::JSON::parse(&update.to_string())?;
1350
+ let restored = self.restoreWorkspace(js_update.unchecked_into(), None);
1351
+ let promise: js_sys::Promise = JsValue::from(restored).unchecked_into();
1352
+ wasm_bindgen_futures::JsFuture::from(promise).await?;
1353
+ Ok(())
1354
+ }
1355
+
1077
1356
  async fn tool_remove_panel(&self, _ctx: &ToolCtx, args: Value) -> Result<Value, ToolError> {
1078
1357
  let args: PanelNameArgs = serde_json::from_value(args)?;
1079
1358
  self.agent_panel(Some(&args.panel))?;
@@ -252,7 +252,7 @@ impl Component for ConfigSelector {
252
252
  false
253
253
  },
254
254
  ConfigSelectorMsg::Close(index, DragTarget::Filter) => {
255
- self.filter_dropdown.hide().unwrap();
255
+ self.filter_dropdown.reset();
256
256
  let mut filter = ctx.props().view_config.filter.clone();
257
257
  filter.remove(index);
258
258
  let config = ViewConfigUpdate {
@@ -162,13 +162,13 @@ impl Component for FilterColumn {
162
162
  false
163
163
  },
164
164
  FilterColumnMsg::Close => {
165
- ctx.props().filter_dropdown.hide().unwrap();
165
+ ctx.props().filter_dropdown.reset();
166
166
  false
167
167
  },
168
168
  FilterColumnMsg::FilterKeyDown(13) => {
169
169
  if ctx.props().is_suggestable() {
170
170
  ctx.props().filter_dropdown.item_select();
171
- ctx.props().filter_dropdown.hide().unwrap();
171
+ ctx.props().filter_dropdown.dismiss();
172
172
  }
173
173
  false
174
174
  },
@@ -38,7 +38,7 @@ pub fn row_selector(props: &RowSelectorProps) -> Html {
38
38
  let on_select = {
39
39
  clone!(props.dropdown, props.index, props.set_focused_index);
40
40
  props.on_select.reform(move |key| {
41
- dropdown.hide().unwrap();
41
+ dropdown.dismiss();
42
42
  set_focused_index.emit(Some(index + 1));
43
43
  key
44
44
  })
@@ -106,7 +106,7 @@ impl Component for EmptyRow {
106
106
  }
107
107
 
108
108
  fn destroy(&mut self, ctx: &Context<Self>) {
109
- ctx.props().dropdown.hide().unwrap();
109
+ ctx.props().dropdown.reset();
110
110
  }
111
111
 
112
112
  fn update(&mut self, ctx: &Context<Self>, msg: Self::Message) -> bool {
@@ -121,7 +121,7 @@ impl Component for EmptyRow {
121
121
  false
122
122
  },
123
123
  Blur => {
124
- p.dropdown.hide().unwrap();
124
+ p.dropdown.reset();
125
125
  if let Some(elem) = self.input_ref.cast::<HtmlInputElement>() {
126
126
  elem.set_value("");
127
127
  }
@@ -139,7 +139,7 @@ impl Component for EmptyRow {
139
139
  },
140
140
  KeyDown(13) => {
141
141
  p.dropdown.item_select();
142
- p.dropdown.hide().unwrap();
142
+ p.dropdown.dismiss();
143
143
  p.set_focused_index.emit(Some(p.index + 1));
144
144
  true
145
145
  },