@steedos-widgets/amis-lib 1.2.13 → 1.2.14
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/cjs/tsconfig.tsbuildinfo +1 -1
- package/dist/index.cjs.js +73 -54
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +73 -54
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +73 -54
- package/dist/index.umd.js.map +1 -1
- package/dist/types/lib/converter/amis/fields/lookup.d.ts +1 -67
- package/dist/types/lib/converter/amis/fields/sections.d.ts +9 -0
- package/dist/types/lib/converter/amis/form.d.ts +9 -0
- package/dist/types/lib/converter/amis/index.d.ts +9 -0
- package/dist/types/lib/objects.d.ts +9 -0
- package/package.json +2 -2
package/dist/index.umd.js
CHANGED
|
@@ -5518,6 +5518,10 @@ else{
|
|
|
5518
5518
|
};
|
|
5519
5519
|
}
|
|
5520
5520
|
|
|
5521
|
+
if(field.pickerSchema){
|
|
5522
|
+
pickerSchema = Object.assign({}, pickerSchema, field.pickerSchema);
|
|
5523
|
+
}
|
|
5524
|
+
|
|
5521
5525
|
const data = {
|
|
5522
5526
|
type: getAmisStaticFieldType('picker', readonly),
|
|
5523
5527
|
labelField: referenceTo.labelField.name,
|
|
@@ -7148,12 +7152,12 @@ else{
|
|
|
7148
7152
|
/*
|
|
7149
7153
|
* @Author: baozhoutao@steedos.com
|
|
7150
7154
|
* @Date: 2022-05-26 16:02:08
|
|
7151
|
-
* @LastEditors:
|
|
7152
|
-
* @LastEditTime: 2023-
|
|
7155
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
7156
|
+
* @LastEditTime: 2023-06-02 16:54:41
|
|
7153
7157
|
* @Description:
|
|
7154
7158
|
*/
|
|
7155
7159
|
|
|
7156
|
-
const getFieldSchemaArray = (formFields)=>{
|
|
7160
|
+
const getFieldSchemaArray = (formFields) => {
|
|
7157
7161
|
let fieldSchemaArray = [];
|
|
7158
7162
|
fieldSchemaArray.length = 0;
|
|
7159
7163
|
|
|
@@ -7166,10 +7170,10 @@ else{
|
|
|
7166
7170
|
// field.group = field.label
|
|
7167
7171
|
field.is_wide = true;
|
|
7168
7172
|
}
|
|
7169
|
-
|
|
7170
|
-
if (!isObjectField){
|
|
7171
|
-
if(!field.hidden){
|
|
7172
|
-
|
|
7173
|
+
|
|
7174
|
+
if (!isObjectField) {
|
|
7175
|
+
if (!field.hidden) {
|
|
7176
|
+
fieldSchemaArray.push(Object.assign({ name: fieldName }, field, { permission: { allowEdit: true } }));
|
|
7173
7177
|
}
|
|
7174
7178
|
}
|
|
7175
7179
|
});
|
|
@@ -7177,89 +7181,104 @@ else{
|
|
|
7177
7181
|
};
|
|
7178
7182
|
|
|
7179
7183
|
const getSection = async (formFields, permissionFields, fieldSchemaArray, sectionName, ctx) => {
|
|
7184
|
+
if (!ctx) {
|
|
7185
|
+
ctx = {};
|
|
7186
|
+
}
|
|
7180
7187
|
const sectionFields = ___namespace.filter(fieldSchemaArray, { 'group': sectionName });
|
|
7181
|
-
if(sectionFields.length == ___namespace.filter(sectionFields, ['hidden', true]).length){
|
|
7182
|
-
return
|
|
7188
|
+
if (sectionFields.length == ___namespace.filter(sectionFields, ['hidden', true]).length) {
|
|
7189
|
+
return;
|
|
7183
7190
|
}
|
|
7184
7191
|
|
|
7185
7192
|
const fieldSetBody = [];
|
|
7186
7193
|
|
|
7187
7194
|
for (const perField of sectionFields) {
|
|
7188
7195
|
let field = perField;
|
|
7189
|
-
|
|
7190
|
-
|
|
7191
|
-
|
|
7192
|
-
|
|
7193
|
-
|
|
7194
|
-
|
|
7195
|
-
|
|
7196
|
-
|
|
7197
|
-
|
|
7198
|
-
|
|
7199
|
-
|
|
7200
|
-
|
|
7201
|
-
|
|
7202
|
-
}
|
|
7196
|
+
if (perField.type === 'grid') {
|
|
7197
|
+
field = await getGridFieldSubFields(perField, formFields);
|
|
7198
|
+
// console.log(`perField.type grid ===> field`, field)
|
|
7199
|
+
} else if (perField.type === 'object') {
|
|
7200
|
+
field = await getObjectFieldSubFields(perField, formFields);
|
|
7201
|
+
// console.log(`perField.type object ===> field`, field)
|
|
7202
|
+
}
|
|
7203
|
+
if (field.name.indexOf(".") < 0) {
|
|
7204
|
+
ctx.__formFields = formFields;
|
|
7205
|
+
const amisField = await convertSFieldToAmisField(field, field.readonly, ctx);
|
|
7206
|
+
// console.log(`${field.name} amisField`, field, amisField)
|
|
7207
|
+
if (amisField) {
|
|
7208
|
+
fieldSetBody.push(amisField);
|
|
7203
7209
|
}
|
|
7210
|
+
}
|
|
7204
7211
|
}
|
|
7205
7212
|
|
|
7206
7213
|
// fieldSet 已支持显隐控制
|
|
7207
|
-
const sectionFieldsVisibleOn = ___namespace.map(___namespace.compact(___namespace.map(fieldSetBody, 'visibleOn'))
|
|
7214
|
+
const sectionFieldsVisibleOn = ___namespace.map(___namespace.compact(___namespace.map(fieldSetBody, 'visibleOn')), (visibleOn) => {
|
|
7208
7215
|
return visibleOn;
|
|
7209
7216
|
});
|
|
7210
|
-
|
|
7217
|
+
|
|
7218
|
+
let section = {
|
|
7211
7219
|
"type": "fieldSet",
|
|
7212
7220
|
"title": sectionName,
|
|
7213
7221
|
"collapsable": true,
|
|
7214
7222
|
"body": fieldSetBody,
|
|
7215
7223
|
};
|
|
7216
|
-
|
|
7224
|
+
|
|
7225
|
+
if (ctx.enableTabs) {
|
|
7226
|
+
section = {
|
|
7227
|
+
"title": sectionName,
|
|
7228
|
+
"body": fieldSetBody,
|
|
7229
|
+
};
|
|
7230
|
+
}
|
|
7231
|
+
|
|
7232
|
+
if (sectionFieldsVisibleOn.length > 0 && fieldSetBody.length === sectionFieldsVisibleOn.length) {
|
|
7217
7233
|
section.visibleOn = `${sectionFieldsVisibleOn.join(" || ")}`;
|
|
7218
7234
|
}
|
|
7219
7235
|
return section
|
|
7220
7236
|
};
|
|
7221
7237
|
|
|
7222
7238
|
const getSections = async (permissionFields, formFields, ctx) => {
|
|
7239
|
+
if (!ctx) {
|
|
7240
|
+
ctx = {};
|
|
7241
|
+
}
|
|
7223
7242
|
const fieldSchemaArray = getFieldSchemaArray(formFields);
|
|
7224
7243
|
const _sections = ___namespace.groupBy(fieldSchemaArray, 'group');
|
|
7225
7244
|
const sections = [];
|
|
7226
|
-
var
|
|
7245
|
+
var sectionVisibleOns = [];
|
|
7227
7246
|
for (const key in _sections) {
|
|
7228
7247
|
const section = await getSection(formFields, permissionFields, fieldSchemaArray, key, ctx);
|
|
7229
|
-
if(section.body.length > 0){
|
|
7230
|
-
if(section.visibleOn){
|
|
7231
|
-
|
|
7248
|
+
if (section.body.length > 0) {
|
|
7249
|
+
if (section.visibleOn) {
|
|
7250
|
+
sectionVisibleOns.push(section.visibleOn);
|
|
7251
|
+
}
|
|
7252
|
+
else {
|
|
7253
|
+
sectionVisibleOns.push("true");
|
|
7232
7254
|
}
|
|
7233
7255
|
sections.push(section);
|
|
7234
7256
|
}
|
|
7235
7257
|
}
|
|
7236
7258
|
/*
|
|
7237
7259
|
为了实现只有一个分组时隐藏该分组标题,需要分三种情况(分组如果没有visibleon属性就代表一定显示,有visibleon需要进行判断)
|
|
7238
|
-
1
|
|
7239
|
-
2
|
|
7240
|
-
|
|
7241
|
-
2.2 当前分组为显示时,其他分组只要有一个是显示,就显示该分组标题
|
|
7242
|
-
2.3 当前分组为显示时,其他分组都隐藏,就隐藏该分组标题
|
|
7243
|
-
3.所有分组中有两个以上的分组没有visibleon(这种情况不用处理)
|
|
7260
|
+
1 当前分组为隐藏时,标题就设置为隐藏
|
|
7261
|
+
2 当前分组为显示时,其他分组只要有一个是显示,就显示该分组标题
|
|
7262
|
+
3 当前分组为显示时,其他分组都隐藏,就隐藏该分组标题
|
|
7244
7263
|
*/
|
|
7245
|
-
|
|
7246
|
-
|
|
7247
|
-
|
|
7248
|
-
|
|
7249
|
-
|
|
7250
|
-
|
|
7251
|
-
|
|
7252
|
-
|
|
7253
|
-
|
|
7254
|
-
|
|
7255
|
-
|
|
7256
|
-
|
|
7257
|
-
|
|
7258
|
-
|
|
7259
|
-
|
|
7260
|
-
|
|
7261
|
-
|
|
7262
|
-
|
|
7264
|
+
sections.forEach((section, index) => {
|
|
7265
|
+
var tempSectionVisibleOns = sectionVisibleOns.slice();
|
|
7266
|
+
tempSectionVisibleOns.splice(index, 1);
|
|
7267
|
+
section.headingClassName = {
|
|
7268
|
+
"hidden": `!((${tempSectionVisibleOns.join(" || ") || 'false'}) && ${sectionVisibleOns[index]})`
|
|
7269
|
+
};
|
|
7270
|
+
});
|
|
7271
|
+
|
|
7272
|
+
if (ctx.enableTabs) {
|
|
7273
|
+
return [
|
|
7274
|
+
{
|
|
7275
|
+
"type": "tabs",
|
|
7276
|
+
"tabs": sections,
|
|
7277
|
+
"tabsMode": ctx.tabsMode
|
|
7278
|
+
}
|
|
7279
|
+
]
|
|
7280
|
+
}
|
|
7281
|
+
|
|
7263
7282
|
return sections;
|
|
7264
7283
|
};
|
|
7265
7284
|
|