@ember-formwright/power-select 0.0.0-stage → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/LICENSE.md +9 -0
- package/README.md +81 -2
- package/addon-main.cjs +4 -0
- package/declarations/index.d.ts +71 -0
- package/declarations/index.d.ts.map +1 -0
- package/declarations/test-support/index.d.ts +38 -0
- package/declarations/test-support/index.d.ts.map +1 -0
- package/dist/index.js +123 -0
- package/dist/index.js.map +1 -0
- package/dist/test-support/index.js +82 -0
- package/dist/test-support/index.js.map +1 -0
- package/dist/theme.css +56 -0
- package/package.json +106 -3
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# @ember-formwright/power-select
|
|
2
|
+
|
|
3
|
+
## 1.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- abc6560: New package, `@ember-formwright/power-select`: `@control="power-select"` and
|
|
8
|
+
`@control="power-select-multiple"` on ember-power-select 9, with search, async options, a
|
|
9
|
+
`PowerSelectHarness` (`@ember-formwright/power-select/test-support`) and theme hooks.
|
|
10
|
+
|
|
11
|
+
In the core, inline and confirm modes now focus the element carrying the field's id, so
|
|
12
|
+
controls whose focusable element isn't an input (a power-select trigger) get focus. Controls
|
|
13
|
+
receive `@callout` when they render inside a callout popover. An inline field whose object
|
|
14
|
+
value isn't among its options shows the value's label instead of `[object Object]`.
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Updated dependencies [aad9026]
|
|
19
|
+
- Updated dependencies [abc6560]
|
|
20
|
+
- @ember-formwright/ember@1.3.0
|
|
21
|
+
- @ember-formwright/test-support@1.3.0
|
package/LICENSE.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,82 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @ember-formwright/power-select
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Searchable, async and multiple selects for Formwright, powered by
|
|
4
|
+
[ember-power-select](https://ember-power-select.com) 9.
|
|
5
|
+
|
|
6
|
+
```bash
|
|
7
|
+
npm install @ember-formwright/ember @ember-formwright/power-select ember-power-select ember-basic-dropdown ember-concurrency
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
// app/app.ts
|
|
12
|
+
import { registerPowerSelectControls } from '@ember-formwright/power-select'
|
|
13
|
+
import 'ember-basic-dropdown/styles'
|
|
14
|
+
import 'ember-power-select/styles'
|
|
15
|
+
import '@ember-formwright/power-select/theme.css' // optional; after the Formwright theme
|
|
16
|
+
|
|
17
|
+
registerPowerSelectControls() // @control="power-select" and @control="power-select-multiple"
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Render `<BasicDropdownWormhole />` (from `ember-basic-dropdown/components/basic-dropdown-wormhole`)
|
|
21
|
+
once in your application template; dropdowns render into it. In tests, add
|
|
22
|
+
`<div id="ember-basic-dropdown-wormhole"></div>` next to `#ember-testing` in `tests/index.html`.
|
|
23
|
+
|
|
24
|
+
```gts
|
|
25
|
+
<f.Field @for="owner" @control="power-select" @label="Owner"
|
|
26
|
+
@options={{this.users}} @optionLabel="name" as |field|>
|
|
27
|
+
<field.Control @searchEnabled={{true}} @allowClear={{true}} as |user|>
|
|
28
|
+
{{user.name}} <small>{{user.email}}</small>
|
|
29
|
+
</field.Control>
|
|
30
|
+
</f.Field>
|
|
31
|
+
|
|
32
|
+
{{! async search: options come from @search, so give inline mode a @format }}
|
|
33
|
+
<f.Field @for="owner" @control="power-select" @format={{this.userName}} as |field|>
|
|
34
|
+
<field.Control @search={{this.searchUsers}} @searchEnabled={{true}} />
|
|
35
|
+
</f.Field>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
`power-select-multiple` stores an array: of options, or of keys with `@storeKey`, like
|
|
39
|
+
`checkbox-group`. `@options`, `@optionKey`, `@optionLabel` and `@storeKey` work as they do for
|
|
40
|
+
`select`. Other power-select args given to `field.Control` are forwarded (`@search`,
|
|
41
|
+
`@searchEnabled`, `@allowClear`, `@renderInPlace`, `@matcher`, `@searchField`, ...), and its
|
|
42
|
+
block renders each option. Without `@matcher` or `@searchField`, search matches the option's
|
|
43
|
+
label.
|
|
44
|
+
|
|
45
|
+
## Testing
|
|
46
|
+
|
|
47
|
+
```ts
|
|
48
|
+
import { PowerSelectHarness } from '@ember-formwright/power-select/test-support'
|
|
49
|
+
|
|
50
|
+
class TaskForm extends FormHarness {
|
|
51
|
+
@field(PowerSelectHarness) declare owner: PowerSelectHarness
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
await task.owner.search('ada') // waits for @search
|
|
55
|
+
await task.owner.select('Ada Lovelace')
|
|
56
|
+
assert.deepEqual(task.owner.selected, ['Ada Lovelace'])
|
|
57
|
+
await task.owner.clear()
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
It also has `remove(text)` (multiple), `options()`, `isOpen` and `trigger`.
|
|
61
|
+
|
|
62
|
+
## Behaviour and known limits
|
|
63
|
+
|
|
64
|
+
- **Focus.** Inline and confirm modes focus the trigger: core focuses the element with the
|
|
65
|
+
field's id.
|
|
66
|
+
- **Callouts.** In `@inline @callout` forms the control sets `@renderInPlace={{true}}`, so the
|
|
67
|
+
dropdown is inside the popover (the top layer): visible, and a click on an option doesn't
|
|
68
|
+
close the callout. The theme lets the popover overflow for it.
|
|
69
|
+
- **Keyboard.** While the dropdown is open, Enter and Escape belong to it and don't reach the
|
|
70
|
+
field: with `@requireConfirm` or `@inline`, Enter on an option doesn't commit, and the first
|
|
71
|
+
Escape closes the dropdown instead of cancelling the edit.
|
|
72
|
+
- **Async options.** Without `@options`, inline mode shows an object value by its label
|
|
73
|
+
(`@optionLabel`, `label` or `name`). Give the field a `@format` for anything else.
|
|
74
|
+
- **`@storeKey` with `@search`.** A stored key can't be mapped back to an option that hasn't
|
|
75
|
+
been searched for. Pass that option as `@selectedOption` (an array for multiple); options
|
|
76
|
+
chosen afterwards are remembered. Without it, the trigger shows the placeholder.
|
|
77
|
+
- **Labels.** The trigger is a `div role="combobox"`, which `<label for>` doesn't name, so the
|
|
78
|
+
control passes the field's `@label` as `@ariaLabel`. Clicking the label doesn't open the
|
|
79
|
+
dropdown.
|
|
80
|
+
- **Native submit.** power-select renders no `<input name>`; the wrapper carries
|
|
81
|
+
`data-fw-name` with the field's path.
|
|
82
|
+
- **Ember and power-select versions.** Ember 6.12+ and ember-power-select 9 only.
|
package/addon-main.cjs
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { type PowerSelectArgs } from 'ember-power-select/components/power-select';
|
|
3
|
+
import type { Select } from 'ember-power-select/types';
|
|
4
|
+
import { type ControlSignature } from '@ember-formwright/ember';
|
|
5
|
+
/** The power-select args a field's `Control` forwards as they are. */
|
|
6
|
+
type ForwardedArgs = Pick<PowerSelectArgs<unknown, boolean>, 'afterOptionsComponent' | 'allowClear' | 'animationEnabled' | 'beforeOptionsComponent' | 'buildSelection' | 'calculatePosition' | 'closeOnSelect' | 'defaultHighlighted' | 'destination' | 'dropdownClass' | 'extra' | 'groupComponent' | 'highlightOnHover' | 'horizontalPosition' | 'initiallyOpened' | 'loadingMessage' | 'matchTriggerWidth' | 'matcher' | 'noMatchesMessage' | 'onBlur' | 'onClose' | 'onFocus' | 'onInput' | 'onOpen' | 'optionsComponent' | 'placeholderComponent' | 'registerAPI' | 'renderInPlace' | 'resultCountMessage' | 'search' | 'searchEnabled' | 'searchField' | 'searchFieldPosition' | 'searchMessage' | 'searchPlaceholder' | 'selectedItemComponent' | 'title' | 'triggerComponent' | 'typeAheadOptionMatcher' | 'verticalPosition'>;
|
|
7
|
+
type AnySelect = Select<unknown, boolean>;
|
|
8
|
+
export interface PowerSelectControlSignature {
|
|
9
|
+
/** A wrapper around power-select, carrying the control's hooks and any attributes. */
|
|
10
|
+
Element: HTMLDivElement;
|
|
11
|
+
Args: ControlSignature['Args'] & ForwardedArgs & {
|
|
12
|
+
/** Runs before the field's own keyboard handling; return false to stop it. */
|
|
13
|
+
onKeydown?: (select: AnySelect, event: KeyboardEvent) => boolean | void | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* With `@storeKey` and options from `@search`: the option (or, for a multiple select, the
|
|
16
|
+
* options) the stored key stands for, so the trigger can show it on first render.
|
|
17
|
+
*/
|
|
18
|
+
selectedOption?: unknown;
|
|
19
|
+
};
|
|
20
|
+
Blocks: {
|
|
21
|
+
/** Renders each option, and the selected one in the trigger. Default: its label. */
|
|
22
|
+
default: [option: unknown, select: AnySelect];
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* A Formwright control around ember-power-select's `<PowerSelect>`. The field's wiring maps
|
|
27
|
+
* onto power-select's args (`@id` to `@triggerId`, `@invalid` to `@ariaInvalid`, ...); any
|
|
28
|
+
* extra power-select arg given to `field.Control` is forwarded.
|
|
29
|
+
*/
|
|
30
|
+
export declare class PowerSelectControl extends Component<PowerSelectControlSignature> {
|
|
31
|
+
/** Options chosen this session, so a stored key from an async search still finds its option. */
|
|
32
|
+
chosen: readonly unknown[];
|
|
33
|
+
get multiple(): boolean;
|
|
34
|
+
get options(): readonly unknown[] | undefined;
|
|
35
|
+
/** Every option the stored value could stand for. */
|
|
36
|
+
get known(): unknown[];
|
|
37
|
+
/** The option a stored value (an option, or its key with `@storeKey`) stands for. */
|
|
38
|
+
optionFor: (value: unknown) => unknown;
|
|
39
|
+
get selected(): unknown;
|
|
40
|
+
get disabled(): boolean;
|
|
41
|
+
/** Inside a callout the dropdown must stay inside the popover (the top layer). */
|
|
42
|
+
get renderInPlace(): boolean | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* Searches by each option's label (`@optionLabel`, else `label` or `name`), unless power-select
|
|
45
|
+
* is told what to match with `@matcher` or `@searchField`.
|
|
46
|
+
*/
|
|
47
|
+
get matcher(): ((option: unknown, text: string) => number) | undefined;
|
|
48
|
+
labelFor: (option: unknown) => string;
|
|
49
|
+
keyFor: (option: unknown) => string;
|
|
50
|
+
onChange: (selection: unknown) => void;
|
|
51
|
+
remember(options: unknown[]): void;
|
|
52
|
+
/**
|
|
53
|
+
* While the dropdown is open, Enter and Escape belong to it: they choose an option or close
|
|
54
|
+
* the dropdown, and don't reach the field, which would commit or cancel the edit.
|
|
55
|
+
*/
|
|
56
|
+
onKeydown: (select: AnySelect, event: KeyboardEvent) => boolean | void;
|
|
57
|
+
}
|
|
58
|
+
/** The same control, storing an array: of options, or of their keys with `@storeKey`. */
|
|
59
|
+
export declare class PowerSelectMultipleControl extends PowerSelectControl {
|
|
60
|
+
get multiple(): boolean;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Makes `@control="power-select"` and `@control="power-select-multiple"` available to every
|
|
64
|
+
* form. Call once, e.g. in app.ts.
|
|
65
|
+
*/
|
|
66
|
+
export declare function registerPowerSelectControls({ single, multiple, }?: {
|
|
67
|
+
single?: string;
|
|
68
|
+
multiple?: string;
|
|
69
|
+
}): void;
|
|
70
|
+
export {};
|
|
71
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.gts"],"names":[],"mappings":"AA8QA,OAAO,SAAS,MAAM,oBAAoB,CAAA;AAE1C,OAAoB,EAAE,KAAK,eAAe,EAAE,MAAM,4CAA4C,CAAA;AAC9F,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAA;AACtD,OAAO,EAML,KAAK,gBAAgB,EACtB,MAAM,yBAAyB,CAAA;AAEhC,sEAAsE;AACtE,KAAK,aAAa,GAAG,IAAI,CACvB,eAAe,CAAC,OAAO,EAAE,OAAO,CAAC,EAC/B,uBAAuB,GACvB,YAAY,GACZ,kBAAkB,GAClB,wBAAwB,GACxB,gBAAgB,GAChB,mBAAmB,GACnB,eAAe,GACf,oBAAoB,GACpB,aAAa,GACb,eAAe,GACf,OAAO,GACP,gBAAgB,GAChB,kBAAkB,GAClB,oBAAoB,GACpB,iBAAiB,GACjB,gBAAgB,GAChB,mBAAmB,GACnB,SAAS,GACT,kBAAkB,GAClB,QAAQ,GACR,SAAS,GACT,SAAS,GACT,SAAS,GACT,QAAQ,GACR,kBAAkB,GAClB,sBAAsB,GACtB,aAAa,GACb,eAAe,GACf,oBAAoB,GACpB,QAAQ,GACR,eAAe,GACf,aAAa,GACb,qBAAqB,GACrB,eAAe,GACf,mBAAmB,GACnB,uBAAuB,GACvB,OAAO,GACP,kBAAkB,GAClB,wBAAwB,GACxB,kBAAkB,CACrB,CAAA;AAED,KAAK,SAAS,GAAG,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;AAEzC,MAAM,WAAW,2BAA2B;IAC1C,sFAAsF;IACtF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OAGG;IACH,SAAS,GAAI,QAAQ,SAAS,EAAE,OAAO,aAAa,KAAG,OAAO,GAAG,IAAI,CAGpE;CA+FF;AAED,yFAAyF;AACzF,qBAAa,0BAA2B,SAAQ,kBAAkB;IAChE,IAAa,QAAQ,IAAI,OAAO,CAE/B;CACF;AAED;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,EAC1C,MAAuB,EACvB,QAAkC,GACnC,GAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,IAAI,CAGpD"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { FieldHarness } from '@ember-formwright/test-support';
|
|
2
|
+
/**
|
|
3
|
+
* Drives a `power-select` or `power-select-multiple` field with power-select's own test
|
|
4
|
+
* helpers:
|
|
5
|
+
*
|
|
6
|
+
* class OwnerForm extends FormHarness {
|
|
7
|
+
* @field(PowerSelectHarness) declare owner: PowerSelectHarness
|
|
8
|
+
* }
|
|
9
|
+
*
|
|
10
|
+
* await form.owner.search('ada')
|
|
11
|
+
* await form.owner.select('Ada Lovelace')
|
|
12
|
+
* assert.deepEqual(form.owner.selected, ['Ada Lovelace'])
|
|
13
|
+
*/
|
|
14
|
+
export declare class PowerSelectHarness extends FieldHarness {
|
|
15
|
+
static controls: string[];
|
|
16
|
+
/** The trigger: the focusable element the field's label points at. */
|
|
17
|
+
get trigger(): HTMLElement;
|
|
18
|
+
/** A selector for this field alone, for helpers that take one. */
|
|
19
|
+
private get fieldSelector();
|
|
20
|
+
get isMultiple(): boolean;
|
|
21
|
+
/** The text of each selected option, as the trigger shows it. */
|
|
22
|
+
get selected(): string[];
|
|
23
|
+
/** Whether the dropdown is open. */
|
|
24
|
+
get isOpen(): boolean;
|
|
25
|
+
/** Opens the dropdown if needed and clicks the option whose text contains `label`. */
|
|
26
|
+
select(label: string): Promise<void>;
|
|
27
|
+
/** The open dropdown, which power-select renders outside the field (or in place). */
|
|
28
|
+
get dropdown(): Element | null;
|
|
29
|
+
/** Types into the search field, then waits for `@search` to return its options. */
|
|
30
|
+
search(text: string): Promise<void>;
|
|
31
|
+
/** The text of each option in the open dropdown (opening it first). */
|
|
32
|
+
options(): Promise<string[]>;
|
|
33
|
+
/** Clears the selection: the ✕ of `@allowClear`, or every chip of a multiple select. */
|
|
34
|
+
clear(): Promise<void>;
|
|
35
|
+
/** Multiple select: removes one chosen option by its text. */
|
|
36
|
+
remove(label: string): Promise<void>;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/test-support/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAA;AAS7D;;;;;;;;;;;GAWG;AACH,qBAAa,kBAAmB,SAAQ,YAAY;IAClD,OAAgB,QAAQ,WAA4C;IAEpE,sEAAsE;IACtE,IAAI,OAAO,IAAI,WAAW,CAEzB;IAED,kEAAkE;IAClE,OAAO,KAAK,aAAa,GAGxB;IAED,IAAI,UAAU,IAAI,OAAO,CAExB;IAED,iEAAiE;IACjE,IAAI,QAAQ,IAAI,MAAM,EAAE,CASvB;IAED,oCAAoC;IACpC,IAAI,MAAM,IAAI,OAAO,CAEpB;IAED,sFAAsF;IAChF,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI1C,qFAAqF;IACrF,IAAI,QAAQ,IAAI,OAAO,GAAG,IAAI,CAG7B;IAED,mFAAmF;IAC7E,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQzC,uEAAuE;IACjE,OAAO,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAIlC,wFAAwF;IAClF,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAK5B,8DAA8D;IACxD,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAG3C"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { tracked } from '@glimmer/tracking';
|
|
3
|
+
import PowerSelect from 'ember-power-select/components/power-select';
|
|
4
|
+
import { matches, labelOf, keyOf, toStored, registerControl } from '@ember-formwright/ember';
|
|
5
|
+
import { precompileTemplate } from '@ember/template-compilation';
|
|
6
|
+
import { setComponentTemplate } from '@ember/component';
|
|
7
|
+
import { g, i } from 'decorator-transforms/runtime';
|
|
8
|
+
|
|
9
|
+
function asArray(value) {
|
|
10
|
+
if (Array.isArray(value)) return value;
|
|
11
|
+
return value === null || value === undefined ? [] : [value];
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* A Formwright control around ember-power-select's `<PowerSelect>`. The field's wiring maps
|
|
15
|
+
* onto power-select's args (`@id` to `@triggerId`, `@invalid` to `@ariaInvalid`, ...); any
|
|
16
|
+
* extra power-select arg given to `field.Control` is forwarded.
|
|
17
|
+
*/
|
|
18
|
+
class PowerSelectControl extends Component {
|
|
19
|
+
static {
|
|
20
|
+
g(this.prototype, "chosen", [tracked], function () {
|
|
21
|
+
return [];
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
#chosen = (i(this, "chosen"), void 0);
|
|
25
|
+
/** Options chosen this session, so a stored key from an async search still finds its option. */
|
|
26
|
+
get multiple() {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
get options() {
|
|
30
|
+
return this.args.options;
|
|
31
|
+
}
|
|
32
|
+
/** Every option the stored value could stand for. */
|
|
33
|
+
get known() {
|
|
34
|
+
return [...(this.args.options ?? []), ...asArray(this.args.selectedOption), ...this.chosen];
|
|
35
|
+
}
|
|
36
|
+
/** The option a stored value (an option, or its key with `@storeKey`) stands for. */
|
|
37
|
+
optionFor = value => {
|
|
38
|
+
const option = this.known.find(o => matches(value, o, this.args.optionKey));
|
|
39
|
+
if (option !== undefined) return option;
|
|
40
|
+
// A stored key with nothing to map it to: show nothing rather than the bare key.
|
|
41
|
+
return this.args.storeKey ? undefined : value;
|
|
42
|
+
};
|
|
43
|
+
get selected() {
|
|
44
|
+
if (this.multiple) {
|
|
45
|
+
return asArray(this.args.value).map(this.optionFor).filter(o => o !== undefined);
|
|
46
|
+
}
|
|
47
|
+
const value = this.args.value;
|
|
48
|
+
return value === null || value === undefined ? undefined : this.optionFor(value);
|
|
49
|
+
}
|
|
50
|
+
get disabled() {
|
|
51
|
+
// power-select has no readonly state; like the built-in select, readonly disables it.
|
|
52
|
+
return Boolean(this.args.disabled || this.args.readonly);
|
|
53
|
+
}
|
|
54
|
+
/** Inside a callout the dropdown must stay inside the popover (the top layer). */
|
|
55
|
+
get renderInPlace() {
|
|
56
|
+
return this.args.callout ? true : this.args.renderInPlace;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Searches by each option's label (`@optionLabel`, else `label` or `name`), unless power-select
|
|
60
|
+
* is told what to match with `@matcher` or `@searchField`.
|
|
61
|
+
*/
|
|
62
|
+
get matcher() {
|
|
63
|
+
if (this.args.matcher || this.args.searchField) return this.args.matcher;
|
|
64
|
+
return (option, text) => this.labelFor(option).toLocaleLowerCase().indexOf(text.toLocaleLowerCase());
|
|
65
|
+
}
|
|
66
|
+
labelFor = option => labelOf(option, this.args.optionLabel);
|
|
67
|
+
keyFor = option => String(keyOf(option, this.args.optionKey));
|
|
68
|
+
onChange = selection => {
|
|
69
|
+
const store = option => toStored(option, this.args.storeKey, this.args.optionKey);
|
|
70
|
+
if (this.multiple) {
|
|
71
|
+
const options = asArray(selection);
|
|
72
|
+
this.remember(options);
|
|
73
|
+
this.args.onChange(options.map(store));
|
|
74
|
+
} else if (selection === null || selection === undefined) {
|
|
75
|
+
this.args.onChange(null);
|
|
76
|
+
} else {
|
|
77
|
+
this.remember([selection]);
|
|
78
|
+
this.args.onChange(store(selection));
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
remember(options) {
|
|
82
|
+
if (!this.args.storeKey) return;
|
|
83
|
+
const known = this.known;
|
|
84
|
+
const fresh = options.filter(o => !known.includes(o));
|
|
85
|
+
if (fresh.length) this.chosen = [...this.chosen, ...fresh];
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* While the dropdown is open, Enter and Escape belong to it: they choose an option or close
|
|
89
|
+
* the dropdown, and don't reach the field, which would commit or cancel the edit.
|
|
90
|
+
*/
|
|
91
|
+
onKeydown = (select, event) => {
|
|
92
|
+
if (this.args.onKeydown?.(select, event) === false) return false;
|
|
93
|
+
if (select.isOpen && (event.key === 'Enter' || event.key === 'Escape')) event.stopPropagation();
|
|
94
|
+
};
|
|
95
|
+
static {
|
|
96
|
+
setComponentTemplate(precompileTemplate("<div class=\"fw-power-select-control\" data-test-fw-control={{@type}} data-fw-name={{@name}} ...attributes>\n <PowerSelect @options={{this.options}} @selected={{this.selected}} @multiple={{this.multiple}} @onChange={{this.onChange}} @onKeydown={{this.onKeydown}} @triggerId={{@id}} @triggerClass=\"fw-control fw-power-select\" @dropdownClass={{@dropdownClass}} @ariaLabel={{@label}} @ariaDescribedBy={{@describedBy}} @ariaInvalid={{if @invalid \"true\"}} @required={{if @required \"true\"}} @disabled={{this.disabled}} @placeholder={{@placeholder}} @renderInPlace={{this.renderInPlace}} @afterOptionsComponent={{@afterOptionsComponent}} @allowClear={{@allowClear}} @animationEnabled={{@animationEnabled}} @beforeOptionsComponent={{@beforeOptionsComponent}} @buildSelection={{@buildSelection}} @calculatePosition={{@calculatePosition}} @closeOnSelect={{@closeOnSelect}} @defaultHighlighted={{@defaultHighlighted}} @destination={{@destination}} @extra={{@extra}} @groupComponent={{@groupComponent}} @highlightOnHover={{@highlightOnHover}} @horizontalPosition={{@horizontalPosition}} @initiallyOpened={{@initiallyOpened}} @loadingMessage={{@loadingMessage}} @matchTriggerWidth={{@matchTriggerWidth}} @matcher={{this.matcher}} @noMatchesMessage={{@noMatchesMessage}} @onBlur={{@onBlur}} @onClose={{@onClose}} @onFocus={{@onFocus}} @onInput={{@onInput}} @onOpen={{@onOpen}} @optionsComponent={{@optionsComponent}} @placeholderComponent={{@placeholderComponent}} @registerAPI={{@registerAPI}} @resultCountMessage={{@resultCountMessage}} @search={{@search}} @searchEnabled={{@searchEnabled}} @searchField={{@searchField}} @searchFieldPosition={{@searchFieldPosition}} @searchMessage={{@searchMessage}} @searchPlaceholder={{@searchPlaceholder}} @selectedItemComponent={{@selectedItemComponent}} @title={{@title}} @triggerComponent={{@triggerComponent}} @typeAheadOptionMatcher={{@typeAheadOptionMatcher}} @verticalPosition={{@verticalPosition}} as |option select|>\n <span class=\"fw-power-select-option\" data-test-fw-option={{this.keyFor option}}>\n {{#if (has-block)}}\n {{yield option select}}\n {{else}}\n {{this.labelFor option}}\n {{/if}}\n </span>\n </PowerSelect>\n</div>", {
|
|
97
|
+
strictMode: true,
|
|
98
|
+
scope: () => ({
|
|
99
|
+
PowerSelect
|
|
100
|
+
})
|
|
101
|
+
}), this);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
/** The same control, storing an array: of options, or of their keys with `@storeKey`. */
|
|
105
|
+
class PowerSelectMultipleControl extends PowerSelectControl {
|
|
106
|
+
get multiple() {
|
|
107
|
+
return true;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Makes `@control="power-select"` and `@control="power-select-multiple"` available to every
|
|
112
|
+
* form. Call once, e.g. in app.ts.
|
|
113
|
+
*/
|
|
114
|
+
function registerPowerSelectControls({
|
|
115
|
+
single = 'power-select',
|
|
116
|
+
multiple = 'power-select-multiple'
|
|
117
|
+
} = {}) {
|
|
118
|
+
registerControl(single, PowerSelectControl);
|
|
119
|
+
registerControl(multiple, PowerSelectMultipleControl);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export { PowerSelectControl, PowerSelectMultipleControl, registerPowerSelectControls };
|
|
123
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/index.gts"],"sourcesContent":["import Component from '@glimmer/component'\nimport { tracked } from '@glimmer/tracking'\nimport PowerSelect, { type PowerSelectArgs } from 'ember-power-select/components/power-select'\nimport type { Select } from 'ember-power-select/types'\nimport {\n registerControl,\n keyOf,\n labelOf,\n matches,\n toStored,\n type ControlSignature,\n} from '@ember-formwright/ember'\n\n/** The power-select args a field's `Control` forwards as they are. */\ntype ForwardedArgs = Pick<\n PowerSelectArgs<unknown, boolean>,\n | 'afterOptionsComponent'\n | 'allowClear'\n | 'animationEnabled'\n | 'beforeOptionsComponent'\n | 'buildSelection'\n | 'calculatePosition'\n | 'closeOnSelect'\n | 'defaultHighlighted'\n | 'destination'\n | 'dropdownClass'\n | 'extra'\n | 'groupComponent'\n | 'highlightOnHover'\n | 'horizontalPosition'\n | 'initiallyOpened'\n | 'loadingMessage'\n | 'matchTriggerWidth'\n | 'matcher'\n | 'noMatchesMessage'\n | 'onBlur'\n | 'onClose'\n | 'onFocus'\n | 'onInput'\n | 'onOpen'\n | 'optionsComponent'\n | 'placeholderComponent'\n | 'registerAPI'\n | 'renderInPlace'\n | 'resultCountMessage'\n | 'search'\n | 'searchEnabled'\n | 'searchField'\n | 'searchFieldPosition'\n | 'searchMessage'\n | 'searchPlaceholder'\n | 'selectedItemComponent'\n | 'title'\n | 'triggerComponent'\n | 'typeAheadOptionMatcher'\n | 'verticalPosition'\n>\n\ntype AnySelect = Select<unknown, boolean>\n\nexport interface PowerSelectControlSignature {\n /** A wrapper around power-select, carrying the control's hooks and any attributes. */\n Element: HTMLDivElement\n Args: ControlSignature['Args'] &\n ForwardedArgs & {\n /** Runs before the field's own keyboard handling; return false to stop it. */\n onKeydown?: (select: AnySelect, event: KeyboardEvent) => boolean | void | undefined\n /**\n * With `@storeKey` and options from `@search`: the option (or, for a multiple select, the\n * options) the stored key stands for, so the trigger can show it on first render.\n */\n selectedOption?: unknown\n }\n Blocks: {\n /** Renders each option, and the selected one in the trigger. Default: its label. */\n default: [option: unknown, select: AnySelect]\n }\n}\n\nfunction asArray(value: unknown): unknown[] {\n if (Array.isArray(value)) return value\n return value === null || value === undefined ? [] : [value]\n}\n\n/**\n * A Formwright control around ember-power-select's `<PowerSelect>`. The field's wiring maps\n * onto power-select's args (`@id` to `@triggerId`, `@invalid` to `@ariaInvalid`, ...); any\n * extra power-select arg given to `field.Control` is forwarded.\n */\nexport class PowerSelectControl extends Component<PowerSelectControlSignature> {\n /** Options chosen this session, so a stored key from an async search still finds its option. */\n @tracked chosen: readonly unknown[] = []\n\n get multiple(): boolean {\n return false\n }\n\n get options(): readonly unknown[] | undefined {\n return this.args.options\n }\n\n /** Every option the stored value could stand for. */\n get known(): unknown[] {\n return [...(this.args.options ?? []), ...asArray(this.args.selectedOption), ...this.chosen]\n }\n\n /** The option a stored value (an option, or its key with `@storeKey`) stands for. */\n optionFor = (value: unknown): unknown => {\n const option = this.known.find(o => matches(value, o, this.args.optionKey))\n if (option !== undefined) return option\n // A stored key with nothing to map it to: show nothing rather than the bare key.\n return this.args.storeKey ? undefined : value\n }\n\n get selected(): unknown {\n if (this.multiple) {\n return asArray(this.args.value)\n .map(this.optionFor)\n .filter(o => o !== undefined)\n }\n const value = this.args.value\n return value === null || value === undefined ? undefined : this.optionFor(value)\n }\n\n get disabled(): boolean {\n // power-select has no readonly state; like the built-in select, readonly disables it.\n return Boolean(this.args.disabled || this.args.readonly)\n }\n\n /** Inside a callout the dropdown must stay inside the popover (the top layer). */\n get renderInPlace(): boolean | undefined {\n return this.args.callout ? true : this.args.renderInPlace\n }\n\n /**\n * Searches by each option's label (`@optionLabel`, else `label` or `name`), unless power-select\n * is told what to match with `@matcher` or `@searchField`.\n */\n get matcher(): ((option: unknown, text: string) => number) | undefined {\n if (this.args.matcher || this.args.searchField) return this.args.matcher\n return (option, text) =>\n this.labelFor(option).toLocaleLowerCase().indexOf(text.toLocaleLowerCase())\n }\n\n labelFor = (option: unknown): string => labelOf(option, this.args.optionLabel)\n keyFor = (option: unknown): string => String(keyOf(option, this.args.optionKey))\n\n onChange = (selection: unknown): void => {\n const store = (option: unknown) => toStored(option, this.args.storeKey, this.args.optionKey)\n if (this.multiple) {\n const options = asArray(selection)\n this.remember(options)\n this.args.onChange(options.map(store))\n } else if (selection === null || selection === undefined) {\n this.args.onChange(null)\n } else {\n this.remember([selection])\n this.args.onChange(store(selection))\n }\n }\n\n remember(options: unknown[]): void {\n if (!this.args.storeKey) return\n const known = this.known\n const fresh = options.filter(o => !known.includes(o))\n if (fresh.length) this.chosen = [...this.chosen, ...fresh]\n }\n\n /**\n * While the dropdown is open, Enter and Escape belong to it: they choose an option or close\n * the dropdown, and don't reach the field, which would commit or cancel the edit.\n */\n onKeydown = (select: AnySelect, event: KeyboardEvent): boolean | void => {\n if (this.args.onKeydown?.(select, event) === false) return false\n if (select.isOpen && (event.key === 'Enter' || event.key === 'Escape')) event.stopPropagation()\n }\n\n <template>\n <div\n class=\"fw-power-select-control\"\n data-test-fw-control={{@type}}\n data-fw-name={{@name}}\n ...attributes\n >\n <PowerSelect\n @options={{this.options}}\n @selected={{this.selected}}\n @multiple={{this.multiple}}\n @onChange={{this.onChange}}\n @onKeydown={{this.onKeydown}}\n @triggerId={{@id}}\n @triggerClass=\"fw-control fw-power-select\"\n @dropdownClass={{@dropdownClass}}\n @ariaLabel={{@label}}\n @ariaDescribedBy={{@describedBy}}\n @ariaInvalid={{if @invalid \"true\"}}\n @required={{if @required \"true\"}}\n @disabled={{this.disabled}}\n @placeholder={{@placeholder}}\n @renderInPlace={{this.renderInPlace}}\n @afterOptionsComponent={{@afterOptionsComponent}}\n @allowClear={{@allowClear}}\n @animationEnabled={{@animationEnabled}}\n @beforeOptionsComponent={{@beforeOptionsComponent}}\n @buildSelection={{@buildSelection}}\n @calculatePosition={{@calculatePosition}}\n @closeOnSelect={{@closeOnSelect}}\n @defaultHighlighted={{@defaultHighlighted}}\n @destination={{@destination}}\n @extra={{@extra}}\n @groupComponent={{@groupComponent}}\n @highlightOnHover={{@highlightOnHover}}\n @horizontalPosition={{@horizontalPosition}}\n @initiallyOpened={{@initiallyOpened}}\n @loadingMessage={{@loadingMessage}}\n @matchTriggerWidth={{@matchTriggerWidth}}\n @matcher={{this.matcher}}\n @noMatchesMessage={{@noMatchesMessage}}\n @onBlur={{@onBlur}}\n @onClose={{@onClose}}\n @onFocus={{@onFocus}}\n @onInput={{@onInput}}\n @onOpen={{@onOpen}}\n @optionsComponent={{@optionsComponent}}\n @placeholderComponent={{@placeholderComponent}}\n @registerAPI={{@registerAPI}}\n @resultCountMessage={{@resultCountMessage}}\n @search={{@search}}\n @searchEnabled={{@searchEnabled}}\n @searchField={{@searchField}}\n @searchFieldPosition={{@searchFieldPosition}}\n @searchMessage={{@searchMessage}}\n @searchPlaceholder={{@searchPlaceholder}}\n @selectedItemComponent={{@selectedItemComponent}}\n @title={{@title}}\n @triggerComponent={{@triggerComponent}}\n @typeAheadOptionMatcher={{@typeAheadOptionMatcher}}\n @verticalPosition={{@verticalPosition}}\n as |option select|\n >\n <span class=\"fw-power-select-option\" data-test-fw-option={{this.keyFor option}}>\n {{#if (has-block)}}\n {{yield option select}}\n {{else}}\n {{this.labelFor option}}\n {{/if}}\n </span>\n </PowerSelect>\n </div>\n </template>\n}\n\n/** The same control, storing an array: of options, or of their keys with `@storeKey`. */\nexport class PowerSelectMultipleControl extends PowerSelectControl {\n override get multiple(): boolean {\n return true\n }\n}\n\n/**\n * Makes `@control=\"power-select\"` and `@control=\"power-select-multiple\"` available to every\n * form. Call once, e.g. in app.ts.\n */\nexport function registerPowerSelectControls({\n single = 'power-select',\n multiple = 'power-select-multiple',\n}: { single?: string; multiple?: string } = {}): void {\n registerControl(single, PowerSelectControl)\n registerControl(multiple, PowerSelectMultipleControl)\n}\n"],"names":["asArray","value","Array","isArray","undefined","PowerSelectControl","Component","g","prototype","tracked","i","multiple","options","args","known","selectedOption","chosen","optionFor","option","find","o","matches","optionKey","storeKey","selected","map","filter","disabled","Boolean","readonly","renderInPlace","callout","matcher","searchField","text","labelFor","toLocaleLowerCase","indexOf","labelOf","optionLabel","keyFor","String","keyOf","onChange","selection","store","toStored","remember","fresh","includes","length","onKeydown","select","event","isOpen","key","stopPropagation","setComponentTemplate","precompileTemplate","strictMode","scope","PowerSelect","PowerSelectMultipleControl","registerPowerSelectControls","single","registerControl"],"mappings":";;;;;;;;AA+EA,SAASA,OAAAA,CAAQC,KAAc,EAAU;EACvC,IAAIC,KAAA,CAAMC,OAAO,CAACF,KAAA,CAAA,EAAQ,OAAOA,KAAA;AACjC,EAAA,OAAOA,KAAA,KAAU,IAAA,IAAQA,KAAA,KAAUG,SAAA,GAAY,EAAE,GAAG,CAACH,KAAA,CAAM;AAC7D;AAEA;;;;;AAKO,MAAMI,kBAAA,SAA2BC,SAAA,CAAU;AAAA,EAAA;IAAAC,CAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,QAAA,EAAA,CAE/CC,OAAA,CAAA,EAAA,YAAA;AAAA,MAAA,OAAqC,EAAE;AAAA,IAAA,CAAA,CAAA;AAAA;EAAA,OAAA,IAAAC,CAAA,CAAA,IAAA,EAAA,QAAA,CAAA,EAAA,MAAA;AADxC;EAGA,IAAIC,QAAAA,GAAoB;AACtB,IAAA,OAAO,KAAA;AACT,EAAA;EAEA,IAAIC,OAAAA,GAA0C;AAC5C,IAAA,OAAO,IAAI,CAACC,IAAI,CAACD,OAAO;AAC1B,EAAA;AAEA;EACA,IAAIE,KAAAA,GAAmB;IACrB,OAAO,CAAI,IAAC,IAAI,CAACD,IAAI,CAACD,OAAO,IAAI,EAAE,CAAA,EAAM,GAAAZ,OAAA,CAAQ,IAAI,CAACa,IAAI,CAACE,cAAc,CAAA,EAAM,GAAA,IAAI,CAACC,MAAM,CAAC;AAC7F,EAAA;AAEA;EACAC,SAAA,GAAahB,KAAc,IAAU;IACnC,MAAMiB,SAAS,IAAI,CAACJ,KAAK,CAACK,IAAI,CAACC,CAAA,IAAKC,OA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,KAAA,CAAMmC,QAAQ,CAAC7B,CAAA,CAAA,CAAA;AAClD,IAAA,IAAI4B,MAAME,MAAM,EAAE,IAAI,CAAClC,MAAM,GAAG,CAAI,GAAA,IAAI,CAACA,MAAM,EAAK,GAAAgC,KAAA,CAAM;AAC5D,EAAA;AAEA;;;;AAIAG,EAAAA,SAAA,GAAYA,CAACC,MAAQ,EAAWC,KAAO,KAA8B;AACnE,IAAA,IAAI,IAAI,CAACxC,IAAI,CAACsC,SAAS,GAAGC,MAAA,EAAQC,KAAA,CAAA,KAAW,KAAA,EAAO,OAAO,KAAA;IAC3D,IAAID,MAAA,CAAOE,MAAM,KAAKD,MAAME,GAAG,KAAK,OAAA,IAAWF,KAAA,CAAME,GAAG,KAAK,QAAQ,CAAA,EAAGF,MAAMG,eAAe,EAAA;EAC/F,CAAA;AAEA,EAAA;IAAAC,oBAAA,CAAAC,kBAAA,CAAA,mqEAAA,EAwEA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;AAEA;AACO,MAAMC,0BAAA,SAAmCzD,kBAAA,CAAA;EAC9C,IAAaM,QAAAA,GAAoB;AAC/B,IAAA,OAAO,IAAA;AACT,EAAA;AACF;AAEA;;;;AAIO,SAASoD,2BAAAA,CAA4B;AAC1CC,EAAAA,SAAS,cAAc;AACvBrD,EAAAA,WAAW;CAC4B,GAAG,EAAE,EAAO;AACnDsD,EAAAA,eAAA,CAAgBD,MAAA,EAAQ3D,kBAAA,CAAA;AACxB4D,EAAAA,eAAA,CAAgBtD,QAAA,EAAUmD,0BAAA,CAAA;AAC5B;;"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { waitUntil } from '@ember/test-helpers';
|
|
2
|
+
import { FieldHarness } from '@ember-formwright/test-support';
|
|
3
|
+
import { selectChoose, selectSearch, getDropdownItems, clearSelected, removeMultipleOption } from 'ember-power-select/test-support';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Drives a `power-select` or `power-select-multiple` field with power-select's own test
|
|
7
|
+
* helpers:
|
|
8
|
+
*
|
|
9
|
+
* class OwnerForm extends FormHarness {
|
|
10
|
+
* @field(PowerSelectHarness) declare owner: PowerSelectHarness
|
|
11
|
+
* }
|
|
12
|
+
*
|
|
13
|
+
* await form.owner.search('ada')
|
|
14
|
+
* await form.owner.select('Ada Lovelace')
|
|
15
|
+
* assert.deepEqual(form.owner.selected, ['Ada Lovelace'])
|
|
16
|
+
*/
|
|
17
|
+
class PowerSelectHarness extends FieldHarness {
|
|
18
|
+
static controls = ['power-select', 'power-select-multiple'];
|
|
19
|
+
|
|
20
|
+
/** The trigger: the focusable element the field's label points at. */
|
|
21
|
+
get trigger() {
|
|
22
|
+
return this.control;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** A selector for this field alone, for helpers that take one. */
|
|
26
|
+
get fieldSelector() {
|
|
27
|
+
const path = this.element.getAttribute('data-test-fw-path') ?? this.path;
|
|
28
|
+
return `[data-test-fw-path="${CSS.escape(path)}"]`;
|
|
29
|
+
}
|
|
30
|
+
get isMultiple() {
|
|
31
|
+
return this.type === 'power-select-multiple' || this.trigger.matches('[aria-multiselectable]');
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** The text of each selected option, as the trigger shows it. */
|
|
35
|
+
get selected() {
|
|
36
|
+
const items = this.isMultiple ? this.trigger.querySelectorAll('.ember-power-select-multiple-option') : this.trigger.querySelectorAll('.ember-power-select-selected-item');
|
|
37
|
+
return [...items].map(item => (item.querySelector('.fw-power-select-option') ?? item).textContent.replace(/\s+/g, ' ').trim());
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** Whether the dropdown is open. */
|
|
41
|
+
get isOpen() {
|
|
42
|
+
return this.trigger.getAttribute('aria-expanded') === 'true';
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** Opens the dropdown if needed and clicks the option whose text contains `label`. */
|
|
46
|
+
async select(label) {
|
|
47
|
+
await selectChoose(this.trigger, label);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** The open dropdown, which power-select renders outside the field (or in place). */
|
|
51
|
+
get dropdown() {
|
|
52
|
+
const id = this.trigger.getAttribute('data-ebd-id')?.replace(/-trigger$/, '');
|
|
53
|
+
return id ? document.getElementById(`ember-basic-dropdown-content-${id}`) : null;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** Types into the search field, then waits for `@search` to return its options. */
|
|
57
|
+
async search(text) {
|
|
58
|
+
await selectSearch(this.trigger, text);
|
|
59
|
+
await waitUntil(() => !this.dropdown?.querySelector('.ember-power-select-option--loading-message'), {
|
|
60
|
+
timeoutMessage: `Formwright harness: search in "${this.path}" never finished loading`
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** The text of each option in the open dropdown (opening it first). */
|
|
65
|
+
async options() {
|
|
66
|
+
return (await getDropdownItems(this.trigger)).map(text => text?.replace(/\s+/g, ' ') ?? '');
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** Clears the selection: the ✕ of `@allowClear`, or every chip of a multiple select. */
|
|
70
|
+
async clear() {
|
|
71
|
+
if (!this.isMultiple) return clearSelected(this.fieldSelector);
|
|
72
|
+
for (const label of this.selected) await removeMultipleOption(this.fieldSelector, label);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** Multiple select: removes one chosen option by its text. */
|
|
76
|
+
async remove(label) {
|
|
77
|
+
await removeMultipleOption(this.fieldSelector, label);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export { PowerSelectHarness };
|
|
82
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/test-support/index.ts"],"sourcesContent":["import { waitUntil } from '@ember/test-helpers'\nimport { FieldHarness } from '@ember-formwright/test-support'\nimport {\n clearSelected,\n getDropdownItems,\n removeMultipleOption,\n selectChoose,\n selectSearch,\n} from 'ember-power-select/test-support'\n\n/**\n * Drives a `power-select` or `power-select-multiple` field with power-select's own test\n * helpers:\n *\n * class OwnerForm extends FormHarness {\n * @field(PowerSelectHarness) declare owner: PowerSelectHarness\n * }\n *\n * await form.owner.search('ada')\n * await form.owner.select('Ada Lovelace')\n * assert.deepEqual(form.owner.selected, ['Ada Lovelace'])\n */\nexport class PowerSelectHarness extends FieldHarness {\n static override controls = ['power-select', 'power-select-multiple']\n\n /** The trigger: the focusable element the field's label points at. */\n get trigger(): HTMLElement {\n return this.control\n }\n\n /** A selector for this field alone, for helpers that take one. */\n private get fieldSelector(): string {\n const path = this.element.getAttribute('data-test-fw-path') ?? this.path\n return `[data-test-fw-path=\"${CSS.escape(path)}\"]`\n }\n\n get isMultiple(): boolean {\n return this.type === 'power-select-multiple' || this.trigger.matches('[aria-multiselectable]')\n }\n\n /** The text of each selected option, as the trigger shows it. */\n get selected(): string[] {\n const items = this.isMultiple\n ? this.trigger.querySelectorAll('.ember-power-select-multiple-option')\n : this.trigger.querySelectorAll('.ember-power-select-selected-item')\n return [...items].map(item =>\n (item.querySelector('.fw-power-select-option') ?? item)\n .textContent!.replace(/\\s+/g, ' ')\n .trim(),\n )\n }\n\n /** Whether the dropdown is open. */\n get isOpen(): boolean {\n return this.trigger.getAttribute('aria-expanded') === 'true'\n }\n\n /** Opens the dropdown if needed and clicks the option whose text contains `label`. */\n async select(label: string): Promise<void> {\n await selectChoose(this.trigger, label)\n }\n\n /** The open dropdown, which power-select renders outside the field (or in place). */\n get dropdown(): Element | null {\n const id = this.trigger.getAttribute('data-ebd-id')?.replace(/-trigger$/, '')\n return id ? document.getElementById(`ember-basic-dropdown-content-${id}`) : null\n }\n\n /** Types into the search field, then waits for `@search` to return its options. */\n async search(text: string): Promise<void> {\n await selectSearch(this.trigger, text)\n await waitUntil(\n () => !this.dropdown?.querySelector('.ember-power-select-option--loading-message'),\n { timeoutMessage: `Formwright harness: search in \"${this.path}\" never finished loading` },\n )\n }\n\n /** The text of each option in the open dropdown (opening it first). */\n async options(): Promise<string[]> {\n return (await getDropdownItems(this.trigger)).map(text => text?.replace(/\\s+/g, ' ') ?? '')\n }\n\n /** Clears the selection: the ✕ of `@allowClear`, or every chip of a multiple select. */\n async clear(): Promise<void> {\n if (!this.isMultiple) return clearSelected(this.fieldSelector)\n for (const label of this.selected) await removeMultipleOption(this.fieldSelector, label)\n }\n\n /** Multiple select: removes one chosen option by its text. */\n async remove(label: string): Promise<void> {\n await removeMultipleOption(this.fieldSelector, label)\n }\n}\n"],"names":["PowerSelectHarness","FieldHarness","controls","trigger","control","fieldSelector","path","element","getAttribute","CSS","escape","isMultiple","type","matches","selected","items","querySelectorAll","map","item","querySelector","textContent","replace","trim","isOpen","select","label","selectChoose","dropdown","id","document","getElementById","search","text","selectSearch","waitUntil","timeoutMessage","options","getDropdownItems","clear","clearSelected","removeMultipleOption","remove"],"mappings":";;;;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,kBAAkB,SAASC,YAAY,CAAC;AACnD,EAAA,OAAgBC,QAAQ,GAAG,CAAC,cAAc,EAAE,uBAAuB,CAAC;;AAEpE;EACA,IAAIC,OAAOA,GAAgB;IACzB,OAAO,IAAI,CAACC,OAAO;AACrB,EAAA;;AAEA;EACA,IAAYC,aAAaA,GAAW;AAClC,IAAA,MAAMC,IAAI,GAAG,IAAI,CAACC,OAAO,CAACC,YAAY,CAAC,mBAAmB,CAAC,IAAI,IAAI,CAACF,IAAI;AACxE,IAAA,OAAO,uBAAuBG,GAAG,CAACC,MAAM,CAACJ,IAAI,CAAC,CAAA,EAAA,CAAI;AACpD,EAAA;EAEA,IAAIK,UAAUA,GAAY;AACxB,IAAA,OAAO,IAAI,CAACC,IAAI,KAAK,uBAAuB,IAAI,IAAI,CAACT,OAAO,CAACU,OAAO,CAAC,wBAAwB,CAAC;AAChG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,IAAI,CAAA,wBAAA;AAA2B,KAC1F,CAAC;AACH,EAAA;;AAEA;EACA,MAAM8B,OAAOA,GAAsB;IACjC,OAAO,CAAC,MAAMC,gBAAgB,CAAC,IAAI,CAAClC,OAAO,CAAC,EAAEc,GAAG,CAACe,IAAI,IAAIA,IAAI,EAAEX,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI,EAAE,CAAC;AAC7F,EAAA;;AAEA;EACA,MAAMiB,KAAKA,GAAkB;IAC3B,IAAI,CAAC,IAAI,CAAC3B,UAAU,EAAE,OAAO4B,aAAa,CAAC,IAAI,CAAClC,aAAa,CAAC;AAC9D,IAAA,KAAK,MAAMoB,KAAK,IAAI,IAAI,CAACX,QAAQ,EAAE,MAAM0B,oBAAoB,CAAC,IAAI,CAACnC,aAAa,EAAEoB,KAAK,CAAC;AAC1F,EAAA;;AAEA;EACA,MAAMgB,MAAMA,CAAChB,KAAa,EAAiB;AACzC,IAAA,MAAMe,oBAAoB,CAAC,IAAI,CAACnC,aAAa,EAAEoB,KAAK,CAAC;AACvD,EAAA;AACF;;"}
|
package/dist/theme.css
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Formwright hooks for ember-power-select. Import power-select's own CSS first, then this:
|
|
3
|
+
*
|
|
4
|
+
* import 'ember-basic-dropdown/styles'
|
|
5
|
+
* import 'ember-power-select/styles'
|
|
6
|
+
* import '@ember-formwright/ember/theme.css'
|
|
7
|
+
* import '@ember-formwright/power-select/theme.css'
|
|
8
|
+
*
|
|
9
|
+
* It doesn't restyle power-select. It makes the trigger follow the Formwright theme's custom
|
|
10
|
+
* properties (borders, radius, focus ring, invalid and disabled states), and lets a dropdown
|
|
11
|
+
* rendered in a callout overflow the popover.
|
|
12
|
+
*/
|
|
13
|
+
.fw-power-select.ember-power-select-trigger {
|
|
14
|
+
font: inherit;
|
|
15
|
+
color: var(--fw-fg);
|
|
16
|
+
background: var(--fw-bg);
|
|
17
|
+
border: 1px solid var(--fw-border);
|
|
18
|
+
border-radius: var(--fw-radius);
|
|
19
|
+
padding: 0.35rem 1.6rem 0.35rem 0.7rem;
|
|
20
|
+
min-height: 2.4rem;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.fw-power-select.ember-power-select-trigger:focus,
|
|
24
|
+
.fw-power-select.ember-power-select-trigger--active {
|
|
25
|
+
outline: none;
|
|
26
|
+
border-color: var(--fw-border-focus);
|
|
27
|
+
box-shadow: var(--fw-ring);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.fw-field[data-invalid] .fw-power-select.ember-power-select-trigger,
|
|
31
|
+
.fw-power-select.ember-power-select-trigger[aria-invalid='true'] {
|
|
32
|
+
border-color: var(--fw-error);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.fw-power-select.ember-power-select-trigger[aria-disabled='true'],
|
|
36
|
+
.fw-field[data-disabled] .fw-power-select.ember-power-select-trigger {
|
|
37
|
+
opacity: 0.6;
|
|
38
|
+
cursor: not-allowed;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.fw-power-select-control {
|
|
42
|
+
flex: 1;
|
|
43
|
+
min-width: 0;
|
|
44
|
+
display: grid;
|
|
45
|
+
position: relative;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/* A dropdown rendered in place inside a callout must not be clipped by the popover. */
|
|
49
|
+
.fw-callout:has(.ember-basic-dropdown-content--in-place) {
|
|
50
|
+
overflow: visible;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/* power-select's own placeholder grey is too light against --fw-bg. */
|
|
54
|
+
.fw-power-select .ember-power-select-placeholder {
|
|
55
|
+
color: var(--fw-muted);
|
|
56
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,109 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ember-formwright/power-select",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "1.3.0",
|
|
4
|
+
"description": "Searchable, async and multiple selects for Formwright, powered by ember-power-select.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"ember-addon",
|
|
7
|
+
"ember",
|
|
8
|
+
"forms",
|
|
9
|
+
"formwright",
|
|
10
|
+
"power-select",
|
|
11
|
+
"select"
|
|
12
|
+
],
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"author": "Joe Gaudet <joe@joegaudet.com>",
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "git+https://github.com/joegaudet/ember-formwright.git",
|
|
18
|
+
"directory": "packages/power-select"
|
|
19
|
+
},
|
|
20
|
+
"homepage": "https://joegaudet.com/ember-formwright/",
|
|
21
|
+
"bugs": "https://github.com/joegaudet/ember-formwright/issues",
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"types": "./declarations/index.d.ts",
|
|
25
|
+
"default": "./dist/index.js"
|
|
26
|
+
},
|
|
27
|
+
"./test-support": {
|
|
28
|
+
"types": "./declarations/test-support/index.d.ts",
|
|
29
|
+
"default": "./dist/test-support/index.js"
|
|
30
|
+
},
|
|
31
|
+
"./theme.css": "./dist/theme.css",
|
|
32
|
+
"./addon-main.js": "./addon-main.cjs"
|
|
33
|
+
},
|
|
34
|
+
"typesVersions": {
|
|
35
|
+
"*": {
|
|
36
|
+
"*": [
|
|
37
|
+
"declarations/*"
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"files": [
|
|
42
|
+
"addon-main.cjs",
|
|
43
|
+
"declarations",
|
|
44
|
+
"dist",
|
|
45
|
+
"README.md",
|
|
46
|
+
"CHANGELOG.md"
|
|
47
|
+
],
|
|
48
|
+
"dependencies": {
|
|
49
|
+
"@embroider/addon-shim": "^1.10.3",
|
|
50
|
+
"decorator-transforms": "^2.4.0"
|
|
51
|
+
},
|
|
52
|
+
"peerDependencies": {
|
|
53
|
+
"@ember/test-helpers": ">= 5.0.0",
|
|
54
|
+
"ember-power-select": ">= 9.0.0",
|
|
55
|
+
"ember-source": ">= 6.12.0",
|
|
56
|
+
"@ember-formwright/ember": "^1.3.0",
|
|
57
|
+
"@ember-formwright/test-support": "^1.3.0"
|
|
58
|
+
},
|
|
59
|
+
"peerDependenciesMeta": {
|
|
60
|
+
"@ember-formwright/test-support": {
|
|
61
|
+
"optional": true
|
|
62
|
+
},
|
|
63
|
+
"@ember/test-helpers": {
|
|
64
|
+
"optional": true
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
"devDependencies": {
|
|
68
|
+
"@babel/core": "^7.29.7",
|
|
69
|
+
"@babel/plugin-transform-typescript": "^7.29.7",
|
|
70
|
+
"@babel/runtime": "^7.29.7",
|
|
71
|
+
"@ember/library-tsconfig": "^3.0.0",
|
|
72
|
+
"@ember/test-helpers": "^5.7.0",
|
|
73
|
+
"@embroider/addon-dev": "^8.4.2",
|
|
74
|
+
"@embroider/macros": "^1.21.1",
|
|
75
|
+
"@glimmer/component": "^2.1.1",
|
|
76
|
+
"@glimmer/tracking": "^1.1.2",
|
|
77
|
+
"@glint/ember-tsc": "^1.11.6",
|
|
78
|
+
"@glint/template": "^1.9.0",
|
|
79
|
+
"@rollup/plugin-babel": "^7.1.0",
|
|
80
|
+
"babel-plugin-ember-template-compilation": "^4.0.1",
|
|
81
|
+
"ember-basic-dropdown": "^9.0.1",
|
|
82
|
+
"ember-concurrency": "^5.3.0",
|
|
83
|
+
"ember-power-select": "^9.0.3",
|
|
84
|
+
"ember-source": "~7.3.0",
|
|
85
|
+
"rollup": "^4.64.6",
|
|
86
|
+
"typescript": "~6.0.3",
|
|
87
|
+
"@ember-formwright/test-support": "1.3.0",
|
|
88
|
+
"@ember-formwright/ember": "1.3.0"
|
|
89
|
+
},
|
|
90
|
+
"publishConfig": {
|
|
91
|
+
"access": "public"
|
|
92
|
+
},
|
|
93
|
+
"engines": {
|
|
94
|
+
"node": ">=22.12.0"
|
|
95
|
+
},
|
|
96
|
+
"ember": {
|
|
97
|
+
"edition": "octane"
|
|
98
|
+
},
|
|
99
|
+
"ember-addon": {
|
|
100
|
+
"version": 2,
|
|
101
|
+
"type": "addon",
|
|
102
|
+
"main": "addon-main.cjs"
|
|
103
|
+
},
|
|
104
|
+
"scripts": {
|
|
105
|
+
"build": "rollup --config",
|
|
106
|
+
"start": "rollup --config --watch",
|
|
107
|
+
"typecheck": "ember-tsc --noEmit"
|
|
108
|
+
}
|
|
6
109
|
}
|