Skip to content

Commit

Permalink
Move to ember-cli@5.2.0 (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
onechiporenko committed Sep 20, 2023
1 parent 4e39ed7 commit 04c4ab7
Show file tree
Hide file tree
Showing 18 changed files with 2,698 additions and 1,664 deletions.
19 changes: 6 additions & 13 deletions .github/workflows/ci.yml
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Install Node
uses: actions/setup-node@v3
with:
node-version: 14.x
node-version: 16
cache: yarn
- name: Install Dependencies
run: yarn install --frozen-lockfile
Expand All @@ -40,7 +40,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 14.x
node-version: 16
cache: yarn
- name: Install Dependencies
run: yarn install --no-lockfile
Expand All @@ -56,7 +56,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 14.x
node-version: 16
cache: yarn
- name: Install Dependencies
run: yarn install --frozen-lockfile
Expand All @@ -73,22 +73,15 @@ jobs:
fail-fast: false
matrix:
try-scenario:
- ember-lts-3.28
- ember-lts-4.4
- ember-lts-4.8
- ember-release
- ember-beta
- ember-canary
- ember-lts-3.24-with-plain-html
- ember-lts-3.28-with-plain-html
- ember-default-with-plain-html
- ember-beta-with-plain-html
- ember-lts-3.24-with-ember-bootstrap-v4
- ember-lts-3.28-with-ember-bootstrap-v4
- ember-default-with-ember-bootstrap-v4
- ember-beta-with-ember-bootstrap-v4
- ember-lts-3.24-with-ember-bootstrap-v5
- ember-lts-3.28-with-ember-bootstrap-v5
- ember-default-with-ember-bootstrap-v5
- ember-beta-with-ember-bootstrap-v5
- embroider-safe
Expand All @@ -99,7 +92,7 @@ jobs:
- name: Install Node
uses: actions/setup-node@v3
with:
node-version: 14.x
node-version: 16
cache: yarn
- name: Install Dependencies
run: yarn install --frozen-lockfile
Expand Down Expand Up @@ -128,7 +121,7 @@ jobs:
- name: Install Node
uses: actions/setup-node@v3
with:
node-version: 14.x
node-version: 16
cache: yarn
- name: Install Dependencies
run: yarn install --frozen-lockfile
Expand All @@ -149,7 +142,7 @@ jobs:
- name: Install Node
uses: actions/setup-node@v3
with:
node-version: 14.x
node-version: 16
cache: yarn
- name: Install Dependencies
run: yarn install --frozen-lockfile
Expand Down
2 changes: 0 additions & 2 deletions .gitignore
@@ -1,5 +1,3 @@
# See https://help.github.com/ignore-files/ for more about ignoring files.

# compiled output
/dist/
/tmp/
Expand Down
5 changes: 1 addition & 4 deletions .prettierignore
Expand Up @@ -13,8 +13,7 @@
# misc
/coverage/
!.*
.eslintcache
.lint-todo/
.*/

# ember-try
/.node_modules.ember-try/
Expand All @@ -23,5 +22,3 @@
/package.json.ember-try
/package-lock.json.ember-try
/yarn.lock.ember-try

.idea
4 changes: 2 additions & 2 deletions addon-test-support/pages/models-table-bs4.js
Expand Up @@ -10,9 +10,9 @@ export const definition = {
{
content: text(),
click: clickable('input'),
}
},
),
})
}),
),
};

Expand Down
4 changes: 2 additions & 2 deletions addon-test-support/pages/models-table-bs5.js
Expand Up @@ -19,9 +19,9 @@ export const definition = {
{
content: text(),
click: clickable('input'),
}
},
),
})
}),
),
};

Expand Down
28 changes: 13 additions & 15 deletions addon/components/models-table/themes/default/floating-filter.ts
Expand Up @@ -4,11 +4,9 @@ import { action } from '@ember/object';
import { isBlank, isNone } from '@ember/utils';
import { EmberRunTimer } from '@ember/runloop/types';
import { cancel, debounce } from '@ember/runloop';
import { RowFilteringCellArgs } from 'ember-models-table/components/models-table/themes/default/row-filtering-cell';
import {
ModelsTableDataItem,
SelectOption,
} from 'ember-models-table/components/models-table';
import { RowFilteringCellArgs } from 'ember-models-table/interfaces/components/models-table/themes/default/row-filtering-cell-args.interface';
import { SelectOption } from 'ember-models-table/interfaces/select-option.interface';
import { ModelsTableDataItem } from 'ember-models-table/types/models-table-data-item.type';

