Skip to content

Commit

Permalink
feat(docs): added examples for list and tree (#UIM-261, #UIM-270) (#352)
Browse files Browse the repository at this point in the history
  • Loading branch information
lskramarov authored and pimenovoleg committed Nov 28, 2019
1 parent 8cd752b commit 22c19db
Show file tree
Hide file tree
Showing 29 changed files with 942 additions and 96 deletions.
3 changes: 3 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ jobs:
echo 'export SHORT_GIT_HASH=$(git rev-parse --short $CIRCLE_SHA1)' >> $BASH_ENV
echo 'export CIRCLE_PULL_REQUEST_NUMBER=$(echo "$CIRCLE_PULL_REQUEST" | cut -d"/" -f7)' >> $BASH_ENV
source $BASH_ENV
- run: echo "$CIRCLE_PULL_REQUEST" | cut -d"/" -f7 && echo $CIRCLE_PULL_REQUEST_NUMBER
- run: printenv
- run: yarn run build:docs
- run: yarn run build:mosaic-examples
- run: yarn run docs:prod-build --progress false --base-href /mosaic-previews/pr$CIRCLE_PULL_REQUEST_NUMBER-$SHORT_GIT_HASH/ --output-path dist/releases/mosaic-docs/pr$CIRCLE_PULL_REQUEST_NUMBER-$SHORT_GIT_HASH/
Expand Down Expand Up @@ -160,6 +162,7 @@ jobs:
echo 'export SHORT_GIT_HASH=$(git rev-parse --short $CIRCLE_SHA1)' >> $BASH_ENV
echo 'export CIRCLE_PULL_REQUEST_NUMBER=$(echo "$CIRCLE_PULL_REQUEST" | cut -d"/" -f7)' >> $BASH_ENV
source $BASH_ENV
- run: printenv
- run: yarn run build:docs
- run: yarn run docs:publish-preview

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,25 @@ const DOCS: { [key: string]: DocCategory[] } = {
examples: ['typography-types']
}
]
},
{
id: 'core/styles',
name: 'Data list',
summary: 'styles',
items: [
{
id: 'list',
name: 'List',
summary: '',
examples: ['list-types']
},
{
id: 'tree',
name: 'Tree',
summary: '',
examples: ['tree-types']
}
]
}
],
[CDK]: [
Expand Down
18 changes: 15 additions & 3 deletions packages/docs/src/assets/stackblitz/mosaic-module.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { CdkTreeModule } from '@ptsecurity/cdk/tree';
import { McMomentDateModule } from '@ptsecurity/mosaic-moment-adapter';
import { McButtonModule } from '@ptsecurity/mosaic/button';
import { McCheckboxModule } from '@ptsecurity/mosaic/checkbox';
import { McHighlightModule, McPseudoCheckboxModule } from '@ptsecurity/mosaic/core';
import { McDatepickerModule } from '@ptsecurity/mosaic/datepicker';
import { McFormFieldModule } from '@ptsecurity/mosaic/form-field';
import { McIconModule } from '@ptsecurity/mosaic/icon';
import { McInputModule } from '@ptsecurity/mosaic/input';
import { McListModule } from '@ptsecurity/mosaic/list';
import { McRadioModule } from '@ptsecurity/mosaic/radio';
import { McSelectModule } from '@ptsecurity/mosaic/select';
import { McTimepickerModule } from '@ptsecurity/mosaic/timepicker';
import { McTreeModule } from '@ptsecurity/mosaic/tree';


@NgModule({
Expand All @@ -22,8 +27,15 @@ import { McTimepickerModule } from '@ptsecurity/mosaic/timepicker';
McInputModule,
McRadioModule,
McTimepickerModule,
McSelectModule
McSelectModule,
McListModule,
McTreeModule,
McIconModule,
McHighlightModule,
FormsModule,
McInputModule,
McPseudoCheckboxModule,
CdkTreeModule
]
})
export class DemoMosaicModule {
}
export class DemoMosaicModule {}
4 changes: 3 additions & 1 deletion packages/mosaic-dev/tree/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,9 @@ export class DemoComponent {
}

private getViewValue = (node: FileNode): string => {
return `${node.name} view`;
const nodeType = node.type ? `.${node.type}` : '';

return `${node.name}${nodeType}`;
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/** No CSS for this example */
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<mc-list-selection
multiple="checkbox"
[(ngModel)]="selected">
<mc-list-option value="Item 1" disabled>Item 1</mc-list-option>
<mc-list-option value="Item 2">Item 2</mc-list-option>
<mc-list-option value="Item 3">Item 3</mc-list-option>
<mc-list-option value="Item 4">Item 4</mc-list-option>
<mc-list-option value="Item 5">Item 5</mc-list-option>
<mc-list-option value="Item 6">Item 6</mc-list-option>
<mc-list-option value="Item 7">Item 7</mc-list-option>
<mc-list-option value="Item 8">Item 8</mc-list-option>
<mc-list-option value="Item 9">Item 9</mc-list-option>
<mc-list-option value="Item 10">Item 10</mc-list-option>
</mc-list-selection>
<br>
<div>Selected: {{ selected }}</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Component } from '@angular/core';


