@genesislcap/foundation-layout 14.96.0 → 14.97.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/custom-elements.json +27 -0
- package/dist/dts/main/layout-main.d.ts +7 -1
- package/dist/dts/main/layout-main.d.ts.map +1 -1
- package/dist/esm/main/layout-main.js +20 -2
- package/dist/foundation-layout.api.json +20 -4
- package/dist/foundation-layout.d.ts +7 -1
- package/docs/api/foundation-layout.foundationlayout.loadlayout.md +2 -1
- package/docs/api/foundation-layout.foundationlayout.md +1 -1
- package/docs/api/foundation-layout.foundationlayout.tryloadlayoutfromlocalstorage.md +1 -1
- package/docs/api-report.md +1 -1
- package/package.json +7 -7
@@ -622,6 +622,14 @@
|
|
622
622
|
"text": "'placeholder' | 'error'"
|
623
623
|
},
|
624
624
|
"description": "what to do if the layout contains items that are not currently registered with the layout system. Defaults to 'error' which will throw an error. If set to 'placeholder' then any missing items will be replaced with a placeholder element. You can control the text of the placeholder element with {@link FoundationLayout.missingItemPlaceholder}.\n * "
|
625
|
+
},
|
626
|
+
{
|
627
|
+
"name": "disableCache",
|
628
|
+
"default": "false",
|
629
|
+
"type": {
|
630
|
+
"text": "boolean"
|
631
|
+
},
|
632
|
+
"description": "if set to true then the layout will give you a new instance of every item, even if it has a currently cached item to use. Using this will not stop you from saving and loading state via the {@link LayoutComponentWithState}interface. Defaults to false.\n * "
|
625
633
|
}
|
626
634
|
],
|
627
635
|
"privacy": "public"
|
@@ -685,6 +693,25 @@
|
|
685
693
|
},
|
686
694
|
"description": "The `LifecycleMixin` can use the lifecycleUpdateToken to determine if it needs to gate\nlifecycle methods from running when other items have been added or deleted.\nThis key is updated every time one of these actions are performed, so you can check if the key has changed and know you potentially need to gate some of your lifecycle functionality.\nThis method should be called whenever we are about to perform an action which will cause a lifecycle update, should as adding or removing an item from the layout"
|
687
695
|
},
|
696
|
+
{
|
697
|
+
"kind": "method",
|
698
|
+
"name": "removeConfigCacheInformation",
|
699
|
+
"privacy": "private",
|
700
|
+
"return": {
|
701
|
+
"type": {
|
702
|
+
"text": "LayoutConfig"
|
703
|
+
}
|
704
|
+
},
|
705
|
+
"parameters": [
|
706
|
+
{
|
707
|
+
"name": "config",
|
708
|
+
"type": {
|
709
|
+
"text": "LayoutConfig"
|
710
|
+
}
|
711
|
+
}
|
712
|
+
],
|
713
|
+
"description": "Recursively remove the instance key from the config which will mean that when the config is loaded it will instantiate a new instance for every item, even if they're in the cache."
|
714
|
+
},
|
688
715
|
{
|
689
716
|
"kind": "field",
|
690
717
|
"name": "_presentation",
|
@@ -152,6 +152,7 @@ export declare class FoundationLayout extends FoundationElement implements Layou
|
|
152
152
|
* the JavaScript API then you don't need to call this function. If you *are* calling {@link FoundationLayout.registerItem} then you should call this function immediately afterwards.
|
153
153
|
*
|
154
154
|
* Will load the layout with `handleMissingItem = 'placeholder` so placeholder text will be shown for any missing items.
|
155
|
+
* Loads layout config with the cache disabled (this will likely only be called after the page has refreshed anyway, so there would have been no cached elements to try and recover).
|
155
156
|
* @returns boolean - true if a layout was loaded, false if not
|
156
157
|
* @public
|
157
158
|
*/
|
@@ -165,10 +166,11 @@ export declare class FoundationLayout extends FoundationElement implements Layou
|
|
165
166
|
*
|
166
167
|
* @param layout - any version of {@link SerialisedLayout} object describing the layout
|
167
168
|
* @param handleMissingItem - what to do if the layout contains items that are not currently registered with the layout system. Defaults to 'error' which will throw an error. If set to 'placeholder' then any missing items will be replaced with a placeholder element. You can control the text of the placeholder element with {@link FoundationLayout.missingItemPlaceholder}.
|
169
|
+
* @param disableCache - if set to true then the layout will give you a new instance of every item, even if it has a currently cached item to use. Using this will not stop you from saving and loading state via the {@link LayoutComponentWithState} interface. Defaults to false.
|
168
170
|
* @throws {@link LayoutUsageError} if you attempt to load a layout with registered items that are not currently registered with the layout system, and handleMissingItem is set to 'error' (default).
|
169
171
|
* @throws various errors if the layout string is malformed and cannot be parsed
|
170
172
|
*/
|
171
|
-
loadLayout(layout: SerialisedLayout, handleMissingItem?: 'placeholder' | 'error'): void;
|
173
|
+
loadLayout(layout: SerialisedLayout, handleMissingItem?: 'placeholder' | 'error', disableCache?: boolean): void;
|
172
174
|
/**
|
173
175
|
* @public
|
174
176
|
* Dynamically add a new item to the layout. The user can move the new plane to whenever they want once it has been added.
|
@@ -287,6 +289,10 @@ export declare class FoundationLayout extends FoundationElement implements Layou
|
|
287
289
|
* @internal
|
288
290
|
*/
|
289
291
|
private getLayoutComponents;
|
292
|
+
/**
|
293
|
+
* Recursively remove the instance key from the config which will mean that when the config is loaded it will instantiate a new instance for every item, even if they're in the cache.
|
294
|
+
*/
|
295
|
+
private removeConfigCacheInformation;
|
290
296
|
}
|
291
297
|
/**
|
292
298
|
* `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,EAMb,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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;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;2BAI3B,CAAC"}
|
@@ -233,6 +233,7 @@ export class FoundationLayout extends FoundationElement {
|
|
233
233
|
* the JavaScript API then you don't need to call this function. If you *are* calling {@link FoundationLayout.registerItem} then you should call this function immediately afterwards.
|
234
234
|
*
|
235
235
|
* Will load the layout with `handleMissingItem = 'placeholder` so placeholder text will be shown for any missing items.
|
236
|
+
* Loads layout config with the cache disabled (this will likely only be called after the page has refreshed anyway, so there would have been no cached elements to try and recover).
|
236
237
|
* @returns boolean - true if a layout was loaded, false if not
|
237
238
|
* @public
|
238
239
|
*/
|
@@ -243,7 +244,7 @@ export class FoundationLayout extends FoundationElement {
|
|
243
244
|
if (!(this.autoSaveKey in existingLayouts))
|
244
245
|
return false;
|
245
246
|
const layout = JSON.parse(existingLayouts[this.autoSaveKey]);
|
246
|
-
this.loadLayout(layout, 'placeholder');
|
247
|
+
this.loadLayout(layout, 'placeholder', true);
|
247
248
|
return true;
|
248
249
|
}
|
249
250
|
/**
|
@@ -255,10 +256,11 @@ export class FoundationLayout extends FoundationElement {
|
|
255
256
|
*
|
256
257
|
* @param layout - any version of {@link SerialisedLayout} object describing the layout
|
257
258
|
* @param handleMissingItem - what to do if the layout contains items that are not currently registered with the layout system. Defaults to 'error' which will throw an error. If set to 'placeholder' then any missing items will be replaced with a placeholder element. You can control the text of the placeholder element with {@link FoundationLayout.missingItemPlaceholder}.
|
259
|
+
* @param disableCache - if set to true then the layout will give you a new instance of every item, even if it has a currently cached item to use. Using this will not stop you from saving and loading state via the {@link LayoutComponentWithState} interface. Defaults to false.
|
258
260
|
* @throws {@link LayoutUsageError} if you attempt to load a layout with registered items that are not currently registered with the layout system, and handleMissingItem is set to 'error' (default).
|
259
261
|
* @throws various errors if the layout string is malformed and cannot be parsed
|
260
262
|
*/
|
261
|
-
loadLayout(layout, handleMissingItem = 'error') {
|
263
|
+
loadLayout(layout, handleMissingItem = 'error', disableCache = false) {
|
262
264
|
const alreadyRegistered = this.registeredItems();
|
263
265
|
const wantedRegistered = FoundationLayout.layoutRequiredRegistrations(layout);
|
264
266
|
const missingRegisteredItems = getMissingArrayItems(wantedRegistered, alreadyRegistered);
|
@@ -268,6 +270,8 @@ export class FoundationLayout extends FoundationElement {
|
|
268
270
|
]}"`);
|
269
271
|
}
|
270
272
|
const layoutConfig = LayoutConfig.fromResolved(ResolvedLayoutConfig.unminifyConfig(layout.c));
|
273
|
+
if (disableCache)
|
274
|
+
this.removeConfigCacheInformation(layoutConfig);
|
271
275
|
if (missingRegisteredItems.length !== 0 && handleMissingItem === 'placeholder') {
|
272
276
|
this.registerPlaceholdersAndSetClosable(layoutConfig, missingRegisteredItems);
|
273
277
|
}
|
@@ -610,6 +614,20 @@ export class FoundationLayout extends FoundationElement {
|
|
610
614
|
...container.children,
|
611
615
|
]);
|
612
616
|
}
|
617
|
+
/**
|
618
|
+
* Recursively remove the instance key from the config which will mean that when the config is loaded it will instantiate a new instance for every item, even if they're in the cache.
|
619
|
+
*/
|
620
|
+
removeConfigCacheInformation(config) {
|
621
|
+
const traverse = (node) => {
|
622
|
+
var _b;
|
623
|
+
(_b = node.content) === null || _b === void 0 ? void 0 : _b.forEach((n) => traverse(n));
|
624
|
+
if (node.type === 'component') {
|
625
|
+
delete node.componentState['instance'];
|
626
|
+
}
|
627
|
+
};
|
628
|
+
traverse(config.root);
|
629
|
+
return config;
|
630
|
+
}
|
613
631
|
}
|
614
632
|
_FoundationLayout__boundDragListener = new WeakMap(), _a = componentType;
|
615
633
|
__decorate([
|
@@ -668,7 +668,7 @@
|
|
668
668
|
{
|
669
669
|
"kind": "Method",
|
670
670
|
"canonicalReference": "@genesislcap/foundation-layout!FoundationLayout#loadLayout:member(1)",
|
671
|
-
"docComment": "/**\n * Restores a layout described in the config from {@link FoundationLayout.getLayout | getLayout()}\n *\n * @remarks\n *\n * In order to restore a layout you must have registered all of the required panes with the layout system before restoring it. If you are just setting the layout using the declarative API then all of the same components will be registered. If you have added any elements using {@link FoundationLayout.registerItem} then you must ensure all of the same items have been added again. To make tracking what items are registered easier it is recommended in this case you explicitly name your registrations using the `id` parameter available on the {@link RegisteredElementConfig} and `foundation-layout-item` APIs. You can use {@link FoundationLayout.layoutRequiredRegistrations} to check which items are registered in a current layout in order to dynamically add any missing items before you can restore the layout\n *\n * @param layout - any version of {@link SerialisedLayout} object describing the layout\n *\n * @param handleMissingItem - what to do if the layout contains items that are not currently registered with the layout system. Defaults to 'error' which will throw an error. If set to 'placeholder' then any missing items will be replaced with a placeholder element. You can control the text of the placeholder element with {@link FoundationLayout.missingItemPlaceholder}.\n *\n * @throws\n *\n * {@link LayoutUsageError} if you attempt to load a layout with registered items that are not currently registered with the layout system, and handleMissingItem is set to 'error' (default).\n *\n * @throws\n *\n * various errors if the layout string is malformed and cannot be parsed\n *\n * @public\n */\n",
|
671
|
+
"docComment": "/**\n * Restores a layout described in the config from {@link FoundationLayout.getLayout | getLayout()}\n *\n * @remarks\n *\n * In order to restore a layout you must have registered all of the required panes with the layout system before restoring it. If you are just setting the layout using the declarative API then all of the same components will be registered. If you have added any elements using {@link FoundationLayout.registerItem} then you must ensure all of the same items have been added again. To make tracking what items are registered easier it is recommended in this case you explicitly name your registrations using the `id` parameter available on the {@link RegisteredElementConfig} and `foundation-layout-item` APIs. You can use {@link FoundationLayout.layoutRequiredRegistrations} to check which items are registered in a current layout in order to dynamically add any missing items before you can restore the layout\n *\n * @param layout - any version of {@link SerialisedLayout} object describing the layout\n *\n * @param handleMissingItem - what to do if the layout contains items that are not currently registered with the layout system. Defaults to 'error' which will throw an error. If set to 'placeholder' then any missing items will be replaced with a placeholder element. You can control the text of the placeholder element with {@link FoundationLayout.missingItemPlaceholder}.\n *\n * @param disableCache - if set to true then the layout will give you a new instance of every item, even if it has a currently cached item to use. Using this will not stop you from saving and loading state via the {@link LayoutComponentWithState} interface. Defaults to false.\n *\n * @throws\n *\n * {@link LayoutUsageError} if you attempt to load a layout with registered items that are not currently registered with the layout system, and handleMissingItem is set to 'error' (default).\n *\n * @throws\n *\n * various errors if the layout string is malformed and cannot be parsed\n *\n * @public\n */\n",
|
672
672
|
"excerptTokens": [
|
673
673
|
{
|
674
674
|
"kind": "Content",
|
@@ -687,6 +687,14 @@
|
|
687
687
|
"kind": "Content",
|
688
688
|
"text": "'placeholder' | 'error'"
|
689
689
|
},
|
690
|
+
{
|
691
|
+
"kind": "Content",
|
692
|
+
"text": ", disableCache?: "
|
693
|
+
},
|
694
|
+
{
|
695
|
+
"kind": "Content",
|
696
|
+
"text": "boolean"
|
697
|
+
},
|
690
698
|
{
|
691
699
|
"kind": "Content",
|
692
700
|
"text": "): "
|
@@ -702,8 +710,8 @@
|
|
702
710
|
],
|
703
711
|
"isStatic": false,
|
704
712
|
"returnTypeTokenRange": {
|
705
|
-
"startIndex":
|
706
|
-
"endIndex":
|
713
|
+
"startIndex": 7,
|
714
|
+
"endIndex": 8
|
707
715
|
},
|
708
716
|
"releaseTag": "Public",
|
709
717
|
"isProtected": false,
|
@@ -724,6 +732,14 @@
|
|
724
732
|
"endIndex": 4
|
725
733
|
},
|
726
734
|
"isOptional": true
|
735
|
+
},
|
736
|
+
{
|
737
|
+
"parameterName": "disableCache",
|
738
|
+
"parameterTypeTokenRange": {
|
739
|
+
"startIndex": 5,
|
740
|
+
"endIndex": 6
|
741
|
+
},
|
742
|
+
"isOptional": true
|
727
743
|
}
|
728
744
|
],
|
729
745
|
"isOptional": false,
|
@@ -893,7 +909,7 @@
|
|
893
909
|
{
|
894
910
|
"kind": "Method",
|
895
911
|
"canonicalReference": "@genesislcap/foundation-layout!FoundationLayout#tryLoadLayoutFromLocalStorage:member(1)",
|
896
|
-
"docComment": "/**\n * Try to load a layout from local storage, or return false. Only required if manually calling {@link FoundationLayout.registerItem}\n *\n * @remarks\n *\n * Attempt to load an autosaved layout from local storage, keyed on the `auto-save-key` attribute. If `auto-save-key` attribute is not set or there is no autosaved layout yet, this will return false. Else, true.\n *\n * This function is automatically called when loading the layout via the declarative API so if you're not registering components via the JavaScript API then you don't need to call this function. If you *are* calling {@link FoundationLayout.registerItem} then you should call this function immediately afterwards.\n *\n * Will load the layout with `handleMissingItem = 'placeholder` so placeholder text will be shown for any missing items.\n *\n * @returns boolean - true if a layout was loaded, false if not\n *\n * @public\n */\n",
|
912
|
+
"docComment": "/**\n * Try to load a layout from local storage, or return false. Only required if manually calling {@link FoundationLayout.registerItem}\n *\n * @remarks\n *\n * Attempt to load an autosaved layout from local storage, keyed on the `auto-save-key` attribute. If `auto-save-key` attribute is not set or there is no autosaved layout yet, this will return false. Else, true.\n *\n * This function is automatically called when loading the layout via the declarative API so if you're not registering components via the JavaScript API then you don't need to call this function. If you *are* calling {@link FoundationLayout.registerItem} then you should call this function immediately afterwards.\n *\n * Will load the layout with `handleMissingItem = 'placeholder` so placeholder text will be shown for any missing items. Loads layout config with the cache disabled (this will likely only be called after the page has refreshed anyway, so there would have been no cached elements to try and recover).\n *\n * @returns boolean - true if a layout was loaded, false if not\n *\n * @public\n */\n",
|
897
913
|
"excerptTokens": [
|
898
914
|
{
|
899
915
|
"kind": "Content",
|
@@ -188,6 +188,7 @@ export declare class FoundationLayout extends FoundationElement implements Layou
|
|
188
188
|
* the JavaScript API then you don't need to call this function. If you *are* calling {@link FoundationLayout.registerItem} then you should call this function immediately afterwards.
|
189
189
|
*
|
190
190
|
* Will load the layout with `handleMissingItem = 'placeholder` so placeholder text will be shown for any missing items.
|
191
|
+
* Loads layout config with the cache disabled (this will likely only be called after the page has refreshed anyway, so there would have been no cached elements to try and recover).
|
191
192
|
* @returns boolean - true if a layout was loaded, false if not
|
192
193
|
* @public
|
193
194
|
*/
|
@@ -201,10 +202,11 @@ export declare class FoundationLayout extends FoundationElement implements Layou
|
|
201
202
|
*
|
202
203
|
* @param layout - any version of {@link SerialisedLayout} object describing the layout
|
203
204
|
* @param handleMissingItem - what to do if the layout contains items that are not currently registered with the layout system. Defaults to 'error' which will throw an error. If set to 'placeholder' then any missing items will be replaced with a placeholder element. You can control the text of the placeholder element with {@link FoundationLayout.missingItemPlaceholder}.
|
205
|
+
* @param disableCache - if set to true then the layout will give you a new instance of every item, even if it has a currently cached item to use. Using this will not stop you from saving and loading state via the {@link LayoutComponentWithState} interface. Defaults to false.
|
204
206
|
* @throws {@link LayoutUsageError} if you attempt to load a layout with registered items that are not currently registered with the layout system, and handleMissingItem is set to 'error' (default).
|
205
207
|
* @throws various errors if the layout string is malformed and cannot be parsed
|
206
208
|
*/
|
207
|
-
loadLayout(layout: SerialisedLayout, handleMissingItem?: 'placeholder' | 'error'): void;
|
209
|
+
loadLayout(layout: SerialisedLayout, handleMissingItem?: 'placeholder' | 'error', disableCache?: boolean): void;
|
208
210
|
/**
|
209
211
|
* @public
|
210
212
|
* Dynamically add a new item to the layout. The user can move the new plane to whenever they want once it has been added.
|
@@ -323,6 +325,10 @@ export declare class FoundationLayout extends FoundationElement implements Layou
|
|
323
325
|
* @internal
|
324
326
|
*/
|
325
327
|
private getLayoutComponents;
|
328
|
+
/**
|
329
|
+
* Recursively remove the instance key from the config which will mean that when the config is loaded it will instantiate a new instance for every item, even if they're in the cache.
|
330
|
+
*/
|
331
|
+
private removeConfigCacheInformation;
|
326
332
|
}
|
327
333
|
|
328
334
|
/**
|
@@ -9,7 +9,7 @@ Restores a layout described in the config from [getLayout()](./foundation-layout
|
|
9
9
|
**Signature:**
|
10
10
|
|
11
11
|
```typescript
|
12
|
-
loadLayout(layout: SerialisedLayout, handleMissingItem?: 'placeholder' | 'error'): void;
|
12
|
+
loadLayout(layout: SerialisedLayout, handleMissingItem?: 'placeholder' | 'error', disableCache?: boolean): void;
|
13
13
|
```
|
14
14
|
|
15
15
|
## Parameters
|
@@ -18,6 +18,7 @@ loadLayout(layout: SerialisedLayout, handleMissingItem?: 'placeholder' | 'error'
|
|
18
18
|
| --- | --- | --- |
|
19
19
|
| layout | [SerialisedLayout](./foundation-layout.serialisedlayout.md) | any version of [SerialisedLayout](./foundation-layout.serialisedlayout.md) object describing the layout |
|
20
20
|
| handleMissingItem | 'placeholder' \| 'error' | _(Optional)_ what to do if the layout contains items that are not currently registered with the layout system. Defaults to 'error' which will throw an error. If set to 'placeholder' then any missing items will be replaced with a placeholder element. You can control the text of the placeholder element with [FoundationLayout.missingItemPlaceholder](./foundation-layout.foundationlayout.missingitemplaceholder.md)<!-- -->. |
|
21
|
+
| disableCache | boolean | _(Optional)_ if set to true then the layout will give you a new instance of every item, even if it has a currently cached item to use. Using this will not stop you from saving and loading state via the [LayoutComponentWithState](./foundation-layout.layoutcomponentwithstate.md) interface. Defaults to false. |
|
21
22
|
|
22
23
|
**Returns:**
|
23
24
|
|
@@ -42,7 +42,7 @@ The constructor for this class is marked as internal. Third-party code should no
|
|
42
42
|
| [addItem(config, placement)](./foundation-layout.foundationlayout.additem.md) | | Dynamically add a new item to the layout. The user can move the new plane to whenever they want once it has been added. |
|
43
43
|
| [getLayout()](./foundation-layout.foundationlayout.getlayout.md) | | Gets a minified string containing the config describing the current layout of the layout object to later restore in [function](./foundation-layout.foundationlayout.loadlayout.md) |
|
44
44
|
| [layoutRequiredRegistrations(layout)](./foundation-layout.foundationlayout.layoutrequiredregistrations.md) | <code>static</code> | Gets all of the required element registry function names for a set of config |
|
45
|
-
| [loadLayout(layout, handleMissingItem)](./foundation-layout.foundationlayout.loadlayout.md) | | Restores a layout described in the config from [getLayout()](./foundation-layout.foundationlayout.getlayout.md) |
|
45
|
+
| [loadLayout(layout, handleMissingItem, disableCache)](./foundation-layout.foundationlayout.loadlayout.md) | | Restores a layout described in the config from [getLayout()](./foundation-layout.foundationlayout.getlayout.md) |
|
46
46
|
| [registeredItems()](./foundation-layout.foundationlayout.registereditems.md) | | Gets all of the currently registered names |
|
47
47
|
| [registerItem(registration, elements)](./foundation-layout.foundationlayout.registeritem.md) | | Register a collection of <code>Element</code> and associate them with an <code>ID</code> with the layout system for later use. |
|
48
48
|
| [tryLoadLayoutFromLocalStorage()](./foundation-layout.foundationlayout.tryloadlayoutfromlocalstorage.md) | | Try to load a layout from local storage, or return false. Only required if manually calling [FoundationLayout.registerItem()](./foundation-layout.foundationlayout.registeritem.md) |
|
@@ -23,5 +23,5 @@ Attempt to load an autosaved layout from local storage, keyed on the `auto-save-
|
|
23
23
|
|
24
24
|
This function is automatically called when loading the layout via the declarative API so if you're not registering components via the JavaScript API then you don't need to call this function. If you \*are\* calling [FoundationLayout.registerItem()](./foundation-layout.foundationlayout.registeritem.md) then you should call this function immediately afterwards.
|
25
25
|
|
26
|
-
Will load the layout with `handleMissingItem = 'placeholder` so placeholder text will be shown for any missing items.
|
26
|
+
Will load the layout with `handleMissingItem = 'placeholder` so placeholder text will be shown for any missing items. Loads layout config with the cache disabled (this will likely only be called after the page has refreshed anyway, so there would have been no cached elements to try and recover).
|
27
27
|
|
package/docs/api-report.md
CHANGED
@@ -51,7 +51,7 @@ export class FoundationLayout extends FoundationElement implements LayoutCompone
|
|
51
51
|
layoutElement: HTMLElement;
|
52
52
|
static layoutRequiredRegistrations(layout: SerialisedLayout): string[];
|
53
53
|
lifecycleUpdateToken: string | undefined;
|
54
|
-
loadLayout(layout: SerialisedLayout, handleMissingItem?: 'placeholder' | 'error'): void;
|
54
|
+
loadLayout(layout: SerialisedLayout, handleMissingItem?: 'placeholder' | 'error', disableCache?: boolean): void;
|
55
55
|
missingItemPlaceholder: (missingItem: string) => string;
|
56
56
|
registeredItems(): string[];
|
57
57
|
registerItem(registration: string, elements: Element[]): string;
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@genesislcap/foundation-layout",
|
3
3
|
"description": "Genesis Foundation UI App Layout",
|
4
|
-
"version": "14.
|
4
|
+
"version": "14.97.0",
|
5
5
|
"license": "SEE LICENSE IN license.txt",
|
6
6
|
"main": "dist/esm/index.js",
|
7
7
|
"types": "dist/foundation-layout.d.ts",
|
@@ -27,15 +27,15 @@
|
|
27
27
|
"test:debug": "genx test --debug"
|
28
28
|
},
|
29
29
|
"devDependencies": {
|
30
|
-
"@genesislcap/foundation-testing": "14.
|
31
|
-
"@genesislcap/genx": "14.
|
30
|
+
"@genesislcap/foundation-testing": "14.97.0",
|
31
|
+
"@genesislcap/genx": "14.97.0",
|
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.
|
37
|
-
"@genesislcap/foundation-logger": "14.
|
38
|
-
"@genesislcap/foundation-utils": "14.
|
36
|
+
"@genesislcap/foundation-comms": "14.97.0",
|
37
|
+
"@genesislcap/foundation-logger": "14.97.0",
|
38
|
+
"@genesislcap/foundation-utils": "14.97.0",
|
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": "8a8a410a437d11bd1ada9d540411d3701f1382e5"
|
54
54
|
}
|