@genesislcap/foundation-layout 14.92.2-beta.revert-PA-913.1 → 14.92.3-beta.29253cf.1
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +20 -2
- package/dist/custom-elements.json +11 -3
- package/dist/dts/index.d.ts +1 -1
- package/dist/dts/index.d.ts.map +1 -1
- package/dist/dts/main/layout-main.d.ts +9 -0
- package/dist/dts/main/layout-main.d.ts.map +1 -1
- package/dist/dts/utils/constants.d.ts +5 -0
- package/dist/dts/utils/constants.d.ts.map +1 -1
- package/dist/dts/utils/events.d.ts +4 -0
- package/dist/dts/utils/events.d.ts.map +1 -1
- package/dist/dts/utils/types.d.ts +74 -2
- package/dist/dts/utils/types.d.ts.map +1 -1
- package/dist/esm/main/layout-main.js +55 -7
- package/dist/esm/utils/constants.js +5 -0
- package/dist/esm/utils/events.js +2 -0
- package/dist/esm/utils/types.js +1 -1
- package/dist/foundation-layout.api.json +109 -5
- package/dist/foundation-layout.d.ts +77 -0
- package/docs/api/foundation-layout.foundationlayout.getlayout.md +4 -0
- package/docs/api/foundation-layout.layoutcomponentwithstate.applystate.md +24 -0
- package/docs/api/foundation-layout.layoutcomponentwithstate.getcurrentstate.md +17 -0
- package/docs/api/foundation-layout.layoutcomponentwithstate.md +75 -0
- package/docs/api/foundation-layout.layoutreceiveevents.md +2 -1
- package/docs/api/foundation-layout.layoutreceiveeventsdetail.md +2 -1
- package/docs/api/foundation-layout.md +3 -2
- package/docs/api-report.md +8 -0
- package/package.json +8 -8
package/README.md
CHANGED
@@ -189,11 +189,13 @@ To enable autosaving the layout see [here](#autosaving-layout).
|
|
189
189
|
|
190
190
|
#### [Get Layout](./docs/api/foundation-layout.foundationlayout.getlayout.md)
|
191
191
|
|
192
|
-
Get an object describing the current layout so that it can be restored at a later date. This does not save any data internally to the layout. It is up to the client to store this state where appropriate for later recall (browser local storage, persistence layer, etc.)
|
192
|
+
Get an object describing the current layout so that it can be restored at a later date. This does not save any data internally to the layout. It is up to the client to store this state where appropriate for later recall (browser local storage, persistence layer, etc.). Use the [autosaving layout](#autosaving-layout) feature to get the layout to do this for you with local storage.
|
193
|
+
|
194
|
+
You can store state for an instance of an item, and that will be saved inline. See [managing state](#managing-state).
|
193
195
|
|
194
196
|
#### [Load Layout](./docs/api/foundation-layout.foundationlayout.loadlayout.md)
|
195
197
|
|
196
|
-
Loads a serialised layout. All items that are described in the config to load must already be registered with the layout system - using either the declarative or JavaScript API. If there are items missing (could be due either to missing items or to a mismatch of registered names) then a `LayoutUsageError` will be thrown containing the names of the missing items.
|
198
|
+
Loads a serialised layout. All items that are described in the config to load must already be registered with the layout system - using either the declarative or JavaScript API. If there are items missing (could be due either to missing items or to a mismatch of registered names) then a `LayoutUsageError` will be thrown containing the names of the missing items. Alternatively, you can request placeholder items to be added.
|
197
199
|
|
198
200
|
## Events
|
199
201
|
|
@@ -300,6 +302,22 @@ Throughout Foundation UI, there is no need to de-register a component that is re
|
|
300
302
|
|
301
303
|
- Once the component is actually initialised in the layout on the DOM, then `shouldRunConnect` will be true, and you can then perform all the required initialisation.
|
302
304
|
|
305
|
+
### Managing state
|
306
|
+
|
307
|
+
Items inside of the layout can save and restore state using various methods, but it can become difficult to manage state if you're adding the same item to the layout multiple times (multiple instances of the same web component).
|
308
|
+
|
309
|
+
You can implement the [LayoutComponentWithState](./docs/api/foundation-layout.layoutcomponentwithstate.md) interface which will allow you to save and load state *per instance* of your components. See the linked interface and the associated functions API documentation for examples and explanations of usage.
|
310
|
+
|
311
|
+
Usage of this interface is optional, if you do not need to manage state for your components in this way then simply do not implement the interface.
|
312
|
+
|
313
|
+
:::warning
|
314
|
+
The layout system is only interacting with the immediately contained items - so if you have components that contain other components, the top level components will need to interact with the contained components to manage their state.
|
315
|
+
:::
|
316
|
+
|
317
|
+
:::danger
|
318
|
+
Each layout item can contain multiple components, and most of the time there are no extra considerations when doing this. However, the state of each component in an instance is saved in order of the components on the DOM, so if the serialised state is manually changed to have the items out of order with their state, then the incorrect states will be passed into each item. This should not occur during defined behaviour, but is possible if the end-user is able to change the state passed into `loadLayout()` manually.
|
319
|
+
:::
|
320
|
+
|
303
321
|
### Element cloning
|
304
322
|
|
305
323
|
To enable you to add multiple items from the same `registration`, the layout system clones elements to add to the layout.
|
@@ -45,6 +45,14 @@
|
|
45
45
|
"module": "./utils"
|
46
46
|
}
|
47
47
|
},
|
48
|
+
{
|
49
|
+
"kind": "js",
|
50
|
+
"name": "LayoutComponentWithState",
|
51
|
+
"declaration": {
|
52
|
+
"name": "LayoutComponentWithState",
|
53
|
+
"module": "./utils"
|
54
|
+
}
|
55
|
+
},
|
48
56
|
{
|
49
57
|
"kind": "js",
|
50
58
|
"name": "LayoutEmitEvents",
|
@@ -1233,10 +1241,10 @@
|
|
1233
1241
|
"kind": "variable",
|
1234
1242
|
"name": "LayoutReceiveEvents",
|
1235
1243
|
"type": {
|
1236
|
-
"text": "{\n changeTitle: 'change-title',\n}"
|
1244
|
+
"text": "{\n changeTitle: 'change-title',\n autosave: 'autosave',\n}"
|
1237
1245
|
},
|
1238
|
-
"default": "{\n changeTitle: 'change-title',\n}",
|
1239
|
-
"description": "Defines events that the layout system listens for\n\n'changeTitle' - emit this from a contained item to update the title of the window that contains it.",
|
1246
|
+
"default": "{\n changeTitle: 'change-title',\n autosave: 'autosave',\n}",
|
1247
|
+
"description": "Defines events that the layout system listens for\n\n'changeTitle' - emit this from a contained item to update the title of the window that contains it.\n'autosave' - emit this from a contained item to hint to the layout system that it should autosave the layout. A contained item should do this if it has just changed some state it would like to persist. See LayoutComponentWithState.",
|
1240
1248
|
"privacy": "public"
|
1241
1249
|
}
|
1242
1250
|
],
|
package/dist/dts/index.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
1
|
export * from './main';
|
2
2
|
export { LAYOUT_ICONS } from './styles';
|
3
|
-
export { CustomButton, DEFAULT_RELOAD_BUFFER, LayoutEmitEvents, LayoutReceiveEvents, LayoutReceiveEventsDetail, LayoutRegionType, LayoutRegistrationError, LayoutUsageError, Placement, RegisteredElementConfig, RegistrationConfig, SerialisedLayout, } from './utils';
|
3
|
+
export { CustomButton, DEFAULT_RELOAD_BUFFER, LayoutComponentWithState, LayoutEmitEvents, LayoutReceiveEvents, LayoutReceiveEventsDetail, LayoutRegionType, LayoutRegistrationError, LayoutUsageError, Placement, RegisteredElementConfig, RegistrationConfig, SerialisedLayout, } from './utils';
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/dts/index.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EACL,YAAY,EACZ,qBAAqB,EACrB,gBAAgB,EAChB,mBAAmB,EACnB,yBAAyB,EACzB,gBAAgB,EAChB,uBAAuB,EACvB,gBAAgB,EAChB,SAAS,EACT,uBAAuB,EACvB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,SAAS,CAAC"}
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EACL,YAAY,EACZ,qBAAqB,EACrB,wBAAwB,EACxB,gBAAgB,EAChB,mBAAmB,EACnB,yBAAyB,EACzB,gBAAgB,EAChB,uBAAuB,EACvB,gBAAgB,EAChB,SAAS,EACT,uBAAuB,EACvB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,SAAS,CAAC"}
|
@@ -107,6 +107,8 @@ export declare class FoundationLayout extends FoundationElement implements Layou
|
|
107
107
|
private onPostItemRemoved;
|
108
108
|
/** @internal */
|
109
109
|
private onPostItemResized;
|
110
|
+
/** @internal */
|
111
|
+
private onAutosaveRequest;
|
110
112
|
/**
|
111
113
|
* JS API, public
|
112
114
|
*/
|
@@ -135,6 +137,8 @@ export declare class FoundationLayout extends FoundationElement implements Layou
|
|
135
137
|
/**
|
136
138
|
* @public
|
137
139
|
* Gets a minified string containing the config describing the current layout of the layout object to later restore in {@link FoundationLayout.loadLayout | function}
|
140
|
+
* @remarks
|
141
|
+
* Includes any state for a contained component exposed by the {@link LayoutComponentWithState} interface.
|
138
142
|
* @returns - latest version of {@link SerialisedLayout} describing the layout
|
139
143
|
*/
|
140
144
|
getLayout(): SerialisedLayout;
|
@@ -278,6 +282,11 @@ export declare class FoundationLayout extends FoundationElement implements Layou
|
|
278
282
|
* @internal
|
279
283
|
*/
|
280
284
|
private setupCustomButtons;
|
285
|
+
/**
|
286
|
+
* Return an array of each contained items in the layout.
|
287
|
+
* @internal
|
288
|
+
*/
|
289
|
+
private getLayoutComponents;
|
281
290
|
}
|
282
291
|
/**
|
283
292
|
* `ViewTemplate` which defines the html for {@link FoundationLayout}.
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"layout-main.d.ts","sourceRoot":"","sources":["../../../src/main/layout-main.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,YAAY,EAEZ,cAAc,EAGf,MAAM,kCAAkC,CAAC;AAI1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAE/D,OAAO,EAEL,eAAe,EAGf,SAAS,EACT,uBAAuB,EACvB,kBAAkB,EAClB,gBAAgB,EAChB,aAAa,EAKb,YAAY,
|
1
|
+
{"version":3,"file":"layout-main.d.ts","sourceRoot":"","sources":["../../../src/main/layout-main.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,YAAY,EAEZ,cAAc,EAGf,MAAM,kCAAkC,CAAC;AAI1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAE/D,OAAO,EAEL,eAAe,EAGf,SAAS,EACT,uBAAuB,EACvB,kBAAkB,EAClB,gBAAgB,EAChB,aAAa,EAKb,YAAY,EAIb,MAAM,WAAW,CAAC;AAKnB,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAiBzC;;;;;;GAMG;AACH,qBAAa,gBAAiB,SAAQ,iBAAkB,YAAW,eAAe;;IAChF,OAAO,CAAC,MAAM,CAAe;IAC7B,gBAAgB;IAChB,aAAa,EAAE,WAAW,CAAC;IAC3B,OAAO,CAAC,YAAY,CAAqC;IAEzD,gBAAgB;IAChB,CAAC,aAAa,CAAC,SAAmB;IAElC;;;;OAIG;IACmC,YAAY,EAAE,MAAM,CAAyB;IACnF,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,oBAAoB,CAAK;IAEjC,gBAAgB;IACV,OAAO,CAAC,IAAI,CAAO;IAEzB,gBAAgB;IACP,OAAO,CAAC,OAAO,CAAU;IAClC;;;;;OAKG;IACmC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC3D;;;;OAIG;IACS,sBAAsB,gBAAiB,MAAM,YAC2B;IAEpF;;;OAGG;IACH,gBAAgB,CAAC,EAAE,YAAY,CAAC,UAAU,CAAC;IAE3C;;;;;;;;;;OAUG;IACS,cAAc,UAAS;IACnC,gBAAgB;IACJ,mBAAmB,UAAS;IAExC;;;;;OAKG;IACH,aAAa,EAAE,YAAY,EAAE,CAAC;IAE9B;;;OAGG;IACS,QAAQ,EAAE,OAAO,CAAS;IAEtC;;;;;OAKG;IACI,KAAK,yBAAmC;IAE/C;;;;;;;OAOG;IACI,oBAAoB,EAAE,MAAM,GAAG,SAAS,CAAa;IAE5D,gBAAgB;;IAWhB,gBAAgB;IAChB,iBAAiB,IAAI,IAAI;IA0BzB,gBAAgB;IAChB,oBAAoB,IAAI,IAAI;IAU5B,gBAAgB;IAChB,OAAO,CAAC,WAAW;IAInB,gBAAgB;IAChB,OAAO,CAAC,UAAU;IAMlB,gBAAgB;IAChB,OAAO,CAAC,eAAe;IAKvB,gBAAgB;IAChB,OAAO,CAAC,gBAAgB;IAIxB,gBAAgB;IAChB,OAAO,CAAC,iBAAiB;IAOzB,gBAAgB;IAChB,OAAO,CAAC,iBAAiB;IAKzB,gBAAgB;IAChB,OAAO,CAAC,iBAAiB;IAIzB;;OAEG;IAEH;;;;;;;;;;OAUG;IACH,MAAM,CAAC,2BAA2B,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,EAAE;IActE;;;;;;;;OAQG;IACH,eAAe,IAAI,MAAM,EAAE;IAI3B;;;;;;OAMG;IACH,SAAS,IAAI,gBAAgB;IAe7B;;;;;;;;;;;;OAYG;IACH,6BAA6B,IAAI,OAAO;IAcxC;;;;;;;;;;;OAWG;IACH,UAAU,CAAC,MAAM,EAAE,gBAAgB,EAAE,iBAAiB,GAAE,aAAa,GAAG,OAAiB;IAsBzF;;;;;;;;;;;OAWG;IACH,OAAO,CACL,MAAM,EAAE,uBAAuB,GAAG,uBAAuB,EAAE,EAC3D,SAAS,GAAE,SAAmC;IA+DhD;;;;;;;;;;;;;;;OAeG;IACH,YAAY,CAAC,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,MAAM;IAW/D;;OAEG;IAEH;;;;;OAKG;IACH,OAAO,CAAC,oBAAoB;IAI5B;;;;OAIG;IACH,mBAAmB,IAAI,IAAI;IAmB3B;;;;;;;OAOG;IACH,gBAAgB,CAAC,CAAC,SAAS,cAAc,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC;IAetD;;;;;;;OAOG;IACH,wBAAwB,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE,kBAAkB,GAAG,MAAM;IAwEtE;;;OAGG;IACH,OAAO,CAAC,wBAAwB;IAehC;;;;SAIK;IACL,OAAO,CAAC,kBAAkB;IAY1B;;;;;;;;OAQG;IACH,OAAO,CAAC,kCAAkC;IA4B1C;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,oBAAoB;IAW5B;;;;;;;;OAQG;IACH,OAAO,CAAC,mBAAmB;IAU3B;;;OAGG;IACH,OAAO,CAAC,kBAAkB;IAc1B;;;OAGG;IACH,OAAO,CAAC,mBAAmB;CAK5B;AAMD;;;;;GAKG;AACH,eAAO,MAAM,cAAc,uEAK1B,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;2BAI3B,CAAC"}
|
@@ -3,6 +3,11 @@
|
|
3
3
|
* @internal
|
4
4
|
*/
|
5
5
|
export declare const componentType: unique symbol;
|
6
|
+
/**
|
7
|
+
* Used to key a reference to the instance and golden layout container on a layout component.
|
8
|
+
* @internal
|
9
|
+
*/
|
10
|
+
export declare const instanceContainer: unique symbol;
|
6
11
|
/**
|
7
12
|
* Default time in milliseconds for the layout to buffer calls to reloading
|
8
13
|
* the layout while the declarative API is loading.
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/utils/constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,aAAa,eAA2B,CAAC;AAEtD;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,MAAM,CAAC;AAEzC;;;GAGG;AACH,eAAO,MAAM,YAAY,+BAA+B,CAAC"}
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/utils/constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,aAAa,eAA2B,CAAC;AAEtD;;;GAGG;AACH,eAAO,MAAM,iBAAiB,eAA+B,CAAC;AAE9D;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,MAAM,CAAC;AAEzC;;;GAGG;AACH,eAAO,MAAM,YAAY,+BAA+B,CAAC"}
|
@@ -21,15 +21,18 @@ export declare const LayoutEmitEvents: {
|
|
21
21
|
* Defines events that the layout system listens for
|
22
22
|
*
|
23
23
|
* 'changeTitle' - emit this from a contained item to update the title of the window that contains it.
|
24
|
+
* 'autosave' - emit this from a contained item to hint to the layout system that it should autosave the layout. A contained item should do this if it has just changed some state it would like to persist. See {@link LayoutComponentWithState}.
|
24
25
|
* @public
|
25
26
|
*/
|
26
27
|
export declare const LayoutReceiveEvents: {
|
27
28
|
readonly changeTitle: "change-title";
|
29
|
+
readonly autosave: "autosave";
|
28
30
|
};
|
29
31
|
/**
|
30
32
|
* Defines the shape of the detail that the layout listens works with for events it listens on
|
31
33
|
*
|
32
34
|
* 'changeTitle' - `title` is the string you want to set. For `mode`: `replace` will set the title to be `title`, `suffix` will append `title` to the end of the existing title.
|
35
|
+
* 'autosave' - no other parameters.
|
33
36
|
* @public
|
34
37
|
*/
|
35
38
|
export type LayoutReceiveEventsDetail = {
|
@@ -37,5 +40,6 @@ export type LayoutReceiveEventsDetail = {
|
|
37
40
|
title: string;
|
38
41
|
mode: 'replace' | 'suffix';
|
39
42
|
};
|
43
|
+
autosave: void;
|
40
44
|
};
|
41
45
|
//# sourceMappingURL=events.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../src/utils/events.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,gBAAgB;;;;;CAKnB,CAAC;AAEX
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../src/utils/events.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,gBAAgB;;;;;CAKnB,CAAC;AAEX;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB;;;CAGtB,CAAC;AAEX;;;;;;GAMG;AACH,MAAM,MAAM,yBAAyB,GAAG;IACtC,WAAW,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,SAAS,GAAG,QAAQ,CAAA;KAAE,CAAC;IAC3D,QAAQ,EAAE,IAAI,CAAC;CAChB,CAAC"}
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { ResolvedLayoutConfig } from '@genesis-community/golden-layout';
|
2
|
-
import { componentType } from './constants';
|
1
|
+
import { ComponentContainer, ResolvedLayoutConfig } from '@genesis-community/golden-layout';
|
2
|
+
import { componentType, instanceContainer } from './constants';
|
3
3
|
/**
|
4
4
|
* Definition of a custom button which will be added to all layout items.
|
5
5
|
* @remarks
|
@@ -26,6 +26,69 @@ export type SerialisedLayout = {
|
|
26
26
|
v: '1';
|
27
27
|
c: ResolvedLayoutConfig;
|
28
28
|
};
|
29
|
+
/**
|
30
|
+
* Interface to implement on an item which is a component of the layout and you wish to serialise state with. This is saved separately for each instance of the component, which allows you to restore multiple instances of the same component with different state.
|
31
|
+
* @typeParam T - the type of the state object you wish to serialise with the component.
|
32
|
+
* @remarks
|
33
|
+
* When the layout is saved either via the autosave functionality or manually calling {@link FoundationLayout.getLayout}, all contained components will be requested to provide state if they wish.
|
34
|
+
*
|
35
|
+
* Any state which is provided will be saved as part of the layout config and will be passed back to the component when the layout is reloaded. Before an item is appended onto the layout DOM, the state will be applied to the component via `applyState`. You will likely want to cache this and then use it later in the lifecycle of the component. The state is `null` when the instance is first created.
|
36
|
+
*
|
37
|
+
* See the written documentation for some error scenarios to consider about when implementing this interface.
|
38
|
+
*
|
39
|
+
* @example
|
40
|
+
* ```
|
41
|
+
* type ComponentState = {
|
42
|
+
* foo: string;
|
43
|
+
* }
|
44
|
+
* \@customElement({ name: 'my-component' })
|
45
|
+
* export class MyComponent extends FASTElement implements LayoutComponentWithState<ComponentState> {
|
46
|
+
* \@observable foo: string;
|
47
|
+
* private fooCache: ComponentState | null;
|
48
|
+
*
|
49
|
+
* getCurrentState(): ComponentState {
|
50
|
+
* if (!this.foo) return null;
|
51
|
+
* return {
|
52
|
+
* foo: this.foo;
|
53
|
+
* }
|
54
|
+
* }
|
55
|
+
*
|
56
|
+
* applyState(state: ComponentState | null) {
|
57
|
+
* this.fooCache = state;
|
58
|
+
* }
|
59
|
+
*
|
60
|
+
* connectedCallback() {
|
61
|
+
* // do other required setup
|
62
|
+
* if (this.fooCache) {
|
63
|
+
* this.foo = this.fooCache.foo;
|
64
|
+
* }
|
65
|
+
* }
|
66
|
+
* }
|
67
|
+
* ```
|
68
|
+
*
|
69
|
+
* @example
|
70
|
+
* If you are using the autosave functionality you should inform the layout system when you update the state of a component, otherwise the state will only be updated when the user performs an action such as resizing an item. Use the {@link LayoutReceiveEvents} `autosave` event.
|
71
|
+
* ```
|
72
|
+
* // Same component as above
|
73
|
+
* export class MyComponent extends FASTElement implements LayoutComponentWithState<ComponentState> {
|
74
|
+
* // can use xChanged pattern as `foo` was declared observable
|
75
|
+
* fooChanged() {
|
76
|
+
* this.$emit(LayoutReceiveEvents.autosave);
|
77
|
+
* }
|
78
|
+
* }
|
79
|
+
* ```
|
80
|
+
* @public
|
81
|
+
* */
|
82
|
+
export interface LayoutComponentWithState<T> {
|
83
|
+
/**
|
84
|
+
* Provide the state you wish to save. It is recommended if the component which implements this interface has not fully initialised at the point this is called that you return `null` as the state, following the pattern of `null` being set as the initial state.
|
85
|
+
*/
|
86
|
+
getCurrentState(): T;
|
87
|
+
/**
|
88
|
+
* Handle any state that has been saved previously for this instance of this component. This will be called before the component is appended to the DOM. Due to the lifecycle events not running by this point, it is recommended you cache the state and then apply it in `connectedCallback`.
|
89
|
+
*/
|
90
|
+
applyState(state: T | null): void;
|
91
|
+
}
|
29
92
|
/**
|
30
93
|
* @public
|
31
94
|
* The parameters that can be set on a new item when being added by the {@link FoundationLayout.addItem} API
|
@@ -61,6 +124,15 @@ export type Placement = {
|
|
61
124
|
};
|
62
125
|
};
|
63
126
|
/** @internal */
|
127
|
+
export type InstanceContainer = {
|
128
|
+
container: ComponentContainer;
|
129
|
+
instance: string;
|
130
|
+
};
|
131
|
+
/** @internal */
|
132
|
+
export type LayoutComponentItem<T> = Element & Partial<LayoutComponentWithState<T>> & {
|
133
|
+
[instanceContainer]?: InstanceContainer;
|
134
|
+
};
|
135
|
+
/** @internal */
|
64
136
|
export interface RegistrationConfig {
|
65
137
|
elements: Element[];
|
66
138
|
id?: string;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/utils/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/utils/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAC5F,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAE/D;;;;;;GAMG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,CAAC,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC;CAC9D,CAAC;AAEF;;;;;;;;;;GAUG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,CAAC,EAAE,GAAG,CAAC;IACP,CAAC,EAAE,oBAAoB,CAAC;CACzB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAoDK;AACL,MAAM,WAAW,wBAAwB,CAAC,CAAC;IACzC;;OAEG;IACH,eAAe,IAAI,CAAC,CAAC;IACrB;;OAEG;IACH,UAAU,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC;CACnC;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,uBAAuB;IACtC,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;;GASG;AACH,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,KAAK,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;IAC1C,QAAQ,CAAC,EAAE;QACT,IAAI,EAAE,gBAAgB,CAAC;QACvB,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;CACH,CAAC;AAEF,gBAAgB;AAChB,MAAM,MAAM,iBAAiB,GAAG;IAC9B,SAAS,EAAE,kBAAkB,CAAC;IAC9B,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,gBAAgB;AAChB,MAAM,MAAM,mBAAmB,CAAC,CAAC,IAAI,OAAO,GAC1C,OAAO,CAAC,wBAAwB,CAAC,CAAC,CAAC,CAAC,GAAG;IACrC,CAAC,iBAAiB,CAAC,CAAC,EAAE,iBAAiB,CAAC;CACzC,CAAC;AAEJ,gBAAgB;AAChB,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED,gBAAgB;AAChB,eAAO,MAAM,iBAAiB,6CAA8C,CAAC;AAC7E;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAClE,gBAAgB;AAChB,MAAM,MAAM,cAAc,GAAG,gBAAgB,GAAG,MAAM,GAAG,MAAM,CAAC;AAEhE,gBAAgB;AAChB,MAAM,WAAW,eAAe;IAC9B,CAAC,aAAa,CAAC,EAAE,cAAc,CAAC;IAChC,wBAAwB,CAAC,MAAM,EAAE,kBAAkB,GAAG,MAAM,CAAC;IAC7D,mBAAmB,IAAI,IAAI,CAAC;CAC7B;AAED,gBAAgB;AAChB,MAAM,MAAM,gBAAgB,GAAG;IAC7B,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACrB,CAAC"}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
var
|
1
|
+
var _FoundationLayout__boundDragListener, _a;
|
2
2
|
import { __classPrivateFieldGet, __classPrivateFieldSet, __decorate } from "tslib";
|
3
3
|
import { GoldenLayout, LayoutConfig, ResolvedLayoutConfig, } from '@genesis-community/golden-layout';
|
4
4
|
import { Session } from '@genesislcap/foundation-comms';
|
@@ -6,7 +6,7 @@ import { layoutCacheDocument, UUID } from '@genesislcap/foundation-utils';
|
|
6
6
|
import { html, attr, observable, when, ref } from '@microsoft/fast-element';
|
7
7
|
import { FoundationElement } from '@microsoft/fast-foundation';
|
8
8
|
import { globalDraggingStyles, glVisualConfig, layoutStyles } from '../styles';
|
9
|
-
import { DEFAULT_RELOAD_BUFFER, LayoutEmitEvents, LayoutReceiveEvents, componentType, AUTOSAVE_KEY, regionConveter, } from '../utils/';
|
9
|
+
import { DEFAULT_RELOAD_BUFFER, LayoutEmitEvents, LayoutReceiveEvents, componentType, AUTOSAVE_KEY, regionConveter, instanceContainer, } from '../utils/';
|
10
10
|
import { getMissingArrayItems } from '../utils/';
|
11
11
|
import { LayoutRegistrationError, LayoutUsageError } from '../utils/error';
|
12
12
|
import { logger } from '../utils/logger';
|
@@ -88,14 +88,13 @@ export class FoundationLayout extends FoundationElement {
|
|
88
88
|
*/
|
89
89
|
this.lifecycleUpdateToken = undefined;
|
90
90
|
/** @internal */
|
91
|
-
_FoundationLayout__boundPreDeletionListener.set(this, undefined);
|
92
|
-
/** @internal */
|
93
91
|
_FoundationLayout__boundDragListener.set(this, undefined);
|
94
92
|
this.onDragStart = this.onDragStart.bind(this);
|
95
93
|
this.onDragStop = this.onDragStop.bind(this);
|
96
94
|
this.cacheAndSaveLayout = this.cacheAndSaveLayout.bind(this);
|
97
95
|
this.onPostItemRemoved = this.onPostItemRemoved.bind(this);
|
98
96
|
this.onPreItemRemoved = this.onPreItemRemoved.bind(this);
|
97
|
+
this.onAutosaveRequest = this.onAutosaveRequest.bind(this);
|
99
98
|
}
|
100
99
|
/** @internal */
|
101
100
|
connectedCallback() {
|
@@ -111,18 +110,24 @@ export class FoundationLayout extends FoundationElement {
|
|
111
110
|
.catch((e) => console.error('Failed to replace styles:', e));
|
112
111
|
appliedGlobalStyles = true;
|
113
112
|
}
|
113
|
+
// golden layout events
|
114
114
|
this.shadowRoot.addEventListener('dragStart', this.onDragStart, true);
|
115
115
|
this.shadowRoot.addEventListener('dragStop', this.onDragStop, true);
|
116
116
|
this.shadowRoot.addEventListener('closeButtonPre', this.onPreItemRemoved, true);
|
117
117
|
this.shadowRoot.addEventListener('closeButtonPressed', this.onPostItemRemoved, true);
|
118
|
+
// events.ts events
|
119
|
+
this.shadowRoot.addEventListener(LayoutReceiveEvents.autosave, this.onAutosaveRequest, true);
|
118
120
|
this.setupCustomButtons();
|
119
121
|
}
|
120
122
|
/** @internal */
|
121
123
|
disconnectedCallback() {
|
124
|
+
// golden layout events
|
122
125
|
this.shadowRoot.removeEventListener('dragStart', this.onDragStart);
|
123
126
|
this.shadowRoot.removeEventListener('dragStop', this.onDragStop);
|
124
127
|
this.shadowRoot.removeEventListener('closeButtonPre', this.onPreItemRemoved);
|
125
128
|
this.shadowRoot.removeEventListener('closeButtonPressed', this.onPostItemRemoved);
|
129
|
+
// events.ts events
|
130
|
+
this.shadowRoot.addEventListener(LayoutReceiveEvents.autosave, this.onAutosaveRequest);
|
126
131
|
}
|
127
132
|
/** @internal */
|
128
133
|
onDragStart() {
|
@@ -153,6 +158,10 @@ export class FoundationLayout extends FoundationElement {
|
|
153
158
|
this.$emit(LayoutEmitEvents.itemResized);
|
154
159
|
this.cacheAndSaveLayout();
|
155
160
|
}
|
161
|
+
/** @internal */
|
162
|
+
onAutosaveRequest() {
|
163
|
+
this.cacheAndSaveLayout();
|
164
|
+
}
|
156
165
|
/**
|
157
166
|
* JS API, public
|
158
167
|
*/
|
@@ -194,9 +203,22 @@ export class FoundationLayout extends FoundationElement {
|
|
194
203
|
/**
|
195
204
|
* @public
|
196
205
|
* Gets a minified string containing the config describing the current layout of the layout object to later restore in {@link FoundationLayout.loadLayout | function}
|
206
|
+
* @remarks
|
207
|
+
* Includes any state for a contained component exposed by the {@link LayoutComponentWithState} interface.
|
197
208
|
* @returns - latest version of {@link SerialisedLayout} describing the layout
|
198
209
|
*/
|
199
210
|
getLayout() {
|
211
|
+
const componentCollection = this.getLayoutComponents();
|
212
|
+
componentCollection.forEach((items) => {
|
213
|
+
if (!items.length)
|
214
|
+
return;
|
215
|
+
const orderedStates = [...items].map((item) => { var _b; return (_b = item.getCurrentState) === null || _b === void 0 ? void 0 : _b.call(item); });
|
216
|
+
const componentInstanceContainer = items[0][instanceContainer];
|
217
|
+
componentInstanceContainer.container.setState({
|
218
|
+
instance: componentInstanceContainer.instance,
|
219
|
+
orderedStates,
|
220
|
+
});
|
221
|
+
});
|
200
222
|
return { v: '1', c: ResolvedLayoutConfig.minifyConfig(this.layout.saveLayout()) };
|
201
223
|
}
|
202
224
|
/**
|
@@ -413,6 +435,9 @@ export class FoundationLayout extends FoundationElement {
|
|
413
435
|
*
|
414
436
|
* This has the effect of allowing us to create multiple instances of the same registered item, and each
|
415
437
|
* created instance is separate allowing it to implement its own serialise and cache of data.
|
438
|
+
*
|
439
|
+
* As part of creating each instance we attach a reference to the instance container which is used
|
440
|
+
* to be able to optionally save state, and any state which has been saved we apply to the component.
|
416
441
|
*/
|
417
442
|
const registrationFunction = (() => {
|
418
443
|
// Use appendChild to consume the elements and save them in the master copy
|
@@ -433,11 +458,25 @@ export class FoundationLayout extends FoundationElement {
|
|
433
458
|
// the key point is "cloneNode" which makes a copy at this point
|
434
459
|
if (!instances.has(state === null || state === void 0 ? void 0 : state['instance'])) {
|
435
460
|
const instanceCopy = document.createDocumentFragment();
|
436
|
-
Array.from(masterCopy.children).forEach((e) =>
|
461
|
+
Array.from(masterCopy.children).forEach((e) => {
|
462
|
+
instanceCopy.appendChild(e.cloneNode(true));
|
463
|
+
});
|
437
464
|
instances.set(state['instance'], [...instanceCopy.children]);
|
438
465
|
}
|
466
|
+
// provide each component with a reference to the instance container
|
467
|
+
// so they can optionally save and load their own state
|
468
|
+
const componentInstanceContainer = {
|
469
|
+
container,
|
470
|
+
instance: state['instance'],
|
471
|
+
};
|
472
|
+
const instanceOrderedStates = state['orderedStates'] || [];
|
439
473
|
// get the instance from the map and append it to the container
|
440
|
-
instances.get(state['instance']).forEach((
|
474
|
+
instances.get(state['instance']).forEach((component, i) => {
|
475
|
+
var _b, _c;
|
476
|
+
(_b = component.applyState) === null || _b === void 0 ? void 0 : _b.call(component, (_c = instanceOrderedStates[i]) !== null && _c !== void 0 ? _c : null);
|
477
|
+
container.element.appendChild(component);
|
478
|
+
component[instanceContainer] = componentInstanceContainer;
|
479
|
+
});
|
441
480
|
this.setupLayoutReceiveEvents(container, state);
|
442
481
|
};
|
443
482
|
})();
|
@@ -552,8 +591,17 @@ export class FoundationLayout extends FoundationElement {
|
|
552
591
|
});
|
553
592
|
});
|
554
593
|
}
|
594
|
+
/**
|
595
|
+
* Return an array of each contained items in the layout.
|
596
|
+
* @internal
|
597
|
+
*/
|
598
|
+
getLayoutComponents() {
|
599
|
+
return [...this.shadowRoot.querySelectorAll('div.lm_content')].map((container) => [
|
600
|
+
...container.children,
|
601
|
+
]);
|
602
|
+
}
|
555
603
|
}
|
556
|
-
|
604
|
+
_FoundationLayout__boundDragListener = new WeakMap(), _a = componentType;
|
557
605
|
__decorate([
|
558
606
|
attr({ attribute: 'reload-buffer' })
|
559
607
|
], FoundationLayout.prototype, "reloadBuffer", void 0);
|
@@ -3,6 +3,11 @@
|
|
3
3
|
* @internal
|
4
4
|
*/
|
5
5
|
export const componentType = Symbol('component-type');
|
6
|
+
/**
|
7
|
+
* Used to key a reference to the instance and golden layout container on a layout component.
|
8
|
+
* @internal
|
9
|
+
*/
|
10
|
+
export const instanceContainer = Symbol('component-instance');
|
6
11
|
/**
|
7
12
|
* Default time in milliseconds for the layout to buffer calls to reloading
|
8
13
|
* the layout while the declarative API is loading.
|
package/dist/esm/utils/events.js
CHANGED
@@ -21,8 +21,10 @@ export const LayoutEmitEvents = {
|
|
21
21
|
* Defines events that the layout system listens for
|
22
22
|
*
|
23
23
|
* 'changeTitle' - emit this from a contained item to update the title of the window that contains it.
|
24
|
+
* 'autosave' - emit this from a contained item to hint to the layout system that it should autosave the layout. A contained item should do this if it has just changed some state it would like to persist. See {@link LayoutComponentWithState}.
|
24
25
|
* @public
|
25
26
|
*/
|
26
27
|
export const LayoutReceiveEvents = {
|
27
28
|
changeTitle: 'change-title',
|
29
|
+
autosave: 'autosave',
|
28
30
|
};
|
package/dist/esm/utils/types.js
CHANGED
@@ -527,7 +527,7 @@
|
|
527
527
|
{
|
528
528
|
"kind": "Method",
|
529
529
|
"canonicalReference": "@genesislcap/foundation-layout!FoundationLayout#getLayout:member(1)",
|
530
|
-
"docComment": "/**\n * Gets a minified string containing the config describing the current layout of the layout object to later restore in {@link FoundationLayout.loadLayout | function}\n *\n * @returns - latest version of {@link SerialisedLayout} describing the layout\n *\n * @public\n */\n",
|
530
|
+
"docComment": "/**\n * Gets a minified string containing the config describing the current layout of the layout object to later restore in {@link FoundationLayout.loadLayout | function}\n *\n * @remarks\n *\n * Includes any state for a contained component exposed by the {@link LayoutComponentWithState} interface.\n *\n * @returns - latest version of {@link SerialisedLayout} describing the layout\n *\n * @public\n */\n",
|
531
531
|
"excerptTokens": [
|
532
532
|
{
|
533
533
|
"kind": "Content",
|
@@ -1432,6 +1432,110 @@
|
|
1432
1432
|
"endIndex": 2
|
1433
1433
|
}
|
1434
1434
|
},
|
1435
|
+
{
|
1436
|
+
"kind": "Interface",
|
1437
|
+
"canonicalReference": "@genesislcap/foundation-layout!LayoutComponentWithState:interface",
|
1438
|
+
"docComment": "/**\n * Interface to implement on an item which is a component of the layout and you wish to serialise state with. This is saved separately for each instance of the component, which allows you to restore multiple instances of the same component with different state.\n *\n * @remarks\n *\n * When the layout is saved either via the autosave functionality or manually calling {@link FoundationLayout.getLayout}, all contained components will be requested to provide state if they wish.\n *\n * Any state which is provided will be saved as part of the layout config and will be passed back to the component when the layout is reloaded. Before an item is appended onto the layout DOM, the state will be applied to the component via `applyState`. You will likely want to cache this and then use it later in the lifecycle of the component. The state is `null` when the instance is first created.\n *\n * See the written documentation for some error scenarios to consider about when implementing this interface.\n *\n * @typeParam T - the type of the state object you wish to serialise with the component.\n *\n * @example\n * ```\n * type ComponentState = {\n * foo: string;\n * }\n * \\@customElement({ name: 'my-component' })\n * export class MyComponent extends FASTElement implements LayoutComponentWithState<ComponentState> {\n * \\@observable foo: string;\n * private fooCache: ComponentState | null;\n *\n * getCurrentState(): ComponentState {\n * if (!this.foo) return null;\n * return {\n * foo: this.foo;\n * }\n * }\n *\n * applyState(state: ComponentState | null) {\n * this.fooCache = state;\n * }\n *\n * connectedCallback() {\n * // do other required setup\n * if (this.fooCache) {\n * this.foo = this.fooCache.foo;\n * }\n * }\n * }\n * ```\n *\n * @example\n *\n * If you are using the autosave functionality you should inform the layout system when you update the state of a component, otherwise the state will only be updated when the user performs an action such as resizing an item. Use the {@link LayoutReceiveEvents} `autosave` event.\n * ```\n * // Same component as above\n * export class MyComponent extends FASTElement implements LayoutComponentWithState<ComponentState> {\n * // can use xChanged pattern as `foo` was declared observable\n * fooChanged() {\n * this.$emit(LayoutReceiveEvents.autosave);\n * }\n * }\n * ```\n *\n * @public\n */\n",
|
1439
|
+
"excerptTokens": [
|
1440
|
+
{
|
1441
|
+
"kind": "Content",
|
1442
|
+
"text": "export interface LayoutComponentWithState<T> "
|
1443
|
+
}
|
1444
|
+
],
|
1445
|
+
"fileUrlPath": "src/utils/types.ts",
|
1446
|
+
"releaseTag": "Public",
|
1447
|
+
"typeParameters": [
|
1448
|
+
{
|
1449
|
+
"typeParameterName": "T",
|
1450
|
+
"constraintTokenRange": {
|
1451
|
+
"startIndex": 0,
|
1452
|
+
"endIndex": 0
|
1453
|
+
},
|
1454
|
+
"defaultTypeTokenRange": {
|
1455
|
+
"startIndex": 0,
|
1456
|
+
"endIndex": 0
|
1457
|
+
}
|
1458
|
+
}
|
1459
|
+
],
|
1460
|
+
"name": "LayoutComponentWithState",
|
1461
|
+
"preserveMemberOrder": false,
|
1462
|
+
"members": [
|
1463
|
+
{
|
1464
|
+
"kind": "MethodSignature",
|
1465
|
+
"canonicalReference": "@genesislcap/foundation-layout!LayoutComponentWithState#applyState:member(1)",
|
1466
|
+
"docComment": "/**\n * Handle any state that has been saved previously for this instance of this component. This will be called before the component is appended to the DOM. Due to the lifecycle events not running by this point, it is recommended you cache the state and then apply it in `connectedCallback`.\n */\n",
|
1467
|
+
"excerptTokens": [
|
1468
|
+
{
|
1469
|
+
"kind": "Content",
|
1470
|
+
"text": "applyState(state: "
|
1471
|
+
},
|
1472
|
+
{
|
1473
|
+
"kind": "Content",
|
1474
|
+
"text": "T | null"
|
1475
|
+
},
|
1476
|
+
{
|
1477
|
+
"kind": "Content",
|
1478
|
+
"text": "): "
|
1479
|
+
},
|
1480
|
+
{
|
1481
|
+
"kind": "Content",
|
1482
|
+
"text": "void"
|
1483
|
+
},
|
1484
|
+
{
|
1485
|
+
"kind": "Content",
|
1486
|
+
"text": ";"
|
1487
|
+
}
|
1488
|
+
],
|
1489
|
+
"isOptional": false,
|
1490
|
+
"returnTypeTokenRange": {
|
1491
|
+
"startIndex": 3,
|
1492
|
+
"endIndex": 4
|
1493
|
+
},
|
1494
|
+
"releaseTag": "Public",
|
1495
|
+
"overloadIndex": 1,
|
1496
|
+
"parameters": [
|
1497
|
+
{
|
1498
|
+
"parameterName": "state",
|
1499
|
+
"parameterTypeTokenRange": {
|
1500
|
+
"startIndex": 1,
|
1501
|
+
"endIndex": 2
|
1502
|
+
},
|
1503
|
+
"isOptional": false
|
1504
|
+
}
|
1505
|
+
],
|
1506
|
+
"name": "applyState"
|
1507
|
+
},
|
1508
|
+
{
|
1509
|
+
"kind": "MethodSignature",
|
1510
|
+
"canonicalReference": "@genesislcap/foundation-layout!LayoutComponentWithState#getCurrentState:member(1)",
|
1511
|
+
"docComment": "/**\n * Provide the state you wish to save. It is recommended if the component which implements this interface has not fully initialised at the point this is called that you return `null` as the state, following the pattern of `null` being set as the initial state.\n */\n",
|
1512
|
+
"excerptTokens": [
|
1513
|
+
{
|
1514
|
+
"kind": "Content",
|
1515
|
+
"text": "getCurrentState(): "
|
1516
|
+
},
|
1517
|
+
{
|
1518
|
+
"kind": "Content",
|
1519
|
+
"text": "T"
|
1520
|
+
},
|
1521
|
+
{
|
1522
|
+
"kind": "Content",
|
1523
|
+
"text": ";"
|
1524
|
+
}
|
1525
|
+
],
|
1526
|
+
"isOptional": false,
|
1527
|
+
"returnTypeTokenRange": {
|
1528
|
+
"startIndex": 1,
|
1529
|
+
"endIndex": 2
|
1530
|
+
},
|
1531
|
+
"releaseTag": "Public",
|
1532
|
+
"overloadIndex": 1,
|
1533
|
+
"parameters": [],
|
1534
|
+
"name": "getCurrentState"
|
1535
|
+
}
|
1536
|
+
],
|
1537
|
+
"extendsTokenRanges": []
|
1538
|
+
},
|
1435
1539
|
{
|
1436
1540
|
"kind": "Variable",
|
1437
1541
|
"canonicalReference": "@genesislcap/foundation-layout!LayoutEmitEvents:var",
|
@@ -1458,7 +1562,7 @@
|
|
1458
1562
|
{
|
1459
1563
|
"kind": "Variable",
|
1460
1564
|
"canonicalReference": "@genesislcap/foundation-layout!LayoutReceiveEvents:var",
|
1461
|
-
"docComment": "/**\n * Defines events that the layout system listens for\n *\n * 'changeTitle' - emit this from a contained item to update the title of the window that contains it.\n *\n * @public\n */\n",
|
1565
|
+
"docComment": "/**\n * Defines events that the layout system listens for\n *\n * 'changeTitle' - emit this from a contained item to update the title of the window that contains it. 'autosave' - emit this from a contained item to hint to the layout system that it should autosave the layout. A contained item should do this if it has just changed some state it would like to persist. See {@link LayoutComponentWithState}.\n *\n * @public\n */\n",
|
1462
1566
|
"excerptTokens": [
|
1463
1567
|
{
|
1464
1568
|
"kind": "Content",
|
@@ -1466,7 +1570,7 @@
|
|
1466
1570
|
},
|
1467
1571
|
{
|
1468
1572
|
"kind": "Content",
|
1469
|
-
"text": "{\n readonly changeTitle: \"change-title\";\n}"
|
1573
|
+
"text": "{\n readonly changeTitle: \"change-title\";\n readonly autosave: \"autosave\";\n}"
|
1470
1574
|
}
|
1471
1575
|
],
|
1472
1576
|
"fileUrlPath": "src/utils/events.ts",
|
@@ -1481,7 +1585,7 @@
|
|
1481
1585
|
{
|
1482
1586
|
"kind": "TypeAlias",
|
1483
1587
|
"canonicalReference": "@genesislcap/foundation-layout!LayoutReceiveEventsDetail:type",
|
1484
|
-
"docComment": "/**\n * Defines the shape of the detail that the layout listens works with for events it listens on\n *\n * 'changeTitle' - `title` is the string you want to set. For `mode`: `replace` will set the title to be `title`, `suffix` will append `title` to the end of the existing title.\n *\n * @public\n */\n",
|
1588
|
+
"docComment": "/**\n * Defines the shape of the detail that the layout listens works with for events it listens on\n *\n * 'changeTitle' - `title` is the string you want to set. For `mode`: `replace` will set the title to be `title`, `suffix` will append `title` to the end of the existing title. 'autosave' - no other parameters.\n *\n * @public\n */\n",
|
1485
1589
|
"excerptTokens": [
|
1486
1590
|
{
|
1487
1591
|
"kind": "Content",
|
@@ -1489,7 +1593,7 @@
|
|
1489
1593
|
},
|
1490
1594
|
{
|
1491
1595
|
"kind": "Content",
|
1492
|
-
"text": "{\n changeTitle: {\n title: string;\n mode: 'replace' | 'suffix';\n };\n}"
|
1596
|
+
"text": "{\n changeTitle: {\n title: string;\n mode: 'replace' | 'suffix';\n };\n autosave: void;\n}"
|
1493
1597
|
},
|
1494
1598
|
{
|
1495
1599
|
"kind": "Content",
|
@@ -143,6 +143,8 @@ export declare class FoundationLayout extends FoundationElement implements Layou
|
|
143
143
|
private onPostItemRemoved;
|
144
144
|
/** @internal */
|
145
145
|
private onPostItemResized;
|
146
|
+
/** @internal */
|
147
|
+
private onAutosaveRequest;
|
146
148
|
/**
|
147
149
|
* JS API, public
|
148
150
|
*/
|
@@ -171,6 +173,8 @@ export declare class FoundationLayout extends FoundationElement implements Layou
|
|
171
173
|
/**
|
172
174
|
* @public
|
173
175
|
* Gets a minified string containing the config describing the current layout of the layout object to later restore in {@link FoundationLayout.loadLayout | function}
|
176
|
+
* @remarks
|
177
|
+
* Includes any state for a contained component exposed by the {@link LayoutComponentWithState} interface.
|
174
178
|
* @returns - latest version of {@link SerialisedLayout} describing the layout
|
175
179
|
*/
|
176
180
|
getLayout(): SerialisedLayout;
|
@@ -314,6 +318,11 @@ export declare class FoundationLayout extends FoundationElement implements Layou
|
|
314
318
|
* @internal
|
315
319
|
*/
|
316
320
|
private setupCustomButtons;
|
321
|
+
/**
|
322
|
+
* Return an array of each contained items in the layout.
|
323
|
+
* @internal
|
324
|
+
*/
|
325
|
+
private getLayoutComponents;
|
317
326
|
}
|
318
327
|
|
319
328
|
/**
|
@@ -488,6 +497,70 @@ declare interface LayoutComponent {
|
|
488
497
|
requestLayoutReload(): void;
|
489
498
|
}
|
490
499
|
|
500
|
+
/**
|
501
|
+
* Interface to implement on an item which is a component of the layout and you wish to serialise state with. This is saved separately for each instance of the component, which allows you to restore multiple instances of the same component with different state.
|
502
|
+
* @typeParam T - the type of the state object you wish to serialise with the component.
|
503
|
+
* @remarks
|
504
|
+
* When the layout is saved either via the autosave functionality or manually calling {@link FoundationLayout.getLayout}, all contained components will be requested to provide state if they wish.
|
505
|
+
*
|
506
|
+
* Any state which is provided will be saved as part of the layout config and will be passed back to the component when the layout is reloaded. Before an item is appended onto the layout DOM, the state will be applied to the component via `applyState`. You will likely want to cache this and then use it later in the lifecycle of the component. The state is `null` when the instance is first created.
|
507
|
+
*
|
508
|
+
* See the written documentation for some error scenarios to consider about when implementing this interface.
|
509
|
+
*
|
510
|
+
* @example
|
511
|
+
* ```
|
512
|
+
* type ComponentState = {
|
513
|
+
* foo: string;
|
514
|
+
* }
|
515
|
+
* \@customElement({ name: 'my-component' })
|
516
|
+
* export class MyComponent extends FASTElement implements LayoutComponentWithState<ComponentState> {
|
517
|
+
* \@observable foo: string;
|
518
|
+
* private fooCache: ComponentState | null;
|
519
|
+
*
|
520
|
+
* getCurrentState(): ComponentState {
|
521
|
+
* if (!this.foo) return null;
|
522
|
+
* return {
|
523
|
+
* foo: this.foo;
|
524
|
+
* }
|
525
|
+
* }
|
526
|
+
*
|
527
|
+
* applyState(state: ComponentState | null) {
|
528
|
+
* this.fooCache = state;
|
529
|
+
* }
|
530
|
+
*
|
531
|
+
* connectedCallback() {
|
532
|
+
* // do other required setup
|
533
|
+
* if (this.fooCache) {
|
534
|
+
* this.foo = this.fooCache.foo;
|
535
|
+
* }
|
536
|
+
* }
|
537
|
+
* }
|
538
|
+
* ```
|
539
|
+
*
|
540
|
+
* @example
|
541
|
+
* If you are using the autosave functionality you should inform the layout system when you update the state of a component, otherwise the state will only be updated when the user performs an action such as resizing an item. Use the {@link LayoutReceiveEvents} `autosave` event.
|
542
|
+
* ```
|
543
|
+
* // Same component as above
|
544
|
+
* export class MyComponent extends FASTElement implements LayoutComponentWithState<ComponentState> {
|
545
|
+
* // can use xChanged pattern as `foo` was declared observable
|
546
|
+
* fooChanged() {
|
547
|
+
* this.$emit(LayoutReceiveEvents.autosave);
|
548
|
+
* }
|
549
|
+
* }
|
550
|
+
* ```
|
551
|
+
* @public
|
552
|
+
* */
|
553
|
+
export declare interface LayoutComponentWithState<T> {
|
554
|
+
/**
|
555
|
+
* Provide the state you wish to save. It is recommended if the component which implements this interface has not fully initialised at the point this is called that you return `null` as the state, following the pattern of `null` being set as the initial state.
|
556
|
+
*/
|
557
|
+
getCurrentState(): T;
|
558
|
+
/**
|
559
|
+
* Handle any state that has been saved previously for this instance of this component. This will be called before the component is appended to the DOM. Due to the lifecycle events not running by this point, it is recommended you cache the state and then apply it in `connectedCallback`.
|
560
|
+
*/
|
561
|
+
applyState(state: T | null): void;
|
562
|
+
}
|
563
|
+
|
491
564
|
/**
|
492
565
|
* Defines events that the layout system emits
|
493
566
|
*
|
@@ -512,16 +585,19 @@ export declare const LayoutEmitEvents: {
|
|
512
585
|
* Defines events that the layout system listens for
|
513
586
|
*
|
514
587
|
* 'changeTitle' - emit this from a contained item to update the title of the window that contains it.
|
588
|
+
* 'autosave' - emit this from a contained item to hint to the layout system that it should autosave the layout. A contained item should do this if it has just changed some state it would like to persist. See {@link LayoutComponentWithState}.
|
515
589
|
* @public
|
516
590
|
*/
|
517
591
|
export declare const LayoutReceiveEvents: {
|
518
592
|
readonly changeTitle: "change-title";
|
593
|
+
readonly autosave: "autosave";
|
519
594
|
};
|
520
595
|
|
521
596
|
/**
|
522
597
|
* Defines the shape of the detail that the layout listens works with for events it listens on
|
523
598
|
*
|
524
599
|
* 'changeTitle' - `title` is the string you want to set. For `mode`: `replace` will set the title to be `title`, `suffix` will append `title` to the end of the existing title.
|
600
|
+
* 'autosave' - no other parameters.
|
525
601
|
* @public
|
526
602
|
*/
|
527
603
|
export declare type LayoutReceiveEventsDetail = {
|
@@ -529,6 +605,7 @@ export declare type LayoutReceiveEventsDetail = {
|
|
529
605
|
title: string;
|
530
606
|
mode: 'replace' | 'suffix';
|
531
607
|
};
|
608
|
+
autosave: void;
|
532
609
|
};
|
533
610
|
|
534
611
|
/**
|
@@ -17,3 +17,7 @@ getLayout(): SerialisedLayout;
|
|
17
17
|
|
18
18
|
- latest version of [SerialisedLayout](./foundation-layout.serialisedlayout.md) describing the layout
|
19
19
|
|
20
|
+
## Remarks
|
21
|
+
|
22
|
+
Includes any state for a contained component exposed by the [LayoutComponentWithState](./foundation-layout.layoutcomponentwithstate.md) interface.
|
23
|
+
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
2
|
+
|
3
|
+
[Home](./index.md) > [@genesislcap/foundation-layout](./foundation-layout.md) > [LayoutComponentWithState](./foundation-layout.layoutcomponentwithstate.md) > [applyState](./foundation-layout.layoutcomponentwithstate.applystate.md)
|
4
|
+
|
5
|
+
## LayoutComponentWithState.applyState() method
|
6
|
+
|
7
|
+
Handle any state that has been saved previously for this instance of this component. This will be called before the component is appended to the DOM. Due to the lifecycle events not running by this point, it is recommended you cache the state and then apply it in `connectedCallback`<!-- -->.
|
8
|
+
|
9
|
+
**Signature:**
|
10
|
+
|
11
|
+
```typescript
|
12
|
+
applyState(state: T | null): void;
|
13
|
+
```
|
14
|
+
|
15
|
+
## Parameters
|
16
|
+
|
17
|
+
| Parameter | Type | Description |
|
18
|
+
| --- | --- | --- |
|
19
|
+
| state | T \| null | |
|
20
|
+
|
21
|
+
**Returns:**
|
22
|
+
|
23
|
+
void
|
24
|
+
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
2
|
+
|
3
|
+
[Home](./index.md) > [@genesislcap/foundation-layout](./foundation-layout.md) > [LayoutComponentWithState](./foundation-layout.layoutcomponentwithstate.md) > [getCurrentState](./foundation-layout.layoutcomponentwithstate.getcurrentstate.md)
|
4
|
+
|
5
|
+
## LayoutComponentWithState.getCurrentState() method
|
6
|
+
|
7
|
+
Provide the state you wish to save. It is recommended if the component which implements this interface has not fully initialised at the point this is called that you return `null` as the state, following the pattern of `null` being set as the initial state.
|
8
|
+
|
9
|
+
**Signature:**
|
10
|
+
|
11
|
+
```typescript
|
12
|
+
getCurrentState(): T;
|
13
|
+
```
|
14
|
+
**Returns:**
|
15
|
+
|
16
|
+
T
|
17
|
+
|
@@ -0,0 +1,75 @@
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
2
|
+
|
3
|
+
[Home](./index.md) > [@genesislcap/foundation-layout](./foundation-layout.md) > [LayoutComponentWithState](./foundation-layout.layoutcomponentwithstate.md)
|
4
|
+
|
5
|
+
## LayoutComponentWithState interface
|
6
|
+
|
7
|
+
Interface to implement on an item which is a component of the layout and you wish to serialise state with. This is saved separately for each instance of the component, which allows you to restore multiple instances of the same component with different state.
|
8
|
+
|
9
|
+
**Signature:**
|
10
|
+
|
11
|
+
```typescript
|
12
|
+
export interface LayoutComponentWithState<T>
|
13
|
+
```
|
14
|
+
|
15
|
+
## Remarks
|
16
|
+
|
17
|
+
When the layout is saved either via the autosave functionality or manually calling [FoundationLayout.getLayout()](./foundation-layout.foundationlayout.getlayout.md)<!-- -->, all contained components will be requested to provide state if they wish.
|
18
|
+
|
19
|
+
Any state which is provided will be saved as part of the layout config and will be passed back to the component when the layout is reloaded. Before an item is appended onto the layout DOM, the state will be applied to the component via `applyState`<!-- -->. You will likely want to cache this and then use it later in the lifecycle of the component. The state is `null` when the instance is first created.
|
20
|
+
|
21
|
+
See the written documentation for some error scenarios to consider about when implementing this interface.
|
22
|
+
|
23
|
+
## Example 1
|
24
|
+
|
25
|
+
|
26
|
+
```
|
27
|
+
type ComponentState = {
|
28
|
+
foo: string;
|
29
|
+
}
|
30
|
+
\@customElement({ name: 'my-component' })
|
31
|
+
export class MyComponent extends FASTElement implements LayoutComponentWithState<ComponentState> {
|
32
|
+
\@observable foo: string;
|
33
|
+
private fooCache: ComponentState | null;
|
34
|
+
|
35
|
+
getCurrentState(): ComponentState {
|
36
|
+
if (!this.foo) return null;
|
37
|
+
return {
|
38
|
+
foo: this.foo;
|
39
|
+
}
|
40
|
+
}
|
41
|
+
|
42
|
+
applyState(state: ComponentState | null) {
|
43
|
+
this.fooCache = state;
|
44
|
+
}
|
45
|
+
|
46
|
+
connectedCallback() {
|
47
|
+
// do other required setup
|
48
|
+
if (this.fooCache) {
|
49
|
+
this.foo = this.fooCache.foo;
|
50
|
+
}
|
51
|
+
}
|
52
|
+
}
|
53
|
+
```
|
54
|
+
|
55
|
+
## Example 2
|
56
|
+
|
57
|
+
If you are using the autosave functionality you should inform the layout system when you update the state of a component, otherwise the state will only be updated when the user performs an action such as resizing an item. Use the [LayoutReceiveEvents](./foundation-layout.layoutreceiveevents.md) `autosave` event.
|
58
|
+
|
59
|
+
```
|
60
|
+
// Same component as above
|
61
|
+
export class MyComponent extends FASTElement implements LayoutComponentWithState<ComponentState> {
|
62
|
+
// can use xChanged pattern as `foo` was declared observable
|
63
|
+
fooChanged() {
|
64
|
+
this.$emit(LayoutReceiveEvents.autosave);
|
65
|
+
}
|
66
|
+
}
|
67
|
+
```
|
68
|
+
|
69
|
+
## Methods
|
70
|
+
|
71
|
+
| Method | Description |
|
72
|
+
| --- | --- |
|
73
|
+
| [applyState(state)](./foundation-layout.layoutcomponentwithstate.applystate.md) | Handle any state that has been saved previously for this instance of this component. This will be called before the component is appended to the DOM. Due to the lifecycle events not running by this point, it is recommended you cache the state and then apply it in <code>connectedCallback</code>. |
|
74
|
+
| [getCurrentState()](./foundation-layout.layoutcomponentwithstate.getcurrentstate.md) | Provide the state you wish to save. It is recommended if the component which implements this interface has not fully initialised at the point this is called that you return <code>null</code> as the state, following the pattern of <code>null</code> being set as the initial state. |
|
75
|
+
|
@@ -6,12 +6,13 @@
|
|
6
6
|
|
7
7
|
Defines events that the layout system listens for
|
8
8
|
|
9
|
-
'changeTitle' - emit this from a contained item to update the title of the window that contains it.
|
9
|
+
'changeTitle' - emit this from a contained item to update the title of the window that contains it. 'autosave' - emit this from a contained item to hint to the layout system that it should autosave the layout. A contained item should do this if it has just changed some state it would like to persist. See [LayoutComponentWithState](./foundation-layout.layoutcomponentwithstate.md)<!-- -->.
|
10
10
|
|
11
11
|
**Signature:**
|
12
12
|
|
13
13
|
```typescript
|
14
14
|
LayoutReceiveEvents: {
|
15
15
|
readonly changeTitle: "change-title";
|
16
|
+
readonly autosave: "autosave";
|
16
17
|
}
|
17
18
|
```
|
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
Defines the shape of the detail that the layout listens works with for events it listens on
|
8
8
|
|
9
|
-
'changeTitle' - `title` is the string you want to set. For `mode`<!-- -->: `replace` will set the title to be `title`<!-- -->, `suffix` will append `title` to the end of the existing title.
|
9
|
+
'changeTitle' - `title` is the string you want to set. For `mode`<!-- -->: `replace` will set the title to be `title`<!-- -->, `suffix` will append `title` to the end of the existing title. 'autosave' - no other parameters.
|
10
10
|
|
11
11
|
**Signature:**
|
12
12
|
|
@@ -16,5 +16,6 @@ export type LayoutReceiveEventsDetail = {
|
|
16
16
|
title: string;
|
17
17
|
mode: 'replace' | 'suffix';
|
18
18
|
};
|
19
|
+
autosave: void;
|
19
20
|
};
|
20
21
|
```
|
@@ -18,6 +18,7 @@
|
|
18
18
|
|
19
19
|
| Interface | Description |
|
20
20
|
| --- | --- |
|
21
|
+
| [LayoutComponentWithState](./foundation-layout.layoutcomponentwithstate.md) | Interface to implement on an item which is a component of the layout and you wish to serialise state with. This is saved separately for each instance of the component, which allows you to restore multiple instances of the same component with different state. |
|
21
22
|
| [RegisteredElementConfig](./foundation-layout.registeredelementconfig.md) | The parameters that can be set on a new item when being added by the [FoundationLayout.addItem()](./foundation-layout.foundationlayout.additem.md) API |
|
22
23
|
|
23
24
|
## Variables
|
@@ -28,7 +29,7 @@
|
|
28
29
|
| [foundationLayoutComponents](./foundation-layout.foundationlayoutcomponents.md) | Registration object to register the layout with your design system. |
|
29
30
|
| [LAYOUT\_ICONS](./foundation-layout.layout_icons.md) | A collection of SVG icons in base64 format. |
|
30
31
|
| [LayoutEmitEvents](./foundation-layout.layoutemitevents.md) | <p>Defines events that the layout system emits</p><p>'firstLoaded' - emitted when the layout has finished loading the first time using the declarative API after [DEFAULT\_RELOAD\_BUFFER](./foundation-layout.default_reload_buffer.md) ms. <br/> 'itemAdded' - emitted when an item is added to the layout' <br/> 'itemRemoved' - emitted when an item is removed from the layout' <br/> 'itemResized' - emitted when the user drags the divider to resize elements</p> |
|
31
|
-
| [LayoutReceiveEvents](./foundation-layout.layoutreceiveevents.md) | <p>Defines events that the layout system listens for</p><p>'changeTitle' - emit this from a contained item to update the title of the window that contains it
|
32
|
+
| [LayoutReceiveEvents](./foundation-layout.layoutreceiveevents.md) | <p>Defines events that the layout system listens for</p><p>'changeTitle' - emit this from a contained item to update the title of the window that contains it. 'autosave' - emit this from a contained item to hint to the layout system that it should autosave the layout. A contained item should do this if it has just changed some state it would like to persist. See [LayoutComponentWithState](./foundation-layout.layoutcomponentwithstate.md)<!-- -->.</p> |
|
32
33
|
| [layoutStyles](./foundation-layout.layoutstyles.md) | <code>ElementStyles</code> which defines the css for [FoundationLayout](./foundation-layout.foundationlayout.md)<!-- -->. |
|
33
34
|
| [layoutTemplate](./foundation-layout.layouttemplate.md) | <code>ViewTemplate</code> which defines the html for [FoundationLayout](./foundation-layout.foundationlayout.md)<!-- -->. |
|
34
35
|
|
@@ -37,7 +38,7 @@
|
|
37
38
|
| Type Alias | Description |
|
38
39
|
| --- | --- |
|
39
40
|
| [CustomButton](./foundation-layout.custombutton.md) | Definition of a custom button which will be added to all layout items. |
|
40
|
-
| [LayoutReceiveEventsDetail](./foundation-layout.layoutreceiveeventsdetail.md) | <p>Defines the shape of the detail that the layout listens works with for events it listens on</p><p>'changeTitle' - <code>title</code> is the string you want to set. For <code>mode</code>: <code>replace</code> will set the title to be <code>title</code>, <code>suffix</code> will append <code>title</code> to the end of the existing title.</p> |
|
41
|
+
| [LayoutReceiveEventsDetail](./foundation-layout.layoutreceiveeventsdetail.md) | <p>Defines the shape of the detail that the layout listens works with for events it listens on</p><p>'changeTitle' - <code>title</code> is the string you want to set. For <code>mode</code>: <code>replace</code> will set the title to be <code>title</code>, <code>suffix</code> will append <code>title</code> to the end of the existing title. 'autosave' - no other parameters.</p> |
|
41
42
|
| [LayoutRegionType](./foundation-layout.layoutregiontype.md) | Union type describing the three different types of region splits. Set on the <code>type</code> attribute on [FoundationLayoutRegion](./foundation-layout.foundationlayoutregion.md)<!-- -->. |
|
42
43
|
| [Placement](./foundation-layout.placement.md) | Where to and how to add the new item(s) into the layout when using the [FoundationLayout.addItem()](./foundation-layout.foundationlayout.additem.md) API. |
|
43
44
|
| [SerialisedLayout](./foundation-layout.serialisedlayout.md) | Versioned layout config objects. <code>v</code> is the version and <code>c</code> contains the layout config. |
|
package/docs/api-report.md
CHANGED
@@ -132,6 +132,12 @@ export const LAYOUT_ICONS: {
|
|
132
132
|
readonly tabDropdownSVG: "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0NDggNTEyIj48IS0tISBGb250IEF3ZXNvbWUgUHJvIDYuMi4wIGJ5IEBmb250YXdlc29tZSAtIGh0dHBzOi8vZm9udGF3ZXNvbWUuY29tIExpY2Vuc2UgLSBodHRwczovL2ZvbnRhd2Vzb21lLmNvbS9saWNlbnNlIChDb21tZXJjaWFsIExpY2Vuc2UpIENvcHlyaWdodCAyMDIyIEZvbnRpY29ucywgSW5jLiAtLT48cGF0aCBkPSJNNC4yNTEgMTgxLjFDNy4zOTIgMTc3LjcgMTEuNjkgMTc1LjEgMTYgMTc1LjFjMy44OTEgMCA3Ljc4MSAxLjQwNiAxMC44NiA0LjI1bDE5Ny4xIDE4MS4xbDE5Ny4xLTE4MS4xYzYuNS02IDE2LjY0LTUuNjI1IDIyLjYxIC45MDYyYzYgNi41IDUuNTk0IDE2LjU5LS44OTA2IDIyLjU5bC0yMDggMTkyYy02LjE1NiA1LjY4OC0xNS41NiA1LjY4OC0yMS43MiAwbC0yMDgtMTkyQy0xLjM0MyAxOTcuNy0xLjc0OSAxODcuNiA0LjI1MSAxODEuMXoiIGZpbGw9IiM4NzliYTYiLz48L3N2Zz4=";
|
133
133
|
};
|
134
134
|
|
135
|
+
// @public
|
136
|
+
export interface LayoutComponentWithState<T> {
|
137
|
+
applyState(state: T | null): void;
|
138
|
+
getCurrentState(): T;
|
139
|
+
}
|
140
|
+
|
135
141
|
// @public
|
136
142
|
export const LayoutEmitEvents: {
|
137
143
|
readonly firstLoaded: "first-loaded";
|
@@ -143,6 +149,7 @@ export const LayoutEmitEvents: {
|
|
143
149
|
// @public
|
144
150
|
export const LayoutReceiveEvents: {
|
145
151
|
readonly changeTitle: "change-title";
|
152
|
+
readonly autosave: "autosave";
|
146
153
|
};
|
147
154
|
|
148
155
|
// @public
|
@@ -151,6 +158,7 @@ export type LayoutReceiveEventsDetail = {
|
|
151
158
|
title: string;
|
152
159
|
mode: 'replace' | 'suffix';
|
153
160
|
};
|
161
|
+
autosave: void;
|
154
162
|
};
|
155
163
|
|
156
164
|
// Warning: (ae-forgotten-export) The symbol "layoutRegionValue" needs to be exported by the entry point index.d.ts
|
package/package.json
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "@genesislcap/foundation-layout",
|
3
3
|
"description": "Genesis Foundation UI App Layout",
|
4
|
-
"version": "14.92.
|
4
|
+
"version": "14.92.3-beta.29253cf.1",
|
5
5
|
"license": "SEE LICENSE IN license.txt",
|
6
6
|
"main": "dist/esm/index.js",
|
7
7
|
"types": "dist/foundation-layout.d.ts",
|
8
8
|
"engines": {
|
9
|
-
"node": ">=
|
9
|
+
"node": ">=20.0.0"
|
10
10
|
},
|
11
11
|
"config": {
|
12
12
|
"PORT": 3020
|
@@ -27,15 +27,15 @@
|
|
27
27
|
"test:debug": "genx test --debug"
|
28
28
|
},
|
29
29
|
"devDependencies": {
|
30
|
-
"@genesislcap/foundation-testing": "14.92.
|
31
|
-
"@genesislcap/genx": "14.92.
|
30
|
+
"@genesislcap/foundation-testing": "14.92.3-beta.29253cf.1",
|
31
|
+
"@genesislcap/genx": "14.92.3-beta.29253cf.1",
|
32
32
|
"rimraf": "^3.0.2"
|
33
33
|
},
|
34
34
|
"dependencies": {
|
35
35
|
"@genesis-community/golden-layout": "^2.10.1",
|
36
|
-
"@genesislcap/foundation-comms": "14.92.
|
37
|
-
"@genesislcap/foundation-logger": "14.92.
|
38
|
-
"@genesislcap/foundation-utils": "14.92.
|
36
|
+
"@genesislcap/foundation-comms": "14.92.3-beta.29253cf.1",
|
37
|
+
"@genesislcap/foundation-logger": "14.92.3-beta.29253cf.1",
|
38
|
+
"@genesislcap/foundation-utils": "14.92.3-beta.29253cf.1",
|
39
39
|
"@microsoft/fast-components": "^2.21.3",
|
40
40
|
"@microsoft/fast-element": "^1.7.0",
|
41
41
|
"@microsoft/fast-foundation": "^2.33.2",
|
@@ -50,5 +50,5 @@
|
|
50
50
|
"access": "public"
|
51
51
|
},
|
52
52
|
"customElements": "dist/custom-elements.json",
|
53
|
-
"gitHead": "
|
53
|
+
"gitHead": "d5804f12d5405b24946439a33d813105694b0867"
|
54
54
|
}
|