/**
* @title Basic list
*/
@Component({
selector: 'list-multiple-checkbox-example',
templateUrl: 'list-multiple-checkbox-example.html',
styleUrls: ['list-multiple-checkbox-example.css']
})
export class ListMultipleCheckboxExample {
selected = [];
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/** No CSS for this example */
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<mc-list-selection
multiple="keyboard"
[(ngModel)]="selected">
<mc-list-option value="Item 1" disabled>Item 1</mc-list-option>
<mc-list-option value="Item 2">Item 2</mc-list-option>
<mc-list-option value="Item 3">Item 3</mc-list-option>
<mc-list-option value="Item 4">Item 4</mc-list-option>
<mc-list-option value="Item 5">Item 5</mc-list-option>
<mc-list-option value="Item 6">Item 6</mc-list-option>
<mc-list-option value="Item 7">Item 7</mc-list-option>
<mc-list-option value="Item 8">Item 8</mc-list-option>
<mc-list-option value="Item 9">Item 9</mc-list-option>
<mc-list-option value="Item 10">Item 10</mc-list-option>
</mc-list-selection>
<br>
<div>Selected: {{ selected }}</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Component } from '@angular/core';


/**
* @title Basic list
*/
@Component({
selector: 'list-multiple-keyboard-example',
templateUrl: 'list-multiple-keyboard-example.html',
styleUrls: ['list-multiple-keyboard-example.css']
})
export class ListMultipleKeyboardExample {
selected = [];
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/** No CSS for this example */
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<mc-list-selection
[(ngModel)]="selected">
<mc-list-option value="Item 1" disabled>Item 1</mc-list-option>
<mc-list-option value="Item 2">Item 2</mc-list-option>
<mc-list-option value="Item 3">Item 3</mc-list-option>
<mc-list-option value="Item 4">Item 4</mc-list-option>
<mc-list-option value="Item 5">Item 5</mc-list-option>
<mc-list-option value="Item 6">Item 6</mc-list-option>
<mc-list-option value="Item 7">Item 7</mc-list-option>
<mc-list-option value="Item 8">Item 8</mc-list-option>
<mc-list-option value="Item 9">Item 9</mc-list-option>
<mc-list-option value="Item 10">Item 10</mc-list-option>
</mc-list-selection>
<br>
<div>Selected: {{ selected }}</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Component } from '@angular/core';


/**
* @title Basic list
*/
@Component({
selector: 'list-overview-example',
templateUrl: 'list-overview-example.html',
styleUrls: ['list-overview-example.css']
})
export class ListOverviewExample {
selected = [];
}
24 changes: 24 additions & 0 deletions packages/mosaic-examples/mosaic/list/module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { McListModule } from '@ptsecurity/mosaic/list';

import { ListMultipleCheckboxExample } from './list-multiple-checkbox/list-multiple-checkbox-example';
import { ListMultipleKeyboardExample } from './list-multiple-keyboard/list-multiple-keyboard-example';
import { ListOverviewExample } from './list-overview/list-overview-example';


const EXAMPLES = [
ListOverviewExample,
ListMultipleCheckboxExample,
ListMultipleKeyboardExample
];

@NgModule({
imports: [
FormsModule,
McListModule
],
declarations: EXAMPLES,
exports: EXAMPLES
})
export class ListExamplesModule {}
34 changes: 34 additions & 0 deletions packages/mosaic-examples/mosaic/tree/module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { McHighlightModule } from '@ptsecurity/mosaic/core';
import { McFormFieldModule } from '@ptsecurity/mosaic/form-field';
import { McIconModule } from '@ptsecurity/mosaic/icon';
import { McInputModule } from '@ptsecurity/mosaic/input';
import { McTreeModule } from '@ptsecurity/mosaic/tree';

import { TreeFilteringExample } from './tree-filtering/tree-filtering-example';
import { TreeMultipleCheckboxExample } from './tree-multiple-checkbox/tree-multiple-checkbox-example';
import { TreeMultipleKeyboardExample } from './tree-multiple-keyboard/tree-multiple-keyboard-example';
import { TreeOverviewExample } from './tree-overview/tree-overview-example';


const EXAMPLES = [
TreeOverviewExample,
TreeMultipleCheckboxExample,
TreeMultipleKeyboardExample,
TreeFilteringExample
];

@NgModule({
imports: [
FormsModule,
McFormFieldModule,
McInputModule,
McTreeModule,
McIconModule,
McHighlightModule
],
declarations: EXAMPLES,
exports: EXAMPLES
})
export class TreeExamplesModule {}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/** No CSS for this example */
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<mc-form-field>
<input type="text" mcInput (ngModelChange)="onFilterChange($event)" [(ngModel)]="filterValue">
</mc-form-field>

<br><br><br>

<mc-tree-selection
[(ngModel)]="modelValue"
[dataSource]="dataSource"
[treeControl]="treeControl">

<mc-tree-option *mcTreeNodeDef="let node" mcTreeNodePadding [disabled]="node.name === 'tests'">
<span [innerHTML]="treeControl.getViewValue(node) | mcHighlight : treeControl.filterValue.value"></span>
</mc-tree-option>

<mc-tree-option *mcTreeNodeDef="let node; when: hasChild" mcTreeNodePadding>
<mc-tree-node-toggle [node]="node"></mc-tree-node-toggle>

<span [innerHTML]="treeControl.getViewValue(node) | mcHighlight : treeControl.filterValue.value"></span>
</mc-tree-option>
</mc-tree-selection>
Loading

0 comments on commit 22c19db

Please sign in to comment.