@genesislcap/foundation-layout 14.59.0 → 14.60.0

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -168,7 +168,7 @@ This API enables you to register an item at runtime, but it will not be displaye
168
168
 
169
169
  #### [Add Item](./docs/api/foundation-layout.foundationlayout.additem.md)
170
170
 
171
- Add an item that has previously been registered with the layout.
171
+ Add an item or items that have previously been registered with the layout.
172
172
 
173
173
  #### [Layout Required Registrations](./docs/api/foundation-layout.foundationlayout.layoutrequiredregistrations.md)
174
174
 
@@ -846,6 +846,39 @@ The following example is invalid:
846
846
  ```
847
847
  This is because you cannot have multiple layout elements as the immediate child of the layout root. You will get a runtime error.
848
848
 
849
+ ### Multiple nested layouts
850
+
851
+ The following example is invalid:
852
+
853
+ ```html
854
+ <foundation-layout>
855
+ <foundation-layout-item title="Component 1">
856
+ <another-component></another-component>
857
+ </foundation-layout-item>
858
+ <foundation-layout-item title="Component 2">
859
+ <!-- Content -->
860
+ </foundation-layout-item>
861
+ </foundation-layout>
862
+ ```
863
+ Where the markup of `another-component` is something like:
864
+ ```html
865
+ <!--other markup-->
866
+ <foundation-layout>
867
+ <foundation-layout-item title="Component 1">
868
+ <!-- Content -->
869
+ </foundation-layout-item>
870
+ <foundation-layout-item title="Component 2">
871
+ <!-- Content -->
872
+ </foundation-layout-item>
873
+ <foundation-layout-item title="Component 3">
874
+ <!-- Content -->
875
+ </foundation-layout-item>
876
+ </foundation-layout>
877
+ <!--other markup-->
878
+ ```
879
+
880
+ This is because you cannot have an instance of the layout nested inside of another layout instance. You could try adding multiple items at once using `.addItem([elem1,..,elemN])` instead.
881
+
849
882
  ### Nested item
850
883
 
851
884
  The following example is invalid:
@@ -461,17 +461,17 @@
461
461
  {
462
462
  "name": "config",
463
463
  "type": {
464
- "text": "RegisteredElementConfig"
464
+ "text": "RegisteredElementConfig | RegisteredElementConfig[]"
465
465
  },
466
- "description": "{@link RegisteredElementConfig}configuration items for the new pane\n * "
466
+ "description": "{@link RegisteredElementConfig}configuration items for the new items(s). Pass an array of {@link RegisteredElementConfig}to add multiple items at once.\n * "
467
467
  },
468
468
  {
469
469
  "name": "placement",
470
- "default": "{ area: 'right' }",
470
+ "default": "defaultAddItemPlacement",
471
471
  "type": {
472
472
  "text": "Placement"
473
473
  },
474
- "description": "where to add the new pane on the layout (defaults to the right hand side)"
474
+ "description": "where and how to add the new items to the layout. For more info and defaults see {@link Placement}.\n * "
475
475
  }
476
476
  ],
477
477
  "privacy": "public"
@@ -139,15 +139,15 @@ export declare class FoundationLayout extends FoundationElement implements Layou
139
139
  * @public
140
140
  * Dynamically add a new item to the layout. The user can move the new plane to whenever they want once it has been added.
141
141
  * @remarks
142
- * Adding a new item invokes the registration previously made explicitly via {@link FoundationLayout.registerItem | registerItem()} or implicitly via the html declerative API.
142
+ * Adding new items invokes the registration previously made explicitly via {@link FoundationLayout.registerItem | registerItem()} or implicitly via the html declarative API.
143
143
  *
144
144
  * The elements added onto the new pane are copies using `element.cloneNode()` of the original element references used during registration.
145
145
  *
146
- * @param config - {@link RegisteredElementConfig} configuration items for the new pane
147
- * @param placement - where to add the new pane on the layout (defaults to the right hand side)
146
+ * @param config - {@link RegisteredElementConfig} configuration items for the new items(s). Pass an array of {@link RegisteredElementConfig} to add multiple items at once.
147
+ * @param placement - where and how to add the new items to the layout. For more info and defaults see {@link Placement}.
148
148
  * @throws {@link LayoutRegistrationError} if you attempt to add an item before it has been registered
149
149
  */
150
- addItem(config: RegisteredElementConfig, placement?: Placement): void;
150
+ addItem(config: RegisteredElementConfig | RegisteredElementConfig[], placement?: Placement): void;
151
151
  /**
152
152
  * @public
153
153
  * Register a collection of `Element` and associate them with an `ID` with the layout system for later use.
@@ -1 +1 @@
1
- {"version":3,"file":"layout-main.d.ts","sourceRoot":"","sources":["../../../src/main/layout-main.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,cAAc,EACf,MAAM,kCAAkC,CAAC;AAI1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAE/D,OA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AAgB;IAChB,CAAC,aAAa,CAAC,EAAE,gBAAgB,CAAgB;IAEjD;;;;OAIG;IACH,OAAO,CAAC,YAAY,CAA0C;IAE9D,gBAAgB;IAChB,iBAAiB,IAAI,IAAI;IAUzB;;;OAGG;IACH,OAAO,CAAC,iBAAiB;IAMzB;;;OAGG;IACH,OAAO,CAAC,qBAAqB;IAS7B,gBAAgB;IAChB,OAAO,CAAC,wBAAwB;IAIhC,gBAAgB;IAChB,gBAAgB,CAAC,CAAC,SAAS,cAAc,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC;IAKtD,gBAAgB;IAChB,mBAAmB,IAAI,IAAI;IAI3B,gBAAgB;IAChB,wBAAwB,CAAC,MAAM,EAAE,kBAAkB,GAAG,MAAM;CAG7D;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,sBAAsB;;;;;;iCAGjC,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import { FoundationLayout, FoundationLayoutRegion } from '../main';
2
+ import { LayoutRegionType } from './types';
2
3
  /**
3
4
  * Returns an array of values of the array a which are missing in b
4
5
  * An empty array is returned if every value of a is in b
@@ -7,4 +8,8 @@ import { FoundationLayout, FoundationLayoutRegion } from '../main';
7
8
  export declare function getMissingArrayItems<T>(a: T[], b: T[]): T[];
8
9
  /** @internal */
9
10
  export declare function getParentLayoutComponent(): FoundationLayout | FoundationLayoutRegion;
11
+ /** @internal */
12
+ export type GoldenLayoutRegions = 'row' | 'column' | 'stack';
13
+ /** @internal */
14
+ export declare const regionConveter: (x: LayoutRegionType) => GoldenLayoutRegions;
10
15
  //# sourceMappingURL=misc.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"misc.d.ts","sourceRoot":"","sources":["../../../src/utils/misc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAInE;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAE3D;AAED,gBAAgB;AAChB,wBAAgB,wBAAwB,IAAI,gBAAgB,GAAG,sBAAsB,CAYpF"}
1
+ {"version":3,"file":"misc.d.ts","sourceRoot":"","sources":["../../../src/utils/misc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAGnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE3C;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAE3D;AAED,gBAAgB;AAChB,wBAAgB,wBAAwB,IAAI,gBAAgB,GAAG,sBAAsB,CAYpF;AAED,gBAAgB;AAChB,MAAM,MAAM,mBAAmB,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,CAAC;AAC7D,gBAAgB;AAChB,eAAO,MAAM,cAAc,MAAO,gBAAgB,KAAG,mBAOpD,CAAC"}
@@ -34,10 +34,20 @@ export interface RegisteredElementConfig {
34
34
  }
35
35
  /**
36
36
  * @public
37
- * Where to add the new item into the layout when using the {@link FoundationLayout.addItem} API
37
+ * Where to and how to add the new item(s) into the layout when using the {@link FoundationLayout.addItem} API.
38
+ * @remarks
39
+ * `area` dictates what part of the layout the new item(s) will be added to.
40
+ * `multiple` is optional and is defaulted to `type=horizontal` and `size=50%` if not defined. `multiple` config only affects the placement if multiple items are specified to be added.
41
+ * `multiple.type` sets the group type of the new items, whether they are horizontal, vertical, or in tabs.
42
+ * `multiple.size` - optional string describing the size of the new item (see the written documentation for more info).
43
+ * `multiple.size` specifies the size of the new group to be added and then the `size` config of the new items are the sizes relative to this new multiple group. If you only specify one new item then the `size` of that will be used as the size and will override `multiple.size`.
38
44
  */
39
45
  export type Placement = {
40
46
  area: 'top' | 'left' | 'bottom' | 'right';
47
+ multiple?: {
48
+ type: LayoutRegionType;
49
+ size?: string;
50
+ };
41
51
  };
42
52
  /** @internal */
43
53
  export interface RegistrationConfig {
@@ -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;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C;;;;;;;;;;GAUG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,CAAC,EAAE,GAAG,CAAC;IACP,CAAC,EAAE,oBAAoB,CAAC;CACzB,CAAC;AAEF;;;;;;;;;;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;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,KAAK,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;CAC3C,CAAC;AAEF,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,IAA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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"}
@@ -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, } from '../utils/';
9
+ import { DEFAULT_RELOAD_BUFFER, LayoutEmitEvents, LayoutReceiveEvents, componentType, AUTOSAVE_KEY, regionConveter, } from '../utils/';
10
10
  import { getMissingArrayItems } from '../utils/';
11
11
  import { LayoutRegistrationError, LayoutUsageError } from '../utils/error';
12
12
  import { logger } from '../utils/logger';
@@ -17,6 +17,13 @@ export { layoutStyles } from '../styles';
17
17
  * layout that requires it
18
18
  */
19
19
  let appliedGlobalStyles = false;
20
+ const defaultAddItemPlacement = {
21
+ area: 'right',
22
+ multiple: {
23
+ type: 'tabs',
24
+ size: '33%',
25
+ },
26
+ };
20
27
  /**
21
28
  * @public
22
29
  * Top level web component which is used to initialise a custom layout
@@ -220,26 +227,36 @@ export class FoundationLayout extends FoundationElement {
220
227
  * @public
221
228
  * Dynamically add a new item to the layout. The user can move the new plane to whenever they want once it has been added.
222
229
  * @remarks
223
- * Adding a new item invokes the registration previously made explicitly via {@link FoundationLayout.registerItem | registerItem()} or implicitly via the html declerative API.
230
+ * Adding new items invokes the registration previously made explicitly via {@link FoundationLayout.registerItem | registerItem()} or implicitly via the html declarative API.
224
231
  *
225
232
  * The elements added onto the new pane are copies using `element.cloneNode()` of the original element references used during registration.
226
233
  *
227
- * @param config - {@link RegisteredElementConfig} configuration items for the new pane
228
- * @param placement - where to add the new pane on the layout (defaults to the right hand side)
234
+ * @param config - {@link RegisteredElementConfig} configuration items for the new items(s). Pass an array of {@link RegisteredElementConfig} to add multiple items at once.
235
+ * @param placement - where and how to add the new items to the layout. For more info and defaults see {@link Placement}.
229
236
  * @throws {@link LayoutRegistrationError} if you attempt to add an item before it has been registered
230
237
  */
231
- addItem(config, placement = { area: 'right' }) {
232
- const { registration, title, size, closable } = config;
233
- if (!this.layout.getRegisteredComponentTypeNames().includes(registration)) {
234
- throw new LayoutRegistrationError(`Cannot add item '${registration}' which is not registered with the layout system.`);
235
- }
238
+ addItem(config, placement = defaultAddItemPlacement) {
239
+ var _b, _c;
240
+ const configArray = Array.isArray(config) ? config : [config];
241
+ const isSingleItem = configArray.length === 1;
242
+ const childItems = configArray.map((regConfig) => {
243
+ const { registration, title, size, closable } = regConfig;
244
+ if (!this.layout.getRegisteredComponentTypeNames().includes(registration)) {
245
+ throw new LayoutRegistrationError(`Cannot add item '${registration}' which is not registered with the layout system.`);
246
+ }
247
+ return {
248
+ type: 'component',
249
+ componentType: registration,
250
+ title: title !== null && title !== void 0 ? title : `Item ${registration}`,
251
+ reorderEnabled: true,
252
+ isClosable: closable || false,
253
+ size: !isSingleItem ? size : undefined,
254
+ };
255
+ });
236
256
  const itemConfig = {
237
- type: 'component',
238
- componentType: registration,
239
- title: title !== null && title !== void 0 ? title : `Item ${registration}`,
240
- reorderEnabled: true,
241
- isClosable: closable || false,
242
- size,
257
+ type: regionConveter(((_b = placement === null || placement === void 0 ? void 0 : placement.multiple) === null || _b === void 0 ? void 0 : _b.type) || 'tabs'),
258
+ content: childItems,
259
+ size: isSingleItem ? config[0].size : (_c = placement === null || placement === void 0 ? void 0 : placement.multiple) === null || _c === void 0 ? void 0 : _c.size,
243
260
  };
244
261
  /**
245
262
  * If no root is added (no items via declerative API) then
@@ -2,17 +2,9 @@ var _a;
2
2
  import { __decorate } from "tslib";
3
3
  import { attr } from '@microsoft/fast-element';
4
4
  import { FoundationElement } from '@microsoft/fast-foundation';
5
- import { componentType, getParentLayoutComponent, layoutRegionValue, wrapperTemplate, } from '../utils';
5
+ import { componentType, getParentLayoutComponent, layoutRegionValue, regionConveter, wrapperTemplate, } from '../utils';
6
6
  import { logger } from '../utils/logger';
7
7
  const defaultLayoutType = layoutRegionValue[0];
8
- const regionConveter = (x) => {
9
- const t = {
10
- horizontal: 'column',
11
- vertical: 'row',
12
- tabs: 'stack',
13
- };
14
- return t[x];
15
- };
16
8
  /**
17
9
  * @public
18
10
  * `FoundationLayoutRegion` is a custom element that represents a region in the layout.
@@ -22,3 +22,12 @@ export function getParentLayoutComponent() {
22
22
  throw new LayoutUsageError('Using layout region outside of layout root');
23
23
  }
24
24
  }
25
+ /** @internal */
26
+ export const regionConveter = (x) => {
27
+ const t = {
28
+ horizontal: 'column',
29
+ vertical: 'row',
30
+ tabs: 'stack',
31
+ };
32
+ return t[x];
33
+ };
@@ -242,7 +242,7 @@
242
242
  {
243
243
  "kind": "Method",
244
244
  "canonicalReference": "@genesislcap/foundation-layout!FoundationLayout#addItem:member(1)",
245
- "docComment": "/**\n * Dynamically add a new item to the layout. The user can move the new plane to whenever they want once it has been added.\n *\n * @remarks\n *\n * Adding a new item invokes the registration previously made explicitly via {@link FoundationLayout.registerItem | registerItem()} or implicitly via the html declerative API.\n *\n * The elements added onto the new pane are copies using `element.cloneNode()` of the original element references used during registration.\n *\n * @param config - {@link RegisteredElementConfig} configuration items for the new pane\n *\n * @param placement - where to add the new pane on the layout (defaults to the right hand side)\n *\n * @throws\n *\n * {@link LayoutRegistrationError} if you attempt to add an item before it has been registered\n *\n * @public\n */\n",
245
+ "docComment": "/**\n * Dynamically add a new item to the layout. The user can move the new plane to whenever they want once it has been added.\n *\n * @remarks\n *\n * Adding new items invokes the registration previously made explicitly via {@link FoundationLayout.registerItem | registerItem()} or implicitly via the html declarative API.\n *\n * The elements added onto the new pane are copies using `element.cloneNode()` of the original element references used during registration.\n *\n * @param config - {@link RegisteredElementConfig} configuration items for the new items(s). Pass an array of {@link RegisteredElementConfig} to add multiple items at once.\n *\n * @param placement - where and how to add the new items to the layout. For more info and defaults see {@link Placement}.\n *\n * @throws\n *\n * {@link LayoutRegistrationError} if you attempt to add an item before it has been registered\n *\n * @public\n */\n",
246
246
  "excerptTokens": [
247
247
  {
248
248
  "kind": "Content",
@@ -253,6 +253,19 @@
253
253
  "text": "RegisteredElementConfig",
254
254
  "canonicalReference": "@genesislcap/foundation-layout!RegisteredElementConfig:interface"
255
255
  },
256
+ {
257
+ "kind": "Content",
258
+ "text": " | "
259
+ },
260
+ {
261
+ "kind": "Reference",
262
+ "text": "RegisteredElementConfig",
263
+ "canonicalReference": "@genesislcap/foundation-layout!RegisteredElementConfig:interface"
264
+ },
265
+ {
266
+ "kind": "Content",
267
+ "text": "[]"
268
+ },
256
269
  {
257
270
  "kind": "Content",
258
271
  "text": ", placement?: "
@@ -277,8 +290,8 @@
277
290
  ],
278
291
  "isStatic": false,
279
292
  "returnTypeTokenRange": {
280
- "startIndex": 5,
281
- "endIndex": 6
293
+ "startIndex": 8,
294
+ "endIndex": 9
282
295
  },
283
296
  "releaseTag": "Public",
284
297
  "isProtected": false,
@@ -288,15 +301,15 @@
288
301
  "parameterName": "config",
289
302
  "parameterTypeTokenRange": {
290
303
  "startIndex": 1,
291
- "endIndex": 2
304
+ "endIndex": 5
292
305
  },
293
306
  "isOptional": false
294
307
  },
295
308
  {
296
309
  "parameterName": "placement",
297
310
  "parameterTypeTokenRange": {
298
- "startIndex": 3,
299
- "endIndex": 4
311
+ "startIndex": 6,
312
+ "endIndex": 7
300
313
  },
301
314
  "isOptional": true
302
315
  }
@@ -1527,7 +1540,7 @@
1527
1540
  {
1528
1541
  "kind": "TypeAlias",
1529
1542
  "canonicalReference": "@genesislcap/foundation-layout!Placement:type",
1530
- "docComment": "/**\n * Where to add the new item into the layout when using the {@link FoundationLayout.addItem} API\n *\n * @public\n */\n",
1543
+ "docComment": "/**\n * Where to and how to add the new item(s) into the layout when using the {@link FoundationLayout.addItem} API.\n *\n * @remarks\n *\n * `area` dictates what part of the layout the new item(s) will be added to. `multiple` is optional and is defaulted to `type=horizontal` and `size=50%` if not defined. `multiple` config only affects the placement if multiple items are specified to be added. `multiple.type` sets the group type of the new items, whether they are horizontal, vertical, or in tabs. `multiple.size` - optional string describing the size of the new item (see the written documentation for more info). `multiple.size` specifies the size of the new group to be added and then the `size` config of the new items are the sizes relative to this new multiple group. If you only specify one new item then the `size` of that will be used as the size and will override `multiple.size`.\n *\n * @public\n */\n",
1531
1544
  "excerptTokens": [
1532
1545
  {
1533
1546
  "kind": "Content",
@@ -1535,7 +1548,16 @@
1535
1548
  },
1536
1549
  {
1537
1550
  "kind": "Content",
1538
- "text": "{\n area: 'top' | 'left' | 'bottom' | 'right';\n}"
1551
+ "text": "{\n area: 'top' | 'left' | 'bottom' | 'right';\n multiple?: {\n type: "
1552
+ },
1553
+ {
1554
+ "kind": "Reference",
1555
+ "text": "LayoutRegionType",
1556
+ "canonicalReference": "@genesislcap/foundation-layout!LayoutRegionType:type"
1557
+ },
1558
+ {
1559
+ "kind": "Content",
1560
+ "text": ";\n size?: string;\n };\n}"
1539
1561
  },
1540
1562
  {
1541
1563
  "kind": "Content",
@@ -1547,7 +1569,7 @@
1547
1569
  "name": "Placement",
1548
1570
  "typeTokenRange": {
1549
1571
  "startIndex": 1,
1550
- "endIndex": 2
1572
+ "endIndex": 4
1551
1573
  }
1552
1574
  },
1553
1575
  {
@@ -162,15 +162,15 @@ export declare class FoundationLayout extends FoundationElement implements Layou
162
162
  * @public
163
163
  * Dynamically add a new item to the layout. The user can move the new plane to whenever they want once it has been added.
164
164
  * @remarks
165
- * Adding a new item invokes the registration previously made explicitly via {@link FoundationLayout.registerItem | registerItem()} or implicitly via the html declerative API.
165
+ * Adding new items invokes the registration previously made explicitly via {@link FoundationLayout.registerItem | registerItem()} or implicitly via the html declarative API.
166
166
  *
167
167
  * The elements added onto the new pane are copies using `element.cloneNode()` of the original element references used during registration.
168
168
  *
169
- * @param config - {@link RegisteredElementConfig} configuration items for the new pane
170
- * @param placement - where to add the new pane on the layout (defaults to the right hand side)
169
+ * @param config - {@link RegisteredElementConfig} configuration items for the new items(s). Pass an array of {@link RegisteredElementConfig} to add multiple items at once.
170
+ * @param placement - where and how to add the new items to the layout. For more info and defaults see {@link Placement}.
171
171
  * @throws {@link LayoutRegistrationError} if you attempt to add an item before it has been registered
172
172
  */
173
- addItem(config: RegisteredElementConfig, placement?: Placement): void;
173
+ addItem(config: RegisteredElementConfig | RegisteredElementConfig[], placement?: Placement): void;
174
174
  /**
175
175
  * @public
176
176
  * Register a collection of `Element` and associate them with an `ID` with the layout system for later use.
@@ -495,10 +495,20 @@ export declare class LayoutUsageError extends Error {
495
495
 
496
496
  /**
497
497
  * @public
498
- * Where to add the new item into the layout when using the {@link FoundationLayout.addItem} API
498
+ * Where to and how to add the new item(s) into the layout when using the {@link FoundationLayout.addItem} API.
499
+ * @remarks
500
+ * `area` dictates what part of the layout the new item(s) will be added to.
501
+ * `multiple` is optional and is defaulted to `type=horizontal` and `size=50%` if not defined. `multiple` config only affects the placement if multiple items are specified to be added.
502
+ * `multiple.type` sets the group type of the new items, whether they are horizontal, vertical, or in tabs.
503
+ * `multiple.size` - optional string describing the size of the new item (see the written documentation for more info).
504
+ * `multiple.size` specifies the size of the new group to be added and then the `size` config of the new items are the sizes relative to this new multiple group. If you only specify one new item then the `size` of that will be used as the size and will override `multiple.size`.
499
505
  */
500
506
  export declare type Placement = {
501
507
  area: 'top' | 'left' | 'bottom' | 'right';
508
+ multiple?: {
509
+ type: LayoutRegionType;
510
+ size?: string;
511
+ };
502
512
  };
503
513
 
504
514
  /**
@@ -9,15 +9,15 @@ Dynamically add a new item to the layout. The user can move the new plane to whe
9
9
  **Signature:**
10
10
 
11
11
  ```typescript
