@genesislcap/foundation-forms 15.23.0 → 15.23.1-alpha-fe16d278a.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/custom-elements.json +37 -0
- package/dist/dts/jsonforms/renderers/ConnectedSelectControlRenderer.d.ts +1 -0
- package/dist/dts/jsonforms/renderers/ConnectedSelectControlRenderer.d.ts.map +1 -1
- package/dist/esm/jsonforms/renderers/ConnectedSelectControlRenderer.js +20 -3
- package/package.json +14 -14
|
@@ -3024,6 +3024,35 @@
|
|
|
3024
3024
|
"kind": "javascript-module",
|
|
3025
3025
|
"path": "src/jsonforms/renderers/ConnectedSelectControlRenderer.ts",
|
|
3026
3026
|
"declarations": [
|
|
3027
|
+
{
|
|
3028
|
+
"kind": "function",
|
|
3029
|
+
"name": "shouldReuseDisplayedValue",
|
|
3030
|
+
"return": {
|
|
3031
|
+
"type": {
|
|
3032
|
+
"text": "boolean"
|
|
3033
|
+
}
|
|
3034
|
+
},
|
|
3035
|
+
"parameters": [
|
|
3036
|
+
{
|
|
3037
|
+
"name": "currentValue",
|
|
3038
|
+
"type": {
|
|
3039
|
+
"text": "unknown"
|
|
3040
|
+
}
|
|
3041
|
+
},
|
|
3042
|
+
{
|
|
3043
|
+
"name": "previousRawValue",
|
|
3044
|
+
"type": {
|
|
3045
|
+
"text": "unknown"
|
|
3046
|
+
}
|
|
3047
|
+
},
|
|
3048
|
+
{
|
|
3049
|
+
"name": "displayedValue",
|
|
3050
|
+
"type": {
|
|
3051
|
+
"text": "string | undefined"
|
|
3052
|
+
}
|
|
3053
|
+
}
|
|
3054
|
+
]
|
|
3055
|
+
},
|
|
3027
3056
|
{
|
|
3028
3057
|
"kind": "function",
|
|
3029
3058
|
"name": "ConnectedSelectControlRendererTemplate",
|
|
@@ -3047,6 +3076,14 @@
|
|
|
3047
3076
|
}
|
|
3048
3077
|
],
|
|
3049
3078
|
"exports": [
|
|
3079
|
+
{
|
|
3080
|
+
"kind": "js",
|
|
3081
|
+
"name": "shouldReuseDisplayedValue",
|
|
3082
|
+
"declaration": {
|
|
3083
|
+
"name": "shouldReuseDisplayedValue",
|
|
3084
|
+
"module": "src/jsonforms/renderers/ConnectedSelectControlRenderer.ts"
|
|
3085
|
+
}
|
|
3086
|
+
},
|
|
3050
3087
|
{
|
|
3051
3088
|
"kind": "js",
|
|
3052
3089
|
"name": "ConnectedSelectControlRendererTemplate",
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DispatchRenderer } from './dispatch-renderer';
|
|
2
|
+
export declare const shouldReuseDisplayedValue: (currentValue: unknown, previousRawValue: unknown, displayedValue: string | undefined) => boolean;
|
|
2
3
|
export declare const ConnectedSelectControlRendererTemplate: (prefix?: string) => import("@microsoft/fast-element").ViewTemplate<DispatchRenderer, any>;
|
|
3
4
|
export declare const ConnectedSelectControlRendererEntry: any;
|
|
4
5
|
//# sourceMappingURL=ConnectedSelectControlRenderer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConnectedSelectControlRenderer.d.ts","sourceRoot":"","sources":["../../../../src/jsonforms/renderers/ConnectedSelectControlRenderer.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"ConnectedSelectControlRenderer.d.ts","sourceRoot":"","sources":["../../../../src/jsonforms/renderers/ConnectedSelectControlRenderer.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAKvD,eAAO,MAAM,yBAAyB,GACpC,cAAc,OAAO,EACrB,kBAAkB,OAAO,EACzB,gBAAgB,MAAM,GAAG,SAAS,KACjC,OAAgE,CAAC;AAqCpE,eAAO,MAAM,sCAAsC,GACjD,SAAQ,MAAe,0EA6CxB,CAAC;AAEF,eAAO,MAAM,mCAAmC,EAAE,GAMjD,CAAC"}
|
|
@@ -6,6 +6,8 @@ import { optionIs } from '../testers/optionIs';
|
|
|
6
6
|
import { controlWrapperTemplate } from './ControlWrapperRenderer';
|
|
7
7
|
import { SELECT_CONTROL_RANK } from './RenderersRanks';
|
|
8
8
|
OptionsDatasource;
|
|
9
|
+
export const shouldReuseDisplayedValue = (currentValue, previousRawValue, displayedValue) => previousRawValue === currentValue && !!displayedValue;
|
|
10
|
+
const lastRawValueByRenderer = new WeakMap();
|
|
9
11
|
/**
|
|
10
12
|
* Gets the display value for the connected select control
|
|
11
13
|
* @param dispatchRenderer - The dispatch renderer instance
|
|
@@ -16,9 +18,24 @@ const getConnectedSelectDisplayValue = (dispatchRenderer) => {
|
|
|
16
18
|
const currentValue = dispatchRenderer.control.data;
|
|
17
19
|
if (!currentValue)
|
|
18
20
|
return '';
|
|
19
|
-
const options = (
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
const options = (_a = dispatchRenderer.control.uischema.options) === null || _a === void 0 ? void 0 : _a.data;
|
|
22
|
+
if (options) {
|
|
23
|
+
const option = options.find((opt) => opt.value === currentValue);
|
|
24
|
+
return String((option === null || option === void 0 ? void 0 : option.label) || currentValue);
|
|
25
|
+
}
|
|
26
|
+
// allOptionsResourceName-backed controls have no static list to resolve a label from -
|
|
27
|
+
// the sibling <options-datasource> resolves it asynchronously instead. This binding
|
|
28
|
+
// re-evaluates on every unrelated form change, so reuse what's already displayed rather
|
|
29
|
+
// than resetting it back to the raw stored value each time.
|
|
30
|
+
const previousRawValue = lastRawValueByRenderer.get(dispatchRenderer);
|
|
31
|
+
const path = dispatchRenderer.control.path;
|
|
32
|
+
const escapedPath = typeof CSS !== 'undefined' ? CSS.escape(path) : path;
|
|
33
|
+
const combobox = dispatchRenderer.querySelector(`#${escapedPath}`);
|
|
34
|
+
if (shouldReuseDisplayedValue(currentValue, previousRawValue, combobox === null || combobox === void 0 ? void 0 : combobox.value)) {
|
|
35
|
+
return combobox.value;
|
|
36
|
+
}
|
|
37
|
+
lastRawValueByRenderer.set(dispatchRenderer, currentValue);
|
|
38
|
+
return String(currentValue);
|
|
22
39
|
};
|
|
23
40
|
export const ConnectedSelectControlRendererTemplate = (prefix = 'zero') => html `
|
|
24
41
|
<template>
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@genesislcap/foundation-forms",
|
|
3
3
|
"description": "Genesis Foundation Forms",
|
|
4
|
-
"version": "15.23.0",
|
|
4
|
+
"version": "15.23.1-alpha-fe16d278a.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": "15.23.0",
|
|
63
|
-
"@genesislcap/genx": "15.23.0",
|
|
64
|
-
"@genesislcap/rollup-builder": "15.23.0",
|
|
65
|
-
"@genesislcap/ts-builder": "15.23.0",
|
|
66
|
-
"@genesislcap/uvu-playwright-builder": "15.23.0",
|
|
67
|
-
"@genesislcap/vite-builder": "15.23.0",
|
|
68
|
-
"@genesislcap/webpack-builder": "15.23.0",
|
|
62
|
+
"@genesislcap/foundation-testing": "15.23.1-alpha-fe16d278a.0",
|
|
63
|
+
"@genesislcap/genx": "15.23.1-alpha-fe16d278a.0",
|
|
64
|
+
"@genesislcap/rollup-builder": "15.23.1-alpha-fe16d278a.0",
|
|
65
|
+
"@genesislcap/ts-builder": "15.23.1-alpha-fe16d278a.0",
|
|
66
|
+
"@genesislcap/uvu-playwright-builder": "15.23.1-alpha-fe16d278a.0",
|
|
67
|
+
"@genesislcap/vite-builder": "15.23.1-alpha-fe16d278a.0",
|
|
68
|
+
"@genesislcap/webpack-builder": "15.23.1-alpha-fe16d278a.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": "15.23.0",
|
|
86
|
-
"@genesislcap/foundation-criteria": "15.23.0",
|
|
87
|
-
"@genesislcap/foundation-logger": "15.23.0",
|
|
88
|
-
"@genesislcap/foundation-notifications": "15.23.0",
|
|
89
|
-
"@genesislcap/foundation-ui": "15.23.0",
|
|
90
|
-
"@genesislcap/foundation-utils": "15.23.0",
|
|
85
|
+
"@genesislcap/foundation-comms": "15.23.1-alpha-fe16d278a.0",
|
|
86
|
+
"@genesislcap/foundation-criteria": "15.23.1-alpha-fe16d278a.0",
|
|
87
|
+
"@genesislcap/foundation-logger": "15.23.1-alpha-fe16d278a.0",
|
|
88
|
+
"@genesislcap/foundation-notifications": "15.23.1-alpha-fe16d278a.0",
|
|
89
|
+
"@genesislcap/foundation-ui": "15.23.1-alpha-fe16d278a.0",
|
|
90
|
+
"@genesislcap/foundation-utils": "15.23.1-alpha-fe16d278a.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",
|