@genesislcap/foundation-forms 14.468.0 → 14.468.1-alpha-2cf7ab6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2236,6 +2236,29 @@
2236
2236
  "kind": "javascript-module",
2237
2237
  "path": "src/jsonforms/renderers/CategorizationWrapperRenderer.ts",
2238
2238
  "declarations": [
2239
+ {
2240
+ "kind": "function",
2241
+ "name": "computeCategoryClassName",
2242
+ "return": {
2243
+ "type": {
2244
+ "text": "string"
2245
+ }
2246
+ },
2247
+ "parameters": [
2248
+ {
2249
+ "name": "category",
2250
+ "type": {
2251
+ "text": "UiSchemaElement"
2252
+ }
2253
+ },
2254
+ {
2255
+ "name": "data",
2256
+ "type": {
2257
+ "text": "any"
2258
+ }
2259
+ }
2260
+ ]
2261
+ },
2239
2262
  {
2240
2263
  "kind": "variable",
2241
2264
  "name": "tabControlIconStyles",
@@ -2272,6 +2295,18 @@
2272
2295
  },
2273
2296
  "default": "new Set([0])"
2274
2297
  },
2298
+ {
2299
+ "kind": "field",
2300
+ "name": "activeTabIndex",
2301
+ "type": {
2302
+ "text": "number"
2303
+ },
2304
+ "default": "0"
2305
+ },
2306
+ {
2307
+ "kind": "method",
2308
+ "name": "controlChanged"
2309
+ },
2275
2310
  {
2276
2311
  "kind": "method",
2277
2312
  "name": "isMounted",
@@ -2328,6 +2363,14 @@
2328
2363
  }
2329
2364
  ],
2330
2365
  "exports": [
2366
+ {
2367
+ "kind": "js",
2368
+ "name": "computeCategoryClassName",
2369
+ "declaration": {
2370
+ "name": "computeCategoryClassName",
2371
+ "module": "src/jsonforms/renderers/CategorizationWrapperRenderer.ts"
2372
+ }
2373
+ },
2331
2374
  {
2332
2375
  "kind": "js",
2333
2376
  "name": "tabControlIconStyles",
@@ -4197,6 +4240,26 @@
4197
4240
  "module": "src/jsonforms/renderers/CategorizationWrapperRenderer.ts"
4198
4241
  }
4199
4242
  },