12
- addItem(config: RegisteredElementConfig, placement?: Placement): void;
12
+ addItem(config: RegisteredElementConfig | RegisteredElementConfig[], placement?: Placement): void;
13
13
  ```
14
14
 
15
15
  ## Parameters
16
16
 
17
17
  | Parameter | Type | Description |
18
18
  | --- | --- | --- |
19
- | config | [RegisteredElementConfig](./foundation-layout.registeredelementconfig.md) | [RegisteredElementConfig](./foundation-layout.registeredelementconfig.md) configuration items for the new pane |
20
- | placement | [Placement](./foundation-layout.placement.md) | _(Optional)_ where to add the new pane on the layout (defaults to the right hand side) |
19
+ | config | [RegisteredElementConfig](./foundation-layout.registeredelementconfig.md) \| [RegisteredElementConfig](./foundation-layout.registeredelementconfig.md)<!-- -->\[\] | [RegisteredElementConfig](./foundation-layout.registeredelementconfig.md) configuration items for the new items(s). Pass an array of [RegisteredElementConfig](./foundation-layout.registeredelementconfig.md) to add multiple items at once. |
20
+ | placement | [Placement](./foundation-layout.placement.md) | _(Optional)_ where and how to add the new items to the layout. For more info and defaults see [Placement](./foundation-layout.placement.md)<!-- -->. |
21
21
 
22
22
  **Returns:**
23
23
 
@@ -29,7 +29,7 @@ void
29
29
 
30
30
  ## Remarks
31
31
 
32
- Adding a new item invokes the registration previously made explicitly via [registerItem()](./foundation-layout.foundationlayout.registeritem.md) or implicitly via the html declerative API.
32
+ Adding new items invokes the registration previously made explicitly via [registerItem()](./foundation-layout.foundationlayout.registeritem.md) or implicitly via the html declarative API.
33
33
 
34
34
  The elements added onto the new pane are copies using `element.cloneNode()` of the original element references used during registration.
35
35
 
@@ -37,6 +37,6 @@
37
37
  | --- | --- |
38
38
  | [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> |
39
39
  | [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)<!-- -->. |
40
- | [Placement](./foundation-layout.placement.md) | Where to add the new item into the layout when using the [FoundationLayout.addItem()](./foundation-layout.foundationlayout.additem.md) API |
40
+ | [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. |
41
41
  | [SerialisedLayout](./foundation-layout.serialisedlayout.md) | Versioned layout config objects. <code>v</code> is the version and <code>c</code> contains the layout config. |
42
42
 
@@ -4,12 +4,22 @@
4
4
 
5
5
  ## Placement type
6
6
 
7
- Where to add the new item into the layout when using the [FoundationLayout.addItem()](./foundation-layout.foundationlayout.additem.md) API
7
+ Where to and how to add the new item(s) into the layout when using the [FoundationLayout.addItem()](./foundation-layout.foundationlayout.additem.md) API.
8
8
 
9
9
  **Signature:**
10
10
 
11
11
  ```typescript
