@resistdesign/voltra 3.0.0-alpha.4 → 3.0.0-alpha.41
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/README.md +379 -14
- package/api/DBX/DBXAsserts.d.ts +95 -0
- package/api/DBX/DBXRequest.d.ts +5 -0
- package/api/DBX/DBXRuntime.d.ts +5 -0
- package/api/DBX/DBXScenarioConfig.d.ts +9 -0
- package/api/DBX/DBXSeed.d.ts +124 -0
- package/api/DBX/DBXTypes.d.ts +176 -0
- package/api/DBX/index.d.ts +8 -0
- package/api/DataAccessControl.d.ts +220 -0
- package/api/Indexing/API.d.ts +224 -0
- package/api/Indexing/Cursor.d.ts +101 -0
- package/api/Indexing/Handler/Config.d.ts +39 -0
- package/api/Indexing/Handler.d.ts +166 -0
- package/api/Indexing/Trace.d.ts +54 -0
- package/api/Indexing/Types.d.ts +204 -0
- package/api/Indexing/ddb/AwsSdkV3Adapter.d.ts +8 -0
- package/api/Indexing/ddb/Types.d.ts +209 -0
- package/api/Indexing/docId.d.ts +27 -0
- package/api/Indexing/exact/ExactDdb.d.ts +58 -0
- package/api/Indexing/exact/ExactIndex.d.ts +90 -0
- package/api/Indexing/exact/ExactS3.d.ts +41 -0
- package/api/Indexing/fieldQualification.d.ts +12 -0
- package/api/Indexing/fulltext/FullTextDdbBackend.d.ts +212 -0
- package/api/Indexing/fulltext/FullTextMemoryBackend.d.ts +93 -0
- package/api/Indexing/fulltext/Schema.d.ts +164 -0
- package/api/Indexing/hashUniversal.d.ts +13 -0
- package/api/Indexing/index.d.ts +45 -0
- package/api/Indexing/lossy/LossyDdb.d.ts +43 -0
- package/api/Indexing/lossy/LossyIndex.d.ts +72 -0
- package/api/Indexing/lossy/LossyS3.d.ts +40 -0
- package/api/Indexing/rel/Cursor.d.ts +25 -0
- package/api/Indexing/rel/Handlers.d.ts +144 -0
- package/api/Indexing/rel/RelationalDdb.d.ts +169 -0
- package/api/Indexing/rel/RelationalInMemoryBackend.d.ts +38 -0
- package/api/Indexing/rel/Types.d.ts +69 -0
- package/api/Indexing/structured/Cursor.d.ts +26 -0
- package/api/Indexing/structured/Handlers.d.ts +128 -0
- package/api/Indexing/structured/SearchStructured.d.ts +44 -0
- package/api/Indexing/structured/StructuredDdb.d.ts +184 -0
- package/api/Indexing/structured/StructuredDdbBackend.d.ts +112 -0
- package/api/Indexing/structured/StructuredInMemoryBackend.d.ts +40 -0
- package/api/Indexing/structured/StructuredInMemoryIndex.d.ts +61 -0
- package/api/Indexing/structured/StructuredStringLike.d.ts +54 -0
- package/api/Indexing/structured/StructuredWriter.d.ts +74 -0
- package/api/Indexing/structured/Types.d.ts +126 -0
- package/api/Indexing/structured/index.d.ts +9 -0
- package/api/Indexing/tokenize.d.ts +31 -0
- package/api/ORM/DACUtils.d.ts +270 -0
- package/api/ORM/ListItemUtils.d.ts +40 -0
- package/api/ORM/ORMRouteMap.d.ts +55 -0
- package/api/ORM/TypeInfoORMService.d.ts +740 -0
- package/api/ORM/drivers/DynamoDBDataItemDBDriver/ConfigTypes.d.ts +229 -0
- package/api/ORM/drivers/DynamoDBDataItemDBDriver.d.ts +89 -0
- package/api/ORM/drivers/InMemoryDataItemDBDriver/ConfigTypes.d.ts +4 -0
- package/api/ORM/drivers/InMemoryDataItemDBDriver.d.ts +55 -0
- package/api/ORM/drivers/InMemoryFileItemDBDriver/ConfigTypes.d.ts +13 -0
- package/api/ORM/drivers/InMemoryFileItemDBDriver.d.ts +98 -0
- package/api/ORM/drivers/InMemoryItemRelationshipDBDriver.d.ts +16 -0
- package/api/ORM/drivers/IndexingRelationshipDriver.d.ts +123 -0
- package/api/ORM/drivers/S3FileItemDBDriver/ConfigTypes.d.ts +322 -0
- package/api/ORM/drivers/S3FileItemDBDriver/S3FileDriver.d.ts +118 -0
- package/api/ORM/drivers/S3FileItemDBDriver.d.ts +71 -0
- package/api/ORM/drivers/common/SupportedTypeInfoORMDBDrivers.d.ts +36 -0
- package/api/ORM/drivers/common/Types.d.ts +197 -0
- package/api/ORM/drivers/common/index.d.ts +2 -0
- package/api/ORM/drivers/index.d.ts +8 -0
- package/api/ORM/index.d.ts +9 -0
- package/api/ORM/indexing/criteriaToStructuredWhere.d.ts +22 -0
- package/api/Router/AWS.d.ts +80 -0
- package/api/Router/Auth.d.ts +14 -0
- package/api/Router/CORS.d.ts +66 -0
- package/api/Router/Types.d.ts +138 -0
- package/api/Router/index.d.ts +89 -0
- package/api/index.d.ts +72 -6
- package/api/index.js +3291 -1954
- package/app/forms/Engine.d.ts +23 -0
- package/app/forms/UI.d.ts +83 -0
- package/app/forms/core/createAutoField.d.ts +43 -0
- package/app/forms/core/createFormRenderer.d.ts +25 -0
- package/app/forms/core/getFieldKind.d.ts +14 -0
- package/app/forms/core/index.d.ts +11 -0
- package/app/forms/core/mergeSuites.d.ts +23 -0
- package/app/forms/core/resolveSuite.d.ts +15 -0
- package/app/forms/core/types.d.ts +180 -0
- package/app/forms/index.d.ts +9 -0
- package/app/forms/types.d.ts +137 -0
- package/app/helpers/styled.d.ts +3 -0
- package/app/index.d.ts +102 -5
- package/app/index.js +98 -327
- package/app/utils/ApplicationState.d.ts +167 -0
- package/app/utils/ApplicationStateLoader.d.ts +86 -0
- package/app/utils/Controller.d.ts +10 -0
- package/app/utils/Debug.d.ts +14 -0
- package/app/utils/EasyLayout.d.ts +89 -0
- package/app/utils/History.d.ts +165 -0
- package/app/utils/Route.d.ts +173 -0
- package/app/utils/RouteHistory.d.ts +27 -0
- package/app/utils/Service.d.ts +45 -0
- package/app/utils/TypeInfoORMAPIUtils.d.ts +94 -0
- package/app/utils/TypeInfoORMClient.d.ts +103 -0
- package/app/utils/UniversalRouteAdapter.d.ts +73 -0
- package/app/utils/easy-layout/computeAreaBounds.d.ts +5 -0
- package/app/utils/easy-layout/computeTracks.d.ts +16 -0
- package/app/utils/easy-layout/index.d.ts +5 -0
- package/app/utils/easy-layout/parseTemplate.d.ts +12 -0
- package/app/utils/easy-layout/types.d.ts +52 -0
- package/app/utils/easy-layout/validateAreas.d.ts +5 -0
- package/app/utils/index.d.ts +24 -0
- package/build/TypeMapping.d.ts +17 -0
- package/build/TypeParsing.d.ts +10 -0
- package/build/index.d.ts +15 -0
- package/build/index.js +569 -0
- package/chunk-2MOLWZMQ.js +71 -0
- package/chunk-7AMEFPPP.js +78 -0
- package/chunk-ATO2455Q.js +258 -0
- package/chunk-DT6WWJUI.js +1185 -0
- package/chunk-I2KLQ2HA.js +19 -0
- package/chunk-TJFTWPXQ.js +39 -0
- package/chunk-WNFRDIBW.js +121 -0
- package/chunk-YCTVEW2I.js +546 -0
- package/common/CommandLine/collectRequiredEnvironmentVariables.d.ts +9 -0
- package/common/CommandLine/index.d.ts +6 -0
- package/common/HelperTypes.d.ts +9 -0
- package/common/IdGeneration/getSimpleId.d.ts +8 -0
- package/common/IdGeneration/index.d.ts +1 -0
- package/common/ItemRelationshipInfoTypes.d.ts +64 -0
- package/common/ItemRelationships/ItemRelationshipValidation.d.ts +21 -0
- package/common/ItemRelationships/index.d.ts +2 -0
- package/common/Logging/Utils.d.ts +10 -0
- package/common/Logging/index.d.ts +1 -0
- package/common/Routing.d.ts +81 -0
- package/common/SearchTypes.d.ts +227 -0
- package/common/SearchUtils.d.ts +55 -0
- package/common/SearchValidation.d.ts +27 -0
- package/common/StringTransformers.d.ts +28 -0
- package/common/Testing/CLI.d.ts +6 -0
- package/common/Testing/Types.d.ts +216 -0
- package/common/Testing/Utils.d.ts +112 -0
- package/common/Testing/index.d.ts +8 -0
- package/common/TypeInfoDataItemUtils.d.ts +39 -0
- package/{Types-C7XjUjoF.d.ts → common/TypeInfoORM/Types.d.ts} +117 -15
- package/common/TypeInfoORM/index.d.ts +3 -0
- package/common/TypeParsing/Constants.d.ts +4 -0
- package/common/TypeParsing/ParsingUtils/Constants.d.ts +8 -0
- package/common/TypeParsing/ParsingUtils/checkType.d.ts +14 -0
- package/common/TypeParsing/ParsingUtils/checkUnionType.d.ts +12 -0
- package/common/TypeParsing/ParsingUtils/extractCommentTags.d.ts +8 -0
- package/common/TypeParsing/ParsingUtils/extractLiteralValues.d.ts +12 -0
- package/common/TypeParsing/ParsingUtils/extractTypeDetails.d.ts +14 -0
- package/common/TypeParsing/ParsingUtils/getPrimaryFieldForTypeInfo.d.ts +18 -0
- package/common/TypeParsing/ParsingUtils/getTypeInfo.d.ts +9 -0
- package/common/TypeParsing/ParsingUtils/getTypeInfoField.d.ts +9 -0
- package/common/TypeParsing/ParsingUtils/getTypeInfoFromAliasType.d.ts +11 -0
- package/common/TypeParsing/ParsingUtils/getTypeInfoFromFieldFilter.d.ts +12 -0
- package/common/TypeParsing/ParsingUtils/getTypeInfoFromTypeAlias.d.ts +11 -0
- package/common/TypeParsing/ParsingUtils/getTypeKeyword.d.ts +9 -0
- package/common/TypeParsing/ParsingUtils/getUnionOrIntersectionTypeInfo.d.ts +11 -0
- package/common/TypeParsing/ParsingUtils/getUnionOrLiteralStringValues.d.ts +8 -0
- package/common/TypeParsing/TypeInfo.d.ts +222 -0
- package/common/TypeParsing/Utils.d.ts +47 -0
- package/common/TypeParsing/Validation.d.ts +327 -0
- package/common/TypeParsing/index.d.ts +8 -0
- package/common/index.d.ts +40 -4
- package/common/index.js +25 -1737
- package/{index-BkFZlfit.d.ts → iac/SimpleCFT.d.ts} +5 -25
- package/iac/index.d.ts +40 -2
- package/iac/index.js +2 -1661
- package/iac/packs/auth.d.ts +131 -0
- package/iac/packs/build/utils.d.ts +289 -0
- package/iac/packs/build.d.ts +92 -0
- package/iac/packs/cdn.d.ts +33 -0
- package/iac/packs/cloud-function.d.ts +67 -0
- package/iac/packs/database.d.ts +32 -0
- package/iac/packs/dns.d.ts +34 -0
- package/iac/packs/file-storage.d.ts +46 -0
- package/iac/packs/gateway.d.ts +82 -0
- package/iac/packs/index.d.ts +60 -1
- package/iac/packs/index.js +391 -594
- package/iac/packs/repo.d.ts +28 -0
- package/iac/packs/ssl-certificate.d.ts +28 -0
- package/iac/types/Constants.d.ts +24 -0
- package/{index-DcvJOZ_c.d.ts → iac/types/IaCTypes.d.ts} +23 -1018
- package/iac/types/Renderers.d.ts +96 -0
- package/iac/types/Types.d.ts +131 -0
- package/iac/types/Utils.d.ts +9 -0
- package/iac/types/generate.d.ts +1 -0
- package/iac/utils/index.d.ts +87 -0
- package/iac/utils/patch-utils.d.ts +66 -0
- package/iac-packs/index.d.ts +6 -0
- package/native/forms/UI.d.ts +73 -0
- package/native/forms/createNativeFormRenderer.d.ts +21 -0
- package/native/forms/index.d.ts +25 -0
- package/native/forms/primitives/index.d.ts +38 -0
- package/native/forms/suite.d.ts +15 -0
- package/native/index.d.ts +19 -0
- package/native/index.js +748 -0
- package/native/testing/react-native.d.ts +46 -0
- package/native/utils/EasyLayout.d.ts +88 -0
- package/native/utils/History.d.ts +102 -0
- package/native/utils/Route.d.ts +80 -0
- package/native/utils/index.d.ts +20 -0
- package/package.json +54 -21
- package/web/forms/UI.d.ts +74 -0
- package/web/forms/createWebFormRenderer.d.ts +21 -0
- package/web/forms/index.d.ts +9 -0
- package/web/forms/primitives/index.d.ts +21 -0
- package/web/forms/suite.d.ts +15 -0
- package/web/index.d.ts +15 -0
- package/web/index.js +668 -0
- package/web/utils/EasyLayout.d.ts +47 -0
- package/web/utils/Route.d.ts +16 -0
- package/web/utils/index.d.ts +7 -0
- package/SearchTypes-DjN6YQzE.d.ts +0 -577
- package/Validation-CFP59oIP.d.ts +0 -226
- package/index-C3-iD9Mh.d.ts +0 -690
- package/index-DZ2BB4iX.d.ts +0 -5357
- package/index-IokxSNxm.d.ts +0 -745
- package/index.d.ts +0 -13
- package/index.js +0 -10973
package/web/index.js
ADDED
|
@@ -0,0 +1,668 @@
|
|
|
1
|
+
import { createEasyLayout } from '../chunk-2MOLWZMQ.js';
|
|
2
|
+
import { createFormRenderer, AutoFormView, AutoForm, createBrowserRouteAdapter, Route } from '../chunk-DT6WWJUI.js';
|
|
3
|
+
import { ERROR_MESSAGE_CONSTANTS } from '../chunk-YCTVEW2I.js';
|
|
4
|
+
import '../chunk-WNFRDIBW.js';
|
|
5
|
+
import { __export, __reExport } from '../chunk-I2KLQ2HA.js';
|
|
6
|
+
import { createElement, useCallback, useRef } from 'react';
|
|
7
|
+
import * as styledBase from 'styled-components';
|
|
8
|
+
import styledBase__default from 'styled-components';
|
|
9
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
10
|
+
|
|
11
|
+
// src/app/helpers/styled.ts
|
|
12
|
+
var styled_exports = {};
|
|
13
|
+
__export(styled_exports, {
|
|
14
|
+
default: () => styled_default
|
|
15
|
+
});
|
|
16
|
+
__reExport(styled_exports, styledBase);
|
|
17
|
+
var styled = typeof styledBase__default.default === "function" ? styledBase__default.default : styledBase__default;
|
|
18
|
+
var styled_default = styled;
|
|
19
|
+
|
|
20
|
+
// src/web/forms/primitives/index.ts
|
|
21
|
+
var FieldWrapper = styled_default("div")`
|
|
22
|
+
display: flex;
|
|
23
|
+
flex-direction: column;
|
|
24
|
+
align-items: flex-start;
|
|
25
|
+
justify-content: flex-start;
|
|
26
|
+
gap: 0.25em;
|
|
27
|
+
`;
|
|
28
|
+
var ErrorMessage = styled_default("span")`
|
|
29
|
+
color: #AA0000;
|
|
30
|
+
`;
|
|
31
|
+
var ArrayContainer = styled_default("div")`
|
|
32
|
+
display: flex;
|
|
33
|
+
flex-direction: column;
|
|
34
|
+
align-items: flex-start;
|
|
35
|
+
justify-content: flex-start;
|
|
36
|
+
gap: 0.5em;
|
|
37
|
+
`;
|
|
38
|
+
var ArrayItemWrapper = styled_default("div")`
|
|
39
|
+
display: flex;
|
|
40
|
+
flex-direction: row;
|
|
41
|
+
align-items: flex-end;
|
|
42
|
+
justify-content: space-between;
|
|
43
|
+
gap: 0.5em;
|
|
44
|
+
`;
|
|
45
|
+
var createArrayItemField = (field) => ({
|
|
46
|
+
...field,
|
|
47
|
+
array: false,
|
|
48
|
+
tags: {
|
|
49
|
+
...field.tags,
|
|
50
|
+
label: void 0
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
var toOptionValue = (val) => {
|
|
54
|
+
if (val === null || val === void 0) return void 0;
|
|
55
|
+
if (typeof val === "boolean") return void 0;
|
|
56
|
+
return String(val);
|
|
57
|
+
};
|
|
58
|
+
var parseNumberValue = (raw) => raw === "" ? null : Number(raw);
|
|
59
|
+
var getSelectableValues = (possibleValues) => {
|
|
60
|
+
return possibleValues?.filter(
|
|
61
|
+
(v) => typeof v === "string" || typeof v === "number"
|
|
62
|
+
);
|
|
63
|
+
};
|
|
64
|
+
var formatCustomValue = (val) => {
|
|
65
|
+
if (val === null || val === void 0) return "None";
|
|
66
|
+
if (typeof val === "string" || typeof val === "number") return String(val);
|
|
67
|
+
return JSON.stringify(val, null, 2);
|
|
68
|
+
};
|
|
69
|
+
var renderErrorMessage = (context) => {
|
|
70
|
+
const { error, errors = [], translateValidationErrorCode } = context;
|
|
71
|
+
const descriptors = (errors.length ? errors : error ? [error] : []).filter(
|
|
72
|
+
(descriptor) => descriptor.code !== ERROR_MESSAGE_CONSTANTS.NONE
|
|
73
|
+
);
|
|
74
|
+
if (!descriptors.length) {
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
return /* @__PURE__ */ jsx(Fragment, { children: descriptors.map((descriptor, index) => {
|
|
78
|
+
const message = translateValidationErrorCode(descriptor);
|
|
79
|
+
if (!message) {
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
return /* @__PURE__ */ jsx(ErrorMessage, { children: message }, `${descriptor.code}-${index}`);
|
|
83
|
+
}) });
|
|
84
|
+
};
|
|
85
|
+
var RelationSingleField = (context) => {
|
|
86
|
+
const { field, fieldKey, label, required, disabled, onRelationAction } = context;
|
|
87
|
+
const id = `field-${fieldKey}`;
|
|
88
|
+
const handleManageRelation = useCallback(() => {
|
|
89
|
+
onRelationAction?.({
|
|
90
|
+
action: "open",
|
|
91
|
+
fieldKey,
|
|
92
|
+
field,
|
|
93
|
+
value: void 0,
|
|
94
|
+
fullPaging: field.tags?.fullPaging,
|
|
95
|
+
onChange: context.onChange
|
|
96
|
+
});
|
|
97
|
+
}, [context.onChange, field, fieldKey, onRelationAction]);
|
|
98
|
+
return /* @__PURE__ */ jsxs(FieldWrapper, { children: [
|
|
99
|
+
/* @__PURE__ */ jsxs("label", { htmlFor: id, children: [
|
|
100
|
+
label,
|
|
101
|
+
" ",
|
|
102
|
+
required && "*"
|
|
103
|
+
] }),
|
|
104
|
+
onRelationAction ? /* @__PURE__ */ jsx(
|
|
105
|
+
"button",
|
|
106
|
+
{
|
|
107
|
+
"data-signifier": "manage",
|
|
108
|
+
type: "button",
|
|
109
|
+
disabled,
|
|
110
|
+
onClick: handleManageRelation,
|
|
111
|
+
children: "Manage"
|
|
112
|
+
}
|
|
113
|
+
) : void 0,
|
|
114
|
+
renderErrorMessage(context)
|
|
115
|
+
] });
|
|
116
|
+
};
|
|
117
|
+
var RelationArrayField = (context) => {
|
|
118
|
+
const { field, fieldKey, label, required, disabled, onRelationAction } = context;
|
|
119
|
+
const id = `field-${fieldKey}`;
|
|
120
|
+
const handleManageRelation = useCallback(() => {
|
|
121
|
+
onRelationAction?.({
|
|
122
|
+
action: "open",
|
|
123
|
+
fieldKey,
|
|
124
|
+
field,
|
|
125
|
+
value: void 0,
|
|
126
|
+
fullPaging: field.tags?.fullPaging,
|
|
127
|
+
onChange: context.onChange
|
|
128
|
+
});
|
|
129
|
+
}, [context.onChange, field, fieldKey, onRelationAction]);
|
|
130
|
+
return /* @__PURE__ */ jsxs(FieldWrapper, { children: [
|
|
131
|
+
/* @__PURE__ */ jsxs("label", { htmlFor: id, children: [
|
|
132
|
+
label,
|
|
133
|
+
" ",
|
|
134
|
+
required && "*"
|
|
135
|
+
] }),
|
|
136
|
+
onRelationAction ? /* @__PURE__ */ jsx(
|
|
137
|
+
"button",
|
|
138
|
+
{
|
|
139
|
+
"data-signifier": "manage-related",
|
|
140
|
+
type: "button",
|
|
141
|
+
disabled,
|
|
142
|
+
onClick: handleManageRelation,
|
|
143
|
+
children: "Manage"
|
|
144
|
+
}
|
|
145
|
+
) : void 0,
|
|
146
|
+
renderErrorMessage(context)
|
|
147
|
+
] });
|
|
148
|
+
};
|
|
149
|
+
var CustomSingleField = (context) => {
|
|
150
|
+
const { field, fieldKey, label, required, disabled } = context;
|
|
151
|
+
const id = `field-${fieldKey}`;
|
|
152
|
+
const customType = field.tags?.customType;
|
|
153
|
+
const onCustomTypeAction = context.onCustomTypeAction;
|
|
154
|
+
const handleManageCustomType = useCallback(() => {
|
|
155
|
+
if (!customType) {
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
onCustomTypeAction?.({
|
|
159
|
+
action: "open",
|
|
160
|
+
fieldKey,
|
|
161
|
+
field,
|
|
162
|
+
customType,
|
|
163
|
+
value: context.value,
|
|
164
|
+
onChange: context.onChange
|
|
165
|
+
});
|
|
166
|
+
}, [context.onChange, context.value, customType, field, fieldKey, onCustomTypeAction]);
|
|
167
|
+
return /* @__PURE__ */ jsxs(FieldWrapper, { children: [
|
|
168
|
+
/* @__PURE__ */ jsxs("label", { htmlFor: id, children: [
|
|
169
|
+
label,
|
|
170
|
+
" ",
|
|
171
|
+
required && "*"
|
|
172
|
+
] }),
|
|
173
|
+
/* @__PURE__ */ jsx(RelationValue, { children: formatCustomValue(context.value) }),
|
|
174
|
+
customType && onCustomTypeAction ? /* @__PURE__ */ jsx(
|
|
175
|
+
"button",
|
|
176
|
+
{
|
|
177
|
+
"data-signifier": "manage",
|
|
178
|
+
type: "button",
|
|
179
|
+
disabled,
|
|
180
|
+
onClick: handleManageCustomType,
|
|
181
|
+
children: "Manage"
|
|
182
|
+
}
|
|
183
|
+
) : void 0,
|
|
184
|
+
renderErrorMessage(context)
|
|
185
|
+
] });
|
|
186
|
+
};
|
|
187
|
+
var CustomArrayField = (context) => {
|
|
188
|
+
const { field, fieldKey, label, required, disabled } = context;
|
|
189
|
+
const id = `field-${fieldKey}`;
|
|
190
|
+
const customType = field.tags?.customType;
|
|
191
|
+
const onCustomTypeAction = context.onCustomTypeAction;
|
|
192
|
+
const arrayValue = Array.isArray(context.value) ? context.value : [];
|
|
193
|
+
const handleEditItem = useCallback((event) => {
|
|
194
|
+
if (!customType) {
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
const indexRaw = event.currentTarget.getAttribute("data-array-index");
|
|
198
|
+
if (!indexRaw) {
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
const index = Number(indexRaw);
|
|
202
|
+
if (!Number.isFinite(index)) {
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
onCustomTypeAction?.({
|
|
206
|
+
action: "edit",
|
|
207
|
+
fieldKey,
|
|
208
|
+
field,
|
|
209
|
+
customType,
|
|
210
|
+
value: context.value,
|
|
211
|
+
index,
|
|
212
|
+
onChange: context.onChange
|
|
213
|
+
});
|
|
214
|
+
}, [context.onChange, context.value, customType, field, fieldKey, onCustomTypeAction]);
|
|
215
|
+
const handleRemoveItem = useCallback((event) => {
|
|
216
|
+
if (!customType) {
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
const indexRaw = event.currentTarget.getAttribute("data-array-index");
|
|
220
|
+
if (!indexRaw) {
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
const index = Number(indexRaw);
|
|
224
|
+
if (!Number.isFinite(index)) {
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
onCustomTypeAction?.({
|
|
228
|
+
action: "remove",
|
|
229
|
+
fieldKey,
|
|
230
|
+
field,
|
|
231
|
+
customType,
|
|
232
|
+
value: context.value,
|
|
233
|
+
index,
|
|
234
|
+
onChange: context.onChange
|
|
235
|
+
});
|
|
236
|
+
}, [context.onChange, context.value, customType, field, fieldKey, onCustomTypeAction]);
|
|
237
|
+
const handleAddItem = useCallback(() => {
|
|
238
|
+
if (!customType) {
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
onCustomTypeAction?.({
|
|
242
|
+
action: "add",
|
|
243
|
+
fieldKey,
|
|
244
|
+
field,
|
|
245
|
+
customType,
|
|
246
|
+
value: context.value,
|
|
247
|
+
onChange: context.onChange
|
|
248
|
+
});
|
|
249
|
+
}, [context.onChange, context.value, customType, field, fieldKey, onCustomTypeAction]);
|
|
250
|
+
return /* @__PURE__ */ jsxs(FieldWrapper, { children: [
|
|
251
|
+
/* @__PURE__ */ jsxs("label", { htmlFor: id, children: [
|
|
252
|
+
label,
|
|
253
|
+
" ",
|
|
254
|
+
required && "*"
|
|
255
|
+
] }),
|
|
256
|
+
/* @__PURE__ */ jsxs(RelationList, { children: [
|
|
257
|
+
arrayValue.length === 0 && /* @__PURE__ */ jsx(RelationValue, { children: "No items yet." }),
|
|
258
|
+
arrayValue.map((item, index) => /* @__PURE__ */ jsxs(RelationItem, { children: [
|
|
259
|
+
/* @__PURE__ */ jsx(RelationValue, { children: formatCustomValue(item) }),
|
|
260
|
+
/* @__PURE__ */ jsxs(RelationActions, { children: [
|
|
261
|
+
customType && onCustomTypeAction ? /* @__PURE__ */ jsx(
|
|
262
|
+
"button",
|
|
263
|
+
{
|
|
264
|
+
"data-signifier": "manage",
|
|
265
|
+
"data-array-index": String(index),
|
|
266
|
+
type: "button",
|
|
267
|
+
disabled,
|
|
268
|
+
onClick: handleEditItem,
|
|
269
|
+
children: "Manage"
|
|
270
|
+
}
|
|
271
|
+
) : void 0,
|
|
272
|
+
customType && onCustomTypeAction ? /* @__PURE__ */ jsx(
|
|
273
|
+
"button",
|
|
274
|
+
{
|
|
275
|
+
type: "button",
|
|
276
|
+
"data-array-index": String(index),
|
|
277
|
+
disabled,
|
|
278
|
+
onClick: handleRemoveItem,
|
|
279
|
+
children: "Remove"
|
|
280
|
+
}
|
|
281
|
+
) : void 0
|
|
282
|
+
] })
|
|
283
|
+
] }, `${fieldKey}-${index}`))
|
|
284
|
+
] }),
|
|
285
|
+
customType && onCustomTypeAction ? /* @__PURE__ */ jsx(
|
|
286
|
+
"button",
|
|
287
|
+
{
|
|
288
|
+
type: "button",
|
|
289
|
+
disabled,
|
|
290
|
+
onClick: handleAddItem,
|
|
291
|
+
children: "Add Item"
|
|
292
|
+
}
|
|
293
|
+
) : void 0,
|
|
294
|
+
renderErrorMessage(context)
|
|
295
|
+
] });
|
|
296
|
+
};
|
|
297
|
+
var ArrayField = (context) => {
|
|
298
|
+
const { field, fieldKey, label, required, disabled } = context;
|
|
299
|
+
const id = `field-${fieldKey}`;
|
|
300
|
+
const itemField = createArrayItemField(field);
|
|
301
|
+
const arrayValue = Array.isArray(context.value) ? [...context.value] : [];
|
|
302
|
+
const handleRemoveArrayItem = useCallback((event) => {
|
|
303
|
+
const indexRaw = event.currentTarget.getAttribute("data-array-index");
|
|
304
|
+
if (!indexRaw) {
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
307
|
+
const index = Number(indexRaw);
|
|
308
|
+
if (!Number.isFinite(index)) {
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
const newValue = [...arrayValue];
|
|
312
|
+
newValue.splice(index, 1);
|
|
313
|
+
context.onChange(newValue);
|
|
314
|
+
}, [arrayValue, context]);
|
|
315
|
+
const handleAddArrayItem = useCallback(() => {
|
|
316
|
+
const baseValue = Array.isArray(context.value) ? context.value : [];
|
|
317
|
+
const newValue = [...baseValue];
|
|
318
|
+
const newItem = field.type === "number" ? 0 : field.type === "boolean" ? false : "";
|
|
319
|
+
newValue.push(newItem);
|
|
320
|
+
context.onChange(newValue);
|
|
321
|
+
}, [context, field.type]);
|
|
322
|
+
return /* @__PURE__ */ jsxs(FieldWrapper, { children: [
|
|
323
|
+
/* @__PURE__ */ jsxs("label", { htmlFor: id, children: [
|
|
324
|
+
label,
|
|
325
|
+
" ",
|
|
326
|
+
required && "*"
|
|
327
|
+
] }),
|
|
328
|
+
/* @__PURE__ */ jsxs(ArrayContainer, { children: [
|
|
329
|
+
arrayValue.map((item, index) => /* @__PURE__ */ jsxs(ArrayItemWrapper, { children: [
|
|
330
|
+
/* @__PURE__ */ jsx("div", { style: { flex: 1 }, children: context.renderField({
|
|
331
|
+
field: itemField,
|
|
332
|
+
fieldKey: `${fieldKey}[${index}]`,
|
|
333
|
+
value: item,
|
|
334
|
+
onChange: (newItem) => {
|
|
335
|
+
const newValue = [...arrayValue];
|
|
336
|
+
newValue[index] = newItem;
|
|
337
|
+
context.onChange(newValue);
|
|
338
|
+
},
|
|
339
|
+
errors: context.arrayItemErrorMap?.[index] ?? [],
|
|
340
|
+
error: context.arrayItemErrorMap?.[index]?.find(
|
|
341
|
+
(descriptor) => descriptor.code !== ERROR_MESSAGE_CONSTANTS.NONE
|
|
342
|
+
) ?? void 0,
|
|
343
|
+
translateValidationErrorCode: context.translateValidationErrorCode,
|
|
344
|
+
disabled
|
|
345
|
+
}) }),
|
|
346
|
+
/* @__PURE__ */ jsx(
|
|
347
|
+
"button",
|
|
348
|
+
{
|
|
349
|
+
type: "button",
|
|
350
|
+
"data-array-index": String(index),
|
|
351
|
+
disabled,
|
|
352
|
+
onClick: handleRemoveArrayItem,
|
|
353
|
+
children: "Remove"
|
|
354
|
+
}
|
|
355
|
+
)
|
|
356
|
+
] }, index)),
|
|
357
|
+
/* @__PURE__ */ jsx(
|
|
358
|
+
"button",
|
|
359
|
+
{
|
|
360
|
+
type: "button",
|
|
361
|
+
disabled,
|
|
362
|
+
onClick: handleAddArrayItem,
|
|
363
|
+
children: "Add Item"
|
|
364
|
+
}
|
|
365
|
+
)
|
|
366
|
+
] }),
|
|
367
|
+
renderErrorMessage(context)
|
|
368
|
+
] });
|
|
369
|
+
};
|
|
370
|
+
var StringField = (context) => {
|
|
371
|
+
const { fieldKey, label, required, disabled } = context;
|
|
372
|
+
const id = `field-${fieldKey}`;
|
|
373
|
+
const handleChange = useCallback((event) => {
|
|
374
|
+
context.onChange(event.target.value);
|
|
375
|
+
}, [context]);
|
|
376
|
+
return /* @__PURE__ */ jsxs(FieldWrapper, { children: [
|
|
377
|
+
/* @__PURE__ */ jsxs("label", { htmlFor: id, children: [
|
|
378
|
+
label,
|
|
379
|
+
" ",
|
|
380
|
+
required && "*"
|
|
381
|
+
] }),
|
|
382
|
+
/* @__PURE__ */ jsx(
|
|
383
|
+
"input",
|
|
384
|
+
{
|
|
385
|
+
id,
|
|
386
|
+
type: context.format || "text",
|
|
387
|
+
value: context.value || "",
|
|
388
|
+
onChange: handleChange,
|
|
389
|
+
disabled,
|
|
390
|
+
pattern: context.constraints?.pattern
|
|
391
|
+
}
|
|
392
|
+
),
|
|
393
|
+
renderErrorMessage(context)
|
|
394
|
+
] });
|
|
395
|
+
};
|
|
396
|
+
var NumberField = (context) => {
|
|
397
|
+
const { fieldKey, label, required, disabled } = context;
|
|
398
|
+
const id = `field-${fieldKey}`;
|
|
399
|
+
const handleChange = useCallback((event) => {
|
|
400
|
+
context.onChange(parseNumberValue(event.target.value));
|
|
401
|
+
}, [context]);
|
|
402
|
+
return /* @__PURE__ */ jsxs(FieldWrapper, { children: [
|
|
403
|
+
/* @__PURE__ */ jsxs("label", { htmlFor: id, children: [
|
|
404
|
+
label,
|
|
405
|
+
" ",
|
|
406
|
+
required && "*"
|
|
407
|
+
] }),
|
|
408
|
+
/* @__PURE__ */ jsx(
|
|
409
|
+
"input",
|
|
410
|
+
{
|
|
411
|
+
id,
|
|
412
|
+
type: "number",
|
|
413
|
+
value: context.value ?? "",
|
|
414
|
+
onChange: handleChange,
|
|
415
|
+
disabled,
|
|
416
|
+
min: context.constraints?.min,
|
|
417
|
+
max: context.constraints?.max,
|
|
418
|
+
step: context.constraints?.step
|
|
419
|
+
}
|
|
420
|
+
),
|
|
421
|
+
renderErrorMessage(context)
|
|
422
|
+
] });
|
|
423
|
+
};
|
|
424
|
+
var BooleanField = (context) => {
|
|
425
|
+
const { fieldKey, label, disabled } = context;
|
|
426
|
+
const id = `field-${fieldKey}`;
|
|
427
|
+
const handleChange = useCallback((event) => {
|
|
428
|
+
context.onChange(event.target.checked);
|
|
429
|
+
}, [context]);
|
|
430
|
+
return /* @__PURE__ */ jsxs(FieldWrapper, { children: [
|
|
431
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
432
|
+
/* @__PURE__ */ jsx(
|
|
433
|
+
"input",
|
|
434
|
+
{
|
|
435
|
+
id,
|
|
436
|
+
type: "checkbox",
|
|
437
|
+
checked: !!context.value,
|
|
438
|
+
onChange: handleChange,
|
|
439
|
+
disabled
|
|
440
|
+
}
|
|
441
|
+
),
|
|
442
|
+
/* @__PURE__ */ jsxs("label", { htmlFor: id, children: [
|
|
443
|
+
" ",
|
|
444
|
+
label,
|
|
445
|
+
" "
|
|
446
|
+
] })
|
|
447
|
+
] }),
|
|
448
|
+
renderErrorMessage(context)
|
|
449
|
+
] });
|
|
450
|
+
};
|
|
451
|
+
var EnumSelectField = (context) => {
|
|
452
|
+
const { field, fieldKey, label, required, disabled } = context;
|
|
453
|
+
const id = `field-${fieldKey}`;
|
|
454
|
+
const selectableValues = getSelectableValues(context.possibleValues);
|
|
455
|
+
const allowCustom = context.allowCustomSelection;
|
|
456
|
+
const handleCustomSelectionChange = useCallback(
|
|
457
|
+
(event) => {
|
|
458
|
+
context.onChange(
|
|
459
|
+
field.type === "number" ? parseNumberValue(event.target.value) : event.target.value
|
|
460
|
+
);
|
|
461
|
+
},
|
|
462
|
+
[context, field.type]
|
|
463
|
+
);
|
|
464
|
+
const handleSelectChange = useCallback(
|
|
465
|
+
(event) => {
|
|
466
|
+
context.onChange(
|
|
467
|
+
field.type === "number" ? parseNumberValue(event.target.value) : event.target.value
|
|
468
|
+
);
|
|
469
|
+
},
|
|
470
|
+
[context, field.type]
|
|
471
|
+
);
|
|
472
|
+
return /* @__PURE__ */ jsxs(FieldWrapper, { children: [
|
|
473
|
+
/* @__PURE__ */ jsxs("label", { htmlFor: id, children: [
|
|
474
|
+
label,
|
|
475
|
+
" ",
|
|
476
|
+
required && "*"
|
|
477
|
+
] }),
|
|
478
|
+
(field.type === "string" || field.type === "number") && selectableValues && allowCustom && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
479
|
+
/* @__PURE__ */ jsx(
|
|
480
|
+
"input",
|
|
481
|
+
{
|
|
482
|
+
id,
|
|
483
|
+
type: "text",
|
|
484
|
+
list: `list-${id}`,
|
|
485
|
+
value: context.value ?? "",
|
|
486
|
+
onChange: handleCustomSelectionChange,
|
|
487
|
+
placeholder: "Select or type...",
|
|
488
|
+
disabled
|
|
489
|
+
}
|
|
490
|
+
),
|
|
491
|
+
/* @__PURE__ */ jsx("datalist", { id: `list-${id}`, children: selectableValues.map((val) => /* @__PURE__ */ jsx("option", { value: toOptionValue(val) }, String(val))) })
|
|
492
|
+
] }),
|
|
493
|
+
(field.type === "string" || field.type === "number") && selectableValues && !allowCustom && /* @__PURE__ */ jsxs(
|
|
494
|
+
"select",
|
|
495
|
+
{
|
|
496
|
+
id,
|
|
497
|
+
value: context.value ?? "",
|
|
498
|
+
onChange: handleSelectChange,
|
|
499
|
+
disabled,
|
|
500
|
+
children: [
|
|
501
|
+
/* @__PURE__ */ jsx("option", { value: "", children: "Select..." }),
|
|
502
|
+
selectableValues.map((val) => /* @__PURE__ */ jsx("option", { value: toOptionValue(val), children: String(val) }, String(val)))
|
|
503
|
+
]
|
|
504
|
+
}
|
|
505
|
+
),
|
|
506
|
+
renderErrorMessage(context)
|
|
507
|
+
] });
|
|
508
|
+
};
|
|
509
|
+
var FormRoot = ({
|
|
510
|
+
children,
|
|
511
|
+
onSubmit
|
|
512
|
+
}) => {
|
|
513
|
+
const handleSubmit = (event) => {
|
|
514
|
+
event.preventDefault();
|
|
515
|
+
onSubmit?.();
|
|
516
|
+
};
|
|
517
|
+
return /* @__PURE__ */ jsx("form", { onSubmit: handleSubmit, children });
|
|
518
|
+
};
|
|
519
|
+
var SuiteButton = ({
|
|
520
|
+
children,
|
|
521
|
+
disabled,
|
|
522
|
+
type,
|
|
523
|
+
onClick,
|
|
524
|
+
"data-signifier": dataSignifier
|
|
525
|
+
}) => {
|
|
526
|
+
return createElement(
|
|
527
|
+
"button",
|
|
528
|
+
{
|
|
529
|
+
type: type ?? "button",
|
|
530
|
+
disabled,
|
|
531
|
+
onClick: type === "submit" ? void 0 : onClick,
|
|
532
|
+
"data-signifier": dataSignifier
|
|
533
|
+
},
|
|
534
|
+
children
|
|
535
|
+
);
|
|
536
|
+
};
|
|
537
|
+
var webSuite = {
|
|
538
|
+
renderers: {
|
|
539
|
+
string: StringField,
|
|
540
|
+
number: NumberField,
|
|
541
|
+
boolean: BooleanField,
|
|
542
|
+
enum_select: EnumSelectField,
|
|
543
|
+
array: ArrayField,
|
|
544
|
+
relation_single: RelationSingleField,
|
|
545
|
+
relation_array: RelationArrayField,
|
|
546
|
+
custom_single: CustomSingleField,
|
|
547
|
+
custom_array: CustomArrayField
|
|
548
|
+
},
|
|
549
|
+
primitives: {
|
|
550
|
+
FormRoot,
|
|
551
|
+
FieldWrapper,
|
|
552
|
+
ErrorMessage,
|
|
553
|
+
Label: ({ children, htmlFor }) => createElement("label", { htmlFor }, children),
|
|
554
|
+
Button: SuiteButton
|
|
555
|
+
}
|
|
556
|
+
};
|
|
557
|
+
var webAutoField = createFormRenderer({
|
|
558
|
+
fallbackSuite: webSuite
|
|
559
|
+
}).AutoField;
|
|
560
|
+
var RelationList = styled_default("div")`
|
|
561
|
+
display: flex;
|
|
562
|
+
flex-direction: column;
|
|
563
|
+
gap: 0.5em;
|
|
564
|
+
margin-bottom: 0.5em;
|
|
565
|
+
`;
|
|
566
|
+
var RelationItem = styled_default("div")`
|
|
567
|
+
display: flex;
|
|
568
|
+
flex-direction: column;
|
|
569
|
+
gap: 0.5em;
|
|
570
|
+
padding: 0.5em;
|
|
571
|
+
`;
|
|
572
|
+
var RelationValue = styled_default("pre")`
|
|
573
|
+
margin: 0;
|
|
574
|
+
padding: 0.5em;
|
|
575
|
+
font-size: 0.85em;
|
|
576
|
+
white-space: pre-wrap;
|
|
577
|
+
`;
|
|
578
|
+
var RelationActions = styled_default("div")`
|
|
579
|
+
display: flex;
|
|
580
|
+
gap: 0.5em;
|
|
581
|
+
flex-wrap: wrap;
|
|
582
|
+
`;
|
|
583
|
+
|
|
584
|
+
// src/web/forms/createWebFormRenderer.ts
|
|
585
|
+
var createWebFormRenderer = (options) => {
|
|
586
|
+
return createFormRenderer({
|
|
587
|
+
fallbackSuite: webSuite,
|
|
588
|
+
suite: options?.suite
|
|
589
|
+
});
|
|
590
|
+
};
|
|
591
|
+
var defaultWebRenderer = createWebFormRenderer();
|
|
592
|
+
var AutoField = (props) => {
|
|
593
|
+
return createElement(webAutoField, {
|
|
594
|
+
field: props.field,
|
|
595
|
+
fieldKey: props.fieldKey,
|
|
596
|
+
value: props.value,
|
|
597
|
+
onChange: props.onChange,
|
|
598
|
+
error: props.error,
|
|
599
|
+
errors: props.errors,
|
|
600
|
+
arrayItemErrorMap: props.arrayItemErrorMap,
|
|
601
|
+
translateValidationErrorCode: props.translateValidationErrorCode,
|
|
602
|
+
disabled: props.disabled,
|
|
603
|
+
onRelationAction: props.onRelationAction,
|
|
604
|
+
onCustomTypeAction: props.onCustomTypeAction
|
|
605
|
+
});
|
|
606
|
+
};
|
|
607
|
+
var AutoFormView2 = (props) => {
|
|
608
|
+
return /* @__PURE__ */ jsx(AutoFormView, { ...props, renderer: defaultWebRenderer });
|
|
609
|
+
};
|
|
610
|
+
var AutoForm2 = (props) => {
|
|
611
|
+
return /* @__PURE__ */ jsx(AutoForm, { ...props, renderer: defaultWebRenderer });
|
|
612
|
+
};
|
|
613
|
+
var EasyLayoutBase = styled_default("div")`
|
|
614
|
+
display: grid;
|
|
615
|
+
${({ $layoutCss }) => $layoutCss}
|
|
616
|
+
`;
|
|
617
|
+
var EasyAreaBase = styled_default("div")`
|
|
618
|
+
grid-area: ${({ $area }) => $area};
|
|
619
|
+
`;
|
|
620
|
+
var styledFactory = {
|
|
621
|
+
createLayout: ({ base, css }) => {
|
|
622
|
+
const LayoutComponent = ({ children }) => {
|
|
623
|
+
const layoutProps = {
|
|
624
|
+
$layoutCss: css,
|
|
625
|
+
children
|
|
626
|
+
};
|
|
627
|
+
if (base) {
|
|
628
|
+
layoutProps.as = base;
|
|
629
|
+
}
|
|
630
|
+
return /* @__PURE__ */ jsx(EasyLayoutBase, { ...layoutProps });
|
|
631
|
+
};
|
|
632
|
+
return LayoutComponent;
|
|
633
|
+
},
|
|
634
|
+
createArea: ({ base, area }) => {
|
|
635
|
+
const AreaComponent = ({ children }) => {
|
|
636
|
+
const areaProps = {
|
|
637
|
+
$area: area,
|
|
638
|
+
children
|
|
639
|
+
};
|
|
640
|
+
if (base) {
|
|
641
|
+
areaProps.as = base;
|
|
642
|
+
}
|
|
643
|
+
return /* @__PURE__ */ jsx(EasyAreaBase, { ...areaProps });
|
|
644
|
+
};
|
|
645
|
+
return AreaComponent;
|
|
646
|
+
}
|
|
647
|
+
};
|
|
648
|
+
var getEasyLayout = (extendFrom, areasExtendFrom, options = {}) => {
|
|
649
|
+
return createEasyLayout(styledFactory, extendFrom, areasExtendFrom, options);
|
|
650
|
+
};
|
|
651
|
+
var Route2 = (props) => {
|
|
652
|
+
const hasMatcherProps = typeof props.path !== "undefined" || typeof props.exact !== "undefined" || typeof props.onParamsChange !== "undefined";
|
|
653
|
+
const adapterRef = useRef(null);
|
|
654
|
+
const shouldUseAutoBrowserAdapter = !hasMatcherProps && typeof props.adapter === "undefined" && typeof props.ingress === "undefined";
|
|
655
|
+
const routeProps = props;
|
|
656
|
+
if (shouldUseAutoBrowserAdapter && !adapterRef.current) {
|
|
657
|
+
adapterRef.current = createBrowserRouteAdapter();
|
|
658
|
+
}
|
|
659
|
+
return shouldUseAutoBrowserAdapter ? /* @__PURE__ */ jsx(
|
|
660
|
+
Route,
|
|
661
|
+
{
|
|
662
|
+
...routeProps,
|
|
663
|
+
adapter: adapterRef.current ?? void 0
|
|
664
|
+
}
|
|
665
|
+
) : /* @__PURE__ */ jsx(Route, { ...routeProps });
|
|
666
|
+
};
|
|
667
|
+
|
|
668
|
+
export { ArrayContainer, ArrayItemWrapper, AutoField, AutoForm2 as AutoForm, AutoFormView2 as AutoFormView, ErrorMessage, FieldWrapper, Route2 as Route, createWebFormRenderer, getEasyLayout, webAutoField, webSuite };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { type EasyLayoutSpacing, type FCWithChildren, type LayoutComponents } from "../../app/utils/EasyLayout";
|
|
2
|
+
/**
|
|
3
|
+
* Quickly express advanced, extensible grid layouts with styled-components.
|
|
4
|
+
* Template syntax:
|
|
5
|
+
* - Row lines: `<area area ...>, <track>`
|
|
6
|
+
* - Optional column line: `\\ <track> <track> ...`
|
|
7
|
+
*
|
|
8
|
+
* Supported track units are `fr`, `px`, and `%`.
|
|
9
|
+
* Parsing and area-shape validation are shared from the app EasyLayout core.
|
|
10
|
+
* On web, final pixel distribution is resolved by the browser CSS Grid engine.
|
|
11
|
+
* Optional spacing (`gap`, `padding`) can be provided in `options`.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```tsx
|
|
15
|
+
* const {
|
|
16
|
+
* layout: Container,
|
|
17
|
+
* areas: {
|
|
18
|
+
* Header,
|
|
19
|
+
* Side,
|
|
20
|
+
* Main,
|
|
21
|
+
* Footer,
|
|
22
|
+
* },
|
|
23
|
+
* } = getEasyLayout(styled.div)`
|
|
24
|
+
* header header header, 1fr
|
|
25
|
+
* side main main, 5fr
|
|
26
|
+
* footer footer footer, 1fr
|
|
27
|
+
* \\ 1fr 1fr 1fr
|
|
28
|
+
* `;
|
|
29
|
+
*
|
|
30
|
+
* const App = () => {
|
|
31
|
+
* return (
|
|
32
|
+
* <Container>
|
|
33
|
+
* <Header>Header Content</Header>
|
|
34
|
+
* <Side>Side Content</Side>
|
|
35
|
+
* <Main>Main Content</Main>
|
|
36
|
+
* <Footer>Footer Content</Footer>
|
|
37
|
+
* </Container>
|
|
38
|
+
* );
|
|
39
|
+
* };
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @param extendFrom - Base component to extend for the layout container.
|
|
43
|
+
* @param areasExtendFrom - Base component to extend for each area component.
|
|
44
|
+
* @param options - Optional layout spacing (`gap`, `padding`).
|
|
45
|
+
* @returns Tagged template function that builds layout components.
|
|
46
|
+
* */
|
|
47
|
+
export declare const getEasyLayout: (extendFrom?: FCWithChildren, areasExtendFrom?: FCWithChildren, options?: EasyLayoutSpacing) => ((layoutTemplate: TemplateStringsArray, ...expressions: any[]) => LayoutComponents);
|