@sprucelabs/spruce-form-utils 17.1.0 → 17.2.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.
@@ -1,7 +1,17 @@
1
+ import FormCardViewController from './viewControllers/FormCard.vc';
1
2
  export { default as formAssert } from './__tests__/support/formAssert';
2
3
  export { default as formCompletionCalculator } from './completing/formCompletionCalculator';
3
4
  export { default as FormPlayerCardViewController } from './completing/FormPlayerCard.vc';
4
5
  export { default as FormCardViewController } from './viewControllers/FormCard.vc';
6
+ export * from './viewControllers/FormCard.vc';
5
7
  export { default as SpyFormCardViewController } from './__tests__/support/SpyFormCard';
6
8
  export { default as formCardAssert } from './__tests__/implementation/FormCard/formCardAssert';
7
9
  export * from './types/types-module';
10
+ declare module '@sprucelabs/heartwood-view-controllers/build/types/heartwood.types' {
11
+ interface ViewControllerMap {
12
+ 'forms.card': FormCardViewController;
13
+ }
14
+ interface ViewControllerOptionsMap {
15
+ 'forms.card': ConstructorParameters<typeof FormCardViewController>[0];
16
+ }
17
+ }
@@ -2,6 +2,7 @@ export { default as formAssert } from './__tests__/support/formAssert.js';
2
2
  export { default as formCompletionCalculator } from './completing/formCompletionCalculator.js';
3
3
  export { default as FormPlayerCardViewController } from './completing/FormPlayerCard.vc.js';
4
4
  export { default as FormCardViewController } from './viewControllers/FormCard.vc.js';
5
+ export * from './viewControllers/FormCard.vc.js';
5
6
  export { default as SpyFormCardViewController } from './__tests__/support/SpyFormCard.js';
6
7
  export { default as formCardAssert } from './__tests__/implementation/FormCard/formCardAssert.js';
7
8
  export * from './types/types-module.js';
@@ -20,4 +20,4 @@ export type FormCardViewControllerOptions<S extends Schema = Schema> = Partial<{
20
20
  } & Omit<FormViewControllerOptions<S>, 'schema'>> & {
21
21
  schema: S;
22
22
  };
