Allow column options to be defined per column instead of globally
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 42/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- javascript
- Área
- frontend
Línea de trabajo
Start at the Table input implementation and inspect how the columns, width, format, and align options are currently handled. Update the option handling to support per-column objects while preserving array columns and global-option precedence, then verify the behavior against the examples and suggested rules in this issue.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
The Table input presently supports four column related options:
columns, indicating which columns should be displayed, and in which orderwidth, defining either a global width or per-column widths (in object form)format, per-column formatters in object formalign, per-column text alignment in object form
It is reasonable to expect that more options will be added in the future, requiring column definitions to be spread across multiple global options.
Suggested solution
Support per-column options objects. The example below has been taken from this notebook and expands the columns option definitions via a custom helper function.
Example:
const time = {
width: relTime ? '8em' : '15em',
format: v => {
const d = new Date(v).toLocaleString('en-US');
return html`<span title="${relTime ? d : timeAgo(v)}">${relTime ? timeAgo(v) : d}`;
}
};
const columns = {
'title': {
format: (v, i, {[i]: d}) => html`<img height="25" style="display:inline-block;vertical-align:middle;margin-right:.5em" src="https://static.observableusercontent.com/thumbnail/${d.thumbnail}.jpg"><a href="/@${d.owner.login}/${d.slug}" style="font-weight:bold">${DOM.text(v)}`,
},
'update_time': time,
'publish_time': time,
'likes': {width: '3em', format: v => v || ''},
'comment_count': {width: '6em', format: v => v || ''},
'version': {width: '4em', format: v => v},
'fork_of': {width: '3em', format: v => v ? '✔' : '', align: 'center'},
};
Suggested Implementation
- For the Table option
columns, assume an object of per-column options indexed by column names, where the order of property keys defines the column order (as shown in the example above). - If
columnsis defined as an array, expand each item into an empty options object, as defined in 1. - If specified, merge the global options
width,format, andaligninto the existing options objects, taking precedence over already defined values.
- Lenguaje dominante
- JavaScript
- Estrellas
- 173
- Forks
- 40
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de observablehq/inputs
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
observablehq/inputs#133 · 1 reacción ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 42/100
observablehq/inputs#278 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 45/100
observablehq/inputs#277 · 2 comentarios ·
-
Dificultad 3/5 1-2 días Aptitud para principiantes 55/100
observablehq/inputs#275 · 2 comentarios ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
observablehq/inputs#273 · 2 comentarios ·
Todos los issues de observablehq/inputs
Issues similares
-
ai-driven-fuzzing bug claude Minor
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
linagora/cozy-client#1777 · 1 comentario · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
[guide] AGENTS.md claims the coverage gate, e2e and full lint run on every PR after ADR 0011 focused validationPosiblemente ocupada @hivecommons-hive la tomó hoy. Abiertoagent/guide documentation hive/claimed-by-guide stage/040-covered-by-pr
Dificultad 2/5 1-3 horas Aptitud para principiantes 81/100
cncf/endusers#2006 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
check:passed feeds:add
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
Los mantenedores suelen responder en 4 días
-
CMS video element: "CmsVideoPlugin" sets `volume = 0`, so videos cannot be unmuted on Android ChromeAbiertoneeds-triage Platform(Default)
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
all-contributors/cli#587 ·
Los mantenedores suelen responder en 1 día