@frontile/changeset-form 0.15.0 → 0.16.0-alpha.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.
Files changed (90) hide show
  1. package/addon-main.js +4 -0
  2. package/{components → declarations/components}/changeset-form/fields/base.d.ts +5 -9
  3. package/declarations/components/changeset-form/fields/base.d.ts.map +1 -0
  4. package/{components → declarations/components}/changeset-form/fields/checkbox-group.d.ts +9 -4
  5. package/declarations/components/changeset-form/fields/checkbox-group.d.ts.map +1 -0
  6. package/{components → declarations/components}/changeset-form/fields/checkbox.d.ts +11 -5
  7. package/declarations/components/changeset-form/fields/checkbox.d.ts.map +1 -0
  8. package/declarations/components/changeset-form/fields/input.d.ts +16 -0
  9. package/declarations/components/changeset-form/fields/input.d.ts.map +1 -0
  10. package/declarations/components/changeset-form/fields/radio-group.d.ts +18 -0
  11. package/declarations/components/changeset-form/fields/radio-group.d.ts.map +1 -0
  12. package/declarations/components/changeset-form/fields/radio.d.ts +16 -0
  13. package/declarations/components/changeset-form/fields/radio.d.ts.map +1 -0
  14. package/{components → declarations/components}/changeset-form/fields/select.d.ts +6 -5
  15. package/declarations/components/changeset-form/fields/select.d.ts.map +1 -0
  16. package/{components → declarations/components}/changeset-form/fields/textarea.d.ts +9 -3
  17. package/declarations/components/changeset-form/fields/textarea.d.ts.map +1 -0
  18. package/{components → declarations/components}/changeset-form/index.d.ts +10 -8
  19. package/declarations/components/changeset-form/index.d.ts.map +1 -0
  20. package/declarations/template-registry.d.ts +19 -0
  21. package/declarations/template-registry.d.ts.map +1 -0
  22. package/dist/_app_/components/changeset-form/fields/base.js +1 -0
  23. package/dist/_app_/components/changeset-form/fields/checkbox-group.js +1 -0
  24. package/dist/_app_/components/changeset-form/fields/checkbox.js +1 -0
  25. package/dist/_app_/components/changeset-form/fields/input.js +1 -0
  26. package/dist/_app_/components/changeset-form/fields/radio-group.js +1 -0
  27. package/dist/_app_/components/changeset-form/fields/radio.js +1 -0
  28. package/dist/_app_/components/changeset-form/fields/select.js +1 -0
  29. package/dist/_app_/components/changeset-form/fields/textarea.js +1 -0
  30. package/dist/_app_/components/changeset-form/index.js +1 -0
  31. package/dist/components/changeset-form/fields/base.js +47 -0
  32. package/dist/components/changeset-form/fields/base.js.map +1 -0
  33. package/dist/components/changeset-form/fields/checkbox-group.js +58 -0
  34. package/dist/components/changeset-form/fields/checkbox-group.js.map +1 -0
  35. package/dist/components/changeset-form/fields/checkbox.js +59 -0
  36. package/dist/components/changeset-form/fields/checkbox.js.map +1 -0
  37. package/dist/components/changeset-form/fields/input.js +26 -0
  38. package/dist/components/changeset-form/fields/input.js.map +1 -0
  39. package/dist/components/changeset-form/fields/radio-group.js +26 -0
  40. package/dist/components/changeset-form/fields/radio-group.js.map +1 -0
  41. package/dist/components/changeset-form/fields/radio.js +28 -0
  42. package/dist/components/changeset-form/fields/radio.js.map +1 -0
  43. package/dist/components/changeset-form/fields/select.js +37 -0
  44. package/dist/components/changeset-form/fields/select.js.map +1 -0
  45. package/dist/components/changeset-form/fields/textarea.js +27 -0
  46. package/dist/components/changeset-form/fields/textarea.js.map +1 -0
  47. package/dist/components/changeset-form/index.js +85 -0
  48. package/dist/components/changeset-form/index.js.map +1 -0
  49. package/dist/template-registry.js +2 -0
  50. package/dist/template-registry.js.map +1 -0
  51. package/package.json +80 -49
  52. package/addon/components/changeset-form/fields/base.ts +0 -75
  53. package/addon/components/changeset-form/fields/checkbox-group.hbs +0 -24
  54. package/addon/components/changeset-form/fields/checkbox-group.ts +0 -68
  55. package/addon/components/changeset-form/fields/checkbox.hbs +0 -15
  56. package/addon/components/changeset-form/fields/checkbox.ts +0 -60
  57. package/addon/components/changeset-form/fields/input.hbs +0 -23
  58. package/addon/components/changeset-form/fields/input.ts +0 -20
  59. package/addon/components/changeset-form/fields/radio-group.hbs +0 -19
  60. package/addon/components/changeset-form/fields/radio-group.ts +0 -29
  61. package/addon/components/changeset-form/fields/radio.hbs +0 -17
  62. package/addon/components/changeset-form/fields/radio.ts +0 -25
  63. package/addon/components/changeset-form/fields/select.hbs +0 -70
  64. package/addon/components/changeset-form/fields/select.ts +0 -51
  65. package/addon/components/changeset-form/fields/textarea.hbs +0 -23
  66. package/addon/components/changeset-form/fields/textarea.ts +0 -20
  67. package/addon/components/changeset-form/index.hbs +0 -55
  68. package/addon/components/changeset-form/index.ts +0 -116
  69. package/app/components/changeset-form/fields/checkbox-group.js +0 -1
  70. package/app/components/changeset-form/fields/checkbox.js +0 -1
  71. package/app/components/changeset-form/fields/input.js +0 -1
  72. package/app/components/changeset-form/fields/radio-group.js +0 -1
  73. package/app/components/changeset-form/fields/radio.js +0 -1
  74. package/app/components/changeset-form/fields/select.js +0 -1
  75. package/app/components/changeset-form/fields/textarea.js +0 -1
  76. package/app/components/changeset-form.js +0 -1
  77. package/components/changeset-form/fields/input.d.ts +0 -10
  78. package/components/changeset-form/fields/radio-group.d.ts +0 -15
  79. package/components/changeset-form/fields/radio.d.ts +0 -11
  80. package/config/environment.js +0 -5
  81. package/docs/changeset-form-usage-demo/demo.md +0 -124
  82. package/docs/changeset-form-usage.md +0 -134
  83. package/index.js +0 -5
  84. package/tsconfig.json +0 -24
  85. package/types/dummy/index.d.ts +0 -0
  86. package/types/ember-changeset-validations.d.ts +0 -56
  87. package/types/ember-get-config.d.ts +0 -3
  88. package/types/ember-power-select/test-support.d.ts +0 -29
  89. package/types/global.d.ts +0 -6
  90. package/types/index.d.ts +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"radio-group.js","sources":["../../../../src/components/changeset-form/fields/radio-group.gts"],"sourcesContent":["import { template } from \"@ember/template-compiler\";\nimport Base, { type BaseArgs, type BaseSignature } from './base';\nimport { action } from '@ember/object';\nimport type { FormRadioSignature } from '@frontile/forms/components/form-radio';\nimport FormRadioGroup, { type FormRadioGroupArgs } from '@frontile/forms/components/form-radio-group';\nimport type { ComponentLike } from '@glint/template';\nexport interface ChangesetFormFieldsRadioGroupArgs extends BaseArgs, FormRadioGroupArgs {\n onChange?: (value: unknown, event: Event) => void;\n}\nexport interface ChangesetFormFieldsRadioGroupSignature extends BaseSignature {\n Args: ChangesetFormFieldsRadioGroupArgs;\n Blocks: {\n default: [radio: ComponentLike<FormRadioSignature>];\n };\n Element: HTMLDivElement;\n}\nexport default class ChangesetFormFieldsRadioGroup extends Base<ChangesetFormFieldsRadioGroupSignature, string | boolean | number | undefined> {\n @action\n async handleChange(value1: unknown, event1: Event): Promise<void> {\n event1.preventDefault();\n this.args.changeset.set(this.args.fieldName, value1);\n await this.validate();\n if (typeof this.args.onChange === 'function') {\n this.args.onChange(value1, event1);\n }\n }\n static{\n template(`\n <FormRadioGroup\n @onChange={{this.handleChange}}\n @value={{this.value}}\n @errors={{this.errors}}\n @label={{@label}}\n @hint={{@hint}}\n @hasSubmitted={{@hasSubmitted}}\n @hasError={{@hasError}}\n @showError={{@showError}}\n @containerClass={{@containerClass}}\n @size={{@size}}\n @isInline={{@isInline}}\n ...attributes\n as |Radio|\n >\n {{yield Radio}}\n </FormRadioGroup>\n `, {\n component: this,\n eval () {\n return eval(arguments[0]);\n }\n });\n }\n}\n"],"names":["ChangesetFormFieldsRadioGroup","_class","_class2","Base","handleChange","value1","event1","preventDefault","args","changeset","set","fieldName","validate","onChange","setComponentTemplate","precompileTemplate","scope","FormRadioGroup","strictMode","_applyDecoratedDescriptor","prototype","action","Object","getOwnPropertyDescriptor"],"mappings":";;;;;;;;AAgBqBA,IAAAA,6BAA6B,IAAAC,MAAA,IAAAC,OAAA,GAAnC,MAAMF,6BAA6B,SAASG,uBAAI,CAAgF;AAC3I,EAAA,MACMC,YAAYA,CAACC,MAAe,EAAEC,MAAa,EAAiB;IAC9DA,MAAM,CAACC,cAAc,EAAE,CAAA;AACvB,IAAA,IAAI,CAACC,IAAI,CAACC,SAAS,CAACC,GAAG,CAAC,IAAI,CAACF,IAAI,CAACG,SAAS,EAAEN,MAAM,CAAC,CAAA;AACpD,IAAA,MAAM,IAAI,CAACO,QAAQ,EAAE,CAAA;IACrB,IAAI,OAAO,IAAI,CAACJ,IAAI,CAACK,QAAQ,KAAK,UAAU,EAAE;MAC1C,IAAI,CAACL,IAAI,CAACK,QAAQ,CAACR,MAAM,EAAEC,MAAM,CAAC,CAAA;AACtC,KAAA;AACJ,GAAA;AA2BJ,CAAC,EAAAQ,oBAAA,CAzBOC,kBAAA,CAkBH,iXAAA,EAAA;AAAAC,EAAAA,KAAA,EAAAA,OAAA;AAAAC,IAAAA,cAAAA;AAAA,GAAA,CAAA;EAAAC,UAAA,EAAA,IAAA;AAKG,CAAC,CAAC,EAAAhB,OAAA,CAAAA,EAAAA,OAAA,CAAAiB,GAAAA,yBAAA,CAAAlB,MAAA,CAAAmB,SAAA,EAjCLC,cAAAA,EAAAA,CAAAA,MAAM,GAAAC,MAAA,CAAAC,wBAAA,CAAAtB,MAAA,CAAAmB,SAAA,EAAA,cAAA,CAAA,EAAAnB,MAAA,CAAAmB,SAAA,CAAA,GAAAnB,MAAA;;;;"}
