@ember-eui/core 12.0.0 → 12.0.1
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/declarations/components/eui-combo-box/options.d.ts.map +1 -1
- package/declarations/components/eui-combo-box/trigger/input.d.ts.map +1 -1
- package/declarations/components/eui-combo-box.d.ts +1 -0
- package/declarations/components/eui-combo-box.d.ts.map +1 -1
- package/dist/components/eui-combo-box/options.js +3 -19
- package/dist/components/eui-combo-box/options.js.map +1 -1
- package/dist/components/eui-combo-box/trigger/input.js +2 -4
- package/dist/components/eui-combo-box/trigger/input.js.map +1 -1
- package/dist/components/eui-combo-box/trigger.js +1 -1
- package/dist/components/eui-combo-box/trigger.js.map +1 -1
- package/dist/components/eui-combo-box.js +1 -0
- package/dist/components/eui-combo-box.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../../src/components/eui-combo-box/options.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../../src/components/eui-combo-box/options.ts"],"names":[],"mappings":"AAQA,OAAO,uBAAuB,MAAM,oDAAoD,CAAC;AAYzF,OAAO,KAAK,gBAAgB,MAAM,2BAA2B,CAAC;AAG9D,MAAM,CAAC,OAAO,OAAO,2BAA4B,SAAQ,uBAAuB;IAC7D,SAAS,EAAE,gBAAgB,CAAC;IAC7C,aAAa,EAAE,GAAG,EAAE,CAAM;IAE1B,IAAI,cAAc,QAgBjB;IAED,gBAAgB,CAAC,KAAK,EAAE,MAAM;IAW9B,IAAI,eAAe,WAIlB;IAED,IAAI,SAAS,QAGZ;IAED,IAAI,eAAe,yCAElB;CAoHF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../../../src/components/eui-combo-box/trigger/input.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../../../src/components/eui-combo-box/trigger/input.ts"],"names":[],"mappings":"AAMA,OAAO,iDAAiD,MAAM,2DAA2D,CAAC;AAK1H,MAAM,CAAC,OAAO,OAAO,gCAAiC,SAAQ,iDAAiD;IAC7G,IAAI,yBAAyB,yCAgB5B;IAGD,aAAa,CAAC,CAAC,EAAE,aAAa,GAAG,KAAK,GAAG,IAAI;CAgG9C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eui-combo-box.d.ts","sourceRoot":"","sources":["../../src/components/eui-combo-box.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"eui-combo-box.d.ts","sourceRoot":"","sources":["../../src/components/eui-combo-box.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAM3C,OAAO,6BAA6B,CAAC;AAkBrC,OAAO,KAAK,OAAO,MAAM,sBAAsB,CAAC;AAEhD,UAAU,YAAY,CAAC,CAAC,CAAE,SAAQ,OAAO,CAAC,CAAC,CAAC;IAC1C,OAAO,EAAE,GAAG,CAAC;CACd;AAED,UAAU,MAAM;IACd,QAAQ,EAAE,GAAG,CAAC;IACd,OAAO,EAAE;QACP,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;KAC/B,CAAC;CACH;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,cAAc,CAAC;IACxB,IAAI,EAAE;QACJ,eAAe,CAAC,EACZ,OAAO,GACP;YACE,WAAW,CAAC,EAAE,OAAO,CAAC;SACvB,CAAC;QACN,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,GAAG,SAAS,CAAC;QACzD,OAAO,EAAE,GAAG,EAAE,CAAC;QACf,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,GAAG,EAAE,GAAG,YAA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,MAAM,EAAE;QAAE,OAAO,EAAE,EAAE,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;IAkCtE,WAAW,CAAC,MAAM,EAAE,MAAM;IAK1B,QAAQ,CAAC,QAAQ,EAAE,GAAG,EAAE;IASxB,cAAc;IAwBd,cAAc,CAAC,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM;CA4B3C"}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { isArray } from '@ember/array';
|
|
2
1
|
import didInsert from '@ember/render-modifiers/modifiers/did-insert';
|
|
3
2
|
import willDestroy from '@ember/render-modifiers/modifiers/will-destroy';
|
|
4
3
|
import { inject } from '@ember/service';
|
|
5
4
|
import { htmlSafe } from '@ember/template';
|
|
6
|
-
import { isEqual } from '@ember/utils';
|
|
7
5
|
import { EnsureSafeComponentHelper } from '@embroider/util';
|
|
8
6
|
import VerticalCollection from '@html-next/vertical-collection/components/vertical-collection/component';
|
|
9
7
|
import EmberPowerSelectOptions from 'ember-power-select/components/power-select/options';
|
|
@@ -14,25 +12,11 @@ import EuiFlexGroup from '../eui-flex-group.js';
|
|
|
14
12
|
import EuiFlexItem from '../eui-flex-item.js';
|
|
15
13
|
import EuiLoadingSpinner from '../eui-loading-spinner.js';
|
|
16
14
|
import EuiTextComponent from '../eui-text.js';
|
|
15
|
+
import emberPowerSelectIsEqual from 'ember-power-select/helpers/ember-power-select-is-equal';
|
|
17
16
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
18
17
|
import { setComponentTemplate } from '@ember/component';
|
|
19
18
|
import { g, i } from 'decorator-transforms/runtime';
|
|
20
19
|
|
|
21
|
-
function emberPowerSelectIsSelected([option, selected]) {
|
|
22
|
-
if (selected === undefined || selected === null) {
|
|
23
|
-
return false;
|
|
24
|
-
}
|
|
25
|
-
if (isArray(selected)) {
|
|
26
|
-
for (let i = 0; i < selected.length; i++) {
|
|
27
|
-
if (isEqual(selected[i], option)) {
|
|
28
|
-
return true;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
return false;
|
|
32
|
-
} else {
|
|
33
|
-
return isEqual(option, selected);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
20
|
class EuiComboBoxOptionsComponent extends EmberPowerSelectOptions {
|
|
37
21
|
static {
|
|
38
22
|
g(this.prototype, "euiConfig", [inject]);
|
|
@@ -72,7 +56,7 @@ class EuiComboBoxOptionsComponent extends EmberPowerSelectOptions {
|
|
|
72
56
|
return htmlSafe(`height:${this.rowHeight}px;`);
|
|
73
57
|
}
|
|
74
58
|
static {
|
|
75
|
-
setComponentTemplate(precompileTemplate("\n {{!-- @glint-nocheck: not typesafe yet --}}\n {{#let (component (EnsureSafeComponentHelper @groupComponent)) as |Group|}}\n {{#if @select.loading}}\n <EuiText @size=\"xs\" class=\"euiComboBoxOptionsList__empty\">\n <EuiFlexGroup @gutterSize=\"s\" @justifyContent=\"center\" @responsive={{false}}>\n <EuiFlexItem @grow={{false}}>\n <EuiLoadingSpinner @size=\"m\" />\n </EuiFlexItem>\n <EuiFlexItem @grow={{false}}>\n {{@loadingMessage}}\n </EuiFlexItem>\n </EuiFlexGroup>\n </EuiText>\n {{else}}\n {{!-- template-lint-disable --}}\n <VerticalCollection @items={{this.flattedOptions}} @tagName=\"div\" @estimateHeight={{this.rowHeight}} @staticHeight={{true}} @bufferSize={{3}} style=\"max-height: 200px; overflow-y: auto;\" role=\"listbox\" aria-controls=\"ember-power-select-trigger-{{@select.uniqueId}}\" class={{@class}} {{didInsert this.addHandlers}} {{willDestroy this.removeHandlers}} ...attributes as |opt index|>\n {{!-- template-lint-enable --}}\n {{#if (emberPowerSelectIsGroupHelper opt)}}\n <Group @group={{opt}} @select={{@select}} @extra={{@extra}} style={{this.rowHeightString}} data-option-index=\"{{index}}\" />\n {{else}}\n <li style={{this.rowHeightString}} class=\"euiFilterSelectItem\n {{if (eq opt @select.highlighted) \" euiFilterSelectItem-isFocused\"}}\" aria-selected=\"{{
|
|
59
|
+
setComponentTemplate(precompileTemplate("\n {{!-- @glint-nocheck: not typesafe yet --}}\n {{#let (component (EnsureSafeComponentHelper @groupComponent)) as |Group|}}\n {{#if @select.loading}}\n <EuiText @size=\"xs\" class=\"euiComboBoxOptionsList__empty\">\n <EuiFlexGroup @gutterSize=\"s\" @justifyContent=\"center\" @responsive={{false}}>\n <EuiFlexItem @grow={{false}}>\n <EuiLoadingSpinner @size=\"m\" />\n </EuiFlexItem>\n <EuiFlexItem @grow={{false}}>\n {{@loadingMessage}}\n </EuiFlexItem>\n </EuiFlexGroup>\n </EuiText>\n {{else}}\n {{!-- template-lint-disable --}}\n <VerticalCollection @items={{this.flattedOptions}} @tagName=\"div\" @estimateHeight={{this.rowHeight}} @staticHeight={{true}} @bufferSize={{3}} style=\"max-height: 200px; overflow-y: auto;\" role=\"listbox\" aria-controls=\"ember-power-select-trigger-{{@select.uniqueId}}\" class={{@class}} {{didInsert this.addHandlers}} {{willDestroy this.removeHandlers}} ...attributes as |opt index|>\n {{!-- template-lint-enable --}}\n {{#if (emberPowerSelectIsGroupHelper opt)}}\n <Group @group={{opt}} @select={{@select}} @extra={{@extra}} style={{this.rowHeightString}} data-option-index=\"{{index}}\" />\n {{else}}\n <li style={{this.rowHeightString}} class=\"euiFilterSelectItem\n {{if (eq opt @select.highlighted) \" euiFilterSelectItem-isFocused\"}}\" aria-selected=\"{{emberPowerSelectIsEqual opt @select.selected}}\" aria-disabled={{if opt.disabled \"true\"}} aria-current=\"{{eq opt @select.highlighted}}\" data-option-index=\"{{index}}\" role=\"option\" tabindex={{if opt.disabled \"-1\" \"0\"}}>\n <span class=\"euiComboBoxOption__contentWrapper\">\n <span class=\"euiComboBoxOption__content\">\n {{yield opt index @select}}\n </span>\n {{#if (and (eq opt @select.highlighted) (not opt.disabled))}}\n <EuiBadge class=\"euiComboBoxOption__enterBadge\" @color=\"hollow\" @iconType=\"returnKey\" aria-hidden=\"true\" />\n {{/if}}\n </span>\n </li>\n {{/if}}\n </VerticalCollection>\n {{/if}}\n {{/let}}\n ", {
|
|
76
60
|
strictMode: true,
|
|
77
61
|
scope: () => ({
|
|
78
62
|
EnsureSafeComponentHelper,
|
|
@@ -85,7 +69,7 @@ class EuiComboBoxOptionsComponent extends EmberPowerSelectOptions {
|
|
|
85
69
|
willDestroy,
|
|
86
70
|
emberPowerSelectIsGroupHelper,
|
|
87
71
|
eq,
|
|
88
|
-
|
|
72
|
+
emberPowerSelectIsEqual,
|
|
89
73
|
and,
|
|
90
74
|
not,
|
|
91
75
|
EuiBadge
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.js","sources":["../../../src/components/eui-combo-box/options.gts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"options.js","sources":["../../../src/components/eui-combo-box/options.gts"],"sourcesContent":["import didInsert from '@ember/render-modifiers/modifiers/did-insert';\nimport willDestroy from '@ember/render-modifiers/modifiers/will-destroy';\nimport { inject as service } from '@ember/service';\nimport { htmlSafe } from '@ember/template';\nimport { EnsureSafeComponentHelper } from '@embroider/util';\n\n//@ts-expect-error\nimport VerticalCollection from '@html-next/vertical-collection/components/vertical-collection/component';\nimport EmberPowerSelectOptions from 'ember-power-select/components/power-select/options';\nimport emberPowerSelectIsGroupHelper, {\n emberPowerSelectIsGroup\n} from 'ember-power-select/helpers/ember-power-select-is-group';\nimport { and, eq, not } from 'ember-truth-helpers';\n\nimport EuiBadge from '../eui-badge.gts';\nimport EuiFlexGroup from '../eui-flex-group.gts';\nimport EuiFlexItem from '../eui-flex-item.gts';\nimport EuiLoadingSpinner from '../eui-loading-spinner.gts';\nimport EuiText from '../eui-text.gts';\n\nimport type EuiConfigService from '../../services/eui-config';\nimport emberPowerSelectIsEqual from 'ember-power-select/helpers/ember-power-select-is-equal';\n\nexport default class EuiComboBoxOptionsComponent extends EmberPowerSelectOptions {\n @service declare euiConfig: EuiConfigService;\n _optionsCache: any[] = [];\n\n get flattedOptions() {\n if (this._optionsCache !== this.args.options) {\n this._optionsCache = this.args.options;\n\n return this.args.options?.reduce((acc, curr) => {\n if (emberPowerSelectIsGroup([curr])) {\n acc.push(curr, ...curr.options);\n } else {\n acc.push(curr);\n }\n\n return acc;\n }, []);\n }\n\n return this._optionsCache;\n }\n\n _optionFromIndex(index: string) {\n let parts = index.split('.');\n let option = this.flattedOptions.at?.(parseInt(parts[0]!, 10));\n\n for (let i = 1; i < parts.length; i++) {\n option = option.options[parseInt(parts[i]!, 10)];\n }\n\n return option;\n }\n\n get configRowHeight() {\n return (\n (this.euiConfig.getConfig('euiComboBoxOptionsHeight') as number) || 29\n );\n }\n\n get rowHeight() {\n //@ts-expect-error\n return this.args.rowHeight ?? this.configRowHeight;\n }\n\n get rowHeightString() {\n return htmlSafe(`height:${this.rowHeight}px;`);\n }\n\n <template>\n {{! @glint-nocheck: not typesafe yet }}\n {{#let (component (EnsureSafeComponentHelper @groupComponent)) as |Group|}}\n {{#if @select.loading}}\n <EuiText @size=\"xs\" class=\"euiComboBoxOptionsList__empty\">\n <EuiFlexGroup\n @gutterSize=\"s\"\n @justifyContent=\"center\"\n @responsive={{false}}\n >\n <EuiFlexItem @grow={{false}}>\n <EuiLoadingSpinner @size=\"m\" />\n </EuiFlexItem>\n <EuiFlexItem @grow={{false}}>\n {{@loadingMessage}}\n </EuiFlexItem>\n </EuiFlexGroup>\n </EuiText>\n {{else}}\n {{! template-lint-disable }}\n <VerticalCollection\n @items={{this.flattedOptions}}\n @tagName=\"div\"\n @estimateHeight={{this.rowHeight}}\n @staticHeight={{true}}\n @bufferSize={{3}}\n style=\"max-height: 200px; overflow-y: auto;\"\n role=\"listbox\"\n aria-controls=\"ember-power-select-trigger-{{@select.uniqueId}}\"\n class={{@class}}\n {{didInsert this.addHandlers}}\n {{willDestroy this.removeHandlers}}\n ...attributes\n as |opt index|\n >\n {{! template-lint-enable }}\n {{#if (emberPowerSelectIsGroupHelper opt)}}\n <Group\n @group={{opt}}\n @select={{@select}}\n @extra={{@extra}}\n style={{this.rowHeightString}}\n data-option-index=\"{{index}}\"\n />\n {{else}}\n <li\n style={{this.rowHeightString}}\n class=\"euiFilterSelectItem\n {{if\n (eq opt @select.highlighted)\n ' euiFilterSelectItem-isFocused'\n }}\"\n aria-selected=\"{{emberPowerSelectIsEqual opt @select.selected}}\"\n aria-disabled={{if opt.disabled \"true\"}}\n aria-current=\"{{eq opt @select.highlighted}}\"\n data-option-index=\"{{index}}\"\n role=\"option\"\n tabindex={{if opt.disabled \"-1\" \"0\"}}\n >\n <span class=\"euiComboBoxOption__contentWrapper\">\n <span class=\"euiComboBoxOption__content\">\n {{yield opt index @select}}\n </span>\n {{#if (and (eq opt @select.highlighted) (not opt.disabled))}}\n <EuiBadge\n class=\"euiComboBoxOption__enterBadge\"\n @color=\"hollow\"\n @iconType=\"returnKey\"\n aria-hidden=\"true\"\n />\n {{/if}}\n </span>\n </li>\n {{/if}}\n </VerticalCollection>\n {{/if}}\n {{/let}}\n </template>\n}\n"],"names":["EuiComboBoxOptionsComponent","EmberPowerSelectOptions","g","prototype","service","i","void 0","_optionsCache","flattedOptions","args","options","reduce","acc","curr","emberPowerSelectIsGroup","push","_optionFromIndex","index","parts","split","option","at","parseInt","length","configRowHeight","euiConfig","getConfig","rowHeight","rowHeightString","htmlSafe","setComponentTemplate","precompileTemplate","strictMode","scope","EnsureSafeComponentHelper","EuiText","EuiFlexGroup","EuiFlexItem","EuiLoadingSpinner","VerticalCollection","didInsert","willDestroy","emberPowerSelectIsGroupHelper","eq","emberPowerSelectIsEqual","and","not","EuiBadge"],"mappings":";;;;;;;;;;;;;;;;;;;AAuBe,MAAMA,2BAAoC,SAAAC,uBAAA,CAAA;AAAA,EAAA;IAAAC,CAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,WAAA,EAAA,CACtDC,MAAA,CAAA,CAAA;AAAA;AAAA,EAAA,UAAA,IAAAC,CAAA,CAAA,IAAA,EAAA,WAAA,CAAA,EAAAC,SAAA;AACDC,EAAAA,aAAe,GAAQ,EAAE;EAEzB,IAAIC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IAAI,IAAI,CAACH,eAAe;AACpD;EAEA,IAAII,eAAkBA,GAAA;AACpB,IAAA,OAAOC,QAAA,CAAS,CAAA,OAAA,EAAU,IAAI,CAACF,SAAS,KAAK,CAAA;AAC/C;AAEA,EAAA;IAAAG,oBAAA,CAAAC,kBAAA,CA6EA,mvEAAA,EAAA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,yBAAA;iBAAAC,gBAAA;QAAAC,YAAA;QAAAC,WAAA;QAAAC,iBAAA;QAAAC,kBAAA;QAAAC,SAAA;QAAAC,WAAA;QAAAC,6BAAA;QAAAC,EAAA;QAAAC,uBAAA;QAAAC,GAAA;QAAAC,GAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { on } from '@ember/modifier';
|
|
2
2
|
import { action } from '@ember/object';
|
|
3
|
-
import didInsert from '@ember/render-modifiers/modifiers/did-insert';
|
|
4
3
|
import { scheduleOnce } from '@ember/runloop';
|
|
5
4
|
import { htmlSafe } from '@ember/template';
|
|
6
5
|
import { isBlank } from '@ember/utils';
|
|
@@ -65,14 +64,13 @@ class EuiComboBoxTriggerInputComponent extends EmberPowerSelectPowerSelectMultip
|
|
|
65
64
|
n(this.prototype, "handleKeydown", [action]);
|
|
66
65
|
}
|
|
67
66
|
static {
|
|
68
|
-
setComponentTemplate(precompileTemplate("\n {{#if (and this.maybePlaceholder (not @select.searchText))}}\n <p class=\"euiComboBoxPlaceholder\">\n {{this.maybePlaceholder}}\n </p>\n {{/if}}\n <div class=\"euiComboBox__input\" style=\"font-size: 14px; display: inline-block; position: relative;\">\n <input tabindex=\"-1\" style=\"opacity: 0px; width:0px; height:0px; position: absolute; top: 40%; border:solid 1px transparent !important; margin:0px !important;\" class=\"fake-input-for-html-form-validity\" {{!--@glint-expect-error--}} {{validatableControl @isInvalid}} />\n <input class=\"ember-power-select-trigger-multiple-input euiComboBox__input\" autocomplete=\"off\" autocorrect=\"off\" autocapitalize=\"off\" {{!--@glint-expect-error--}} autofocus={{@autoFocus}} spellcheck={{false}} id=\"ember-power-select-trigger-multiple-input-{{@select.uniqueId}}\" value={{@select.searchText}} aria-controls={{@listboxId}}
|
|
67
|
+
setComponentTemplate(precompileTemplate("\n {{#if (and this.maybePlaceholder (not @select.searchText))}}\n <p class=\"euiComboBoxPlaceholder\">\n {{this.maybePlaceholder}}\n </p>\n {{/if}}\n <div class=\"euiComboBox__input\" style=\"font-size: 14px; display: inline-block; position: relative;\">\n <input tabindex=\"-1\" style=\"opacity: 0px; width:0px; height:0px; position: absolute; top: 40%; border:solid 1px transparent !important; margin:0px !important;\" class=\"fake-input-for-html-form-validity\" {{!--@glint-expect-error--}} {{validatableControl @isInvalid}} />\n <input class=\"ember-power-select-trigger-multiple-input euiComboBox__input\" autocomplete=\"off\" autocorrect=\"off\" autocapitalize=\"off\" {{!--@glint-expect-error--}} autofocus={{@autoFocus}} spellcheck={{false}} id=\"ember-power-select-trigger-multiple-input-{{@select.uniqueId}}\" value={{@select.searchText}} aria-controls={{@listboxId}} disabled={{@select.disabled}} tabindex={{@tabindex}} form=\"power-select-fake-form\" {{on \"focus\" @onFocus}} {{on \"blur\" @onBlur}} {{on \"input\" this.handleInput}} {{on \"keydown\" this.handleKeydown}} />\n </div>\n ", {
|
|
69
68
|
strictMode: true,
|
|
70
69
|
scope: () => ({
|
|
71
70
|
and,
|
|
72
71
|
not,
|
|
73
72
|
validatableControl,
|
|
74
|
-
on
|
|
75
|
-
didInsert
|
|
73
|
+
on
|
|
76
74
|
})
|
|
77
75
|
}), this);
|
|
78
76
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.js","sources":["../../../../src/components/eui-combo-box/trigger/input.gts"],"sourcesContent":["import { on } from '@ember/modifier';\nimport { action } from '@ember/object';\nimport
|
|
1
|
+
{"version":3,"file":"input.js","sources":["../../../../src/components/eui-combo-box/trigger/input.gts"],"sourcesContent":["import { on } from '@ember/modifier';\nimport { action } from '@ember/object';\nimport { scheduleOnce } from '@ember/runloop';\nimport { htmlSafe } from '@ember/template';\nimport { isBlank } from '@ember/utils';\n\nimport EmberPowerSelectPowerSelectMultipleInputComponent from 'ember-power-select/components/power-select-multiple/input';\nimport { and, not } from 'ember-truth-helpers';\n\nimport validatableControl from '../../../modifiers/validatable-control.ts';\n\nexport default class EuiComboBoxTriggerInputComponent extends EmberPowerSelectPowerSelectMultipleInputComponent {\n get triggerMultipleInputStyle() {\n scheduleOnce('actions', null, this.args.select.actions.reposition);\n\n let textWidth = 0;\n\n // @ts-expect-error\n if (this.inputFont) {\n // @ts-expect-error\n textWidth = this.textMeasurer.width(\n this.args.select.searchText,\n // @ts-expect-error\n this.inputFont\n );\n }\n\n return htmlSafe(`box-sizing: content-box; width: ${textWidth + 2}px`);\n }\n\n @action\n handleKeydown(e: KeyboardEvent): false | void {\n if (e.target === null) return;\n\n if (this.args.onKeydown && this.args.onKeydown(e) === false) {\n if (\n // @ts-expect-error\n this.args.onCreateOption && //if user wants to create an option and\n e.keyCode === 13 && //presses [Enter] and\n (this.args.select.options.length === 0 || //If There are no options or\n this.args.select.results.length === 0) && //Last search made returned no results and\n this.args.select.searchText.length >= 1 //There's something in the searchText box\n ) {\n // @ts-expect-error\n this.args.onCreateOption();\n\n return false;\n }\n\n e.stopPropagation();\n\n return false;\n }\n\n if (e.keyCode === 8) {\n e.stopPropagation();\n\n if (isBlank((e.target as HTMLInputElement).value)) {\n let lastSelection =\n this.args.select.selected[this.args.select.selected.length - 1];\n\n if (lastSelection) {\n this.args.select.actions.select(\n this.args.buildSelection(lastSelection, this.args.select),\n e\n );\n this.args.select.actions.search('');\n this.args.select.actions.open(e);\n }\n }\n } else if ((e.keyCode >= 48 && e.keyCode <= 90) || e.keyCode === 32) {\n // Keys 0-9, a-z or SPACE\n e.stopPropagation();\n }\n }\n\n <template>\n {{#if (and this.maybePlaceholder (not @select.searchText))}}\n <p class=\"euiComboBoxPlaceholder\">\n {{this.maybePlaceholder}}\n </p>\n {{/if}}\n <div\n class=\"euiComboBox__input\"\n style=\"font-size: 14px; display: inline-block; position: relative;\"\n >\n <input\n tabindex=\"-1\"\n style=\"opacity: 0px; width:0px; height:0px; position: absolute; top: 40%; border:solid 1px transparent !important; margin:0px !important;\"\n class=\"fake-input-for-html-form-validity\"\n {{!@glint-expect-error}}\n {{validatableControl @isInvalid}}\n />\n <input\n class=\"ember-power-select-trigger-multiple-input euiComboBox__input\"\n autocomplete=\"off\"\n autocorrect=\"off\"\n autocapitalize=\"off\"\n {{!@glint-expect-error}}\n autofocus={{@autoFocus}}\n spellcheck={{false}}\n id=\"ember-power-select-trigger-multiple-input-{{@select.uniqueId}}\"\n value={{@select.searchText}}\n aria-controls={{@listboxId}}\n disabled={{@select.disabled}}\n tabindex={{@tabindex}}\n form=\"power-select-fake-form\"\n {{on \"focus\" @onFocus}}\n {{on \"blur\" @onBlur}}\n {{on \"input\" this.handleInput}}\n {{on \"keydown\" this.handleKeydown}}\n />\n </div>\n </template>\n}\n"],"names":["EuiComboBoxTriggerInputComponent","EmberPowerSelectPowerSelectMultipleInputComponent","triggerMultipleInputStyle","scheduleOnce","args","select","actions","reposition","textWidth","inputFont","textMeasurer","width","searchText","htmlSafe","handleKeydown","e","target","onKeydown","onCreateOption","keyCode","options","length","results","stopPropagation","isBlank","value","lastSelection","selected","buildSelection","search","open","n","prototype","action","setComponentTemplate","precompileTemplate","strictMode","scope","and","not","validatableControl","on"],"mappings":";;;;;;;;;;;;AAWe,MAAMA,gCAAyC,SAAAC,iDAAA,CAAA;EAC5D,IAAIC,yBAA4BA,GAAA;AAC9BC,IAAAA,YAAa,CAAA,SAAA,EAAW,IAAM,EAAA,IAAI,CAACC,IAAI,CAACC,MAAM,CAACC,OAAO,CAACC,UAAU,CAAA;IAEjE,IAAIC,SAAY,GAAA,CAAA;AAEhB;IACA,IAAI,IAAI,CAACC,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,MAAM,GAAG,CAAE,CAAA;AAEjE,QAAA,IAAIK,aAAe,EAAA;UACjB,IAAI,CAACtB,IAAI,CAACC,MAAM,CAACC,OAAO,CAACD,MAAM,CAC7B,IAAI,CAACD,IAAI,CAACwB,cAAc,CAACF,aAAA,EAAe,IAAI,CAACtB,IAAI,CAACC,MAAM,CACxD,EAAAU,CAAA,CAAA;UAEF,IAAI,CAACX,IAAI,CAACC,MAAM,CAACC,OAAO,CAACuB,MAAM,CAAC,EAAA,CAAA;UAChC,IAAI,CAACzB,IAAI,CAACC,MAAM,CAACC,OAAO,CAACwB,IAAI,CAACf,CAAA,CAAA;AAChC;AACF;AACF,KAAA,MAAO,IAAKA,CAAE,CAAAI,OAAO,IAAI,EAAM,IAAAJ,CAAA,CAAEI,OAAO,IAAI,EAAE,IAAKJ,CAAE,CAAAI,OAAO,KAAK,EAAI,EAAA;AACnE;MACAJ,CAAA,CAAEQ,eAAe,EAAA;AACnB;AACF;AAAA,EAAA;IAAAQ,CAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,eAAA,EAAA,CA5CCC,MAAA,CAAA,CAAA;AAAA;AA8CD,EAAA;IAAAC,oBAAA,CAAAC,kBAAA,CAqCA,qnCAAA,EAAA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,GAAA;QAAAC,GAAA;QAAAC,kBAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
|
|
@@ -15,7 +15,7 @@ import { setComponentTemplate } from '@ember/component';
|
|
|
15
15
|
|
|
16
16
|
class EuiComboBoxTriggerComponent extends EmberPowerSelectMultipleTrigger {
|
|
17
17
|
static {
|
|
18
|
-
setComponentTemplate(precompileTemplate("\n {{!-- @glint-nocheck: not typesafe yet --}}\n <EuiFormControlLayout @icon={{argOrDefault @icon \"arrowDown\"}} @iconSide=\"right\" @fullWidth={{@fullWidth}} @compressed={{@compressed}} @readOnly={{@readOnly}} @clear={{if (and @select.selected @allowClear) (fn @select.actions.select (array))}} @isLoading={{@isLoading}} @disabled={{@select.disabled}}>\n <:field>\n {{!-- template-lint-disable --}}\n <ul id=\"ember-power-select-multiple-options-{{@select.uniqueId}}\" class={{classNames \"euiComboBox__inputWrap ember-power-select-multiple-options\" (if @compressed \"euiComboBox__inputWrap--compressed\") (if @fullWidth \"euiComboBox__inputWrap--fullWidth\") (if @singleSelection \"euiComboBox__inputWrap--noWrap\") (if @isLoading \"euiComboBox__inputWrap--isLoading\") (if @allowClear \"euiComboBox__inputWrap-isClearable\")}} ...attributes {{didUpdate this.openChanged @select.isOpen}} {{on \"touchstart\" this.chooseOption}} {{on \"mousedown\" this.chooseOption}}>\n {{!-- template-lint-enable --}}\n {{#if (or (and @singleSelection (not @select.searchText)) (not @singleSelection))}}\n {{#each @select.selected as |opt idx|}}\n {{#if @selectedItemComponent}}\n {{#let (component (EnsureSafeComponentHelper @selectedItemComponent) extra=@extra option=opt select=@select) as |SelectedItemComponent|}}\n <SelectedItemComponent />\n {{/let}}\n {{else}}\n <EuiComboBoxPill class=\"ember-power-select-multiple-option\n {{if opt.disabled \"ember-power-select-multiple-option--disabled\"}}\" @option={{opt}} @onClose={{if (or @select.disabled @singleSelection) false (if @onClose (fn (optional @onClose) opt) true)}} @dataSelectedIconIndex={{idx}} @color={{opt.color}} @asPlainText={{@singleSelection.asPlainText}}>\n {{yield opt @select}}\n </EuiComboBoxPill>\n {{/if}}\n {{else}}{{#if (and @placeholder (not @searchEnabled))}}\n <span class=\"ember-power-select-placeholder\">\n {{@placeholder}}\n </span>\n {{/if}}{{/each}}\n {{/if}}\n {{#if @searchEnabled}}\n {{#if (and this.maybePlaceholder (not @select.searchText))}}\n <p class=\"euiComboBoxPlaceholder\">\n {{this.maybePlaceholder}}\n </p>\n {{/if}}\n
|
|
18
|
+
setComponentTemplate(precompileTemplate("\n {{!-- @glint-nocheck: not typesafe yet --}}\n <EuiFormControlLayout @icon={{argOrDefault @icon \"arrowDown\"}} @iconSide=\"right\" @fullWidth={{@fullWidth}} @compressed={{@compressed}} @readOnly={{@readOnly}} @clear={{if (and @select.selected @allowClear) (fn @select.actions.select (array))}} @isLoading={{@isLoading}} @disabled={{@select.disabled}}>\n <:field>\n {{!-- template-lint-disable --}}\n <ul id=\"ember-power-select-multiple-options-{{@select.uniqueId}}\" class={{classNames \"euiComboBox__inputWrap ember-power-select-multiple-options\" (if @compressed \"euiComboBox__inputWrap--compressed\") (if @fullWidth \"euiComboBox__inputWrap--fullWidth\") (if @singleSelection \"euiComboBox__inputWrap--noWrap\") (if @isLoading \"euiComboBox__inputWrap--isLoading\") (if @allowClear \"euiComboBox__inputWrap-isClearable\")}} ...attributes {{didUpdate this.openChanged @select.isOpen}} {{on \"touchstart\" this.chooseOption}} {{on \"mousedown\" this.chooseOption}}>\n {{!-- template-lint-enable --}}\n {{#if (or (and @singleSelection (not @select.searchText)) (not @singleSelection))}}\n {{#each @select.selected as |opt idx|}}\n {{#if @selectedItemComponent}}\n {{#let (component (EnsureSafeComponentHelper @selectedItemComponent) extra=@extra option=opt select=@select) as |SelectedItemComponent|}}\n <SelectedItemComponent />\n {{/let}}\n {{else}}\n <EuiComboBoxPill class=\"ember-power-select-multiple-option\n {{if opt.disabled \"ember-power-select-multiple-option--disabled\"}}\" @option={{opt}} @onClose={{if (or @select.disabled @singleSelection) false (if @onClose (fn (optional @onClose) opt) true)}} @dataSelectedIconIndex={{idx}} @color={{opt.color}} @asPlainText={{@singleSelection.asPlainText}}>\n {{yield opt @select}}\n </EuiComboBoxPill>\n {{/if}}\n {{else}}{{#if (and @placeholder (not @searchEnabled))}}\n <span class=\"ember-power-select-placeholder\">\n {{@placeholder}}\n </span>\n {{/if}}{{/each}}\n {{/if}}\n {{#if @searchEnabled}}\n {{#if (and this.maybePlaceholder (not @select.searchText))}}\n <p class=\"euiComboBoxPlaceholder\">\n {{this.maybePlaceholder}}\n </p>\n {{/if}}\n {{#let (component EuiComboBoxTriggerInput select=@select ariaActiveDescendant=@ariaActiveDescendant ariaLabelledBy=@ariaLabelledBy ariaLabel=@ariaLabel listboxId=@listboxId tabindex=@tabindex buildSelection=@buildSelection placeholder=@placeholder placeholderComponent=@placeholderComponent searchField=@searchField onFocus=@onFocus isInvalid=@isInvalid onBlur=@onBlur onKeydown=@onKeydown onInput=@onInput onCreateOption=@onCreateOption) as |InputComponent|}}\n {{#let (component (EnsureSafeComponentHelper @placeholderComponent) select=@select placeholder=@placeholder isMultipleWithSearch=true inputComponent=InputComponent displayPlaceholder=(and (not @select.searchText) (not @select.selected))) as |PlaceholderComponent|}}\n <PlaceholderComponent />\n {{/let}}\n {{/let}}\n {{else}}\n {{!-- template-lint-disable --}}\n <div class=\"euiComboBox__input\" style=\"font-size: 14px; display: inline-block;\"></div>\n {{!-- template-lint-enable --}}\n {{/if}}\n </ul>\n </:field>\n </EuiFormControlLayout>\n ", {
|
|
19
19
|
strictMode: true,
|
|
20
20
|
scope: () => ({
|
|
21
21
|
EuiFormControlLayout,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trigger.js","sources":["../../../src/components/eui-combo-box/trigger.gts"],"sourcesContent":["import { fn } from '@ember/helper';\nimport { array } from '@ember/helper';\nimport { on } from '@ember/modifier';\nimport didUpdate from '@ember/render-modifiers/modifiers/did-update';\nimport { EnsureSafeComponentHelper } from '@embroider/util';\n\nimport optional from 'ember-composable-helpers/helpers/optional';\nimport EmberPowerSelectMultipleTrigger from 'ember-power-select/components/power-select-multiple/trigger';\nimport { and, not, or } from 'ember-truth-helpers';\n\nimport argOrDefault from '../../helpers/arg-or-default.ts';\nimport classNames from '../../helpers/class-names.ts';\nimport EuiComboBoxPill from '../eui-combo-box-pill.gts';\nimport EuiFormControlLayout from '../eui-form-control-layout.gts';\nimport EuiComboBoxTriggerInput from './trigger/input.gts';\n\nexport default class EuiComboBoxTriggerComponent extends EmberPowerSelectMultipleTrigger {\n <template>\n {{! @glint-nocheck: not typesafe yet }}\n <EuiFormControlLayout\n @icon={{argOrDefault @icon \"arrowDown\"}}\n @iconSide=\"right\"\n @fullWidth={{@fullWidth}}\n @compressed={{@compressed}}\n @readOnly={{@readOnly}}\n @clear={{if\n (and @select.selected @allowClear)\n (fn @select.actions.select (array))\n }}\n @isLoading={{@isLoading}}\n @disabled={{@select.disabled}}\n >\n <:field>\n {{! template-lint-disable }}\n <ul\n id=\"ember-power-select-multiple-options-{{@select.uniqueId}}\"\n class={{classNames\n \"euiComboBox__inputWrap ember-power-select-multiple-options\"\n (if @compressed \"euiComboBox__inputWrap--compressed\")\n (if @fullWidth \"euiComboBox__inputWrap--fullWidth\")\n (if @singleSelection \"euiComboBox__inputWrap--noWrap\")\n (if @isLoading \"euiComboBox__inputWrap--isLoading\")\n (if @allowClear \"euiComboBox__inputWrap-isClearable\")\n }}\n ...attributes\n {{didUpdate this.openChanged @select.isOpen}}\n {{on \"touchstart\" this.chooseOption}}\n {{on \"mousedown\" this.chooseOption}}\n >\n {{! template-lint-enable }}\n {{#if\n (or\n (and @singleSelection (not @select.searchText))\n (not @singleSelection)\n )\n }}\n {{#each @select.selected as |opt idx|}}\n {{#if @selectedItemComponent}}\n {{#let\n (component\n (EnsureSafeComponentHelper @selectedItemComponent)\n extra=@extra\n option=opt\n select=@select\n )\n as |SelectedItemComponent|\n }}\n <SelectedItemComponent />\n {{/let}}\n {{else}}\n <EuiComboBoxPill\n class=\"ember-power-select-multiple-option\n {{if\n opt.disabled\n 'ember-power-select-multiple-option--disabled'\n }}\"\n @option={{opt}}\n @onClose={{if\n (or @select.disabled @singleSelection)\n false\n (if @onClose (fn (optional @onClose) opt) true)\n }}\n @dataSelectedIconIndex={{idx}}\n @color={{opt.color}}\n @asPlainText={{@singleSelection.asPlainText}}\n >\n {{yield opt @select}}\n </EuiComboBoxPill>\n {{/if}}\n {{else}}{{#if (and @placeholder (not @searchEnabled))}}\n <span class=\"ember-power-select-placeholder\">\n {{@placeholder}}\n </span>\n {{/if}}{{/each}}\n {{/if}}\n {{#if @searchEnabled}}\n {{#if (and this.maybePlaceholder (not @select.searchText))}}\n <p class=\"euiComboBoxPlaceholder\">\n {{this.maybePlaceholder}}\n </p>\n {{/if}}\n
|
|
1
|
+
{"version":3,"file":"trigger.js","sources":["../../../src/components/eui-combo-box/trigger.gts"],"sourcesContent":["import { fn } from '@ember/helper';\nimport { array } from '@ember/helper';\nimport { on } from '@ember/modifier';\nimport didUpdate from '@ember/render-modifiers/modifiers/did-update';\nimport { EnsureSafeComponentHelper } from '@embroider/util';\n\nimport optional from 'ember-composable-helpers/helpers/optional';\nimport EmberPowerSelectMultipleTrigger from 'ember-power-select/components/power-select-multiple/trigger';\nimport { and, not, or } from 'ember-truth-helpers';\n\nimport argOrDefault from '../../helpers/arg-or-default.ts';\nimport classNames from '../../helpers/class-names.ts';\nimport EuiComboBoxPill from '../eui-combo-box-pill.gts';\nimport EuiFormControlLayout from '../eui-form-control-layout.gts';\nimport EuiComboBoxTriggerInput from './trigger/input.gts';\n\nexport default class EuiComboBoxTriggerComponent extends EmberPowerSelectMultipleTrigger {\n <template>\n {{! @glint-nocheck: not typesafe yet }}\n <EuiFormControlLayout\n @icon={{argOrDefault @icon \"arrowDown\"}}\n @iconSide=\"right\"\n @fullWidth={{@fullWidth}}\n @compressed={{@compressed}}\n @readOnly={{@readOnly}}\n @clear={{if\n (and @select.selected @allowClear)\n (fn @select.actions.select (array))\n }}\n @isLoading={{@isLoading}}\n @disabled={{@select.disabled}}\n >\n <:field>\n {{! template-lint-disable }}\n <ul\n id=\"ember-power-select-multiple-options-{{@select.uniqueId}}\"\n class={{classNames\n \"euiComboBox__inputWrap ember-power-select-multiple-options\"\n (if @compressed \"euiComboBox__inputWrap--compressed\")\n (if @fullWidth \"euiComboBox__inputWrap--fullWidth\")\n (if @singleSelection \"euiComboBox__inputWrap--noWrap\")\n (if @isLoading \"euiComboBox__inputWrap--isLoading\")\n (if @allowClear \"euiComboBox__inputWrap-isClearable\")\n }}\n ...attributes\n {{didUpdate this.openChanged @select.isOpen}}\n {{on \"touchstart\" this.chooseOption}}\n {{on \"mousedown\" this.chooseOption}}\n >\n {{! template-lint-enable }}\n {{#if\n (or\n (and @singleSelection (not @select.searchText))\n (not @singleSelection)\n )\n }}\n {{#each @select.selected as |opt idx|}}\n {{#if @selectedItemComponent}}\n {{#let\n (component\n (EnsureSafeComponentHelper @selectedItemComponent)\n extra=@extra\n option=opt\n select=@select\n )\n as |SelectedItemComponent|\n }}\n <SelectedItemComponent />\n {{/let}}\n {{else}}\n <EuiComboBoxPill\n class=\"ember-power-select-multiple-option\n {{if\n opt.disabled\n 'ember-power-select-multiple-option--disabled'\n }}\"\n @option={{opt}}\n @onClose={{if\n (or @select.disabled @singleSelection)\n false\n (if @onClose (fn (optional @onClose) opt) true)\n }}\n @dataSelectedIconIndex={{idx}}\n @color={{opt.color}}\n @asPlainText={{@singleSelection.asPlainText}}\n >\n {{yield opt @select}}\n </EuiComboBoxPill>\n {{/if}}\n {{else}}{{#if (and @placeholder (not @searchEnabled))}}\n <span class=\"ember-power-select-placeholder\">\n {{@placeholder}}\n </span>\n {{/if}}{{/each}}\n {{/if}}\n {{#if @searchEnabled}}\n {{#if (and this.maybePlaceholder (not @select.searchText))}}\n <p class=\"euiComboBoxPlaceholder\">\n {{this.maybePlaceholder}}\n </p>\n {{/if}}\n {{#let\n (component\n EuiComboBoxTriggerInput\n select=@select\n ariaActiveDescendant=@ariaActiveDescendant\n ariaLabelledBy=@ariaLabelledBy\n ariaLabel=@ariaLabel\n listboxId=@listboxId\n tabindex=@tabindex\n buildSelection=@buildSelection\n placeholder=@placeholder\n placeholderComponent=@placeholderComponent\n searchField=@searchField\n onFocus=@onFocus\n isInvalid=@isInvalid\n onBlur=@onBlur\n onKeydown=@onKeydown\n onInput=@onInput\n onCreateOption=@onCreateOption\n )\n as |InputComponent|\n }}\n {{#let\n (component\n (EnsureSafeComponentHelper @placeholderComponent)\n select=@select\n placeholder=@placeholder\n isMultipleWithSearch=true\n inputComponent=InputComponent\n displayPlaceholder=(and\n (not @select.searchText) (not @select.selected)\n )\n )\n as |PlaceholderComponent|\n }}\n <PlaceholderComponent />\n {{/let}}\n {{/let}}\n {{else}}\n {{! template-lint-disable }}\n <div\n class=\"euiComboBox__input\"\n style=\"font-size: 14px; display: inline-block;\"\n ></div>\n {{! template-lint-enable }}\n {{/if}}\n </ul>\n </:field>\n </EuiFormControlLayout>\n </template>\n}\n"],"names":["EuiComboBoxTriggerComponent","EmberPowerSelectMultipleTrigger","setComponentTemplate","precompileTemplate","strictMode","scope","EuiFormControlLayout","argOrDefault","and","fn","array","classNames","didUpdate","on","or","not","EnsureSafeComponentHelper","EuiComboBoxPill","optional","EuiComboBoxTriggerInput"],"mappings":";;;;;;;;;;;;;;;AAgBe,MAAMA,2BAAoC,SAAAC,+BAAA,CAAA;AACvD,EAAA;IAAAC,oBAAA,CAAAC,kBAAA,CAqIA,0hHAAA,EAAA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,oBAAA;QAAAC,YAAA;QAAAC,GAAA;QAAAC,EAAA;QAAAC,KAAA;QAAAC,UAAA;QAAAC,SAAA;QAAAC,EAAA;QAAAC,EAAA;QAAAC,GAAA;QAAAC,yBAAA;QAAAC,eAAA;QAAAC,QAAA;AAAAC,iCAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
|
|
@@ -4,6 +4,7 @@ import { isArray } from '@ember/array';
|
|
|
4
4
|
import { action } from '@ember/object';
|
|
5
5
|
import { inject } from '@ember/service';
|
|
6
6
|
import { isEqual } from '@ember/utils';
|
|
7
|
+
import 'ember-basic-dropdown/styles';
|
|
7
8
|
import optional from 'ember-composable-helpers/helpers/optional';
|
|
8
9
|
import pipe from 'ember-composable-helpers/helpers/pipe';
|
|
9
10
|
import queue from 'ember-composable-helpers/helpers/queue';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eui-combo-box.js","sources":["../../src/components/eui-combo-box.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { cached, tracked } from '@glimmer/tracking';\nimport { isArray } from '@ember/array';\nimport { action } from '@ember/object';\nimport { inject as service } from '@ember/service';\nimport { isEqual } from '@ember/utils';\n\nimport optional from 'ember-composable-helpers/helpers/optional';\nimport pipe from 'ember-composable-helpers/helpers/pipe';\nimport queue from 'ember-composable-helpers/helpers/queue';\nimport PowerSelectMultiple from 'ember-power-select/components/power-select-multiple';\nimport { emberPowerSelectIsGroup } from 'ember-power-select/helpers/ember-power-select-is-group';\nimport { and, not } from 'ember-truth-helpers';\n\nimport argOrDefault from '../helpers/arg-or-default.ts';\nimport classNames from '../helpers/class-names.ts';\nimport EuiComboBoxCreateOption from './eui-combo-box/create-option.gts';\nimport EuiComboBoxGroup from './eui-combo-box/group.gts';\nimport EuiComboBoxNoMatchesMessage from './eui-combo-box/no-matches-message.gts';\nimport EuiComboBoxOptions from './eui-combo-box/options.gts';\nimport EuiComboBoxSearchMessage from './eui-combo-box/search-message.gts';\nimport EuiComboBoxTrigger from './eui-combo-box/trigger.gts';\n\nimport type EuiI18n from '../services/eui-i18n';\n\ninterface PromiseProxy<T> extends Promise<T> {\n content: any;\n}\n\ninterface Select {\n selected: any;\n actions: {\n search: (str: string) => void;\n };\n}\n\nexport interface EuiComboBoxSignature {\n Element: HTMLDivElement;\n Args: {\n singleSelection?:\n | boolean\n | {\n asPlainText?: boolean;\n };\n onCreateOption?: (search: string) => boolean | undefined;\n options: any[];\n search?: (term: string, select: Select) => any[] | PromiseProxy<any[]>;\n searchField?: string;\n isInvalid?: boolean;\n fullWidth?: boolean;\n searchMessage?: string;\n searchEnabled?: boolean;\n isClearable?: boolean;\n isLoading?: boolean;\n isDisabled?: boolean;\n readOnly?: boolean;\n searchMessageComponent?: any;\n compressed?: boolean;\n onFocus?: (e: FocusEvent) => void;\n onBlur?: (e: FocusEvent) => void;\n onClose?: (e: Event) => void;\n onOpen?: (e: Event) => void;\n renderInPlace?: boolean;\n customOptionText?: string;\n loadingMessage?: any;\n selectedItemComponent?: any;\n beforeOptionsComponent?: any;\n placeholderComponent?: any;\n afterOptionsComponent?: any;\n searchPlaceholder?: any;\n dropdownClass?: string;\n selectedOptions?: any[];\n onChange: (selected: any[]) => void;\n placeholder?: string;\n extra?: any;\n closeOnSelect?: boolean;\n autoFocus?: boolean;\n defaultHighlighted?: any;\n matchTriggerWidth?: boolean;\n tabindex?: number;\n initiallyOpen?: boolean;\n horizontalPosition?: string;\n verticalPosition?: string;\n destination?: string;\n preventScroll?: boolean;\n noMatchesMessage?: string;\n noMatchesMessageComponent?: any;\n };\n Blocks: {\n default: [any, number, Select];\n };\n}\n\ninterface Sliceable<T> {\n slice(): T[];\n}\n\nconst isSliceable = <T,>(coll: any): coll is Sliceable<T> => {\n return isArray(coll);\n};\n\nexport const toPlainArray = <T,>(collection: T[] | Sliceable<T>): T[] => {\n if (isSliceable<T>(collection)) {\n return collection.slice();\n } else {\n return collection;\n }\n};\n\nexport default class EuiComboBoxComponent extends Component<EuiComboBoxSignature> {\n @service declare euiI18n: EuiI18n;\n\n @tracked select: any = null;\n @tracked private _resolvedOptions?: any[];\n @tracked searchText = '';\n @tracked private _searchResult?: any[];\n\n private _filterResultsCache: {\n results: any[];\n options: any[];\n searchText: string;\n } = { results: [], options: [], searchText: this.searchText };\n\n get loadingMessage() {\n return (\n this.args.loadingMessage ||\n this.euiI18n.lookupToken(\n 'euiComboBox.loadingMessage',\n 'Loading options...'\n )\n );\n }\n\n get noMatchesMessage() {\n return (\n this.args.noMatchesMessage ||\n this.euiI18n.lookupToken(\n 'euiComboBox.noMatchesMessage',\n 'No results found'\n )\n );\n }\n\n get searchMessage() {\n return (\n this.args.searchMessage ||\n this.euiI18n.lookupToken(\n 'euiComboBox.searchMessage',\n 'Type to search'\n )\n );\n }\n\n <template>\n {{! @glint-nocheck: not typesafe yet }}\n <PowerSelectMultiple\n ...attributes\n @onChange={{pipe this.onChange @onChange}}\n @onFocus={{@onFocus}}\n @onBlur={{@onBlur}}\n @onOpen={{@onOpen}}\n @onClose={{@onClose}}\n @placeholderComponent={{@placeholderComponent}}\n @searchMessage={{this.searchMessage}}\n @searchMessageComponent={{if\n @searchMessageComponent\n @searchMessageComponent\n EuiComboBoxSearchMessage\n }}\n @noMatchesMessage={{this.noMatchesMessage}}\n @matchTriggerWidth={{@matchTriggerWidth}}\n @options={{this.options}}\n @selected={{@selectedOptions}}\n @closeOnSelect={{@closeOnSelect}}\n @defaultHighlighted={{@defaultHighlighted}}\n @searchField={{@searchField}}\n @searchEnabled={{argOrDefault @searchEnabled true}}\n @tabindex={{@tabindex}}\n @initiallyOpened={{and (not @isDisabled) @autoFocus}}\n @triggerComponent={{component\n EuiComboBoxTrigger\n fullWidth=@fullWidth\n compressed=@compressed\n isInvalid=@isInvalid\n singleSelection=@singleSelection\n onClose=@removeTag\n onCreateOption=(if @onCreateOption this.onCreateOption)\n isLoading=@isLoading\n autoFocus=(and (not @isDisabled) @autoFocus)\n icon=@triggerIcon\n }}\n @matcher={{@matcher}}\n @initiallyOpen={{@initiallyOpen}}\n @typeAheadOptionMatcher={{@typeAheadOptionMatcher}}\n @buildSelection={{this.buildSelection}}\n @search={{@search}}\n @onInput={{@onInput}}\n @onKeydown={{@onKeydown}}\n @scrollTo={{this.scrollTo}}\n @registerAPI={{queue this.registerAPI (optional @registerApi)}}\n @horizontalPosition={{@horizontalPosition}}\n @destination={{@destination}}\n @preventScroll={{@preventScroll}}\n @renderInPlace={{@renderInPlace}}\n @verticalPosition={{@verticalPosition}}\n @disabled={{@isDisabled}}\n @calculatePosition={{@calculatePosition}}\n @eventType={{@eventType}}\n @ariaLabel={{@ariaLabel}}\n @ariaLabelledBy={{@ariaLabelledBy}}\n @required={{@required}}\n @triggerRole={{@triggerRole}}\n @title={{@title}}\n @triggerId={{@triggerId}}\n @allowClear={{and (argOrDefault @isClearable true) (not @isDisabled)}}\n @loadingMessage={{this.loadingMessage}}\n @selectedItemComponent={{@selectedItemComponent}}\n @beforeOptionsComponent={{@beforeOptionsComponent}}\n @afterOptionsComponent={{@afterOptionsComponent}}\n @placeholder={{@placeholder}}\n @searchPlaceholder={{@searchPlaceholder}}\n @optionsComponent={{component\n EuiComboBoxOptions\n rowHeight=@rowHeight\n class=@optionsClass\n }}\n @extra={{@extra}}\n @groupComponent={{component EuiComboBoxGroup}}\n @triggerClass={{classNames\n \"euiComboBox\"\n (if @compressed \"euiComboBox--compressed\")\n (if @fullWidth \"euiComboBox--fullWidth\")\n (if @isDisabled \"euiComboBox-isDisabled\")\n (if @isInvalid \"euiComboBox-isInvalid\")\n (if this.select.isOpen \"euiComboBox-isOpen\")\n }}\n @noMatchesMessageComponent={{if\n @onCreateOption\n (component\n EuiComboBoxCreateOption\n customOptionText=@customOptionText\n onCreateOption=this.onCreateOption\n select=this.select\n )\n (component EuiComboBoxNoMatchesMessage)\n }}\n @dropdownClass=\"euiComboBoxOptionsList euiPanel euiPanel--borderRadiusMedium euiPanel--noShadow euiPanel--plain euiPopover__panel-isAttached euiPopover__panel euiPopover__panel-noArrow euiPopover__panel--bottom euiPopover__panel-isOpen euiComboBoxOptionsList__rowWrap {{@dropdownClass}}\"\n as |option i|\n >\n {{yield option i}}\n </PowerSelectMultiple>\n </template>\n\n //This is to allow scrolling between virtualized groups\n @cached\n get opts() {\n return this.results.reduce((acc, curr) => {\n if (emberPowerSelectIsGroup([curr])) {\n acc.push(curr, ...curr.options);\n } else {\n acc.push(curr);\n }\n\n return acc;\n }, []);\n }\n\n @cached\n get options(): any[] {\n if (this._resolvedOptions) return toPlainArray(this._resolvedOptions);\n\n if (this.args.options) {\n return toPlainArray(this.args.options);\n } else {\n return [];\n }\n }\n\n @cached\n get results(): any[] {\n if (this.searchText.length > 0) {\n if (this.args.search) {\n return toPlainArray(this._searchResult || this.options);\n } else {\n if (\n this._filterResultsCache.options === this.options &&\n this._filterResultsCache.searchText === this.searchText\n ) {\n // This is an optimization to avoid filtering several times, which may be a bit expensive\n // if there are many options, if neither the options nor the searchtext have changed\n return this._filterResultsCache.results;\n }\n\n //@ts-ignore\n let results = this._filter(this.options, this.searchText);\n //eslint-disable-next-line\n this._filterResultsCache = {\n results,\n options: this.options,\n searchText: this.searchText\n };\n\n return results;\n }\n } else {\n return this.options;\n }\n }\n\n @action\n scrollTo(option: any, select: { results: []; uniqueId: string }): void {\n let optionsList = document.querySelector(\n `[aria-controls=\"ember-power-select-trigger-${select.uniqueId}\"]`\n ) as HTMLElement;\n\n if (!optionsList) {\n return;\n }\n\n let index = this.opts.indexOf(option);\n\n if (index === -1) {\n return;\n }\n\n let optionElement = optionsList.querySelector(\n `[data-option-index=\"${index}\"]`\n ) as HTMLElement;\n\n if (!optionElement) {\n return;\n }\n\n let optionTopScroll = optionElement.offsetTop;\n let optionBottomScroll = optionTopScroll + optionElement.offsetHeight;\n\n if (optionBottomScroll > optionsList.offsetHeight + optionsList.scrollTop) {\n optionsList.scrollTop = optionBottomScroll - optionsList.offsetHeight;\n } else if (optionTopScroll < optionsList.scrollTop) {\n optionsList.scrollTop = optionTopScroll;\n }\n }\n\n @action\n registerAPI(select: Select) {\n this.select = select;\n }\n\n @action\n onChange(selected: any[]) {\n if (this.args.singleSelection) {\n return selected.length > 0 ? [selected[selected.length - 1]] : [];\n }\n\n return selected;\n }\n\n @action\n onCreateOption() {\n let option;\n\n if (\n this.args.onCreateOption &&\n typeof this.args.onCreateOption === 'function'\n ) {\n // The `onCreateOption` function can be used to sanitize the input or explicitly return `false` to reject the input\n option = this.args.onCreateOption(this.select.searchText);\n\n if (option === false) {\n return;\n }\n }\n\n let search = option || this.select.searchText;\n\n this.select.actions.search('');\n this.select.actions.close();\n\n return search;\n }\n\n @action\n buildSelection(option: any, select: Select) {\n let newSelection = (select.selected || []).slice(0);\n let idx = -1;\n\n for (let i = 0; i < newSelection.length; i++) {\n if (isEqual(newSelection[i], option)) {\n idx = i;\n\n break;\n }\n }\n\n if (idx > -1) {\n newSelection.splice(idx, 1);\n } else {\n newSelection.push(option);\n }\n\n if (this.args.singleSelection && newSelection.length === 0) {\n select.actions.search('');\n }\n\n if (select?.selected?.length < newSelection.length) {\n select.actions.search('');\n }\n\n return newSelection;\n }\n}\n"],"names":["isSliceable","coll","isArray","toPlainArray","collection","slice","EuiComboBoxComponent","Component","g","prototype","service","i","void 0","tracked","_filterResultsCache","results","options","searchText","loadingMessage","args","euiI18n","lookupToken","noMatchesMessage","searchMessage","setComponentTemplate","precompileTemplate","strictMode","scope","PowerSelectMultiple","pipe","EuiComboBoxSearchMessage","argOrDefault","and","not","EuiComboBoxTrigger","queue","optional","EuiComboBoxOptions","EuiComboBoxGroup","classNames","EuiComboBoxCreateOption","EuiComboBoxNoMatchesMessage","opts","reduce","acc","curr","emberPowerSelectIsGroup","push","n","cached","_resolvedOptions","length","search","_searchResult","_filter","scrollTo","option","select","optionsList","document","querySelector","uniqueId","index","indexOf","optionElement","optionTopScroll","offsetTop","optionBottomScroll","offsetHeight","scrollTop","action","registerAPI","onChange","selected","singleSelection","onCreateOption","actions","close","buildSelection","newSelection","idx","isEqual","splice"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAiGA,MAAMA,cAAmBC,IAAS,IAAqB;EACrD,OAAOC,OAAQ,CAAAD,IAAA,CAAA;AACjB,CAAA;AAEaE,MAAAA,YAAe,GAAKC,UAAiC,IAAA;AAChE,EAAA,IAAIJ,WAAA,CAAeI,UAAa,CAAA,EAAA;AAC9B,IAAA,OAAOA,WAAWC,KAAK,EAAA;AACzB,GAAO,MAAA;AACL,IAAA,OAAOD,UAAA;AACT;AACF;AAEe,MAAME,6BAA6BC,SAAU,CAAA;AAAA,EAAA;IAAAC,CAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,SAAA,EAAA,CACzDC,MAAA,CAAA,CAAA;AAAA;AAAA,EAAA,QAAA,IAAAC,CAAA,CAAA,IAAA,EAAA,SAAA,CAAA,EAAAC,SAAA;AAAA,EAAA;IAAAJ,CAAA,CAAA,IAAA,CAAA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MAAM,CAACF,GAAK,EAAA,CAAA,CAAA;AAC3B,KAAO,MAAA;AACLD,MAAAA,YAAA,CAAahC,IAAI,CAACS,MAAA,CAAA;AACpB;IAEA,IAAI,IAAI,CAACrC,IAAI,CAACuD,eAAe,IAAIK,YAAA,CAAa5B,MAAM,KAAK,CAAG,EAAA;AAC1DM,MAAAA,MAAO,CAAAmB,OAAO,CAACxB,MAAM,CAAC,EAAA,CAAA;AACxB;IAEA,IAAIK,MAAQ,EAAAgB,QAAA,EAAUtB,MAAS,GAAA4B,YAAA,CAAa5B,MAAM,EAAE;AAClDM,MAAAA,MAAO,CAAAmB,OAAO,CAACxB,MAAM,CAAC,EAAA,CAAA;AACxB;AAEA,IAAA,OAAO2B,YAAA;AACT;AAAA,EAAA;IAAA/B,CAAA,CAAA,IAAA,CAAAvC,SAAA,EAAA,gBAAA,EAAA,CA5BC6D,MAAA,CAAA,CAAA;AAAA;AA6BH;;;;"}
|
|
1
|
+
{"version":3,"file":"eui-combo-box.js","sources":["../../src/components/eui-combo-box.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { cached, tracked } from '@glimmer/tracking';\nimport { isArray } from '@ember/array';\nimport { action } from '@ember/object';\nimport { inject as service } from '@ember/service';\nimport { isEqual } from '@ember/utils';\nimport 'ember-basic-dropdown/styles';\n\nimport optional from 'ember-composable-helpers/helpers/optional';\nimport pipe from 'ember-composable-helpers/helpers/pipe';\nimport queue from 'ember-composable-helpers/helpers/queue';\nimport PowerSelectMultiple from 'ember-power-select/components/power-select-multiple';\nimport { emberPowerSelectIsGroup } from 'ember-power-select/helpers/ember-power-select-is-group';\nimport { and, not } from 'ember-truth-helpers';\n\nimport argOrDefault from '../helpers/arg-or-default.ts';\nimport classNames from '../helpers/class-names.ts';\nimport EuiComboBoxCreateOption from './eui-combo-box/create-option.gts';\nimport EuiComboBoxGroup from './eui-combo-box/group.gts';\nimport EuiComboBoxNoMatchesMessage from './eui-combo-box/no-matches-message.gts';\nimport EuiComboBoxOptions from './eui-combo-box/options.gts';\nimport EuiComboBoxSearchMessage from './eui-combo-box/search-message.gts';\nimport EuiComboBoxTrigger from './eui-combo-box/trigger.gts';\n\nimport type EuiI18n from '../services/eui-i18n';\n\ninterface PromiseProxy<T> extends Promise<T> {\n content: any;\n}\n\ninterface Select {\n selected: any;\n actions: {\n search: (str: string) => void;\n };\n}\n\nexport interface EuiComboBoxSignature {\n Element: HTMLDivElement;\n Args: {\n singleSelection?:\n | boolean\n | {\n asPlainText?: boolean;\n };\n onCreateOption?: (search: string) => boolean | undefined;\n options: any[];\n search?: (term: string, select: Select) => any[] | PromiseProxy<any[]>;\n searchField?: string;\n isInvalid?: boolean;\n fullWidth?: boolean;\n searchMessage?: string;\n searchEnabled?: boolean;\n isClearable?: boolean;\n isLoading?: boolean;\n isDisabled?: boolean;\n readOnly?: boolean;\n searchMessageComponent?: any;\n compressed?: boolean;\n onFocus?: (e: FocusEvent) => void;\n onBlur?: (e: FocusEvent) => void;\n onClose?: (e: Event) => void;\n onOpen?: (e: Event) => void;\n renderInPlace?: boolean;\n customOptionText?: string;\n loadingMessage?: any;\n selectedItemComponent?: any;\n beforeOptionsComponent?: any;\n placeholderComponent?: any;\n afterOptionsComponent?: any;\n searchPlaceholder?: any;\n dropdownClass?: string;\n selectedOptions?: any[];\n onChange: (selected: any[]) => void;\n placeholder?: string;\n extra?: any;\n closeOnSelect?: boolean;\n autoFocus?: boolean;\n defaultHighlighted?: any;\n matchTriggerWidth?: boolean;\n tabindex?: number;\n initiallyOpen?: boolean;\n horizontalPosition?: string;\n verticalPosition?: string;\n destination?: string;\n preventScroll?: boolean;\n noMatchesMessage?: string;\n noMatchesMessageComponent?: any;\n };\n Blocks: {\n default: [any, number, Select];\n };\n}\n\ninterface Sliceable<T> {\n slice(): T[];\n}\n\nconst isSliceable = <T,>(coll: any): coll is Sliceable<T> => {\n return isArray(coll);\n};\n\nexport const toPlainArray = <T,>(collection: T[] | Sliceable<T>): T[] => {\n if (isSliceable<T>(collection)) {\n return collection.slice();\n } else {\n return collection;\n }\n};\n\nexport default class EuiComboBoxComponent extends Component<EuiComboBoxSignature> {\n @service declare euiI18n: EuiI18n;\n\n @tracked select: any = null;\n @tracked private _resolvedOptions?: any[];\n @tracked searchText = '';\n @tracked private _searchResult?: any[];\n\n private _filterResultsCache: {\n results: any[];\n options: any[];\n searchText: string;\n } = { results: [], options: [], searchText: this.searchText };\n\n get loadingMessage() {\n return (\n this.args.loadingMessage ||\n this.euiI18n.lookupToken(\n 'euiComboBox.loadingMessage',\n 'Loading options...'\n )\n );\n }\n\n get noMatchesMessage() {\n return (\n this.args.noMatchesMessage ||\n this.euiI18n.lookupToken(\n 'euiComboBox.noMatchesMessage',\n 'No results found'\n )\n );\n }\n\n get searchMessage() {\n return (\n this.args.searchMessage ||\n this.euiI18n.lookupToken(\n 'euiComboBox.searchMessage',\n 'Type to search'\n )\n );\n }\n\n <template>\n {{! @glint-nocheck: not typesafe yet }}\n <PowerSelectMultiple\n ...attributes\n @onChange={{pipe this.onChange @onChange}}\n @onFocus={{@onFocus}}\n @onBlur={{@onBlur}}\n @onOpen={{@onOpen}}\n @onClose={{@onClose}}\n @placeholderComponent={{@placeholderComponent}}\n @searchMessage={{this.searchMessage}}\n @searchMessageComponent={{if\n @searchMessageComponent\n @searchMessageComponent\n EuiComboBoxSearchMessage\n }}\n @noMatchesMessage={{this.noMatchesMessage}}\n @matchTriggerWidth={{@matchTriggerWidth}}\n @options={{this.options}}\n @selected={{@selectedOptions}}\n @closeOnSelect={{@closeOnSelect}}\n @defaultHighlighted={{@defaultHighlighted}}\n @searchField={{@searchField}}\n @searchEnabled={{argOrDefault @searchEnabled true}}\n @tabindex={{@tabindex}}\n @initiallyOpened={{and (not @isDisabled) @autoFocus}}\n @triggerComponent={{component\n EuiComboBoxTrigger\n fullWidth=@fullWidth\n compressed=@compressed\n isInvalid=@isInvalid\n singleSelection=@singleSelection\n onClose=@removeTag\n onCreateOption=(if @onCreateOption this.onCreateOption)\n isLoading=@isLoading\n autoFocus=(and (not @isDisabled) @autoFocus)\n icon=@triggerIcon\n }}\n @matcher={{@matcher}}\n @initiallyOpen={{@initiallyOpen}}\n @typeAheadOptionMatcher={{@typeAheadOptionMatcher}}\n @buildSelection={{this.buildSelection}}\n @search={{@search}}\n @onInput={{@onInput}}\n @onKeydown={{@onKeydown}}\n @scrollTo={{this.scrollTo}}\n @registerAPI={{queue this.registerAPI (optional @registerApi)}}\n @horizontalPosition={{@horizontalPosition}}\n @destination={{@destination}}\n @preventScroll={{@preventScroll}}\n @renderInPlace={{@renderInPlace}}\n @verticalPosition={{@verticalPosition}}\n @disabled={{@isDisabled}}\n @calculatePosition={{@calculatePosition}}\n @eventType={{@eventType}}\n @ariaLabel={{@ariaLabel}}\n @ariaLabelledBy={{@ariaLabelledBy}}\n @required={{@required}}\n @triggerRole={{@triggerRole}}\n @title={{@title}}\n @triggerId={{@triggerId}}\n @allowClear={{and (argOrDefault @isClearable true) (not @isDisabled)}}\n @loadingMessage={{this.loadingMessage}}\n @selectedItemComponent={{@selectedItemComponent}}\n @beforeOptionsComponent={{@beforeOptionsComponent}}\n @afterOptionsComponent={{@afterOptionsComponent}}\n @placeholder={{@placeholder}}\n @searchPlaceholder={{@searchPlaceholder}}\n @optionsComponent={{component\n EuiComboBoxOptions\n rowHeight=@rowHeight\n class=@optionsClass\n }}\n @extra={{@extra}}\n @groupComponent={{component EuiComboBoxGroup}}\n @triggerClass={{classNames\n \"euiComboBox\"\n (if @compressed \"euiComboBox--compressed\")\n (if @fullWidth \"euiComboBox--fullWidth\")\n (if @isDisabled \"euiComboBox-isDisabled\")\n (if @isInvalid \"euiComboBox-isInvalid\")\n (if this.select.isOpen \"euiComboBox-isOpen\")\n }}\n @noMatchesMessageComponent={{if\n @onCreateOption\n (component\n EuiComboBoxCreateOption\n customOptionText=@customOptionText\n onCreateOption=this.onCreateOption\n select=this.select\n )\n (component EuiComboBoxNoMatchesMessage)\n }}\n @dropdownClass=\"euiComboBoxOptionsList euiPanel euiPanel--borderRadiusMedium euiPanel--noShadow euiPanel--plain euiPopover__panel-isAttached euiPopover__panel euiPopover__panel-noArrow euiPopover__panel--bottom euiPopover__panel-isOpen euiComboBoxOptionsList__rowWrap {{@dropdownClass}}\"\n as |option i|\n >\n {{yield option i}}\n </PowerSelectMultiple>\n </template>\n\n //This is to allow scrolling between virtualized groups\n @cached\n get opts() {\n return this.results.reduce((acc, curr) => {\n if (emberPowerSelectIsGroup([curr])) {\n acc.push(curr, ...curr.options);\n } else {\n acc.push(curr);\n }\n\n return acc;\n }, []);\n }\n\n @cached\n get options(): any[] {\n if (this._resolvedOptions) return toPlainArray(this._resolvedOptions);\n\n if (this.args.options) {\n return toPlainArray(this.args.options);\n } else {\n return [];\n }\n }\n\n @cached\n get results(): any[] {\n if (this.searchText.length > 0) {\n if (this.args.search) {\n return toPlainArray(this._searchResult || this.options);\n } else {\n if (\n this._filterResultsCache.options === this.options &&\n this._filterResultsCache.searchText === this.searchText\n ) {\n // This is an optimization to avoid filtering several times, which may be a bit expensive\n // if there are many options, if neither the options nor the searchtext have changed\n return this._filterResultsCache.results;\n }\n\n //@ts-ignore\n let results = this._filter(this.options, this.searchText);\n //eslint-disable-next-line\n this._filterResultsCache = {\n results,\n options: this.options,\n searchText: this.searchText\n };\n\n return results;\n }\n } else {\n return this.options;\n }\n }\n\n @action\n scrollTo(option: any, select: { results: []; uniqueId: string }): void {\n let optionsList = document.querySelector(\n `[aria-controls=\"ember-power-select-trigger-${select.uniqueId}\"]`\n ) as HTMLElement;\n\n if (!optionsList) {\n return;\n }\n\n let index = this.opts.indexOf(option);\n\n if (index === -1) {\n return;\n }\n\n let optionElement = optionsList.querySelector(\n `[data-option-index=\"${index}\"]`\n ) as HTMLElement;\n\n if (!optionElement) {\n return;\n }\n\n let optionTopScroll = optionElement.offsetTop;\n let optionBottomScroll = optionTopScroll + optionElement.offsetHeight;\n\n if (optionBottomScroll > optionsList.offsetHeight + optionsList.scrollTop) {\n optionsList.scrollTop = optionBottomScroll - optionsList.offsetHeight;\n } else if (optionTopScroll < optionsList.scrollTop) {\n optionsList.scrollTop = optionTopScroll;\n }\n }\n\n @action\n registerAPI(select: Select) {\n this.select = select;\n }\n\n @action\n onChange(selected: any[]) {\n if (this.args.singleSelection) {\n return selected.length > 0 ? [selected[selected.length - 1]] : [];\n }\n\n return selected;\n }\n\n @action\n onCreateOption() {\n let option;\n\n if (\n this.args.onCreateOption &&\n typeof this.args.onCreateOption === 'function'\n ) {\n // The `onCreateOption` function can be used to sanitize the input or explicitly return `false` to reject the input\n option = this.args.onCreateOption(this.select.searchText);\n\n if (option === false) {\n return;\n }\n }\n\n let search = option || this.select.searchText;\n\n this.select.actions.search('');\n this.select.actions.close();\n\n return search;\n }\n\n @action\n buildSelection(option: any, select: Select) {\n let newSelection = (select.selected || []).slice(0);\n let idx = -1;\n\n for (let i = 0; i < newSelection.length; i++) {\n if (isEqual(newSelection[i], option)) {\n idx = i;\n\n break;\n }\n }\n\n if (idx > -1) {\n newSelection.splice(idx, 1);\n } else {\n newSelection.push(option);\n }\n\n if (this.args.singleSelection && newSelection.length === 0) {\n select.actions.search('');\n }\n\n if (select?.selected?.length < newSelection.length) {\n select.actions.search('');\n }\n\n return newSelection;\n }\n}\n"],"names":["isSliceable","coll","isArray","toPlainArray","collection","slice","EuiComboBoxComponent","Component","g","prototype","service","i","void 0","tracked","_filterResultsCache","results","options","searchText","loadingMessage","args","euiI18n","lookupToken","noMatchesMessage","searchMessage","setComponentTemplate","precompileTemplate","strictMode","scope","PowerSelectMultiple","pipe","EuiComboBoxSearchMessage","argOrDefault","and","not","EuiComboBoxTrigger","queue","optional","EuiComboBoxOptions","EuiComboBoxGroup","classNames","EuiComboBoxCreateOption","EuiComboBoxNoMatchesMessage","opts","reduce","acc","curr","emberPowerSelectIsGroup","push","n","cached","_resolvedOptions","length","search","_searchResult","_filter","scrollTo","option","select","optionsList","document","querySelector","uniqueId","index","indexOf","optionElement","optionTopScroll","offsetTop","optionBottomScroll","offsetHeight","scrollTop","action","registerAPI","onChange","selected","singleSelection","onCreateOption","actions","close","buildSelection","newSelection","idx","isEqual","splice"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAkGA,MAAMA,cAAmBC,IAAS,IAAqB;EACrD,OAAOC,OAAQ,CAAAD,IAAA,CAAA;AACjB,CAAA;AAEaE,MAAAA,YAAe,GAAKC,UAAiC,IAAA;AAChE,EAAA,IAAIJ,WAAA,CAAeI,UAAa,CAAA,EAAA;AAC9B,IAAA,OAAOA,WAAWC,KAAK,EAAA;AACzB,GAAO,MAAA;AACL,IAAA,OAAOD,UAAA;AACT;AACF;AAEe,MAAME,6BAA6BC,SAAU,CAAA;AAAA,EAAA;IAAAC,CAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,SAAA,EAAA,CACzDC,MAAA,CAAA,CAAA;AAAA;AAAA,EAAA,QAAA,IAAAC,CAAA,CAAA,IAAA,EAAA,SAAA,CAAA,EAAAC,SAAA;AAAA,EAAA;IAAAJ,CAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,QAAA,EAAA,CAEAI,OAAA,CAAA,EAAA,YAAA;AAAA,MAAA,OAAsB,IAAK;AAAA,KAAA,CAAA;AAAA;AAAA,EAAA,OAAA,IAAAF,CAAA,CAAA,IAAA,EAAA,QAAA,CAAA,EAAAC,SAAA;AAAA,EAAA;IAAAJ,CAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,kBAAA,EAAA,CAC3BI,OAAA,CAAA,CAAA;AAAA;AAAA,EAAA,iBAAA,IAAAF,CAAA,CAAA,IAAA,EAAA,kBAAA,CAAA,EAAAC,SAAA;AAAA,EAAA;IAAAJ,CAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,YAAA,EAAA,CACAI,OAAA,CAAA,EAAA,YAAA;AAAA,MAAA,OAAqB,EAAG;AAAA,KAAA,CAAA;AAAA;AAAA,EAAA,WAAA,IAAAF,CAAA,CAAA,IAAA,EAAA,YAAA,CAAA,EAAAC,SAAA;AAAA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json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ember-eui/core",
|
|
3
|
-
"version": "12.0.
|
|
3
|
+
"version": "12.0.1",
|
|
4
4
|
"description": "Ember Components for Elastic UI",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon",
|
|
@@ -171,9 +171,9 @@
|
|
|
171
171
|
"@glimmer/tracking": "^1.1.2",
|
|
172
172
|
"ember-auto-import": "^2.10.0",
|
|
173
173
|
"ember-basic-dropdown": "^8.5.0",
|
|
174
|
+
"ember-power-select": "^8.7.0",
|
|
174
175
|
"ember-concurrency": "^4.0.2",
|
|
175
176
|
"ember-focus-trap": "^1.1.0",
|
|
176
|
-
"ember-power-select": "^8.7.0",
|
|
177
177
|
"ember-source": ">= 4.0.0",
|
|
178
178
|
"@ember/string": "^4.0.0",
|
|
179
179
|
"moment": "^2.29.3"
|