12
12
  export type Placement = {
13
13
  area: 'top' | 'left' | 'bottom' | 'right';
14
+ multiple?: {
15
+ type: LayoutRegionType;
16
+ size?: string;
17
+ };
14
18
  };
15
19
  ```
20
+ **References:** [LayoutRegionType](./foundation-layout.layoutregiontype.md)
21
+
22
+ ## Remarks
23
+
24
+ `area` dictates what part of the layout the new item(s) will be added to. `multiple` is optional and is defaulted to `type=horizontal` and `size=50%` if not defined. `multiple` config only affects the placement if multiple items are specified to be added. `multiple.type` sets the group type of the new items, whether they are horizontal, vertical, or in tabs. `multiple.size` - optional string describing the size of the new item (see the written documentation for more info). `multiple.size` specifies the size of the new group to be added and then the `size` config of the new items are the sizes relative to this new multiple group. If you only specify one new item then the `size` of that will be used as the size and will override `multiple.size`<!-- -->.
25
+
@@ -24,7 +24,7 @@ export class FoundationLayout extends FoundationElement implements LayoutCompone
24
24
  [componentType]: "root";
25
25
  // @internal
26
26
  constructor();
27
- addItem(config: RegisteredElementConfig, placement?: Placement): void;
27
+ addItem(config: RegisteredElementConfig | RegisteredElementConfig[], placement?: Placement): void;
28
28
  // @internal
29
29
  addItemFromChild<T extends RootItemConfig>(item: T): T;
30
30
  autoSaveKey?: string;
@@ -157,6 +157,10 @@ export class LayoutUsageError extends Error {
157
157
  // @public
158
158
  export type Placement = {
159
159
  area: 'top' | 'left' | 'bottom' | 'right';
160
+ multiple?: {
161
+ type: LayoutRegionType;
162
+ size?: string;
163
+ };
160
164
  };
161
165
 
162
166
  // @public
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.59.0",
4
+ "version": "14.60.0",
5
5
  "license": "SEE LICENSE IN license.txt",
6
6
  "main": "dist/esm/index.js",
7
7
  "types": "dist/foundation-layout.d.ts",
@@ -24,14 +24,14 @@
24
24
  "test:debug": "genx test --debug"
25
25
  },
26
26
  "devDependencies": {
27
- "@genesislcap/foundation-testing": "14.59.0",
28
- "@genesislcap/genx": "14.59.0",
27
+ "@genesislcap/foundation-testing": "14.60.0",
28
+ "@genesislcap/genx": "14.60.0",
29
29
  "rimraf": "^3.0.2"
30
30
  },
31
31
  "dependencies": {
32
32
  "@genesis-community/golden-layout": "^2.9.3",
33
- "@genesislcap/foundation-comms": "14.59.0",
34
- "@genesislcap/foundation-utils": "14.59.0",
33
+ "@genesislcap/foundation-comms": "14.60.0",
34
+ "@genesislcap/foundation-utils": "14.60.0",
35
35
  "@microsoft/fast-components": "^2.21.3",
36
36
  "@microsoft/fast-element": "^1.7.0",
37
37
  "@microsoft/fast-foundation": "^2.33.2",
@@ -46,5 +46,5 @@
46
46
  "access": "public"
47
47
  },
48
48
  "customElements": "dist/custom-elements.json",
49
- "gitHead": "9e694bb994fa48b71b0c6301a3ad72f54671d117"
49
+ "gitHead": "78e4c99a7097525e11e99ef7f058d5c464fa30ab"
50
50
  }