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

feat: POC - virtual tree with full scrolling #1609

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
299 changes: 298 additions & 1 deletion .storybook/helpers/files.data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,300 @@ export const filesRoot: File[] = [
{
name: 'main.ts',
},
{
name: 'styles',
files: [
{
name: 'main.scss',
},
],
},
{
name: 'index.html',
},
{
name: 'main.ts',
},
{
name: 'styles',
files: [
{
name: 'main.scss',
},
],
},
{
name: 'index.html',
},
{
name: 'main.ts',
},
{
name: 'styles',
files: [
{
name: 'main.scss',
},
],
},
{
name: 'index.html',
},
{
name: 'main.ts',
},
{
name: 'styles',
files: [
{
name: 'main.scss',
},
],
},
{
name: 'index.html',
},
{
name: 'main.ts',
},
{
name: 'styles',
files: [
{
name: 'main.scss',
},
],
},
{
name: 'index.html',
},
{
name: 'main.ts',
},
{
name: 'styles',
files: [
{
name: 'main.scss',
},
],
},
{
name: 'index.html',
},
{
name: 'main.ts',
},
{
name: 'styles',
files: [
{
name: 'main.scss',
},
],
},
{
name: 'index.html',
},
{
name: 'main.ts',
},
{
name: 'styles',
files: [
{
name: 'main.scss',
},
],
},
{
name: 'index.html',
},
{
name: 'main.ts',
},
{
name: 'styles',
files: [
{
name: 'main.scss',
},
],
},
{
name: 'index.html',
},
{
name: 'main.ts',
},
{
name: 'styles',
files: [
{
name: 'main.scss',
},
],
},
{
name: 'index.html',
},
{
name: 'main.ts',
},
{
name: 'styles',
files: [
{
name: 'main.scss',
},
],
},
{
name: 'index.html',
},
{
name: 'main.ts',
},
{
name: 'styles',
files: [
{
name: 'main.scss',
},
],
},
{
name: 'index.html',
},
{
name: 'main.ts',
},
{
name: 'styles',
files: [
{
name: 'main.scss',
},
],
},
{
name: 'index.html',
},
{
name: 'main.ts',
},
{
name: 'styles',
files: [
{
name: 'main.scss',
},
],
},
{
name: 'index.html',
},
{
name: 'main.ts',
},
{
name: 'styles',
files: [
{
name: 'main.scss',
},
],
},
{
name: 'index.html',
},
{
name: 'main.ts',
},
{
name: 'styles',
files: [
{
name: 'main.scss',
},
],
},
{
name: 'index.html',
},
{
name: 'main.ts',
},
{
name: 'styles',
files: [
{
name: 'main.scss',
},
],
},
{
name: 'index.html',
},
{
name: 'main.ts',
},
{
name: 'styles',
files: [
{
name: 'main.scss',
},
],
},
{
name: 'index.html',
},
{
name: 'main.ts',
},
{
name: 'styles',
files: [
{
name: 'main.scss',
},
],
},
{
name: 'index.html',
},
{
name: 'main.ts',
},
{
name: 'styles',
files: [
{
name: 'main.scss',
},
],
},
{
name: 'index.html',
},
{
name: 'main.ts',
},
{
name: 'styles',
files: [
{
name: 'main.scss',
},
],
},
{
name: 'index.html',
},
{
name: 'main.ts',
},
],
},
{
Expand All @@ -94,7 +388,10 @@ export function getFileTreeNodeMarkup(
${args.hasIcon ? `<cds-icon [attr.shape]="'${file.files ? 'folder' : 'file'}'"></cds-icon>` : ''}
${args.asLink ? `<a href="javascript:;" class="clr-treenode-link">${file.name}</a>` : file.name}
${file.files ? getFileTreeNodeMarkup(file.files, args) : ''}
</clr-tree-node>`
</clr-tree-node>


`
)
.join('');
}
19 changes: 19 additions & 0 deletions .storybook/stories/tree/tree.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,29 @@ const TreeViewTemplate: StoryFn = args => ({
props: args,
});

const VirtualTreeTemplate: StoryFn = args => ({
template: `
<clr-tree>
<clr-tree-node>
One!
<clr-tree-node *ngFor="let x of [].constructor(5)">
Two!
<clr-tree-node *ngFor="let x of [].constructor(5)">Three!</clr-tree-node>
</clr-tree-node>
</clr-tree-node>
</clr-tree>
`,
props: args,
});

export const TreeView: StoryObj = {
render: TreeViewTemplate,
};

export const VirtualTree: StoryObj = {
render: VirtualTreeTemplate,
};

export const TreeViewAsLink: StoryObj = {
render: TreeViewTemplate,
args: {
Expand Down
16 changes: 13 additions & 3 deletions projects/angular/src/data/tree-view/_tree-view.clarity.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,21 @@
@include meta.load-css('properties.tree-view');

@include mixins.exports('tree-view.clarity') {
.example-viewport {
height: 200px;
width: 200px;
border: 1px solid black;
}

.example-item {
height: 24px;
}

.clr-tree-node {
//Display
display: block;

&.disabled .clr-tree-node-content-container {
.clr-tree-node-content-container.clr-form-control-disabled {
cursor: not-allowed;

.clr-treenode-link {
Expand Down Expand Up @@ -102,7 +112,7 @@

//Dimensions
&:first-child {
margin-left: tree-view-variables.$clr-tree-node-touch-target;
// margin-left: tree-view-variables.$clr-tree-node-touch-target;
}

&.clr-treenode-text-only {
Expand Down Expand Up @@ -216,7 +226,7 @@

.clr-treenode-children {
//Dimensions
margin-left: tree-view-variables.$clr-tree-node-children-margin;
// margin-left: tree-view-variables.$clr-tree-node-children-margin;
will-change: height;
overflow-y: hidden;
}
Expand Down
Loading