@steedos/service-plugin-amis 2.7.7 → 2.7.8-beta.2
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.
|
@@ -106,6 +106,9 @@ module.exports = {
|
|
|
106
106
|
case "record":
|
|
107
107
|
schema = await PageSchema.getRecordPageInitSchema(objectApiName, userSession);
|
|
108
108
|
break;
|
|
109
|
+
case "field_layout":
|
|
110
|
+
schema = await PageSchema.getFieldLayoutInitSchema(objectApiName, userSession);
|
|
111
|
+
break;
|
|
109
112
|
}
|
|
110
113
|
return schema;
|
|
111
114
|
// return AmisSchema.getRecordSchema(objectApiName, '${recordId}', false, userSession);
|
|
@@ -120,7 +120,81 @@ const getRecordPageInitSchema = async function (objectApiName, userSession) {
|
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
+
// 获取字段布局页面初始化amisSchema
|
|
124
|
+
const getFieldLayoutInitSchema = async function (objectApiName, userSession) {
|
|
125
|
+
const fieldProps = ["_name", "name", "type", "amis", "auto_fill_mapping", "autonumber_enable_modify", "column_name", "coordinatesType", "create", "data_type",
|
|
126
|
+
"defaultValue", "deleted_lookup_record_behavior", "depend_on", "description", "enable_enhanced_lookup", "enable_thousands", "filterable", "filters", "filtersFunction", "formula_blank_value", "formula",
|
|
127
|
+
"generated", "group", "hidden", "index", "inlineHelpText", "is_customize", "is_name", "is_system", "is_wide", "label", "language", "multiple", "object", "options", "precision", "primary", "readonly", "reference_to_field",
|
|
128
|
+
"reference_to", "required", "rows", "scale", "searchable", "show_as_qr", "sort_no", "sortable", "static", "summary_field", "summary_object", "summary_filters", "summary_type", "unique", "visible_on", "write_requires_master_read"
|
|
129
|
+
];
|
|
130
|
+
var body = [];
|
|
131
|
+
const uiSchema = await getUISchema(objectApiName, userSession);
|
|
132
|
+
const groups = uiSchema.field_groups || [];
|
|
133
|
+
const object = await objectql.getObject('object_fields');
|
|
134
|
+
const fields = await object.find({filters: ['object','=', objectApiName]});
|
|
135
|
+
|
|
136
|
+
_.forEach(fields, (field,index) => {
|
|
137
|
+
if (field.group) {
|
|
138
|
+
let current_group = _.find(groups, function (group) { return group.group_name == field.group; });
|
|
139
|
+
if (!current_group) {
|
|
140
|
+
groups.push({
|
|
141
|
+
group_name: field.group
|
|
142
|
+
})
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
fields[index] = _.pick(field,fieldProps)
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
const no_group_fields = _.filter(fields, field => !field.group);
|
|
149
|
+
body.push({
|
|
150
|
+
"type": "fieldSet",
|
|
151
|
+
"title": "",
|
|
152
|
+
"body": _.map(no_group_fields, field => {
|
|
153
|
+
return {
|
|
154
|
+
"type": "steedos-field",
|
|
155
|
+
"config": {
|
|
156
|
+
"amis": {
|
|
157
|
+
},
|
|
158
|
+
...field
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
})
|
|
162
|
+
})
|
|
163
|
+
|
|
164
|
+
_.forEach(groups, group => {
|
|
165
|
+
const filter_fields = _.filter(fields, field => field.group == group.group_name);
|
|
166
|
+
const field_set = {
|
|
167
|
+
"type": "fieldSet",
|
|
168
|
+
"title": group.group_name,
|
|
169
|
+
"body": _.map(filter_fields, field => {
|
|
170
|
+
return {
|
|
171
|
+
"type": "steedos-field",
|
|
172
|
+
"config": {
|
|
173
|
+
"amis": {
|
|
174
|
+
},
|
|
175
|
+
...field
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
})
|
|
179
|
+
};
|
|
180
|
+
if (group.visible_on) {
|
|
181
|
+
field_set.visibleOn = group.visible_on;
|
|
182
|
+
}
|
|
183
|
+
if (group.collapsed) {
|
|
184
|
+
field_set.collapsed = group.collapsed;
|
|
185
|
+
}
|
|
186
|
+
body.push(field_set)
|
|
187
|
+
})
|
|
188
|
+
return {
|
|
189
|
+
type: 'service',
|
|
190
|
+
name: getScopeId(objectApiName, "form"),
|
|
191
|
+
className: "steedos-amis-form steedos-field-layout-page",
|
|
192
|
+
body
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
123
196
|
|
|
124
197
|
exports.getFormPageInitSchema = getFormPageInitSchema;
|
|
125
198
|
exports.getListPageInitSchema = getListPageInitSchema;
|
|
126
|
-
exports.getRecordPageInitSchema = getRecordPageInitSchema;
|
|
199
|
+
exports.getRecordPageInitSchema = getRecordPageInitSchema;
|
|
200
|
+
exports.getFieldLayoutInitSchema = getFieldLayoutInitSchema;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@steedos/service-plugin-amis",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.8-beta.2",
|
|
4
4
|
"main": "package.service.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "yarn build:tailwind-base && yarn build:tailwind",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"publishConfig": {
|
|
14
14
|
"access": "public"
|
|
15
15
|
},
|
|
16
|
-
"gitHead": "
|
|
16
|
+
"gitHead": "d915768c87aaa7bc026623a4953d6f39c5ddace1",
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"tailwindcss": "3.2.4"
|
|
19
19
|
}
|