@simitgroup/simpleapp-generator 2.0.3-i-alpha → 2.0.3-k-alpha
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/ReleaseNote.md +7 -0
- package/package.json +1 -1
- package/templates/basic/nest/service.ts.eta +1 -1
- package/templates/basic/nuxt/simpleapp.generate.client.ts.eta +1 -1
- package/templates/nuxt/composables/date.generate.ts.eta +1 -1
- package/templates/nuxt/simpleapp/generate/features/miniApp/app/components/MiniAppSettingPage.vue.eta +51 -51
- package/templates/nuxt/simpleapp/generate/features/customField/components/CustomFieldFormField.vue.eta +0 -100
- package/templates/nuxt/simpleapp/generate/features/customField/components/CustomFieldFormFieldInput.vue.eta +0 -125
- package/templates/nuxt/simpleapp/generate/features/customField/components/CustomFieldFormSection.vue.eta +0 -40
- package/templates/nuxt/simpleapp/generate/features/customField/components/CustomFieldViewFormField.vue.eta +0 -96
- package/templates/nuxt/simpleapp/generate/features/customField/components/CustomFieldViewFormFieldInput.vue.eta +0 -150
- package/templates/nuxt/simpleapp/generate/features/customField/components/CustomFieldViewFormSection.vue.eta +0 -38
package/ReleaseNote.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
[2.0.3k-alpha]
|
|
2
|
+
1. Update sharelibs imports to @simtrain/shared package
|
|
3
|
+
|
|
4
|
+
[2.0.3j-alpha]
|
|
5
|
+
1. Replace CustomFieldFormField with SimpleAppJsonForms in MiniAppSettingPage
|
|
6
|
+
2. Remove redundant custom field form templates
|
|
7
|
+
|
|
1
8
|
[2.0.3i-alpha]
|
|
2
9
|
1. Add uiSchema for custom field
|
|
3
10
|
2. Remove unused lang template files (cn.ts._eta, en.ts.eta)
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
import { UserContext } from 'src/simple-app/_core/features/user-context/user.context'
|
|
11
|
-
import * as sharelibs from '
|
|
11
|
+
import * as sharelibs from '@simtrain/shared'
|
|
12
12
|
import { Injectable,Inject,forwardRef } from '@nestjs/common';
|
|
13
13
|
import { InjectModel } from '@nestjs/mongoose';
|
|
14
14
|
import jsonpath from 'jsonpath'
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import _ from 'lodash'
|
|
9
9
|
import {SchemaType,NotificationStatus} from '~/types'
|
|
10
|
-
import * as sharelibs from '
|
|
10
|
+
import * as sharelibs from '@simtrain/shared'
|
|
11
11
|
import jsonpath from 'jsonpath'
|
|
12
12
|
import { SimpleAppClient } from "./SimpleAppClient";
|
|
13
13
|
import {
|
|
@@ -9,7 +9,7 @@ import { DateTime } from "luxon";
|
|
|
9
9
|
import {
|
|
10
10
|
dayjsDateFormatToPrimeVue,
|
|
11
11
|
getDefaultDateFormatForCountryCode,
|
|
12
|
-
} from "
|
|
12
|
+
} from "@simtrain/shared";
|
|
13
13
|
import { DurationType } from "~/types";
|
|
14
14
|
|
|
15
15
|
const convertToDate = (date: Date | string) => {
|
package/templates/nuxt/simpleapp/generate/features/miniApp/app/components/MiniAppSettingPage.vue.eta
CHANGED
|
@@ -1,54 +1,48 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<LoadingLine :loading="isFetching" />
|
|
3
|
-
<
|
|
3
|
+
<MiniAppSettingLayout
|
|
4
4
|
v-if="!_.isEmpty(schema)"
|
|
5
|
-
:
|
|
6
|
-
:
|
|
7
|
-
|
|
5
|
+
:isFetching="isFetching"
|
|
6
|
+
:miniAppCode="_miniAppCode"
|
|
7
|
+
:miniAppTitle="miniAppTitle"
|
|
8
8
|
>
|
|
9
|
-
<
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
</Button>
|
|
18
|
-
</template>
|
|
9
|
+
<template #action>
|
|
10
|
+
<Button
|
|
11
|
+
class="btn-primary"
|
|
12
|
+
@click="onSave"
|
|
13
|
+
>
|
|
14
|
+
{{ t("miniAppLang.saveSetting") }}
|
|
15
|
+
</Button>
|
|
16
|
+
</template>
|
|
19
17
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
/>
|
|
42
|
-
</div>
|
|
43
|
-
</template>
|
|
44
|
-
</MiniAppSettingLayout>
|
|
45
|
-
</SimpleAppJsonSchemaForm>
|
|
18
|
+
<template #default>
|
|
19
|
+
<div class="space-y-4">
|
|
20
|
+
<p
|
|
21
|
+
v-if="miniApp?.integration?.customPage?.setting?.note"
|
|
22
|
+
class="text-sm text-gray-600 whitespace-pre-line"
|
|
23
|
+
>
|
|
24
|
+
{{
|
|
25
|
+
t("miniAppLang.miniAppSettingNote", {
|
|
26
|
+
miniAppNote: miniApp.integration.customPage.setting.note ?? "",
|
|
27
|
+
})
|
|
28
|
+
}}
|
|
29
|
+
</p>
|
|
30
|
+
<SimpleAppJsonForms
|
|
31
|
+
ref="jsonForms"
|
|
32
|
+
v-model="data"
|
|
33
|
+
:schema="schema"
|
|
34
|
+
@change="onFormChange"
|
|
35
|
+
/>
|
|
36
|
+
</div>
|
|
37
|
+
</template>
|
|
38
|
+
</MiniAppSettingLayout>
|
|
46
39
|
</template>
|
|
47
40
|
|
|
48
41
|
<script setup lang="ts" generic="T">
|
|
49
42
|
import _ from "lodash";
|
|
43
|
+
import type { ErrorObject } from "ajv";
|
|
44
|
+
import type { SimpleAppJsonFormsRef } from "~/types/simpleApp.type";
|
|
50
45
|
import MiniAppSettingLayout from "./MiniAppSettingLayout.vue";
|
|
51
|
-
import CustomFieldFormField from "../../../customField/components/CustomFieldFormField.vue";
|
|
52
46
|
|
|
53
47
|
const props = defineProps<{
|
|
54
48
|
miniAppCode?: string;
|
|
@@ -56,16 +50,22 @@ const props = defineProps<{
|
|
|
56
50
|
|
|
57
51
|
const _miniAppCode = props.miniAppCode ?? getPathPara("miniAppCode");
|
|
58
52
|
|
|
59
|
-
const {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
53
|
+
const { isFetching, miniApp, miniAppTitle, schema, data, loadMiniAppDetail, saveSetting } =
|
|
54
|
+
useMiniAppSetting(_miniAppCode);
|
|
55
|
+
|
|
56
|
+
const jsonForms = ref<SimpleAppJsonFormsRef | null>(null);
|
|
57
|
+
const formErrors = ref<ErrorObject[]>([]);
|
|
58
|
+
|
|
59
|
+
const onFormChange = (_data: any, errors: ErrorObject[]) => {
|
|
60
|
+
formErrors.value = errors;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const onSave = async () => {
|
|
64
|
+
jsonForms.value?.changeValidationModeToShow();
|
|
65
|
+
if (!formErrors.value.length) {
|
|
66
|
+
await saveSetting();
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
69
|
|
|
70
70
|
onMounted(async () => {
|
|
71
71
|
await loadMiniAppDetail();
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<template v-if="validJsonSchema">
|
|
3
|
-
<template v-if="_.isArray(validJsonSchema)"> </template>
|
|
4
|
-
<template v-else>
|
|
5
|
-
<template v-if="validJsonSchema.type === 'object'">
|
|
6
|
-
<template v-if="validJsonSchema['x-foreignkey']">
|
|
7
|
-
<CustomFieldFormFieldInput
|
|
8
|
-
:jsonSchema="validJsonSchema"
|
|
9
|
-
:hierarchy="hierarchy"
|
|
10
|
-
:schemaSource="schemaSource"
|
|
11
|
-
:handleGetField="handleGetField"
|
|
12
|
-
v-model="data[schemaName]"
|
|
13
|
-
/>
|
|
14
|
-
</template>
|
|
15
|
-
<template v-else>
|
|
16
|
-
<Fieldset class="col-span-2 rounded-xl">
|
|
17
|
-
<template #legend>
|
|
18
|
-
<span
|
|
19
|
-
:class="{
|
|
20
|
-
'mx-2': legendTitle && legendTitle !== '',
|
|
21
|
-
}"
|
|
22
|
-
>
|
|
23
|
-
{{ legendTitle }}
|
|
24
|
-
</span>
|
|
25
|
-
</template>
|
|
26
|
-
|
|
27
|
-
<div
|
|
28
|
-
class="grid grid-cols-2 gap-4 p-2"
|
|
29
|
-
:class="{
|
|
30
|
-
'pt-4': legendTitle === undefined || legendTitle === '',
|
|
31
|
-
}"
|
|
32
|
-
>
|
|
33
|
-
<template
|
|
34
|
-
v-if="validJsonSchema.properties"
|
|
35
|
-
v-for="(subSchema, subSchemaName) in validJsonSchema.properties"
|
|
36
|
-
:key="subSchemaName"
|
|
37
|
-
>
|
|
38
|
-
<CustomFieldFormField
|
|
39
|
-
:jsonSchema="subSchema"
|
|
40
|
-
:data="data[schemaName]"
|
|
41
|
-
:schemaSource="schemaSource"
|
|
42
|
-
:schemaName="subSchemaName as string"
|
|
43
|
-
:handleGetField="handleGetField"
|
|
44
|
-
:hierarchy="
|
|
45
|
-
hierarchy === '' || hierarchy === undefined
|
|
46
|
-
? (subSchemaName as string)
|
|
47
|
-
: `${hierarchy}.${subSchemaName}`
|
|
48
|
-
"
|
|
49
|
-
/>
|
|
50
|
-
</template>
|
|
51
|
-
</div>
|
|
52
|
-
</Fieldset>
|
|
53
|
-
</template>
|
|
54
|
-
</template>
|
|
55
|
-
<template v-else>
|
|
56
|
-
<CustomFieldFormFieldInput
|
|
57
|
-
:jsonSchema="validJsonSchema"
|
|
58
|
-
:hierarchy="hierarchy"
|
|
59
|
-
:schemaSource="schemaSource"
|
|
60
|
-
:handleGetField="handleGetField"
|
|
61
|
-
v-model="data[schemaName]"
|
|
62
|
-
/>
|
|
63
|
-
</template>
|
|
64
|
-
</template>
|
|
65
|
-
</template>
|
|
66
|
-
</template>
|
|
67
|
-
|
|
68
|
-
<script setup lang="ts">
|
|
69
|
-
import _ from "lodash";
|
|
70
|
-
import { SimpleAppJSONSchema7Definition } from "~/types";
|
|
71
|
-
import { SchemaSource } from "~/types/customField.type";
|
|
72
|
-
import CustomFieldFormFieldInput from "./CustomFieldFormFieldInput.vue";
|
|
73
|
-
|
|
74
|
-
const props = defineProps<{
|
|
75
|
-
jsonSchema?: SimpleAppJSONSchema7Definition | undefined;
|
|
76
|
-
data: any;
|
|
77
|
-
hierarchy: string;
|
|
78
|
-
schemaName: string;
|
|
79
|
-
schemaSource: SchemaSource;
|
|
80
|
-
isHideFieldsetLegend?: boolean;
|
|
81
|
-
handleGetField: (path: string) => any;
|
|
82
|
-
}>();
|
|
83
|
-
|
|
84
|
-
const legendTitle = computed(() => {
|
|
85
|
-
if (props.isHideFieldsetLegend) return "";
|
|
86
|
-
|
|
87
|
-
return (
|
|
88
|
-
(props.jsonSchema &&
|
|
89
|
-
typeof props.jsonSchema !== "boolean" &&
|
|
90
|
-
props.jsonSchema?.title) ??
|
|
91
|
-
props.schemaName
|
|
92
|
-
);
|
|
93
|
-
});
|
|
94
|
-
const validJsonSchema = computed(() => {
|
|
95
|
-
if (props.jsonSchema !== undefined && typeof props.jsonSchema === "object") {
|
|
96
|
-
return props.jsonSchema;
|
|
97
|
-
}
|
|
98
|
-
return false;
|
|
99
|
-
});
|
|
100
|
-
</script>
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<template v-if="jsonSchema.type !== 'array'">
|
|
3
|
-
<SimpleAppInput
|
|
4
|
-
v-if="fieldPath"
|
|
5
|
-
:setting="handleGetField(fieldPath)"
|
|
6
|
-
:inputType="inputType"
|
|
7
|
-
:hidelabel="isParentIsArray"
|
|
8
|
-
v-model="model"
|
|
9
|
-
/>
|
|
10
|
-
</template>
|
|
11
|
-
<template
|
|
12
|
-
v-else-if="
|
|
13
|
-
jsonSchema.type === 'array' &&
|
|
14
|
-
jsonSchema.items &&
|
|
15
|
-
_.isObject(jsonSchema.items) &&
|
|
16
|
-
!Array.isArray(jsonSchema.items)
|
|
17
|
-
"
|
|
18
|
-
>
|
|
19
|
-
<template v-if="jsonSchema.items.type === 'object'">
|
|
20
|
-
<div class="col-span-2">
|
|
21
|
-
<SimpleAppInputTable
|
|
22
|
-
:getField="handleGetField"
|
|
23
|
-
class="col-span-4"
|
|
24
|
-
:setting="handleGetField(fieldPath)"
|
|
25
|
-
v-model="model"
|
|
26
|
-
>
|
|
27
|
-
<Column
|
|
28
|
-
v-if="
|
|
29
|
-
jsonSchema.items &&
|
|
30
|
-
typeof jsonSchema.items === 'object' &&
|
|
31
|
-
'properties' in jsonSchema.items
|
|
32
|
-
"
|
|
33
|
-
v-for="(subSchema, subSchemaName) in jsonSchema.items.properties"
|
|
34
|
-
:key="subSchemaName"
|
|
35
|
-
:field="subSchemaName.toString()"
|
|
36
|
-
#body="{ index }"
|
|
37
|
-
:header="camelCaseToWords(subSchemaName.toString())"
|
|
38
|
-
>
|
|
39
|
-
<CustomFieldFormFieldInput
|
|
40
|
-
v-if="typeof subSchema === 'object' && subSchema !== null"
|
|
41
|
-
:jsonSchema="subSchema"
|
|
42
|
-
:hierarchy="
|
|
43
|
-
hierarchy === '' || hierarchy === undefined
|
|
44
|
-
? (subSchemaName as string)
|
|
45
|
-
: `${hierarchy}.*.${subSchemaName}`
|
|
46
|
-
"
|
|
47
|
-
:schemaSource="schemaSource"
|
|
48
|
-
:handleGetField="handleGetField"
|
|
49
|
-
v-model="model[index][subSchemaName]"
|
|
50
|
-
/>
|
|
51
|
-
</Column>
|
|
52
|
-
|
|
53
|
-
<Column #body="{ index }" header="Delete">
|
|
54
|
-
<ButtonDanger
|
|
55
|
-
class="btn-danger"
|
|
56
|
-
type="button"
|
|
57
|
-
@click="model.splice(index, 1)"
|
|
58
|
-
>
|
|
59
|
-
X
|
|
60
|
-
</ButtonDanger>
|
|
61
|
-
</Column>
|
|
62
|
-
</SimpleAppInputTable>
|
|
63
|
-
</div>
|
|
64
|
-
</template>
|
|
65
|
-
<template v-else-if="jsonSchema.items.type === 'string'">
|
|
66
|
-
<SimpleAppInput
|
|
67
|
-
v-if="fieldPath"
|
|
68
|
-
:setting="handleGetField(fieldPath)"
|
|
69
|
-
:inputType="
|
|
70
|
-
(jsonSchema?.inputType as SimpleAppInputType) ??
|
|
71
|
-
SimpleAppInputType.chip
|
|
72
|
-
"
|
|
73
|
-
:hidelabel="isParentIsArray"
|
|
74
|
-
v-model="model"
|
|
75
|
-
/>
|
|
76
|
-
</template>
|
|
77
|
-
</template>
|
|
78
|
-
</template>
|
|
79
|
-
|
|
80
|
-
<script setup lang="ts">
|
|
81
|
-
import _ from "lodash";
|
|
82
|
-
import ButtonDanger from "~/components/button/ButtonDanger.vue";
|
|
83
|
-
import { SimpleAppInputType, SimpleAppJSONSchema7 } from "~/types";
|
|
84
|
-
import { SchemaSource } from "~/types/customField.type";
|
|
85
|
-
|
|
86
|
-
const props = defineProps<{
|
|
87
|
-
jsonSchema: SimpleAppJSONSchema7;
|
|
88
|
-
hierarchy: string;
|
|
89
|
-
handleGetField: any;
|
|
90
|
-
schemaSource: SchemaSource;
|
|
91
|
-
}>();
|
|
92
|
-
|
|
93
|
-
const model = defineModel<any>();
|
|
94
|
-
|
|
95
|
-
const fieldPath = computed(() => {
|
|
96
|
-
const hierarchies = props.hierarchy.split(".");
|
|
97
|
-
|
|
98
|
-
const path = (getFieldPathPrefix() + hierarchies.join("/properties/"))
|
|
99
|
-
.replace("properties/*", "items")
|
|
100
|
-
.replace("*", "items");
|
|
101
|
-
|
|
102
|
-
// if (props.schemaSource === "miniAppSetting") {
|
|
103
|
-
// return path.replace("/properties/setting", "");
|
|
104
|
-
// }
|
|
105
|
-
|
|
106
|
-
return path;
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
const inputType = computed(() => {
|
|
110
|
-
return getInputType(props.jsonSchema);
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
const isParentIsArray = computed(() => {
|
|
114
|
-
const hierarchies = props.hierarchy.split(".");
|
|
115
|
-
return hierarchies[hierarchies.length - 2] == "*";
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
function getFieldPathPrefix() {
|
|
119
|
-
if (props.schemaSource === "customField") {
|
|
120
|
-
return "#/properties/more/properties/";
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
return "#/properties/";
|
|
124
|
-
}
|
|
125
|
-
</script>
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<section v-if="validProperties" class="space-y-4">
|
|
3
|
-
<template
|
|
4
|
-
v-for="(groupJsonSchema, groupName) in validProperties"
|
|
5
|
-
:key="groupName"
|
|
6
|
-
>
|
|
7
|
-
<CustomFieldFormField
|
|
8
|
-
v-if="isValidSchema(groupJsonSchema)"
|
|
9
|
-
:jsonSchema="groupJsonSchema"
|
|
10
|
-
:data="data"
|
|
11
|
-
:handleGetField="handleGetField"
|
|
12
|
-
:schemaName="groupName.toString()"
|
|
13
|
-
:hierarchy="groupName.toString()"
|
|
14
|
-
schemaSource="customField"
|
|
15
|
-
/>
|
|
16
|
-
</template>
|
|
17
|
-
</section>
|
|
18
|
-
</template>
|
|
19
|
-
|
|
20
|
-
<script setup lang="ts">
|
|
21
|
-
import _ from 'lodash';
|
|
22
|
-
import { CustomFieldMoreSchema } from '~/simpleapp/generate/features/customField/types/common';
|
|
23
|
-
import CustomFieldFormField from './CustomFieldFormField.vue';
|
|
24
|
-
|
|
25
|
-
const props = defineProps<{
|
|
26
|
-
customFieldJsonSchema: CustomFieldMoreSchema;
|
|
27
|
-
data: any;
|
|
28
|
-
handleGetField: (path: string) => any;
|
|
29
|
-
}>();
|
|
30
|
-
|
|
31
|
-
const validProperties = computed(() => {
|
|
32
|
-
if (
|
|
33
|
-
props.customFieldJsonSchema.properties !== undefined &&
|
|
34
|
-
typeof props.customFieldJsonSchema.properties === 'object'
|
|
35
|
-
) {
|
|
36
|
-
return props.customFieldJsonSchema.properties;
|
|
37
|
-
}
|
|
38
|
-
return false;
|
|
39
|
-
});
|
|
40
|
-
</script>
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<template v-if="validJsonSchema">
|
|
3
|
-
<template v-if="_.isArray(validJsonSchema)"> </template>
|
|
4
|
-
<template v-else>
|
|
5
|
-
<template v-if="validJsonSchema.type === 'object'">
|
|
6
|
-
<template v-if="validJsonSchema['x-foreignkey']">
|
|
7
|
-
<CustomFieldViewFormFieldInput
|
|
8
|
-
:jsonSchema="validJsonSchema"
|
|
9
|
-
:hierarchy="hierarchy"
|
|
10
|
-
:schemaSource="schemaSource"
|
|
11
|
-
v-model="data[schemaName]"
|
|
12
|
-
/>
|
|
13
|
-
</template>
|
|
14
|
-
<template v-else>
|
|
15
|
-
<Fieldset class="col-span-2 rounded-xl">
|
|
16
|
-
<template #legend>
|
|
17
|
-
<span
|
|
18
|
-
:class="{
|
|
19
|
-
'mx-2': legendTitle && legendTitle !== '',
|
|
20
|
-
}"
|
|
21
|
-
>
|
|
22
|
-
{{ legendTitle }}
|
|
23
|
-
</span>
|
|
24
|
-
</template>
|
|
25
|
-
|
|
26
|
-
<div
|
|
27
|
-
class="grid grid-cols-2 gap-4 p-2"
|
|
28
|
-
:class="{
|
|
29
|
-
'pt-4': legendTitle === undefined || legendTitle === '',
|
|
30
|
-
}"
|
|
31
|
-
>
|
|
32
|
-
<template
|
|
33
|
-
v-if="validJsonSchema.properties"
|
|
34
|
-
v-for="(subSchema, subSchemaName) in validJsonSchema.properties"
|
|
35
|
-
:key="subSchemaName"
|
|
36
|
-
>
|
|
37
|
-
<CustomFieldViewFormField
|
|
38
|
-
:jsonSchema="subSchema"
|
|
39
|
-
:data="data[schemaName]"
|
|
40
|
-
:schemaSource="schemaSource"
|
|
41
|
-
:schemaName="subSchemaName as string"
|
|
42
|
-
:hierarchy="
|
|
43
|
-
hierarchy === '' || hierarchy === undefined
|
|
44
|
-
? (subSchemaName as string)
|
|
45
|
-
: `${hierarchy}.${subSchemaName}`
|
|
46
|
-
"
|
|
47
|
-
/>
|
|
48
|
-
</template>
|
|
49
|
-
</div>
|
|
50
|
-
</Fieldset>
|
|
51
|
-
</template>
|
|
52
|
-
</template>
|
|
53
|
-
<template v-else>
|
|
54
|
-
<CustomFieldViewFormFieldInput
|
|
55
|
-
:jsonSchema="validJsonSchema"
|
|
56
|
-
:hierarchy="hierarchy"
|
|
57
|
-
:schemaSource="schemaSource"
|
|
58
|
-
v-model="data[schemaName]"
|
|
59
|
-
/>
|
|
60
|
-
</template>
|
|
61
|
-
</template>
|
|
62
|
-
</template>
|
|
63
|
-
</template>
|
|
64
|
-
|
|
65
|
-
<script setup lang="ts">
|
|
66
|
-
import _ from "lodash";
|
|
67
|
-
import { SimpleAppJSONSchema7Definition } from "~/types";
|
|
68
|
-
import { SchemaSource } from "~/types/customField.type";
|
|
69
|
-
import CustomFieldViewFormFieldInput from "./CustomFieldViewFormFieldInput.vue";
|
|
70
|
-
|
|
71
|
-
const props = defineProps<{
|
|
72
|
-
jsonSchema?: SimpleAppJSONSchema7Definition | undefined;
|
|
73
|
-
data: any;
|
|
74
|
-
hierarchy: string;
|
|
75
|
-
schemaName: string;
|
|
76
|
-
schemaSource: SchemaSource;
|
|
77
|
-
isHideFieldsetLegend?: boolean;
|
|
78
|
-
}>();
|
|
79
|
-
|
|
80
|
-
const legendTitle = computed(() => {
|
|
81
|
-
if (props.isHideFieldsetLegend) return "";
|
|
82
|
-
|
|
83
|
-
return (
|
|
84
|
-
(props.jsonSchema &&
|
|
85
|
-
typeof props.jsonSchema !== "boolean" &&
|
|
86
|
-
props.jsonSchema?.title) ??
|
|
87
|
-
props.schemaName
|
|
88
|
-
);
|
|
89
|
-
});
|
|
90
|
-
const validJsonSchema = computed(() => {
|
|
91
|
-
if (props.jsonSchema !== undefined && typeof props.jsonSchema === "object") {
|
|
92
|
-
return props.jsonSchema;
|
|
93
|
-
}
|
|
94
|
-
return false;
|
|
95
|
-
});
|
|
96
|
-
</script>
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<template v-if="jsonSchema.type !== 'array'">
|
|
3
|
-
<div>
|
|
4
|
-
<label v-if="!isParentIsArray" class="text-gray-400 text-sm truncate">
|
|
5
|
-
{{ label }}
|
|
6
|
-
</label>
|
|
7
|
-
<div>
|
|
8
|
-
<PageDocListColumnItem
|
|
9
|
-
:col="columnName"
|
|
10
|
-
:data="{
|
|
11
|
-
[columnName]: model,
|
|
12
|
-
}"
|
|
13
|
-
:schemacols="schemaCols"
|
|
14
|
-
:uniqueKey="''"
|
|
15
|
-
:documentTitle="''"
|
|
16
|
-
:resourcename="''"
|
|
17
|
-
/>
|
|
18
|
-
</div>
|
|
19
|
-
</div>
|
|
20
|
-
</template>
|
|
21
|
-
<template
|
|
22
|
-
v-else-if="
|
|
23
|
-
jsonSchema.type === 'array' &&
|
|
24
|
-
jsonSchema.items &&
|
|
25
|
-
_.isObject(jsonSchema.items) &&
|
|
26
|
-
!Array.isArray(jsonSchema.items)
|
|
27
|
-
"
|
|
28
|
-
>
|
|
29
|
-
<template v-if="jsonSchema.items.type === 'object'">
|
|
30
|
-
<div class="col-span-2">
|
|
31
|
-
<SimpleAppInputTable
|
|
32
|
-
:getField="() => {}"
|
|
33
|
-
class="col-span-4"
|
|
34
|
-
:setting="{
|
|
35
|
-
readonly: true,
|
|
36
|
-
}"
|
|
37
|
-
v-model="model"
|
|
38
|
-
>
|
|
39
|
-
<Column
|
|
40
|
-
v-if="
|
|
41
|
-
jsonSchema.items &&
|
|
42
|
-
typeof jsonSchema.items === 'object' &&
|
|
43
|
-
'properties' in jsonSchema.items
|
|
44
|
-
"
|
|
45
|
-
v-for="(subSchema, subSchemaName) in jsonSchema.items.properties"
|
|
46
|
-
:key="subSchemaName"
|
|
47
|
-
:field="subSchemaName.toString()"
|
|
48
|
-
#body="{ index }"
|
|
49
|
-
:header="camelCaseToWords(subSchemaName.toString())"
|
|
50
|
-
>
|
|
51
|
-
<CustomFieldViewFormFieldInput
|
|
52
|
-
v-if="typeof subSchema === 'object' && subSchema !== null"
|
|
53
|
-
:jsonSchema="subSchema"
|
|
54
|
-
:hierarchy="
|
|
55
|
-
hierarchy === '' || hierarchy === undefined
|
|
56
|
-
? (subSchemaName as string)
|
|
57
|
-
: `${hierarchy}.*.${subSchemaName}`
|
|
58
|
-
"
|
|
59
|
-
:schemaSource="schemaSource"
|
|
60
|
-
v-model="model[index][subSchemaName]"
|
|
61
|
-
/>
|
|
62
|
-
</Column>
|
|
63
|
-
</SimpleAppInputTable>
|
|
64
|
-
</div>
|
|
65
|
-
</template>
|
|
66
|
-
<template v-else-if="jsonSchema.items.type === 'string'">
|
|
67
|
-
<div>
|
|
68
|
-
<label v-if="!isParentIsArray" class="text-gray-400 text-sm truncate">
|
|
69
|
-
{{ label }}
|
|
70
|
-
</label>
|
|
71
|
-
<div>
|
|
72
|
-
<PageDocListColumnItem
|
|
73
|
-
:col="columnName"
|
|
74
|
-
:data="{
|
|
75
|
-
[columnName]: model,
|
|
76
|
-
}"
|
|
77
|
-
:schemacols="schemaCols"
|
|
78
|
-
:uniqueKey="''"
|
|
79
|
-
:documentTitle="''"
|
|
80
|
-
:resourcename="''"
|
|
81
|
-
/>
|
|
82
|
-
</div>
|
|
83
|
-
</div>
|
|
84
|
-
</template>
|
|
85
|
-
</template>
|
|
86
|
-
</template>
|
|
87
|
-
|
|
88
|
-
<script setup lang="ts">
|
|
89
|
-
import _ from "lodash";
|
|
90
|
-
import PageDocListColumnItem from "~/components/page/PageDocListColumnItem.vue";
|
|
91
|
-
import {
|
|
92
|
-
SchemaFields,
|
|
93
|
-
SimpleAppInputType,
|
|
94
|
-
SimpleAppJSONSchema7,
|
|
95
|
-
} from "~/types";
|
|
96
|
-
import { SchemaSource } from "~/types/customField.type";
|
|
97
|
-
|
|
98
|
-
const props = defineProps<{
|
|
99
|
-
jsonSchema: SimpleAppJSONSchema7;
|
|
100
|
-
hierarchy: string;
|
|
101
|
-
schemaSource: SchemaSource;
|
|
102
|
-
}>();
|
|
103
|
-
|
|
104
|
-
const model = defineModel<any>();
|
|
105
|
-
|
|
106
|
-
const columnName = computed(() => {
|
|
107
|
-
return props.hierarchy.split(".").pop() ?? "";
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
const schemaCols = computed(() => {
|
|
111
|
-
return {
|
|
112
|
-
[columnName.value]: props.jsonSchema,
|
|
113
|
-
} as SchemaFields;
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
const label = computed(() => {
|
|
117
|
-
return props.jsonSchema.title ?? props.hierarchy.split(".").pop();
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
const fieldPath = computed(() => {
|
|
121
|
-
const hierarchies = props.hierarchy.split(".");
|
|
122
|
-
|
|
123
|
-
const path = (getFieldPathPrefix() + hierarchies.join("/properties/"))
|
|
124
|
-
.replace("properties/*", "items")
|
|
125
|
-
.replace("*", "items");
|
|
126
|
-
|
|
127
|
-
// if (props.schemaSource === "miniAppSetting") {
|
|
128
|
-
// return path.replace("/properties/setting", "");
|
|
129
|
-
// }
|
|
130
|
-
|
|
131
|
-
return path;
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
const inputType = computed(() => {
|
|
135
|
-
return getInputType(props.jsonSchema);
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
const isParentIsArray = computed(() => {
|
|
139
|
-
const hierarchies = props.hierarchy.split(".");
|
|
140
|
-
return hierarchies[hierarchies.length - 2] == "*";
|
|
141
|
-
});
|
|
142
|
-
|
|
143
|
-
function getFieldPathPrefix() {
|
|
144
|
-
if (props.schemaSource === "customField") {
|
|
145
|
-
return "#/properties/more/properties/";
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
return "#/properties/";
|
|
149
|
-
}
|
|
150
|
-
</script>
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<section v-if="validProperties" class="space-y-4">
|
|
3
|
-
<template
|
|
4
|
-
v-for="(groupJsonSchema, groupName) in validProperties"
|
|
5
|
-
:key="groupName"
|
|
6
|
-
>
|
|
7
|
-
<CustomFieldViewFormField
|
|
8
|
-
v-if="isValidSchema(groupJsonSchema)"
|
|
9
|
-
:jsonSchema="groupJsonSchema"
|
|
10
|
-
:data="data"
|
|
11
|
-
:schemaName="groupName.toString()"
|
|
12
|
-
:hierarchy="groupName.toString()"
|
|
13
|
-
schemaSource="customField"
|
|
14
|
-
/>
|
|
15
|
-
</template>
|
|
16
|
-
</section>
|
|
17
|
-
</template>
|
|
18
|
-
|
|
19
|
-
<script setup lang="ts">
|
|
20
|
-
import _ from 'lodash';
|
|
21
|
-
import { CustomFieldMoreSchema } from '~/simpleapp/generate/features/customField/types/common';
|
|
22
|
-
import CustomFieldViewFormField from './CustomFieldViewFormField.vue';
|
|
23
|
-
|
|
24
|
-
const props = defineProps<{
|
|
25
|
-
customFieldJsonSchema: CustomFieldMoreSchema;
|
|
26
|
-
data: any;
|
|
27
|
-
}>();
|
|
28
|
-
|
|
29
|
-
const validProperties = computed(() => {
|
|
30
|
-
if (
|
|
31
|
-
props.customFieldJsonSchema.properties !== undefined &&
|
|
32
|
-
typeof props.customFieldJsonSchema.properties === 'object'
|
|
33
|
-
) {
|
|
34
|
-
return props.customFieldJsonSchema.properties;
|
|
35
|
-
}
|
|
36
|
-
return false;
|
|
37
|
-
});
|
|
38
|
-
</script>
|