@genesislcap/foundation-forms 14.115.1 → 14.116.1
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 +22 -0
- package/dist/dts/form.d.ts +0 -2
- package/dist/dts/form.d.ts.map +1 -1
- package/dist/dts/jsonforms/json-forms.d.ts +2 -0
- package/dist/dts/jsonforms/json-forms.d.ts.map +1 -1
- package/dist/dts/utils/index.d.ts +1 -0
- package/dist/dts/utils/index.d.ts.map +1 -1
- package/dist/dts/utils/logger.d.ts +3 -0
- package/dist/dts/utils/logger.d.ts.map +1 -0
- package/dist/esm/form.js +1 -3
- package/dist/esm/jsonforms/json-forms.js +33 -7
- package/dist/esm/utils/index.js +1 -0
- package/dist/esm/utils/logger.js +3 -0
- package/package.json +9 -8
|
@@ -715,6 +715,10 @@
|
|
|
715
715
|
"kind": "field",
|
|
716
716
|
"name": "i18n"
|
|
717
717
|
},
|
|
718
|
+
{
|
|
719
|
+
"kind": "field",
|
|
720
|
+
"name": "uichemaToUse"
|
|
721
|
+
},
|
|
718
722
|
{
|
|
719
723
|
"kind": "field",
|
|
720
724
|
"name": "schema"
|
|
@@ -824,6 +828,10 @@
|
|
|
824
828
|
"text": ""
|
|
825
829
|
}
|
|
826
830
|
}
|
|
831
|
+
},
|
|
832
|
+
{
|
|
833
|
+
"kind": "method",
|
|
834
|
+
"name": "copyUISchemaToClipboard"
|
|
827
835
|
}
|
|
828
836
|
],
|
|
829
837
|
"attributes": [
|
|
@@ -910,6 +918,14 @@
|
|
|
910
918
|
"package": "./filters"
|
|
911
919
|
}
|
|
912
920
|
},
|
|
921
|
+
{
|
|
922
|
+
"kind": "js",
|
|
923
|
+
"name": "*",
|
|
924
|
+
"declaration": {
|
|
925
|
+
"name": "*",
|
|
926
|
+
"package": "./logger"
|
|
927
|
+
}
|
|
928
|
+
},
|
|
913
929
|
{
|
|
914
930
|
"kind": "js",
|
|
915
931
|
"name": "*",
|
|
@@ -928,6 +944,12 @@
|
|
|
928
944
|
}
|
|
929
945
|
]
|
|
930
946
|
},
|
|
947
|
+
{
|
|
948
|
+
"kind": "javascript-module",
|
|
949
|
+
"path": "src/utils/logger.ts",
|
|
950
|
+
"declarations": [],
|
|
951
|
+
"exports": []
|
|
952
|
+
},
|
|
931
953
|
{
|
|
932
954
|
"kind": "javascript-module",
|
|
933
955
|
"path": "src/utils/translation.ts",
|
package/dist/dts/form.d.ts
CHANGED
|
@@ -2,8 +2,6 @@ import { UISchemaElement } from '@jsonforms/core';
|
|
|
2
2
|
import { FoundationElement } from '@microsoft/fast-foundation';
|
|
3
3
|
import { JSONSchema7 } from 'json-schema';
|
|
4
4
|
import { RendererEntry } from './types';
|
|
5
|
-
/** @internal */
|
|
6
|
-
export declare const logger: import("@genesislcap/foundation-logger").Logger;
|
|
7
5
|
/** @public */
|
|
8
6
|
export declare const renderers: any[];
|
|
9
7
|
/**
|
package/dist/dts/form.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form.d.ts","sourceRoot":"","sources":["../../src/form.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"form.d.ts","sourceRoot":"","sources":["../../src/form.ts"],"names":[],"mappings":"AACA,OAAO,EAKL,eAAe,EAChB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAE/D,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAmB1C,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAexC,cAAc;AACd,eAAO,MAAM,SAAS,OAiBrB,CAAC;AACF;;;;;GAKG;AAEH,qBAKa,IAAK,SAAQ,iBAAiB;IACzC;;;;OAIG;IACG,YAAY,EAAE,MAAM,CAAC;YACb,mBAAmB;IAQjC,OAAO,CAAC,oBAAoB;IA0B5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAqCG;IACS,QAAQ,EAAE,eAAe,CAAC;IACtC;;;OAGG;IACS,SAAS,EAAE,aAAa,EAAE,CAAa;IACnD;;;;;;OAMG;IACS,UAAU,EAAE,WAAW,CAAC;IAEpC,OAAO,CAAC,MAAM,CAAqB;IAC1B,OAAO,CAAC,OAAO,CAAW;IACnC;;;OAGG;IACS,IAAI,EAAE,GAAG,CAAM;IAE3B;;OAEG;IACS,UAAU,EAAE,OAAO,CAAC;IAChC;;OAEG;IACS,SAAS,EAAE,OAAO,CAAC;IAEJ,QAAQ,EAAE,OAAO,CAAC;IACe,UAAU,EAAE,OAAO,CAAC;IAEhF;;OAEG;IACG,OAAO;IA2Bb,IAAc,cAAc,YAM3B;IAED;;OAEG;IACH,UAAU,CAAC,KAAK,EAAE,WAAW;IAI7B;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,WAAW;IAQ3B,oBAAoB;IAKpB;;;OAGG;IACH,KAAK,CAAC,SAAS,UAAO;CAMvB"}
|
|
@@ -5,6 +5,7 @@ export declare class JSONForms extends FASTElement {
|
|
|
5
5
|
submitted: boolean;
|
|
6
6
|
jsonforms: any;
|
|
7
7
|
i18n: any;
|
|
8
|
+
uichemaToUse: any;
|
|
8
9
|
schema: any;
|
|
9
10
|
schemaChanged(): void;
|
|
10
11
|
uischema: UISchemaElement;
|
|
@@ -29,5 +30,6 @@ export declare class JSONForms extends FASTElement {
|
|
|
29
30
|
* @returns ErrorObject[] that will be passed to JsonFormsCore as additionalErrors
|
|
30
31
|
*/
|
|
31
32
|
validate: (uischema: any) => ErrorObject[];
|
|
33
|
+
copyUISchemaToClipboard(): Promise<void>;
|
|
32
34
|
}
|
|
33
35
|
//# sourceMappingURL=json-forms.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-forms.d.ts","sourceRoot":"","sources":["../../../src/jsonforms/json-forms.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"json-forms.d.ts","sourceRoot":"","sources":["../../../src/jsonforms/json-forms.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,WAAW,EAMX,8BAA8B,EAE9B,aAAa,EAEb,eAAe,EACf,cAAc,EACf,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAIL,WAAW,EAIZ,MAAM,yBAAyB,CAAC;AACjC,OAAO,GAAG,EAAE,EAAE,WAAW,EAAE,MAAM,KAAK,CAAC;AAmCvC,qBASa,SAAU,SAAQ,WAAW;IACb,SAAS,EAAE,OAAO,CAAC;IAElC,SAAS,MAAC;IACV,IAAI,MAAC;IACL,YAAY,MAAC;IAEb,MAAM,MAAC;IACnB,aAAa;IAgDD,QAAQ,EAAE,eAAe,CAAC;IACtC,eAAe;IAIH,IAAI,MAAC;IACjB,WAAW;IAIC,SAAS,EAAE,8BAA8B,EAAE,CAAC;IACxD,gBAAgB;IAIJ,cAAc,EAAE,cAAc,CAAC;IAC3C,qBAAqB;IAIT,GAAG,EAAE,GAAG,CAAC;IACrB,UAAU;IAIiB,QAAQ,EAAE,OAAO,CAAC;IAC7C,eAAe;IAIH,MAAM,EAAE,GAAG,CAAC;IACxB,aAAa;IAIb,IAAI,KAAK,IAAI,aAAa,CAuBzB;IAED,QAAQ,WAAY,WAAW,UAU7B;IAEF;;;;OAIG;IACH,QAAQ,qBAAe,WAAW,EAAE,CAkBlC;IAEI,uBAAuB;CAQ9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../src/utils/logger.ts"],"names":[],"mappings":"AAEA,gBAAgB;AAChB,eAAO,MAAM,MAAM,iDAAkC,CAAC"}
|
package/dist/esm/form.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { __awaiter, __decorate } from "tslib";
|
|
2
2
|
import { Connect } from '@genesislcap/foundation-comms';
|
|
3
|
-
import { createLogger } from '@genesislcap/foundation-logger';
|
|
4
3
|
import { isControl, isStringControl, mapStateToControlProps, rankWith, } from '@jsonforms/core';
|
|
5
4
|
import { attr, customElement, DOM, observable, volatile } from '@microsoft/fast-element';
|
|
6
5
|
import { FoundationElement } from '@microsoft/fast-foundation';
|
|
@@ -21,8 +20,7 @@ import { LayoutStepperRendererEntry } from './jsonforms/renderers/LayoutStepperR
|
|
|
21
20
|
import { LayoutVertical2ColumnsEntry } from './jsonforms/renderers/LayoutVertical2ColumnsRenderer';
|
|
22
21
|
import { NumberControlRendererEntry } from './jsonforms/renderers/NumberControlRenderer';
|
|
23
22
|
import { StringControlRendererTemplate } from './jsonforms/renderers/StringControlRenderer';
|
|
24
|
-
|
|
25
|
-
export const logger = createLogger('foundation-form');
|
|
23
|
+
import { logger } from './utils';
|
|
26
24
|
const stringEntry = {
|
|
27
25
|
renderer: StringControlRendererTemplate,
|
|
28
26
|
tester: rankWith(2, isStringControl),
|
|
@@ -1,10 +1,17 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
1
|
+
import { __awaiter, __decorate } from "tslib";
|
|
2
|
+
import { isDev } from '@genesislcap/foundation-utils';
|
|
2
3
|
import { Actions, configReducer, coreReducer, Generate, i18nReducer, } from '@jsonforms/core';
|
|
3
|
-
import { attr, customElement, FASTElement, html, observable, when } from '@microsoft/fast-element';
|
|
4
|
+
import { attr, css, customElement, FASTElement, html, observable, when, } from '@microsoft/fast-element';
|
|
5
|
+
import { logger } from '../utils';
|
|
4
6
|
import { genesisErrorTranslator } from '../utils/translation';
|
|
5
7
|
const TIMESTAMP_FIELD = '#/properties/TIMESTAMP';
|
|
6
8
|
const template = html `
|
|
7
9
|
<template>
|
|
10
|
+
${when((x) => isDev() && !x.uischema, html `
|
|
11
|
+
<zero-button class="clipboard-button" @click=${(x) => x.copyUISchemaToClipboard()}>
|
|
12
|
+
Copy autogenerated UI Schema
|
|
13
|
+
</zero-button>
|
|
14
|
+
`)}
|
|
8
15
|
${when((x) => x.jsonforms && x.dispatch && x.props, html `
|
|
9
16
|
<dispatch-renderer
|
|
10
17
|
:jsonforms=${(x) => x.jsonforms}
|
|
@@ -62,18 +69,18 @@ let JSONForms = class JSONForms extends FASTElement {
|
|
|
62
69
|
if (!this.schema) {
|
|
63
70
|
return;
|
|
64
71
|
}
|
|
65
|
-
|
|
72
|
+
this.uichemaToUse = (_a = this.uischema) !== null && _a !== void 0 ? _a : Generate.uiSchema(this.schema);
|
|
66
73
|
if (!this.uischema) {
|
|
67
|
-
console.log('UI schema not provided. Auto generated schema:',
|
|
74
|
+
console.log('UI schema not provided. Auto generated schema:', this.uichemaToUse);
|
|
68
75
|
}
|
|
69
|
-
const additionalErrors = this.validate(
|
|
76
|
+
const additionalErrors = this.validate(this.uichemaToUse);
|
|
70
77
|
const initCore = () => {
|
|
71
78
|
const initialCore = {
|
|
72
79
|
data: this.data,
|
|
73
80
|
schema: this.schema,
|
|
74
|
-
uischema:
|
|
81
|
+
uischema: this.uichemaToUse,
|
|
75
82
|
};
|
|
76
|
-
const core = coreReducer(initialCore, Actions.init(this.data, this.schema,
|
|
83
|
+
const core = coreReducer(initialCore, Actions.init(this.data, this.schema, this.uichemaToUse, {
|
|
77
84
|
validationMode: this.validationMode || 'ValidateAndShow',
|
|
78
85
|
ajv: this.ajv,
|
|
79
86
|
additionalErrors,
|
|
@@ -133,6 +140,17 @@ let JSONForms = class JSONForms extends FASTElement {
|
|
|
133
140
|
visible: true,
|
|
134
141
|
};
|
|
135
142
|
}
|
|
143
|
+
copyUISchemaToClipboard() {
|
|
144
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
145
|
+
try {
|
|
146
|
+
yield navigator.clipboard.writeText(JSON.stringify(this.uichemaToUse));
|
|
147
|
+
logger.debug('Autogenerated UI schema copied to clipboard');
|
|
148
|
+
}
|
|
149
|
+
catch (err) {
|
|
150
|
+
logger.error('Failed to copy autogenerated UI schema: ', err);
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
}
|
|
136
154
|
};
|
|
137
155
|
__decorate([
|
|
138
156
|
attr({ mode: 'boolean' })
|
|
@@ -143,6 +161,9 @@ __decorate([
|
|
|
143
161
|
__decorate([
|
|
144
162
|
observable
|
|
145
163
|
], JSONForms.prototype, "i18n", void 0);
|
|
164
|
+
__decorate([
|
|
165
|
+
observable
|
|
166
|
+
], JSONForms.prototype, "uichemaToUse", void 0);
|
|
146
167
|
__decorate([
|
|
147
168
|
observable
|
|
148
169
|
], JSONForms.prototype, "schema", void 0);
|
|
@@ -171,6 +192,11 @@ JSONForms = __decorate([
|
|
|
171
192
|
customElement({
|
|
172
193
|
name: 'json-forms',
|
|
173
194
|
template: template,
|
|
195
|
+
styles: css `
|
|
196
|
+
.clipboard-button {
|
|
197
|
+
display: flex;
|
|
198
|
+
}
|
|
199
|
+
`,
|
|
174
200
|
})
|
|
175
201
|
], JSONForms);
|
|
176
202
|
export { JSONForms };
|
package/dist/esm/utils/index.js
CHANGED
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.
|
|
4
|
+
"version": "14.116.1",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"license": "SEE LICENSE IN license.txt",
|
|
7
7
|
"main": "dist/esm/index.js",
|
|
@@ -40,16 +40,17 @@
|
|
|
40
40
|
"test:debug": "genx test --debug"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@genesislcap/foundation-testing": "14.
|
|
44
|
-
"@genesislcap/genx": "14.
|
|
43
|
+
"@genesislcap/foundation-testing": "14.116.1",
|
|
44
|
+
"@genesislcap/genx": "14.116.1",
|
|
45
45
|
"@types/json-schema": "^7.0.11",
|
|
46
46
|
"rimraf": "^3.0.2"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@genesislcap/foundation-comms": "14.
|
|
50
|
-
"@genesislcap/foundation-criteria": "14.
|
|
51
|
-
"@genesislcap/foundation-logger": "14.
|
|
52
|
-
"@genesislcap/foundation-ui": "14.
|
|
49
|
+
"@genesislcap/foundation-comms": "14.116.1",
|
|
50
|
+
"@genesislcap/foundation-criteria": "14.116.1",
|
|
51
|
+
"@genesislcap/foundation-logger": "14.116.1",
|
|
52
|
+
"@genesislcap/foundation-ui": "14.116.1",
|
|
53
|
+
"@genesislcap/foundation-utils": "14.116.1",
|
|
53
54
|
"@jsonforms/core": "^3.0.0",
|
|
54
55
|
"@microsoft/fast-components": "^2.21.3",
|
|
55
56
|
"@microsoft/fast-element": "^1.7.0",
|
|
@@ -69,5 +70,5 @@
|
|
|
69
70
|
"access": "public"
|
|
70
71
|
},
|
|
71
72
|
"customElements": "dist/custom-elements.json",
|
|
72
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "109f83c69f5d71ef796621a92eb43971bed3e25f"
|
|
73
74
|
}
|