@@ -0,0 +1,28 @@
1
+ import _applyDecoratedDescriptor from '@babel/runtime/helpers/esm/applyDecoratedDescriptor';
2
+ import ChangesetFormFieldsBase from './base.js';
3
+ import { action } from '@ember/object';
4
+ import { on } from '@ember/modifier';
5
+ import FormRadio from '@frontile/forms/components/form-radio';
6
+ import { precompileTemplate } from '@ember/template-compilation';
7
+ import { setComponentTemplate } from '@ember/component';
8
+
9
+ var _class, _class2;
10
+ let ChangesetFormFieldsRadio = (_class = (_class2 = class ChangesetFormFieldsRadio extends ChangesetFormFieldsBase {
11
+ async handleChange(value1, event1) {
12
+ event1.preventDefault();
13
+ this.args.changeset.set(this.args.fieldName, value1);
14
+ await this.validate();
15
+ if (typeof this.args.onChange === 'function') {
16
+ this.args.onChange(value1, event1);
17
+ }
18
+ }
19
+ }, setComponentTemplate(precompileTemplate("\n <FormRadio @onChange={{this.handleChange}} @checked={{this.value}} @hint={{@hint}} @value={{@value}} @name={{@name}} @containerClass={{@containerClass}} @size={{@size}} ...attributes {{on \"blur\" this.validate}}>\n {{#if (has-block)}}\n {{yield}}\n {{else}}\n {{@label}}\n {{/if}}\n </FormRadio>\n ", {
20
+ scope: () => ({
21
+ FormRadio,
22
+ on
23
+ }),
24
+ strictMode: true
25
+ }), _class2), _class2), (_applyDecoratedDescriptor(_class.prototype, "handleChange", [action], Object.getOwnPropertyDescriptor(_class.prototype, "handleChange"), _class.prototype)), _class);
26
+
27
+ export { ChangesetFormFieldsRadio as default };
28
+ //# sourceMappingURL=radio.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"radio.js","sources":["../../../../src/components/changeset-form/fields/radio.gts"],"sourcesContent":["import { template } from \"@ember/template-compiler\";\nimport Base, { type BaseArgs, type BaseSignature } from './base';\nimport { action } from '@ember/object';\nimport { on } from '@ember/modifier';\nimport FormRadio, { type FormRadioArgs } from '@frontile/forms/components/form-radio';\nexport interface ChangesetFormFieldsRadioArgs extends BaseArgs, FormRadioArgs {\n onChange: (value: unknown, event: Event) => void;\n}\nexport interface ChangesetFormFieldsRadioSignature extends BaseSignature {\n Args: ChangesetFormFieldsRadioArgs;\n Element: HTMLInputElement;\n Blocks: {\n default: [];\n };\n}\nexport default class ChangesetFormFieldsRadio extends Base<ChangesetFormFieldsRadioSignature> {\n @action\n async handleChange(value1: unknown, event1: Event): Promise<void> {\n event1.preventDefault();\n this.args.changeset.set(this.args.fieldName, value1);\n await this.validate();\n if (typeof this.args.onChange === 'function') {\n this.args.onChange(value1, event1);\n }\n }\n static{\n template(`\n <FormRadio\n @onChange={{this.handleChange}}\n @checked={{this.value}}\n @hint={{@hint}}\n @value={{@value}}\n @name={{@name}}\n @containerClass={{@containerClass}}\n @size={{@size}}\n ...attributes\n {{on \"blur\" this.validate}}\n >\n {{#if (has-block)}}\n {{yield}}\n {{else}}\n {{@label}}\n {{/if}}\n </FormRadio>\n `, {\n component: this,\n eval () {\n return eval(arguments[0]);\n }\n });\n }\n}\n"],"names":["ChangesetFormFieldsRadio","_class","_class2","Base","handleChange","value1","event1","preventDefault","args","changeset","set","fieldName","validate","onChange","setComponentTemplate","precompileTemplate","scope","FormRadio","on","strictMode","_applyDecoratedDescriptor","prototype","action","Object","getOwnPropertyDescriptor"],"mappings":";;;;;;;;;AAeqBA,IAAAA,wBAAwB,IAAAC,MAAA,IAAAC,OAAA,GAA9B,MAAMF,wBAAwB,SAASG,uBAAI,CAAoC;AAC1F,EAAA,MACMC,YAAYA,CAACC,MAAe,EAAEC,MAAa,EAAiB;IAC9DA,MAAM,CAACC,cAAc,EAAE,CAAA;AACvB,IAAA,IAAI,CAACC,IAAI,CAACC,SAAS,CAACC,GAAG,CAAC,IAAI,CAACF,IAAI,CAACG,SAAS,EAAEN,MAAM,CAAC,CAAA;AACpD,IAAA,MAAM,IAAI,CAACO,QAAQ,EAAE,CAAA;IACrB,IAAI,OAAO,IAAI,CAACJ,IAAI,CAACK,QAAQ,KAAK,UAAU,EAAE;MAC1C,IAAI,CAACL,IAAI,CAACK,QAAQ,CAACR,MAAM,EAAEC,MAAM,CAAC,CAAA;AACtC,KAAA;AACJ,GAAA;AA2BJ,CAAC,EAAAQ,oBAAA,CAzBOC,kBAAA,CAkBH,oVAAA,EAAA;AAAAC,EAAAA,KAAA,EAAAA,OAAA;IAAAC,SAAA;AAAAC,IAAAA,EAAAA;AAAA,GAAA,CAAA;EAAAC,UAAA,EAAA,IAAA;AAKG,CAAC,CAAC,EAAAjB,OAAA,CAAAA,EAAAA,OAAA,CAAAkB,GAAAA,yBAAA,CAAAnB,MAAA,CAAAoB,SAAA,EAjCLC,cAAAA,EAAAA,CAAAA,MAAM,GAAAC,MAAA,CAAAC,wBAAA,CAAAvB,MAAA,CAAAoB,SAAA,EAAA,cAAA,CAAA,EAAApB,MAAA,CAAAoB,SAAA,CAAA,GAAApB,MAAA;;;;"}
@@ -0,0 +1,37 @@
1
+ import _applyDecoratedDescriptor from '@babel/runtime/helpers/esm/applyDecoratedDescriptor';
2
+ import ChangesetFormFieldsBase from './base.js';
3
+ import { action } from '@ember/object';
4
+ import FormSelect from '@frontile/forms/components/form-select';
5
+ import { precompileTemplate } from '@ember/template-compilation';
6
+ import { setComponentTemplate } from '@ember/component';
7
+
8
+ var _class, _class2;
9
+ let ChangesetFormFieldsSelect = (_class = (_class2 = class ChangesetFormFieldsSelect extends ChangesetFormFieldsBase {
10
+ async handleChange(selection1, select1, event1) {
11
+ this.args.changeset.set(this.args.fieldName, selection1);
12
+ await this.validate();
13
+ if (typeof this.args.onChange === 'function') {
14
+ this.args.onChange(selection1, select1, event1);
15
+ }
16
+ }
17
+ async handleFocusOut(select1, event1) {
18
+ await this.validate();
19
+ if (typeof this.args.onFocusOut === 'function') {
20
+ this.args.onFocusOut(select1, event1);
21
+ }
22
+ }
23
+ async handleClose(select1, event1) {
24
+ await this.validate();
25
+ if (typeof this.args.onClose === 'function') {
26
+ this.args.onClose(select1, event1);
27
+ }
28
+ }
29
+ }, setComponentTemplate(precompileTemplate("\n {{!-- @glint-nocheck: need to fix powerselect types--}}\n <FormSelect @selected={{this.value}} @onChange={{this.handleChange}} @onFocusOut={{this.handleFocusOut}} @onClose={{this.handleClose}} @errors={{this.errors}} @hasSubmitted={{@hasSubmitted}} @isMultiple={{@isMultiple}} @label={{@label}} @hint={{@hint}} @hasError={{@hasError}} @showError={{@showError}} @containerClass={{@containerClass}} @size={{@size}} @onFocusIn={{@onFocusIn}} @onFocus={{@onFocus}} @onBlur={{@onBlur}} @onOpen={{@onOpen}} @triggerClass={{@triggerClass}} @highlightOnHover={{@highlightOnHover}} @placeholderComponent={{@placeholderComponent}} @searchMessage={{@searchMessage}} @noMatchesMessage={{@noMatchesMessage}} @matchTriggerWidth={{@matchTriggerWidth}} @options={{@options}} @closeOnSelect={{@closeOnSelect}} @defaultHighlighted={{@defaultHighlighted}} @searchField={{@searchField}} @searchEnabled={{@searchEnabled}} @tabindex={{@tabindex}} @triggerComponent={{@triggerComponent}} @matcher={{@matcher}} @initiallyOpened={{@initiallyOpened}} @typeAheadOptionMatcher={{@typeAheadOptionMatcher}} @buildSelection={{@buildSelection}} @search={{@search}} @onInput={{@onInput}} @onKeydown={{@onKeydown}} @scrollTo={{@scrollTo}} @registerAPI={{@registerAPI}} @horizontalPosition={{@horizontalPosition}} @destination={{@destination}} @preventScroll={{@preventScroll}} @renderInPlace={{@renderInPlace}} @verticalPosition={{@verticalPosition}} @disabled={{@disabled}} @calculatePosition={{@calculatePosition}} @eventType={{@eventType}} @ariaLabel={{@ariaLabel}} @required={{@required}} @triggerRole={{@triggerRole}} @title={{@title}} @triggerId={{@triggerId}} @allowClear={{@allowClear}} @loadingMessage={{@loadingMessage}} @selectedItemComponent={{@selectedItemComponent}} @dropdownClass={{@dropdownClass}} @beforeOptionsComponent={{@beforeOptionsComponent}} @placeholder={{@placeholder}} @searchPlaceholder={{@searchPlaceholder}} @searchMessageComponent={{@searchMessageComponent}} @optionsComponent={{@optionsComponent}} @extra={{@extra}} @groupComponent={{@groupComponent}} @afterOptionsComponent={{@afterOptionsComponent}} ...attributes as |option term|>\n {{yield option term}}\n </FormSelect>\n ", {
30
+ scope: () => ({
31
+ FormSelect
32
+ }),
33
+ strictMode: true
34
+ }), _class2), _class2), (_applyDecoratedDescriptor(_class.prototype, "handleChange", [action], Object.getOwnPropertyDescriptor(_class.prototype, "handleChange"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "handleFocusOut", [action], Object.getOwnPropertyDescriptor(_class.prototype, "handleFocusOut"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "handleClose", [action], Object.getOwnPropertyDescriptor(_class.prototype, "handleClose"), _class.prototype)), _class);
35
+
36
+ export { ChangesetFormFieldsSelect as default };
37
+ //# sourceMappingURL=select.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"select.js","sources":["../../../../src/components/changeset-form/fields/select.gts"],"sourcesContent":["import { template } from \"@ember/template-compiler\";\nimport Base, { type BaseArgs, type BaseSignature } from './base';\nimport { action } from '@ember/object';\nimport FormSelect, { type FormSelectArgs, type Select } from '@frontile/forms/components/form-select';\nexport interface ChangesetFormFieldsSelectArgs extends BaseArgs, FormSelectArgs {\n onChange: (selection: unknown, select: Select, event?: Event) => void;\n onFocusOut?: (select: Select, event: FocusEvent) => void;\n onClose?: (select: Select, e: Event) => boolean | undefined;\n}\nexport interface ChangesetFormFieldsSelectSignature extends BaseSignature {\n Args: ChangesetFormFieldsSelectArgs;\n Blocks: {\n default: [option: unknown, select: Select];\n };\n Element: HTMLDivElement;\n}\nexport default class ChangesetFormFieldsSelect extends Base<ChangesetFormFieldsSelectSignature> {\n @action\n async handleChange(selection1: unknown, select1: Select, event1?: Event): Promise<void> {\n this.args.changeset.set(this.args.fieldName, selection1);\n await this.validate();\n if (typeof this.args.onChange === 'function') {\n this.args.onChange(selection1, select1, event1);\n }\n }\n @action\n async handleFocusOut(select1: Select, event1: FocusEvent): Promise<void> {\n await this.validate();\n if (typeof this.args.onFocusOut === 'function') {\n this.args.onFocusOut(select1, event1);\n }\n }\n @action\n async handleClose(select1: Select, event1: Event): Promise<void> {\n await this.validate();\n if (typeof this.args.onClose === 'function') {\n this.args.onClose(select1, event1);\n }\n }\n static{\n template(`\n {{! @glint-nocheck: need to fix powerselect types}}\n <FormSelect\n @selected={{this.value}}\n @onChange={{this.handleChange}}\n @onFocusOut={{this.handleFocusOut}}\n @onClose={{this.handleClose}}\n @errors={{this.errors}}\n @hasSubmitted={{@hasSubmitted}}\n @isMultiple={{@isMultiple}}\n @label={{@label}}\n @hint={{@hint}}\n @hasError={{@hasError}}\n @showError={{@showError}}\n @containerClass={{@containerClass}}\n @size={{@size}}\n @onFocusIn={{@onFocusIn}}\n @onFocus={{@onFocus}}\n @onBlur={{@onBlur}}\n @onOpen={{@onOpen}}\n @triggerClass={{@triggerClass}}\n @highlightOnHover={{@highlightOnHover}}\n @placeholderComponent={{@placeholderComponent}}\n @searchMessage={{@searchMessage}}\n @noMatchesMessage={{@noMatchesMessage}}\n @matchTriggerWidth={{@matchTriggerWidth}}\n @options={{@options}}\n @closeOnSelect={{@closeOnSelect}}\n @defaultHighlighted={{@defaultHighlighted}}\n @searchField={{@searchField}}\n @searchEnabled={{@searchEnabled}}\n @tabindex={{@tabindex}}\n @triggerComponent={{@triggerComponent}}\n @matcher={{@matcher}}\n @initiallyOpened={{@initiallyOpened}}\n @typeAheadOptionMatcher={{@typeAheadOptionMatcher}}\n @buildSelection={{@buildSelection}}\n @search={{@search}}\n @onInput={{@onInput}}\n @onKeydown={{@onKeydown}}\n @scrollTo={{@scrollTo}}\n @registerAPI={{@registerAPI}}\n @horizontalPosition={{@horizontalPosition}}\n @destination={{@destination}}\n @preventScroll={{@preventScroll}}\n @renderInPlace={{@renderInPlace}}\n @verticalPosition={{@verticalPosition}}\n @disabled={{@disabled}}\n @calculatePosition={{@calculatePosition}}\n @eventType={{@eventType}}\n @ariaLabel={{@ariaLabel}}\n @required={{@required}}\n @triggerRole={{@triggerRole}}\n @title={{@title}}\n @triggerId={{@triggerId}}\n @allowClear={{@allowClear}}\n @loadingMessage={{@loadingMessage}}\n @selectedItemComponent={{@selectedItemComponent}}\n @dropdownClass={{@dropdownClass}}\n @beforeOptionsComponent={{@beforeOptionsComponent}}\n @placeholder={{@placeholder}}\n @searchPlaceholder={{@searchPlaceholder}}\n @searchMessageComponent={{@searchMessageComponent}}\n @optionsComponent={{@optionsComponent}}\n @extra={{@extra}}\n @groupComponent={{@groupComponent}}\n @afterOptionsComponent={{@afterOptionsComponent}}\n ...attributes\n as |option term|\n >\n {{yield option term}}\n </FormSelect>\n `, {\n component: this,\n eval () {\n return eval(arguments[0]);\n }\n });\n }\n}\n"],"names":["ChangesetFormFieldsSelect","_class","_class2","Base","handleChange","selection1","select1","event1","args","changeset","set","fieldName","validate","onChange","handleFocusOut","onFocusOut","handleClose","onClose","setComponentTemplate","precompileTemplate","scope","FormSelect","strictMode","_applyDecoratedDescriptor","prototype","action","Object","getOwnPropertyDescriptor"],"mappings":";;;;;;;;AAgBqBA,IAAAA,yBAAyB,IAAAC,MAAA,IAAAC,OAAA,GAA/B,MAAMF,yBAAyB,SAASG,uBAAI,CAAqC;AAC5F,EAAA,MACMC,YAAYA,CAACC,UAAmB,EAAEC,OAAe,EAAEC,MAAc,EAAiB;AACpF,IAAA,IAAI,CAACC,IAAI,CAACC,SAAS,CAACC,GAAG,CAAC,IAAI,CAACF,IAAI,CAACG,SAAS,EAAEN,UAAU,CAAC,CAAA;AACxD,IAAA,MAAM,IAAI,CAACO,QAAQ,EAAE,CAAA;IACrB,IAAI,OAAO,IAAI,CAACJ,IAAI,CAACK,QAAQ,KAAK,UAAU,EAAE;MAC1C,IAAI,CAACL,IAAI,CAACK,QAAQ,CAACR,UAAU,EAAEC,OAAO,EAAEC,MAAM,CAAC,CAAA;AACnD,KAAA;AACJ,GAAA;AACA,EAAA,MACMO,cAAcA,CAACR,OAAe,EAAEC,MAAkB,EAAiB;AACrE,IAAA,MAAM,IAAI,CAACK,QAAQ,EAAE,CAAA;IACrB,IAAI,OAAO,IAAI,CAACJ,IAAI,CAACO,UAAU,KAAK,UAAU,EAAE;MAC5C,IAAI,CAACP,IAAI,CAACO,UAAU,CAACT,OAAO,EAAEC,MAAM,CAAC,CAAA;AACzC,KAAA;AACJ,GAAA;AACA,EAAA,MACMS,WAAWA,CAACV,OAAe,EAAEC,MAAa,EAAiB;AAC7D,IAAA,MAAM,IAAI,CAACK,QAAQ,EAAE,CAAA;IACrB,IAAI,OAAO,IAAI,CAACJ,IAAI,CAACS,OAAO,KAAK,UAAU,EAAE;MACzC,IAAI,CAACT,IAAI,CAACS,OAAO,CAACX,OAAO,EAAEC,MAAM,CAAC,CAAA;AACtC,KAAA;AACJ,GAAA;AAiFJ,CAAC,EAAAW,oBAAA,CA/EOC,kBAAA,CAwEH,mpEAAA,EAAA;AAAAC,EAAAA,KAAA,EAAAA,OAAA;AAAAC,IAAAA,UAAAA;AAAA,GAAA,CAAA;EAAAC,UAAA,EAAA,IAAA;AAKG,CAAC,CAAC,EAAApB,OAAA,CAAA,EAAAA,OAAA,CAAA,GAAAqB,yBAAA,CAAAtB,MAAA,CAAAuB,SAAA,EAAA,cAAA,EAAA,CApGLC,MAAM,CAAAC,EAAAA,MAAA,CAAAC,wBAAA,CAAA1B,MAAA,CAAAuB,SAAA,mBAAAvB,MAAA,CAAAuB,SAAA,CAAA,EAAAD,yBAAA,CAAAtB,MAAA,CAAAuB,SAAA,EAQNC,gBAAAA,EAAAA,CAAAA,MAAM,CAAAC,EAAAA,MAAA,CAAAC,wBAAA,CAAA1B,MAAA,CAAAuB,SAAA,EAAAvB,gBAAAA,CAAAA,EAAAA,MAAA,CAAAuB,SAAA,CAAAD,EAAAA,yBAAA,CAAAtB,MAAA,CAAAuB,SAAA,EAAA,aAAA,EAAA,CAONC,MAAM,CAAA,EAAAC,MAAA,CAAAC,wBAAA,CAAA1B,MAAA,CAAAuB,SAAA,EAAAvB,aAAAA,CAAAA,EAAAA,MAAA,CAAAuB,SAAA,IAAAvB,MAAA;;;;"}
@@ -0,0 +1,27 @@
1
+ import _applyDecoratedDescriptor from '@babel/runtime/helpers/esm/applyDecoratedDescriptor';
2
+ import ChangesetFormFieldsBase from './base.js';
3
+ import { action } from '@ember/object';
4
+ import { on } from '@ember/modifier';
5
+ import FormTextarea from '@frontile/forms/components/form-textarea';
6
+ import '@frontile/forms/components/form-input';
7
+ import { precompileTemplate } from '@ember/template-compilation';
8
+ import { setComponentTemplate } from '@ember/component';
9
+
10
+ var _class, _class2;
11
+ let ChangesetFormFieldsTextarea = (_class = (_class2 = class ChangesetFormFieldsTextarea extends ChangesetFormFieldsBase {
12
+ handleInput(value1, event1) {
13
+ this.args.changeset.set(this.args.fieldName, value1);
14
+ if (typeof this.args.onInput === 'function') {
15
+ this.args.onInput(value1, event1);
16
+ }
17
+ }
18
+ }, setComponentTemplate(precompileTemplate("\n <FormTextarea {{on \"blur\" this.validate}} @value={{this.value}} @onInput={{this.handleInput}} @errors={{this.errors}} @hasSubmitted={{@hasSubmitted}} @type={{@type}} @label={{@label}} @hint={{@hint}} @hasError={{@hasError}} @showError={{@showError}} @containerClass={{@containerClass}} @size={{@size}} @onChange={{@onChange}} @onFocusIn={{@onFocusIn}} @onFocusOut={{@onFocusOut}} ...attributes>\n {{yield}}\n </FormTextarea>\n ", {
19
+ scope: () => ({
20
+ FormTextarea,
21
+ on
22
+ }),
23
+ strictMode: true
24
+ }), _class2), _class2), (_applyDecoratedDescriptor(_class.prototype, "handleInput", [action], Object.getOwnPropertyDescriptor(_class.prototype, "handleInput"), _class.prototype)), _class);
25
+
26
+ export { ChangesetFormFieldsTextarea as default };
27
+ //# sourceMappingURL=textarea.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"textarea.js","sources":["../../../../src/components/changeset-form/fields/textarea.gts"],"sourcesContent":["import { template } from \"@ember/template-compiler\";\nimport Base, { type BaseArgs, type BaseSignature } from './base';\nimport { action } from '@ember/object';\nimport { on } from '@ember/modifier';\nimport FormTextarea from '@frontile/forms/components/form-textarea';\nimport { type FormInputArgs } from '@frontile/forms/components/form-input';\nexport interface ChangesetFormFieldsTextareaArgs extends BaseArgs, FormInputArgs {\n onInput?: (value: string, event: InputEvent) => void;\n}\nexport interface ChangesetFormFieldsTextareaSignature extends BaseSignature {\n Args: ChangesetFormFieldsTextareaArgs;\n Element: HTMLTextAreaElement;\n Blocks: {\n default: [];\n };\n}\nexport default class ChangesetFormFieldsTextarea extends Base<ChangesetFormFieldsTextareaSignature, string | undefined> {\n @action\n handleInput(value1: string, event1: InputEvent): void {\n this.args.changeset.set(this.args.fieldName, value1);\n if (typeof this.args.onInput === 'function') {\n this.args.onInput(value1, event1);\n }\n }\n static{\n template(`\n <FormTextarea\n {{on \"blur\" this.validate}}\n @value={{this.value}}\n @onInput={{this.handleInput}}\n @errors={{this.errors}}\n @hasSubmitted={{@hasSubmitted}}\n @type={{@type}}\n @label={{@label}}\n @hint={{@hint}}\n @hasError={{@hasError}}\n @showError={{@showError}}\n @containerClass={{@containerClass}}\n @size={{@size}}\n @onChange={{@onChange}}\n @onFocusIn={{@onFocusIn}}\n @onFocusOut={{@onFocusOut}}\n ...attributes\n >\n {{yield}}\n </FormTextarea>\n `, {\n component: this,\n eval () {\n return eval(arguments[0]);\n }\n });\n }\n}\n"],"names":["ChangesetFormFieldsTextarea","_class","_class2","Base","handleInput","value1","event1","args","changeset","set","fieldName","onInput","setComponentTemplate","precompileTemplate","scope","FormTextarea","on","strictMode","_applyDecoratedDescriptor","prototype","action","Object","getOwnPropertyDescriptor"],"mappings":";;;;;;;;;;AAgBqBA,IAAAA,2BAA2B,IAAAC,MAAA,IAAAC,OAAA,GAAjC,MAAMF,2BAA2B,SAASG,uBAAI,CAA2D;AAEpHC,EAAAA,WAAWA,CAACC,MAAc,EAAEC,MAAkB,EAAQ;AAClD,IAAA,IAAI,CAACC,IAAI,CAACC,SAAS,CAACC,GAAG,CAAC,IAAI,CAACF,IAAI,CAACG,SAAS,EAAEL,MAAM,CAAC,CAAA;IACpD,IAAI,OAAO,IAAI,CAACE,IAAI,CAACI,OAAO,KAAK,UAAU,EAAE;MACzC,IAAI,CAACJ,IAAI,CAACI,OAAO,CAACN,MAAM,EAAEC,MAAM,CAAC,CAAA;AACrC,KAAA;AACJ,GAAA;AA8BJ,CAAC,EAAAM,oBAAA,CA5BOC,kBAAA,CAqBH,8bAAA,EAAA;AAAAC,EAAAA,KAAA,EAAAA,OAAA;IAAAC,YAAA;AAAAC,IAAAA,EAAAA;AAAA,GAAA,CAAA;EAAAC,UAAA,EAAA,IAAA;AAKG,CAAC,CAAC,EAAAf,OAAA,CAAAA,EAAAA,OAAA,CAAAgB,GAAAA,yBAAA,CAAAjB,MAAA,CAAAkB,SAAA,EAlCLC,aAAAA,EAAAA,CAAAA,MAAM,GAAAC,MAAA,CAAAC,wBAAA,CAAArB,MAAA,CAAAkB,SAAA,EAAA,aAAA,CAAA,EAAAlB,MAAA,CAAAkB,SAAA,CAAA,GAAAlB,MAAA;;;;"}
@@ -0,0 +1,85 @@
1
+ import _initializerDefineProperty from '@babel/runtime/helpers/esm/initializerDefineProperty';
2
+ import '@babel/runtime/helpers/esm/defineProperty';
3
+ import _applyDecoratedDescriptor from '@babel/runtime/helpers/esm/applyDecoratedDescriptor';
4
+ import '@babel/runtime/helpers/esm/initializerWarningHelper';
5
+ import Component from '@glimmer/component';
6
+ import { tracked } from '@glimmer/tracking';
7
+ import { action } from '@ember/object';
8
+ import { assert } from '@ember/debug';
9
+ import { next } from '@ember/runloop';
10
+ import { fn, hash } from '@ember/helper';
11
+ import { on } from '@ember/modifier';
12
+ import ChangesetFormFieldsInput from './fields/input.js';
13
+ import ChangesetFormFieldsTextarea from './fields/textarea.js';
14
+ import ChangesetFormFieldsSelect from './fields/select.js';
15
+ import ChangesetFormFieldsCheckbox from './fields/checkbox.js';
16
+ import ChangesetFormFieldsCheckboxGroup from './fields/checkbox-group.js';
17
+ import ChangesetFormFieldsRadio from './fields/radio.js';
18
+ import ChangesetFormFieldsRadioGroup from './fields/radio-group.js';
19
+ import { precompileTemplate } from '@ember/template-compilation';
20
+ import { setComponentTemplate } from '@ember/component';
21
+
22
+ var _class, _descriptor, _class2;
23
+ let ChangesetForm = (_class = (_class2 = class ChangesetForm extends Component {
24
+ constructor(owner1, args1) {
25
+ super(owner1, args1);
26
+ _initializerDefineProperty(this, "hasSubmitted", _descriptor, this);
27
+ assert('@changeset must be defined on <ChangesetForm> component', this.args.changeset);
28
+ if (this.args.validateOnInit) {
29
+ next(() => {
30
+ this.args.changeset.validate();
31
+ });
32
+ }
33
+ }
34
+ async handleSubmit(changeset1, event1) {
35
+ event1.preventDefault();
36
+ await changeset1.validate();
37
+ this.hasSubmitted = true;
38
+ if (changeset1.isInvalid) {
39
+ return;
40
+ }
41
+ let result1;
42
+ if (this.args.runExecuteInsteadOfSave) {
43
+ result1 = changeset1.execute();
44
+ } else {
45
+ result1 = await changeset1.save({});
46
+ }
47
+ if (typeof this.args.onSubmit === 'function') {
48
+ this.args.onSubmit(result1.data, event1);
49
+ }
50
+ }
51
+ handleReset(changeset1, event1) {
52
+ event1.preventDefault();
53
+ this.hasSubmitted = false;
54
+ const {
55
+ data: data1
56
+ } = changeset1.rollback();
57
+ if (typeof this.args.onReset === 'function') {
58
+ this.args.onReset(data1, event1);
59
+ }
60
+ }
61
+ }, setComponentTemplate(precompileTemplate("\n <form ...attributes {{on \"submit\" (fn this.handleSubmit @changeset)}} {{on \"reset\" (fn this.handleReset @changeset)}}>\n\n {{yield (hash Input=(component ChangesetFormFieldsInput changeset=@changeset hasSubmitted=this.hasSubmitted showError=@alwaysShowErrors) Textarea=(component ChangesetFormFieldsTextarea changeset=@changeset hasSubmitted=this.hasSubmitted showError=@alwaysShowErrors) Select=(component ChangesetFormFieldsSelect changeset=@changeset hasSubmitted=this.hasSubmitted showError=@alwaysShowErrors) Checkbox=(component ChangesetFormFieldsCheckbox changeset=@changeset hasSubmitted=this.hasSubmitted showError=@alwaysShowErrors) CheckboxGroup=(component ChangesetFormFieldsCheckboxGroup changeset=@changeset hasSubmitted=this.hasSubmitted showError=@alwaysShowErrors) Radio=(component ChangesetFormFieldsRadio changeset=@changeset hasSubmitted=this.hasSubmitted showError=@alwaysShowErrors) RadioGroup=(component ChangesetFormFieldsRadioGroup changeset=@changeset hasSubmitted=this.hasSubmitted showError=@alwaysShowErrors) state=(hash hasSubmitted=this.hasSubmitted))}}\n\n </form>\n ", {
62
+ scope: () => ({
63
+ on,
64
+ fn,
65
+ hash,
66
+ ChangesetFormFieldsInput,
67
+ ChangesetFormFieldsTextarea,
68
+ ChangesetFormFieldsSelect,
69
+ ChangesetFormFieldsCheckbox,
70
+ ChangesetFormFieldsCheckboxGroup,
71
+ ChangesetFormFieldsRadio,
72
+ ChangesetFormFieldsRadioGroup
73
+ }),
74
+ strictMode: true
75
+ }), _class2), _class2), (_descriptor = _applyDecoratedDescriptor(_class.prototype, "hasSubmitted", [tracked], {
76
+ configurable: true,
77
+ enumerable: true,
78
+ writable: true,
79
+ initializer: function () {
80
+ return false;
81
+ }
82
+ }), _applyDecoratedDescriptor(_class.prototype, "handleSubmit", [action], Object.getOwnPropertyDescriptor(_class.prototype, "handleSubmit"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "handleReset", [action], Object.getOwnPropertyDescriptor(_class.prototype, "handleReset"), _class.prototype)), _class);
83
+
84
+ export { ChangesetForm as default };
85
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/changeset-form/index.gts"],"sourcesContent":["import { template } from \"@ember/template-compiler\";\nimport Component from '@glimmer/component';\nimport { tracked } from '@glimmer/tracking';\nimport { action } from '@ember/object';\nimport { assert } from '@ember/debug';\nimport { next } from '@ember/runloop';\nimport { hash, fn } from '@ember/helper';\nimport { on } from '@ember/modifier';\nimport ChangesetFormFieldsInput from './fields/input';\nimport ChangesetFormFieldsTextarea from './fields/textarea';\nimport ChangesetFormFieldsSelect from './fields/select';\nimport ChangesetFormFieldsCheckbox from './fields/checkbox';\nimport ChangesetFormFieldsCheckboxGroup from './fields/checkbox-group';\nimport ChangesetFormFieldsRadio from './fields/radio';\nimport ChangesetFormFieldsRadioGroup from './fields/radio-group';\nimport type { BufferedChangeset } from 'ember-changeset/types';\nimport type { WithBoundArgs } from '@glint/template';\nexport interface ChangesetFormArgs {\n /** Changeset Object */ changeset: BufferedChangeset;\n /**\n * Run Changeset execute method instead of save\n * @defaultValue false\n * */ runExecuteInsteadOfSave?: boolean;\n /**\n * Always show errors if there are any\n * @defaultValue false\n */ alwaysShowErrors?: boolean;\n /**\n * Validate the changeset on initialization\n * @defaultValue false\n */ validateOnInit?: boolean;\n /** Callback executed when from `onsubmit` event is triggered */ onSubmit?: (data: unknown, event: Event) => void;\n /** Callback executed when from `onreset` event is triggered */ onReset?: (data: unknown, event: Event) => void;\n}\nexport interface ChangesetFormSignature {\n Args: ChangesetFormArgs;\n Blocks: {\n default: [{\n Input: WithBoundArgs<typeof ChangesetFormFieldsInput, 'changeset'> & WithBoundArgs<typeof ChangesetFormFieldsInput, 'hasSubmitted'> & WithBoundArgs<typeof ChangesetFormFieldsInput, 'showError'>;\n Textarea: WithBoundArgs<typeof ChangesetFormFieldsTextarea, 'changeset'> & WithBoundArgs<typeof ChangesetFormFieldsTextarea, 'hasSubmitted'> & WithBoundArgs<typeof ChangesetFormFieldsTextarea, 'showError'>;\n Select: WithBoundArgs<typeof ChangesetFormFieldsSelect, 'changeset'> & WithBoundArgs<typeof ChangesetFormFieldsSelect, 'hasSubmitted'> & WithBoundArgs<typeof ChangesetFormFieldsSelect, 'showError'>;\n Checkbox: WithBoundArgs<typeof ChangesetFormFieldsCheckbox, 'changeset'>;\n CheckboxGroup: WithBoundArgs<typeof ChangesetFormFieldsCheckboxGroup, 'changeset'> & WithBoundArgs<typeof ChangesetFormFieldsCheckboxGroup, 'hasSubmitted'> & WithBoundArgs<typeof ChangesetFormFieldsCheckboxGroup, 'showError'>;\n Radio: WithBoundArgs<typeof ChangesetFormFieldsRadio, 'changeset'>;\n RadioGroup: WithBoundArgs<typeof ChangesetFormFieldsRadioGroup, 'changeset'> & WithBoundArgs<typeof ChangesetFormFieldsRadioGroup, 'hasSubmitted'> & WithBoundArgs<typeof ChangesetFormFieldsRadioGroup, 'showError'>;\n state: {\n hasSubmitted: boolean;\n };\n }];\n };\n Element: HTMLFormElement;\n}\nexport default class ChangesetForm extends Component<ChangesetFormSignature> {\n @tracked\n hasSubmitted = false;\n constructor(owner1: unknown, args1: ChangesetFormArgs){\n super(owner1, args1);\n assert('@changeset must be defined on <ChangesetForm> component', this.args.changeset);\n if (this.args.validateOnInit) {\n next(()=>{\n this.args.changeset.validate();\n });\n }\n }\n @action\n async handleSubmit(changeset1: BufferedChangeset, event1: Event): Promise<void> {\n event1.preventDefault();\n await changeset1.validate();\n this.hasSubmitted = true;\n if (changeset1.isInvalid) {\n return;\n }\n let result1;\n if (this.args.runExecuteInsteadOfSave) {\n result1 = changeset1.execute();\n } else {\n result1 = await changeset1.save({});\n }\n if (typeof this.args.onSubmit === 'function') {\n this.args.onSubmit(result1.data, event1);\n }\n }\n @action\n handleReset(changeset1: BufferedChangeset, event1: Event): void {\n event1.preventDefault();\n this.hasSubmitted = false;\n const { data: data1 } = changeset1.rollback();\n if (typeof this.args.onReset === 'function') {\n this.args.onReset(data1, event1);\n }\n }\n static{\n template(`\n <form\n ...attributes\n {{on \"submit\" (fn this.handleSubmit @changeset)}}\n {{on \"reset\" (fn this.handleReset @changeset)}}\n >\n\n {{yield\n (hash\n Input=(component\n ChangesetFormFieldsInput\n changeset=@changeset\n hasSubmitted=this.hasSubmitted\n showError=@alwaysShowErrors\n )\n Textarea=(component\n ChangesetFormFieldsTextarea\n changeset=@changeset\n hasSubmitted=this.hasSubmitted\n showError=@alwaysShowErrors\n )\n Select=(component\n ChangesetFormFieldsSelect\n changeset=@changeset\n hasSubmitted=this.hasSubmitted\n showError=@alwaysShowErrors\n )\n Checkbox=(component\n ChangesetFormFieldsCheckbox\n changeset=@changeset\n hasSubmitted=this.hasSubmitted\n showError=@alwaysShowErrors\n )\n CheckboxGroup=(component\n ChangesetFormFieldsCheckboxGroup\n changeset=@changeset\n hasSubmitted=this.hasSubmitted\n showError=@alwaysShowErrors\n )\n Radio=(component\n ChangesetFormFieldsRadio\n changeset=@changeset\n hasSubmitted=this.hasSubmitted\n showError=@alwaysShowErrors\n )\n RadioGroup=(component\n ChangesetFormFieldsRadioGroup\n changeset=@changeset\n hasSubmitted=this.hasSubmitted\n showError=@alwaysShowErrors\n )\n state=(hash hasSubmitted=this.hasSubmitted)\n )\n }}\n\n </form>\n `, {\n component: this,\n eval () {\n return eval(arguments[0]);\n }\n });\n }\n}\n"],"names":["ChangesetForm","_class","_class2","Component","constructor","owner1","args1","_initializerDefineProperty","_descriptor","assert","args","changeset","validateOnInit","next","validate","handleSubmit","changeset1","event1","preventDefault","hasSubmitted","isInvalid","result1","runExecuteInsteadOfSave","execute","save","onSubmit","data","handleReset","data1","rollback","onReset","setComponentTemplate","precompileTemplate","scope","on","fn","hash","ChangesetFormFieldsInput","ChangesetFormFieldsTextarea","ChangesetFormFieldsSelect","ChangesetFormFieldsCheckbox","ChangesetFormFieldsCheckboxGroup","ChangesetFormFieldsRadio","ChangesetFormFieldsRadioGroup","strictMode","_applyDecoratedDescriptor","prototype","tracked","configurable","enumerable","writable","initializer","action","Object","getOwnPropertyDescriptor"],"mappings":"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"}
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=template-registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template-registry.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@frontile/changeset-form",
3
- "version": "0.15.0",
3
+ "version": "0.16.0-alpha.0",
4
4
  "description": "Component Library for Ember Octane apps: ChangesetForm",
5
5
  "keywords": [
6
6
  "ember-addon",
@@ -9,62 +9,59 @@
9
9
  "repository": "https://github.com/josemarluedke/frontile",
10
10
  "license": "MIT",
11
11
  "author": "",
12
- "directories": {
13
- "doc": "doc",
14
- "test": "tests"
15
- },
12
+ "files": [
13
+ "addon-main.js",
14
+ "declarations",
15
+ "dist",
16
+ "tailwind"
17
+ ],
16
18
  "scripts": {
17
- "build": "ember build --environment=production",
18
- "start": "ember serve",
19
- "test": "ember test",
20
- "test:all": "ember try:each",
21
- "try:one": "ember try:one",
22
- "prepack": "ember ts:precompile",
23
- "postpack": "ember ts:clean"
19
+ "build": "concurrently -m 1 'npm:build:*'",
20
+ "build:js": "rollup --config",
21
+ "build:types": "glint --declaration",
22
+ "lint": "concurrently 'npm:lint:*(!fix)' --names 'lint:'",
23
+ "lint:fix": "concurrently 'npm:lint:*:fix' --names 'fix:'",
24
+ "lint:hbs": "ember-template-lint . --no-error-on-unmatched-pattern",
25
+ "lint:js": "eslint . --cache",
26
+ "lint:hbs:fix": "ember-template-lint . --fix --no-error-on-unmatched-pattern",
27
+ "lint:js:fix": "eslint . --fix",
28
+ "lint:types": "glint",
29
+ "start": "concurrently 'npm:start:*'",
30
+ "start:js": "rollup --config --watch --no-watch.clearScreen",
31
+ "start:types": "glint -d --watch",
32
+ "test": "echo 'A v2 addon does not have tests, run tests in test-app'",
33
+ "prepack": "concurrently 'npm:build'"
24
34
  },
25
35
  "peerDependencies": {
36
+ "@babel/runtime": ">= 7",
26
37
  "ember-source": "^4.0.0 || ^5.0.0"
27
38
  },
28
39
  "dependencies": {
29
- "@frontile/forms": "^0.15.0",
40
+ "@embroider/addon-shim": "^1.8.7",
41
+ "@frontile/forms": "^0.16.0-alpha.0",
42
+ "@glint/template": "1.2.1",
30
43
  "ember-changeset": "^4.1.2",
31
- "ember-changeset-validations": "^4.1.1",
32
- "ember-cli-babel": "^7.26.11",
33
- "ember-cli-htmlbars": "^6.2.0",
34
- "ember-cli-typescript": "^5.2.1"
44
+ "ember-changeset-validations": "^4.1.1"
35
45
  },
36
46
  "devDependencies": {
37
- "@babel/core": "^7.22.9",
38
- "@ember/optional-features": "^2.0.0",
39
- "@ember/test-helpers": "^3.2.0",
40
- "@embroider/test-setup": "^3.0.1",
41
- "@frontile/core": "^0.15.0",
42
- "@glimmer/component": "^1.1.2",
43
- "@glimmer/tracking": "^1.1.2",
44
- "@types/ember-qunit": "^6.1.1",
45
- "@types/ember-resolver": "^9.0.0",
46
- "@types/htmlbars-inline-precompile": "^3.0.0",
47
- "@types/qunit": "^2.19.6",
48
- "@types/rsvp": "^4.0.4",
49
- "broccoli-asset-rev": "^3.0.0",
50
- "ember-auto-import": "^2.6.3",
51
- "ember-cli": "^5.1.0",
52
- "ember-cli-dependency-checker": "^3.3.2",
53
- "ember-cli-inject-live-reload": "^2.1.0",
54
- "ember-cli-typescript-blueprints": "^3.0.0",
55
- "ember-cli-uglify": "^3.0.0",
56
- "ember-disable-prototype-extensions": "^1.1.3",
57
- "ember-load-initializers": "^2.1.2",
58
- "ember-qunit": "^7.0.0",
59
- "ember-resolver": "^11.0.0",
60
- "ember-source": "^5.1.2",
61
- "ember-try": "^2.0.0",
62
- "loader.js": "^4.7.0",
63
- "qunit": "^2.19.4",
64
- "qunit-dom": "^2.0.0",
47
+ "@babel/core": "7.23.6",
48
+ "@babel/plugin-proposal-class-properties": "7.18.6",
49
+ "@babel/plugin-proposal-decorators": "7.23.6",
50
+ "@babel/plugin-transform-class-static-block": "^7.23.4",
51
+ "@babel/preset-typescript": "7.23.3",
52
+ "@embroider/addon-dev": "4.1.3",
53
+ "@glint/core": "1.2.1",
54
+ "@glint/environment-ember-loose": "1.2.1",
55
+ "@glint/environment-ember-template-imports": "1.2.1",
56
+ "@rollup/plugin-node-resolve": "^15.2.3",
57
+ "@tsconfig/ember": "^3.0.3",
58
+ "babel-plugin-ember-template-compilation": "^2.2.1",
59
+ "concurrently": "^8.2.0",
60
+ "ember-source": "^5.5.0",
61
+ "rollup": "^4.9.1",
62
+ "rollup-plugin-ts": "^3.4.5",
65
63
  "tailwindcss": "^3.3.3",
66
- "typescript": "^5.1.6",
67
- "webpack": "^5.88.2"
64
+ "typescript": "^5.3.3"
68
65
  },
69
66
  "engines": {
70
67
  "node": ">= 10.*"
@@ -76,7 +73,41 @@
76
73
  "edition": "octane"
77
74
  },
78
75
  "ember-addon": {
79
- "configPath": "tests/dummy/config"
76
+ "version": 2,
77
+ "type": "addon",
78
+ "main": "addon-main.js",
79
+ "app-js": {
80
+ "./components/changeset-form/fields/base.js": "./dist/_app_/components/changeset-form/fields/base.js",
81
+ "./components/changeset-form/fields/checkbox-group.js": "./dist/_app_/components/changeset-form/fields/checkbox-group.js",
82
+ "./components/changeset-form/fields/checkbox.js": "./dist/_app_/components/changeset-form/fields/checkbox.js",
83
+ "./components/changeset-form/fields/input.js": "./dist/_app_/components/changeset-form/fields/input.js",
84
+ "./components/changeset-form/fields/radio-group.js": "./dist/_app_/components/changeset-form/fields/radio-group.js",
85
+ "./components/changeset-form/fields/radio.js": "./dist/_app_/components/changeset-form/fields/radio.js",
86
+ "./components/changeset-form/fields/select.js": "./dist/_app_/components/changeset-form/fields/select.js",
87
+ "./components/changeset-form/fields/textarea.js": "./dist/_app_/components/changeset-form/fields/textarea.js",
88
+ "./components/changeset-form/index.js": "./dist/_app_/components/changeset-form/index.js"
89
+ }
90
+ },
91
+ "exports": {
92
+ ".": {
93
+ "types": "./declarations/index.d.ts",
94
+ "default": "./dist/index.js"
95
+ },
96
+ "./*": {
97
+ "types": "./declarations/*.d.ts",
98
+ "default": "./dist/*.js"
99
+ },
100
+ "./addon-main.js": "./addon-main.js",
101
+ "./tailwind": {
102
+ "default": "./tailwind/index.js"
103
+ }
104
+ },
105
+ "typesVersions": {
106
+ "*": {
107
+ "*": [
108
+ "declarations/*"
109
+ ]
110
+ }
80
111
  },
81
- "gitHead": "b038ebd4a286717de3339de658c6c32d628ae4f0"
112
+ "gitHead": "c1f2fb51b859e18d1bcb94090055ad9c1128d4d3"
82
113
  }
@@ -1,75 +0,0 @@
1
- import Component from '@glimmer/component';
2
- import { BufferedChangeset } from 'ember-changeset/types';
3
- import { assert } from '@ember/debug';
4
- import { action } from '@ember/object';
5
- import { later } from '@ember/runloop';
6
-
7
- export interface BaseArgs {
8
- changeset: BufferedChangeset;
9
- fieldName: string;
10
- errors?: string[];
11
- }
12
-
13
- export interface BaseSignature {
14
- Args: BaseArgs;
15
- }
16
-
17
- export interface ValidationError {
18
- key: string;
19
- value: unknown;
20
- validation: string[] | string;
21
- }
22
-
23
- export default class ChangesetFormFieldsBase<
24
- T extends BaseSignature
25
- > extends Component<T> {
26
- constructor(owner: unknown, args: T['Args']) {
27
- super(owner, args);
28
-
29
- assert(
30
- '<ChangesetForm> fields must receive @changeset',
31
- typeof this.args.changeset !== 'undefined'
32
- );
33
-
34
- assert(
35
- '<ChangesetForm> fields must receive @fieldName',
36
- typeof this.args.fieldName !== 'undefined'
37
- );
38
- }
39
-
40
- get value(): unknown {
41
- return this.args.changeset.get(this.args.fieldName);
42
- }
43
-
44
- get errors(): string[] {
45
- if (typeof this.args.errors !== 'undefined') {
46
- return this.args.errors;
47
- }
48
-
49
- const fieldErrors = this.args.changeset.errors.filter((error) => {
50
- return error.key === this.args.fieldName;
51
- });
52
-
53
- return fieldErrors.reduce(
54
- (errors: string[], error: ValidationError): string[] => {
55
- if (Array.isArray(error.validation)) {
56
- return [...errors, ...error.validation];
57
- } else {
58
- return [...errors, error.validation];
59
- }
60
- },
61
- []
62
- );
63
- }
64
-
65
- @action
66
- async validate(): Promise<void> {
67
- later(
68
- this,
69
- () => {
70
- this.args.changeset.validate(this.args.fieldName);
71
- },
72
- 1
73
- );
74
- }
75
- }
@@ -1,24 +0,0 @@
1
- <FormCheckboxGroup
2
- @onChange={{this.handleChange}}
3
- @errors={{this.errors}}
4
-
5
- @label={{@label}}
6
- @hint={{@hint}}
7
- @hasError={{@hasError}}
8
- @showError={{@showError}}
9
- @hasSubmitted={{@hasSubmitted}}
10
- @containerClass={{@containerClass}}
11
- @size={{@size}}
12
- @isInline={{@isInline}}
13
-
14
- ...attributes
15
- as |Checkbox api|
16
- >
17
- {{yield (component "changeset-form/fields/checkbox"
18
- _groupName=@groupName
19
- _parentOnChange=api.onChange
20
- changeset=@changeset
21
- size=@size
22
- )
23
- }}
24
- </FormCheckboxGroup>
@@ -1,68 +0,0 @@
1
- import Component from '@glimmer/component';
2
- import { BufferedChangeset } from 'ember-changeset/types';
3
- import { assert } from '@ember/debug';
4
- import { action } from '@ember/object';
5
- import { BaseArgs, BaseSignature, ValidationError } from './base';
6
- import ChangesetFormFieldsCheckbox from './checkbox';
7
-
8
- export interface ChangesetFormFieldsGroupArgs extends BaseArgs {
9
- errors?: string[];
10
- changeset: BufferedChangeset;
11
- groupName?: string;
12
- onChange?: (value: unknown, event: Event) => void;
13
- }
14
-
15
- export interface ChangesetFormFieldsCheckboxGroupSignature
16
- extends BaseSignature {
17
- Args: ChangesetFormFieldsGroupArgs;
18
- Blocks: {
19
- default: [checkbox: ChangesetFormFieldsCheckbox];
20
- };
21
- Element: HTMLDivElement;
22
- }
23
-
24
- export default class ChangesetFormFieldsCheckboxGroup extends Component<ChangesetFormFieldsCheckboxGroupSignature> {
25
- constructor(owner: unknown, args: ChangesetFormFieldsGroupArgs) {
26
- super(owner, args);
27
-
28
- assert(
29
- '<ChangesetForm> fields must receive @changeset',
30
- typeof this.args.changeset !== 'undefined'
31
- );
32
- }
33
-
34
- get errors(): string[] {
35
- if (typeof this.args.errors !== 'undefined') {
36
- return this.args.errors;
37
- }
38
-
39
- if (!this.args.groupName) {
40
- return [];
41
- }
42
-
43
- const fieldErrors = this.args.changeset.errors.filter((error) => {
44
- return error.key === this.args.groupName;
45
- });
46
-
47
- return fieldErrors.reduce(
48
- (errors: string[], error: ValidationError): string[] => {
49
- return [...errors, ...error.validation];
50
- },
51
- []
52
- );
53
- }
54
-
55
- @action async validate(): Promise<void> {
56
- if (this.args.groupName) {
57
- await this.args.changeset.validate(this.args.groupName);
58
- }
59
- }
60
-
61
- @action handleChange(value: unknown, event: Event): void {
62
- this.validate();
63
-
64
- if (typeof this.args.onChange === 'function') {
65
- this.args.onChange(value, event);
66
- }
67
- }
68
- }
@@ -1,15 +0,0 @@
1
- <FormCheckbox
2
- @onChange={{this.handleChange}}
3
- @checked={{this.value}}
4
- @hint={{@hint}}
5
- @name={{@name}}
6
- @containerClass={{@containerClass}}
7
- @size={{@size}}
8
- ...attributes
9
- >
10
- {{#if (has-block)}}
11
- {{yield}}
12
- {{else}}
13
- {{@label}}
14
- {{/if}}
15
- </FormCheckbox>