Skip to content

Typings and schema issues of components #4900

Closed

Description

@Lodin

Description

I'm developing a React implementation of components in vaadin/react-components. I use extensive generation based on web-types.json information which allowed me to spot some issues among components.

Non-public files

Several web-types.json files provide information about files that looks like not supposed to be public. Here they are:

  • @vaadin\charts\src\vaadin-chart-series.js
  • @vaadin\upload\src\vaadin-upload-file.js
  • @vaadin\crud\src\vaadin-crud-edit.js
  • @vaadin\crud\src\vaadin-crud-edit-column.js

Some of them don't have d.ts files so if I import them in generated file, TypeScript compiler starts to complain about it.

Broken event map

To support all events in React correctly, I use the information about events stored in web-types.json. However, time to time events are missing in TypeScript declaration.

  • AccordionPanel. This component doesn't provide an event map completely.
  • AppLayout.
    • close-overlay-drawer
  • Checkbox
    • value-changed
  • ComboBox
    • vaadin-combo-box-dropdown-closed
    • vaadin-combo-box-dropdown-opened
  • ComboBoxLight
    • vaadin-combo-box-dropdown-closed
    • vaadin-combo-box-dropdown-opened
  • Grid
    • size-changed
    • data-provider-changed
  • GridPro
    • size-changed
    • data-provider-changed
    • enter-next-row-changed
    • single-cell-edit-changed
  • GridProEditColumn
    • editor-type-changed
  • LoginForm
    • action-changed
    • disabled-changed
    • error-changed
    • no-forgot-password-changed
    • i18n-changed
  • LoginOverlay
    • description-changed
    • action-changed
    • disabled-changed
    • error-changed
    • no-forgot-password-changed
    • i18n-changed
  • RadioButton
    • value-changed

Typings errors and lack of similarity

Working with many components, I found that some of them have types different from others. It could probably be an issue.

@vaadin/notification.

Specifies renderer in the following way

type NotificationRenderer = (root: HTMLElement, notification?: Notification) => void;

Looks like a bug because Lit implementation doesn't care about nullability of notification:

export type NotificationLitRenderer = (notification: Notification) => TemplateResult;

Among component properties, the renderer is specified in the following way:

type NotificationProps = {
	renderer: NotificationRenderer | undefined;
}

However, for @vaadin/grid all renderers are specified as Renderer | null | undefined.

@vaadin/grid

Specifies the renderer in the following way:

export type GridRowDetailsRenderer<TItem> = (
  root: HTMLElement,
  grid?: Grid<TItem>,
  model?: GridItemModel<TItem>,
) => void;

Again, the nullability for grid and model seem to be a mistake because Lit doesn't consider it.

@vaadin/virtual-list

As in @vaadin/notification, the renderer prop misses null as an acceptable value.

type VirtualListProps = {
	renderer: VirtualListRenderer | undefined;
}

@vaadin/context-menu

As in @vaadin/grid, it has nullable model and element in renderer.

export type ContextMenuRenderer = (
  root: HTMLElement,
  contextMenu?: ContextMenu,
  context?: ContextMenuRendererContext,
) => void;

@vaadin/dialog

As in @vaadin/grid, it has nullable element in renderer.

export type DialogRenderer = (root: HTMLElement, dialog?: Dialog) => void;

Public components that are declared as private

@vaadin/chart

This component uses the library which has an imperative interface to update the series etc. So for make it declarative, there is a ChartSeries component. However, it doesn't have a place in the package's root, so the algorithm ignores it because considers it private. Could we put it to the root to make sure it is public?

Expected outcome

(see description)

Minimal reproducible example

(see description)

Steps to reproduce

(see description)

Environment

Vaadin version(s): 23.3.0-alpha3
OS: Windows

Browsers

Issue is not browser related

Activity

  1. web-padawan commented on Nov 3, 2022

    @web-padawan
    Member

    Thanks for the issue. I can say that at least some properties using notify: true where this shouldn't be needed.
    Will go through the list tomorrow and submit some PRs for individual components to add / fix event maps.

  2. web-padawan commented on Nov 7, 2022

    @web-padawan
    Member

    The following issues have been resolved and released in v23.3.0-alpha5:

    AccordionPanel. This component doesn't provide an event map completely.

    @vaadin/notification
    Looks like a bug because Lit implementation doesn't care about nullability of notification:

    @vaadin/grid
    Again, the nullability for grid and model seem to be a mistake because Lit doesn't consider it.

    @vaadin/virtual-list
    As in @vaadin/grid, it has nullable model and element in renderer.

    @vaadin/charts
    There is a ChartSeries component. However, it doesn't have a place in the package's root.

    @vaadin\crud\src\vaadin-crud-edit.js
    @vaadin\crud\src\vaadin-crud-edit-column.js

    Also, fixed event types for LoginForm and LoginOverlay: either added, or removed notify: true where not needed.

  3. web-padawan commented on Nov 7, 2022

    @web-padawan
    Member

    Here are some things that I would consider "won't fix":

    AppLayout
    close-overlay-drawer

    This event is not fired on the component itself, but on the window object.
    And it can be considered internal, as users are not supposed to listen to it.

    ComboBox
    vaadin-combo-box-dropdown-closed
    vaadin-combo-box-dropdown-opened

    These events are internal, and actually we might want to deprecate them.

    Checkbox
    value-changed

    RadioButton
    value-changed

    This property is there by mistake: the value is not supposed to be changed in both components.
    We could consider removing notify: true from the InputMixin and moving it to other mixin.

  4. yuriy-fix commented on Nov 8, 2022

    @yuriy-fix
    Contributor

    Let's keep it in triage to follow the progress and check if we need extra actions.

  5. Lodin commented on Nov 8, 2022

    @Lodin
    Author

    Thanks!
    I have just checked the changes. There are still some issues left:

    Typings errors and lack of similarity

    @vaadin/select

    It looks like I forgot to include it to the issue.

    As in @vaadin/notification, the renderer definition accepts an undefined original element.

    type SelectRenderer = (root: HTMLElement, select?: Select) => void;

    Broken event map

    There are still some components that are not declared as "won't fix" but still lacks event maps:

    • CrudEdit (this one appeared in recent updates)
      • edit
    • Grid
      • size-changed
      • data-provider-changed
    • GridPro
      • size-changed
      • data-provider-changed
      • enter-next-row-changed
      • single-cell-edit-changed
    • GridProEditColumn
      • editor-type-changed
  6. platosha commented on Nov 16, 2022

    @platosha
    Contributor

    One more typing issue: MultiSelectListMixin TypeScript declaration does not list types from MultiSelectListMixinClass. As a result, ListBox class does not specify the multiple property.

  7. web-padawan commented on Dec 30, 2022

    @web-padawan
    Member

    Most of these issues have been fixed. I'll check the remaining issues related to events, as well as some other TS inconsistencies later, and maybe create a new issue later on as a follow-up.

  8. cromoteca commented on Mar 21, 2023

    @cromoteca
    Contributor

    @web-padawan while documenting React components for Hilla, I found some properties that are reported as missing, yet they are used in the examples. How can I ask for them to be added? Should I list here, open another issue, or an issue for each?

  9. platosha commented on Apr 18, 2023

    @platosha
    Contributor

    Found one more event definition missing:

    @vaadin/multi-select-combo-box

    • Missing opened-changed in MultiSelectComboBoxEventMap
  10. web-padawan commented on Mar 7, 2025

    @web-padawan
    Member

    Issues reported above have been fixed. Closing this issue, please create a new one if there are some more missing properties.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions