sonamu 0.0.14 → 0.0.17
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/api/sonamu.d.ts +1 -1
- package/dist/api/sonamu.d.ts.map +1 -1
- package/dist/api/sonamu.js +2 -2
- package/dist/api/sonamu.js.map +1 -1
- package/dist/syncer/syncer.d.ts.map +1 -1
- package/dist/syncer/syncer.js +4 -1
- package/dist/syncer/syncer.js.map +1 -1
- package/dist/templates/service.template.js +1 -1
- package/dist/templates/service.template.js.map +1 -1
- package/dist/templates/view_enums_select.template.d.ts.map +1 -1
- package/dist/templates/view_enums_select.template.js +6 -8
- package/dist/templates/view_enums_select.template.js.map +1 -1
- package/dist/templates/view_form.template.d.ts +1 -1
- package/dist/templates/view_form.template.d.ts.map +1 -1
- package/dist/templates/view_form.template.js +48 -41
- package/dist/templates/view_form.template.js.map +1 -1
- package/dist/templates/view_list.template.d.ts +1 -1
- package/dist/templates/view_list.template.d.ts.map +1 -1
- package/dist/templates/view_list.template.js +17 -24
- package/dist/templates/view_list.template.js.map +1 -1
- package/dist/types/types.d.ts +1 -1
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/types.js.map +1 -1
- package/package.json +1 -1
- package/src/api/sonamu.ts +2 -2
- package/src/syncer/syncer.ts +3 -1
- package/src/templates/model_test.template.ts +2 -4
- package/src/templates/service.template.ts +1 -1
- package/src/templates/view_enums_select.template.ts +6 -8
- package/src/templates/view_form.template.ts +55 -61
- package/src/templates/view_list.template.ts +21 -26
- package/src/types/types.ts +1 -0
|
@@ -40,6 +40,7 @@ export class Template__view_list extends Template {
|
|
|
40
40
|
|
|
41
41
|
switch (col.renderType) {
|
|
42
42
|
case "string-plain":
|
|
43
|
+
case "string-date":
|
|
43
44
|
case "number-id":
|
|
44
45
|
return `<>{${colName}}</>`;
|
|
45
46
|
case "number-fk_id":
|
|
@@ -49,12 +50,14 @@ export class Template__view_list extends Template {
|
|
|
49
50
|
);
|
|
50
51
|
return `<>${relPropFk.with}#{${colName}}</>`;
|
|
51
52
|
case "string-image":
|
|
52
|
-
return
|
|
53
|
+
return `<>{${
|
|
54
|
+
col.nullable ? `${colName} && ` : ""
|
|
55
|
+
}<img src={${colName}} />}</>`;
|
|
53
56
|
case "string-datetime":
|
|
54
57
|
if (col.nullable) {
|
|
55
|
-
return `<span className="text-tiny">{${colName} === null ? '-' : DateTime.fromSQL(${colName}).
|
|
58
|
+
return `<span className="text-tiny">{${colName} === null ? '-' : DateTime.fromSQL(${colName}).toSQL().slice(0, 10)}</span>`;
|
|
56
59
|
} else {
|
|
57
|
-
return `<span className="text-tiny">{DateTime.fromSQL(${colName}).
|
|
60
|
+
return `<span className="text-tiny">{DateTime.fromSQL(${colName}).toSQL().slice(0, 10)}</span>`;
|
|
58
61
|
}
|
|
59
62
|
case "boolean":
|
|
60
63
|
return `<>{${colName} ? <Label color='green' circular>O</Label> : <Label color='grey' circular>X</Label> }</>`;
|
|
@@ -64,11 +67,11 @@ export class Template__view_list extends Template {
|
|
|
64
67
|
targetMDNames.constant
|
|
65
68
|
}.${name}[${colName}].ko}</>`;
|
|
66
69
|
case "array-images":
|
|
67
|
-
return `<>{ ${colName}.map(r =>
|
|
70
|
+
return `<>{ ${colName}.map(r => ${
|
|
71
|
+
col.nullable ? `r && ` : ""
|
|
72
|
+
}<img src={r} />) }</>`;
|
|
68
73
|
case "number-plain":
|
|
69
|
-
return `<>{${
|
|
70
|
-
col.nullable ? `${colName} && ` : ""
|
|
71
|
-
}new Intl.NumberFormat().format(${colName})}</>`;
|
|
74
|
+
return `<>{${col.nullable ? `${colName} && ` : ""}numF(${colName})}</>`;
|
|
72
75
|
case "object":
|
|
73
76
|
try {
|
|
74
77
|
const relProp = getRelationPropFromColName(smdId, col.name);
|
|
@@ -333,7 +336,7 @@ export class Template__view_list extends Template {
|
|
|
333
336
|
});
|
|
334
337
|
}
|
|
335
338
|
|
|
336
|
-
// 리스트 컬럼
|
|
339
|
+
// 리스트 컬럼
|
|
337
340
|
const columnImports = uniq(
|
|
338
341
|
columnsNode
|
|
339
342
|
.children!.map((col) => {
|
|
@@ -342,14 +345,6 @@ export class Template__view_list extends Template {
|
|
|
342
345
|
.flat()
|
|
343
346
|
.filter((col) => col !== null)
|
|
344
347
|
).join("\n");
|
|
345
|
-
preTemplates.push({
|
|
346
|
-
key: "view_list_columns",
|
|
347
|
-
options: {
|
|
348
|
-
smdId,
|
|
349
|
-
columns,
|
|
350
|
-
columnImports,
|
|
351
|
-
} as TemplateOptions["view_list_columns"],
|
|
352
|
-
});
|
|
353
348
|
|
|
354
349
|
// SearchInput
|
|
355
350
|
preTemplates!.push({
|
|
@@ -381,13 +376,7 @@ import {
|
|
|
381
376
|
} from 'semantic-ui-react';
|
|
382
377
|
import classNames from 'classnames';
|
|
383
378
|
import { DateTime } from "luxon";
|
|
384
|
-
import { DelButton } from '
|
|
385
|
-
import { EditButton } from 'src/typeframe/components/EditButton';
|
|
386
|
-
import { AppBreadcrumbs } from 'src/typeframe/components/AppBreadcrumbs';
|
|
387
|
-
import { AddButton } from 'src/typeframe/components/AddButton';
|
|
388
|
-
import { useSelection, useListParams } from 'src/typeframe/helpers';
|
|
389
|
-
import { TFColumn } from "src/typeframe/iso-types";
|
|
390
|
-
import dc from './_columns';
|
|
379
|
+
import { DelButton, EditButton, AppBreadcrumbs, AddButton, useSelection, useListParams, SonamuCol, numF } from '@sonamu-kit/react-sui';
|
|
391
380
|
|
|
392
381
|
import { ${names.capital}SubsetA } from "src/services/${names.fs}/${
|
|
393
382
|
names.fs
|
|
@@ -463,9 +452,15 @@ export default function ${names.capital}List({}: ${names.capital}ListProps) {
|
|
|
463
452
|
} = useSelection((rows ?? []).map((row) => row.id));
|
|
464
453
|
|
|
465
454
|
// 컬럼
|
|
466
|
-
const columns:
|
|
467
|
-
|
|
468
|
-
|
|
455
|
+
const columns:SonamuCol<${names.capital}SubsetA>[] = [${columns
|
|
456
|
+
.map((col) => {
|
|
457
|
+
return [
|
|
458
|
+
`{ label: "${col.label}",`,
|
|
459
|
+
`tc: ${col.tc}, `,
|
|
460
|
+
`collapsing: ${["Title", "Name"].includes(col.label) === false}, }`,
|
|
461
|
+
].join("\n");
|
|
462
|
+
})
|
|
463
|
+
.join(",\n")}];
|
|
469
464
|
|
|
470
465
|
return (
|
|
471
466
|
<div className="list ${names.fsPlural}-index">
|