export interface FloatingFilterArgs extends RowFilteringCellArgs {
clearColumnFilter: (e: Event) => boolean;
Expand Down Expand Up @@ -56,7 +54,7 @@ export interface FloatingFilterOptions {
export const columnListFloatingFilterFunction = (
cellValue: string,
floatingFilterValue: string,
row: ModelsTableDataItem
row: ModelsTableDataItem,
): boolean => {
floatingFilterValue = floatingFilterValue || '{}';
const { args } = JSON.parse(floatingFilterValue);
Expand All @@ -67,7 +65,7 @@ export const columnListFloatingFilterFunction = (
export const columnNumberFloatingFilterFunction = (
cellValue: string,
floatingFilterValue: string,
row: ModelsTableDataItem
row: ModelsTableDataItem,
): boolean => {
floatingFilterValue = floatingFilterValue || '{}';
const { type, args } = JSON.parse(floatingFilterValue);
Expand Down Expand Up @@ -103,7 +101,7 @@ export const columnNumberFloatingFilterFunction = (
export const columnStringFloatingFilterFunction = (
cellValue: string,
floatingFilterValue: string,
row: ModelsTableDataItem
row: ModelsTableDataItem,
): boolean => {
floatingFilterValue = floatingFilterValue || '{}';
const { type, args } = JSON.parse(floatingFilterValue);
Expand Down Expand Up @@ -179,7 +177,7 @@ export default class FloatingFilter extends Component<FloatingFilterArgs> {
return this.getThemeKeyValue(
'floatingFilter',
'Icon',
'fa fa-fw fa-filter'
'fa fa-fw fa-filter',
);
}

Expand Down Expand Up @@ -252,7 +250,7 @@ export default class FloatingFilter extends Component<FloatingFilterArgs> {
{
label: this.getFilterLabel(
FilterType.NOT_STARTS_WITH,
'Not starts with'
'Not starts with',
),
value: FilterType.NOT_STARTS_WITH,
},
Expand Down Expand Up @@ -364,15 +362,15 @@ export default class FloatingFilter extends Component<FloatingFilterArgs> {
return this.listFilterOptions;
}
return this.listFilterOptions.filter((opt) =>
`${opt.value}`.includes(this.filterForListFilterOptions)
`${opt.value}`.includes(this.filterForListFilterOptions),
);
}

protected get selectIcon(): string {
return this.getThemeKeyValue(
'SelectAll',
'Icon',
'fa fa-fw fa-check-square-o'
'fa fa-fw fa-check-square-o',
);
}

Expand Down Expand Up @@ -403,7 +401,7 @@ export default class FloatingFilter extends Component<FloatingFilterArgs> {
protected getThemeKeyValue(
key: string,
type: string,
defaultValue: string
defaultValue: string,
): string {
const themeKey = `floatingFilter${key}${type}`;
return (this.args.themeInstance[themeKey] as string) ?? defaultValue;
Expand Down Expand Up @@ -432,7 +430,7 @@ export default class FloatingFilter extends Component<FloatingFilterArgs> {
@action
protected updateFilterListItem(
opt: FloatingFilterListOption,
e: Event
e: Event,
): boolean {
opt.checked = !opt.checked;
e?.stopPropagation?.();
Expand Down Expand Up @@ -463,7 +461,7 @@ export default class FloatingFilter extends Component<FloatingFilterArgs> {
args.push(
this.listFilterOptions
.filter((opt) => opt.checked)
.map((opt) => opt.value)
.map((opt) => opt.value),
);
}
if (this.showFirstArgInput) {
Expand Down
18 changes: 18 additions & 0 deletions addon/template-registry.ts
@@ -0,0 +1,18 @@
import DefaultFloatingFilter from './components/models-table/themes/default/floating-filter';
import EmberBootstrapV4FloatingFilter from './components/models-table/themes/ember-bootstrap-v4/floating-filter';
import EmberBootstrapV5FloatingFilter from './components/models-table/themes/ember-bootstrap-v5/floating-filter';
import PlainHtmlFloatingFilter from './components/models-table/themes/plain-html/floating-filter';

export default interface Registry {
'ModelsTable::Themes::Default::FloatingFilter': typeof DefaultFloatingFilter;
'models-table/themes/default/floating-filter': typeof DefaultFloatingFilter;

'ModelsTable::Themes::EmberBootstrapV4::FloatingFilter': typeof EmberBootstrapV4FloatingFilter;
'models-table/themes/ember-bootstrap-v4/floating-filter': typeof EmberBootstrapV4FloatingFilter;

'ModelsTable::Themes::EmberBootstrapV5::FloatingFilter': typeof EmberBootstrapV5FloatingFilter;
'models-table/themes/ember-bootstrap-v5/floating-filter': typeof EmberBootstrapV5FloatingFilter;

'ModelsTable::Themes::PlainHtml::FloatingFilter': typeof PlainHtmlFloatingFilter;
'models-table/themes/plain-html/floating-filter': typeof PlainHtmlFloatingFilter;
}
11 changes: 7 additions & 4 deletions addon/utils/emt/themes/ebs.ts
@@ -1,26 +1,29 @@
import Component from '@glimmer/component';
import { ComponentLike } from '@glint/template';
import {
macroCondition,
dependencySatisfies,
importSync,
} from '@embroider/macros';
import { assert } from '@ember/debug';
import { BsButtonSignature } from 'ember-models-table/override-types/ember-bootstrap/bs-button';
import { BsFormSignature } from 'ember-models-table/override-types/ember-bootstrap/bs-form';
import { BsDropdownSignature } from 'ember-models-table/override-types/ember-bootstrap/bs-dropdown';

export const getBsButton = (): Component => {
export const getBsButton = (): ComponentLike<BsButtonSignature> => {
if (macroCondition(dependencySatisfies('ember-bootstrap', '>=5'))) {
assert('ember-bootstrap v5 not found', false);
}
return (importSync('ember-bootstrap/components/bs-button') as any).default;
};

export const getBsForm = (): Component => {
export const getBsForm = (): ComponentLike<BsFormSignature> => {
if (macroCondition(dependencySatisfies('ember-bootstrap', '>=5'))) {
assert('ember-bootstrap v5 not found', false);
}
return (importSync('ember-bootstrap/components/bs-form') as any).default;
};

export const getBsDropdown = (): Component => {
export const getBsDropdown = (): ComponentLike<BsDropdownSignature> => {
if (macroCondition(dependencySatisfies('ember-bootstrap', '>=5'))) {
assert('ember-bootstrap v5 not found', false);
}
Expand Down
10 changes: 5 additions & 5 deletions blueprints/ember-models-table-floating-filter/index.js
Expand Up @@ -40,7 +40,7 @@ module.exports = {
beforeInstall(options) {
this.includePlainHtmlThemeCss = hasOwnProperty.call(
options,
'includePlainHtmlThemeCss'
'includePlainHtmlThemeCss',
)
? options.includePlainHtmlThemeCss
: false;
Expand Down Expand Up @@ -84,15 +84,15 @@ module.exports = {
fs.writeFileSync(file, newBuild.code());
this.ui.writeLine(
chalk.green(
`Added ember-models-table-floating-filter configuration to ${file}.`
)
`Added ember-models-table-floating-filter configuration to ${file}.`,
),
);
} catch (error) {
const settingsString = JSON.stringify(settings);
this.ui.writeLine(
chalk.red(
`Configuration file could not be edited. Manually update your ${file} to include '${this.name}': ${settingsString}.`
)
`Configuration file could not be edited. Manually update your ${file} to include '${this.name}': ${settingsString}.`,
),
);
}
},
Expand Down
2 changes: 1 addition & 1 deletion index.js
Expand Up @@ -16,7 +16,7 @@ module.exports = {
const options = Object.assign(
{},
defaultOptions,
app.options['ember-models-table-floating-filter']
app.options['ember-models-table-floating-filter'],
);
let vendorPath = path.join('vendor', 'ember-models-table-floating-filter');
if (options.includePlainHtmlThemeCss) {
Expand Down

0 comments on commit 04c4ab7

Please sign in to comment.