@frontile/changeset-form 0.12.2
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/LICENSE.md +9 -0
- package/README.md +37 -0
- package/addon/components/changeset-form/context/index.hbs +15 -0
- package/addon/components/changeset-form/fields/base.ts +71 -0
- package/addon/components/changeset-form/fields/checkbox-group.hbs +23 -0
- package/addon/components/changeset-form/fields/checkbox-group.ts +58 -0
- package/addon/components/changeset-form/fields/checkbox.hbs +15 -0
- package/addon/components/changeset-form/fields/checkbox.ts +56 -0
- package/addon/components/changeset-form/fields/input.hbs +22 -0
- package/addon/components/changeset-form/fields/input.ts +16 -0
- package/addon/components/changeset-form/fields/radio-group.hbs +18 -0
- package/addon/components/changeset-form/fields/radio-group.ts +20 -0
- package/addon/components/changeset-form/fields/radio.hbs +17 -0
- package/addon/components/changeset-form/fields/radio.ts +20 -0
- package/addon/components/changeset-form/fields/select.hbs +72 -0
- package/addon/components/changeset-form/fields/select.ts +43 -0
- package/addon/components/changeset-form/fields/textarea.hbs +22 -0
- package/addon/components/changeset-form/fields/textarea.ts +16 -0
- package/addon/components/changeset-form/index.hbs +23 -0
- package/addon/components/changeset-form/index.ts +71 -0
- package/app/components/changeset-form/context/index.js +1 -0
- package/app/components/changeset-form/fields/checkbox-group.js +1 -0
- package/app/components/changeset-form/fields/checkbox.js +1 -0
- package/app/components/changeset-form/fields/input.js +1 -0
- package/app/components/changeset-form/fields/radio-group.js +1 -0
- package/app/components/changeset-form/fields/radio.js +1 -0
- package/app/components/changeset-form/fields/select.js +1 -0
- package/app/components/changeset-form/fields/textarea.js +1 -0
- package/app/components/changeset-form.js +1 -0
- package/components/changeset-form/fields/base.d.ts +18 -0
- package/components/changeset-form/fields/checkbox-group.d.ts +15 -0
- package/components/changeset-form/fields/checkbox.d.ts +14 -0
- package/components/changeset-form/fields/input.d.ts +8 -0
- package/components/changeset-form/fields/radio-group.d.ts +8 -0
- package/components/changeset-form/fields/radio.d.ts +8 -0
- package/components/changeset-form/fields/select.d.ts +13 -0
- package/components/changeset-form/fields/textarea.d.ts +8 -0
- package/components/changeset-form/index.d.ts +22 -0
- package/config/environment.js +5 -0
- package/docs/changeset-form-usage-demo/demo.md +122 -0
- package/docs/changeset-form-usage.md +134 -0
- package/index.js +5 -0
- package/package.json +82 -0
- package/tsconfig.json +24 -0
- package/types/dummy/index.d.ts +0 -0
- package/types/ember-changeset-validations.d.ts +56 -0
- package/types/ember-power-select/test-support.d.ts +29 -0
- package/types/global.d.ts +6 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@frontile/changeset-form/components/changeset-form/fields/radio';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@frontile/changeset-form/components/changeset-form/fields/select';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@frontile/changeset-form/components/changeset-form/fields/textarea';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@frontile/changeset-form/components/changeset-form';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { BufferedChangeset } from 'ember-changeset/types';
|
|
3
|
+
export interface BaseArgs {
|
|
4
|
+
changeset: BufferedChangeset;
|
|
5
|
+
fieldName: string;
|
|
6
|
+
errors?: string[];
|
|
7
|
+
}
|
|
8
|
+
export interface ValidationError {
|
|
9
|
+
key: string;
|
|
10
|
+
value: unknown;
|
|
11
|
+
validation: string[] | string;
|
|
12
|
+
}
|
|
13
|
+
export default class ChangesetFormFieldsBase<T extends BaseArgs> extends Component<T> {
|
|
14
|
+
constructor(owner: unknown, args: T);
|
|
15
|
+
get value(): unknown;
|
|
16
|
+
get errors(): string[];
|
|
17
|
+
validate(): Promise<void>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { BufferedChangeset } from 'ember-changeset/types';
|
|
3
|
+
interface ChangesetFormFieldsGroupArgs {
|
|
4
|
+
errors?: string[];
|
|
5
|
+
changeset: BufferedChangeset;
|
|
6
|
+
groupName?: string;
|
|
7
|
+
onChange?: (value: unknown, event: Event) => void;
|
|
8
|
+
}
|
|
9
|
+
export default class ChangesetFormFieldsCheckboxGroup extends Component<ChangesetFormFieldsGroupArgs> {
|
|
10
|
+
constructor(owner: unknown, args: ChangesetFormFieldsGroupArgs);
|
|
11
|
+
get errors(): string[];
|
|
12
|
+
validate(): Promise<void>;
|
|
13
|
+
handleChange(value: unknown, event: Event): void;
|
|
14
|
+
}
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import Base, { BaseArgs } from './base';
|
|
2
|
+
interface ChangesetFormFieldsCheckboxArgs extends BaseArgs {
|
|
3
|
+
_groupName?: string;
|
|
4
|
+
_parentOnChange?: (value: unknown, event: Event) => void;
|
|
5
|
+
onChange?: (value: unknown, event: Event) => void;
|
|
6
|
+
}
|
|
7
|
+
export default class ChangesetFormFieldsCheckbox extends Base<ChangesetFormFieldsCheckboxArgs> {
|
|
8
|
+
get fullFieldName(): string;
|
|
9
|
+
get value(): unknown;
|
|
10
|
+
get errors(): string[];
|
|
11
|
+
validate(): Promise<void>;
|
|
12
|
+
handleChange(value: unknown, event: Event): Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import Base, { BaseArgs } from './base';
|
|
2
|
+
interface ChangesetFormFieldsInputArgs extends BaseArgs {
|
|
3
|
+
onInput?: (value: string, event: InputEvent) => void;
|
|
4
|
+
}
|
|
5
|
+
export default class ChangesetFormFieldsInput extends Base<ChangesetFormFieldsInputArgs> {
|
|
6
|
+
handleInput(value: string, event: InputEvent): void;
|
|
7
|
+
}
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import Base, { BaseArgs } from './base';
|
|
2
|
+
interface Args extends BaseArgs {
|
|
3
|
+
onChange?: (value: unknown, event: Event) => void;
|
|
4
|
+
}
|
|
5
|
+
export default class ChangesetFormFieldsRadioGroup extends Base<Args> {
|
|
6
|
+
handleChange(value: unknown, event: Event): Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import Base, { BaseArgs } from './base';
|
|
2
|
+
interface ChangesetFormFieldsRadioArgs extends BaseArgs {
|
|
3
|
+
onChange?: (value: unknown, event: Event) => void;
|
|
4
|
+
}
|
|
5
|
+
export default class ChangesetFormFieldsRadio extends Base<ChangesetFormFieldsRadioArgs> {
|
|
6
|
+
handleChange(value: unknown, event: Event): Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import Base, { BaseArgs } from './base';
|
|
2
|
+
import { Select } from 'ember-power-select/addon/components/power-select';
|
|
3
|
+
interface ChangesetFormFieldsSelectArgs extends BaseArgs {
|
|
4
|
+
onChange?: (selection: unknown, select: Select, event?: Event) => void;
|
|
5
|
+
onFocusOut?: (select: Select, event: FocusEvent) => void;
|
|
6
|
+
onClose?: (select: Select, event: Event) => void;
|
|
7
|
+
}
|
|
8
|
+
export default class ChangesetFormFieldsSelect extends Base<ChangesetFormFieldsSelectArgs> {
|
|
9
|
+
handleChange(selection: unknown, select: Select, event?: Event): Promise<void>;
|
|
10
|
+
handleFocusOut(select: Select, event: FocusEvent): Promise<void>;
|
|
11
|
+
handleClose(select: Select, event: Event): Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import Base, { BaseArgs } from './base';
|
|
2
|
+
interface ChangesetFormFieldsTextareaArgs extends BaseArgs {
|
|
3
|
+
onInput?: (value: string, event: InputEvent) => void;
|
|
4
|
+
}
|
|
5
|
+
export default class ChangesetFormFieldsTextarea extends Base<ChangesetFormFieldsTextareaArgs> {
|
|
6
|
+
handleInput(value: string, event: InputEvent): void;
|
|
7
|
+
}
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { BufferedChangeset } from 'ember-changeset/types';
|
|
3
|
+
interface ChangesetFormArgs {
|
|
4
|
+
/** Changeset Object */
|
|
5
|
+
changeset: BufferedChangeset;
|
|
6
|
+
/**
|
|
7
|
+
* Run Changeset execute method instead of save
|
|
8
|
+
* @defaultValue false
|
|
9
|
+
* */
|
|
10
|
+
runExecuteInsteadOfSave?: boolean;
|
|
11
|
+
/** Callback exeuted when from `onsubmit` event is triggered */
|
|
12
|
+
onSubmit?: (data: unknown, event: Event) => void;
|
|
13
|
+
/** Callback exeuted when from `onreset` event is triggered */
|
|
14
|
+
onReset?: (data: unknown, event: Event) => void;
|
|
15
|
+
}
|
|
16
|
+
export default class ChangesetForm extends Component<ChangesetFormArgs> {
|
|
17
|
+
hasSubmitted: boolean;
|
|
18
|
+
constructor(owner: unknown, args: ChangesetFormArgs);
|
|
19
|
+
handleSubmit(changeset: BufferedChangeset, event: Event): Promise<void>;
|
|
20
|
+
handleReset(changeset: BufferedChangeset, event: Event): void;
|
|
21
|
+
}
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
---
|
|
2
|
+
order: 1
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Complete Form
|
|
6
|
+
|
|
7
|
+
This shows how to have a complete form using `ChangesetForm`.
|
|
8
|
+
|
|
9
|
+
```hbs template
|
|
10
|
+
<ChangesetForm @changeset={{changeset this.model this.validations}} as |Form changeset|>
|
|
11
|
+
<Form.Input
|
|
12
|
+
@label="First Name"
|
|
13
|
+
@fieldName="firstName"
|
|
14
|
+
placeholder="What is your first name?"
|
|
15
|
+
/>
|
|
16
|
+
<Form.Input
|
|
17
|
+
@label="Last Name"
|
|
18
|
+
@fieldName="lastName"
|
|
19
|
+
@containerClass="mt-4"
|
|
20
|
+
placeholder="What is your family name?"
|
|
21
|
+
/>
|
|
22
|
+
<Form.Input
|
|
23
|
+
@label="Email Address"
|
|
24
|
+
@fieldName="email"
|
|
25
|
+
type="email"
|
|
26
|
+
@containerClass="mt-4"
|
|
27
|
+
/>
|
|
28
|
+
<Form.Textarea
|
|
29
|
+
@label="Comments"
|
|
30
|
+
@fieldName="comments"
|
|
31
|
+
@containerClass="mt-4"
|
|
32
|
+
/>
|
|
33
|
+
<Form.Select
|
|
34
|
+
@label="Countries"
|
|
35
|
+
@fieldName="countries"
|
|
36
|
+
@isMultiple={{true}}
|
|
37
|
+
@options={{this.countries}}
|
|
38
|
+
@allowClear={{true}}
|
|
39
|
+
@containerClass="mt-4" as |option|
|
|
40
|
+
>
|
|
41
|
+
{{option}}
|
|
42
|
+
</Form.Select>
|
|
43
|
+
<Form.CheckboxGroup
|
|
44
|
+
@groupName="coreValues"
|
|
45
|
+
@label="Core Values"
|
|
46
|
+
@containerClass="mt-4" as |Checkbox|
|
|
47
|
+
>
|
|
48
|
+
<Checkbox @label="Hungry" @fieldName="hungry" />
|
|
49
|
+
<Checkbox @label="Humble" @fieldName="humble" />
|
|
50
|
+
<Checkbox @label="Curious" @fieldName="curious" />
|
|
51
|
+
</Form.CheckboxGroup>
|
|
52
|
+
<Form.RadioGroup
|
|
53
|
+
@label="Favorite Meal"
|
|
54
|
+
@containerClass="mt-4"
|
|
55
|
+
@fieldName="favoriteMeal" as |Radio|
|
|
56
|
+
>
|
|
57
|
+
<Radio @label="Breakfast" @value="breakfast" />
|
|
58
|
+
<Radio @label="Lunch" @value="lunch" />
|
|
59
|
+
<Radio @label="Dinner" @value="dinner" />
|
|
60
|
+
</Form.RadioGroup>
|
|
61
|
+
<Button
|
|
62
|
+
@type="submit"
|
|
63
|
+
@intent="primary"
|
|
64
|
+
disabled={{changeset.isInvalid}}
|
|
65
|
+
class="mt-4"
|
|
66
|
+
>
|
|
67
|
+
Save
|
|
68
|
+
</Button>
|
|
69
|
+
<Button
|
|
70
|
+
@type="reset"
|
|
71
|
+
@appearance="outlined"
|
|
72
|
+
>
|
|
73
|
+
Reset
|
|
74
|
+
</Button>
|
|
75
|
+
<div class="mt-4">
|
|
76
|
+
<code>
|
|
77
|
+
<p>isPristine: {{changeset.isPristine}}</p>
|
|
78
|
+
<p>isValid: {{changeset.isValid}}</p>
|
|
79
|
+
<p>isInvalid: {{changeset.isInvalid}}</p>
|
|
80
|
+
</code>
|
|
81
|
+
</div>
|
|
82
|
+
</ChangesetForm>
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
```ts component
|
|
86
|
+
import Component from '@glimmer/component';
|
|
87
|
+
import validateFormat from 'ember-changeset-validations/validators/format';
|
|
88
|
+
import validatePresence from 'ember-changeset-validations/validators/presence';
|
|
89
|
+
|
|
90
|
+
export const myValidations = {
|
|
91
|
+
firstName: validatePresence(true),
|
|
92
|
+
lastName: validatePresence(true),
|
|
93
|
+
email: validateFormat({ type: 'email' }),
|
|
94
|
+
countries: validatePresence(true)
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
export default class Demo extends Component {
|
|
98
|
+
validations = myValidations;
|
|
99
|
+
countries = [
|
|
100
|
+
'Brazil',
|
|
101
|
+
'India',
|
|
102
|
+
'Israel',
|
|
103
|
+
'Japan',
|
|
104
|
+
'United Kingdom',
|
|
105
|
+
'United States'
|
|
106
|
+
];
|
|
107
|
+
|
|
108
|
+
model = {
|
|
109
|
+
firstName: null,
|
|
110
|
+
lastName: null,
|
|
111
|
+
email: 'frontile@example.com',
|
|
112
|
+
comments: 'Changeset forms are great! 🚀',
|
|
113
|
+
countries: ['Brazil', 'United States'],
|
|
114
|
+
coreValues: {
|
|
115
|
+
hungry: true,
|
|
116
|
+
humble: true,
|
|
117
|
+
curious: true
|
|
118
|
+
},
|
|
119
|
+
favoriteMeal: 'lunch'
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
```
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Usage
|
|
3
|
+
url: /usage
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Using ChangesetFornm
|
|
7
|
+
|
|
8
|
+
Almost every single app out there has some kind of form. It might be a user preference
|
|
9
|
+
page or a core part of the experience you are providing your user. Usually,
|
|
10
|
+
forms are bound to an object that the user can update or add more values.
|
|
11
|
+
To provide rich user experience, validating the user's input might be a requirement,
|
|
12
|
+
or to avoid confusing users, you might want to wait for the user to click "save" until
|
|
13
|
+
updating parts of the screen that shows the data that the user is changing.
|
|
14
|
+
|
|
15
|
+
ChangesetForm helps to implement all these features in your apps. We use
|
|
16
|
+
[ember-changeset](http://github.com/poteto/ember-changeset) under the hood,
|
|
17
|
+
validations are provided by [ember-changeset-validations](https://github.com/poteto/ember-changeset-validations/).
|
|
18
|
+
|
|
19
|
+
The `<ChangesetForm>` component yields an object with all the components pre-bonded
|
|
20
|
+
to a changeset for you to create a form. It also exposes the changeset itself if
|
|
21
|
+
you need to access any information directly.
|
|
22
|
+
|
|
23
|
+
## Form Data Model
|
|
24
|
+
|
|
25
|
+
The data model used to back the `<ChangesetForm>` is an instance of a changeset object by `ember-changeset`,
|
|
26
|
+
and so, nested property paths are supported. Ember Data Models are also supported.
|
|
27
|
+
|
|
28
|
+
```js
|
|
29
|
+
import Component from '@glimmer/component';
|
|
30
|
+
|
|
31
|
+
export default class Demo extends Component {
|
|
32
|
+
myFormModel = {
|
|
33
|
+
name: {
|
|
34
|
+
first: 'Ron',
|
|
35
|
+
last: 'Swanson'
|
|
36
|
+
},
|
|
37
|
+
email: 'ron@pawnee.in.gov',
|
|
38
|
+
hometown: 'Pawnee, IN',
|
|
39
|
+
preferences: ['Lagavulin', 'Steak', 'Bacon', 'No govt.']
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Validation
|
|
45
|
+
|
|
46
|
+
Changeset validation is provided by [ember-changeset-validations](https://github.com/poteto/ember-changeset-validations/),
|
|
47
|
+
and is optional for any `Changeset` object used by `<ChangesetForm>` components. This takes the form of another
|
|
48
|
+
JS object literal mapping properties to validation functions:
|
|
49
|
+
|
|
50
|
+
```js
|
|
51
|
+
import Component from '@glimmer/component';
|
|
52
|
+
import validateFormat from 'ember-changeset-validations/validators/format';
|
|
53
|
+
import validatePresence from 'ember-changeset-validations/validators/presence';
|
|
54
|
+
|
|
55
|
+
export default class Demo extends Component {
|
|
56
|
+
// ...
|
|
57
|
+
myValidations = {
|
|
58
|
+
'name.first': validatePresence(true),
|
|
59
|
+
'name.last': validatePresence(true),
|
|
60
|
+
email: validateFormat({ type: 'email' }),
|
|
61
|
+
hometown: validatePresence(true),
|
|
62
|
+
preferences: validatePresence(true)
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Creating an Instance of a changeset via the template
|
|
68
|
+
|
|
69
|
+
```hbs
|
|
70
|
+
<ChangesetForm
|
|
71
|
+
@changeset={{changeset this.myFormModel this.myValidations}}
|
|
72
|
+
as |Form|
|
|
73
|
+
>
|
|
74
|
+
<!-- ... -->
|
|
75
|
+
</ChangesetForm>
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Creating Your Own Changeset via JS
|
|
79
|
+
|
|
80
|
+
In this case you are responsible for also providing any validation you wish to apply
|
|
81
|
+
to your `Changeset`. The following is a brief example of that method:
|
|
82
|
+
|
|
83
|
+
```js
|
|
84
|
+
import Component from '@glimmer/component';
|
|
85
|
+
import { Changeset } from 'ember-changeset';
|
|
86
|
+
import lookupValidator from 'ember-changeset-validations';
|
|
87
|
+
import validatePresence from 'ember-changeset-validations/validators/presence';
|
|
88
|
+
|
|
89
|
+
export default class Demo extends Component {
|
|
90
|
+
validations = {
|
|
91
|
+
myValue: validatePresence(true)
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
myModel = {
|
|
95
|
+
myValue: ''
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
myChangeset = new Changeset(
|
|
99
|
+
this.myModel,
|
|
100
|
+
lookupValidator(this.validations),
|
|
101
|
+
this.validations
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
```hbs
|
|
107
|
+
<ChangesetForm @changeset={{this.myChangeset}} as |Form|>
|
|
108
|
+
<!-- ... -->
|
|
109
|
+
</ChangesetForm>
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## API
|
|
113
|
+
|
|
114
|
+
### Args
|
|
115
|
+
|
|
116
|
+
<ArgsTable @of="ChangesetForm" class="mb-8" />
|
|
117
|
+
|
|
118
|
+
### Blocks
|
|
119
|
+
|
|
120
|
+
| Name | Type |
|
|
121
|
+
| --------- | -------------------------------------------------------------------------------------------------- |
|
|
122
|
+
| `default` | `[formComponents: FormComponents, changeset: BufferedChangeset, state: { hasSubmitted: boolean }]` |
|
|
123
|
+
|
|
124
|
+
Here's the list of yielded form components from `FormComponents`:
|
|
125
|
+
|
|
126
|
+
| Key | Component |
|
|
127
|
+
| ------------- | --------------------- |
|
|
128
|
+
| Text | `<FormText>` |
|
|
129
|
+
| Textarea | `<FormTextArea>` |
|
|
130
|
+
| Select | `<FormSelect>` |
|
|
131
|
+
| Checkbox | `<FormCheckbox>` |
|
|
132
|
+
| CheckboxGroup | `<FormCheckboxGroup>` |
|
|
133
|
+
| Radio | `<FormRadio>` |
|
|
134
|
+
| RadioGroup | `<FormRadioGroup>` |
|
package/index.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@frontile/changeset-form",
|
|
3
|
+
"version": "0.12.2",
|
|
4
|
+
"description": "Component Library for Ember Octane apps: ChangesetForm",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"ember-addon"
|
|
7
|
+
],
|
|
8
|
+
"repository": "",
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"author": "",
|
|
11
|
+
"directories": {
|
|
12
|
+
"doc": "doc",
|
|
13
|
+
"test": "tests"
|
|
14
|
+
},
|
|
15
|
+
"scripts": {
|
|
16
|
+
"build": "ember build --environment=production",
|
|
17
|
+
"start": "ember serve",
|
|
18
|
+
"test": "ember test",
|
|
19
|
+
"test:all": "ember try:each",
|
|
20
|
+
"try:one": "ember try:one",
|
|
21
|
+
"prepack": "ember ts:precompile",
|
|
22
|
+
"postpack": "ember ts:clean"
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@frontile/forms": "^0.12.2",
|
|
26
|
+
"ember-changeset": "^3.15.0",
|
|
27
|
+
"ember-changeset-validations": "^3.16.0",
|
|
28
|
+
"ember-cli-babel": "^7.26.6",
|
|
29
|
+
"ember-cli-htmlbars": "^5.7.1",
|
|
30
|
+
"ember-cli-typescript": "^4.2.1"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@babel/core": "^7.15.5",
|
|
34
|
+
"@ember/optional-features": "^2.0.0",
|
|
35
|
+
"@ember/test-helpers": "^2.4.2",
|
|
36
|
+
"@embroider/test-setup": "^0.44.1",
|
|
37
|
+
"@frontile/core": "^0.12.2",
|
|
38
|
+
"@glimmer/component": "^1.0.4",
|
|
39
|
+
"@glimmer/tracking": "^1.0.4",
|
|
40
|
+
"@types/ember": "^3.16.5",
|
|
41
|
+
"@types/ember-qunit": "^3.4.14",
|
|
42
|
+
"@types/ember-resolver": "^5.0.10",
|
|
43
|
+
"@types/ember__test-helpers": "^2.0.2",
|
|
44
|
+
"@types/qunit": "^2.11.2",
|
|
45
|
+
"@types/rsvp": "^4.0.4",
|
|
46
|
+
"autoprefixer": "^10.3.4",
|
|
47
|
+
"broccoli-asset-rev": "^3.0.0",
|
|
48
|
+
"ember-auto-import": "^2.2.0",
|
|
49
|
+
"ember-cli": "~3.28.0",
|
|
50
|
+
"ember-cli-dependency-checker": "^3.2.0",
|
|
51
|
+
"ember-cli-inject-live-reload": "^2.1.0",
|
|
52
|
+
"ember-cli-postcss": "^7.0.2",
|
|
53
|
+
"ember-cli-typescript-blueprints": "^3.0.0",
|
|
54
|
+
"ember-cli-uglify": "^3.0.0",
|
|
55
|
+
"ember-disable-prototype-extensions": "^1.1.3",
|
|
56
|
+
"ember-load-initializers": "^2.1.2",
|
|
57
|
+
"ember-maybe-import-regenerator": "^1.0.0",
|
|
58
|
+
"ember-qunit": "^5.1.4",
|
|
59
|
+
"ember-resolver": "^8.0.3",
|
|
60
|
+
"ember-source": "~3.28.1",
|
|
61
|
+
"ember-try": "^1.4.0",
|
|
62
|
+
"loader.js": "^4.7.0",
|
|
63
|
+
"qunit": "^2.17.1",
|
|
64
|
+
"qunit-dom": "^2.0.0",
|
|
65
|
+
"tailwindcss": "^2.2.15",
|
|
66
|
+
"typescript": "^4.4.3",
|
|
67
|
+
"webpack": "^5.53.0"
|
|
68
|
+
},
|
|
69
|
+
"engines": {
|
|
70
|
+
"node": ">= 10.*"
|
|
71
|
+
},
|
|
72
|
+
"publishConfig": {
|
|
73
|
+
"access": "public"
|
|
74
|
+
},
|
|
75
|
+
"ember": {
|
|
76
|
+
"edition": "octane"
|
|
77
|
+
},
|
|
78
|
+
"ember-addon": {
|
|
79
|
+
"configPath": "tests/dummy/config"
|
|
80
|
+
},
|
|
81
|
+
"gitHead": "59786c42b500c610510e26c19557e461875aa50a"
|
|
82
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../tsconfig.base.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"baseUrl": ".",
|
|
5
|
+
"skipLibCheck": true,
|
|
6
|
+
"paths": {
|
|
7
|
+
"dummy/tests/*": ["tests/*"],
|
|
8
|
+
"dummy/*": ["tests/dummy/app/*", "app/*"],
|
|
9
|
+
"@frontile/changeset-form": ["addon"],
|
|
10
|
+
"@frontile/changeset-form/*": ["addon/*"],
|
|
11
|
+
"@frontile/changeset-form/test-support": ["addon-test-support"],
|
|
12
|
+
"@frontile/changeset-form/test-support/*": ["addon-test-support/*"],
|
|
13
|
+
"*": ["types/*"]
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"include": [
|
|
17
|
+
"app/**/*",
|
|
18
|
+
"addon/**/*",
|
|
19
|
+
"tests/**/*",
|
|
20
|
+
"types/**/*",
|
|
21
|
+
"test-support/**/*",
|
|
22
|
+
"addon-test-support/**/*"
|
|
23
|
+
]
|
|
24
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-type-alias */
|
|
2
|
+
|
|
3
|
+
declare module 'ember-changeset-validations' {
|
|
4
|
+
import {
|
|
5
|
+
ValidationResult,
|
|
6
|
+
ValidatorMapFunc,
|
|
7
|
+
ValidatorAction
|
|
8
|
+
} from 'ember-changeset/types';
|
|
9
|
+
|
|
10
|
+
interface NestedValidator<T> {
|
|
11
|
+
[key: string]: T;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
type Validator =
|
|
15
|
+
| ValidatorMapFunc
|
|
16
|
+
| ValidatorMapFunc[]
|
|
17
|
+
| ValidatorAction
|
|
18
|
+
| NestedValidator<Validator>;
|
|
19
|
+
|
|
20
|
+
interface ValidatorMap {
|
|
21
|
+
[s: string]: Validator;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export default function lookupValidator(
|
|
25
|
+
validationMap: ValidatorMap
|
|
26
|
+
): (params: {
|
|
27
|
+
key: string;
|
|
28
|
+
newValue: unknown;
|
|
29
|
+
oldValue: unknown;
|
|
30
|
+
changes: { [s: string]: unknown };
|
|
31
|
+
content: { [s: string]: unknown };
|
|
32
|
+
}) => string | boolean | [boolean] | string[] | Promise<ValidationResult>;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
declare module 'ember-changeset-validations/validators/presence' {
|
|
36
|
+
import { ValidatorAction } from 'ember-changeset/types';
|
|
37
|
+
export default function validatePresence(
|
|
38
|
+
options?:
|
|
39
|
+
| boolean
|
|
40
|
+
| {
|
|
41
|
+
presence?: boolean;
|
|
42
|
+
ignoreBlank?: boolean;
|
|
43
|
+
}
|
|
44
|
+
): ValidatorAction;
|
|
45
|
+
}
|
|
46
|
+
declare module 'ember-changeset-validations/validators/format' {
|
|
47
|
+
import { ValidatorAction } from 'ember-changeset/types';
|
|
48
|
+
export default function validateFormat(options?: {
|
|
49
|
+
allowBlank?: boolean;
|
|
50
|
+
type?: string;
|
|
51
|
+
inverse?: string;
|
|
52
|
+
regex?: RegExp | string;
|
|
53
|
+
allowNonTld?: boolean;
|
|
54
|
+
minTldLength?: number;
|
|
55
|
+
}): ValidatorAction;
|
|
56
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
declare module 'ember-power-select/test-support' {
|
|
2
|
+
export function selectChoose(
|
|
3
|
+
cssPath: string,
|
|
4
|
+
optionTextOrOptionSelector: string,
|
|
5
|
+
index?: number
|
|
6
|
+
): Promise<void>;
|
|
7
|
+
export function selectSearch(
|
|
8
|
+
cssPath: string,
|
|
9
|
+
searchText: string
|
|
10
|
+
): Promise<void>;
|
|
11
|
+
export function removeMultipleOption(
|
|
12
|
+
cssPath: string,
|
|
13
|
+
optionText: string
|
|
14
|
+
): Promise<void>;
|
|
15
|
+
export function clearSelected(
|
|
16
|
+
cssPath: string,
|
|
17
|
+
optionText: string
|
|
18
|
+
): Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
declare module 'ember-power-select/test-support/helpers' {
|
|
22
|
+
export function clickTrigger(scope?: string): Promise<void>;
|
|
23
|
+
export function typeInSearch(text: string): Promise<void>;
|
|
24
|
+
export function selectChoose(
|
|
25
|
+
cssPath: string,
|
|
26
|
+
optionTextOrOptionSelector: string,
|
|
27
|
+
index?: number
|
|
28
|
+
): Promise<void>;
|
|
29
|
+
}
|