@sprucelabs/heartwood-view-controllers 126.11.18 → 126.12.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/build/.spruce/errors/errors.types.d.ts +20 -0
- package/build/.spruce/errors/heartwoodViewControllers/buttonNotFound.schema.d.ts +3 -0
- package/build/.spruce/errors/heartwoodViewControllers/buttonNotFound.schema.js +19 -0
- package/build/.spruce/errors/options.types.d.ts +4 -1
- package/build/errors/SpruceError.js +3 -0
- package/build/errors/buttonNotFound.builder.d.ts +11 -0
- package/build/errors/buttonNotFound.builder.js +13 -0
- package/build/esm/.spruce/errors/errors.types.d.ts +20 -0
- package/build/esm/.spruce/errors/options.types.d.ts +4 -1
- package/build/esm/errors/SpruceError.js +3 -0
- package/build/esm/errors/buttonNotFound.builder.d.ts +11 -0
- package/build/esm/errors/buttonNotFound.builder.js +11 -0
- package/build/esm/viewControllers/navigation/Navigation.vc.d.ts +2 -1
- package/build/esm/viewControllers/navigation/Navigation.vc.js +16 -0
- package/build/viewControllers/navigation/Navigation.vc.d.ts +2 -1
- package/build/viewControllers/navigation/Navigation.vc.js +18 -0
- package/package.json +1 -1
|
@@ -431,6 +431,26 @@ export declare namespace SpruceErrors.HeartwoodViewControllers {
|
|
|
431
431
|
}
|
|
432
432
|
type CellDeletedEntity = SchemaEntity<SpruceErrors.HeartwoodViewControllers.CellDeletedSchema>;
|
|
433
433
|
}
|
|
434
|
+
export declare namespace SpruceErrors.HeartwoodViewControllers {
|
|
435
|
+
interface ButtonNotFound {
|
|
436
|
+
'id': string;
|
|
437
|
+
}
|
|
438
|
+
interface ButtonNotFoundSchema extends SpruceSchema.Schema {
|
|
439
|
+
id: 'buttonNotFound';
|
|
440
|
+
namespace: 'HeartwoodViewControllers';
|
|
441
|
+
name: 'button not found';
|
|
442
|
+
moduleToImportFromWhenRemote: '@sprucelabs/heartwood-view-controllers';
|
|
443
|
+
fields: {
|
|
444
|
+
/** . */
|
|
445
|
+
'id': {
|
|
446
|
+
type: 'id';
|
|
447
|
+
isRequired: true;
|
|
448
|
+
options: undefined;
|
|
449
|
+
};
|
|
450
|
+
};
|
|
451
|
+
}
|
|
452
|
+
type ButtonNotFoundEntity = SchemaEntity<SpruceErrors.HeartwoodViewControllers.ButtonNotFoundSchema>;
|
|
453
|
+
}
|
|
434
454
|
export declare namespace SpruceErrors.HeartwoodViewControllers {
|
|
435
455
|
interface AppNotFound {
|
|
436
456
|
'namespace': string;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const schema_1 = require("@sprucelabs/schema");
|
|
4
|
+
const buttonNotFoundSchema = {
|
|
5
|
+
id: 'buttonNotFound',
|
|
6
|
+
namespace: 'HeartwoodViewControllers',
|
|
7
|
+
name: 'button not found',
|
|
8
|
+
moduleToImportFromWhenRemote: '@sprucelabs/heartwood-view-controllers',
|
|
9
|
+
fields: {
|
|
10
|
+
/** . */
|
|
11
|
+
'id': {
|
|
12
|
+
type: 'id',
|
|
13
|
+
isRequired: true,
|
|
14
|
+
options: undefined
|
|
15
|
+
},
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
schema_1.SchemaRegistry.getInstance().trackSchema(buttonNotFoundSchema);
|
|
19
|
+
exports.default = buttonNotFoundSchema;
|
|
@@ -66,8 +66,11 @@ export interface DateAlreadySelectedErrorOptions extends SpruceErrors.HeartwoodV
|
|
|
66
66
|
export interface CellDeletedErrorOptions extends SpruceErrors.HeartwoodViewControllers.CellDeleted, ISpruceErrorOptions {
|
|
67
67
|
code: 'CELL_DELETED';
|
|
68
68
|
}
|
|
69
|
+
export interface ButtonNotFoundErrorOptions extends SpruceErrors.HeartwoodViewControllers.ButtonNotFound, ISpruceErrorOptions {
|
|
70
|
+
code: 'BUTTON_NOT_FOUND';
|
|
71
|
+
}
|
|
69
72
|
export interface AppNotFoundErrorOptions extends SpruceErrors.HeartwoodViewControllers.AppNotFound, ISpruceErrorOptions {
|
|
70
73
|
code: 'APP_NOT_FOUND';
|
|
71
74
|
}
|
|
72
|
-
type ErrorOptions = ViewAlreadyDestroyedErrorOptions | ToolNotFoundErrorOptions | StepNotCompleteErrorOptions | SlideNotFoundErrorOptions | RowDeletedErrorOptions | PersonNotFoundErrorOptions | NoFieldVcSetErrorOptions | MissingStorageErrorOptions | InvalidViewControllerSourceErrorOptions | InvalidViewControllerNameErrorOptions | InvalidSkillViewControllerErrorOptions | InvalidLoginConfigurationErrorOptions | InvalidAppControllerErrorOptions | ExportFailedErrorOptions | EventNotFoundErrorOptions | DuplicateToolIdErrorOptions | DuplicateRowIdErrorOptions | DuplicateEventIdErrorOptions | DidNotGenerateOfferErrorOptions | DateNotSelectedErrorOptions | DateAlreadySelectedErrorOptions | CellDeletedErrorOptions | AppNotFoundErrorOptions;
|
|
75
|
+
type ErrorOptions = ViewAlreadyDestroyedErrorOptions | ToolNotFoundErrorOptions | StepNotCompleteErrorOptions | SlideNotFoundErrorOptions | RowDeletedErrorOptions | PersonNotFoundErrorOptions | NoFieldVcSetErrorOptions | MissingStorageErrorOptions | InvalidViewControllerSourceErrorOptions | InvalidViewControllerNameErrorOptions | InvalidSkillViewControllerErrorOptions | InvalidLoginConfigurationErrorOptions | InvalidAppControllerErrorOptions | ExportFailedErrorOptions | EventNotFoundErrorOptions | DuplicateToolIdErrorOptions | DuplicateRowIdErrorOptions | DuplicateEventIdErrorOptions | DidNotGenerateOfferErrorOptions | DateNotSelectedErrorOptions | DateAlreadySelectedErrorOptions | CellDeletedErrorOptions | ButtonNotFoundErrorOptions | AppNotFoundErrorOptions;
|
|
73
76
|
export default ErrorOptions;
|
|
@@ -86,6 +86,9 @@ class SpruceError extends error_1.default {
|
|
|
86
86
|
case 'INVALID_LOGIN_CONFIGURATION':
|
|
87
87
|
message = 'A Invalid login configuration just happened!';
|
|
88
88
|
break;
|
|
89
|
+
case 'BUTTON_NOT_FOUND':
|
|
90
|
+
message = `I could not find a button with the id '${options.id}'!`;
|
|
91
|
+
break;
|
|
89
92
|
default:
|
|
90
93
|
message = super.friendlyMessage();
|
|
91
94
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const schema_1 = require("@sprucelabs/schema");
|
|
4
|
+
exports.default = (0, schema_1.buildErrorSchema)({
|
|
5
|
+
id: 'buttonNotFound',
|
|
6
|
+
name: 'button not found',
|
|
7
|
+
fields: {
|
|
8
|
+
id: {
|
|
9
|
+
type: 'id',
|
|
10
|
+
isRequired: true,
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
});
|
|
@@ -431,6 +431,26 @@ export declare namespace SpruceErrors.HeartwoodViewControllers {
|
|
|
431
431
|
}
|
|
432
432
|
type CellDeletedEntity = SchemaEntity<SpruceErrors.HeartwoodViewControllers.CellDeletedSchema>;
|
|
433
433
|
}
|
|
434
|
+
export declare namespace SpruceErrors.HeartwoodViewControllers {
|
|
435
|
+
interface ButtonNotFound {
|
|
436
|
+
'id': string;
|
|
437
|
+
}
|
|
438
|
+
interface ButtonNotFoundSchema extends SpruceSchema.Schema {
|
|
439
|
+
id: 'buttonNotFound';
|
|
440
|
+
namespace: 'HeartwoodViewControllers';
|
|
441
|
+
name: 'button not found';
|
|
442
|
+
moduleToImportFromWhenRemote: '@sprucelabs/heartwood-view-controllers';
|
|
443
|
+
fields: {
|
|
444
|
+
/** . */
|
|
445
|
+
'id': {
|
|
446
|
+
type: 'id';
|
|
447
|
+
isRequired: true;
|
|
448
|
+
options: undefined;
|
|
449
|
+
};
|
|
450
|
+
};
|
|
451
|
+
}
|
|
452
|
+
type ButtonNotFoundEntity = SchemaEntity<SpruceErrors.HeartwoodViewControllers.ButtonNotFoundSchema>;
|
|
453
|
+
}
|
|
434
454
|
export declare namespace SpruceErrors.HeartwoodViewControllers {
|
|
435
455
|
interface AppNotFound {
|
|
436
456
|
'namespace': string;
|
|
@@ -66,8 +66,11 @@ export interface DateAlreadySelectedErrorOptions extends SpruceErrors.HeartwoodV
|
|
|
66
66
|
export interface CellDeletedErrorOptions extends SpruceErrors.HeartwoodViewControllers.CellDeleted, ISpruceErrorOptions {
|
|
67
67
|
code: 'CELL_DELETED';
|
|
68
68
|
}
|
|
69
|
+
export interface ButtonNotFoundErrorOptions extends SpruceErrors.HeartwoodViewControllers.ButtonNotFound, ISpruceErrorOptions {
|
|
70
|
+
code: 'BUTTON_NOT_FOUND';
|
|
71
|
+
}
|
|
69
72
|
export interface AppNotFoundErrorOptions extends SpruceErrors.HeartwoodViewControllers.AppNotFound, ISpruceErrorOptions {
|
|
70
73
|
code: 'APP_NOT_FOUND';
|
|
71
74
|
}
|
|
72
|
-
type ErrorOptions = ViewAlreadyDestroyedErrorOptions | ToolNotFoundErrorOptions | StepNotCompleteErrorOptions | SlideNotFoundErrorOptions | RowDeletedErrorOptions | PersonNotFoundErrorOptions | NoFieldVcSetErrorOptions | MissingStorageErrorOptions | InvalidViewControllerSourceErrorOptions | InvalidViewControllerNameErrorOptions | InvalidSkillViewControllerErrorOptions | InvalidLoginConfigurationErrorOptions | InvalidAppControllerErrorOptions | ExportFailedErrorOptions | EventNotFoundErrorOptions | DuplicateToolIdErrorOptions | DuplicateRowIdErrorOptions | DuplicateEventIdErrorOptions | DidNotGenerateOfferErrorOptions | DateNotSelectedErrorOptions | DateAlreadySelectedErrorOptions | CellDeletedErrorOptions | AppNotFoundErrorOptions;
|
|
75
|
+
type ErrorOptions = ViewAlreadyDestroyedErrorOptions | ToolNotFoundErrorOptions | StepNotCompleteErrorOptions | SlideNotFoundErrorOptions | RowDeletedErrorOptions | PersonNotFoundErrorOptions | NoFieldVcSetErrorOptions | MissingStorageErrorOptions | InvalidViewControllerSourceErrorOptions | InvalidViewControllerNameErrorOptions | InvalidSkillViewControllerErrorOptions | InvalidLoginConfigurationErrorOptions | InvalidAppControllerErrorOptions | ExportFailedErrorOptions | EventNotFoundErrorOptions | DuplicateToolIdErrorOptions | DuplicateRowIdErrorOptions | DuplicateEventIdErrorOptions | DidNotGenerateOfferErrorOptions | DateNotSelectedErrorOptions | DateAlreadySelectedErrorOptions | CellDeletedErrorOptions | ButtonNotFoundErrorOptions | AppNotFoundErrorOptions;
|
|
73
76
|
export default ErrorOptions;
|
|
@@ -82,6 +82,9 @@ export default class SpruceError extends AbstractSpruceError {
|
|
|
82
82
|
case 'INVALID_LOGIN_CONFIGURATION':
|
|
83
83
|
message = 'A Invalid login configuration just happened!';
|
|
84
84
|
break;
|
|
85
|
+
case 'BUTTON_NOT_FOUND':
|
|
86
|
+
message = `I could not find a button with the id '${options.id}'!`;
|
|
87
|
+
break;
|
|
85
88
|
default:
|
|
86
89
|
message = super.friendlyMessage();
|
|
87
90
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Navigation, NavigationButton, ViewControllerOptions } from '../../types/heartwood.types';
|
|
1
|
+
import { Navigation, NavigationButton, NavigationItem, ViewControllerOptions } from '../../types/heartwood.types';
|
|
2
2
|
import AbstractViewController from '../Abstract.vc';
|
|
3
3
|
export default class NavigationViewController extends AbstractViewController<Navigation> {
|
|
4
4
|
private model;
|
|
@@ -7,5 +7,6 @@ export default class NavigationViewController extends AbstractViewController<Nav
|
|
|
7
7
|
show(): void;
|
|
8
8
|
setButtons(buttons: NavigationButton[]): void;
|
|
9
9
|
setShouldRenderButtonLabels(shouldRender: boolean): void;
|
|
10
|
+
updateButton(id: string, updates: Partial<NavigationItem>): void;
|
|
10
11
|
render(): Navigation;
|
|
11
12
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import SpruceError from '../../errors/SpruceError.js';
|
|
1
2
|
import removeUniversalViewOptions from '../../utilities/removeUniversalViewOptions.js';
|
|
2
3
|
import AbstractViewController from '../Abstract.vc.js';
|
|
3
4
|
export default class NavigationViewController extends AbstractViewController {
|
|
@@ -21,6 +22,21 @@ export default class NavigationViewController extends AbstractViewController {
|
|
|
21
22
|
this.model.shouldRenderButtonLabels = shouldRender;
|
|
22
23
|
this.triggerRender();
|
|
23
24
|
}
|
|
25
|
+
updateButton(id, updates) {
|
|
26
|
+
var _a;
|
|
27
|
+
const buttons = (_a = this.model.buttons) !== null && _a !== void 0 ? _a : [];
|
|
28
|
+
const idx = buttons === null || buttons === void 0 ? void 0 : buttons.findIndex((b) => b.id === id);
|
|
29
|
+
if (idx === -1) {
|
|
30
|
+
throw new SpruceError({
|
|
31
|
+
code: 'BUTTON_NOT_FOUND',
|
|
32
|
+
id,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
let button = buttons[idx];
|
|
36
|
+
button = Object.assign(Object.assign({}, button), updates);
|
|
37
|
+
buttons[idx] = button;
|
|
38
|
+
this.triggerRender();
|
|
39
|
+
}
|
|
24
40
|
render() {
|
|
25
41
|
return Object.assign({ controller: this }, this.model);
|
|
26
42
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Navigation, NavigationButton, ViewControllerOptions } from '../../types/heartwood.types';
|
|
1
|
+
import { Navigation, NavigationButton, NavigationItem, ViewControllerOptions } from '../../types/heartwood.types';
|
|
2
2
|
import AbstractViewController from '../Abstract.vc';
|
|
3
3
|
export default class NavigationViewController extends AbstractViewController<Navigation> {
|
|
4
4
|
private model;
|
|
@@ -7,5 +7,6 @@ export default class NavigationViewController extends AbstractViewController<Nav
|
|
|
7
7
|
show(): void;
|
|
8
8
|
setButtons(buttons: NavigationButton[]): void;
|
|
9
9
|
setShouldRenderButtonLabels(shouldRender: boolean): void;
|
|
10
|
+
updateButton(id: string, updates: Partial<NavigationItem>): void;
|
|
10
11
|
render(): Navigation;
|
|
11
12
|
}
|
|
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const SpruceError_1 = __importDefault(require("../../errors/SpruceError"));
|
|
6
7
|
const removeUniversalViewOptions_1 = __importDefault(require("../../utilities/removeUniversalViewOptions"));
|
|
7
8
|
const Abstract_vc_1 = __importDefault(require("../Abstract.vc"));
|
|
8
9
|
class NavigationViewController extends Abstract_vc_1.default {
|
|
@@ -26,6 +27,23 @@ class NavigationViewController extends Abstract_vc_1.default {
|
|
|
26
27
|
this.model.shouldRenderButtonLabels = shouldRender;
|
|
27
28
|
this.triggerRender();
|
|
28
29
|
}
|
|
30
|
+
updateButton(id, updates) {
|
|
31
|
+
const buttons = this.model.buttons ?? [];
|
|
32
|
+
const idx = buttons?.findIndex((b) => b.id === id);
|
|
33
|
+
if (idx === -1) {
|
|
34
|
+
throw new SpruceError_1.default({
|
|
35
|
+
code: 'BUTTON_NOT_FOUND',
|
|
36
|
+
id,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
let button = buttons[idx];
|
|
40
|
+
button = {
|
|
41
|
+
...button,
|
|
42
|
+
...updates,
|
|
43
|
+
};
|
|
44
|
+
buttons[idx] = button;
|
|
45
|
+
this.triggerRender();
|
|
46
|
+
}
|
|
29
47
|
render() {
|
|
30
48
|
return { controller: this, ...this.model };
|
|
31
49
|
}
|
package/package.json
CHANGED