Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvement - adapted stylesheet for c-table #569

Merged
merged 3 commits into from
Jun 25, 2020

Conversation

helloimela
Copy link
Contributor

@helloimela helloimela commented Jun 17, 2020

Describe pull-request

  • Implement shadow Dom for c-table component
  • Under shadowDom, dropdown will not inherit bootstrap js and style from global, so it needs to be made as its own component

Solving issue
Fixes: #551

How to test

Test together with scania/scania-theme#146

Use component:

<c-table></c-table>

<script>

const arr = [
      {
        "id":1,
        "name" : "Harru",
        "lastname": "Haru",
        "email": "[email protected]"
      },
      {
        "id":2,
        "name" : "Johan",
        "lastname": "Johansson",
        "email": "[email protected]"
      },
      {
        "id":3,
        "name" : "Mika",
        "lastname": "Fedora",
        "email": "[email protected]"
      },
        
    ]
    
    const el = document.querySelector('c-table');

    el.header = [
      {
        key: "name",
        description: "First Name",
      },
      {
        key: "lastname",
        description: "Last Name",
      },
      {
        key: "email",
        description: "Email",
      }
    ]
    el.content = arr;

    el.hasEdit = true;
    el.hasDelete = true;
    el.addEventListener('optEdit', testEdit)
    el.addEventListener('optDelete', testDelete)

    function testEdit(msg) {
      alert(JSON.stringify(msg.detail));
    }

    function testDelete(msg) {
    // es6 format won't work in IE
       let newArr = [...el.content];
       newArr.forEach(function(item, index){
         if(item.id == msg.detail.id) {
           newArr.splice(index, 1)
         }
       })
       el.content = newArr;
    }
</script>

Screenshots
If applicable, add screenshots to help explain

Additional context
Add any other context about the pull-request here.

Ela Yudhanira added 2 commits June 16, 2020 15:32
- Under shadowDom, dropdown will not inherit bootstrap js and style from global, so it needs to be made as its own component
@helloimela helloimela requested a review from mmexvr June 17, 2020 10:15
@helloimela helloimela self-assigned this Jun 17, 2020
@helloimela helloimela added the Improvement Improvement of already existing feature label Jun 17, 2020
@helloimela helloimela changed the title Improvement/adapted stylesheet c table Improvement - adapted stylesheet for c-table Jun 17, 2020
@mmexvr
Copy link
Member

mmexvr commented Jun 18, 2020

  • If you click on the action span element inside the dropdown, it will not open the dropdown.
  • Color of the delete is different in different browsers

image

@mmexvr
Copy link
Member

mmexvr commented Jun 25, 2020

Looks good!

#565 Reference, this PR is related with some fixes and improvements from that PR

@mmexvr mmexvr merged commit d2a0a51 into master Jun 25, 2020
@helloimela helloimela deleted the improvement/adapted_Stylesheet_c-table branch July 1, 2020 07:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Improvement Improvement of already existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sort and filtering for tables
2 participants