@gadmin2n/prisma-react-generator 0.0.46 → 0.0.48
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.
|
@@ -113,7 +113,7 @@ export const ${model.name}List: React.FC<IResourceComponentsProps> = () => {
|
|
|
113
113
|
tableQueryResult,
|
|
114
114
|
searchFormProps,
|
|
115
115
|
} = useTable<${model.name}, HttpError>({
|
|
116
|
-
meta: { transformQFn: getSearchFilters, select: prismaSelect },
|
|
116
|
+
meta: { transformQFn: getSearchFilters, select: prismaSelect, model: ${instanceName}Model },
|
|
117
117
|
filters: { initial: parsedFilters, defaultBehavior: 'merge' },
|
|
118
118
|
sorters: { initial: parsedSorter },
|
|
119
119
|
${gameAngle
|
|
@@ -185,7 +185,7 @@ export const ${model.name}List: React.FC<IResourceComponentsProps> = () => {
|
|
|
185
185
|
return (
|
|
186
186
|
<List
|
|
187
187
|
headerProps={{
|
|
188
|
-
subTitle:
|
|
188
|
+
subTitle: (
|
|
189
189
|
<BulkActions
|
|
190
190
|
selectedRowKeys={batchOps.selectedRowKeys}
|
|
191
191
|
actions={tableConfig.rowSelection.actions}
|
|
@@ -208,6 +208,7 @@ export const ${model.name}List: React.FC<IResourceComponentsProps> = () => {
|
|
|
208
208
|
importProps={importProps}
|
|
209
209
|
onExport={triggerExport}
|
|
210
210
|
exportLoading={exportLoading}
|
|
211
|
+
resourceName={resourceName}
|
|
211
212
|
/>
|
|
212
213
|
),
|
|
213
214
|
}}
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
} from "../../generated/props/${instanceName}/config";
|
|
19
19
|
import { ${instanceName}Model } from "../../generated/props/${instanceName}/model";
|
|
20
20
|
import { modelsMap } from "generated/models.index";
|
|
21
|
+
import { agentAttrs } from "../../components/agentPanel/agentAttributes";
|
|
21
22
|
|
|
22
23
|
export const ${model.name}Show: React.FC<IResourceComponentsProps> = () => {
|
|
23
24
|
const resourceName = "${instanceName}";
|
|
@@ -47,7 +48,7 @@ export const ${model.name}Show: React.FC<IResourceComponentsProps> = () => {
|
|
|
47
48
|
<Show
|
|
48
49
|
isLoading={isLoading}
|
|
49
50
|
headerButtons={
|
|
50
|
-
|
|
51
|
+
<div style={{ display: 'inline-flex', gap: 8 }} {...agentAttrs({ type: 'show-header', resource: resourceName })}>
|
|
51
52
|
<ListButton/>
|
|
52
53
|
<EditButton recordItemId={record?.id} />
|
|
53
54
|
<CloneButton recordItemId={record?.id} />
|
|
@@ -56,12 +57,15 @@ export const ${model.name}Show: React.FC<IResourceComponentsProps> = () => {
|
|
|
56
57
|
recordItemId={record?.id}
|
|
57
58
|
meta={{ select: showPrismaSelect}}
|
|
58
59
|
/>
|
|
59
|
-
|
|
60
|
+
</div>
|
|
60
61
|
}
|
|
62
|
+
contentProps={{ styles: { body: { padding: 0 } } }}
|
|
61
63
|
>
|
|
62
|
-
{
|
|
63
|
-
|
|
64
|
-
|
|
64
|
+
<div style={{ border: '1px solid #f0f0f0', borderRadius: 8, overflow: 'hidden' }}>
|
|
65
|
+
{fields.map((field: any) => {
|
|
66
|
+
return getShowField(field, resourceName, record, t, model, modelsMap);
|
|
67
|
+
})}
|
|
68
|
+
</div>
|
|
65
69
|
</Show>
|
|
66
70
|
);
|
|
67
71
|
};
|
|
@@ -46,6 +46,9 @@ declare type UiType = {
|
|
|
46
46
|
options: string[];
|
|
47
47
|
mode?: 'multiple' | undefined;
|
|
48
48
|
};
|
|
49
|
+
} | {
|
|
50
|
+
type: 'AutoComplete';
|
|
51
|
+
args: {};
|
|
49
52
|
} | {
|
|
50
53
|
type: 'String' | 'Boolean' | 'Int' | 'BigInt' | 'Float' | 'Decimal' | 'DateTime' | 'Markdown' | 'Html' | 'Url' | 'Email' | 'Other';
|
|
51
54
|
args: {};
|
|
@@ -289,7 +289,8 @@ function parseDocumentation(documentation, field) {
|
|
|
289
289
|
let content = lineMatch[1].replace(/\)\s*$/, '');
|
|
290
290
|
const tooltipIdx = content.indexOf('tooltip=');
|
|
291
291
|
if (tooltipIdx !== -1) {
|
|
292
|
-
tooltip = content.slice(tooltipIdx + 'tooltip='.length).trim()
|
|
292
|
+
tooltip = content.slice(tooltipIdx + 'tooltip='.length).trim()
|
|
293
|
+
.replace(/\\,/g, ',').replace(/\\\)/g, ')');
|
|
293
294
|
content = content.slice(0, tooltipIdx).replace(/,\s*$/, '');
|
|
294
295
|
}
|
|
295
296
|
[fieldType, ...args] = content.split(',').map((arg) => arg.trim());
|
|
@@ -354,6 +355,12 @@ function parseDocumentation(documentation, field) {
|
|
|
354
355
|
...(tooltip && { tooltip }),
|
|
355
356
|
};
|
|
356
357
|
}
|
|
358
|
+
else if (fieldType === 'AutoComplete') {
|
|
359
|
+
return {
|
|
360
|
+
formItem: { type: fieldType, args: {} },
|
|
361
|
+
...(tooltip && { tooltip }),
|
|
362
|
+
};
|
|
363
|
+
}
|
|
357
364
|
else {
|
|
358
365
|
return {
|
|
359
366
|
formItem: {
|
package/package.json
CHANGED