4243
+ {
4244
+ "kind": "field",
4245
+ "name": "activeTabIndex",
4246
+ "type": {
4247
+ "text": "number"
4248
+ },
4249
+ "default": "0",
4250
+ "inheritedFrom": {
4251
+ "name": "CategorizationWrapper",
4252
+ "module": "src/jsonforms/renderers/CategorizationWrapperRenderer.ts"
4253
+ }
4254
+ },
4255
+ {
4256
+ "kind": "method",
4257
+ "name": "controlChanged",
4258
+ "inheritedFrom": {
4259
+ "name": "CategorizationWrapper",
4260
+ "module": "src/jsonforms/renderers/CategorizationWrapperRenderer.ts"
4261
+ }
4262
+ },
4200
4263
  {
4201
4264
  "kind": "method",
4202
4265
  "name": "isMounted",
@@ -12,6 +12,7 @@ import { UiSchemaElement } from '../../types';
12
12
  *
13
13
  * @internal
14
14
  */
15
+ export declare function resolveActiveCategoryIndex(activeCategory: number | string | undefined, elements: UiSchemaElement[]): number;
15
16
  export declare function computeCategoryClassName(category: UiSchemaElement, data: any): string;
16
17
  export declare const tabControlIconStyles: import("@microsoft/fast-element").ElementStyles;
17
18
  export declare const CategorizationWrapperRendererTemplate: (prefix?: string) => import("@microsoft/fast-element").ViewTemplate<CategorizationWrapper, any>;
@@ -19,6 +20,8 @@ export declare class CategorizationWrapper extends FASTElement {
19
20
  form: any;
20
21
  control: any;
21
22
  mountedTabs: Set<number>;
23
+ activeTabIndex: number;
24
+ controlChanged(): void;
22
25
  isMounted(index: number): boolean;
23
26
  handleTabChange(event: Event): void;
24
27
  hasCategoryError(categoryIndex: number): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"CategorizationWrapperRenderer.d.ts","sourceRoot":"","sources":["../../../../src/jsonforms/renderers/CategorizationWrapperRenderer.ts"],"names":[],"mappings":"AACA,OAAO,EAKL,WAAW,EAIZ,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EAA2C,eAAe,EAAE,MAAM,aAAa,CAAC;AAEvF;;;;;;;;;;;GAWG;AACH,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,eAAe,EAAE,IAAI,EAAE,GAAG,GAAG,MAAM,CAMrF;AAED,eAAO,MAAM,oBAAoB,iDAKhC,CAAC;AAEF,eAAO,MAAM,qCAAqC,GAChD,eAAe,+EA4DhB,CAAC;AAkBF,qBAQa,qBAAsB,SAAQ,WAAW;IACxC,IAAI,MAAC;IACL,OAAO,MAAC;IACR,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,CAAgB;IAEpD,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;IAIjC,eAAe,CAAC,KAAK,EAAE,KAAK;IAO5B,gBAAgB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO;CAQjD"}
1
+ {"version":3,"file":"CategorizationWrapperRenderer.d.ts","sourceRoot":"","sources":["../../../../src/jsonforms/renderers/CategorizationWrapperRenderer.ts"],"names":[],"mappings":"AACA,OAAO,EAKL,WAAW,EAIZ,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EAA2C,eAAe,EAAE,MAAM,aAAa,CAAC;AAEvF;;;;;;;;;;;GAWG;AACH,wBAAgB,0BAA0B,CACxC,cAAc,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,EAC3C,QAAQ,EAAE,eAAe,EAAE,GAC1B,MAAM,CASR;AAED,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,eAAe,EAAE,IAAI,EAAE,GAAG,GAAG,MAAM,CAMrF;AAED,eAAO,MAAM,oBAAoB,iDAKhC,CAAC;AAEF,eAAO,MAAM,qCAAqC,GAChD,eAAe,+EA6DhB,CAAC;AAkBF,qBAQa,qBAAsB,SAAQ,WAAW;IACxC,IAAI,MAAC;IACL,OAAO,MAAC;IACR,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,CAAgB;IACxC,cAAc,EAAE,MAAM,CAAK;IAEvC,cAAc;IASd,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;IAIjC,eAAe,CAAC,KAAK,EAAE,KAAK;IAQ5B,gBAAgB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO;CAQjD"}
@@ -13,6 +13,16 @@ import { classNames } from '@microsoft/fast-web-utilities';
13
13
  *
14
14
  * @internal
15
15
  */
16
+ export function resolveActiveCategoryIndex(activeCategory, elements) {
17
+ if (typeof activeCategory === 'number') {
18
+ return activeCategory >= 0 && activeCategory < elements.length ? activeCategory : 0;
19
+ }
20
+ if (typeof activeCategory === 'string') {
21
+ const found = elements.findIndex((el) => el.label === activeCategory);
22
+ return found !== -1 ? found : 0;
23
+ }
24
+ return 0;
25
+ }
16
26
  export function computeCategoryClassName(category, data) {
17
27
  var _a, _b;
18
28
  const className = (_a = category === null || category === void 0 ? void 0 : category.options) === null || _a === void 0 ? void 0 : _a.className;
@@ -29,9 +39,10 @@ export const tabControlIconStyles = css `
29
39
  `;
30
40
  export const CategorizationWrapperRendererTemplate = (prefix = 'zero') => html `
31
41
  <template>
32
- <${prefix}-tabs appearance="secondary" class="tabs-container" @change=${(x, ctx) => x.handleTabChange(ctx.event)}>
42
+ <${prefix}-tabs appearance="secondary" class="tabs-container" :activeid="${(x) => 'tab-' + x.activeTabIndex}" @change=${(x, ctx) => x.handleTabChange(ctx.event)}>
33
43
  ${repeat((x) => x.control.uischema.elements, html `
34
44
  <${prefix}-tab
45
+ id="${(x, ctx) => 'tab-' + ctx.index}"
35
46
  appearance="secondary"
36
47
  class="${(x, ctx) => {
37
48
  var _a, _b, _c;
@@ -89,6 +100,18 @@ let CategorizationWrapper = class CategorizationWrapper extends FASTElement {
89
100
  constructor() {
90
101
  super(...arguments);
91
102
  this.mountedTabs = new Set([0]);
103
+ this.activeTabIndex = 0;
104
+ }
105
+ controlChanged() {
106
+ var _a, _b, _c, _d;
107
+ if (!this.control)
108
+ return;
109
+ const activeCategory = (_b = (_a = this.control.uischema) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.activeCategory;
110
+ if (activeCategory === undefined)
111
+ return;
112
+ const index = resolveActiveCategoryIndex(activeCategory, (_d = (_c = this.control.uischema) === null || _c === void 0 ? void 0 : _c.elements) !== null && _d !== void 0 ? _d : []);
113
+ this.activeTabIndex = index;
114
+ this.mountedTabs = new Set([index]);
92
115
  }
93
116
  isMounted(index) {
94
117
  return this.mountedTabs.has(index);
@@ -97,6 +120,7 @@ let CategorizationWrapper = class CategorizationWrapper extends FASTElement {
97
120
  if (event.target !== event.currentTarget)
98
121
  return;
99
122
  const index = event.target.currentTabIndex;
123
+ this.activeTabIndex = index;
100
124
  if (this.mountedTabs.has(index))
101
125
  return;
102
126
  this.mountedTabs = new Set(this.mountedTabs).add(index);
@@ -120,6 +144,9 @@ __decorate([
120
144
  __decorate([
121
145
  observable
122
146
  ], CategorizationWrapper.prototype, "mountedTabs", void 0);
147
+ __decorate([
148
+ observable
149
+ ], CategorizationWrapper.prototype, "activeTabIndex", void 0);
123
150
  CategorizationWrapper = __decorate([
124
151
  customElement({
125
152
  name: 'categorization-wrapper',
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@genesislcap/foundation-forms",
3
3
  "description": "Genesis Foundation Forms",
4
- "version": "14.468.0",
4
+ "version": "14.468.1-alpha-2cf7ab6.0",
5
5
  "sideEffects": false,
6
6
  "license": "SEE LICENSE IN license.txt",
7
7
  "main": "dist/esm/index.js",
@@ -59,13 +59,13 @@
59
59
  }
60
60
  },
61
61
  "devDependencies": {
62
- "@genesislcap/foundation-testing": "14.468.0",
63
- "@genesislcap/genx": "14.468.0",
64
- "@genesislcap/rollup-builder": "14.468.0",
65
- "@genesislcap/ts-builder": "14.468.0",
66
- "@genesislcap/uvu-playwright-builder": "14.468.0",
67
- "@genesislcap/vite-builder": "14.468.0",
68
- "@genesislcap/webpack-builder": "14.468.0",
62
+ "@genesislcap/foundation-testing": "14.468.1-alpha-2cf7ab6.0",
63
+ "@genesislcap/genx": "14.468.1-alpha-2cf7ab6.0",
64
+ "@genesislcap/rollup-builder": "14.468.1-alpha-2cf7ab6.0",
65
+ "@genesislcap/ts-builder": "14.468.1-alpha-2cf7ab6.0",
66
+ "@genesislcap/uvu-playwright-builder": "14.468.1-alpha-2cf7ab6.0",
67
+ "@genesislcap/vite-builder": "14.468.1-alpha-2cf7ab6.0",
68
+ "@genesislcap/webpack-builder": "14.468.1-alpha-2cf7ab6.0",
69
69
  "@types/json-schema": "^7.0.11",
70
70
  "@types/papaparse": "^5.3.14"
71
71
  },
@@ -82,12 +82,12 @@
82
82
  }
83
83
  },
84
84
  "dependencies": {
85
- "@genesislcap/foundation-comms": "14.468.0",
86
- "@genesislcap/foundation-criteria": "14.468.0",
87
- "@genesislcap/foundation-logger": "14.468.0",
88
- "@genesislcap/foundation-notifications": "14.468.0",
89
- "@genesislcap/foundation-ui": "14.468.0",
90
- "@genesislcap/foundation-utils": "14.468.0",
85
+ "@genesislcap/foundation-comms": "14.468.1-alpha-2cf7ab6.0",
86
+ "@genesislcap/foundation-criteria": "14.468.1-alpha-2cf7ab6.0",
87
+ "@genesislcap/foundation-logger": "14.468.1-alpha-2cf7ab6.0",
88
+ "@genesislcap/foundation-notifications": "14.468.1-alpha-2cf7ab6.0",
89
+ "@genesislcap/foundation-ui": "14.468.1-alpha-2cf7ab6.0",
90
+ "@genesislcap/foundation-utils": "14.468.1-alpha-2cf7ab6.0",
91
91
  "@json-schema-tools/dereferencer": "^1.6.1",
92
92
  "@jsonforms/core": "^3.2.1",
93
93
  "@microsoft/fast-components": "2.30.6",
@@ -109,5 +109,5 @@
109
109
  "access": "public"
110
110
  },
111
111
  "customElements": "dist/custom-elements.json",
112
- "gitHead": "0dfb3e9bf917a6de7e74e52d86995cfcd85f3110"
112
+ "gitHead": "8b21a25657a354f0df2f7165828ce24bda4b729e"
113
113
  }