@ostack.tech/ui-kform-scaffolder 0.16.2 → 0.16.4
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/ostack-ui-kform-scaffolder.js +162 -133
- package/dist/ostack-ui-kform-scaffolder.js.map +1 -1
- package/dist/webapp/assets/{index-yfjDU8MC.js → index-ChNcDT7a.js} +116 -195
- package/dist/webapp/index.html +1 -1
- package/package.json +1 -1
- package/types/SchematicKind.d.ts +1 -0
- package/types/index.d.ts +0 -1
- package/types/scaffolding/reactApp/ReactAppData.d.ts +1 -1
- package/types/scaffolding/scaffolders/scaffoldAppComponent.d.ts +1 -1
- package/types/scaffolding/scaffolders/scaffoldActions.d.ts +0 -3
|
@@ -58,34 +58,6 @@ function UseTableValuesSerializerConfig({ disabled }) {
|
|
|
58
58
|
return /* @__PURE__ */ jsx(UseTableValuesSerializerConfig$1, { disabled: disabled || serializationFormatConfig === "xml" });
|
|
59
59
|
}
|
|
60
60
|
//#endregion
|
|
61
|
-
//#region src/scaffolding/templates/react-app/src/actions/Load.tsx.ejs?raw
|
|
62
|
-
var Load_tsx_default = "import { LoadAction } from \"@ostack.tech/ui-kform\";\nimport { decode<%= formClass %>FromString, <%= formClass %>FormMode } from \"<%= kmpModuleName %>\";\nimport { use<%= formClass %>Context } from \"../<%= formClass %>Context.ts\";\n\nexport function Load() {\n const { externalContexts } = use<%= formClass %>Context();\n\n return (\n externalContexts.mode !== <%= formClass %>FormMode.READ && (\n <LoadAction\n decode={async (file) => decode<%= formClass %>FromString(await file.text())}\n mimeTypes={[\"<%= serializationMimeType %>\"]}\n extensions={[\".<%= serializationFormat %>\"]}\n />\n )\n );\n}\n";
|
|
63
|
-
//#endregion
|
|
64
|
-
//#region src/scaffolding/templates/react-app/src/actions/Save.tsx.ejs?raw
|
|
65
|
-
var Save_tsx_default = "import { SaveAction } from \"@ostack.tech/ui-kform\";\nimport { type <%= formClass %>, encode<%= formClass %>ToString, <%= formClass %>FormMode } from \"<%= kmpModuleName %>\";\nimport { use<%= formClass %>Context } from \"../<%= formClass %>Context.ts\";\n\nexport function Save() {\n const { externalContexts } = use<%= formClass %>Context();\n\n return (\n <SaveAction\n encode={(<%= formVar %>: <%= formClass %>) => encode<%= formClass %>ToString(<%= formVar %>, true)}\n disableOverwrite={externalContexts.mode === <%= formClass %>FormMode.READ}\n mimeTypes={[\"<%= serializationMimeType %>\"]}\n extensions={[\".<%= serializationFormat %>\"]}\n />\n );\n}\n";
|
|
66
|
-
//#endregion
|
|
67
|
-
//#region src/scaffolding/templates/react-app/src/actions/Submit.tsx.ejs?raw
|
|
68
|
-
var Submit_tsx_default = "import { LocatedValidationWarning } from \"@ostack.tech/kform\";\nimport { SubmitAction } from \"@ostack.tech/ui-kform\";\nimport {\n type <%= formClass %>,\n <%= formClass %>FormMode,\n <%= formClass %>SubmitSuccess,\n <%= formClass %>SubmitValidationError,\n <%= formClass %>SubmitError,\n} from \"<%= kmpModuleName %>\";\nimport { use<%= formClass %>Context } from \"../<%= formClass %>Context.ts\";\nimport { submit } from \"../api/submit.ts\";\n\nexport function Submit() {\n const { externalContexts } = use<%= formClass %>Context();\n\n const handleSubmit = async (\n <%= formVar %>: <%= formClass %>,\n acceptedWarnings?: LocatedValidationWarning[],\n ) => {\n const response = await submit(<%= formVar %>, acceptedWarnings);\n if (response instanceof <%= formClass %>SubmitSuccess) {\n return response.redirectTo;\n } else if (response instanceof <%= formClass %>SubmitValidationError) {\n return response.issues;\n } else {\n throw response as <%= formClass %>SubmitError;\n }\n };\n\n const handleSuccessfulSubmit = (redirectTo: string) => {\n window.location.href = redirectTo;\n };\n\n return (\n externalContexts.mode !== <%= formClass %>FormMode.READ && (\n <SubmitAction\n onSubmit={handleSubmit}\n onSuccessfulSubmit={handleSuccessfulSubmit}\n <%_ if (useTableValuesSerializer) { -%>\n convertExternalIssuesTableRowIndicesToIds\n <%_ } -%>\n />\n )\n );\n}\n";
|
|
69
|
-
//#endregion
|
|
70
|
-
//#region src/scaffolding/templates/react-app/src/actions/Validate.tsx.ejs?raw
|
|
71
|
-
var Validate_tsx_default = "import { ValidateAction } from \"@ostack.tech/ui-kform\";\nimport { <%= formClass %>FormMode } from \"<%= kmpModuleName %>\";\nimport { use<%= formClass %>Context } from \"../<%= formClass %>Context.ts\";\n\nexport function Validate() {\n const { externalContexts } = use<%= formClass %>Context();\n\n return externalContexts.mode !== <%= formClass %>FormMode.READ && <ValidateAction />;\n}\n";
|
|
72
|
-
//#endregion
|
|
73
|
-
//#region src/scaffolding/scaffolders/scaffoldActions.ts
|
|
74
|
-
function scaffoldActions(schematic, data) {
|
|
75
|
-
const ejsData = {
|
|
76
|
-
kmpModuleName: data.kmpModuleName ?? `${kebabCase(schematic.name)}-shared`,
|
|
77
|
-
serializationFormat: data.serializationFormat ?? "json",
|
|
78
|
-
serializationMimeType: `application/${data.serializationFormat}`,
|
|
79
|
-
formVar: camelCase(schematic.name),
|
|
80
|
-
formClass: schematic.name,
|
|
81
|
-
useTableValuesSerializer: data.useTableValuesSerializer
|
|
82
|
-
};
|
|
83
|
-
addEjsTemplateFile(data, "actions/Load.tsx", Load_tsx_default, ejsData);
|
|
84
|
-
addEjsTemplateFile(data, "actions/Save.tsx", Save_tsx_default, ejsData);
|
|
85
|
-
addEjsTemplateFile(data, "actions/Submit.tsx", Submit_tsx_default, ejsData);
|
|
86
|
-
addEjsTemplateFile(data, "actions/Validate.tsx", Validate_tsx_default, ejsData);
|
|
87
|
-
}
|
|
88
|
-
//#endregion
|
|
89
61
|
//#region src/scaffolding/templates/react-app/src/api/apiFetch.ts.ejs?raw
|
|
90
62
|
var apiFetch_ts_default = "const API_BASE_URL = new URL(\"<%= apiBasePath %>\", window.location.origin);\n\n/**\n * Wrapper around `fetch` for accessing the API.\n *\n * Configuration common to all API requests should be set here.\n */\nexport function apiFetch(url: string | URL, init?: RequestInit) {\n return fetch(new URL(url, API_BASE_URL), init);\n}\n";
|
|
91
63
|
//#endregion
|
|
@@ -188,11 +160,6 @@ function scaffoldPageComponentDeclarations(schematic, data) {
|
|
|
188
160
|
function scaffoldField(schematic, data) {
|
|
189
161
|
const schematicKind = data.schematicKinds.get(schematic.kind);
|
|
190
162
|
if (!schematicKind) throw new Error(`Unknown schematic kind ${schematic.kind}`);
|
|
191
|
-
if (schematicKind.scaffoldField) return schematicKind.scaffoldField?.(schematic, data);
|
|
192
|
-
data.currentFile.imports.push({
|
|
193
|
-
moduleName: "@ostack.tech/ui-kform",
|
|
194
|
-
name: "ControlField"
|
|
195
|
-
});
|
|
196
163
|
let controlModuleName;
|
|
197
164
|
let controlName;
|
|
198
165
|
if (schematicKind.control) {
|
|
@@ -205,17 +172,25 @@ function scaffoldField(schematic, data) {
|
|
|
205
172
|
});
|
|
206
173
|
}
|
|
207
174
|
let control = schematicKind.scaffoldControl?.(schematic, data);
|
|
208
|
-
if (!control) {
|
|
209
|
-
|
|
175
|
+
if (!control) control = `<${controlName} path="${data.currentPath}" />`;
|
|
176
|
+
if (data.omitField) return control;
|
|
177
|
+
if (schematicKind.scaffoldField) return schematicKind.scaffoldField?.(schematic, data);
|
|
178
|
+
data.currentFile.imports.push({
|
|
179
|
+
moduleName: "@ostack.tech/ui",
|
|
180
|
+
name: "Field"
|
|
181
|
+
});
|
|
182
|
+
let label;
|
|
183
|
+
if (!schematicKind.omitFieldLabel) {
|
|
184
|
+
data.currentFile.imports.push({
|
|
210
185
|
moduleName: "@ostack.tech/ui",
|
|
211
186
|
name: "Label"
|
|
212
187
|
});
|
|
213
|
-
|
|
188
|
+
label = `<Label>${sentenceCase(schematic.childName)}</Label>`;
|
|
214
189
|
}
|
|
215
190
|
return code`
|
|
216
|
-
<
|
|
217
|
-
${control}
|
|
218
|
-
</
|
|
191
|
+
<Field>
|
|
192
|
+
${[label, control].filter((s) => s).join("\n")}
|
|
193
|
+
</Field>
|
|
219
194
|
`;
|
|
220
195
|
}
|
|
221
196
|
//#endregion
|
|
@@ -256,7 +231,8 @@ var bigIntegerSchematicKind = {
|
|
|
256
231
|
var booleanSchematicKind = {
|
|
257
232
|
...booleanSchematicKind$1,
|
|
258
233
|
control: "@ostack.tech/ui-kform.CheckboxControl",
|
|
259
|
-
|
|
234
|
+
omitFieldLabel: true,
|
|
235
|
+
scaffoldControl: (schematic, data) => data.omitField ? `<CheckboxControl path="${data.currentPath}" />` : `<CheckboxControl path="${data.currentPath}">${sentenceCase(schematic.childName)}</CheckboxControl>`
|
|
260
236
|
};
|
|
261
237
|
var byteSchematicKind = {
|
|
262
238
|
...byteSchematicKind$1,
|
|
@@ -357,21 +333,19 @@ var enumSelectSchematicKind = {
|
|
|
357
333
|
kind: "Enum (Select)",
|
|
358
334
|
control: "@ostack.tech/ui-kform.SelectControl",
|
|
359
335
|
scaffoldControl: (schematic, data) => {
|
|
360
|
-
if (!data.omitLabel) data.currentFile.imports.push({
|
|
361
|
-
moduleName: "@ostack.tech/ui",
|
|
362
|
-
name: "Label"
|
|
363
|
-
});
|
|
364
336
|
data.currentFile.imports.push({
|
|
365
337
|
moduleName: data.kmpModuleName,
|
|
366
338
|
name: schematic.name
|
|
367
339
|
});
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
340
|
+
if (schematic.children.length > 0) data.currentFile.imports.push({
|
|
341
|
+
moduleName: "@ostack.tech/ui-kform",
|
|
342
|
+
name: "SelectControlItem"
|
|
343
|
+
});
|
|
344
|
+
return code`
|
|
345
|
+
<SelectControl path="${data.currentPath}">
|
|
346
|
+
${schematic.children.map((child) => `<SelectControlItem value={${schematic.name}.${child.childName}}>${sentenceCase(child.childName)}</SelectControlItem>`).join("\n")}
|
|
347
|
+
</SelectControl>
|
|
348
|
+
`;
|
|
375
349
|
}
|
|
376
350
|
};
|
|
377
351
|
var enumRadioGroupSchematicKind = {
|
|
@@ -379,21 +353,19 @@ var enumRadioGroupSchematicKind = {
|
|
|
379
353
|
kind: "Enum (RadioGroup)",
|
|
380
354
|
control: "@ostack.tech/ui-kform.RadioGroupControl",
|
|
381
355
|
scaffoldControl: (schematic, data) => {
|
|
382
|
-
if (!data.omitLabel) data.currentFile.imports.push({
|
|
383
|
-
moduleName: "@ostack.tech/ui",
|
|
384
|
-
name: "Label"
|
|
385
|
-
});
|
|
386
356
|
data.currentFile.imports.push({
|
|
387
357
|
moduleName: data.kmpModuleName,
|
|
388
358
|
name: schematic.name
|
|
389
359
|
});
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
360
|
+
if (schematic.children.length > 0) data.currentFile.imports.push({
|
|
361
|
+
moduleName: "@ostack.tech/ui-kform",
|
|
362
|
+
name: "RadioGroupControlItem"
|
|
363
|
+
});
|
|
364
|
+
return code`
|
|
365
|
+
<RadioGroupControl path="${data.currentPath}">
|
|
366
|
+
${schematic.children.map((child) => `<RadioGroupControlItem value={${schematic.name}.${child.childName}}>${sentenceCase(child.childName)}</RadioGroupControlItem>`).join("\n")}
|
|
367
|
+
</RadioGroupControl>
|
|
368
|
+
`;
|
|
397
369
|
}
|
|
398
370
|
};
|
|
399
371
|
var fileSchematicKind = {
|
|
@@ -424,21 +396,19 @@ var listCheckboxGroupSchematicKind = {
|
|
|
424
396
|
scaffoldControl: (schematic, data) => {
|
|
425
397
|
const childSchematic = schematic.children[0];
|
|
426
398
|
if (childSchematic.kind !== "Enum") throw new Error("Invalid child kind.");
|
|
427
|
-
if (!data.omitLabel) data.currentFile.imports.push({
|
|
428
|
-
moduleName: "@ostack.tech/ui",
|
|
429
|
-
name: "Label"
|
|
430
|
-
});
|
|
431
399
|
data.currentFile.imports.push({
|
|
432
400
|
moduleName: data.kmpModuleName,
|
|
433
401
|
name: childSchematic.name
|
|
434
402
|
});
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
403
|
+
if (childSchematic.children.length > 0) data.currentFile.imports.push({
|
|
404
|
+
moduleName: "@ostack.tech/ui-kform",
|
|
405
|
+
name: "CheckboxGroupControlItem"
|
|
406
|
+
});
|
|
407
|
+
return code`
|
|
408
|
+
<CheckboxGroupControl path="${data.currentPath}">
|
|
409
|
+
${childSchematic.children.map((child) => `<CheckboxGroupControlItem value={${childSchematic.name}.${child.childName}}>${sentenceCase(child.childName)}</CheckboxGroupControlItem>`).join("\n")}
|
|
410
|
+
</CheckboxGroupControl>
|
|
411
|
+
`;
|
|
442
412
|
}
|
|
443
413
|
};
|
|
444
414
|
var listSelectMultipleSchematicKind = {
|
|
@@ -456,21 +426,19 @@ var listSelectMultipleSchematicKind = {
|
|
|
456
426
|
scaffoldControl: (schematic, data) => {
|
|
457
427
|
const childSchematic = schematic.children[0];
|
|
458
428
|
if (childSchematic.kind !== "Enum") throw new Error("Invalid child kind.");
|
|
459
|
-
if (!data.omitLabel) data.currentFile.imports.push({
|
|
460
|
-
moduleName: "@ostack.tech/ui",
|
|
461
|
-
name: "Label"
|
|
462
|
-
});
|
|
463
429
|
data.currentFile.imports.push({
|
|
464
430
|
moduleName: data.kmpModuleName,
|
|
465
431
|
name: childSchematic.name
|
|
466
432
|
});
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
433
|
+
if (childSchematic.children.length > 0) data.currentFile.imports.push({
|
|
434
|
+
moduleName: "@ostack.tech/ui-kform",
|
|
435
|
+
name: "SelectMultipleControlItem"
|
|
436
|
+
});
|
|
437
|
+
return code`
|
|
438
|
+
<SelectMultipleControl path="${data.currentPath}">
|
|
439
|
+
${childSchematic.children.map((child) => `<SelectMultipleControlItem value={${childSchematic.name}.${child.childName}}>${sentenceCase(child.childName)}</SelectMultipleControlItem>`).join("\n")}
|
|
440
|
+
</SelectMultipleControl>
|
|
441
|
+
`;
|
|
474
442
|
}
|
|
475
443
|
};
|
|
476
444
|
var localDateSchematicKind = {
|
|
@@ -523,6 +491,7 @@ var tableSchematicKind = {
|
|
|
523
491
|
})],
|
|
524
492
|
propertyAnnotations: tableAnnexesSchematicKind.propertyAnnotations,
|
|
525
493
|
control: "@ostack.tech/ui-kform.TableControl",
|
|
494
|
+
omitFieldLabel: true,
|
|
526
495
|
scaffoldControl: (schematic, data) => {
|
|
527
496
|
const rowSchematic = schematic.children[0];
|
|
528
497
|
if (rowSchematic.kind !== "Class") throw new Error("Table child schematic is not of Class kind.");
|
|
@@ -531,10 +500,13 @@ var tableSchematicKind = {
|
|
|
531
500
|
name: "Label"
|
|
532
501
|
}, {
|
|
533
502
|
moduleName: "@ostack.tech/ui-kform",
|
|
534
|
-
name: "
|
|
503
|
+
name: "TableControlColumns"
|
|
535
504
|
}, {
|
|
536
505
|
moduleName: "@ostack.tech/ui-kform",
|
|
537
|
-
name: "
|
|
506
|
+
name: "TableControlIndexColumn"
|
|
507
|
+
}, {
|
|
508
|
+
moduleName: "@ostack.tech/ui-kform",
|
|
509
|
+
name: "TableControlActionsColumn"
|
|
538
510
|
}, {
|
|
539
511
|
moduleName: "@ostack.tech/ui-kform",
|
|
540
512
|
name: "TableControlAddRowTrigger"
|
|
@@ -542,25 +514,27 @@ var tableSchematicKind = {
|
|
|
542
514
|
moduleName: "@ostack.tech/ui-kform",
|
|
543
515
|
name: "TableControlContent"
|
|
544
516
|
});
|
|
517
|
+
if (rowSchematic.children.length > 0) data.currentFile.imports.push({
|
|
518
|
+
moduleName: "@ostack.tech/ui-kform",
|
|
519
|
+
name: "TableControlColumn"
|
|
520
|
+
});
|
|
545
521
|
return code`
|
|
546
|
-
<TableControl
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
${rowSchematic.children.map((child) =>
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
]}
|
|
563
|
-
>
|
|
522
|
+
<TableControl path="${data.currentPath}">
|
|
523
|
+
<TableControlColumns>
|
|
524
|
+
<TableControlIndexColumn />
|
|
525
|
+
${rowSchematic.children.map((child) => {
|
|
526
|
+
return code`
|
|
527
|
+
<TableControlColumn label=${JSON.stringify(sentenceCase(child.childName))}>
|
|
528
|
+
${scaffoldField(child, {
|
|
529
|
+
...data,
|
|
530
|
+
omitField: true,
|
|
531
|
+
currentPath: child.childName
|
|
532
|
+
})}
|
|
533
|
+
</TableControlColumn>
|
|
534
|
+
`;
|
|
535
|
+
}).join("\n")},
|
|
536
|
+
<TableControlActionsColumn />
|
|
537
|
+
</TableControlColumns>
|
|
564
538
|
<Label>${sentenceCase(schematic.childName)}</Label>
|
|
565
539
|
<TableControlAddRowTrigger />
|
|
566
540
|
<TableControlContent />
|
|
@@ -715,16 +689,12 @@ function scaffoldAppComponentFile(schematic, data) {
|
|
|
715
689
|
[externalContexts],
|
|
716
690
|
)}
|
|
717
691
|
readOnly={externalContexts.mode === ${schematic.name}FormMode.READ}
|
|
718
|
-
validationMode={
|
|
719
|
-
externalContexts.mode === ${schematic.name}FormMode.READ
|
|
720
|
-
? "manual"
|
|
721
|
-
: "auto"
|
|
722
|
-
}
|
|
723
692
|
formTitle="${capitalCase(schematic.name)}"
|
|
724
693
|
activePath={activePath}
|
|
725
694
|
onActivePathChange={setActivePath}${issueMessagesProp}
|
|
726
695
|
defaultLocale={${localeVar}}
|
|
727
696
|
reportError={reportError}
|
|
697
|
+
debug={import.meta.env.DEV}
|
|
728
698
|
>
|
|
729
699
|
${scaffoldAppLayout(schematic, data)}
|
|
730
700
|
|
|
@@ -737,7 +707,7 @@ function scaffoldAppComponentFile(schematic, data) {
|
|
|
737
707
|
function scaffoldAppLayout(schematic, data, scaffoldTopBarFn = scaffoldTopBar) {
|
|
738
708
|
const layout = reactAppLayout(schematic, data);
|
|
739
709
|
if (layout.length === 1 && layout[0].data.currentPath === "/") return code`
|
|
740
|
-
${scaffoldTopBarFn(data)}
|
|
710
|
+
${scaffoldTopBarFn(schematic, data)}
|
|
741
711
|
|
|
742
712
|
${scaffoldFormPages(data, layout[0])}
|
|
743
713
|
`;
|
|
@@ -750,41 +720,101 @@ function scaffoldAppLayout(schematic, data, scaffoldTopBarFn = scaffoldTopBar) {
|
|
|
750
720
|
});
|
|
751
721
|
return code`
|
|
752
722
|
<Annexes>
|
|
753
|
-
${scaffoldTopBarFn(data, "<AnnexesManager />")}
|
|
723
|
+
${scaffoldTopBarFn(schematic, data, "<AnnexesManager />")}
|
|
754
724
|
|
|
755
725
|
${layout.map((annex) => scaffoldAnnex(data, annex)).join("\n\n")}
|
|
756
726
|
</Annexes>
|
|
757
727
|
`;
|
|
758
728
|
}
|
|
759
|
-
function scaffoldTopBar(data, annexesManager) {
|
|
729
|
+
function scaffoldTopBar(schematic, data, annexesManager) {
|
|
760
730
|
data.currentFile.imports.push({
|
|
761
731
|
moduleName: "@ostack.tech/ui-kform",
|
|
762
732
|
name: "TopBar"
|
|
763
733
|
}, {
|
|
764
734
|
moduleName: "@ostack.tech/ui-kform",
|
|
765
735
|
name: "TopBarActions"
|
|
736
|
+
});
|
|
737
|
+
return code`
|
|
738
|
+
<TopBar>${annexesManager ? `\n ${annexesManager}\n` : ""}
|
|
739
|
+
<TopBarActions>
|
|
740
|
+
${scaffoldActions(schematic, data)}
|
|
741
|
+
</TopBarActions>
|
|
742
|
+
</TopBar>;
|
|
743
|
+
`;
|
|
744
|
+
}
|
|
745
|
+
function scaffoldActions(schematic, data) {
|
|
746
|
+
const formClass = schematic.name;
|
|
747
|
+
const formVar = camelCase(formClass);
|
|
748
|
+
const serializationFormat = data.serializationFormat ?? "json";
|
|
749
|
+
const serializationMimeType = `application/${data.serializationFormat}`;
|
|
750
|
+
data.currentFile.imports.push({
|
|
751
|
+
moduleName: "@ostack.tech/kform",
|
|
752
|
+
name: "LocatedValidationWarning"
|
|
753
|
+
}, {
|
|
754
|
+
moduleName: "@ostack.tech/ui-kform",
|
|
755
|
+
name: "LoadAction"
|
|
756
|
+
}, {
|
|
757
|
+
moduleName: "@ostack.tech/ui-kform",
|
|
758
|
+
name: "SaveAction"
|
|
759
|
+
}, {
|
|
760
|
+
moduleName: "@ostack.tech/ui-kform",
|
|
761
|
+
name: "ValidateAction"
|
|
762
|
+
}, {
|
|
763
|
+
moduleName: "@ostack.tech/ui-kform",
|
|
764
|
+
name: "SubmitAction"
|
|
765
|
+
}, {
|
|
766
|
+
moduleName: data.kmpModuleName,
|
|
767
|
+
name: formClass,
|
|
768
|
+
isType: true
|
|
769
|
+
}, {
|
|
770
|
+
moduleName: data.kmpModuleName,
|
|
771
|
+
name: `decode${formClass}FromString`
|
|
766
772
|
}, {
|
|
767
|
-
moduleName:
|
|
768
|
-
name:
|
|
773
|
+
moduleName: data.kmpModuleName,
|
|
774
|
+
name: `encode${formClass}ToString`
|
|
769
775
|
}, {
|
|
770
|
-
moduleName:
|
|
771
|
-
name:
|
|
776
|
+
moduleName: data.kmpModuleName,
|
|
777
|
+
name: `${formClass}SubmitSuccess`
|
|
772
778
|
}, {
|
|
773
|
-
moduleName:
|
|
774
|
-
name:
|
|
779
|
+
moduleName: data.kmpModuleName,
|
|
780
|
+
name: `${formClass}SubmitValidationError`
|
|
775
781
|
}, {
|
|
776
|
-
moduleName:
|
|
777
|
-
name:
|
|
782
|
+
moduleName: data.kmpModuleName,
|
|
783
|
+
name: `${formClass}SubmitError`
|
|
784
|
+
}, {
|
|
785
|
+
moduleName: "./api/submit.ts",
|
|
786
|
+
name: "submit"
|
|
778
787
|
});
|
|
779
788
|
return code`
|
|
780
|
-
<
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
789
|
+
<LoadAction
|
|
790
|
+
decode={async (file) => decode${formClass}FromString(await file.text())}
|
|
791
|
+
mimeTypes={["${serializationMimeType}"]}
|
|
792
|
+
extensions={[".${serializationFormat}"]}
|
|
793
|
+
/>
|
|
794
|
+
<SaveAction
|
|
795
|
+
encode={(${formVar}: ${formClass}) => encode${formClass}ToString(${formVar}, true)}
|
|
796
|
+
mimeTypes={["${serializationMimeType}"]}
|
|
797
|
+
extensions={[".${serializationFormat}"]}
|
|
798
|
+
/>
|
|
799
|
+
<ValidateAction />
|
|
800
|
+
<SubmitAction
|
|
801
|
+
onSubmit={async (
|
|
802
|
+
${formVar}: ${formClass},
|
|
803
|
+
acceptedWarnings?: LocatedValidationWarning[],
|
|
804
|
+
) => {
|
|
805
|
+
const response = await submit(${formVar}, acceptedWarnings);
|
|
806
|
+
if (response instanceof ${formClass}SubmitSuccess) {
|
|
807
|
+
return response.redirectTo;
|
|
808
|
+
} else if (response instanceof ${formClass}SubmitValidationError) {
|
|
809
|
+
return response.issues;
|
|
810
|
+
} else {
|
|
811
|
+
throw response as ${formClass}SubmitError;
|
|
812
|
+
}
|
|
813
|
+
}}
|
|
814
|
+
onSuccessfulSubmit={(redirectTo: string) => {
|
|
815
|
+
window.location.href = redirectTo;
|
|
816
|
+
}}${data.useTableValuesSerializer ? "\nconvertExternalIssuesTableRowIndicesToIds" : ""}
|
|
817
|
+
/>
|
|
788
818
|
`;
|
|
789
819
|
}
|
|
790
820
|
function scaffoldAnnex(data, annex) {
|
|
@@ -1053,9 +1083,9 @@ function scaffoldViteProject(schematic, data) {
|
|
|
1053
1083
|
formId: kebabCase(schematic.name),
|
|
1054
1084
|
formClass: schematic.name,
|
|
1055
1085
|
formTitle: capitalCase(schematic.name),
|
|
1056
|
-
ostackUiVersion: "0.16.
|
|
1086
|
+
ostackUiVersion: "0.16.4",
|
|
1057
1087
|
kFormVersion: "1.0.0-rc.1",
|
|
1058
|
-
dependencyVersions: JSON.parse("{\"@eslint/js\":\"^10.0.1\",\"@fortawesome/fontawesome-svg-core\":\"^7.3.1\",\"@fortawesome/free-brands-svg-icons\":\"^7.3.1\",\"@fortawesome/free-regular-svg-icons\":\"^7.3.1\",\"@fortawesome/free-solid-svg-icons\":\"^7.3.1\",\"@ostack.tech/kform\":\"~1.0.0-rc.1\",\"@ostack.tech/kform-react\":\"~1.0.0-rc.1\",\"@ostack.tech/kform-scaffolder\":\"~1.0.0-rc.1\",\"@storybook/addon-a11y\":\"^10.5.
|
|
1088
|
+
dependencyVersions: JSON.parse("{\"@eslint/js\":\"^10.0.1\",\"@fortawesome/fontawesome-svg-core\":\"^7.3.1\",\"@fortawesome/free-brands-svg-icons\":\"^7.3.1\",\"@fortawesome/free-regular-svg-icons\":\"^7.3.1\",\"@fortawesome/free-solid-svg-icons\":\"^7.3.1\",\"@ostack.tech/kform\":\"~1.0.0-rc.1\",\"@ostack.tech/kform-react\":\"~1.0.0-rc.1\",\"@ostack.tech/kform-scaffolder\":\"~1.0.0-rc.1\",\"@storybook/addon-a11y\":\"^10.5.8\",\"@storybook/addon-docs\":\"^10.5.8\",\"@storybook/addon-links\":\"^10.5.8\",\"@storybook/react-vite\":\"^10.5.8\",\"@types/node\":\"^24.13.3\",\"@types/react\":\"^19.2.18\",\"@types/react-dom\":\"^19.2.4\",\"@vitejs/plugin-react\":\"^6.0.5\",\"change-case\":\"^5.4.4\",\"cpy-cli\":\"^7.0.0\",\"date-fns\":\"^4.4.0\",\"eslint\":\"^10.8.1\",\"eslint-config-prettier\":\"^10.1.8\",\"eslint-plugin-prettier\":\"^5.5.6\",\"eslint-plugin-react-hooks\":\"^7.1.1\",\"eslint-plugin-react-refresh\":\"^0.5.4\",\"eslint-plugin-simple-import-sort\":\"^14.0.0\",\"eslint-plugin-storybook\":\"^10.5.8\",\"globals\":\"^17.11.0\",\"happy-dom\":\"^20.11.2\",\"lint-staged\":\"^17.3.0\",\"prettier\":\"^3.9.6\",\"prettier-plugin-jsdoc\":\"^1.8.1\",\"react\":\"^19.2.8\",\"react-dom\":\"^19.2.8\",\"refractor\":\"^5.0.0\",\"rimraf\":\"^6.1.3\",\"sass-embedded\":\"^1.102.0\",\"simple-git-hooks\":\"^2.13.1\",\"storybook\":\"^10.5.8\",\"terser\":\"^5.50.0\",\"tslib\":\"^2.8.1\",\"typescript\":\"~6.0.3\",\"typescript-eslint\":\"^8.67.0\",\"vite\":\"^8.2.1\",\"vitest\":\"^4.1.10\",\"write-excel-file\":\"^4.1.1\",\"zod\":\"^4.4.3\",\"zustand\":\"^5.0.15\"}"),
|
|
1059
1089
|
encodedExternalContexts: JSON.stringify(data.serializationFormat === "json" ? "{}" : `<${schematic.name}ExternalContexts />`),
|
|
1060
1090
|
apiBasePath: data.apiBasePath ?? "/api/",
|
|
1061
1091
|
viteConfigOutDir: data.viteConfigOutDir ?? "build/dist/",
|
|
@@ -1090,7 +1120,6 @@ function SchematicBuilder({ name = "ostack-ui-kform", schematicKinds = defaultSc
|
|
|
1090
1120
|
configScaffolder(scaffoldStyles, reactAppData),
|
|
1091
1121
|
configScaffolder(scaffoldAppComponent, reactAppData),
|
|
1092
1122
|
configScaffolder(scaffoldAppContext, reactAppData),
|
|
1093
|
-
configScaffolder(scaffoldActions, reactAppData),
|
|
1094
1123
|
configScaffolder(scaffoldApi, reactAppData),
|
|
1095
1124
|
configScaffolder(scaffoldPageComponents, reactAppData)
|
|
1096
1125
|
], scaffoldingData = (schematic) => ({
|
|
@@ -1100,7 +1129,7 @@ function SchematicBuilder({ name = "ostack-ui-kform", schematicKinds = defaultSc
|
|
|
1100
1129
|
/* @__PURE__ */ jsx(DefaultLocaleConfig, {}),
|
|
1101
1130
|
/* @__PURE__ */ jsx(SerializationFormatConfig, {}),
|
|
1102
1131
|
/* @__PURE__ */ jsx(UseTableValuesSerializerConfig, {})
|
|
1103
|
-
] }), version = "0.16.
|
|
1132
|
+
] }), version = "0.16.4", ...otherProps }) {
|
|
1104
1133
|
return /* @__PURE__ */ jsx(SchematicBuilder$1, {
|
|
1105
1134
|
name,
|
|
1106
1135
|
schematicKinds,
|
|
@@ -1112,6 +1141,6 @@ function SchematicBuilder({ name = "ostack-ui-kform", schematicKinds = defaultSc
|
|
|
1112
1141
|
});
|
|
1113
1142
|
}
|
|
1114
1143
|
//#endregion
|
|
1115
|
-
export { DEFAULT_ACTIVE_PATH_SEARCH_PARAM, DEFAULT_API_BASE_PATH, DEFAULT_INCLUDE_SERIALIZATION_FORMAT_VERSION, DEFAULT_JVM_TOOLCHAIN_VERSION, DEFAULT_LOCALE, DEFAULT_NODEJS_VERSION, DEFAULT_REPORT_ERROR_API_ENDPOINT, DEFAULT_SERIALIZATION_FORMAT, DEFAULT_SUBMIT_API_ENDPOINT, DEFAULT_VITE_CONFIG_OUT_DIR, DEFAULT_VITE_CONFIG_PROXY_TARGET, DefaultLocaleConfig, LOCALES, SchematicBuilder, SerializationFormatConfig, UseTableValuesSerializerConfig, anySchematicKind, bigDecimalSchematicKind, bigIntegerSchematicKind, booleanSchematicKind, byteSchematicKind, classAnnexSchematicKind, classFormPageSchematicKind, classSchematicKind, defaultSchematicKinds, doubleSchematicKind, enumRadioGroupSchematicKind, enumSchematicKind, enumSelectSchematicKind, fileSchematicKind, floatSchematicKind, intSchematicKind, listCheckboxGroupSchematicKind, listSelectMultipleSchematicKind, localDateSchematicKind, longSchematicKind, reactAppLayout,
|
|
1144
|
+
export { DEFAULT_ACTIVE_PATH_SEARCH_PARAM, DEFAULT_API_BASE_PATH, DEFAULT_INCLUDE_SERIALIZATION_FORMAT_VERSION, DEFAULT_JVM_TOOLCHAIN_VERSION, DEFAULT_LOCALE, DEFAULT_NODEJS_VERSION, DEFAULT_REPORT_ERROR_API_ENDPOINT, DEFAULT_SERIALIZATION_FORMAT, DEFAULT_SUBMIT_API_ENDPOINT, DEFAULT_VITE_CONFIG_OUT_DIR, DEFAULT_VITE_CONFIG_PROXY_TARGET, DefaultLocaleConfig, LOCALES, SchematicBuilder, SerializationFormatConfig, UseTableValuesSerializerConfig, anySchematicKind, bigDecimalSchematicKind, bigIntegerSchematicKind, booleanSchematicKind, byteSchematicKind, classAnnexSchematicKind, classFormPageSchematicKind, classSchematicKind, defaultSchematicKinds, doubleSchematicKind, enumRadioGroupSchematicKind, enumSchematicKind, enumSelectSchematicKind, fileSchematicKind, floatSchematicKind, intSchematicKind, listCheckboxGroupSchematicKind, listSelectMultipleSchematicKind, localDateSchematicKind, longSchematicKind, reactAppLayout, scaffoldApi, scaffoldAppComponent, scaffoldAppContext, scaffoldAppLayout, scaffoldExternalContexts, scaffoldField, scaffoldGradleProject, scaffoldGradleWrapper, scaffoldIssueMessages, scaffoldMain, scaffoldPageComponents, scaffoldProjectMisc, scaffoldResponses, scaffoldSerializer, scaffoldStyles, scaffoldViteProject, shortSchematicKind, shouldScaffoldIssueMessages, stringSchematicKind, tableAnnexesSchematicKind, tableSchematicKind };
|
|
1116
1145
|
|
|
1117
1146
|
//# sourceMappingURL=ostack-ui-kform-scaffolder.js.map
|