From 355e4ab035c2540a66e3bb9fd9a81e0390a55eb3 Mon Sep 17 00:00:00 2001 From: NullVoxPopuli Date: Tue, 25 Oct 2022 18:37:26 -0400 Subject: [PATCH] chore(docs): update to remove unneeded requirements --- docs/demos/kitchen-sink/demo/demo-a.md | 4 ++-- docs/plugins/column-reordering/demo/dema-a.md | 6 ++---- docs/plugins/column-resizing/demo/demo-a.md | 2 -- docs/plugins/column-resizing/index.md | 6 ------ docs/plugins/column-visibility/demo/demo-a.md | 4 ++-- docs/plugins/sticky-column/demo/demo-a.md | 1 - docs/plugins/sticky-column/index.md | 8 +++++--- docs/plugins/writing-your-own.md | 1 + 8 files changed, 12 insertions(+), 20 deletions(-) diff --git a/docs/demos/kitchen-sink/demo/demo-a.md b/docs/demos/kitchen-sink/demo/demo-a.md index 3c146a8d..34b9a0ac 100644 --- a/docs/demos/kitchen-sink/demo/demo-a.md +++ b/docs/demos/kitchen-sink/demo/demo-a.md @@ -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 @@ -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() { diff --git a/docs/plugins/column-reordering/demo/dema-a.md b/docs/plugins/column-reordering/demo/dema-a.md index 836ec3b9..1646665d 100644 --- a/docs/plugins/column-reordering/demo/dema-a.md +++ b/docs/plugins/column-reordering/demo/dema-a.md @@ -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'; @@ -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); } /** diff --git a/docs/plugins/column-resizing/demo/demo-a.md b/docs/plugins/column-resizing/demo/demo-a.md index f6edb86e..7656c539 100644 --- a/docs/plugins/column-resizing/demo/demo-a.md +++ b/docs/plugins/column-resizing/demo/demo-a.md @@ -62,8 +62,6 @@ export default class extends Component { ], data: () => DATA, plugins: [ - ColumnVisibility, - ColumnReordering, ColumnResizing, ], }); diff --git a/docs/plugins/column-resizing/index.md b/docs/plugins/column-resizing/index.md index 4c7cd444..4d963235 100644 --- a/docs/plugins/column-resizing/index.md +++ b/docs/plugins/column-resizing/index.md @@ -6,13 +6,9 @@ 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 @@ -20,7 +16,6 @@ import { ColumnVisibility } from 'ember-headless-table/plugins/column-visibility columns: () => [ /* ... */ ], data: () => [ /* ... */ ], plugins: [ - ColumnVisibility, ColumnResizing, ], }) @@ -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' })), ], }) diff --git a/docs/plugins/column-visibility/demo/demo-a.md b/docs/plugins/column-visibility/demo/demo-a.md index 22f5a36e..22dc5661 100644 --- a/docs/plugins/column-visibility/demo/demo-a.md +++ b/docs/plugins/column-visibility/demo/demo-a.md @@ -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'; @@ -65,7 +65,7 @@ export default class extends Component { }); get columns() { - return meta.forTable(this.table, ColumnVisibility).visibleColumns; + return columns.for(this.table); } /** diff --git a/docs/plugins/sticky-column/demo/demo-a.md b/docs/plugins/sticky-column/demo/demo-a.md index bd536b07..df2460b2 100644 --- a/docs/plugins/sticky-column/demo/demo-a.md +++ b/docs/plugins/sticky-column/demo/demo-a.md @@ -59,7 +59,6 @@ export default class extends Component { plugins: [ StickyColumns, ColumnResizing, - ColumnVisibility, ], }); diff --git a/docs/plugins/sticky-column/index.md b/docs/plugins/sticky-column/index.md index bfcb13ed..538f368b 100644 --- a/docs/plugins/sticky-column/index.md +++ b/docs/plugins/sticky-column/index.md @@ -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'; @@ -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` diff --git a/docs/plugins/writing-your-own.md b/docs/plugins/writing-your-own.md index 998552fe..aa873961 100644 --- a/docs/plugins/writing-your-own.md +++ b/docs/plugins/writing-your-own.md @@ -31,6 +31,7 @@ The key properties to look at are: - `headerCellModifier` - for each `` - `rowModifier` - for each `` - `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: