Skip to content

Commit

Permalink
chore(docs): update to remove unneeded requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
NullVoxPopuli committed Oct 26, 2022
1 parent 48ef0bb commit 355e4ab
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 20 deletions.
4 changes: 2 additions & 2 deletions docs/demos/kitchen-sink/demo/demo-a.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ import { tracked } from '@glimmer/tracking';
import { htmlSafe } from '@ember/template';

import { headlessTable } from 'ember-headless-table';
import { meta } from 'ember-headless-table/plugins';
import { meta, columns } from 'ember-headless-table/plugins';
import {
ColumnResizing,
isResizing, resizeHandle
Expand Down Expand Up @@ -139,7 +139,7 @@ export default class extends Component {
@tracked sorts = [];

get columns() {
return meta.forTable(this.table, ColumnReordering).columns;
return columns.for(this.table);
}

get data() {
Expand Down
6 changes: 2 additions & 4 deletions docs/plugins/column-reordering/demo/dema-a.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,11 @@
import Component from '@glimmer/component';

import { headlessTable } from 'ember-headless-table';
import { meta } from 'ember-headless-table/plugins';
import { meta, columns } from 'ember-headless-table/plugins';
import {
ColumnReordering,
moveLeft, moveRight
} from 'ember-headless-table/plugins/column-reordering';
import { ColumnVisibility } from 'ember-headless-table/plugins/column-visibility';

import { DATA } from 'docs-app/sample-data';

Expand All @@ -54,12 +53,11 @@ export default class extends Component {
data: () => DATA,
plugins: [
ColumnReordering,
ColumnVisibility,
],
});

get columns() {
return meta.forTable(this.table, ColumnReordering).columns;
return columns.for(this.table);
}

/**
Expand Down
2 changes: 0 additions & 2 deletions docs/plugins/column-resizing/demo/demo-a.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ export default class extends Component {
],
data: () => DATA,
plugins: [
ColumnVisibility,
ColumnReordering,
ColumnResizing,
],
});
Expand Down
6 changes: 0 additions & 6 deletions docs/plugins/column-resizing/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,16 @@ API Documentation available [here][api-docs]

## Usage

Because this plugin operates or visible columns,
the `ColumnVisibility` plugin is required.

```js
import { headlessTable } from 'ember-headless-table';
import { ColumnResizing, resizeHandle } from 'ember-headless-table/plugins/column-resizing';
import { ColumnVisibility } from 'ember-headless-table/plugins/column-visibility';

// ...
// in a class
table = headlessTable(this, {
columns: () => [ /* ... */ ],
data: () => [ /* ... */ ],
plugins: [
ColumnVisibility,
ColumnResizing,
],
})
Expand Down Expand Up @@ -55,7 +50,6 @@ See the API Documentation [here][api-docs] for the full list of options and desc
table = headlessTable(this, {
columns: () => [ /* ... */ ],
plugins: [
ColumnVisibility,
ColumnResizing.with(() => ({ handlePosition: 'right' })),
],
})
Expand Down
4 changes: 2 additions & 2 deletions docs/plugins/column-visibility/demo/demo-a.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
import Component from '@glimmer/component';

import { headlessTable } from 'ember-headless-table';
import { meta } from 'ember-headless-table/plugins';
import { meta, columns } from 'ember-headless-table/plugins';
import { ColumnVisibility, hide, show } from 'ember-headless-table/plugins/column-visibility';

import { DATA } from 'docs-app/sample-data';
Expand All @@ -65,7 +65,7 @@ export default class extends Component {
});

get columns() {
return meta.forTable(this.table, ColumnVisibility).visibleColumns;
return columns.for(this.table);
}

/**
Expand Down
1 change: 0 additions & 1 deletion docs/plugins/sticky-column/demo/demo-a.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ export default class extends Component {
plugins: [
StickyColumns,
ColumnResizing,
ColumnVisibility,
],
});

Expand Down
8 changes: 5 additions & 3 deletions docs/plugins/sticky-column/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ API Documentation available [here][api-docs]

```js
import { headlessTable } from 'ember-headless-table';
import { ColumnVisibility } from 'ember-headless-table/plugins/column-visibility';
import { StickyColumns } from 'ember-headless-table/plugins/sticky-columns';
import { ColumnResizing } from 'ember-headless-table/plugins/column-resizing';

Expand All @@ -26,13 +25,16 @@ import { ColumnResizing } from 'ember-headless-table/plugins/column-resizing';
],
data: () => [ /* ... */ ],
plugins: [
ColumnReordering,
ColumnVisibility,
ColumnResizing,
StickyColumns,
],
})
```

Note that the `ColumnResizing` plugin is requried because `StickyColumns` needs a guarantee
that a `columnWidth` implementation exists so that columns may become sticky beyond just the
far left and far right columns.

### ColumnOptions

- `sticky`
Expand Down
1 change: 1 addition & 0 deletions docs/plugins/writing-your-own.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ The key properties to look at are:
- `headerCellModifier` - for each `<th>`
- `rowModifier` - for each `<tr>`
- `reset` -- a hook that the table will call on your plugin if you have state to revert to
- `columns` -- for overriding / altering column order / visibility / grouping / etc

With these capabilities, features for tables may be built in a way that relieves implementation complexity on the consumer, such as:

Expand Down

0 comments on commit 355e4ab

Please sign in to comment.