Skip to content

feat: expose editor buttons with slots - #2377

Merged
DiegoCardoso merged 5 commits into
masterfrom
feat/expose-editor-buttons
Aug 26, 2021
Merged

DiegoCardoso merged 5 commits into
masterfrom
feat/expose-editor-buttons

Conversation

@DiegoCardoso

Copy link
Copy Markdown
Contributor

Description

This is an internal API to be used by the Flow counterpat.

Create slots on the editor buttons (save, cancel and delete) to enable the Flow counterpart to pass its own button instances to the Crud WC.

Part of vaadin/flow-components#1112

Type of change

  • Bugfix
  • Feature

Checklist

  • I have read the contribution guide: https://vaadin.com/docs-beta/latest/guide/contributing/overview/
  • I have added a description following the guideline.
  • The issue is created in the corresponding repository and I have referenced it.
  • I have added tests to ensure my change is effective and works as intended.
  • New and existing tests are passing locally with my change.
  • I have performed self-review and corrected misspellings.

Additional for Feature type of change

  • Enhancement / new feature was discussed in a corresponding GitHub issue and Acceptance Criteria were created.

This is an internal API to be used by the Flow counterpart.
Expose the editor buttons (save, cancel and delete) with slots in a
similar way as done with form. This is to enable the Flow counterpart
to pass its own buttons instances and attach them to the Crud WC.

Part of vaadin/flow-components#1112

Co-authored-by: Hadi Amiri <hdamr@users.noreply.github.com>
@web-padawan web-padawan changed the title feat: add i18n property to password-field (#2346) feat: expose editor buttons with slots Aug 24, 2021

@hdamr hdamr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Comment thread packages/vaadin-crud/src/vaadin-crud.js Resolved
Comment on lines -136 to -137

describe('items', () => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's avoid large diff by using this approach. Here is how I would do it.

  ['default', 'slotted buttons'].forEach((mode) => {
    describe(`[${mode}] items`, () => {
      beforeEach(async () => {
        if (mode === 'default') {
          crud = fixtureSync('<vaadin-crud style="width: 300px;"></vaadin-crud>');
        } else {
          crud = fixtureSync(
            `<vaadin-crud style="width: 300px;">
              <vaadin-button slot="save-button"></vaadin-button>
              <vaadin-button slot="cancel-button"></vaadin-button>
              <vaadin-button slot="delete-button"></vaadin-button>
            </vaadin-crud>`
          );
        }
        crud.items = [{ foo: 'bar' }];
        await nextRender(crud._grid);
      });

      describeItems();
    });
  });

  function describeItems() {
    // all the existing nested `describe` here
  }

Note, the function is intended so we can define it after the invocation and leverage hoisting.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. Changed.

@DiegoCardoso
DiegoCardoso force-pushed the feat/expose-editor-buttons branch from 3764ab6 to 36abc1e Compare August 26, 2021 15:02
@web-padawan

Copy link
Copy Markdown
Member

Looks like Save button is now disabled by default, is that intended?

Screenshot 2021-08-26 at 18 06 29

@sonarqubecloud

Copy link
Copy Markdown

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@vaadin-bot

Copy link
Copy Markdown
Collaborator

This ticket/PR has been released with platform 22.0.0.alpha2 and is also targeting the upcoming stable 22.0.0 version.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants