pnp / List-Formatting

List Formatting Samples for use in SharePoint and Microsoft Lists
https://pnp.github.io/List-Formatting/
MIT License
1.76k stars 844 forks source link

Added sample highlight-non-empty-folders #721

Closed MoeIcI closed 11 months ago

MoeIcI commented 12 months ago
Q A
Bug fix? no
New sample? yes
Related issues? none

What's in this Pull Request?

Added a new sample which uses the 'Folder Child Count' and 'Item Child Count' columns to check if a folder is empty or not. According to the result of the check the folder title will be written in semi bold or slightly grayed out.

screenshot

tecchan1107 commented 11 months ago

Thank you for the amazing sample @MoeIcI !! I actually tried it out and it made it easier to find empty folders and delete useless folders!

After trying the sample, one concern I have is that not only the empty folders, but also the filenames are lighter in color. Is this intentionally making the file names lighter in color as well?

If it is not intentional, you can use the ContentTypeId column to identify whether it is a file or a folder. image

For reference, the following is a sample using the ContentTypeId column. In this sample, the ContentTypeId column is used, and if it is a folder, the icon is not displayed. https://github.com/pnp/List-Formatting/tree/master/column-samples/generic-share-to-teams

MoeIcI commented 11 months ago

Thank you for your feedback, @tecchan1107 !

It wasn't intended to gray out files. I will add a condition to apply it only to folder and set every other file to the class 'ms-fontColor-black'. Additionally I added the customRowAction 'defaultClick' to open the folder or file by clicking once.

How can I edit my code in the Pull-Request to add the changes? Edit: Never mind, I answered my question myself 😄

tecchan1107 commented 11 months ago

Awesome!! I think the addition of defaultClick would be very useful!

To make the change, try making the change in the library-visualize-empty-folders branch of your repository! image

There are many ways to make changes, such as using Visual Studio Code, but I find it easiest to make changes in the browser. image

When changes are completed, they will be reflected in this pull request. image

tecchan1107 commented 11 months ago

Editing is perfect! I will check them again. Please wait until they are merged🙇‍♂

MoeIcI commented 11 months ago

Alright, thank you, @tecchan1107 !

tecchan1107 commented 11 months ago

I have done the merge! Please check out the following link! https://github.com/pnp/List-Formatting/tree/master/column-samples/filename-highlight-non-empty-folders

I also made the following minor adjustments when doing the merge. Let me know if you have any questions, etc.

Once again, thank you for the great sample @MoeIcI !!!!

tecchan1107 commented 11 months ago

If you are interested, please register for the following program. When you register, you will get a digital badge! M365 Platform & Power Platform Community Recognition Program

※Even if you register, it will not be distributed immediately. It will take some time before it is distributed.

MoeIcI commented 11 months ago

Hey @tecchan1107 , thanks for your help. The changes are great! I tried to add the ms-link class but didn't get it running, so thanks for that.

I checked the sample after the merge, and it works fine. I noticed that the sample doesn't show up if I go on https://pnp.github.io/List-Formatting/. Is this a bug or does it take some time?

tecchan1107 commented 11 months ago

I checked the sample after the merge, and it works fine. I noticed that the sample doesn't show up if I go on https://pnp.github.io/List-Formatting/. Is this a bug or does it take some time?

That is not a bug; https://pnp.github.io/List-Formatting/ is not automatically updated, so it is not updated. I also do not know how to update it, so I am unable to answer when it can be posted. Sorry about that.

Sample Solution Gallery is automatically and regularly updated. Therefore, it will be posted tomorrow.