Skip to content

Commit

Permalink
chore: upgrade ember-modifier to v4.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
joelamb committed Oct 9, 2023
1 parent 5204d8f commit a11e22e
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 52 deletions.
2 changes: 1 addition & 1 deletion ember-headless-table/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
"@ember/string": "^3.0.0",
"@embroider/addon-shim": "^1.0.0",
"@embroider/macros": "1.10.0",
"ember-modifier": "^3.2.7",
"ember-modifier": "^4.1.0",
"ember-resources": "^5.4.0",
"ember-tracked-storage-polyfill": "^1.0.0",
"tracked-built-ins": "^3.1.0"
Expand Down
45 changes: 18 additions & 27 deletions ember-headless-table/src/-private/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,12 @@ export class Table<DataType = unknown> extends Resource<Signature<DataType>> {
* These are all no-use, no-cost utilities
*/
modifiers = {
container: modifier(
(element: HTMLElement): Destructor => {
let modifiers = this.plugins.map((plugin) => plugin.containerModifier);
let composed = composeFunctionModifiers([attachContainer, ...modifiers]);
container: modifier((element: HTMLElement): Destructor => {
let modifiers = this.plugins.map((plugin) => plugin.containerModifier);
let composed = composeFunctionModifiers([attachContainer, ...modifiers]);

return composed(element, this);
},
{ eager: false }
),
return composed(element, this);
}),

// resize: ResizeModifier,
// TODO: switch to composing real modifiers once "curry" and "compose"
Expand All @@ -150,25 +147,19 @@ export class Table<DataType = unknown> extends Resource<Signature<DataType>> {
//
// With curried+composed modifiers, only the plugin's headerModifier
// that has tracked changes would run, leaving the other modifiers alone
columnHeader: modifier(
(element: HTMLElement, [column]: [Column<DataType>]): Destructor => {
let modifiers = this.plugins.map((plugin) => plugin.headerCellModifier);
let composed = composeFunctionModifiers(modifiers);

return composed(element, { column, table: this });
},
{ eager: false }
),

row: modifier(
(element: HTMLElement, [row]: [Row<DataType>]): Destructor => {
let modifiers = this.plugins.map((plugin) => plugin.rowModifier);
let composed = composeFunctionModifiers(modifiers);

return composed(element, { row, table: this });
},
{ eager: false }
),
columnHeader: modifier((element: HTMLElement, [column]: [Column<DataType>]): Destructor => {
let modifiers = this.plugins.map((plugin) => plugin.headerCellModifier);
let composed = composeFunctionModifiers(modifiers);

return composed(element, { column, table: this });
}),

row: modifier((element: HTMLElement, [row]: [Row<DataType>]): Destructor => {
let modifiers = this.plugins.map((plugin) => plugin.rowModifier);
let composed = composeFunctionModifiers(modifiers);

return composed(element, { row, table: this });
}),
};

/**
Expand Down
50 changes: 26 additions & 24 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a11e22e

Please sign in to comment.