23
- export declare function buildFormCardOptions<S extends Schema>(options: FormCardViewControllerOptions<S>): FormCardViewControllerOptions<Schema>;
23
+ export declare function buildFormCard<S extends Schema>(options: FormCardViewControllerOptions<S>): FormCardViewControllerOptions<Schema>;
@@ -23,7 +23,7 @@ import { assertOptions, } from '@sprucelabs/schema';
23
23
  class FormCardViewController extends AbstractViewController {
24
24
  constructor(options) {
25
25
  super(options);
26
- const _a = assertOptions(options, ['schema']), { fields, header } = _a, form = __rest(_a, ["fields", "header"]);
26
+ const _a = assertOptions(options, ['schema']), { fields, id, header } = _a, form = __rest(_a, ["fields", "id", "header"]);
27
27
  if (!fields && !form.sections) {
28
28
  assertOptions(options, ['sections', 'fields'], 'You have to supply either fields or sections to your form card!');
29
29
  }
@@ -31,19 +31,16 @@ class FormCardViewController extends AbstractViewController {
31
31
  form.sections = [{ fields }];
32
32
  }
33
33
  this.formVc = this.Controller('form', form);
34
- this.cardVc = this.CardVc(header);
34
+ this.cardVc = this.CardVc({ id, header });
35
35
  }
36
- CardVc(header) {
37
- return this.Controller('card', {
38
- header,
39
- body: {
36
+ CardVc(options) {
37
+ return this.Controller('card', Object.assign(Object.assign({}, options), { body: {
40
38
  sections: [
41
39
  {
42
40
  form: this.formVc.render(),
43
41
  },
44
42
  ],
45
- },
46
- });
43
+ } }));
47
44
  }
48
45
  getIsValid() {
49
46
  return this.formVc.isValid();
@@ -77,6 +74,6 @@ class FormCardViewController extends AbstractViewController {
77
74
  }
78
75
  FormCardViewController.id = 'card';
79
76
  export default FormCardViewController;
80
- export function buildFormCardOptions(options) {
77
+ export function buildFormCard(options) {
81
78
  return options;
82
79
  }
@@ -1,7 +1,17 @@
1
+ import FormCardViewController from './viewControllers/FormCard.vc';
1
2
  export { default as formAssert } from './__tests__/support/formAssert';
2
3
  export { default as formCompletionCalculator } from './completing/formCompletionCalculator';
3
4
  export { default as FormPlayerCardViewController } from './completing/FormPlayerCard.vc';
4
5
  export { default as FormCardViewController } from './viewControllers/FormCard.vc';
6
+ export * from './viewControllers/FormCard.vc';
5
7
  export { default as SpyFormCardViewController } from './__tests__/support/SpyFormCard';
6
8
  export { default as formCardAssert } from './__tests__/implementation/FormCard/formCardAssert';
7
9
  export * from './types/types-module';
10
+ declare module '@sprucelabs/heartwood-view-controllers/build/types/heartwood.types' {
11
+ interface ViewControllerMap {
12
+ 'forms.card': FormCardViewController;
13
+ }
14
+ interface ViewControllerOptionsMap {
15
+ 'forms.card': ConstructorParameters<typeof FormCardViewController>[0];
16
+ }
17
+ }
@@ -26,6 +26,7 @@ var FormPlayerCard_vc_1 = require("./completing/FormPlayerCard.vc");
26
26
  Object.defineProperty(exports, "FormPlayerCardViewController", { enumerable: true, get: function () { return __importDefault(FormPlayerCard_vc_1).default; } });
27
27
  var FormCard_vc_1 = require("./viewControllers/FormCard.vc");
28
28
  Object.defineProperty(exports, "FormCardViewController", { enumerable: true, get: function () { return __importDefault(FormCard_vc_1).default; } });
29
+ __exportStar(require("./viewControllers/FormCard.vc"), exports);
29
30
  var SpyFormCard_1 = require("./__tests__/support/SpyFormCard");
30
31
  Object.defineProperty(exports, "SpyFormCardViewController", { enumerable: true, get: function () { return __importDefault(SpyFormCard_1).default; } });
31
32
  var formCardAssert_1 = require("./__tests__/implementation/FormCard/formCardAssert");
@@ -20,4 +20,4 @@ export type FormCardViewControllerOptions<S extends Schema = Schema> = Partial<{
20
20
  } & Omit<FormViewControllerOptions<S>, 'schema'>> & {
21
21
  schema: S;
22
22
  };
23
- export declare function buildFormCardOptions<S extends Schema>(options: FormCardViewControllerOptions<S>): FormCardViewControllerOptions<Schema>;
23
+ export declare function buildFormCard<S extends Schema>(options: FormCardViewControllerOptions<S>): FormCardViewControllerOptions<Schema>;
@@ -11,13 +11,13 @@ var __rest = (this && this.__rest) || function (s, e) {
11
11
  return t;
12
12
  };
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.buildFormCardOptions = void 0;
14
+ exports.buildFormCard = void 0;
15
15
  const heartwood_view_controllers_1 = require("@sprucelabs/heartwood-view-controllers");
16
16
  const schema_1 = require("@sprucelabs/schema");
17
17
  class FormCardViewController extends heartwood_view_controllers_1.AbstractViewController {
18
18
  constructor(options) {
19
19
  super(options);
20
- const _a = (0, schema_1.assertOptions)(options, ['schema']), { fields, header } = _a, form = __rest(_a, ["fields", "header"]);
20
+ const _a = (0, schema_1.assertOptions)(options, ['schema']), { fields, id, header } = _a, form = __rest(_a, ["fields", "id", "header"]);
21
21
  if (!fields && !form.sections) {
22
22
  (0, schema_1.assertOptions)(options, ['sections', 'fields'], 'You have to supply either fields or sections to your form card!');
23
23
  }
@@ -25,19 +25,16 @@ class FormCardViewController extends heartwood_view_controllers_1.AbstractViewCo
25
25
  form.sections = [{ fields }];
26
26
  }
27
27
  this.formVc = this.Controller('form', form);
28
- this.cardVc = this.CardVc(header);
28
+ this.cardVc = this.CardVc({ id, header });
29
29
  }
30
- CardVc(header) {
31
- return this.Controller('card', {
32
- header,
33
- body: {
30
+ CardVc(options) {
31
+ return this.Controller('card', Object.assign(Object.assign({}, options), { body: {
34
32
  sections: [
35
33
  {
36
34
  form: this.formVc.render(),
37
35
  },
38
36
  ],
39
- },
40
- });
37
+ } }));
41
38
  }
42
39
  getIsValid() {
43
40
  return this.formVc.isValid();
@@ -67,7 +64,7 @@ class FormCardViewController extends heartwood_view_controllers_1.AbstractViewCo
67
64
  }
68
65
  FormCardViewController.id = 'card';
69
66
  exports.default = FormCardViewController;
70
- function buildFormCardOptions(options) {
67
+ function buildFormCard(options) {
71
68
  return options;
72
69
  }
73
- exports.buildFormCardOptions = buildFormCardOptions;
70
+ exports.buildFormCard = buildFormCard;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sprucelabs/spruce-form-utils",
3
3
  "description": "Support for working with forms and Sprucebot. 📄",
4
- "version": "17.1.0",
4
+ "version": "17.2.0",
5
5
  "skill": {
6
6
  "namespace": "forms"
7
7
  },
@@ -52,7 +52,8 @@
52
52
  "release": "npm publish"
53
53
  },
54
54
  "dependencies": {
55
- "@sprucelabs/test-utils": "latest"
55
+ "@sprucelabs/test-utils": "latest",
56
+ "@sprucelabs/spruce-image-utils": "latest"
56
57
  },
57
58
  "engines": {
58
59
  "yarn": "1.x"