Skip to content

Commit b353ef1

Browse files
committed
Basic Setup
1 parent 8b3c2ac commit b353ef1

File tree

11 files changed

+354
-22
lines changed

11 files changed

+354
-22
lines changed

packages/ember-bootstrap-constraint-validations/package.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,17 @@
5757
"version": 2,
5858
"type": "addon",
5959
"main": "addon-main.js",
60-
"app-js": {}
60+
"app-js": {
61+
"./components/bs-form.js": "./dist/_app_/components/bs-form.js",
62+
"./components/bs-form/element.js": "./dist/_app_/components/bs-form/element.js"
63+
}
6164
},
6265
"exports": {
6366
".": "./dist/index.js",
6467
"./*": "./dist/*",
6568
"./addon-main.js": "./addon-main.js"
69+
},
70+
"peerDependencies": {
71+
"ember-bootstrap": "^5.1.0"
6672
}
6773
}

packages/ember-bootstrap-constraint-validations/rollup.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export default {
1414
plugins: [
1515
// These are the modules that users should be able to import from your
1616
// addon. Anything not listed here may get optimized away.
17-
addon.publicEntrypoints(['components/**/*.js', 'index.js']),
17+
addon.publicEntrypoints(['components/**/*.js']),
1818

1919
// These are the modules that should get reexported into the traditional
2020
// "app" tree. Things in here should also be in publicEntrypoints above, but
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import BaseBsForm from 'ember-bootstrap/components/bs-form';
2+
3+
export default class BsForm extends BaseBsForm {
4+
'__ember-bootstrap_subclass' = true;
5+
6+
get hasValidator() {
7+
return true;
8+
}
9+
10+
async validate(model) {
11+
throw new Error();
12+
}
13+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import BaseBsFormElement from 'ember-bootstrap/components/bs-form/element';
2+
3+
export default class BsFormElement extends BaseBsFormElement {
4+
'__ember-bootstrap_subclass' = true;
5+
6+
get errors() {
7+
// let { model, property } = this.args;
8+
9+
return ['dummy error'];
10+
}
11+
12+
get hasValidator() {
13+
return true;
14+
}
15+
}

packages/ember-bootstrap-constraint-validations/src/index.js

Whitespace-only changes.

packages/test-app/app/controllers/.gitkeep

Whitespace-only changes.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import Controller from '@ember/controller';
2+
import { action } from '@ember/object';
3+
4+
class Model {
5+
name = null;
6+
email = null;
7+
}
8+
9+
export default class ApplicationController extends Controller {
10+
model = new Model();
11+
12+
@action
13+
submit() {
14+
window.alert('Submitted!');
15+
}
16+
17+
@action
18+
invalid() {
19+
window.alert('Invalid!');
20+
}
21+
}
Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1-
{{page-title "TestApp"}}
1+
<div class="container mt-4">
22

3-
<h2 id="title">Welcome to Ember</h2>
3+
<BsForm @model={{this.model}} @onSubmit={{this.submit}} @onInvalid={{this.invalid}} as |form|>
4+
<form.element @label="Name" @property="name" />
5+
<form.element @label="Email" @property="email" />
6+
<form.submitButton>Submit</form.submitButton>
7+
</BsForm>
48

5-
{{outlet}}
9+
</div>

packages/test-app/ember-cli-build.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ const EmberApp = require('ember-cli/lib/broccoli/ember-app');
44

55
module.exports = function (defaults) {
66
let app = new EmberApp(defaults, {
7-
// Add options here
7+
'ember-bootstrap': {
8+
bootstrapVersion: 5,
9+
importBootstrapCSS: true,
10+
},
811
});
912

1013
// Use `app.import` to add additional libraries to the generated

packages/test-app/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@
3030
"@glimmer/component": "^1.0.4",
3131
"@glimmer/tracking": "^1.0.4",
3232
"babel-eslint": "^10.1.0",
33+
"bootstrap": "^5.0.0",
3334
"broccoli-asset-rev": "^3.0.0",
3435
"ember-auto-import": "^2.4.1",
36+
"ember-bootstrap": "^5.1.0",
3537
"ember-bootstrap-constraint-validations": "^0.0.0",
3638
"ember-cli": "~4.3.0",
3739
"ember-cli-app-version": "^5.0.0",
@@ -71,4 +73,4 @@
7173
"ember": {
7274
"edition": "octane"
7375
}
74-
}
76+
}

0 commit comments

Comments
 (0)