@react-typed-forms/schemas 3.0.0-dev.73
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/.rush/temp/package-deps_build.json +13 -0
- package/.rush/temp/shrinkwrap-deps.json +25 -0
- package/lib/controlRender.d.ts +94 -0
- package/lib/controlRender.js +219 -0
- package/lib/hooks.d.ts +9 -0
- package/lib/hooks.js +85 -0
- package/lib/index.d.ts +4 -0
- package/lib/index.js +20 -0
- package/lib/schemaBuilder.d.ts +107 -0
- package/lib/schemaBuilder.js +81 -0
- package/lib/types.d.ts +199 -0
- package/lib/types.js +77 -0
- package/package.json +42 -0
- package/schemas.build.log +2 -0
- package/src/controlRender.tsx +471 -0
- package/src/hooks.ts +155 -0
- package/src/index.ts +4 -0
- package/src/schemaBuilder.ts +166 -0
- package/src/types.ts +256 -0
- package/tsconfig.json +20 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"files": {
|
|
3
|
+
"packages/schemas/.rush/temp/shrinkwrap-deps.json": "6ad43bbf71e5f191d9f571da269a25bb4d9e8909",
|
|
4
|
+
"packages/schemas/package.json": "44b7bc4a5f4b4edcde168265b086fe71f0921d97",
|
|
5
|
+
"packages/schemas/src/controlRender.tsx": "277603b8bb9ced9263547455c6a38c9ce56930a6",
|
|
6
|
+
"packages/schemas/src/hooks.ts": "64cf3ef2b5151231c9ffbc26da34002a3cab867d",
|
|
7
|
+
"packages/schemas/src/index.ts": "b15fbb6de132cd912cf8141d5c4d2329e947546e",
|
|
8
|
+
"packages/schemas/src/schemaBuilder.ts": "3a36cbc35f70fca2b561f6d4ddc1bd1030eeb3f6",
|
|
9
|
+
"packages/schemas/src/types.ts": "88168cc68de0d9784e0e60430bee4d084ee3fa68",
|
|
10
|
+
"packages/schemas/tsconfig.json": "52e4f044fa580f4e0ad5830f3cfca574e2788372"
|
|
11
|
+
},
|
|
12
|
+
"arguments": "rimraf ./lib/ && tsc "
|
|
13
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"../../packages/schemas": "../../packages/schemas:vY3D5bPwBzOGJtSnpoQLPVXnewF01wtTbcozE4xaygA=:",
|
|
3
|
+
"/@types/prop-types/15.7.5": "sha512-JCB8C6SnDoQf0cNycqd/35A7MjcnK+ZTqE7judS6o7utxUCg6imJg3QK2qzHKszlTjcj2cn+NwMB2i96ubpj7w==",
|
|
4
|
+
"/@types/react/18.0.22": "sha512-4yWc5PyCkZN8ke8K9rQHkTXxHIWHxLzzW6RI1kXVoepkD3vULpKzC2sDtAMKn78h92BRYuzf+7b/ms7ajE6hFw==",
|
|
5
|
+
"/@types/scheduler/0.16.2": "sha512-hppQEBDmlwhFAXKJX2KnWLYu5yMfi91yazPb2l+lbJiwW+wdo1gNeRA+3RgNSO39WYX2euey41KEwnqesU2Jew==",
|
|
6
|
+
"/balanced-match/1.0.2": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
|
|
7
|
+
"/brace-expansion/1.1.11": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
|
|
8
|
+
"/concat-map/0.0.1": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
|
|
9
|
+
"/csstype/3.0.11": "sha512-sa6P2wJ+CAbgyy4KFssIb/JNMLxFvKF1pCYCSXS8ZMuqZnMsrxqI2E5sPyoTpxoPU/gVZMzr2zjOfg8GIZOMsw==",
|
|
10
|
+
"/fs.realpath/1.0.0": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=",
|
|
11
|
+
"/glob/7.2.0": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==",
|
|
12
|
+
"/inflight/1.0.6": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
|
|
13
|
+
"/inherits/2.0.4": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
|
|
14
|
+
"/js-tokens/4.0.0": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==",
|
|
15
|
+
"/loose-envify/1.4.0": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==",
|
|
16
|
+
"/minimatch/3.1.2": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
|
|
17
|
+
"/nswag/13.18.2": "sha512-7OpG9WkrZUO2+9I7hgQsaAHujsP/tCaIs7ML2B4wUuFLjSsG6lHucyrREyVO/h9l3MM/Cw4RlEGFBbluWhgeYg==",
|
|
18
|
+
"/once/1.4.0": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==",
|
|
19
|
+
"/path-is-absolute/1.0.1": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=",
|
|
20
|
+
"/react-dom/18.2.0_react@18.2.0": "sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g==",
|
|
21
|
+
"/react/18.2.0": "sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==",
|
|
22
|
+
"/rimraf/3.0.2": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
|
|
23
|
+
"/scheduler/0.23.0": "sha512-CtuThmgHNg7zIZWAXi3AsyIzA3n4xx7aNyjwC2VJldO2LMVDhFK+63xGqq6CsJH4rTAt6/M+N4GhZiDYPx9eUw==",
|
|
24
|
+
"/wrappy/1.0.2": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="
|
|
25
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { ActionControlDefinition, AnyControlDefinition, CompoundField, ControlDefinition, DataControlDefinition, DisplayControlDefinition, FieldOption, GroupedControlsDefinition, ScalarField, SchemaField } from "./types";
|
|
2
|
+
import React, { Key, ReactElement } from "react";
|
|
3
|
+
import { AnyControl, Control } from "@react-typed-forms/core";
|
|
4
|
+
export interface FormEditHooks {
|
|
5
|
+
useDataProperties(formState: FormEditState, definition: DataControlDefinition, field: ScalarField): DataControlProperties;
|
|
6
|
+
useGroupProperties(formState: FormEditState, definition: GroupedControlsDefinition, currentHooks: FormEditHooks): GroupControlProperties;
|
|
7
|
+
useDisplayProperties(formState: FormEditState, definition: DisplayControlDefinition): DisplayControlProperties;
|
|
8
|
+
useActionProperties(formState: FormEditState, definition: ActionControlDefinition): ActionControlProperties;
|
|
9
|
+
}
|
|
10
|
+
export interface DataControlProperties {
|
|
11
|
+
visible: boolean;
|
|
12
|
+
options: FieldOption[] | undefined;
|
|
13
|
+
defaultValue: any;
|
|
14
|
+
required: boolean;
|
|
15
|
+
customRender?: (props: DataRendererProps) => ReactElement;
|
|
16
|
+
}
|
|
17
|
+
export interface GroupControlProperties {
|
|
18
|
+
visible: boolean;
|
|
19
|
+
hooks: FormEditHooks;
|
|
20
|
+
}
|
|
21
|
+
export interface DisplayControlProperties {
|
|
22
|
+
visible: boolean;
|
|
23
|
+
}
|
|
24
|
+
export interface ActionControlProperties {
|
|
25
|
+
visible: boolean;
|
|
26
|
+
onClick: () => void;
|
|
27
|
+
}
|
|
28
|
+
export interface ControlData {
|
|
29
|
+
[field: string]: any;
|
|
30
|
+
}
|
|
31
|
+
export interface FormEditState {
|
|
32
|
+
fields: SchemaField[];
|
|
33
|
+
data: Control<ControlData>;
|
|
34
|
+
}
|
|
35
|
+
export interface FormRendererComponents {
|
|
36
|
+
renderData: (props: DataRendererProps) => ReactElement;
|
|
37
|
+
renderGroup: (props: GroupRendererProps) => ReactElement;
|
|
38
|
+
renderCompound: (props: CompoundGroupRendererProps) => ReactElement;
|
|
39
|
+
renderDisplay: (props: DisplayRendererProps) => ReactElement;
|
|
40
|
+
renderAction: (props: ActionRendererProps) => ReactElement;
|
|
41
|
+
}
|
|
42
|
+
export declare const FormRendererComponentsContext: React.Context<FormRendererComponents | undefined>;
|
|
43
|
+
export declare function useFormRendererComponents(): FormRendererComponents;
|
|
44
|
+
export interface DisplayRendererProps {
|
|
45
|
+
definition: DisplayControlDefinition;
|
|
46
|
+
properties: DisplayControlProperties;
|
|
47
|
+
}
|
|
48
|
+
export interface ActionRendererProps {
|
|
49
|
+
definition: ActionControlDefinition;
|
|
50
|
+
properties: ActionControlProperties;
|
|
51
|
+
}
|
|
52
|
+
export interface DataRendererProps {
|
|
53
|
+
definition: DataControlDefinition;
|
|
54
|
+
properties: DataControlProperties;
|
|
55
|
+
field: ScalarField;
|
|
56
|
+
control: AnyControl;
|
|
57
|
+
formEditState?: FormEditState;
|
|
58
|
+
}
|
|
59
|
+
export interface GroupRendererProps {
|
|
60
|
+
definition: Omit<GroupedControlsDefinition, "children">;
|
|
61
|
+
properties: GroupControlProperties;
|
|
62
|
+
childCount: number;
|
|
63
|
+
renderChild: (child: number, wrapChild: (key: Key, childElem: ReactElement) => ReactElement) => ReactElement;
|
|
64
|
+
}
|
|
65
|
+
export interface CompoundGroupRendererProps {
|
|
66
|
+
definition: GroupedControlsDefinition;
|
|
67
|
+
field: CompoundField;
|
|
68
|
+
control: AnyControl;
|
|
69
|
+
properties: GroupControlProperties;
|
|
70
|
+
renderChild: (key: Key, control: ControlDefinition, data: Control<{
|
|
71
|
+
[field: string]: any;
|
|
72
|
+
}>, wrapChild: (key: Key, childElem: ReactElement) => ReactElement) => ReactElement;
|
|
73
|
+
}
|
|
74
|
+
export declare function isScalarField(sf: SchemaField): sf is ScalarField;
|
|
75
|
+
export declare function isCompoundField(sf: SchemaField): sf is CompoundField;
|
|
76
|
+
export type AnySchemaFields = SchemaField | ScalarField | (Omit<CompoundField, "children"> & {
|
|
77
|
+
children: AnySchemaFields[];
|
|
78
|
+
});
|
|
79
|
+
export declare function applyDefaultValues(v: {
|
|
80
|
+
[k: string]: any;
|
|
81
|
+
} | undefined, fields: SchemaField[]): any;
|
|
82
|
+
export declare function applyDefaultForField(v: any, field: SchemaField, parent: SchemaField[], notElement?: boolean): any;
|
|
83
|
+
export declare function defaultValueForFields(fields: SchemaField[]): any;
|
|
84
|
+
export declare function defaultValueForField(sf: SchemaField, notElement?: boolean): any;
|
|
85
|
+
export declare function findScalarField(fields: SchemaField[], field: string): ScalarField | undefined;
|
|
86
|
+
export declare function findCompoundField(fields: SchemaField[], field: string): CompoundField | undefined;
|
|
87
|
+
export declare function findField(fields: SchemaField[], field: string): SchemaField | undefined;
|
|
88
|
+
export declare function fieldDisplayName(sf: SchemaField): string;
|
|
89
|
+
export declare function controlTitle(title: string | undefined, field: SchemaField): string;
|
|
90
|
+
export declare function renderControl(definition: AnyControlDefinition, formState: FormEditState, hooks: FormEditHooks, key: Key, wrapChild?: (key: Key, db: ReactElement) => ReactElement): ReactElement;
|
|
91
|
+
export declare function controlForField(field: string, formState: FormEditState): Control<any>;
|
|
92
|
+
export declare function fieldForControl(c: ControlDefinition): string | undefined;
|
|
93
|
+
export declare function isSchemaControl(c: ControlDefinition): c is DataControlDefinition;
|
|
94
|
+
export declare function isGroupControl(c: ControlDefinition): c is GroupedControlsDefinition;
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.isGroupControl = exports.isSchemaControl = exports.fieldForControl = exports.controlForField = exports.renderControl = exports.controlTitle = exports.fieldDisplayName = exports.findField = exports.findCompoundField = exports.findScalarField = exports.defaultValueForField = exports.defaultValueForFields = exports.applyDefaultForField = exports.applyDefaultValues = exports.isCompoundField = exports.isScalarField = exports.useFormRendererComponents = exports.FormRendererComponentsContext = void 0;
|
|
27
|
+
const types_1 = require("./types");
|
|
28
|
+
const react_1 = __importStar(require("react"));
|
|
29
|
+
const core_1 = require("@react-typed-forms/core");
|
|
30
|
+
exports.FormRendererComponentsContext = (0, react_1.createContext)(undefined);
|
|
31
|
+
function useFormRendererComponents() {
|
|
32
|
+
const c = (0, react_1.useContext)(exports.FormRendererComponentsContext);
|
|
33
|
+
if (!c) {
|
|
34
|
+
throw "Need to use FormRendererComponentContext.Provider";
|
|
35
|
+
}
|
|
36
|
+
return c;
|
|
37
|
+
}
|
|
38
|
+
exports.useFormRendererComponents = useFormRendererComponents;
|
|
39
|
+
function isScalarField(sf) {
|
|
40
|
+
return sf.schemaType === types_1.SchemaFieldType.Scalar;
|
|
41
|
+
}
|
|
42
|
+
exports.isScalarField = isScalarField;
|
|
43
|
+
function isCompoundField(sf) {
|
|
44
|
+
return sf.schemaType === types_1.SchemaFieldType.Compound;
|
|
45
|
+
}
|
|
46
|
+
exports.isCompoundField = isCompoundField;
|
|
47
|
+
function applyDefaultValues(v, fields) {
|
|
48
|
+
if (!v)
|
|
49
|
+
return defaultValueForFields(fields);
|
|
50
|
+
const applyValue = fields.filter((x) => x.schemaType === types_1.SchemaFieldType.Compound || !(x.field in v));
|
|
51
|
+
if (!applyValue.length)
|
|
52
|
+
return v;
|
|
53
|
+
const out = Object.assign({}, v);
|
|
54
|
+
applyValue.forEach((x) => {
|
|
55
|
+
out[x.field] =
|
|
56
|
+
x.field in v
|
|
57
|
+
? applyDefaultForField(v[x.field], x, fields)
|
|
58
|
+
: defaultValueForField(x, true);
|
|
59
|
+
});
|
|
60
|
+
return out;
|
|
61
|
+
}
|
|
62
|
+
exports.applyDefaultValues = applyDefaultValues;
|
|
63
|
+
function applyDefaultForField(v, field, parent, notElement) {
|
|
64
|
+
var _a;
|
|
65
|
+
if (field.collection && !notElement) {
|
|
66
|
+
return ((_a = v) !== null && _a !== void 0 ? _a : []).map((x) => applyDefaultForField(x, field, parent, true));
|
|
67
|
+
}
|
|
68
|
+
if (isCompoundField(field)) {
|
|
69
|
+
return applyDefaultValues(v, field.treeChildren ? parent : field.children);
|
|
70
|
+
}
|
|
71
|
+
return defaultValueForField(field, true);
|
|
72
|
+
}
|
|
73
|
+
exports.applyDefaultForField = applyDefaultForField;
|
|
74
|
+
function defaultValueForFields(fields) {
|
|
75
|
+
return Object.fromEntries(fields.map((x) => [x.field, defaultValueForField(x, true)]));
|
|
76
|
+
}
|
|
77
|
+
exports.defaultValueForFields = defaultValueForFields;
|
|
78
|
+
function defaultValueForField(sf, notElement) {
|
|
79
|
+
if (notElement && sf.collection)
|
|
80
|
+
return [];
|
|
81
|
+
if (isCompoundField(sf)) {
|
|
82
|
+
return defaultValueForFields(sf.children);
|
|
83
|
+
}
|
|
84
|
+
return sf.defaultValue;
|
|
85
|
+
}
|
|
86
|
+
exports.defaultValueForField = defaultValueForField;
|
|
87
|
+
function findScalarField(fields, field) {
|
|
88
|
+
return findField(fields, field);
|
|
89
|
+
}
|
|
90
|
+
exports.findScalarField = findScalarField;
|
|
91
|
+
function findCompoundField(fields, field) {
|
|
92
|
+
return findField(fields, field);
|
|
93
|
+
}
|
|
94
|
+
exports.findCompoundField = findCompoundField;
|
|
95
|
+
function findField(fields, field) {
|
|
96
|
+
return fields.find((x) => x.field === field);
|
|
97
|
+
}
|
|
98
|
+
exports.findField = findField;
|
|
99
|
+
function fieldDisplayName(sf) {
|
|
100
|
+
return sf.displayName ? sf.displayName : sf.field;
|
|
101
|
+
}
|
|
102
|
+
exports.fieldDisplayName = fieldDisplayName;
|
|
103
|
+
function controlTitle(title, field) {
|
|
104
|
+
return title ? title : fieldDisplayName(field);
|
|
105
|
+
}
|
|
106
|
+
exports.controlTitle = controlTitle;
|
|
107
|
+
function renderControl(definition, formState, hooks, key, wrapChild) {
|
|
108
|
+
const { fields } = formState;
|
|
109
|
+
switch (definition.type) {
|
|
110
|
+
case types_1.ControlDefinitionType.Data:
|
|
111
|
+
const def = definition;
|
|
112
|
+
const fieldData = findScalarField(fields, def.field);
|
|
113
|
+
if (!fieldData)
|
|
114
|
+
return react_1.default.createElement("h1", null,
|
|
115
|
+
"No schema field for: ",
|
|
116
|
+
def.field);
|
|
117
|
+
return (react_1.default.createElement(DataRenderer, { key: key, wrapElem: wrapElem, formState: formState, hooks: hooks, controlDef: def, fieldData: fieldData }));
|
|
118
|
+
case types_1.ControlDefinitionType.Group:
|
|
119
|
+
return (react_1.default.createElement(GroupRenderer, { key: key, hooks: hooks, groupDef: definition, formState: formState, wrapElem: wrapElem }));
|
|
120
|
+
case types_1.ControlDefinitionType.Display:
|
|
121
|
+
return (react_1.default.createElement(DisplayRenderer, { key: key, hooks: hooks, formState: formState, wrapElem: wrapElem, displayDef: definition }));
|
|
122
|
+
case types_1.ControlDefinitionType.Action:
|
|
123
|
+
return (react_1.default.createElement(ActionRenderer, { key: key, hooks: hooks, formState: formState, wrapElem: wrapElem, actionDef: definition }));
|
|
124
|
+
default:
|
|
125
|
+
return react_1.default.createElement("h1", null,
|
|
126
|
+
"Unknown control: ",
|
|
127
|
+
definition.type);
|
|
128
|
+
}
|
|
129
|
+
function wrapElem(e) {
|
|
130
|
+
var _a;
|
|
131
|
+
return (_a = wrapChild === null || wrapChild === void 0 ? void 0 : wrapChild(key, e)) !== null && _a !== void 0 ? _a : e;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
exports.renderControl = renderControl;
|
|
135
|
+
function DataRenderer({ hooks, formState, controlDef, wrapElem, fieldData, }) {
|
|
136
|
+
var _a, _b;
|
|
137
|
+
const { renderData } = useFormRendererComponents();
|
|
138
|
+
const props = hooks.useDataProperties(formState, controlDef, fieldData);
|
|
139
|
+
const scalarControl = (_a = formState.data.fields[fieldData.field]) !== null && _a !== void 0 ? _a : (0, core_1.newControl)(undefined);
|
|
140
|
+
(0, core_1.useControlChangeEffect)(scalarControl, (c) => {
|
|
141
|
+
if (props.defaultValue && !c.current.value) {
|
|
142
|
+
c.value = props.defaultValue;
|
|
143
|
+
}
|
|
144
|
+
}, core_1.ControlChange.Value, [scalarControl, props.defaultValue], true);
|
|
145
|
+
if (!props.visible) {
|
|
146
|
+
return react_1.default.createElement(react_1.default.Fragment, null);
|
|
147
|
+
}
|
|
148
|
+
const scalarProps = {
|
|
149
|
+
formEditState: formState,
|
|
150
|
+
field: fieldData,
|
|
151
|
+
control: scalarControl,
|
|
152
|
+
definition: controlDef,
|
|
153
|
+
properties: props,
|
|
154
|
+
};
|
|
155
|
+
return wrapElem(((_b = props.customRender) !== null && _b !== void 0 ? _b : renderData)(scalarProps));
|
|
156
|
+
}
|
|
157
|
+
function ActionRenderer({ hooks, formState, wrapElem, actionDef, }) {
|
|
158
|
+
const { renderAction } = useFormRendererComponents();
|
|
159
|
+
const actionControlProperties = hooks.useActionProperties(formState, actionDef);
|
|
160
|
+
if (!actionControlProperties.visible) {
|
|
161
|
+
return react_1.default.createElement(react_1.default.Fragment, null);
|
|
162
|
+
}
|
|
163
|
+
return wrapElem(renderAction({ definition: actionDef, properties: actionControlProperties }));
|
|
164
|
+
}
|
|
165
|
+
function GroupRenderer({ hooks, formState, groupDef, wrapElem, }) {
|
|
166
|
+
const { renderCompound, renderGroup } = useFormRendererComponents();
|
|
167
|
+
const groupProps = hooks.useGroupProperties(formState, groupDef, hooks);
|
|
168
|
+
if (!groupProps.visible) {
|
|
169
|
+
return react_1.default.createElement(react_1.default.Fragment, null);
|
|
170
|
+
}
|
|
171
|
+
const compoundField = groupDef.compoundField
|
|
172
|
+
? findCompoundField(formState.fields, groupDef.compoundField)
|
|
173
|
+
: undefined;
|
|
174
|
+
if (compoundField) {
|
|
175
|
+
return wrapElem(renderCompound({
|
|
176
|
+
definition: groupDef,
|
|
177
|
+
field: compoundField,
|
|
178
|
+
control: formState.data.fields[compoundField.field],
|
|
179
|
+
properties: groupProps,
|
|
180
|
+
renderChild: (k, c, data, wrapChild) => renderControl(c, Object.assign(Object.assign({}, formState), { fields: compoundField.children, data }), groupProps.hooks, k, wrapChild),
|
|
181
|
+
}));
|
|
182
|
+
}
|
|
183
|
+
return wrapElem(renderGroup({
|
|
184
|
+
definition: groupDef,
|
|
185
|
+
childCount: groupDef.children.length,
|
|
186
|
+
properties: groupProps,
|
|
187
|
+
renderChild: (c, wrapChild) => renderControl(groupDef.children[c], formState, groupProps.hooks, c, wrapChild),
|
|
188
|
+
}));
|
|
189
|
+
}
|
|
190
|
+
function DisplayRenderer({ hooks, wrapElem, formState, displayDef, }) {
|
|
191
|
+
const { renderDisplay } = useFormRendererComponents();
|
|
192
|
+
const displayProps = hooks.useDisplayProperties(formState, displayDef);
|
|
193
|
+
if (!displayProps.visible) {
|
|
194
|
+
return react_1.default.createElement(react_1.default.Fragment, null);
|
|
195
|
+
}
|
|
196
|
+
return wrapElem(renderDisplay({ definition: displayDef, properties: displayProps }));
|
|
197
|
+
}
|
|
198
|
+
function controlForField(field, formState) {
|
|
199
|
+
var _a;
|
|
200
|
+
const refField = findField(formState.fields, field);
|
|
201
|
+
return ((_a = (refField && formState.data.fields[refField.field])) !== null && _a !== void 0 ? _a : (0, core_1.newControl)(undefined));
|
|
202
|
+
}
|
|
203
|
+
exports.controlForField = controlForField;
|
|
204
|
+
function fieldForControl(c) {
|
|
205
|
+
return isSchemaControl(c)
|
|
206
|
+
? c.field
|
|
207
|
+
: isGroupControl(c)
|
|
208
|
+
? c.compoundField
|
|
209
|
+
: undefined;
|
|
210
|
+
}
|
|
211
|
+
exports.fieldForControl = fieldForControl;
|
|
212
|
+
function isSchemaControl(c) {
|
|
213
|
+
return c.type === types_1.ControlDefinitionType.Data;
|
|
214
|
+
}
|
|
215
|
+
exports.isSchemaControl = isSchemaControl;
|
|
216
|
+
function isGroupControl(c) {
|
|
217
|
+
return c.type === types_1.ControlDefinitionType.Group;
|
|
218
|
+
}
|
|
219
|
+
exports.isGroupControl = isGroupControl;
|
package/lib/hooks.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DataControlDefinition, EntityExpression, FieldOption, ScalarField, ControlDefinition } from "./types";
|
|
2
|
+
import { DataControlProperties, FormEditHooks, FormEditState } from "./controlRender";
|
|
3
|
+
export type ExpressionHook = (expr: EntityExpression, formState: FormEditState) => any;
|
|
4
|
+
export declare function useDefaultValue(definition: DataControlDefinition, field: ScalarField, formState: FormEditState, useExpression: ExpressionHook): any;
|
|
5
|
+
export declare function useIsControlVisible(definition: ControlDefinition, formState: FormEditState, useExpression: ExpressionHook): boolean;
|
|
6
|
+
export declare function getDefaultScalarControlProperties(control: DataControlDefinition, field: ScalarField, visible: boolean, defaultValue: any): DataControlProperties;
|
|
7
|
+
export declare function getOptionsForScalarField(field: ScalarField): FieldOption[] | undefined;
|
|
8
|
+
export declare const defaultExpressionHook: ExpressionHook;
|
|
9
|
+
export declare function createFormEditHooks(useExpression: ExpressionHook): FormEditHooks;
|
package/lib/hooks.js
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createFormEditHooks = exports.defaultExpressionHook = exports.getOptionsForScalarField = exports.getDefaultScalarControlProperties = exports.useIsControlVisible = exports.useDefaultValue = void 0;
|
|
4
|
+
const types_1 = require("./types");
|
|
5
|
+
const controlRender_1 = require("./controlRender");
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const core_1 = require("@react-typed-forms/core");
|
|
8
|
+
function useDefaultValue(definition, field, formState, useExpression) {
|
|
9
|
+
var _a;
|
|
10
|
+
const valueExpression = (_a = definition.dynamic) === null || _a === void 0 ? void 0 : _a.find((x) => x.type === types_1.DynamicPropertyType.DefaultValue);
|
|
11
|
+
if (valueExpression) {
|
|
12
|
+
return useExpression(valueExpression.expr, formState);
|
|
13
|
+
}
|
|
14
|
+
return field.defaultValue;
|
|
15
|
+
}
|
|
16
|
+
exports.useDefaultValue = useDefaultValue;
|
|
17
|
+
function useIsControlVisible(definition, formState, useExpression) {
|
|
18
|
+
var _a, _b;
|
|
19
|
+
const visibleExpression = (_a = definition.dynamic) === null || _a === void 0 ? void 0 : _a.find((x) => x.type === types_1.DynamicPropertyType.Visible);
|
|
20
|
+
if (visibleExpression && visibleExpression.expr) {
|
|
21
|
+
return Boolean(useExpression(visibleExpression.expr, formState));
|
|
22
|
+
}
|
|
23
|
+
const schemaFields = formState.fields;
|
|
24
|
+
const typeControl = (0, react_1.useMemo)(() => {
|
|
25
|
+
var _a, _b;
|
|
26
|
+
const typeField = schemaFields.find((x) => (0, controlRender_1.isScalarField)(x) && x.isTypeField);
|
|
27
|
+
return ((_b = (typeField && ((_a = formState.data.fields) === null || _a === void 0 ? void 0 : _a[typeField.field]))) !== null && _b !== void 0 ? _b : (0, core_1.newControl)(undefined));
|
|
28
|
+
}, [schemaFields, formState.data]);
|
|
29
|
+
const fieldName = (0, controlRender_1.fieldForControl)(definition);
|
|
30
|
+
const onlyForTypes = (_b = (fieldName ? (0, controlRender_1.findField)(schemaFields, fieldName) : undefined)) === null || _b === void 0 ? void 0 : _b.onlyForTypes;
|
|
31
|
+
return (0, core_1.useControlValue)(() => !onlyForTypes ||
|
|
32
|
+
onlyForTypes.length === 0 ||
|
|
33
|
+
Boolean(typeControl.value && onlyForTypes.includes(typeControl.value)));
|
|
34
|
+
}
|
|
35
|
+
exports.useIsControlVisible = useIsControlVisible;
|
|
36
|
+
function getDefaultScalarControlProperties(control, field, visible, defaultValue) {
|
|
37
|
+
return {
|
|
38
|
+
defaultValue,
|
|
39
|
+
options: getOptionsForScalarField(field),
|
|
40
|
+
required: control.required,
|
|
41
|
+
visible,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
exports.getDefaultScalarControlProperties = getDefaultScalarControlProperties;
|
|
45
|
+
function getOptionsForScalarField(field) {
|
|
46
|
+
var _a, _b;
|
|
47
|
+
const opts = (_a = field.restrictions) === null || _a === void 0 ? void 0 : _a.options;
|
|
48
|
+
if ((_b = opts === null || opts === void 0 ? void 0 : opts.length) !== null && _b !== void 0 ? _b : 0 > 0) {
|
|
49
|
+
return opts;
|
|
50
|
+
}
|
|
51
|
+
return undefined;
|
|
52
|
+
}
|
|
53
|
+
exports.getOptionsForScalarField = getOptionsForScalarField;
|
|
54
|
+
const defaultExpressionHook = (expr, formState) => {
|
|
55
|
+
switch (expr.type) {
|
|
56
|
+
case types_1.ExpressionType.FieldValue:
|
|
57
|
+
const fvExpr = expr;
|
|
58
|
+
return (0, core_1.useControlValue)(() => (0, controlRender_1.controlForField)(fvExpr.field, formState).value === fvExpr.value);
|
|
59
|
+
default:
|
|
60
|
+
return undefined;
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
exports.defaultExpressionHook = defaultExpressionHook;
|
|
64
|
+
function createFormEditHooks(useExpression) {
|
|
65
|
+
return {
|
|
66
|
+
useDataProperties(formState, definition, field) {
|
|
67
|
+
const visible = useIsControlVisible(definition, formState, useExpression);
|
|
68
|
+
const defaultValue = useDefaultValue(definition, field, formState, useExpression);
|
|
69
|
+
return getDefaultScalarControlProperties(definition, field, visible, defaultValue);
|
|
70
|
+
},
|
|
71
|
+
useDisplayProperties: (fs, definition) => {
|
|
72
|
+
const visible = useIsControlVisible(definition, fs, useExpression);
|
|
73
|
+
return { visible };
|
|
74
|
+
},
|
|
75
|
+
useGroupProperties: (fs, definition, hooks) => {
|
|
76
|
+
const visible = useIsControlVisible(definition, fs, useExpression);
|
|
77
|
+
return { visible, hooks };
|
|
78
|
+
},
|
|
79
|
+
useActionProperties(formState, definition) {
|
|
80
|
+
const visible = useIsControlVisible(definition, formState, useExpression);
|
|
81
|
+
return { visible, onClick: () => { } };
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
exports.createFormEditHooks = createFormEditHooks;
|
package/lib/index.d.ts
ADDED
package/lib/index.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./types"), exports);
|
|
18
|
+
__exportStar(require("./schemaBuilder"), exports);
|
|
19
|
+
__exportStar(require("./controlRender"), exports);
|
|
20
|
+
__exportStar(require("./hooks"), exports);
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { CompoundField, FieldOption, FieldType, ScalarField, SchemaField, SchemaFieldType } from "./types";
|
|
2
|
+
type AllowedSchema<T> = T extends string ? ScalarField & {
|
|
3
|
+
schemaType: SchemaFieldType.Scalar;
|
|
4
|
+
type: FieldType.String | FieldType.Date | FieldType.DateTime;
|
|
5
|
+
} : T extends number ? ScalarField & {
|
|
6
|
+
schemaType: SchemaFieldType.Scalar;
|
|
7
|
+
type: FieldType.Int | FieldType.Double;
|
|
8
|
+
} : T extends boolean ? ScalarField & {
|
|
9
|
+
schemaType: SchemaFieldType.Scalar;
|
|
10
|
+
type: FieldType.Bool;
|
|
11
|
+
} : T extends Array<infer E> ? AllowedSchema<E> & {
|
|
12
|
+
collection: true;
|
|
13
|
+
} : T extends {
|
|
14
|
+
[key: string]: any;
|
|
15
|
+
} ? CompoundField & {
|
|
16
|
+
schemaType: SchemaFieldType.Compound;
|
|
17
|
+
type: FieldType.Compound;
|
|
18
|
+
} : never;
|
|
19
|
+
type AllowedField<T> = (name: string) => AllowedSchema<T>;
|
|
20
|
+
export declare function buildSchema<T>(def: {
|
|
21
|
+
[K in keyof T]-?: AllowedField<T[K]>;
|
|
22
|
+
}): SchemaField[];
|
|
23
|
+
export declare function stringField(displayName: string, options?: Partial<Omit<ScalarField, "schemaType" | "type">>): (name: string) => ScalarField & {
|
|
24
|
+
schemaType: SchemaFieldType.Scalar;
|
|
25
|
+
} & {
|
|
26
|
+
field?: string | undefined;
|
|
27
|
+
displayName: string;
|
|
28
|
+
tags?: string[] | undefined;
|
|
29
|
+
system?: boolean | undefined;
|
|
30
|
+
collection?: boolean | undefined;
|
|
31
|
+
onlyForTypes?: string[] | undefined;
|
|
32
|
+
entityRefType?: string | undefined;
|
|
33
|
+
required?: boolean | undefined;
|
|
34
|
+
parentField?: string | undefined;
|
|
35
|
+
searchable?: boolean | undefined;
|
|
36
|
+
defaultValue?: any;
|
|
37
|
+
isTypeField?: boolean | undefined;
|
|
38
|
+
restrictions?: import("./types").SchemaRestrictions | undefined;
|
|
39
|
+
type: FieldType.String;
|
|
40
|
+
};
|
|
41
|
+
export declare function stringOptionsField(displayName: string, ...options: FieldOption[]): (name: string) => ScalarField & {
|
|
42
|
+
schemaType: SchemaFieldType.Scalar;
|
|
43
|
+
} & {
|
|
44
|
+
type: FieldType.String;
|
|
45
|
+
displayName: string;
|
|
46
|
+
restrictions: {
|
|
47
|
+
options: FieldOption[];
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
export declare function withScalarOptions<S extends ScalarField>(options: Partial<ScalarField>, v: (name: string) => S): (name: string) => S;
|
|
51
|
+
export declare function makeScalarField<S extends Partial<ScalarField>>(options: S): (name: string) => ScalarField & {
|
|
52
|
+
schemaType: SchemaFieldType.Scalar;
|
|
53
|
+
} & S;
|
|
54
|
+
export declare function makeCompoundField<S extends Partial<CompoundField>>(options: S): (name: string) => CompoundField & {
|
|
55
|
+
schemaType: SchemaFieldType.Compound;
|
|
56
|
+
type: FieldType.Compound;
|
|
57
|
+
} & S;
|
|
58
|
+
export declare function intField(displayName: string, options?: Partial<Omit<ScalarField, "schemaType" | "type">>): (name: string) => ScalarField & {
|
|
59
|
+
schemaType: SchemaFieldType.Scalar;
|
|
60
|
+
} & {
|
|
61
|
+
field?: string | undefined;
|
|
62
|
+
displayName: string;
|
|
63
|
+
tags?: string[] | undefined;
|
|
64
|
+
system?: boolean | undefined;
|
|
65
|
+
collection?: boolean | undefined;
|
|
66
|
+
onlyForTypes?: string[] | undefined;
|
|
67
|
+
entityRefType?: string | undefined;
|
|
68
|
+
required?: boolean | undefined;
|
|
69
|
+
parentField?: string | undefined;
|
|
70
|
+
searchable?: boolean | undefined;
|
|
71
|
+
defaultValue?: any;
|
|
72
|
+
isTypeField?: boolean | undefined;
|
|
73
|
+
restrictions?: import("./types").SchemaRestrictions | undefined;
|
|
74
|
+
type: FieldType.Int;
|
|
75
|
+
};
|
|
76
|
+
export declare function boolField(displayName: string, options?: Partial<Omit<ScalarField, "schemaType" | "type">>): (name: string) => ScalarField & {
|
|
77
|
+
schemaType: SchemaFieldType.Scalar;
|
|
78
|
+
} & {
|
|
79
|
+
field?: string | undefined;
|
|
80
|
+
displayName: string;
|
|
81
|
+
tags?: string[] | undefined;
|
|
82
|
+
system?: boolean | undefined;
|
|
83
|
+
collection?: boolean | undefined;
|
|
84
|
+
onlyForTypes?: string[] | undefined;
|
|
85
|
+
entityRefType?: string | undefined;
|
|
86
|
+
required?: boolean | undefined;
|
|
87
|
+
parentField?: string | undefined;
|
|
88
|
+
searchable?: boolean | undefined;
|
|
89
|
+
defaultValue?: any;
|
|
90
|
+
isTypeField?: boolean | undefined;
|
|
91
|
+
restrictions?: import("./types").SchemaRestrictions | undefined;
|
|
92
|
+
type: FieldType.Bool;
|
|
93
|
+
};
|
|
94
|
+
export declare function compoundField<Other extends Partial<Omit<CompoundField, "type" | "schemaType">>>(displayName: string, fields: SchemaField[], other: Other): (name: string) => CompoundField & {
|
|
95
|
+
schemaType: SchemaFieldType.Compound;
|
|
96
|
+
type: FieldType.Compound;
|
|
97
|
+
collection: Other["collection"];
|
|
98
|
+
};
|
|
99
|
+
export declare function defaultScalarField(field: string, displayName: string): ScalarField & {
|
|
100
|
+
schemaType: SchemaFieldType.Scalar;
|
|
101
|
+
type: FieldType.String;
|
|
102
|
+
};
|
|
103
|
+
export declare function defaultCompoundField(field: string, displayName: string, collection: boolean): CompoundField & {
|
|
104
|
+
type: FieldType.Compound;
|
|
105
|
+
schemaType: SchemaFieldType.Compound;
|
|
106
|
+
};
|
|
107
|
+
export {};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.defaultCompoundField = exports.defaultScalarField = exports.compoundField = exports.boolField = exports.intField = exports.makeCompoundField = exports.makeScalarField = exports.withScalarOptions = exports.stringOptionsField = exports.stringField = exports.buildSchema = void 0;
|
|
4
|
+
const types_1 = require("./types");
|
|
5
|
+
function buildSchema(def) {
|
|
6
|
+
return Object.entries(def).map((x) => x[1](x[0]));
|
|
7
|
+
}
|
|
8
|
+
exports.buildSchema = buildSchema;
|
|
9
|
+
function stringField(displayName, options) {
|
|
10
|
+
return makeScalarField(Object.assign({ type: types_1.FieldType.String, displayName }, options));
|
|
11
|
+
}
|
|
12
|
+
exports.stringField = stringField;
|
|
13
|
+
function stringOptionsField(displayName, ...options) {
|
|
14
|
+
return makeScalarField({
|
|
15
|
+
type: types_1.FieldType.String,
|
|
16
|
+
displayName,
|
|
17
|
+
restrictions: { options },
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
exports.stringOptionsField = stringOptionsField;
|
|
21
|
+
function withScalarOptions(options, v) {
|
|
22
|
+
return (n) => (Object.assign(Object.assign({}, v(n)), options));
|
|
23
|
+
}
|
|
24
|
+
exports.withScalarOptions = withScalarOptions;
|
|
25
|
+
function makeScalarField(options) {
|
|
26
|
+
return (n) => (Object.assign(Object.assign({}, defaultScalarField(n, n)), options));
|
|
27
|
+
}
|
|
28
|
+
exports.makeScalarField = makeScalarField;
|
|
29
|
+
function makeCompoundField(options) {
|
|
30
|
+
return (n) => (Object.assign(Object.assign({}, defaultCompoundField(n, n, false)), options));
|
|
31
|
+
}
|
|
32
|
+
exports.makeCompoundField = makeCompoundField;
|
|
33
|
+
function intField(displayName, options) {
|
|
34
|
+
return makeScalarField(Object.assign({ type: types_1.FieldType.Int, displayName }, options));
|
|
35
|
+
}
|
|
36
|
+
exports.intField = intField;
|
|
37
|
+
function boolField(displayName, options) {
|
|
38
|
+
return makeScalarField(Object.assign({ type: types_1.FieldType.Bool, displayName }, options));
|
|
39
|
+
}
|
|
40
|
+
exports.boolField = boolField;
|
|
41
|
+
function compoundField(displayName, fields, other) {
|
|
42
|
+
return (field) => (Object.assign(Object.assign(Object.assign({}, defaultCompoundField(field, displayName, false)), other), { children: fields }));
|
|
43
|
+
}
|
|
44
|
+
exports.compoundField = compoundField;
|
|
45
|
+
function defaultScalarField(field, displayName) {
|
|
46
|
+
return {
|
|
47
|
+
restrictions: {
|
|
48
|
+
options: [],
|
|
49
|
+
},
|
|
50
|
+
tags: [],
|
|
51
|
+
field,
|
|
52
|
+
displayName,
|
|
53
|
+
type: types_1.FieldType.String,
|
|
54
|
+
collection: false,
|
|
55
|
+
searchable: false,
|
|
56
|
+
schemaType: types_1.SchemaFieldType.Scalar,
|
|
57
|
+
system: false,
|
|
58
|
+
entityRefType: "",
|
|
59
|
+
parentField: "",
|
|
60
|
+
required: false,
|
|
61
|
+
defaultValue: undefined,
|
|
62
|
+
onlyForTypes: [],
|
|
63
|
+
isTypeField: false,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
exports.defaultScalarField = defaultScalarField;
|
|
67
|
+
function defaultCompoundField(field, displayName, collection) {
|
|
68
|
+
return {
|
|
69
|
+
tags: [],
|
|
70
|
+
field,
|
|
71
|
+
displayName,
|
|
72
|
+
type: types_1.FieldType.Compound,
|
|
73
|
+
collection,
|
|
74
|
+
schemaType: types_1.SchemaFieldType.Compound,
|
|
75
|
+
system: false,
|
|
76
|
+
treeChildren: false,
|
|
77
|
+
children: [],
|
|
78
|
+
onlyForTypes: [],
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
exports.defaultCompoundField = defaultCompoundField;
|