@sprucelabs/heartwood-view-controllers 111.1.66 → 112.0.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/schemas/heartwoodViewControllers/v2021_02_11/dialog.schema.js +9 -1
- package/build/.spruce/schemas/heartwoodViewControllers/v2021_02_11/lockScreen.schema.d.ts +3 -0
- package/build/.spruce/schemas/heartwoodViewControllers/v2021_02_11/lockScreen.schema.js +111 -0
- package/build/.spruce/schemas/schemas.types.d.ts +466 -294
- package/build/controllerMap.d.ts +2 -0
- package/build/controllerMap.js +2 -0
- package/build/esm/.spruce/schemas/heartwoodViewControllers/v2021_02_11/dialog.schema.js +9 -1
- package/build/esm/.spruce/schemas/heartwoodViewControllers/v2021_02_11/lockScreen.schema.d.ts +3 -0
- package/build/esm/.spruce/schemas/heartwoodViewControllers/v2021_02_11/lockScreen.schema.js +106 -0
- package/build/esm/.spruce/schemas/schemas.types.d.ts +466 -294
- package/build/esm/controllerMap.d.ts +2 -0
- package/build/esm/controllerMap.js +2 -0
- package/build/esm/index.d.ts +2 -0
- package/build/esm/index.js +2 -0
- package/build/esm/schemas/v2021_02_11/autocompleteInput.builder.d.ts +7 -7
- package/build/esm/schemas/v2021_02_11/dialog.builder.d.ts +9 -0
- package/build/esm/schemas/v2021_02_11/dialog.builder.js +8 -0
- package/build/esm/schemas/v2021_02_11/lockScreen.builder.d.ts +29728 -0
- package/build/esm/schemas/v2021_02_11/lockScreen.builder.js +19 -0
- package/build/esm/skillViewControllers/Abstract.svc.d.ts +7 -7
- package/build/esm/skillViewControllers/Abstract.svc.js +9 -0
- package/build/esm/skillViewControllers/LockScreen.svc.d.ts +13 -0
- package/build/esm/skillViewControllers/LockScreen.svc.js +33 -0
- package/build/esm/tests/AbstractViewControllerTest.d.ts +2 -2
- package/build/esm/tests/utilities/vcAssert.d.ts +1 -1
- package/build/esm/tests/utilities/vcAssert.js +1 -1
- package/build/esm/tests/utilities/vcAssert.utility.d.ts +1 -1
- package/build/esm/types/heartwood.types.d.ts +8 -1
- package/build/esm/utilities/removeUniversalViewOptions.d.ts +1 -1
- package/build/esm/utilities/removeUniversalViewOptions.js +1 -0
- package/build/esm/viewControllers/Confirm.vc.d.ts +7 -8
- package/build/esm/viewControllers/Confirm.vc.js +4 -1
- package/build/esm/viewControllers/Dialog.vc.d.ts +3 -5
- package/build/esm/viewControllers/ViewControllerFactory.d.ts +4 -1
- package/build/esm/viewControllers/ViewControllerFactory.js +8 -8
- package/build/index.d.ts +2 -0
- package/build/index.js +8 -4
- package/build/schemas/v2021_02_11/autocompleteInput.builder.d.ts +7 -7
- package/build/schemas/v2021_02_11/dialog.builder.d.ts +9 -0
- package/build/schemas/v2021_02_11/dialog.builder.js +9 -0
- package/build/schemas/v2021_02_11/lockScreen.builder.d.ts +29728 -0
- package/build/schemas/v2021_02_11/lockScreen.builder.js +28 -0
- package/build/skillViewControllers/Abstract.svc.d.ts +7 -7
- package/build/skillViewControllers/Abstract.svc.js +9 -0
- package/build/skillViewControllers/LockScreen.svc.d.ts +13 -0
- package/build/skillViewControllers/LockScreen.svc.js +26 -0
- package/build/tests/AbstractViewControllerTest.d.ts +2 -2
- package/build/tests/utilities/vcAssert.d.ts +1 -1
- package/build/tests/utilities/vcAssert.js +1 -1
- package/build/tests/utilities/vcAssert.utility.d.ts +1 -1
- package/build/types/heartwood.types.d.ts +8 -1
- package/build/utilities/removeUniversalViewOptions.d.ts +1 -1
- package/build/utilities/removeUniversalViewOptions.js +1 -0
- package/build/viewControllers/Confirm.vc.d.ts +7 -8
- package/build/viewControllers/Confirm.vc.js +4 -1
- package/build/viewControllers/Dialog.vc.d.ts +3 -5
- package/build/viewControllers/ViewControllerFactory.d.ts +4 -1
- package/build/viewControllers/ViewControllerFactory.js +8 -7
- package/package.json +1 -1
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { buildSchema } from '@sprucelabs/schema';
|
|
2
|
+
import skillViewBuilder from './skillView.builder.js';
|
|
3
|
+
export default buildSchema({
|
|
4
|
+
id: 'lockScreen',
|
|
5
|
+
name: 'lock screen',
|
|
6
|
+
fields: Object.assign(Object.assign({}, skillViewBuilder.fields), { controller: {
|
|
7
|
+
type: 'raw',
|
|
8
|
+
label: 'Controller',
|
|
9
|
+
options: {
|
|
10
|
+
valueType: 'HeartwoodTypes.ViewController<SpruceSchemas.HeartwoodViewControllers.v2021_02_11.LockScreen>',
|
|
11
|
+
},
|
|
12
|
+
}, skillViewController: {
|
|
13
|
+
type: 'raw',
|
|
14
|
+
label: 'Card controller',
|
|
15
|
+
options: {
|
|
16
|
+
valueType: 'HeartwoodTypes.SkillViewController',
|
|
17
|
+
},
|
|
18
|
+
} }),
|
|
19
|
+
});
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { SkillViewController, SkillViewControllerLoadOptions } from '../types/heartwood.types';
|
|
1
|
+
import { SkillView, SkillViewController, SkillViewControllerLoadOptions, ToolBelt, ViewControllerOptions } from '../types/heartwood.types';
|
|
3
2
|
import AbstractViewController from '../viewControllers/Abstract.vc';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export default abstract class AbstractSkillViewController<Args extends Record<string, any> = Record<string, any>> extends AbstractViewController<SkillView> implements SkillViewController {
|
|
3
|
+
import { LockScreenSkillViewControllerOptions } from './LockScreen.svc';
|
|
4
|
+
export default abstract class AbstractSkillViewController<Args extends Record<string, any> = Record<string, any>, ViewModel extends Record<string, any> = SkillView> extends AbstractViewController<ViewModel> implements SkillViewController {
|
|
7
5
|
static id: string;
|
|
8
6
|
protected title?: string;
|
|
9
7
|
protected subtitle?: string;
|
|
8
|
+
private renderLockScreenHandler;
|
|
9
|
+
constructor(options: ViewControllerOptions);
|
|
10
10
|
load(options: SkillViewControllerLoadOptions<Args>): Promise<void>;
|
|
11
11
|
focus(): Promise<void>;
|
|
12
12
|
blur(): Promise<void>;
|
|
@@ -15,6 +15,6 @@ export default abstract class AbstractSkillViewController<Args extends Record<st
|
|
|
15
15
|
protected setSubtitle(subtitle: string | null | undefined): void;
|
|
16
16
|
getSubtitle(): string | undefined;
|
|
17
17
|
renderToolBelt(): ToolBelt | null;
|
|
18
|
-
|
|
18
|
+
protected renderLockScreen(options: LockScreenSkillViewControllerOptions): import("./LockScreen.svc").default;
|
|
19
|
+
abstract render(): ViewModel;
|
|
19
20
|
}
|
|
20
|
-
export {};
|
|
@@ -9,6 +9,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import AbstractViewController from '../viewControllers/Abstract.vc.js';
|
|
11
11
|
export default class AbstractSkillViewController extends AbstractViewController {
|
|
12
|
+
constructor(options) {
|
|
13
|
+
super(options);
|
|
14
|
+
this.renderLockScreenHandler = options.renderLockScreenHandler;
|
|
15
|
+
}
|
|
12
16
|
load(options) {
|
|
13
17
|
return __awaiter(this, void 0, void 0, function* () { });
|
|
14
18
|
}
|
|
@@ -35,4 +39,9 @@ export default class AbstractSkillViewController extends AbstractViewController
|
|
|
35
39
|
renderToolBelt() {
|
|
36
40
|
return null;
|
|
37
41
|
}
|
|
42
|
+
renderLockScreen(options) {
|
|
43
|
+
const controller = this.Controller('lock-screen', Object.assign({}, options));
|
|
44
|
+
this.renderLockScreenHandler(controller.render());
|
|
45
|
+
return controller;
|
|
46
|
+
}
|
|
38
47
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { LockScreen, SkillView, ViewControllerOptions } from '../types/heartwood.types';
|
|
2
|
+
import AbstractSkillViewController from './Abstract.svc';
|
|
3
|
+
export default class LockScreenSkillViewController extends AbstractSkillViewController<Record<string, any>, LockScreen> {
|
|
4
|
+
private skillViewController?;
|
|
5
|
+
private onHideHandler?;
|
|
6
|
+
constructor(options: ViewControllerOptions & LockScreen);
|
|
7
|
+
setOnHideHandler(onHideHandler: OnHideHandler): void;
|
|
8
|
+
hide(): Promise<void>;
|
|
9
|
+
render(): LockScreen;
|
|
10
|
+
}
|
|
11
|
+
export type LockScreenSkillViewControllerOptions = SkillView;
|
|
12
|
+
type OnHideHandler = () => Promise<void> | void;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import AbstractSkillViewController from './Abstract.svc.js';
|
|
11
|
+
export default class LockScreenSkillViewController extends AbstractSkillViewController {
|
|
12
|
+
constructor(options) {
|
|
13
|
+
super(options);
|
|
14
|
+
const { controller } = options;
|
|
15
|
+
this.skillViewController = controller;
|
|
16
|
+
}
|
|
17
|
+
setOnHideHandler(onHideHandler) {
|
|
18
|
+
this.onHideHandler = onHideHandler;
|
|
19
|
+
}
|
|
20
|
+
hide() {
|
|
21
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
var _a;
|
|
23
|
+
yield ((_a = this.onHideHandler) === null || _a === void 0 ? void 0 : _a.call(this));
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
render() {
|
|
27
|
+
var _a;
|
|
28
|
+
return {
|
|
29
|
+
controller: this,
|
|
30
|
+
skillViewController: (_a = this.skillViewController) !== null && _a !== void 0 ? _a : this,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -3,7 +3,7 @@ import AbstractSpruceTest from '@sprucelabs/test-utils';
|
|
|
3
3
|
import EventFaker from '../__tests__/support/EventFaker';
|
|
4
4
|
import { ControllerOptions, ViewController, ViewControllerMap } from '../types/heartwood.types';
|
|
5
5
|
import { RenderOptions } from '../utilities/render.utility';
|
|
6
|
-
import ViewControllerFactory, {
|
|
6
|
+
import ViewControllerFactory, { ViewControllerFactoryOptions } from '../viewControllers/ViewControllerFactory';
|
|
7
7
|
import MercuryFixture from './fixtures/MercuryFixture';
|
|
8
8
|
export default abstract class AbstractViewControllerTest extends AbstractSpruceTest {
|
|
9
9
|
protected static controllerMap: Record<string, any>;
|
|
@@ -14,7 +14,7 @@ export default abstract class AbstractViewControllerTest extends AbstractSpruceT
|
|
|
14
14
|
protected static get mercury(): MercuryFixture;
|
|
15
15
|
protected static beforeEach(): Promise<void>;
|
|
16
16
|
protected static afterEach(): Promise<void>;
|
|
17
|
-
protected static Factory(options?: Partial<
|
|
17
|
+
protected static Factory(options?: Partial<ViewControllerFactoryOptions>): ViewControllerFactory;
|
|
18
18
|
protected static getFactory(): ViewControllerFactory;
|
|
19
19
|
protected static Controller<N extends keyof ViewControllerMap>(name: N, options: ControllerOptions<N>): ViewControllerMap[N];
|
|
20
20
|
protected static render<Vc extends ViewController<any>>(vc: Vc, options?: RenderOptions): ReturnType<Vc["render"]>;
|
|
@@ -256,7 +256,7 @@ declare const vcAssert: {
|
|
|
256
256
|
* @deprecated vcAssert.assertIsActiveRecordCard(...) -> activeRecordCardAssert.isActiveRecordCard(...)
|
|
257
257
|
*/
|
|
258
258
|
assertIsActiveRecordCard(vc: ViewController<Card>): void;
|
|
259
|
-
assertControllerInstanceOf<Controller extends ViewController<any>>(vc: ViewController<any> | null, Class: new (...arg: any[]) => Controller): Controller;
|
|
259
|
+
assertControllerInstanceOf<Controller extends ViewController<any>>(vc: ViewController<any> | null | undefined, Class: new (...arg: any[]) => Controller): Controller;
|
|
260
260
|
assertRendersAsInstanceOf<Controller extends ViewController<any>>(vc: ViewController<any>, Class: new (...args: any[]) => Controller): Controller;
|
|
261
261
|
assertCardRendersStats(vc: ViewController<Card>): StatsViewController;
|
|
262
262
|
assertStatsRendersValue(vc: StatsViewController, idx: number, value: number | string): void;
|
|
@@ -909,7 +909,7 @@ const vcAssert = {
|
|
|
909
909
|
},
|
|
910
910
|
assertControllerInstanceOf(vc, Class) {
|
|
911
911
|
var _a, _b, _c;
|
|
912
|
-
assert.isTruthy(vc,
|
|
912
|
+
assert.isTruthy(vc, `Expected a vc but received '${vc}'!`);
|
|
913
913
|
const match = isVcInstanceOf(vc, Class);
|
|
914
914
|
assert.isTruthy(match, `Expected your ${(_c = (_b = (_a = Object.getPrototypeOf(vc)) === null || _a === void 0 ? void 0 : _a.constructor) === null || _b === void 0 ? void 0 : _b.name) !== null && _c !== void 0 ? _c : 'view controller'} to be an instance of ${Class.name}, but it wasn't!`);
|
|
915
915
|
return match;
|
|
@@ -100,7 +100,7 @@ declare const vcAssertUtil: {
|
|
|
100
100
|
assertRowRendersRatings(listVc: import("../..").ViewController<import("../..").List>, row: string | number): void;
|
|
101
101
|
assertSkillViewRendersActiveRecordCard(svc: import("../..").SkillViewController, id?: string): import("../..").ActiveRecordCardViewController;
|
|
102
102
|
assertIsActiveRecordCard(vc: import("../..").ViewController<import("../..").Card>): void;
|
|
103
|
-
assertControllerInstanceOf<Controller extends import("../..").ViewController<any>>(vc: import("../..").ViewController<any> | null, Class: new (...arg: any[]) => Controller): Controller;
|
|
103
|
+
assertControllerInstanceOf<Controller extends import("../..").ViewController<any>>(vc: import("../..").ViewController<any> | null | undefined, Class: new (...arg: any[]) => Controller): Controller;
|
|
104
104
|
assertRendersAsInstanceOf<Controller extends import("../..").ViewController<any>>(vc: import("../..").ViewController<any>, Class: new (...args: any[]) => Controller): Controller;
|
|
105
105
|
assertCardRendersStats(vc: import("../..").ViewController<import("../..").Card>): import("../..").StatsViewController;
|
|
106
106
|
assertStatsRendersValue(vc: import("../..").StatsViewController, idx: number, value: number | string): void;
|
|
@@ -6,6 +6,7 @@ import { Log } from '@sprucelabs/spruce-skill-utils';
|
|
|
6
6
|
import { BarChartViewController, CalendarEventOptions, PagerViewController } from '..';
|
|
7
7
|
import { fancyIcons, lineIcons } from '../constants';
|
|
8
8
|
import mapUtil from '../maps/map.utility';
|
|
9
|
+
import LockScreenSkillViewController, { LockScreenSkillViewControllerOptions } from '../skillViewControllers/LockScreen.svc';
|
|
9
10
|
import { UniversalViewOptionFields } from '../utilities/removeUniversalViewOptions';
|
|
10
11
|
import ActiveRecordCardViewController, { ActiveRecordCardViewControllerOptions } from '../viewControllers/activeRecord/ActiveRecordCard.vc';
|
|
11
12
|
import ActiveRecordListViewController, { ActiveRecordListViewControllerOptions } from '../viewControllers/activeRecord/ActiveRecordList.vc';
|
|
@@ -148,10 +149,12 @@ export type LatLng = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.LatLng;
|
|
|
148
149
|
export type List = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.List;
|
|
149
150
|
export type ListRow = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.ListRow;
|
|
150
151
|
export type ListCell = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.ListCell;
|
|
152
|
+
export type Dialog = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.Dialog;
|
|
151
153
|
export type Receipt = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.Receipt;
|
|
152
154
|
export type Pager = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.Pager;
|
|
153
155
|
export type Slide = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.CardSection;
|
|
154
156
|
export type SkillView = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.SkillView;
|
|
157
|
+
export type LockScreen = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.LockScreen;
|
|
155
158
|
export type Calendar = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.Calendar;
|
|
156
159
|
export type CalendarPerson = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.CalendarPerson;
|
|
157
160
|
export type CardFooter = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.CardFooter;
|
|
@@ -190,7 +193,7 @@ export type ButtonGroupButton = Omit<Button, 'onClick' | 'onClickHintIcon'> & {
|
|
|
190
193
|
id: string;
|
|
191
194
|
};
|
|
192
195
|
export type LineIconPosition = NonNullable<Button['lineIconPosition']>;
|
|
193
|
-
export interface SkillViewController<Args extends Record<string, any> = Record<string, any
|
|
196
|
+
export interface SkillViewController<Args extends Record<string, any> = Record<string, any>, ViewModel extends Record<string, any> = SkillView> extends ViewController<ViewModel> {
|
|
194
197
|
getIsLoginRequired?(): Promise<boolean>;
|
|
195
198
|
focus?(): Promise<void>;
|
|
196
199
|
/**
|
|
@@ -301,6 +304,7 @@ export interface ViewControllerMap {
|
|
|
301
304
|
'polar-area': PolarAreaViewController;
|
|
302
305
|
pager: PagerViewController;
|
|
303
306
|
'bar-chart': BarChartViewController;
|
|
307
|
+
'lock-screen': LockScreenSkillViewController;
|
|
304
308
|
}
|
|
305
309
|
export interface ViewControllerOptionsMap {
|
|
306
310
|
form: FormViewControllerOptions<any>;
|
|
@@ -343,6 +347,7 @@ export interface ViewControllerOptionsMap {
|
|
|
343
347
|
'polar-area': PolarAreaViewControllerOptions;
|
|
344
348
|
pager: PagerViewControllerOptions;
|
|
345
349
|
'bar-chart': BarChartViewControllerOptions;
|
|
350
|
+
'lock-screen': LockScreenSkillViewControllerOptions;
|
|
346
351
|
}
|
|
347
352
|
export interface SkillViewControllerMap {
|
|
348
353
|
}
|
|
@@ -361,6 +366,7 @@ export interface OnRenderHandler {
|
|
|
361
366
|
onRender?(): void;
|
|
362
367
|
}
|
|
363
368
|
export type RenderInDialogHandler = (options: DialogViewControllerOptions) => void;
|
|
369
|
+
export type RenderLockScreenHandler = (options: LockScreen) => void;
|
|
364
370
|
export interface ConfirmOptions {
|
|
365
371
|
title?: string;
|
|
366
372
|
subtitle?: string;
|
|
@@ -395,6 +401,7 @@ export interface ViewControllerOptions {
|
|
|
395
401
|
vcFactory: ViewControllerFactory;
|
|
396
402
|
connectToApi: () => Promise<Client>;
|
|
397
403
|
renderInDialogHandler: RenderInDialogHandler;
|
|
404
|
+
renderLockScreenHandler: RenderLockScreenHandler;
|
|
398
405
|
confirmHandler: ConfirmHandler;
|
|
399
406
|
voteHandler: VoteHandler;
|
|
400
407
|
toastHandler: ToastHandler;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const universalViewOptionFields: readonly ["vcFactory", "renderInDialogHandler", "confirmHandler", "voteHandler", "connectToApi", "device", "dates", "maps", "toastHandler", "log", "plugins"];
|
|
1
|
+
export declare const universalViewOptionFields: readonly ["vcFactory", "renderInDialogHandler", "confirmHandler", "voteHandler", "connectToApi", "device", "dates", "maps", "toastHandler", "log", "plugins", "renderLockScreenHandler"];
|
|
2
2
|
export type UniversalViewOptionFields = (typeof universalViewOptionFields)[number];
|
|
3
3
|
export default function removeUniversalViewOptions<R extends Record<string, any>>(rendered: R): Omit<R, UniversalViewOptionFields>;
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import { ConfirmOptions, ViewControllerOptions } from '../types/heartwood.types';
|
|
1
|
+
import { ConfirmOptions, Dialog, ViewControllerOptions } from '../types/heartwood.types';
|
|
2
2
|
import AbstractViewController from './Abstract.vc';
|
|
3
|
-
import { DialogOptions } from './Dialog.vc';
|
|
4
|
-
export type Dialog = DialogOptions;
|
|
5
|
-
export type ConfirmViewControllerOptions = ConfirmOptions & {
|
|
6
|
-
onAccept: () => void;
|
|
7
|
-
onDecline: () => void;
|
|
8
|
-
};
|
|
9
3
|
export default class ConfirmViewController extends AbstractViewController<Dialog> {
|
|
10
4
|
private dialogVc;
|
|
11
5
|
private acceptHandler;
|
|
12
6
|
private declineHandler;
|
|
13
7
|
constructor(options: ConfirmOptions & ViewControllerOptions & ConfirmViewControllerOptions);
|
|
8
|
+
private DialogVc;
|
|
14
9
|
handleDecline(): void;
|
|
15
10
|
handleAccept(): void;
|
|
16
11
|
hide(): Promise<void>;
|
|
17
|
-
render():
|
|
12
|
+
render(): Dialog;
|
|
18
13
|
}
|
|
14
|
+
export type ConfirmViewControllerOptions = ConfirmOptions & {
|
|
15
|
+
onAccept: () => void;
|
|
16
|
+
onDecline: () => void;
|
|
17
|
+
};
|
|
@@ -27,7 +27,10 @@ export default class ConfirmViewController extends AbstractViewController {
|
|
|
27
27
|
title: options.message,
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
|
-
this.dialogVc = this.
|
|
30
|
+
this.dialogVc = this.DialogVc(options, body);
|
|
31
|
+
}
|
|
32
|
+
DialogVc(options, body) {
|
|
33
|
+
return this.Controller('dialog', {
|
|
31
34
|
isVisible: true,
|
|
32
35
|
shouldShowCloseButton: false,
|
|
33
36
|
header: options.title || options.subtitle
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import { SpruceSchemas } from '@sprucelabs/mercury-types';
|
|
2
2
|
import { ViewController, ViewControllerOptions } from '../types/heartwood.types';
|
|
3
3
|
import AbstractViewController from './Abstract.vc';
|
|
4
|
-
export type DialogOptions = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.Card & SpruceSchemas.HeartwoodViewControllers.v2021_02_11.Dialog & {
|
|
5
|
-
closeHandler?: () => void;
|
|
6
|
-
};
|
|
7
|
-
export type Dialog = DialogOptions;
|
|
8
|
-
export type DialogViewControllerOptions = Omit<Dialog, 'closeHandler'>;
|
|
9
4
|
export default class DialogViewController extends AbstractViewController<Dialog> {
|
|
10
5
|
private closeResolver?;
|
|
11
6
|
private closePromise?;
|
|
@@ -25,3 +20,6 @@ export default class DialogViewController extends AbstractViewController<Dialog>
|
|
|
25
20
|
wait(): Promise<void>;
|
|
26
21
|
render(): Dialog;
|
|
27
22
|
}
|
|
23
|
+
export type DialogOptions = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.Card & SpruceSchemas.HeartwoodViewControllers.v2021_02_11.Dialog;
|
|
24
|
+
export type Dialog = DialogOptions;
|
|
25
|
+
export type DialogViewControllerOptions = Omit<Dialog, 'closeHandler'>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DateUtil } from '@sprucelabs/calendar-utils';
|
|
2
2
|
import { Log } from '@sprucelabs/spruce-skill-utils';
|
|
3
|
-
import { ConfirmHandler, ControllerOptions, ImportedViewController, RenderInDialogHandler, ViewController, ViewControllerMap, ViewControllerId, VoteHandler, Device, MapUtil, ViewControllerConstructor, ToastHandler, ViewControllerPlugins, ViewControllerPluginsByName, ConnectToApi, ViewControllerPlugin, ViewControllerPluginOptions, ViewControllerOptions, AppController, AppControllerConstructor, AppControllerId, AppControllerMap } from '../types/heartwood.types';
|
|
3
|
+
import { ConfirmHandler, ControllerOptions, ImportedViewController, RenderInDialogHandler, ViewController, ViewControllerMap, ViewControllerId, VoteHandler, Device, MapUtil, ViewControllerConstructor, ToastHandler, ViewControllerPlugins, ViewControllerPluginsByName, ConnectToApi, ViewControllerPlugin, ViewControllerPluginOptions, ViewControllerOptions, AppController, AppControllerConstructor, AppControllerId, AppControllerMap, RenderLockScreenHandler } from '../types/heartwood.types';
|
|
4
4
|
export default class ViewControllerFactory {
|
|
5
5
|
static Class?: typeof ViewControllerFactory;
|
|
6
6
|
private controllerMap;
|
|
@@ -15,6 +15,7 @@ export default class ViewControllerFactory {
|
|
|
15
15
|
protected log?: Log;
|
|
16
16
|
protected plugins: ViewControllerPlugins;
|
|
17
17
|
private AppMap;
|
|
18
|
+
private renderLockScreenHandler;
|
|
18
19
|
constructor(options: ViewControllerFactoryConstructorOptions);
|
|
19
20
|
setRenderInDialogHandler(handler: RenderInDialogHandler): void;
|
|
20
21
|
setConfirmHandler(handler: ConfirmHandler): void;
|
|
@@ -40,6 +41,7 @@ export default class ViewControllerFactory {
|
|
|
40
41
|
export interface ViewControllerFactoryOptions {
|
|
41
42
|
controllerMap?: Record<string, any>;
|
|
42
43
|
renderInDialogHandler?: RenderInDialogHandler;
|
|
44
|
+
renderLockScreenHandler?: RenderLockScreenHandler;
|
|
43
45
|
voteHandler?: VoteHandler;
|
|
44
46
|
confirmHandler?: ConfirmHandler;
|
|
45
47
|
toastHandler?: ToastHandler;
|
|
@@ -53,6 +55,7 @@ export interface ViewControllerFactoryOptions {
|
|
|
53
55
|
export interface ViewControllerFactoryConstructorOptions {
|
|
54
56
|
controllerMap: Record<string, any>;
|
|
55
57
|
renderInDialogHandler: RenderInDialogHandler;
|
|
58
|
+
renderLockScreenHandler: RenderLockScreenHandler;
|
|
56
59
|
connectToApi: ConnectToApi;
|
|
57
60
|
confirmHandler: ConfirmHandler;
|
|
58
61
|
voteHandler: VoteHandler;
|
|
@@ -17,9 +17,10 @@ export default class ViewControllerFactory {
|
|
|
17
17
|
constructor(options) {
|
|
18
18
|
this.plugins = {};
|
|
19
19
|
this.AppMap = {};
|
|
20
|
-
const { controllerMap, renderInDialogHandler, confirmHandler, connectToApi, voteHandler, device, dates, maps, toastHandler, log, pluginsByName, } = options;
|
|
20
|
+
const { controllerMap, renderInDialogHandler, renderLockScreenHandler, confirmHandler, connectToApi, voteHandler, device, dates, maps, toastHandler, log, pluginsByName, } = options;
|
|
21
21
|
this.controllerMap = Object.assign(Object.assign({}, controllerMap), CORE_CONTROLLER_MAP);
|
|
22
22
|
this.renderInDialogHandler = renderInDialogHandler;
|
|
23
|
+
this.renderLockScreenHandler = renderLockScreenHandler;
|
|
23
24
|
this.confirmHandler = confirmHandler;
|
|
24
25
|
this.connectToApi = connectToApi;
|
|
25
26
|
this.voteHandler = voteHandler;
|
|
@@ -41,7 +42,7 @@ export default class ViewControllerFactory {
|
|
|
41
42
|
}
|
|
42
43
|
static Factory(options) {
|
|
43
44
|
var _a;
|
|
44
|
-
const { controllerMap = {}, renderInDialogHandler, confirmHandler, connectToApi, voteHandler, device, dates, maps, toastHandler, log, pluginsByName, } = assertOptions(options, ['connectToApi', 'device']);
|
|
45
|
+
const { controllerMap = {}, renderInDialogHandler, renderLockScreenHandler, confirmHandler, connectToApi, voteHandler, device, dates, maps, toastHandler, log, pluginsByName, } = assertOptions(options, ['connectToApi', 'device']);
|
|
45
46
|
return new ((_a = this.Class) !== null && _a !== void 0 ? _a : this)({
|
|
46
47
|
controllerMap,
|
|
47
48
|
connectToApi,
|
|
@@ -51,11 +52,10 @@ export default class ViewControllerFactory {
|
|
|
51
52
|
log,
|
|
52
53
|
pluginsByName,
|
|
53
54
|
toastHandler: toastHandler !== null && toastHandler !== void 0 ? toastHandler : (() => { }),
|
|
54
|
-
confirmHandler: confirmHandler ? confirmHandler : () => __awaiter(this, void 0, void 0, function* () { return false; }),
|
|
55
|
-
voteHandler: voteHandler ? voteHandler : () => __awaiter(this, void 0, void 0, function* () { }),
|
|
56
|
-
renderInDialogHandler: renderInDialogHandler
|
|
57
|
-
|
|
58
|
-
: () => { },
|
|
55
|
+
confirmHandler: confirmHandler !== null && confirmHandler !== void 0 ? confirmHandler : (() => __awaiter(this, void 0, void 0, function* () { return false; })),
|
|
56
|
+
voteHandler: voteHandler !== null && voteHandler !== void 0 ? voteHandler : (() => __awaiter(this, void 0, void 0, function* () { })),
|
|
57
|
+
renderInDialogHandler: renderInDialogHandler !== null && renderInDialogHandler !== void 0 ? renderInDialogHandler : (() => { }),
|
|
58
|
+
renderLockScreenHandler: renderLockScreenHandler !== null && renderLockScreenHandler !== void 0 ? renderLockScreenHandler : (() => { }),
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
61
|
setController(name, Class) {
|
|
@@ -155,7 +155,7 @@ export default class ViewControllerFactory {
|
|
|
155
155
|
}
|
|
156
156
|
buildViewContructorOptions(name, options) {
|
|
157
157
|
var _a;
|
|
158
|
-
return Object.assign(Object.assign(Object.assign(Object.assign({}, options), { vcFactory: this }), this.sharedConstructorOptions(name)), { renderInDialogHandler: this.renderInDialogHandler, confirmHandler: this.confirmHandler, voteHandler: (_a = options === null || options === void 0 ? void 0 : options.voteHandler) !== null && _a !== void 0 ? _a : this.voteHandler, toastHandler: this.toastHandler });
|
|
158
|
+
return Object.assign(Object.assign(Object.assign(Object.assign({}, options), { vcFactory: this }), this.sharedConstructorOptions(name)), { renderInDialogHandler: this.renderInDialogHandler, confirmHandler: this.confirmHandler, renderLockScreenHandler: this.renderLockScreenHandler, voteHandler: (_a = options === null || options === void 0 ? void 0 : options.voteHandler) !== null && _a !== void 0 ? _a : this.voteHandler, toastHandler: this.toastHandler });
|
|
159
159
|
}
|
|
160
160
|
sharedConstructorOptions(name) {
|
|
161
161
|
var _a;
|
package/build/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export * from './viewControllers/ButtonGroup.vc';
|
|
|
11
11
|
export { default as CardViewControllerImpl } from './viewControllers/card/Card.vc';
|
|
12
12
|
export { default as ConfirmViewController } from './viewControllers/Confirm.vc';
|
|
13
13
|
export { default as DialogViewController } from './viewControllers/Dialog.vc';
|
|
14
|
+
export { default as LockScreenSkillViewController } from './skillViewControllers/LockScreen.svc';
|
|
14
15
|
export { default as NavigationViewController } from './viewControllers/navigation/Navigation.vc';
|
|
15
16
|
export { default as ListViewController } from './viewControllers/list/List.vc';
|
|
16
17
|
export { default as ListRowViewController } from './viewControllers/list/ListRow.vc';
|
|
@@ -68,6 +69,7 @@ export { default as fancyIconSchema } from './.spruce/schemas/heartwoodViewContr
|
|
|
68
69
|
export { default as lineIconSchema } from './.spruce/schemas/heartwoodViewControllers/v2021_02_11/lineIcon.schema';
|
|
69
70
|
export { default as buttonSchema } from './.spruce/schemas/heartwoodViewControllers/v2021_02_11/button.schema';
|
|
70
71
|
export { default as dialogSchema } from './.spruce/schemas/heartwoodViewControllers/v2021_02_11/dialog.schema';
|
|
72
|
+
export { default as lockScreenSchema } from './.spruce/schemas/heartwoodViewControllers/v2021_02_11/lockScreen.schema';
|
|
71
73
|
export { default as textSchema } from './.spruce/schemas/heartwoodViewControllers/v2021_02_11/text.schema';
|
|
72
74
|
export { default as formSchema } from './.spruce/schemas/heartwoodViewControllers/v2021_02_11/form.schema';
|
|
73
75
|
export { default as formSectionSchema } from './.spruce/schemas/heartwoodViewControllers/v2021_02_11/formSection.schema';
|
package/build/index.js
CHANGED
|
@@ -17,10 +17,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
17
17
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
18
|
};
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.
|
|
21
|
-
exports.
|
|
22
|
-
exports.
|
|
23
|
-
exports.navigationRouteSchema = exports.routerDestinationSchema = exports.navigationDropdownButtonSchema = exports.navigationButtonDropdownSchema = exports.barChartDataSetSchema = exports.barChartDataPointSchema = exports.barChartSchema = exports.progressDetailsSchema = exports.progressNavigatorStepSchema = exports.progressNavigatorSchema = exports.countdownTimerSchema = exports.permissionContractReferenceSchema = exports.navigationButtonSchema = exports.navigationSchema = exports.ToolBeltStateMachine = exports.removeUniversalViewOptions = exports.buildSkillViewLayout = exports.splitCardsIntoLayouts = exports.listUtil = exports.mapInteractor = exports.mapAssert = exports.renderUtil = exports.routerTestPatcher = exports.dialogTestPatcher = exports.confirmTestPatcher = exports.calendarSeeder = exports.interactionUtil = void 0;
|
|
20
|
+
exports.buttonSchema = exports.lineIconSchema = exports.fancyIconSchema = exports.selectInputSchema = exports.skillViewSchema = exports.bigFormSchema = exports.calendarEventColorsSchema = exports.buildSkillView = exports.buildForm = exports.buildBigForm = exports.AuthenticatorImpl = exports.PolarAreaViewController = exports.MockActiveRecordCard = exports.activeRecordCardAssert = exports.buildActiveRecordList = exports.buildActiveRecordCard = exports.AbstractInputViewController = exports.AutocompleteInputViewController = exports.AbstractCalendarEventViewController = exports.RatingsViewController = exports.ProgressViewController = exports.StatsViewController = exports.FeedViewController = exports.ActiveRecordListViewController = exports.ActiveRecordCardViewController = exports.TalkingSprucebotViewController = exports.ButtonBarViewController = exports.CalendarViewController = exports.SwipeCardViewControllerImpl = exports.SwipeViewControllerImpl = exports.PagerViewController = exports.ProgressNavigatorViewController = exports.CountdownTimerViewController = exports.FormBuilderCardViewControllerImpl = exports.LoginViewController = exports.BarChartViewController = exports.ToolBeltViewController = exports.FormViewControllerImpl = exports.ListCellViewController = exports.ListRowViewController = exports.ListViewController = exports.NavigationViewController = exports.LockScreenSkillViewController = exports.DialogViewController = exports.ConfirmViewController = exports.CardViewControllerImpl = exports.ButtonGroupViewController = exports.AbstractAppController = exports.AbstractViewController = exports.AbstractSkillViewController = void 0;
|
|
21
|
+
exports.ratingsSchema = exports.progressSchema = exports.statsStatSchema = exports.statsSchema = exports.toggleInputSchema = exports.listToggleInputSchema = exports.addressInputSchema = exports.buttonBarButtonSchema = exports.buttonBarSchema = exports.toolBeltToolSchema = exports.toolBeltSchema = exports.calendarTimeSchema = exports.calendarPersonSchema = exports.calendarSchema = exports.themePropsSchema = exports.themeSchema = exports.cardFooterButtonSchema = exports.criticalErrorSchema = exports.sprucebotTypedMessageSentenceSchema = exports.sprucebotTypedMessageAvatarSchema = exports.selectInputChoiceSchema = exports.calendarEventColorOverrideSchema = exports.portalSchema = exports.listTextInputSchema = exports.listSelectInputSchema = exports.listCellButtonSchema = exports.dropdownButtonSchema = exports.bigFormSectionSchema = exports.textInputSchema = exports.phoneInputSchema = exports.inputSchema = exports.dropdownSchema = exports.sprucebotTypedMessageSchema = exports.talkingSprucebotSchema = exports.sprucebotAvatarSchema = exports.formBuilderImportExportObjectSchema = exports.listCellSchema = exports.listRowSchema = exports.listSchema = exports.layoutSchema = exports.cardSectionSchema = exports.cardHeaderSchema = exports.cardFooterSchema = exports.cardBodySchema = exports.cardSchema = exports.formSectionSchema = exports.formSchema = exports.textSchema = exports.lockScreenSchema = exports.dialogSchema = void 0;
|
|
22
|
+
exports.countdownTimerInteractor = exports.countdownTimerAssert = exports.calendarInteractor = exports.interactor = exports.normalizeScopeFromVc = exports.autocompleteInteractor = exports.formAssert = exports.autocompleteAssert = exports.listAssert = exports.buttonAssert = exports.deviceAssert = exports.navigationAssert = exports.toolBeltAssert = exports.toastAssert = exports.vcPluginAssert = exports.vcDurationAssert = exports.pagerAssert = exports.vcAssert = exports.vcAssertUtil = exports.feedAssert = exports.feedInteractor = exports.normalizeFormSectionFieldNamesUtil = exports.ViewControllerError = exports.SpyDevice = exports.StubStorage = exports.ViewControllerFactory = exports.ViewControllerImporter = exports.ViewControllerExporter = exports.pagerSchema = exports.polarAreaDataItemSchema = exports.polarAreaSchema = exports.inputButtonSchema = exports.mapPinSchema = exports.mapSchema = exports.latLngSchema = exports.formBuilderImportExportPageSchema = exports.autocompleteSuggestionSchema = exports.autocompleteInputSchema = exports.feedSchema = exports.calendarShiftSchema = exports.receiptTotalSchema = exports.receiptSectionSchema = exports.receiptLineItemSchema = exports.receiptHeaderSchema = exports.receiptSchema = exports.listDateInputSchema = exports.calendarSelectedDateSchema = exports.calendarEventSchema = exports.ratingsInputSchema = exports.listRatingsInputSchema = void 0;
|
|
23
|
+
exports.navigationRouteSchema = exports.routerDestinationSchema = exports.navigationDropdownButtonSchema = exports.navigationButtonDropdownSchema = exports.barChartDataSetSchema = exports.barChartDataPointSchema = exports.barChartSchema = exports.progressDetailsSchema = exports.progressNavigatorStepSchema = exports.progressNavigatorSchema = exports.countdownTimerSchema = exports.permissionContractReferenceSchema = exports.navigationButtonSchema = exports.navigationSchema = exports.ToolBeltStateMachine = exports.removeUniversalViewOptions = exports.buildSkillViewLayout = exports.splitCardsIntoLayouts = exports.listUtil = exports.mapInteractor = exports.mapAssert = exports.renderUtil = exports.routerTestPatcher = exports.dialogTestPatcher = exports.confirmTestPatcher = exports.calendarSeeder = exports.interactionUtil = exports.barChartAssert = exports.progressNavigatorAssert = void 0;
|
|
24
24
|
__exportStar(require("./constants"), exports);
|
|
25
25
|
__exportStar(require("./types/heartwood.types"), exports);
|
|
26
26
|
__exportStar(require("./utilities/removeUniversalViewOptions"), exports);
|
|
@@ -41,6 +41,8 @@ var Confirm_vc_1 = require("./viewControllers/Confirm.vc");
|
|
|
41
41
|
Object.defineProperty(exports, "ConfirmViewController", { enumerable: true, get: function () { return __importDefault(Confirm_vc_1).default; } });
|
|
42
42
|
var Dialog_vc_1 = require("./viewControllers/Dialog.vc");
|
|
43
43
|
Object.defineProperty(exports, "DialogViewController", { enumerable: true, get: function () { return __importDefault(Dialog_vc_1).default; } });
|
|
44
|
+
var LockScreen_svc_1 = require("./skillViewControllers/LockScreen.svc");
|
|
45
|
+
Object.defineProperty(exports, "LockScreenSkillViewController", { enumerable: true, get: function () { return __importDefault(LockScreen_svc_1).default; } });
|
|
44
46
|
var Navigation_vc_1 = require("./viewControllers/navigation/Navigation.vc");
|
|
45
47
|
Object.defineProperty(exports, "NavigationViewController", { enumerable: true, get: function () { return __importDefault(Navigation_vc_1).default; } });
|
|
46
48
|
var List_vc_1 = require("./viewControllers/list/List.vc");
|
|
@@ -140,6 +142,8 @@ var button_schema_1 = require("./.spruce/schemas/heartwoodViewControllers/v2021_
|
|
|
140
142
|
Object.defineProperty(exports, "buttonSchema", { enumerable: true, get: function () { return __importDefault(button_schema_1).default; } });
|
|
141
143
|
var dialog_schema_1 = require("./.spruce/schemas/heartwoodViewControllers/v2021_02_11/dialog.schema");
|
|
142
144
|
Object.defineProperty(exports, "dialogSchema", { enumerable: true, get: function () { return __importDefault(dialog_schema_1).default; } });
|
|
145
|
+
var lockScreen_schema_1 = require("./.spruce/schemas/heartwoodViewControllers/v2021_02_11/lockScreen.schema");
|
|
146
|
+
Object.defineProperty(exports, "lockScreenSchema", { enumerable: true, get: function () { return __importDefault(lockScreen_schema_1).default; } });
|
|
143
147
|
var text_schema_1 = require("./.spruce/schemas/heartwoodViewControllers/v2021_02_11/text.schema");
|
|
144
148
|
Object.defineProperty(exports, "textSchema", { enumerable: true, get: function () { return __importDefault(text_schema_1).default; } });
|
|
145
149
|
var form_schema_1 = require("./.spruce/schemas/heartwoodViewControllers/v2021_02_11/form.schema");
|
|
@@ -50,13 +50,6 @@ declare const _default: {
|
|
|
50
50
|
type: "text";
|
|
51
51
|
label: string;
|
|
52
52
|
};
|
|
53
|
-
isRequired: {
|
|
54
|
-
type: "boolean";
|
|
55
|
-
label: string;
|
|
56
|
-
};
|
|
57
|
-
value: {
|
|
58
|
-
type: "text";
|
|
59
|
-
};
|
|
60
53
|
onChange: {
|
|
61
54
|
type: "raw";
|
|
62
55
|
label: string;
|
|
@@ -64,6 +57,13 @@ declare const _default: {
|
|
|
64
57
|
valueType: string;
|
|
65
58
|
};
|
|
66
59
|
};
|
|
60
|
+
isRequired: {
|
|
61
|
+
type: "boolean";
|
|
62
|
+
label: string;
|
|
63
|
+
};
|
|
64
|
+
value: {
|
|
65
|
+
type: "text";
|
|
66
|
+
};
|
|
67
67
|
rightButtons: {
|
|
68
68
|
type: "schema";
|
|
69
69
|
isArray: true;
|
|
@@ -28,6 +28,15 @@ declare const _default: {
|
|
|
28
28
|
onClose: {
|
|
29
29
|
type: "raw";
|
|
30
30
|
label: string;
|
|
31
|
+
hint: string;
|
|
32
|
+
options: {
|
|
33
|
+
valueType: string;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
closeHandler: {
|
|
37
|
+
type: "raw";
|
|
38
|
+
label: string;
|
|
39
|
+
hint: string;
|
|
31
40
|
options: {
|
|
32
41
|
valueType: string;
|
|
33
42
|
};
|
|
@@ -36,6 +36,15 @@ exports.default = (0, schema_1.buildSchema)({
|
|
|
36
36
|
onClose: {
|
|
37
37
|
type: 'raw',
|
|
38
38
|
label: 'Close callback',
|
|
39
|
+
hint: 'Called when the dialog is closed',
|
|
40
|
+
options: {
|
|
41
|
+
valueType: '() => Promise<void | boolean> | void | boolean',
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
closeHandler: {
|
|
45
|
+
type: 'raw',
|
|
46
|
+
label: 'Close handler',
|
|
47
|
+
hint: 'Called to actually close the dialog',
|
|
39
48
|
options: {
|
|
40
49
|
valueType: '() => Promise<void | boolean> | void | boolean',
|
|
41
50
|
},
|