@ember-eui/validated-form 13.0.5 → 14.1.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/declarations/-private/random-id.d.ts.map +1 -1
- package/declarations/components/validated-form/field-base.d.ts +33 -4
- package/declarations/components/validated-form/field-base.d.ts.map +1 -1
- package/declarations/components/validated-form/field-checkbox-group.d.ts +12 -1
- package/declarations/components/validated-form/field-checkbox-group.d.ts.map +1 -1
- package/declarations/components/validated-form/field-combo-box.d.ts +14 -1
- package/declarations/components/validated-form/field-combo-box.d.ts.map +1 -1
- package/declarations/components/validated-form/field-dual-range-slider.d.ts +17 -1
- package/declarations/components/validated-form/field-dual-range-slider.d.ts.map +1 -1
- package/declarations/components/validated-form/field-markdown-editor.d.ts +13 -1
- package/declarations/components/validated-form/field-markdown-editor.d.ts.map +1 -1
- package/declarations/components/validated-form/field-number.d.ts +12 -1
- package/declarations/components/validated-form/field-number.d.ts.map +1 -1
- package/declarations/components/validated-form/field-password.d.ts +12 -1
- package/declarations/components/validated-form/field-password.d.ts.map +1 -1
- package/declarations/components/validated-form/field-radio-group.d.ts +11 -7
- package/declarations/components/validated-form/field-radio-group.d.ts.map +1 -1
- package/declarations/components/validated-form/field-range-slider.d.ts +11 -1
- package/declarations/components/validated-form/field-range-slider.d.ts.map +1 -1
- package/declarations/components/validated-form/field-select.d.ts +11 -1
- package/declarations/components/validated-form/field-select.d.ts.map +1 -1
- package/declarations/components/validated-form/field-switch.d.ts +12 -1
- package/declarations/components/validated-form/field-switch.d.ts.map +1 -1
- package/declarations/components/validated-form/field-text-area.d.ts +17 -0
- package/declarations/components/validated-form/field-text-area.d.ts.map +1 -1
- package/declarations/components/validated-form/field-text.d.ts +9 -0
- package/declarations/components/validated-form/field-text.d.ts.map +1 -1
- package/declarations/components/validated-form.d.ts +37 -1
- package/declarations/components/validated-form.d.ts.map +1 -1
- package/declarations/utils/build-validation-messages.d.ts.map +1 -1
- package/declarations/validators/messages.d.ts +44 -1
- package/declarations/validators/messages.d.ts.map +1 -1
- package/dist/-private/random-id.js +1 -0
- package/dist/-private/random-id.js.map +1 -1
- package/dist/components/default-theme.js.map +1 -1
- package/dist/components/validated-form/field-base.js +3 -3
- package/dist/components/validated-form/field-base.js.map +1 -1
- package/dist/components/validated-form/field-checkbox-group.js +4 -4
- package/dist/components/validated-form/field-checkbox-group.js.map +1 -1
- package/dist/components/validated-form/field-combo-box.js +2 -2
- package/dist/components/validated-form/field-combo-box.js.map +1 -1
- package/dist/components/validated-form/field-dual-range-slider.js +2 -4
- package/dist/components/validated-form/field-dual-range-slider.js.map +1 -1
- package/dist/components/validated-form/field-markdown-editor.js +2 -6
- package/dist/components/validated-form/field-markdown-editor.js.map +1 -1
- package/dist/components/validated-form/field-number.js +1 -2
- package/dist/components/validated-form/field-number.js.map +1 -1
- package/dist/components/validated-form/field-password.js +1 -2
- package/dist/components/validated-form/field-password.js.map +1 -1
- package/dist/components/validated-form/field-radio-group.js +4 -24
- package/dist/components/validated-form/field-radio-group.js.map +1 -1
- package/dist/components/validated-form/field-range-slider.js +1 -3
- package/dist/components/validated-form/field-range-slider.js.map +1 -1
- package/dist/components/validated-form/field-select.js +1 -2
- package/dist/components/validated-form/field-select.js.map +1 -1
- package/dist/components/validated-form/field-switch.js +2 -4
- package/dist/components/validated-form/field-switch.js.map +1 -1
- package/dist/components/validated-form/field-text-area.js +1 -1
- package/dist/components/validated-form/field-text-area.js.map +1 -1
- package/dist/components/validated-form/field-text.js +1 -2
- package/dist/components/validated-form/field-text.js.map +1 -1
- package/dist/components/validated-form.js +3 -3
- package/dist/components/validated-form.js.map +1 -1
- package/dist/utils/build-validation-messages.js +13 -5
- package/dist/utils/build-validation-messages.js.map +1 -1
- package/dist/utils/get-messages.js.map +1 -1
- package/dist/utils/validation-errors.js.map +1 -1
- package/dist/utils/with-defaults.js.map +1 -1
- package/dist/validators/messages.js.map +1 -1
- package/package.json +57 -34
- /package/{addon-main.js → addon-main.cjs} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field-number.js","sources":["../../../src/components/validated-form/field-number.gts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"field-number.js","sources":["../../../src/components/validated-form/field-number.gts"],"sourcesContent":["import { on } from '@ember/modifier';\nimport didInsert from '@ember/render-modifiers/modifiers/did-insert';\nimport didUpdate from '@ember/render-modifiers/modifiers/did-update';\nimport EuiFieldNumber from '@ember-eui/core/components/eui-field-number';\nimport EuiFormRow from '@ember-eui/core/components/eui-form-row';\nimport { argOrDefault } from '@ember-eui/core/helpers';\n\nimport { not } from 'ember-truth-helpers';\n\nimport randomId from '../../-private/random-id.ts';\nimport ValidatedFormFieldBase from './field-base.gts';\n\nimport type { FieldBaseSignature } from './field-base.gts';\nimport type { EuiFieldNumberSignature } from '@ember-eui/core/components/eui-field-number';\nimport type { EuiFormRowSignature } from '@ember-eui/core/components/eui-form-row';\n\n/**\n * A validated number input in an EuiFormRow. Takes FieldBase's, EuiFormRow's and\n * the control's args.\n */\nexport interface FieldNumberSignature {\n Element: EuiFieldNumberSignature['Element'];\n Args: FieldBaseSignature['Args'] &\n EuiFormRowSignature['Args'] &\n EuiFieldNumberSignature['Args'] & {\n /** Classes for the EuiFormRow. */\n rowClasses?: string;\n /** Classes for the control. */\n fieldClasses?: string;\n /** @private Set by ValidatedForm. */\n formId?: string;\n /** Accessible label of the control. */\n ariaLabel?: string;\n /** Focuses the control on render. */\n autofocus?: boolean;\n /** Called with the input's value (a string). */\n onChange?: (value: string) => void;\n /** Placeholder text. */\n placeholder?: string;\n };\n Blocks: {\n label: [...EuiFormRowSignature['Blocks']['label']];\n helpText: [...EuiFormRowSignature['Blocks']['helpText']];\n prepend: [...EuiFieldNumberSignature['Blocks']['prepend']];\n append: [...EuiFieldNumberSignature['Blocks']['append']];\n };\n}\n\nexport default class ValidatedFormFieldNumber extends ValidatedFormFieldBase<FieldNumberSignature> {\n <template>\n {{#let (argOrDefault @id (randomId)) as |theId|}}\n <EuiFormRow\n class={{this.rowClasses}}\n @labelType={{@labelType}}\n @display={{@display}}\n @hasEmptyLabelSpace={{@hasEmptyLabelSpace}}\n @fullWidth={{@fullWidth}}\n @hasChildLabel={{@hasChildLabel}}\n @label={{this.label}}\n @labelAppend={{@labelAppend}}\n @id={{theId}}\n @isInvalid={{this.isInvalidAndTouched}}\n @error={{this.validationErrorMessages}}\n @helpText={{@helpText}}\n @errorClasses={{@errorClasses}}\n @isFakeLabelBlock={{not (has-block \"label\")}}\n @isFakeHelpTextBlock={{not (has-block \"helpText\")}}\n {{didInsert this.setValidationMessages}}\n {{didUpdate this.didUpdateValue @validations}}\n {{didUpdate this.didUpdateValue @value}}\n >\n <:label>\n {{yield to=\"label\"}}\n </:label>\n\n <:field>\n <EuiFieldNumber\n class={{@fieldClasses}}\n form={{@formId}}\n aria-label={{@ariaLabel}}\n @value={{@value}}\n @icon={{@icon}}\n @isInvalid={{this.isInvalidAndTouched}}\n @fullWidth={{@fullWidth}}\n @isLoading={{@isLoading}}\n @readOnly={{@readOnly}}\n @disabled={{@disabled}}\n @min={{@min}}\n @max={{@max}}\n @step={{@step}}\n @inputRef={{@inputRef}}\n @controlOnly={{@controlOnly}}\n @compressed={{@compressed}}\n @id={{theId}}\n @clear={{@clear}}\n @isPrependProvided={{has-block \"prepend\"}}\n @isAppendProvided={{has-block \"append\"}}\n autofocus={{@autofocus}}\n placeholder={{@placeholder}}\n ...attributes\n {{on \"input\" this.handleChange}}\n >\n <:prepend as |classes|>\n {{yield classes to=\"prepend\"}}\n </:prepend>\n <:append as |classes|>\n {{yield classes to=\"append\"}}\n </:append>\n </EuiFieldNumber>\n </:field>\n <:helpText as |helpText|>\n {{yield helpText to=\"helpText\"}}\n </:helpText>\n </EuiFormRow>\n {{/let}}\n </template>\n}\n"],"names":["ValidatedFormFieldNumber","ValidatedFormFieldBase","setComponentTemplate","precompileTemplate","strictMode","scope","argOrDefault","randomId","EuiFormRow","not","didInsert","didUpdate","EuiFieldNumber","on"],"mappings":";;;;;;;;;;;;AAgDe,MAAMA,iCAAiCC,sBAAA,CAAuB;AAC3E,EAAA;IAAAC,oBAAA,CAAAC,kBAAA,CAAA,srDAAA,EAkEA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,YAAA;QAAAC,QAAA;QAAAC,UAAA;QAAAC,GAAA;QAAAC,SAAA;QAAAC,SAAA;QAAAC,cAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import '@ember/helper';
|
|
2
1
|
import { on } from '@ember/modifier';
|
|
3
2
|
import didInsert from '@ember/render-modifiers/modifiers/did-insert';
|
|
4
3
|
import didUpdate from '@ember/render-modifiers/modifiers/did-update';
|
|
@@ -13,7 +12,7 @@ import { setComponentTemplate } from '@ember/component';
|
|
|
13
12
|
|
|
14
13
|
class ValidatedFormFieldPassword extends ValidatedFormFieldBase {
|
|
15
14
|
static {
|
|
16
|
-
setComponentTemplate(precompileTemplate("
|
|
15
|
+
setComponentTemplate(precompileTemplate("{{#let (argOrDefault @id (randomId)) as |theId|}}\n <EuiFormRow class={{this.rowClasses}} @labelType={{@labelType}} @display={{@display}} @hasEmptyLabelSpace={{@hasEmptyLabelSpace}} @fullWidth={{@fullWidth}} @hasChildLabel={{@hasChildLabel}} @label={{this.label}} @labelAppend={{@labelAppend}} @id={{theId}} @isInvalid={{this.isInvalidAndTouched}} @error={{this.validationErrorMessages}} @helpText={{@helpText}} @errorClasses={{@errorClasses}} @isFakeLabelBlock={{not (has-block \"label\")}} @isFakeHelpTextBlock={{not (has-block \"helpText\")}} {{didInsert this.setValidationMessages}} {{didUpdate this.didUpdateValue @validations}} {{didUpdate this.didUpdateValue @value}}>\n <:label>\n {{yield to=\"label\"}}\n </:label>\n <:field>\n <EuiFieldPassword class={{@fieldClasses}} form={{@formId}} aria-label={{@ariaLabel}} @isInvalid={{this.isInvalidAndTouched}} @fullWidth={{@fullWidth}} @isLoading={{@isLoading}} @compressed={{@compressed}} @inputRef={{@inputRef}} @value={{@value}} @type={{@type}} @id={{theId}} @disabled={{@disabled}} @isFakePrependBlock={{not (has-block \"prepend\")}} @isFakeAppendBlock={{not (has-block \"append\")}} autofocus={{@autofocus}} placeholder={{@placeholder}} ...attributes {{on \"input\" this.handleChange}}>\n <:prepend as |classes inputId|>\n {{yield classes inputId to=\"prepend\"}}\n </:prepend>\n <:append as |classes inputId|>\n {{yield classes inputId to=\"append\"}}\n </:append>\n </EuiFieldPassword>\n </:field>\n <:helpText as |helpText|>\n {{yield helpText to=\"helpText\"}}\n </:helpText>\n </EuiFormRow>\n{{/let}}", {
|
|
17
16
|
strictMode: true,
|
|
18
17
|
scope: () => ({
|
|
19
18
|
argOrDefault,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field-password.js","sources":["../../../src/components/validated-form/field-password.gts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"field-password.js","sources":["../../../src/components/validated-form/field-password.gts"],"sourcesContent":["import { on } from '@ember/modifier';\nimport didInsert from '@ember/render-modifiers/modifiers/did-insert';\nimport didUpdate from '@ember/render-modifiers/modifiers/did-update';\nimport EuiFieldPassword from '@ember-eui/core/components/eui-field-password';\nimport EuiFormRow from '@ember-eui/core/components/eui-form-row';\nimport { argOrDefault } from '@ember-eui/core/helpers';\n\nimport { not } from 'ember-truth-helpers';\n\nimport randomId from '../../-private/random-id.ts';\nimport ValidatedFormFieldBase from './field-base.gts';\n\nimport type { FieldBaseSignature } from './field-base.gts';\nimport type { EuiFieldPasswordSignature } from '@ember-eui/core/components/eui-field-password';\nimport type { EuiFormRowSignature } from '@ember-eui/core/components/eui-form-row';\n\n/**\n * A validated password input in an EuiFormRow. Takes FieldBase's, EuiFormRow's and\n * the control's args.\n */\nexport interface FieldPasswordSignature {\n Element: EuiFieldPasswordSignature['Element'];\n Args: FieldBaseSignature['Args'] &\n EuiFormRowSignature['Args'] &\n EuiFieldPasswordSignature['Args'] & {\n /** Classes for the EuiFormRow. */\n rowClasses?: string;\n /** Classes for the control. */\n fieldClasses?: string;\n /** @private Set by ValidatedForm. */\n formId?: string;\n /** Accessible label of the control. */\n ariaLabel?: string;\n /** Focuses the control on render. */\n autofocus?: boolean;\n /** Called with the input's value. */\n onChange?: (value: string) => void;\n /** Placeholder text. */\n placeholder?: string;\n };\n Blocks: {\n label: [...EuiFormRowSignature['Blocks']['label']];\n helpText: [...EuiFormRowSignature['Blocks']['helpText']];\n prepend: [...EuiFieldPasswordSignature['Blocks']['prepend']];\n append: [...EuiFieldPasswordSignature['Blocks']['append']];\n };\n}\n\nexport default class ValidatedFormFieldPassword extends ValidatedFormFieldBase<FieldPasswordSignature> {\n <template>\n {{#let (argOrDefault @id (randomId)) as |theId|}}\n <EuiFormRow\n class={{this.rowClasses}}\n @labelType={{@labelType}}\n @display={{@display}}\n @hasEmptyLabelSpace={{@hasEmptyLabelSpace}}\n @fullWidth={{@fullWidth}}\n @hasChildLabel={{@hasChildLabel}}\n @label={{this.label}}\n @labelAppend={{@labelAppend}}\n @id={{theId}}\n @isInvalid={{this.isInvalidAndTouched}}\n @error={{this.validationErrorMessages}}\n @helpText={{@helpText}}\n @errorClasses={{@errorClasses}}\n @isFakeLabelBlock={{not (has-block \"label\")}}\n @isFakeHelpTextBlock={{not (has-block \"helpText\")}}\n {{didInsert this.setValidationMessages}}\n {{didUpdate this.didUpdateValue @validations}}\n {{didUpdate this.didUpdateValue @value}}\n >\n <:label>\n {{yield to=\"label\"}}\n </:label>\n <:field>\n <EuiFieldPassword\n class={{@fieldClasses}}\n form={{@formId}}\n aria-label={{@ariaLabel}}\n @isInvalid={{this.isInvalidAndTouched}}\n @fullWidth={{@fullWidth}}\n @isLoading={{@isLoading}}\n @compressed={{@compressed}}\n @inputRef={{@inputRef}}\n @value={{@value}}\n @type={{@type}}\n @id={{theId}}\n @disabled={{@disabled}}\n @isFakePrependBlock={{not (has-block \"prepend\")}}\n @isFakeAppendBlock={{not (has-block \"append\")}}\n autofocus={{@autofocus}}\n placeholder={{@placeholder}}\n ...attributes\n {{on \"input\" this.handleChange}}\n >\n <:prepend as |classes inputId|>\n {{yield classes inputId to=\"prepend\"}}\n </:prepend>\n <:append as |classes inputId|>\n {{yield classes inputId to=\"append\"}}\n </:append>\n </EuiFieldPassword>\n </:field>\n <:helpText as |helpText|>\n {{yield helpText to=\"helpText\"}}\n </:helpText>\n </EuiFormRow>\n {{/let}}\n </template>\n}\n"],"names":["ValidatedFormFieldPassword","ValidatedFormFieldBase","setComponentTemplate","precompileTemplate","strictMode","scope","argOrDefault","randomId","EuiFormRow","not","didInsert","didUpdate","EuiFieldPassword","on"],"mappings":";;;;;;;;;;;;AAgDe,MAAMA,mCAAmCC,sBAAA,CAAuB;AAC7E,EAAA;IAAAC,oBAAA,CAAAC,kBAAA,CAAA,knDAAA,EA2DA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,YAAA;QAAAC,QAAA;QAAAC,UAAA;QAAAC,GAAA;QAAAC,SAAA;QAAAC,SAAA;QAAAC,gBAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;"}
|
|
@@ -10,42 +10,22 @@ import randomId from '../../-private/random-id.js';
|
|
|
10
10
|
import ValidatedFormFieldBase from './field-base.js';
|
|
11
11
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
12
12
|
import { setComponentTemplate } from '@ember/component';
|
|
13
|
-
import { n } from 'decorator-transforms/runtime';
|
|
13
|
+
import { n } from 'decorator-transforms/runtime-esm';
|
|
14
14
|
|
|
15
15
|
class ValidatedFormFieldRadioGroup extends ValidatedFormFieldBase {
|
|
16
16
|
get value() {
|
|
17
|
-
|
|
18
|
-
return value?.toArray?.() || value;
|
|
19
|
-
}
|
|
20
|
-
get arrayToMap() {
|
|
21
|
-
const currArr = this.args.value || [];
|
|
22
|
-
return this.transformToMap(currArr);
|
|
23
|
-
}
|
|
24
|
-
transformToMap(value = []) {
|
|
25
|
-
let valuesMap = value.reduce((acc, val) => {
|
|
26
|
-
acc[val] = true;
|
|
27
|
-
return acc;
|
|
28
|
-
}, {});
|
|
29
|
-
return valuesMap;
|
|
17
|
+
return maybeUnwrapProxy(this.args.value);
|
|
30
18
|
}
|
|
31
19
|
//@ts-expect-error
|
|
32
20
|
handleChange(optionId) {
|
|
33
|
-
|
|
34
|
-
const found = value.find(v => v === optionId);
|
|
35
|
-
let newArr = [];
|
|
36
|
-
if (found) {
|
|
37
|
-
newArr = value.filter(v => v !== optionId);
|
|
38
|
-
} else {
|
|
39
|
-
newArr = [...value, optionId];
|
|
40
|
-
}
|
|
41
|
-
this.args.onChange?.(newArr);
|
|
21
|
+
this.args.onChange?.(optionId);
|
|
42
22
|
this.isTouched = true;
|
|
43
23
|
}
|
|
44
24
|
static {
|
|
45
25
|
n(this.prototype, "handleChange", [action]);
|
|
46
26
|
}
|
|
47
27
|
static {
|
|
48
|
-
setComponentTemplate(precompileTemplate("
|
|
28
|
+
setComponentTemplate(precompileTemplate("{{#let (argOrDefault @id (randomId)) as |theId|}}\n <EuiFormRow class={{this.rowClasses}} @labelType={{@labelType}} @display={{@display}} @hasEmptyLabelSpace={{@hasEmptyLabelSpace}} @fullWidth={{@fullWidth}} @hasChildLabel={{@hasChildLabel}} @label={{this.label}} @labelAppend={{@labelAppend}} @id={{theId}} @isInvalid={{this.isInvalidAndTouched}} @error={{this.validationErrorMessages}} @helpText={{@helpText}} @errorClasses={{@errorClasses}} @isFakeLabelBlock={{not (has-block \"label\")}} @isFakeHelpTextBlock={{not (has-block \"helpText\")}} {{didInsert this.setValidationMessages}} {{didUpdate this.didUpdateValue @validations}} {{didUpdate this.didUpdateValue @value}}>\n <:label as |label|>\n {{yield label to=\"label\"}}\n </:label>\n <:field>\n <EuiRadioGroup class={{@fieldClasses}} @formId={{@formId}} aria-label={{@ariaLabel}} @disabled={{@disabled}} @valueKey={{@valueKey}} @labelKey={{@labelKey}} @compressed={{@compressed}} @name={{@name}} @options={{this.options}} @idSelected={{this.value}} @legend={{@legend}} @onChange={{this.handleChange}} autofocus={{@autofocus}} ...attributes />\n </:field>\n <:helpText as |helpText|>\n {{yield helpText to=\"helpText\"}}\n </:helpText>\n </EuiFormRow>\n{{/let}}", {
|
|
49
29
|
strictMode: true,
|
|
50
30
|
scope: () => ({
|
|
51
31
|
argOrDefault,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field-radio-group.js","sources":["../../../src/components/validated-form/field-radio-group.gts"],"sourcesContent":["import { action } from '@ember/object';\nimport didInsert from '@ember/render-modifiers/modifiers/did-insert';\nimport didUpdate from '@ember/render-modifiers/modifiers/did-update';\nimport EuiFormRow from '@ember-eui/core/components/eui-form-row';\nimport EuiRadioGroup from '@ember-eui/core/components/eui-radio-group';\nimport { argOrDefault } from '@ember-eui/core/helpers';\nimport { maybeUnwrapProxy } from '@ember-eui/core/utils/maybe-unwrap-proxy';\n\nimport { not } from 'ember-truth-helpers';\n\nimport randomId from '../../-private/random-id.ts';\nimport ValidatedFormFieldBase from './field-base.gts';\n\nimport type { FieldBaseSignature } from './field-base.gts';\nimport type { EuiFormRowSignature } from '@ember-eui/core/components/eui-form-row';\nimport type { EuiRadioGroupSignature } from '@ember-eui/core/components/eui-radio-group';\n\nexport interface FieldRadioGroupSignature {\n Element: EuiRadioGroupSignature['Element'];\n Args: FieldBaseSignature['Args'] &\n EuiFormRowSignature['Args'] &\n EuiRadioGroupSignature['Args'] & {\n rowClasses?: string;\n fieldClasses?: string;\n formId?: string;\n ariaLabel?: string;\n autofocus?: boolean;\n onChange?: (
|
|
1
|
+
{"version":3,"file":"field-radio-group.js","sources":["../../../src/components/validated-form/field-radio-group.gts"],"sourcesContent":["import { action } from '@ember/object';\nimport didInsert from '@ember/render-modifiers/modifiers/did-insert';\nimport didUpdate from '@ember/render-modifiers/modifiers/did-update';\nimport EuiFormRow from '@ember-eui/core/components/eui-form-row';\nimport EuiRadioGroup from '@ember-eui/core/components/eui-radio-group';\nimport { argOrDefault } from '@ember-eui/core/helpers';\nimport { maybeUnwrapProxy } from '@ember-eui/core/utils/maybe-unwrap-proxy';\n\nimport { not } from 'ember-truth-helpers';\n\nimport randomId from '../../-private/random-id.ts';\nimport ValidatedFormFieldBase from './field-base.gts';\n\nimport type { FieldBaseSignature } from './field-base.gts';\nimport type { EuiFormRowSignature } from '@ember-eui/core/components/eui-form-row';\nimport type { EuiRadioGroupSignature } from '@ember-eui/core/components/eui-radio-group';\n\n/**\n * A validated radio group in an EuiFormRow. Takes FieldBase's, EuiFormRow's and\n * the control's args.\n */\nexport interface FieldRadioGroupSignature {\n Element: EuiRadioGroupSignature['Element'];\n Args: FieldBaseSignature['Args'] &\n EuiFormRowSignature['Args'] &\n EuiRadioGroupSignature['Args'] & {\n /** Classes for the EuiFormRow. */\n rowClasses?: string;\n /** Classes for the control. */\n fieldClasses?: string;\n /** @private Set by ValidatedForm. */\n formId?: string;\n /** Accessible label of the control. */\n ariaLabel?: string;\n /** Focuses the control on render. */\n autofocus?: boolean;\n /** Called with the chosen option's id. */\n onChange?: (optionId: string) => void;\n };\n Blocks: {\n label: [...EuiFormRowSignature['Blocks']['label']];\n helpText: [...EuiFormRowSignature['Blocks']['helpText']];\n };\n}\n\nexport default class ValidatedFormFieldRadioGroup extends ValidatedFormFieldBase<FieldRadioGroupSignature> {\n get value() {\n return maybeUnwrapProxy(this.args.value);\n }\n\n @action\n //@ts-expect-error\n handleChange(optionId: string) {\n this.args.onChange?.(optionId);\n this.isTouched = true;\n }\n\n <template>\n {{#let (argOrDefault @id (randomId)) as |theId|}}\n <EuiFormRow\n class={{this.rowClasses}}\n @labelType={{@labelType}}\n @display={{@display}}\n @hasEmptyLabelSpace={{@hasEmptyLabelSpace}}\n @fullWidth={{@fullWidth}}\n @hasChildLabel={{@hasChildLabel}}\n @label={{this.label}}\n @labelAppend={{@labelAppend}}\n @id={{theId}}\n @isInvalid={{this.isInvalidAndTouched}}\n @error={{this.validationErrorMessages}}\n @helpText={{@helpText}}\n @errorClasses={{@errorClasses}}\n @isFakeLabelBlock={{not (has-block \"label\")}}\n @isFakeHelpTextBlock={{not (has-block \"helpText\")}}\n {{didInsert this.setValidationMessages}}\n {{didUpdate this.didUpdateValue @validations}}\n {{didUpdate this.didUpdateValue @value}}\n >\n <:label as |label|>\n {{yield label to=\"label\"}}\n </:label>\n <:field>\n <EuiRadioGroup\n class={{@fieldClasses}}\n @formId={{@formId}}\n aria-label={{@ariaLabel}}\n @disabled={{@disabled}}\n @valueKey={{@valueKey}}\n @labelKey={{@labelKey}}\n @compressed={{@compressed}}\n @name={{@name}}\n @options={{this.options}}\n @idSelected={{this.value}}\n @legend={{@legend}}\n @onChange={{this.handleChange}}\n autofocus={{@autofocus}}\n ...attributes\n />\n </:field>\n <:helpText as |helpText|>\n {{yield helpText to=\"helpText\"}}\n </:helpText>\n </EuiFormRow>\n {{/let}}\n </template>\n}\n"],"names":["ValidatedFormFieldRadioGroup","ValidatedFormFieldBase","value","maybeUnwrapProxy","args","handleChange","optionId","onChange","isTouched","n","prototype","action","setComponentTemplate","precompileTemplate","strictMode","scope","argOrDefault","randomId","EuiFormRow","not","didInsert","didUpdate","EuiRadioGroup"],"mappings":";;;;;;;;;;;;;;AA6Ce,MAAMA,qCAAqCC,sBAAA,CAAuB;EAC/E,IAAIC,KAAAA,GAAQ;AACV,IAAA,OAAOC,gBAAA,CAAiB,IAAI,CAACC,IAAI,CAACF,KAAK,CAAA;AACzC,EAAA;AAGA;EACAG,YAAAA,CAAaC,QAAgB,EAAE;AAC7B,IAAA,IAAI,CAACF,IAAI,CAACG,QAAQ,GAAGD,QAAA,CAAA;IACrB,IAAI,CAACE,SAAS,GAAG,IAAA;AACnB,EAAA;AAAA,EAAA;IAAAC,CAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,cAAA,EAAA,CALCC,MAAA,CAAA,CAAA;AAAA;AAOD,EAAA;IAAAC,oBAAA,CAAAC,kBAAA,CAAA,wuCAAA,EAgDA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,YAAA;QAAAC,QAAA;QAAAC,UAAA;QAAAC,GAAA;QAAAC,SAAA;QAAAC,SAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;"}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import '@ember/helper';
|
|
2
|
-
import '@ember/modifier';
|
|
3
1
|
import didInsert from '@ember/render-modifiers/modifiers/did-insert';
|
|
4
2
|
import didUpdate from '@ember/render-modifiers/modifiers/did-update';
|
|
5
3
|
import EuiFormRow from '@ember-eui/core/components/eui-form-row';
|
|
@@ -13,7 +11,7 @@ import { setComponentTemplate } from '@ember/component';
|
|
|
13
11
|
|
|
14
12
|
class ValidatedFormFieldRangeSlider extends ValidatedFormFieldBase {
|
|
15
13
|
static {
|
|
16
|
-
setComponentTemplate(precompileTemplate("
|
|
14
|
+
setComponentTemplate(precompileTemplate("{{#let (argOrDefault @id (randomId)) as |theId|}}\n <EuiFormRow class={{this.rowClasses}} @labelType={{@labelType}} @display={{@display}} @hasEmptyLabelSpace={{@hasEmptyLabelSpace}} @fullWidth={{@fullWidth}} @hasChildLabel={{@hasChildLabel}} @label={{this.label}} @labelAppend={{@labelAppend}} @id={{theId}} @isInvalid={{this.isInvalidAndTouched}} @error={{this.validationErrorMessages}} @helpText={{@helpText}} @errorClasses={{@errorClasses}} @isFakeLabelBlock={{not (has-block \"label\")}} @isFakeHelpTextBlock={{not (has-block \"helpText\")}} {{didInsert this.setValidationMessages}} {{didUpdate this.didUpdateValue @validations}} {{didUpdate this.didUpdateValue @value}}>\n <:label>\n {{yield to=\"label\"}}\n </:label>\n\n <:field>\n <EuiRange class={{@fieldClasses}} form={{@formId}} @compressed={{@compressed}} @readOnly={{@readOnly}} @fullWidth={{@fullWidth}} @id={{theId}} @levels={{@levels}} @step={{@step}} @showInput={{@showInput}} @showLabels={{@showLabels}} @showRange={{@showRange}} @showTicks={{@showTicks}} @showValue={{@showValue}} @disabled={{@disabled}} @ticks={{@ticks}} @tickInterval={{@tickInterval}} @valuePrepend={{@valuePrepend}} @valueAppend={{@valueAppend}} @onChange={{this.handleChange}} @value={{@value}} @max={{@max}} @isLoading={{@isLoading}} @min={{@min}} @isInvalid={{this.isInvalidAndTouched}} @isPrependProvided={{has-block \"prepend\"}} @isAppendProvided={{has-block \"append\"}} @isFakeMinBlock={{not (has-block \"min\")}} @isFakeMaxBlock={{not (has-block \"max\")}} @isFakeValueBlock={{not (has-block \"value\")}} @isFakeValuePrependBlock={{not (has-block \"valuePrepend\")}} @isFakeValueAppendBlock={{not (has-block \"valueAppend\")}} aria-label={{@ariaLabel}} autofocus={{@autofocus}} ...attributes>\n <:prepend as |classes|>\n {{yield classes to=\"prepend\"}}\n </:prepend>\n <:min as |min|>\n {{yield min to=\"min\"}}\n </:min>\n <:valuePrepend>\n {{yield to=\"valuePrepend\"}}\n </:valuePrepend>\n <:value>\n {{yield to=\"value\"}}\n </:value>\n <:valueAppend>\n {{yield to=\"valueAppend\"}}\n </:valueAppend>\n <:max as |max|>\n {{yield max to=\"max\"}}\n </:max>\n <:append as |classes|>\n {{yield classes to=\"append\"}}\n </:append>\n </EuiRange>\n </:field>\n <:helpText as |helpText|>\n {{yield helpText to=\"helpText\"}} \n </:helpText>\n </EuiFormRow>\n{{/let}}", {
|
|
17
15
|
strictMode: true,
|
|
18
16
|
scope: () => ({
|
|
19
17
|
argOrDefault,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field-range-slider.js","sources":["../../../src/components/validated-form/field-range-slider.gts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"field-range-slider.js","sources":["../../../src/components/validated-form/field-range-slider.gts"],"sourcesContent":["import didInsert from '@ember/render-modifiers/modifiers/did-insert';\nimport didUpdate from '@ember/render-modifiers/modifiers/did-update';\nimport EuiFormRow from '@ember-eui/core/components/eui-form-row';\nimport EuiRange from '@ember-eui/core/components/eui-range';\nimport { argOrDefault } from '@ember-eui/core/helpers';\n\nimport { not } from 'ember-truth-helpers';\n\nimport randomId from '../../-private/random-id.ts';\nimport ValidatedFormFieldBase from './field-base.gts';\n\nimport type { FieldBaseSignature } from './field-base.gts';\nimport type { EuiFormRowSignature } from '@ember-eui/core/components/eui-form-row';\nimport type { EuiRangeSignature } from '@ember-eui/core/components/eui-range';\n\n/**\n * A validated range slider in an EuiFormRow. Takes FieldBase's, EuiFormRow's and\n * the control's args.\n */\nexport interface FieldRangeSliderSignature {\n Element: EuiRangeSignature['Element'];\n Args: FieldBaseSignature['Args'] &\n EuiFormRowSignature['Args'] &\n EuiRangeSignature['Args'] & {\n /** Classes for the EuiFormRow. */\n rowClasses?: string;\n /** Classes for the control. */\n fieldClasses?: string;\n /** @private Set by ValidatedForm. */\n formId?: string;\n /** Accessible label of the control. */\n ariaLabel?: string;\n /** Focuses the control on render. */\n autofocus?: boolean;\n /** Called with the slider's value (a string). */\n onChange?: (value: string) => void;\n };\n Blocks: {\n label: [];\n helpText: [...EuiFormRowSignature['Blocks']['helpText']];\n prepend: [...EuiRangeSignature['Blocks']['prepend']];\n min: [...EuiRangeSignature['Blocks']['min']];\n valuePrepend: [...EuiRangeSignature['Blocks']['valuePrepend']];\n value: [...EuiRangeSignature['Blocks']['value']];\n valueAppend: [...EuiRangeSignature['Blocks']['valueAppend']];\n append: [...EuiRangeSignature['Blocks']['append']];\n max: [...EuiRangeSignature['Blocks']['max']];\n };\n}\n\nexport default class ValidatedFormFieldRangeSlider extends ValidatedFormFieldBase<FieldRangeSliderSignature> {\n <template>\n {{#let (argOrDefault @id (randomId)) as |theId|}}\n <EuiFormRow\n class={{this.rowClasses}}\n @labelType={{@labelType}}\n @display={{@display}}\n @hasEmptyLabelSpace={{@hasEmptyLabelSpace}}\n @fullWidth={{@fullWidth}}\n @hasChildLabel={{@hasChildLabel}}\n @label={{this.label}}\n @labelAppend={{@labelAppend}}\n @id={{theId}}\n @isInvalid={{this.isInvalidAndTouched}}\n @error={{this.validationErrorMessages}}\n @helpText={{@helpText}}\n @errorClasses={{@errorClasses}}\n @isFakeLabelBlock={{not (has-block \"label\")}}\n @isFakeHelpTextBlock={{not (has-block \"helpText\")}}\n {{didInsert this.setValidationMessages}}\n {{didUpdate this.didUpdateValue @validations}}\n {{didUpdate this.didUpdateValue @value}}\n >\n <:label>\n {{yield to=\"label\"}}\n </:label>\n\n <:field>\n <EuiRange\n class={{@fieldClasses}}\n form={{@formId}}\n @compressed={{@compressed}}\n @readOnly={{@readOnly}}\n @fullWidth={{@fullWidth}}\n @id={{theId}}\n @levels={{@levels}}\n @step={{@step}}\n @showInput={{@showInput}}\n @showLabels={{@showLabels}}\n @showRange={{@showRange}}\n @showTicks={{@showTicks}}\n @showValue={{@showValue}}\n @disabled={{@disabled}}\n @ticks={{@ticks}}\n @tickInterval={{@tickInterval}}\n @valuePrepend={{@valuePrepend}}\n @valueAppend={{@valueAppend}}\n @onChange={{this.handleChange}}\n @value={{@value}}\n @max={{@max}}\n @isLoading={{@isLoading}}\n @min={{@min}}\n @isInvalid={{this.isInvalidAndTouched}}\n @isPrependProvided={{has-block \"prepend\"}}\n @isAppendProvided={{has-block \"append\"}}\n @isFakeMinBlock={{not (has-block \"min\")}}\n @isFakeMaxBlock={{not (has-block \"max\")}}\n @isFakeValueBlock={{not (has-block \"value\")}}\n @isFakeValuePrependBlock={{not (has-block \"valuePrepend\")}}\n @isFakeValueAppendBlock={{not (has-block \"valueAppend\")}}\n aria-label={{@ariaLabel}}\n autofocus={{@autofocus}}\n ...attributes\n >\n <:prepend as |classes|>\n {{yield classes to=\"prepend\"}}\n </:prepend>\n <:min as |min|>\n {{yield min to=\"min\"}}\n </:min>\n <:valuePrepend>\n {{yield to=\"valuePrepend\"}}\n </:valuePrepend>\n <:value>\n {{yield to=\"value\"}}\n </:value>\n <:valueAppend>\n {{yield to=\"valueAppend\"}}\n </:valueAppend>\n <:max as |max|>\n {{yield max to=\"max\"}}\n </:max>\n <:append as |classes|>\n {{yield classes to=\"append\"}}\n </:append>\n </EuiRange>\n </:field>\n <:helpText as |helpText|>\n {{yield helpText to=\"helpText\"}} \n </:helpText>\n </EuiFormRow>\n {{/let}}\n </template>\n}\n"],"names":["ValidatedFormFieldRangeSlider","ValidatedFormFieldBase","setComponentTemplate","precompileTemplate","strictMode","scope","argOrDefault","randomId","EuiFormRow","not","didInsert","didUpdate","EuiRange"],"mappings":";;;;;;;;;;;AAkDe,MAAMA,sCAAsCC,sBAAA,CAAuB;AAChF,EAAA;IAAAC,oBAAA,CAAAC,kBAAA,CAAA,q9EAAA,EA2FA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,YAAA;QAAAC,QAAA;QAAAC,UAAA;QAAAC,GAAA;QAAAC,SAAA;QAAAC,SAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import '@ember/helper';
|
|
2
1
|
import { on } from '@ember/modifier';
|
|
3
2
|
import didInsert from '@ember/render-modifiers/modifiers/did-insert';
|
|
4
3
|
import didUpdate from '@ember/render-modifiers/modifiers/did-update';
|
|
@@ -13,7 +12,7 @@ import { setComponentTemplate } from '@ember/component';
|
|
|
13
12
|
|
|
14
13
|
class ValidatedFormFieldSelect extends ValidatedFormFieldBase {
|
|
15
14
|
static {
|
|
16
|
-
setComponentTemplate(precompileTemplate("
|
|
15
|
+
setComponentTemplate(precompileTemplate("{{#let (argOrDefault @id (randomId)) as |theId|}}\n <EuiFormRow class={{this.rowClasses}} @labelType={{@labelType}} @display={{@display}} @hasEmptyLabelSpace={{@hasEmptyLabelSpace}} @fullWidth={{@fullWidth}} @hasChildLabel={{@hasChildLabel}} @label={{this.label}} @labelAppend={{@labelAppend}} @id={{theId}} @isInvalid={{this.isInvalidAndTouched}} @error={{this.validationErrorMessages}} @helpText={{@helpText}} @errorClasses={{@errorClasses}} @isFakeLabelBlock={{not (has-block \"label\")}} @isFakeHelpTextBlock={{not (has-block \"helpText\")}} {{didInsert this.setValidationMessages}} {{didUpdate this.didUpdateValue @validations}} {{didUpdate this.didUpdateValue @value}}>\n <:label>\n {{yield to=\"label\"}}\n </:label>\n\n <:field>\n <EuiSelect aria-label={{@ariaLabel}} class={{@fieldClasses}} form={{@formId}} @options={{this.options}} @isInvalid={{this.isInvalidAndTouched}} @fullWidth={{@fullWidth}} @isLoading={{@isLoading}} @hasNoInitialSelection={{@hasNoInitialSelection}} @inputRef={{@inputRef}} @disabled={{@disabled}} @value={{@value}} @compressed={{@compressed}} @isFakePrependBlock={{not (has-block \"prepend\")}} @isFakeAppendBlock={{not (has-block \"append\")}} @id={{theId}} autofocus={{@autofocus}} ...attributes {{on \"change\" this.handleChange}}>\n <:prepend as |classes inputId|>\n {{yield classes inputId to=\"prepend\"}}\n </:prepend>\n <:append as |classes inputId|>\n {{yield classes inputId to=\"append\"}}\n </:append>\n </EuiSelect>\n </:field>\n <:helpText as |helpText|>\n {{yield helpText to=\"helpText\"}}\n </:helpText>\n </EuiFormRow>\n{{/let}}", {
|
|
17
16
|
strictMode: true,
|
|
18
17
|
scope: () => ({
|
|
19
18
|
argOrDefault,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field-select.js","sources":["../../../src/components/validated-form/field-select.gts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"field-select.js","sources":["../../../src/components/validated-form/field-select.gts"],"sourcesContent":["import { on } from '@ember/modifier';\nimport didInsert from '@ember/render-modifiers/modifiers/did-insert';\nimport didUpdate from '@ember/render-modifiers/modifiers/did-update';\nimport EuiFormRow from '@ember-eui/core/components/eui-form-row';\nimport EuiSelect from '@ember-eui/core/components/eui-select';\nimport { argOrDefault } from '@ember-eui/core/helpers';\n\nimport { not } from 'ember-truth-helpers';\n\nimport randomId from '../../-private/random-id.ts';\nimport ValidatedFormFieldBase from './field-base.gts';\n\nimport type { FieldBaseSignature } from './field-base.gts';\nimport type { EuiFormRowSignature } from '@ember-eui/core/components/eui-form-row';\nimport type { EuiSelectSignature } from '@ember-eui/core/components/eui-select';\n\n/**\n * A validated select in an EuiFormRow. Takes FieldBase's, EuiFormRow's and\n * the control's args.\n */\nexport interface FieldSelectSignature {\n Element: EuiSelectSignature['Element'];\n Args: FieldBaseSignature['Args'] &\n EuiFormRowSignature['Args'] &\n EuiSelectSignature['Args'] & {\n /** Classes for the EuiFormRow. */\n rowClasses?: string;\n /** Classes for the control. */\n fieldClasses?: string;\n /** @private Set by ValidatedForm. */\n formId?: string;\n /** Accessible label of the control. */\n ariaLabel?: string;\n /** Focuses the control on render. */\n autofocus?: boolean;\n /** Called with the selected option's value. */\n onChange?: (value: string) => void;\n };\n Blocks: {\n label: [];\n helpText: [...EuiFormRowSignature['Blocks']['helpText']];\n prepend: [...EuiSelectSignature['Blocks']['prepend']];\n append: [...EuiSelectSignature['Blocks']['append']];\n };\n}\n\nexport default class ValidatedFormFieldSelect extends ValidatedFormFieldBase<FieldSelectSignature> {\n <template>\n {{#let (argOrDefault @id (randomId)) as |theId|}}\n <EuiFormRow\n class={{this.rowClasses}}\n @labelType={{@labelType}}\n @display={{@display}}\n @hasEmptyLabelSpace={{@hasEmptyLabelSpace}}\n @fullWidth={{@fullWidth}}\n @hasChildLabel={{@hasChildLabel}}\n @label={{this.label}}\n @labelAppend={{@labelAppend}}\n @id={{theId}}\n @isInvalid={{this.isInvalidAndTouched}}\n @error={{this.validationErrorMessages}}\n @helpText={{@helpText}}\n @errorClasses={{@errorClasses}}\n @isFakeLabelBlock={{not (has-block \"label\")}}\n @isFakeHelpTextBlock={{not (has-block \"helpText\")}}\n {{didInsert this.setValidationMessages}}\n {{didUpdate this.didUpdateValue @validations}}\n {{didUpdate this.didUpdateValue @value}}\n >\n <:label>\n {{yield to=\"label\"}}\n </:label>\n\n <:field>\n <EuiSelect\n aria-label={{@ariaLabel}}\n class={{@fieldClasses}}\n form={{@formId}}\n @options={{this.options}}\n @isInvalid={{this.isInvalidAndTouched}}\n @fullWidth={{@fullWidth}}\n @isLoading={{@isLoading}}\n @hasNoInitialSelection={{@hasNoInitialSelection}}\n @inputRef={{@inputRef}}\n @disabled={{@disabled}}\n @value={{@value}}\n @compressed={{@compressed}}\n @isFakePrependBlock={{not (has-block \"prepend\")}}\n @isFakeAppendBlock={{not (has-block \"append\")}}\n @id={{theId}}\n autofocus={{@autofocus}}\n ...attributes\n {{on \"change\" this.handleChange}}\n >\n <:prepend as |classes inputId|>\n {{yield classes inputId to=\"prepend\"}}\n </:prepend>\n <:append as |classes inputId|>\n {{yield classes inputId to=\"append\"}}\n </:append>\n </EuiSelect>\n </:field>\n <:helpText as |helpText|>\n {{yield helpText to=\"helpText\"}}\n </:helpText>\n </EuiFormRow>\n {{/let}}\n </template>\n}\n"],"names":["ValidatedFormFieldSelect","ValidatedFormFieldBase","setComponentTemplate","precompileTemplate","strictMode","scope","argOrDefault","randomId","EuiFormRow","not","didInsert","didUpdate","EuiSelect","on"],"mappings":";;;;;;;;;;;;AA8Ce,MAAMA,iCAAiCC,sBAAA,CAAuB;AAC3E,EAAA;IAAAC,oBAAA,CAAAC,kBAAA,CAAA,soDAAA,EA4DA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,YAAA;QAAAC,QAAA;QAAAC,UAAA;QAAAC,GAAA;QAAAC,SAAA;QAAAC,SAAA;QAAAC,SAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;"}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import '@ember/helper';
|
|
2
|
-
import '@ember/modifier';
|
|
3
1
|
import { action } from '@ember/object';
|
|
4
2
|
import didInsert from '@ember/render-modifiers/modifiers/did-insert';
|
|
5
3
|
import didUpdate from '@ember/render-modifiers/modifiers/did-update';
|
|
@@ -11,7 +9,7 @@ import randomId from '../../-private/random-id.js';
|
|
|
11
9
|
import ValidatedFormFieldBase from './field-base.js';
|
|
12
10
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
13
11
|
import { setComponentTemplate } from '@ember/component';
|
|
14
|
-
import { n } from 'decorator-transforms/runtime';
|
|
12
|
+
import { n } from 'decorator-transforms/runtime-esm';
|
|
15
13
|
|
|
16
14
|
class ValidatedFormFieldSwitch extends ValidatedFormFieldBase {
|
|
17
15
|
handleChange(e) {
|
|
@@ -24,7 +22,7 @@ class ValidatedFormFieldSwitch extends ValidatedFormFieldBase {
|
|
|
24
22
|
n(this.prototype, "handleChange", [action]);
|
|
25
23
|
}
|
|
26
24
|
static {
|
|
27
|
-
setComponentTemplate(precompileTemplate("
|
|
25
|
+
setComponentTemplate(precompileTemplate("{{#let (argOrDefault @id (randomId)) as |theId|}}\n <EuiFormRow class={{this.rowClasses}} @labelType={{@labelType}} @display={{@display}} @hasEmptyLabelSpace={{@hasEmptyLabelSpace}} @fullWidth={{@fullWidth}} @hasChildLabel={{@hasChildLabel}} @label={{this.label}} @labelAppend={{@labelAppend}} @id={{theId}} @isInvalid={{this.isInvalidAndTouched}} @error={{this.validationErrorMessages}} @helpText={{@helpText}} @errorClasses={{@errorClasses}} @isFakeLabelBlock={{not (has-block \"label\")}} @isFakeHelpTextBlock={{not (has-block \"helpText\")}} {{didInsert this.setValidationMessages}} {{didUpdate this.didUpdateValue @validations}} {{didUpdate this.didUpdateValue @value}}>\n <:label>\n {{yield to=\"label\"}}\n </:label>\n <:field>\n <EuiSwitch class={{@fieldClasses}} form={{@formId}} aria-label={{@ariaLabel}} @id={{theId}} @showLabel={{@showLabel}} @label={{@switchLabel}} @checked={{@value}} @onChange={{this.handleChange}} @isFakeLabelBlock={{not (has-block \"switch-label\")}} @disabled={{@disabled}} @compressed={{@compressed}} @type={{@type}} ...attributes>\n <:label>\n {{yield to=\"switch-label\"}}\n </:label>\n </EuiSwitch>\n </:field>\n <:helpText as |helpText|>\n {{yield helpText to=\"helpText\"}}\n </:helpText>\n </EuiFormRow>\n{{/let}}", {
|
|
28
26
|
strictMode: true,
|
|
29
27
|
scope: () => ({
|
|
30
28
|
argOrDefault,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field-switch.js","sources":["../../../src/components/validated-form/field-switch.gts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"field-switch.js","sources":["../../../src/components/validated-form/field-switch.gts"],"sourcesContent":["import { action } from '@ember/object';\nimport didInsert from '@ember/render-modifiers/modifiers/did-insert';\nimport didUpdate from '@ember/render-modifiers/modifiers/did-update';\nimport EuiFormRow from '@ember-eui/core/components/eui-form-row';\nimport EuiSwitch from '@ember-eui/core/components/eui-switch';\nimport { argOrDefault } from '@ember-eui/core/helpers';\n\nimport { not } from 'ember-truth-helpers';\n\nimport randomId from '../../-private/random-id.ts';\nimport ValidatedFormFieldBase from './field-base.gts';\n\nimport type { FieldBaseSignature } from './field-base.gts';\nimport type { EuiFormRowSignature } from '@ember-eui/core/components/eui-form-row';\nimport type { EuiSwitchSignature } from '@ember-eui/core/components/eui-switch';\n\n/**\n * A validated switch in an EuiFormRow. Takes FieldBase's, EuiFormRow's and\n * the control's args.\n */\nexport interface FieldSwitchSignature {\n Element: EuiSwitchSignature['Element'];\n Args: FieldBaseSignature['Args'] &\n EuiFormRowSignature['Args'] &\n EuiSwitchSignature['Args'] & {\n /** Classes for the EuiFormRow. */\n rowClasses?: string;\n /** Classes for the control. */\n fieldClasses?: string;\n /** @private Set by ValidatedForm. */\n formId?: string;\n /** Accessible label of the control. */\n ariaLabel?: string;\n /** Focuses the control on render. */\n autofocus?: boolean;\n /** The switch's own label (next to it); `@label` is the row's label. */\n switchLabel?: EuiSwitchSignature['Args']['label'];\n /** Called with the new checked state and the click event. */\n onChange?: (checked: boolean, e: MouseEvent) => void;\n };\n Blocks: {\n label: [];\n helpText: EuiFormRowSignature['Blocks']['helpText'];\n 'switch-label': [];\n };\n}\n\nexport default class ValidatedFormFieldSwitch extends ValidatedFormFieldBase<FieldSwitchSignature> {\n @action\n handleChange(e: MouseEvent) {\n e.preventDefault();\n\n const checked = (e.target as HTMLInputElement).checked;\n\n this.args.onChange?.(checked, e);\n this.notifyValidityChange();\n }\n\n <template>\n {{#let (argOrDefault @id (randomId)) as |theId|}}\n <EuiFormRow\n class={{this.rowClasses}}\n @labelType={{@labelType}}\n @display={{@display}}\n @hasEmptyLabelSpace={{@hasEmptyLabelSpace}}\n @fullWidth={{@fullWidth}}\n @hasChildLabel={{@hasChildLabel}}\n @label={{this.label}}\n @labelAppend={{@labelAppend}}\n @id={{theId}}\n @isInvalid={{this.isInvalidAndTouched}}\n @error={{this.validationErrorMessages}}\n @helpText={{@helpText}}\n @errorClasses={{@errorClasses}}\n @isFakeLabelBlock={{not (has-block \"label\")}}\n @isFakeHelpTextBlock={{not (has-block \"helpText\")}}\n {{didInsert this.setValidationMessages}}\n {{didUpdate this.didUpdateValue @validations}}\n {{didUpdate this.didUpdateValue @value}}\n >\n <:label>\n {{yield to=\"label\"}}\n </:label>\n <:field>\n <EuiSwitch\n class={{@fieldClasses}}\n form={{@formId}}\n aria-label={{@ariaLabel}}\n @id={{theId}}\n @showLabel={{@showLabel}}\n @label={{@switchLabel}}\n @checked={{@value}}\n @onChange={{this.handleChange}}\n @isFakeLabelBlock={{not (has-block \"switch-label\")}}\n @disabled={{@disabled}}\n @compressed={{@compressed}}\n @type={{@type}}\n ...attributes\n >\n <:label>\n {{yield to=\"switch-label\"}}\n </:label>\n </EuiSwitch>\n </:field>\n <:helpText as |helpText|>\n {{yield helpText to=\"helpText\"}}\n </:helpText>\n </EuiFormRow>\n {{/let}}\n </template>\n}\n"],"names":["ValidatedFormFieldSwitch","ValidatedFormFieldBase","handleChange","e","preventDefault","checked","target","args","onChange","notifyValidityChange","n","prototype","action","setComponentTemplate","precompileTemplate","strictMode","scope","argOrDefault","randomId","EuiFormRow","not","didInsert","didUpdate","EuiSwitch"],"mappings":";;;;;;;;;;;;;AA+Ce,MAAMA,iCAAiCC,sBAAA,CAAuB;EAE3EC,YAAAA,CAAaC,CAAa,EAAE;IAC1BA,CAAA,CAAEC,cAAc,EAAA;AAEhB,IAAA,MAAMC,UAAWF,CAAA,CAAEG,MAAM,CAAsBD,OAAO;IAEtD,IAAI,CAACE,IAAI,CAACC,QAAQ,GAAGH,OAAA,EAASF,CAAA,CAAA;IAC9B,IAAI,CAACM,oBAAoB,EAAA;AAC3B,EAAA;AAAA,EAAA;IAAAC,CAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,cAAA,EAAA,CARCC,MAAA,CAAA,CAAA;AAAA;AAUD,EAAA;IAAAC,oBAAA,CAAAC,kBAAA,CAAA,yyCAAA,EAmDA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,YAAA;QAAAC,QAAA;QAAAC,UAAA;QAAAC,GAAA;QAAAC,SAAA;QAAAC,SAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;"}
|
|
@@ -12,7 +12,7 @@ import { setComponentTemplate } from '@ember/component';
|
|
|
12
12
|
|
|
13
13
|
class ValidatedFormFieldTextArea extends ValidatedFormFieldBase {
|
|
14
14
|
static {
|
|
15
|
-
setComponentTemplate(precompileTemplate("
|
|
15
|
+
setComponentTemplate(precompileTemplate("{{#let (argOrDefault @id (randomId)) as |theId|}}\n <EuiFormRow class={{this.rowClasses}} @labelType={{@labelType}} @display={{@display}} @hasEmptyLabelSpace={{@hasEmptyLabelSpace}} @fullWidth={{@fullWidth}} @hasChildLabel={{@hasChildLabel}} @label={{this.label}} @labelAppend={{@labelAppend}} @id={{theId}} @isInvalid={{this.isInvalidAndTouched}} @error={{this.validationErrorMessages}} @helpText={{@helpText}} @errorClasses={{@errorClasses}} @isFakeLabelBlock={{not (has-block \"label\")}} @isFakeHelpTextBlock={{not (has-block \"helpText\")}} {{didInsert this.setValidationMessages}} {{didUpdate this.didUpdateValue @validations}} {{didUpdate this.didUpdateValue @value}}>\n <:label>\n {{yield to=\"label\"}}\n </:label>\n <:field>\n <EuiTextArea class={{@fieldClasses}} form={{@formId}} aria-label={{@ariaLabel}} @value={{@value}} @isInvalid={{this.isInvalidAndTouched}} @fullWidth={{@fullWidth}} @compressed={{@compressed}} @resize={{@resize}} @disabled={{@disabled}} @inputRef={{@inputRef}} @id={{theId}} @rows={{@rows}} autofocus={{@autofocus}} placeholder={{@placeholder}} readOnly={{@readOnly}} ...attributes {{on \"input\" this.handleChange}}>\n {{yield}}\n </EuiTextArea>\n </:field>\n <:helpText as |helpText|>\n {{yield helpText to=\"helpText\"}}\n </:helpText>\n </EuiFormRow>\n{{/let}}", {
|
|
16
16
|
strictMode: true,
|
|
17
17
|
scope: () => ({
|
|
18
18
|
argOrDefault,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field-text-area.js","sources":["../../../src/components/validated-form/field-text-area.gts"],"sourcesContent":["import { on } from '@ember/modifier';\nimport didInsert from '@ember/render-modifiers/modifiers/did-insert';\nimport didUpdate from '@ember/render-modifiers/modifiers/did-update';\nimport EuiFormRow from '@ember-eui/core/components/eui-form-row';\nimport EuiTextArea from '@ember-eui/core/components/eui-text-area';\nimport { argOrDefault } from '@ember-eui/core/helpers';\n\nimport { not } from 'ember-truth-helpers';\n\nimport randomId from '../../-private/random-id.ts';\nimport ValidatedFormFieldBase from './field-base.gts';\n\nimport type { FieldBaseSignature } from './field-base.gts';\nimport type { EuiFormRowSignature } from '@ember-eui/core/components/eui-form-row';\nimport type { EuiTextAreaSignature } from '@ember-eui/core/components/eui-text-area';\nimport type { ComponentLike } from '@glint/template';\n\nexport interface FieldTextAreaSignature extends FieldBaseSignature {\n Element: EuiTextAreaSignature['Element'];\n Args: FieldBaseSignature['Args'] &\n EuiFormRowSignature['Args'] &\n EuiTextAreaSignature['Args'] & {\n formId?: string;\n ariaLabel?: string;\n rows?: number;\n resize?: 'vertical' | 'horizontal' | 'both' | 'none';\n rowClasses?: string;\n fieldClasses?: string;\n labelAppend?: ComponentLike;\n prepend?: ComponentLike;\n append?: ComponentLike;\n placeholder?: string;\n autofocus?: boolean;\n readOnly?: boolean;\n inputRef?: (element: HTMLTextAreaElement) => void;\n };\n Blocks: {\n label: [];\n helpText: [...EuiFormRowSignature['Blocks']['helpText']];\n default: [...EuiTextAreaSignature['Blocks']['default']];\n };\n}\n\nexport default class ValidatedFormFieldTextArea extends ValidatedFormFieldBase<FieldTextAreaSignature> {\n <template>\n {{#let (argOrDefault @id (randomId)) as |theId|}}\n <EuiFormRow\n class={{this.rowClasses}}\n @labelType={{@labelType}}\n @display={{@display}}\n @hasEmptyLabelSpace={{@hasEmptyLabelSpace}}\n @fullWidth={{@fullWidth}}\n @hasChildLabel={{@hasChildLabel}}\n @label={{this.label}}\n @labelAppend={{@labelAppend}}\n @id={{theId}}\n @isInvalid={{this.isInvalidAndTouched}}\n @error={{this.validationErrorMessages}}\n @helpText={{@helpText}}\n @errorClasses={{@errorClasses}}\n @isFakeLabelBlock={{not (has-block \"label\")}}\n @isFakeHelpTextBlock={{not (has-block \"helpText\")}}\n {{didInsert this.setValidationMessages}}\n {{didUpdate this.didUpdateValue @validations}}\n {{didUpdate this.didUpdateValue @value}}\n >\n <:label>\n {{yield to=\"label\"}}\n </:label>\n <:field>\n <EuiTextArea\n class={{@fieldClasses}}\n form={{@formId}}\n aria-label={{@ariaLabel}}\n @value={{@value}}\n @isInvalid={{this.isInvalidAndTouched}}\n @fullWidth={{@fullWidth}}\n @compressed={{@compressed}}\n @resize={{@resize}}\n @disabled={{@disabled}}\n @inputRef={{@inputRef}}\n @id={{theId}}\n @rows={{@rows}}\n autofocus={{@autofocus}}\n placeholder={{@placeholder}}\n readOnly={{@readOnly}}\n ...attributes\n {{on \"input\" this.handleChange}}\n >\n {{yield}}\n </EuiTextArea>\n </:field>\n <:helpText as |helpText|>\n {{yield helpText to=\"helpText\"}}\n </:helpText>\n </EuiFormRow>\n {{/let}}\n </template>\n}\n"],"names":["ValidatedFormFieldTextArea","ValidatedFormFieldBase","setComponentTemplate","precompileTemplate","strictMode","scope","argOrDefault","randomId","EuiFormRow","not","didInsert","didUpdate","EuiTextArea","on"],"mappings":";;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"field-text-area.js","sources":["../../../src/components/validated-form/field-text-area.gts"],"sourcesContent":["import { on } from '@ember/modifier';\nimport didInsert from '@ember/render-modifiers/modifiers/did-insert';\nimport didUpdate from '@ember/render-modifiers/modifiers/did-update';\nimport EuiFormRow from '@ember-eui/core/components/eui-form-row';\nimport EuiTextArea from '@ember-eui/core/components/eui-text-area';\nimport { argOrDefault } from '@ember-eui/core/helpers';\n\nimport { not } from 'ember-truth-helpers';\n\nimport randomId from '../../-private/random-id.ts';\nimport ValidatedFormFieldBase from './field-base.gts';\n\nimport type { FieldBaseSignature } from './field-base.gts';\nimport type { EuiFormRowSignature } from '@ember-eui/core/components/eui-form-row';\nimport type { EuiTextAreaSignature } from '@ember-eui/core/components/eui-text-area';\nimport type { ComponentLike } from '@glint/template';\n\n/**\n * A validated textarea in an EuiFormRow. Takes FieldBase's, EuiFormRow's and the\n * control's args; `@onChange` receives the value.\n */\nexport interface FieldTextAreaSignature extends FieldBaseSignature {\n Element: EuiTextAreaSignature['Element'];\n Args: FieldBaseSignature['Args'] &\n EuiFormRowSignature['Args'] &\n EuiTextAreaSignature['Args'] & {\n /** @private Set by ValidatedForm. */\n formId?: string;\n /** Accessible label of the control. */\n ariaLabel?: string;\n /** Visible number of lines. */\n rows?: number;\n /** Which way it can be resized: `'vertical'`, `'horizontal'`, `'both'` or `'none'`. */\n resize?: 'vertical' | 'horizontal' | 'both' | 'none';\n /** Classes for the EuiFormRow. */\n rowClasses?: string;\n /** Classes for the control. */\n fieldClasses?: string;\n /** @deprecated Not rendered, see EuiFormRow. */\n labelAppend?: ComponentLike;\n /** @deprecated Has no effect. */\n prepend?: ComponentLike;\n /** @deprecated Has no effect. */\n append?: ComponentLike;\n /** Placeholder text. */\n placeholder?: string;\n /** Focuses the control on render. */\n autofocus?: boolean;\n /** Read-only control. */\n readOnly?: boolean;\n /** Called with the `<textarea>` element. */\n inputRef?: (element: HTMLTextAreaElement) => void;\n };\n Blocks: {\n label: [];\n helpText: [...EuiFormRowSignature['Blocks']['helpText']];\n default: [...EuiTextAreaSignature['Blocks']['default']];\n };\n}\n\nexport default class ValidatedFormFieldTextArea extends ValidatedFormFieldBase<FieldTextAreaSignature> {\n <template>\n {{#let (argOrDefault @id (randomId)) as |theId|}}\n <EuiFormRow\n class={{this.rowClasses}}\n @labelType={{@labelType}}\n @display={{@display}}\n @hasEmptyLabelSpace={{@hasEmptyLabelSpace}}\n @fullWidth={{@fullWidth}}\n @hasChildLabel={{@hasChildLabel}}\n @label={{this.label}}\n @labelAppend={{@labelAppend}}\n @id={{theId}}\n @isInvalid={{this.isInvalidAndTouched}}\n @error={{this.validationErrorMessages}}\n @helpText={{@helpText}}\n @errorClasses={{@errorClasses}}\n @isFakeLabelBlock={{not (has-block \"label\")}}\n @isFakeHelpTextBlock={{not (has-block \"helpText\")}}\n {{didInsert this.setValidationMessages}}\n {{didUpdate this.didUpdateValue @validations}}\n {{didUpdate this.didUpdateValue @value}}\n >\n <:label>\n {{yield to=\"label\"}}\n </:label>\n <:field>\n <EuiTextArea\n class={{@fieldClasses}}\n form={{@formId}}\n aria-label={{@ariaLabel}}\n @value={{@value}}\n @isInvalid={{this.isInvalidAndTouched}}\n @fullWidth={{@fullWidth}}\n @compressed={{@compressed}}\n @resize={{@resize}}\n @disabled={{@disabled}}\n @inputRef={{@inputRef}}\n @id={{theId}}\n @rows={{@rows}}\n autofocus={{@autofocus}}\n placeholder={{@placeholder}}\n readOnly={{@readOnly}}\n ...attributes\n {{on \"input\" this.handleChange}}\n >\n {{yield}}\n </EuiTextArea>\n </:field>\n <:helpText as |helpText|>\n {{yield helpText to=\"helpText\"}}\n </:helpText>\n </EuiFormRow>\n {{/let}}\n </template>\n}\n"],"names":["ValidatedFormFieldTextArea","ValidatedFormFieldBase","setComponentTemplate","precompileTemplate","strictMode","scope","argOrDefault","randomId","EuiFormRow","not","didInsert","didUpdate","EuiTextArea","on"],"mappings":";;;;;;;;;;;;AA4De,MAAMA,mCAAmCC,sBAAA,CAAuB;AAC7E,EAAA;IAAAC,oBAAA,CAAAC,kBAAA,CAAA,q0CAAA,EAqDA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,YAAA;QAAAC,QAAA;QAAAC,UAAA;QAAAC,GAAA;QAAAC,SAAA;QAAAC,SAAA;QAAAC,WAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import '@ember/helper';
|
|
2
1
|
import { on } from '@ember/modifier';
|
|
3
2
|
import didInsert from '@ember/render-modifiers/modifiers/did-insert';
|
|
4
3
|
import didUpdate from '@ember/render-modifiers/modifiers/did-update';
|
|
@@ -13,7 +12,7 @@ import { setComponentTemplate } from '@ember/component';
|
|
|
13
12
|
|
|
14
13
|
class ValidatedFormFieldText extends ValidatedFormFieldBase {
|
|
15
14
|
static {
|
|
16
|
-
setComponentTemplate(precompileTemplate("
|
|
15
|
+
setComponentTemplate(precompileTemplate("{{#let (argOrDefault @id (randomId)) as |theId|}}\n <EuiFormRow class={{this.rowClasses}} @labelType={{@labelType}} @display={{@display}} @hasEmptyLabelSpace={{@hasEmptyLabelSpace}} @fullWidth={{@fullWidth}} @hasChildLabel={{@hasChildLabel}} @label={{this.label}} @labelAppend={{@labelAppend}} @id={{theId}} @isInvalid={{this.isInvalidAndTouched}} @error={{this.validationErrorMessages}} @helpText={{@helpText}} @errorClasses={{@errorClasses}} @isFakeLabelBlock={{not (has-block \"label\")}} @isFakeHelpTextBlock={{not (has-block \"helpText\")}} {{didInsert this.setValidationMessages}} {{didUpdate this.didUpdateValue @validations}} {{didUpdate this.didUpdateValue @value}}>\n <:label>\n {{yield to=\"label\"}}\n </:label>\n <:field>\n <EuiFieldText class={{@fieldClasses}} aria-label={{@ariaLabel}} form={{@formId}} @value={{@value}} @icon={{@icon}} @isInvalid={{this.isInvalidAndTouched}} @fullWidth={{@fullWidth}} @isLoading={{@isLoading}} @disabled={{@disabled}} @readOnly={{@readOnly}} @inputRef={{@inputRef}} @controlOnly={{@controlOnly}} @compressed={{@compressed}} @clear={{@clear}} @id={{theId}} @isFakePrependBlock={{not (has-block \"prepend\")}} @isFakeAppendBlock={{not (has-block \"append\")}} autofocus={{@autofocus}} placeholder={{@placeholder}} {{on \"input\" this.handleChange}} ...attributes>\n <:prepend as |classes inputId|>\n {{yield classes inputId to=\"prepend\"}}\n </:prepend>\n <:append as |classes inputId|>\n {{yield classes inputId to=\"append\"}}\n </:append>\n </EuiFieldText>\n </:field>\n <:helpText as |helpText|>\n {{yield helpText to=\"helpText\"}}\n </:helpText>\n </EuiFormRow>\n{{/let}}", {
|
|
17
16
|
strictMode: true,
|
|
18
17
|
scope: () => ({
|
|
19
18
|
argOrDefault,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field-text.js","sources":["../../../src/components/validated-form/field-text.gts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"field-text.js","sources":["../../../src/components/validated-form/field-text.gts"],"sourcesContent":["import { on } from '@ember/modifier';\nimport didInsert from '@ember/render-modifiers/modifiers/did-insert';\nimport didUpdate from '@ember/render-modifiers/modifiers/did-update';\nimport EuiFieldText from '@ember-eui/core/components/eui-field-text';\nimport EuiFormRow from '@ember-eui/core/components/eui-form-row';\nimport { argOrDefault } from '@ember-eui/core/helpers';\n\nimport { not } from 'ember-truth-helpers';\n\nimport randomId from '../../-private/random-id.ts';\nimport ValidatedFormFieldBase from './field-base.gts';\n\nimport type { FieldBaseSignature } from './field-base.gts';\nimport type { EuiFieldTextSignature } from '@ember-eui/core/components/eui-field-text';\nimport type { EuiFormRowSignature } from '@ember-eui/core/components/eui-form-row';\n\n/**\n * A validated text input in an EuiFormRow. Takes FieldBase's, EuiFormRow's and the\n * control's args; `@onChange` receives the value.\n */\nexport interface FieldTextSignature {\n Element: EuiFieldTextSignature['Element'];\n Args: FieldBaseSignature['Args'] &\n EuiFormRowSignature['Args'] &\n EuiFieldTextSignature['Args'] & {\n /** Classes for the EuiFormRow. */\n rowClasses?: string;\n /** Classes for the control. */\n fieldClasses?: string;\n /** @private Set by ValidatedForm. */\n formId?: string;\n /** Accessible label of the control. */\n ariaLabel?: string;\n /** Focuses the control on render. */\n autofocus?: boolean;\n };\n Blocks: {\n label: [];\n helpText: [...EuiFormRowSignature['Blocks']['helpText']];\n prepend: [...EuiFieldTextSignature['Blocks']['prepend']];\n append: [...EuiFieldTextSignature['Blocks']['append']];\n };\n}\n\nexport default class ValidatedFormFieldText extends ValidatedFormFieldBase<FieldTextSignature> {\n <template>\n {{#let (argOrDefault @id (randomId)) as |theId|}}\n <EuiFormRow\n class={{this.rowClasses}}\n @labelType={{@labelType}}\n @display={{@display}}\n @hasEmptyLabelSpace={{@hasEmptyLabelSpace}}\n @fullWidth={{@fullWidth}}\n @hasChildLabel={{@hasChildLabel}}\n @label={{this.label}}\n @labelAppend={{@labelAppend}}\n @id={{theId}}\n @isInvalid={{this.isInvalidAndTouched}}\n @error={{this.validationErrorMessages}}\n @helpText={{@helpText}}\n @errorClasses={{@errorClasses}}\n @isFakeLabelBlock={{not (has-block \"label\")}}\n @isFakeHelpTextBlock={{not (has-block \"helpText\")}}\n {{didInsert this.setValidationMessages}}\n {{didUpdate this.didUpdateValue @validations}}\n {{didUpdate this.didUpdateValue @value}}\n >\n <:label>\n {{yield to=\"label\"}}\n </:label>\n <:field>\n <EuiFieldText\n class={{@fieldClasses}}\n aria-label={{@ariaLabel}}\n form={{@formId}}\n @value={{@value}}\n @icon={{@icon}}\n @isInvalid={{this.isInvalidAndTouched}}\n @fullWidth={{@fullWidth}}\n @isLoading={{@isLoading}}\n @disabled={{@disabled}}\n @readOnly={{@readOnly}}\n @inputRef={{@inputRef}}\n @controlOnly={{@controlOnly}}\n @compressed={{@compressed}}\n @clear={{@clear}}\n @id={{theId}}\n @isFakePrependBlock={{not (has-block \"prepend\")}}\n @isFakeAppendBlock={{not (has-block \"append\")}}\n autofocus={{@autofocus}}\n placeholder={{@placeholder}}\n {{on \"input\" this.handleChange}}\n ...attributes\n >\n <:prepend as |classes inputId|>\n {{yield classes inputId to=\"prepend\"}}\n </:prepend>\n <:append as |classes inputId|>\n {{yield classes inputId to=\"append\"}}\n </:append>\n </EuiFieldText>\n </:field>\n <:helpText as |helpText|>\n {{yield helpText to=\"helpText\"}}\n </:helpText>\n </EuiFormRow>\n {{/let}}\n </template>\n}\n"],"names":["ValidatedFormFieldText","ValidatedFormFieldBase","setComponentTemplate","precompileTemplate","strictMode","scope","argOrDefault","randomId","EuiFormRow","not","didInsert","didUpdate","EuiFieldText","on"],"mappings":";;;;;;;;;;;;AA4Ce,MAAMA,+BAA+BC,sBAAA,CAAuB;AACzE,EAAA;IAAAC,oBAAA,CAAAC,kBAAA,CAAA,krDAAA,EA8DA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,YAAA;QAAAC,QAAA;QAAAC,UAAA;QAAAC,GAAA;QAAAC,SAAA;QAAAC,SAAA;QAAAC,YAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;"}
|
|
@@ -12,7 +12,7 @@ import randomId from '../-private/random-id.js';
|
|
|
12
12
|
import { ValidatedFormDefaultTheme } from './default-theme.js';
|
|
13
13
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
14
14
|
import { setComponentTemplate } from '@ember/component';
|
|
15
|
-
import { g, i, n } from 'decorator-transforms/runtime';
|
|
15
|
+
import { g, i, n } from 'decorator-transforms/runtime-esm';
|
|
16
16
|
|
|
17
17
|
class ValidatedFormComponent extends Component {
|
|
18
18
|
static {
|
|
@@ -65,7 +65,7 @@ class ValidatedFormComponent extends Component {
|
|
|
65
65
|
this.childComponents.setEach('isTouched', false);
|
|
66
66
|
try {
|
|
67
67
|
await this.args.onSubmit?.();
|
|
68
|
-
} catch
|
|
68
|
+
} catch {
|
|
69
69
|
this.childComponents.setEach('isTouched', true);
|
|
70
70
|
}
|
|
71
71
|
}
|
|
@@ -155,7 +155,7 @@ class ValidatedFormComponent extends Component {
|
|
|
155
155
|
};
|
|
156
156
|
}
|
|
157
157
|
static {
|
|
158
|
-
setComponentTemplate(precompileTemplate("
|
|
158
|
+
setComponentTemplate(precompileTemplate("{{#let (argOrDefault @id (randomId)) as |formId|}}\n <EuiForm @tagName={{argOrDefault @tagName \"form\"}} id={{formId}} @isInvalid={{@isInvalid}} @invalidCallout={{@invalidCallout}} @error={{@error}} @errorTitle={{@errorTitle}} {{on \"submit\" this.handleSubmit}} {{on \"reset\" this.handleReset}} {{didInsert this.setNewValidity}} {{on \"focusout\" this.onFocusOut}} ...attributes>\n {{yield (hash onValidityChange=this.onChildValidityChange register=this.register unregister=this.unregister isValid=this.isValid isInvalid=this.isInvalid isTouched=this.isTouched isInvalidAndTouched=this.isInvalidAndTouched formId=formId FieldBase=(component this.theme.FieldBase register=this.register unregister=this.unregister onValidityChange=this.onChildValidityChange formId=formId disabled=@isDisabled) FieldNumber=(component this.theme.FieldNumber register=this.register unregister=this.unregister onValidityChange=this.onChildValidityChange fullWidth=@fullWidth compressed=@compressed formId=formId disabled=@isDisabled) FieldText=(component this.theme.FieldText register=this.register unregister=this.unregister onValidityChange=this.onChildValidityChange fullWidth=@fullWidth compressed=@compressed formId=formId disabled=@isDisabled) FieldPassword=(component this.theme.FieldPassword register=this.register unregister=this.unregister onValidityChange=this.onChildValidityChange fullWidth=@fullWidth compressed=@compressed formId=formId disabled=@isDisabled) FieldTextArea=(component this.theme.FieldTextArea register=this.register unregister=this.unregister onValidityChange=this.onChildValidityChange fullWidth=@fullWidth compressed=@compressed formId=formId disabled=@isDisabled) FieldSelect=(component this.theme.FieldSelect register=this.register unregister=this.unregister onValidityChange=this.onChildValidityChange fullWidth=@fullWidth compressed=@compressed formId=formId disabled=@isDisabled) FieldComboBox=(component this.theme.FieldComboBox register=this.register unregister=this.unregister onValidityChange=this.onChildValidityChange fullWidth=@fullWidth compressed=@compressed formId=formId isDisabled=@isDisabled) FieldCheckboxGroup=(component this.theme.FieldCheckboxGroup register=this.register unregister=this.unregister onValidityChange=this.onChildValidityChange fullWidth=@fullWidth compressed=@compressed formId=formId disabled=@isDisabled) FieldRadioGroup=(component this.theme.FieldRadioGroup register=this.register unregister=this.unregister onValidityChange=this.onChildValidityChange fullWidth=@fullWidth compressed=@compressed formId=formId disabled=@isDisabled) FieldRangeSlider=(component this.theme.FieldRangeSlider register=this.register unregister=this.unregister onValidityChange=this.onChildValidityChange fullWidth=@fullWidth compressed=@compressed formId=formId disabled=@isDisabled) FieldDualRangeSlider=(component this.theme.FieldDualRangeSlider register=this.register unregister=this.unregister onValidityChange=this.onChildValidityChange fullWidth=@fullWidth compressed=@compressed formId=formId disabled=@isDisabled) FieldSwitch=(component this.theme.FieldSwitch register=this.register unregister=this.unregister onValidityChange=this.onChildValidityChange fullWidth=@fullWidth compressed=@compressed formId=formId disabled=@isDisabled) FieldMarkdownEditor=(component this.theme.FieldMarkdownEditor register=this.register unregister=this.unregister onValidityChange=this.onChildValidityChange fullWidth=@fullWidth compressed=@compressed formId=formId disabled=@isDisabled))}}\n </EuiForm>\n{{/let}}", {
|
|
159
159
|
strictMode: true,
|
|
160
160
|
scope: () => ({
|
|
161
161
|
argOrDefault,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validated-form.js","sources":["../../src/components/validated-form.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { tracked } from '@glimmer/tracking';\nimport { A } from '@ember/array';\nimport { hash } from '@ember/helper';\nimport { on } from '@ember/modifier';\nimport { action } from '@ember/object';\nimport didInsert from '@ember/render-modifiers/modifiers/did-insert';\nimport { next, schedule } from '@ember/runloop';\nimport EuiForm from '@ember-eui/core/components/eui-form';\nimport { argOrDefault } from '@ember-eui/core/helpers';\nimport type Owner from '@ember/owner';\n\nimport randomId from '../-private/random-id.ts';\nimport { ValidatedFormDefaultTheme } from './default-theme.ts';\n\nimport type { IValidatedFormTheme } from './default-theme';\nimport type FieldBase from './validated-form/field-base.gts';\nimport type { EuiFormSignature } from '@ember-eui/core/components/eui-form';\n\nexport interface ValidatedFormSignature {\n Element: EuiFormSignature['Element'];\n Args: {\n id?: string;\n register?: (child: ValidatedFormComponent) => void;\n unregister?: (child: ValidatedFormComponent) => void;\n addChild?: (child: FieldBase) => void;\n removeChild?: (child: FieldBase) => void;\n onInvalid?: () => void;\n onSubmit?: () => void;\n onReset?: (e: Event) => void;\n onValidityChange?: (\n isValid: boolean,\n isTouched: boolean,\n isInvalidAndTouched: boolean\n ) => void;\n theme?: Partial<IValidatedFormTheme>;\n isDisabled?: boolean;\n fullWidth?: boolean;\n compressed?: boolean;\n tagName?: EuiFormSignature['Args']['tagName'];\n isInvalid?: EuiFormSignature['Args']['isInvalid'];\n invalidCallout?: EuiFormSignature['Args']['invalidCallout'];\n error?: EuiFormSignature['Args']['error'];\n errorTitle?: EuiFormSignature['Args']['errorTitle'];\n };\n Blocks: {\n default: [\n {\n onValidityChange: (\n isValid: boolean,\n isTouched: boolean,\n isInvalidAndTouched: boolean\n ) => void;\n register: (child: FieldBase) => void;\n unregister: (child: FieldBase) => void;\n isValid: boolean;\n isInvalid: boolean;\n isTouched: boolean;\n isInvalidAndTouched: boolean;\n formId: string;\n FieldBase: IValidatedFormTheme['FieldBase'];\n FieldNumber: IValidatedFormTheme['FieldNumber'];\n FieldText: IValidatedFormTheme['FieldText'];\n FieldPassword: IValidatedFormTheme['FieldPassword'];\n FieldTextArea: IValidatedFormTheme['FieldTextArea'];\n FieldSelect: IValidatedFormTheme['FieldSelect'];\n FieldComboBox: IValidatedFormTheme['FieldComboBox'];\n FieldCheckboxGroup: IValidatedFormTheme['FieldCheckboxGroup'];\n FieldRadioGroup: IValidatedFormTheme['FieldRadioGroup'];\n FieldRangeSlider: IValidatedFormTheme['FieldRangeSlider'];\n FieldDualRangeSlider: IValidatedFormTheme['FieldDualRangeSlider'];\n FieldSwitch: IValidatedFormTheme['FieldSwitch'];\n FieldMarkdownEditor: IValidatedFormTheme['FieldMarkdownEditor'];\n }\n ];\n };\n}\n\nexport default class ValidatedFormComponent extends Component<ValidatedFormSignature> {\n @tracked childComponents: ReturnType<typeof A<FieldBase>> = A<FieldBase>([]);\n //cache to only notify if changed\n lastIsValid?: boolean;\n lastIsTouched?: boolean;\n\n @tracked isInvalid = false;\n @tracked isTouched = false;\n\n constructor(owner: Owner, args: ValidatedFormSignature['Args']) {\n super(owner, args);\n this.args.register?.(this);\n }\n\n willDestroy() {\n super.willDestroy();\n this.args.unregister?.(this);\n }\n\n get isValid() {\n return !this.isInvalid;\n }\n\n get isInvalidAndTouched() {\n return this.isInvalid && this.isTouched;\n }\n\n addChild(child: FieldBase) {\n this.childComponents.pushObject(child);\n }\n\n removeChild(child: FieldBase) {\n this.childComponents.removeObject(child);\n }\n\n @action\n async handleSubmit(e: Event) {\n e.preventDefault();\n\n if (this.isInvalid) {\n this.childComponents.setEach('isTouched', true);\n this.args.onInvalid?.();\n } else {\n this.childComponents.setEach('isTouched', false);\n\n try {\n await this.args.onSubmit?.();\n } catch (e) {\n this.childComponents.setEach('isTouched', true);\n }\n }\n }\n\n @action\n handleReset(e: Event) {\n e.preventDefault();\n this.args.onReset?.(e);\n }\n\n @action\n register(child: FieldBase) {\n if (!this.isDestroyed) {\n schedule('afterRender', this, this.addChild, child);\n }\n }\n\n @action\n unregister(child: FieldBase) {\n if (!this.isDestroyed) {\n schedule('afterRender', this, this.removeChild, child);\n // When adding a child the validation gets calculated on a `did-insert` modifier\n // for removal there's no modifier so it gets called here\n schedule('afterRender', this, this.triggerValidityChange);\n }\n }\n\n @action\n updateValidity() {\n this.triggerValidityChange();\n }\n\n getIsValid() {\n return this.childComponents.isEvery('isValid');\n }\n\n getIsTouched() {\n return this.childComponents.isAny('isTouched');\n }\n\n triggerValidityChange() {\n const lastIsValid = this.isValid;\n const lastIsTouched = this.isTouched;\n\n if (\n lastIsValid !== this.getIsValid() ||\n lastIsTouched !== this.getIsTouched()\n ) {\n this.setNewValidity();\n }\n }\n\n @action\n setNewValidity() {\n next(() => {\n this.isInvalid = !this.getIsValid();\n this.isTouched = this.getIsTouched();\n\n if (!this.isDestroying) {\n this.args.onValidityChange?.(\n this.isValid,\n this.isTouched,\n this.isInvalidAndTouched\n );\n }\n });\n }\n\n @action\n onChildValidityChange() {\n if (!this.isDestroying) {\n this.updateValidity();\n }\n }\n\n @action\n onFocusOut(e: FocusEvent) {\n \n const targetEuiFormRow = (e.target as HTMLInputElement)?.closest?.('.euiFormRow');\n \n this.childComponents\n .find((child) => {\n return targetEuiFormRow === child.formRowElement;\n })\n ?.setIsTouched(true);\n }\n\n get theme() {\n const theme: Partial<IValidatedFormTheme> = this.args.theme || {};\n\n return { ...ValidatedFormDefaultTheme, ...theme };\n }\n\n <template>\n {{#let (argOrDefault @id (randomId)) as |formId|}}\n <EuiForm\n @tagName={{argOrDefault @tagName \"form\"}}\n id={{formId}}\n @isInvalid={{@isInvalid}}\n @invalidCallout={{@invalidCallout}}\n @error={{@error}}\n @errorTitle={{@errorTitle}}\n {{on \"submit\" this.handleSubmit}}\n {{on \"reset\" this.handleReset}}\n {{didInsert this.setNewValidity}}\n {{on \"focusout\" this.onFocusOut}}\n ...attributes\n >\n {{yield\n (hash\n onValidityChange=this.onChildValidityChange\n register=this.register\n unregister=this.unregister\n isValid=this.isValid\n isInvalid=this.isInvalid\n isTouched=this.isTouched\n isInvalidAndTouched=this.isInvalidAndTouched\n formId=formId\n FieldBase=(component\n this.theme.FieldBase\n register=this.register\n unregister=this.unregister\n onValidityChange=this.onChildValidityChange\n formId=formId\n disabled=@isDisabled\n )\n FieldNumber=(component\n this.theme.FieldNumber\n register=this.register\n unregister=this.unregister\n onValidityChange=this.onChildValidityChange\n fullWidth=@fullWidth\n compressed=@compressed\n formId=formId\n disabled=@isDisabled\n )\n FieldText=(component\n this.theme.FieldText\n register=this.register\n unregister=this.unregister\n onValidityChange=this.onChildValidityChange\n fullWidth=@fullWidth\n compressed=@compressed\n formId=formId\n disabled=@isDisabled\n )\n FieldPassword=(component\n this.theme.FieldPassword\n register=this.register\n unregister=this.unregister\n onValidityChange=this.onChildValidityChange\n fullWidth=@fullWidth\n compressed=@compressed\n formId=formId\n disabled=@isDisabled\n )\n FieldTextArea=(component\n this.theme.FieldTextArea\n register=this.register\n unregister=this.unregister\n onValidityChange=this.onChildValidityChange\n fullWidth=@fullWidth\n compressed=@compressed\n formId=formId\n disabled=@isDisabled\n )\n FieldSelect=(component\n this.theme.FieldSelect\n register=this.register\n unregister=this.unregister\n onValidityChange=this.onChildValidityChange\n fullWidth=@fullWidth\n compressed=@compressed\n formId=formId\n disabled=@isDisabled\n )\n FieldComboBox=(component\n this.theme.FieldComboBox\n register=this.register\n unregister=this.unregister\n onValidityChange=this.onChildValidityChange\n fullWidth=@fullWidth\n compressed=@compressed\n formId=formId\n isDisabled=@isDisabled\n )\n FieldCheckboxGroup=(component\n this.theme.FieldCheckboxGroup\n register=this.register\n unregister=this.unregister\n onValidityChange=this.onChildValidityChange\n fullWidth=@fullWidth\n compressed=@compressed\n formId=formId\n disabled=@isDisabled\n )\n FieldRadioGroup=(component\n this.theme.FieldRadioGroup\n register=this.register\n unregister=this.unregister\n onValidityChange=this.onChildValidityChange\n fullWidth=@fullWidth\n compressed=@compressed\n formId=formId\n disabled=@isDisabled\n )\n FieldRangeSlider=(component\n this.theme.FieldRangeSlider\n register=this.register\n unregister=this.unregister\n onValidityChange=this.onChildValidityChange\n fullWidth=@fullWidth\n compressed=@compressed\n formId=formId\n disabled=@isDisabled\n )\n FieldDualRangeSlider=(component\n this.theme.FieldDualRangeSlider\n register=this.register\n unregister=this.unregister\n onValidityChange=this.onChildValidityChange\n fullWidth=@fullWidth\n compressed=@compressed\n formId=formId\n disabled=@isDisabled\n )\n FieldSwitch=(component\n this.theme.FieldSwitch\n register=this.register\n unregister=this.unregister\n onValidityChange=this.onChildValidityChange\n fullWidth=@fullWidth\n compressed=@compressed\n formId=formId\n disabled=@isDisabled\n )\n FieldMarkdownEditor=(component\n this.theme.FieldMarkdownEditor\n register=this.register\n unregister=this.unregister\n onValidityChange=this.onChildValidityChange\n fullWidth=@fullWidth\n compressed=@compressed\n formId=formId\n disabled=@isDisabled\n )\n )\n }}\n </EuiForm>\n {{/let}}\n </template>\n}\n"],"names":["ValidatedFormComponent","Component","g","prototype","tracked","A","i","void 0","lastIsValid","lastIsTouched","constructor","owner","args","register","willDestroy","unregister","isValid","isInvalid","isInvalidAndTouched","isTouched","addChild","child","childComponents","pushObject","removeChild","removeObject","handleSubmit","e","preventDefault","setEach","onInvalid","onSubmit","n","action","handleReset","onReset","isDestroyed","schedule","triggerValidityChange","updateValidity","getIsValid","isEvery","getIsTouched","isAny","setNewValidity","next","isDestroying","onValidityChange","onChildValidityChange","onFocusOut","targetEuiFormRow","target","closest","find","formRowElement","setIsTouched","theme","ValidatedFormDefaultTheme","setComponentTemplate","precompileTemplate","strictMode","scope","argOrDefault","randomId","EuiForm","on","didInsert","hash"],"mappings":";;;;;;;;;;;;;;;;AA8Ee,MAAMA,+BAA+BC,SAAU,CAAA;AAAA,EAAA;IAAAC,CAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,iBAAA,EAAA,CAC3DC,OAAA,CAAA,EAAA,YAAA;MAAA,OAA2DC,CAAE,CAAW,EAAE,CAAE;AAAA,KAAA,CAAA;AAAA;AAAA,EAAA,gBAAA,IAAAC,CAAA,CAAA,IAAA,EAAA,iBAAA,CAAA,EAAAC,MAAA;AAC7E;EACAC,WAAA;EACAC,aAAA;AAA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dC8B,MAAA,CAAA,CAAA;AAAA;AAiBDe,EAAAA,qBAAwBA,GAAA;AACtB,IAAA,IAAI,CAAC,IAAI,CAACF,YAAY,EAAE;MACtB,IAAI,CAACP,cAAc,EAAA;AACrB;AACF;AAAA,EAAA;IAAAP,CAAA,CAAA,IAAA,CAAA7B,SAAA,EAAA,uBAAA,EAAA,CALC8B,MAAA,CAAA,CAAA;AAAA;EAQDgB,UAAWA,CAAAtB,CAAa,EAAE;IAExB,MAAMuB,mBAAoBvB,CAAA,CAAEwB,MAAM,EAAuBC,OAAU,GAAA,aAAA,CAAA;AAEnE,IAAA,IAAI,CAAC9B,eAAe,CACjB+B,IAAI,CAAEhC,KAAA,IAAA;AACL,MAAA,OAAO6B,gBAAA,KAAqB7B,MAAMiC,cAAc;AAClD,KAAA,CAAA,EACEC,YAAa,CAAA,IAAA,CAAA;AACnB;AAAA,EAAA;IAAAvB,CAAA,CAAA,IAAA,CAAA7B,SAAA,EAAA,YAAA,EAAA,CAVC8B,MAAA,CAAA,CAAA;AAAA;EAYD,IAAIuB,KAAQA,GAAA;IACV,MAAMA,KAAsC,GAAA,IAAI,CAAC5C,IAAI,CAAC4C,KAAK,IAAI,EAAC;IAEhE,OAAO;AAAE,MAAA,GAAGC,yBAAyB;MAAE,GAAGD;KAAM;AAClD;AAEA,EAAA;IAAAE,oBAAA,CAAAC,kBAAA,CA6JA,i/GAAA,EAAA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,YAAA;QAAAC,QAAA;QAAAC,OAAA;QAAAC,EAAA;QAAAC,SAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
|
|
1
|
+
{"version":3,"file":"validated-form.js","sources":["../../src/components/validated-form.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { tracked } from '@glimmer/tracking';\nimport { A } from '@ember/array';\nimport { hash } from '@ember/helper';\nimport { on } from '@ember/modifier';\nimport { action } from '@ember/object';\nimport didInsert from '@ember/render-modifiers/modifiers/did-insert';\nimport { next, schedule } from '@ember/runloop';\nimport EuiForm from '@ember-eui/core/components/eui-form';\nimport { argOrDefault } from '@ember-eui/core/helpers';\nimport type Owner from '@ember/owner';\n\nimport randomId from '../-private/random-id.ts';\nimport { ValidatedFormDefaultTheme } from './default-theme.ts';\n\nimport type { IValidatedFormTheme } from './default-theme';\nimport type FieldBase from './validated-form/field-base.gts';\nimport type { EuiFormSignature } from '@ember-eui/core/components/eui-form';\n\n/**\n * A form whose fields validate their own values with ember-validators\n * (`@validations`) or functions (`@customValidations`). Errors show once a\n * field is touched; submitting calls `@onSubmit` only when all fields are\n * valid.\n */\nexport interface ValidatedFormSignature {\n Element: EuiFormSignature['Element'];\n Args: {\n /** Id of the form; fields join it with `form=`. Defaults to a random id. */\n id?: string;\n /** @private Nested forms register with their parent form. */\n register?: (child: ValidatedFormComponent) => void;\n /** @private Nested forms register with their parent form. */\n unregister?: (child: ValidatedFormComponent) => void;\n /** @private */\n addChild?: (child: FieldBase) => void;\n /** @private */\n removeChild?: (child: FieldBase) => void;\n /** Called on submit while a field is invalid (all fields show their errors). */\n onInvalid?: () => void;\n /**\n * Called on submit when every field is valid. If it returns a promise\n * that rejects, the fields are marked touched again.\n */\n onSubmit?: () => void | Promise<void>;\n /** Called when the form is reset. */\n onReset?: (e: Event) => void;\n /**\n * Called when the form's validity or touched state changes, e.g. to\n * disable the submit button while invalid.\n */\n onValidityChange?: (\n isValid: boolean,\n isTouched: boolean,\n isInvalidAndTouched: boolean\n ) => void;\n /** Replaces the yielded field components (see the theme docs). */\n theme?: Partial<IValidatedFormTheme>;\n /** Disables every field. */\n isDisabled?: boolean;\n /** Makes every field full width. */\n fullWidth?: boolean;\n /** Compressed fields, for dense forms. */\n compressed?: boolean;\n /** `'form'` (the default) or `'div'`. */\n tagName?: EuiFormSignature['Args']['tagName'];\n /** Shows `@error` in a callout above the form, see EuiForm. */\n isInvalid?: EuiFormSignature['Args']['isInvalid'];\n /** See EuiForm's `@invalidCallout`. */\n invalidCallout?: EuiFormSignature['Args']['invalidCallout'];\n /** Form-level errors, see EuiForm's `@error`. */\n error?: EuiFormSignature['Args']['error'];\n /** Title of the errors callout. */\n errorTitle?: EuiFormSignature['Args']['errorTitle'];\n };\n Blocks: {\n /**\n * Yields the form's state (`isValid`, `isInvalid`, `isTouched`,\n * `isInvalidAndTouched`, `formId`) and its field components, already\n * connected to it: `as |form|` → `<form.FieldText @label=\"Name\"\n * @value={{this.name}} @onChange={{…}} @validations={{…}} />`.\n */\n default: [\n {\n onValidityChange: (\n isValid: boolean,\n isTouched: boolean,\n isInvalidAndTouched: boolean\n ) => void;\n register: (child: FieldBase) => void;\n unregister: (child: FieldBase) => void;\n isValid: boolean;\n isInvalid: boolean;\n isTouched: boolean;\n isInvalidAndTouched: boolean;\n formId: string;\n FieldBase: IValidatedFormTheme['FieldBase'];\n FieldNumber: IValidatedFormTheme['FieldNumber'];\n FieldText: IValidatedFormTheme['FieldText'];\n FieldPassword: IValidatedFormTheme['FieldPassword'];\n FieldTextArea: IValidatedFormTheme['FieldTextArea'];\n FieldSelect: IValidatedFormTheme['FieldSelect'];\n FieldComboBox: IValidatedFormTheme['FieldComboBox'];\n FieldCheckboxGroup: IValidatedFormTheme['FieldCheckboxGroup'];\n FieldRadioGroup: IValidatedFormTheme['FieldRadioGroup'];\n FieldRangeSlider: IValidatedFormTheme['FieldRangeSlider'];\n FieldDualRangeSlider: IValidatedFormTheme['FieldDualRangeSlider'];\n FieldSwitch: IValidatedFormTheme['FieldSwitch'];\n FieldMarkdownEditor: IValidatedFormTheme['FieldMarkdownEditor'];\n }\n ];\n };\n}\n\nexport default class ValidatedFormComponent extends Component<ValidatedFormSignature> {\n @tracked childComponents: ReturnType<typeof A<FieldBase>> = A<FieldBase>([]);\n //cache to only notify if changed\n lastIsValid?: boolean;\n lastIsTouched?: boolean;\n\n @tracked isInvalid = false;\n @tracked isTouched = false;\n\n constructor(owner: Owner, args: ValidatedFormSignature['Args']) {\n super(owner, args);\n this.args.register?.(this);\n }\n\n willDestroy() {\n super.willDestroy();\n this.args.unregister?.(this);\n }\n\n get isValid() {\n return !this.isInvalid;\n }\n\n get isInvalidAndTouched() {\n return this.isInvalid && this.isTouched;\n }\n\n addChild(child: FieldBase) {\n this.childComponents.pushObject(child);\n }\n\n removeChild(child: FieldBase) {\n this.childComponents.removeObject(child);\n }\n\n @action\n async handleSubmit(e: Event) {\n e.preventDefault();\n\n if (this.isInvalid) {\n this.childComponents.setEach('isTouched', true);\n this.args.onInvalid?.();\n } else {\n this.childComponents.setEach('isTouched', false);\n\n try {\n await this.args.onSubmit?.();\n } catch {\n this.childComponents.setEach('isTouched', true);\n }\n }\n }\n\n @action\n handleReset(e: Event) {\n e.preventDefault();\n this.args.onReset?.(e);\n }\n\n @action\n register(child: FieldBase) {\n if (!this.isDestroyed) {\n schedule('afterRender', this, this.addChild, child);\n }\n }\n\n @action\n unregister(child: FieldBase) {\n if (!this.isDestroyed) {\n schedule('afterRender', this, this.removeChild, child);\n // When adding a child the validation gets calculated on a `did-insert` modifier\n // for removal there's no modifier so it gets called here\n schedule('afterRender', this, this.triggerValidityChange);\n }\n }\n\n @action\n updateValidity() {\n this.triggerValidityChange();\n }\n\n getIsValid() {\n return this.childComponents.isEvery('isValid');\n }\n\n getIsTouched() {\n return this.childComponents.isAny('isTouched');\n }\n\n triggerValidityChange() {\n const lastIsValid = this.isValid;\n const lastIsTouched = this.isTouched;\n\n if (\n lastIsValid !== this.getIsValid() ||\n lastIsTouched !== this.getIsTouched()\n ) {\n this.setNewValidity();\n }\n }\n\n @action\n setNewValidity() {\n next(() => {\n this.isInvalid = !this.getIsValid();\n this.isTouched = this.getIsTouched();\n\n if (!this.isDestroying) {\n this.args.onValidityChange?.(\n this.isValid,\n this.isTouched,\n this.isInvalidAndTouched\n );\n }\n });\n }\n\n @action\n onChildValidityChange() {\n if (!this.isDestroying) {\n this.updateValidity();\n }\n }\n\n @action\n onFocusOut(e: FocusEvent) {\n \n const targetEuiFormRow = (e.target as HTMLInputElement)?.closest?.('.euiFormRow');\n \n this.childComponents\n .find((child) => {\n return targetEuiFormRow === child.formRowElement;\n })\n ?.setIsTouched(true);\n }\n\n get theme() {\n const theme: Partial<IValidatedFormTheme> = this.args.theme || {};\n\n return { ...ValidatedFormDefaultTheme, ...theme };\n }\n\n <template>\n {{#let (argOrDefault @id (randomId)) as |formId|}}\n <EuiForm\n @tagName={{argOrDefault @tagName \"form\"}}\n id={{formId}}\n @isInvalid={{@isInvalid}}\n @invalidCallout={{@invalidCallout}}\n @error={{@error}}\n @errorTitle={{@errorTitle}}\n {{on \"submit\" this.handleSubmit}}\n {{on \"reset\" this.handleReset}}\n {{didInsert this.setNewValidity}}\n {{on \"focusout\" this.onFocusOut}}\n ...attributes\n >\n {{yield\n (hash\n onValidityChange=this.onChildValidityChange\n register=this.register\n unregister=this.unregister\n isValid=this.isValid\n isInvalid=this.isInvalid\n isTouched=this.isTouched\n isInvalidAndTouched=this.isInvalidAndTouched\n formId=formId\n FieldBase=(component\n this.theme.FieldBase\n register=this.register\n unregister=this.unregister\n onValidityChange=this.onChildValidityChange\n formId=formId\n disabled=@isDisabled\n )\n FieldNumber=(component\n this.theme.FieldNumber\n register=this.register\n unregister=this.unregister\n onValidityChange=this.onChildValidityChange\n fullWidth=@fullWidth\n compressed=@compressed\n formId=formId\n disabled=@isDisabled\n )\n FieldText=(component\n this.theme.FieldText\n register=this.register\n unregister=this.unregister\n onValidityChange=this.onChildValidityChange\n fullWidth=@fullWidth\n compressed=@compressed\n formId=formId\n disabled=@isDisabled\n )\n FieldPassword=(component\n this.theme.FieldPassword\n register=this.register\n unregister=this.unregister\n onValidityChange=this.onChildValidityChange\n fullWidth=@fullWidth\n compressed=@compressed\n formId=formId\n disabled=@isDisabled\n )\n FieldTextArea=(component\n this.theme.FieldTextArea\n register=this.register\n unregister=this.unregister\n onValidityChange=this.onChildValidityChange\n fullWidth=@fullWidth\n compressed=@compressed\n formId=formId\n disabled=@isDisabled\n )\n FieldSelect=(component\n this.theme.FieldSelect\n register=this.register\n unregister=this.unregister\n onValidityChange=this.onChildValidityChange\n fullWidth=@fullWidth\n compressed=@compressed\n formId=formId\n disabled=@isDisabled\n )\n FieldComboBox=(component\n this.theme.FieldComboBox\n register=this.register\n unregister=this.unregister\n onValidityChange=this.onChildValidityChange\n fullWidth=@fullWidth\n compressed=@compressed\n formId=formId\n isDisabled=@isDisabled\n )\n FieldCheckboxGroup=(component\n this.theme.FieldCheckboxGroup\n register=this.register\n unregister=this.unregister\n onValidityChange=this.onChildValidityChange\n fullWidth=@fullWidth\n compressed=@compressed\n formId=formId\n disabled=@isDisabled\n )\n FieldRadioGroup=(component\n this.theme.FieldRadioGroup\n register=this.register\n unregister=this.unregister\n onValidityChange=this.onChildValidityChange\n fullWidth=@fullWidth\n compressed=@compressed\n formId=formId\n disabled=@isDisabled\n )\n FieldRangeSlider=(component\n this.theme.FieldRangeSlider\n register=this.register\n unregister=this.unregister\n onValidityChange=this.onChildValidityChange\n fullWidth=@fullWidth\n compressed=@compressed\n formId=formId\n disabled=@isDisabled\n )\n FieldDualRangeSlider=(component\n this.theme.FieldDualRangeSlider\n register=this.register\n unregister=this.unregister\n onValidityChange=this.onChildValidityChange\n fullWidth=@fullWidth\n compressed=@compressed\n formId=formId\n disabled=@isDisabled\n )\n FieldSwitch=(component\n this.theme.FieldSwitch\n register=this.register\n unregister=this.unregister\n onValidityChange=this.onChildValidityChange\n fullWidth=@fullWidth\n compressed=@compressed\n formId=formId\n disabled=@isDisabled\n )\n FieldMarkdownEditor=(component\n this.theme.FieldMarkdownEditor\n register=this.register\n unregister=this.unregister\n onValidityChange=this.onChildValidityChange\n fullWidth=@fullWidth\n compressed=@compressed\n formId=formId\n disabled=@isDisabled\n )\n )\n }}\n </EuiForm>\n {{/let}}\n </template>\n}\n"],"names":["ValidatedFormComponent","Component","g","prototype","tracked","A","i","lastIsValid","lastIsTouched","constructor","owner","args","register","willDestroy","unregister","isValid","isInvalid","isInvalidAndTouched","isTouched","addChild","child","childComponents","pushObject","removeChild","removeObject","handleSubmit","e","preventDefault","setEach","onInvalid","onSubmit","n","action","handleReset","onReset","isDestroyed","schedule","triggerValidityChange","updateValidity","getIsValid","isEvery","getIsTouched","isAny","setNewValidity","next","isDestroying","onValidityChange","onChildValidityChange","onFocusOut","targetEuiFormRow","target","closest","find","formRowElement","setIsTouched","theme","ValidatedFormDefaultTheme","setComponentTemplate","precompileTemplate","strictMode","scope","argOrDefault","randomId","EuiForm","on","didInsert","hash"],"mappings":";;;;;;;;;;;;;;;;AAkHe,MAAMA,+BAA+BC,SAAA,CAAU;AAAA,EAAA;IAAAC,CAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,iBAAA,EAAA,CAC3DC,OAAA,CAAA,EAAA,YAAA;MAAA,OAA2DC,CAAA,CAAa,EAAE,CAAA;AAAA,IAAA,CAAA,CAAA;AAAA;EAAA,gBAAA,IAAAC,CAAA,CAAA,IAAA,EAAA,iBAAA,CAAA,EAAA,MAAA;AAC3E;EACAC,WAAA;EACAC,aAAA;AAAwB,EAAA;IAAAN,CAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,WAAA,EAAA,CAEvBC,OAAA,CAAA,EAAA,YAAA;AAAA,MAAA,OAAoB,KAAA;AAAA,IAAA,CAAA,CAAA;AAAA;EAAA,UAAA,IAAAE,CAAA,CAAA,IAAA,EAAA,WAAA,CAAA,EAAA,MAAA;AAAA,EAAA;IAAAJ,CAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,WAAA,EAAA,CACpBC,OAAA,CAAA,EAAA,YAAA;AAAA,MAAA,OAAoB,KAAA;AAAA,IAAA,CAAA,CAAA;AAAA;EAAA,UAAA,IAAAE,CAAA,CAAA,IAAA,EAAA,WAAA,CAAA,EAAA,MAAA;AAErBG,EAAAA,WAAAA,CAAYC,KAAY,EAAEC,IAAoC,EAAE;AAC9D,IAAA,KAAK,CAACD,KAA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