@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.esm.js
CHANGED
|
@@ -5492,6 +5492,10 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
5492
5492
|
};
|
|
5493
5493
|
}
|
|
5494
5494
|
|
|
5495
|
+
if(field.pickerSchema){
|
|
5496
|
+
pickerSchema = Object.assign({}, pickerSchema, field.pickerSchema);
|
|
5497
|
+
}
|
|
5498
|
+
|
|
5495
5499
|
const data = {
|
|
5496
5500
|
type: getAmisStaticFieldType('picker', readonly),
|
|
5497
5501
|
labelField: referenceTo.labelField.name,
|
|
@@ -7122,12 +7126,12 @@ function getBatchDelete(objectName){
|
|
|
7122
7126
|
/*
|
|
7123
7127
|
* @Author: baozhoutao@steedos.com
|
|
7124
7128
|
* @Date: 2022-05-26 16:02:08
|
|
7125
|
-
* @LastEditors:
|
|
7126
|
-
* @LastEditTime: 2023-
|
|
7129
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
7130
|
+
* @LastEditTime: 2023-06-02 16:54:41
|
|
7127
7131
|
* @Description:
|
|
7128
7132
|
*/
|
|
7129
7133
|
|
|
7130
|
-
const getFieldSchemaArray = (formFields)=>{
|
|
7134
|
+
const getFieldSchemaArray = (formFields) => {
|
|
7131
7135
|
let fieldSchemaArray = [];
|
|
7132
7136
|
fieldSchemaArray.length = 0;
|
|
7133
7137
|
|
|
@@ -7140,10 +7144,10 @@ const getFieldSchemaArray = (formFields)=>{
|
|
|
7140
7144
|
// field.group = field.label
|
|
7141
7145
|
field.is_wide = true;
|
|
7142
7146
|
}
|
|
7143
|
-
|
|
7144
|
-
if (!isObjectField){
|
|
7145
|
-
if(!field.hidden){
|
|
7146
|
-
|
|
7147
|
+
|
|
7148
|
+
if (!isObjectField) {
|
|
7149
|
+
if (!field.hidden) {
|
|
7150
|
+
fieldSchemaArray.push(Object.assign({ name: fieldName }, field, { permission: { allowEdit: true } }));
|
|
7147
7151
|
}
|
|
7148
7152
|
}
|
|
7149
7153
|
});
|
|
@@ -7151,89 +7155,104 @@ const getFieldSchemaArray = (formFields)=>{
|
|
|
7151
7155
|
};
|
|
7152
7156
|
|
|
7153
7157
|
const getSection = async (formFields, permissionFields, fieldSchemaArray, sectionName, ctx) => {
|
|
7158
|
+
if (!ctx) {
|
|
7159
|
+
ctx = {};
|
|
7160
|
+
}
|
|
7154
7161
|
const sectionFields = _$1.filter(fieldSchemaArray, { 'group': sectionName });
|
|
7155
|
-
if(sectionFields.length == _$1.filter(sectionFields, ['hidden', true]).length){
|
|
7156
|
-
return
|
|
7162
|
+
if (sectionFields.length == _$1.filter(sectionFields, ['hidden', true]).length) {
|
|
7163
|
+
return;
|
|
7157
7164
|
}
|
|
7158
7165
|
|
|
7159
7166
|
const fieldSetBody = [];
|
|
7160
7167
|
|
|
7161
7168
|
for (const perField of sectionFields) {
|
|
7162
7169
|
let field = perField;
|
|
7163
|
-
|
|
7164
|
-
|
|
7165
|
-
|
|
7166
|
-
|
|
7167
|
-
|
|
7168
|
-
|
|
7169
|
-
|
|
7170
|
-
|
|
7171
|
-
|
|
7172
|
-
|
|
7173
|
-
|
|
7174
|
-
|
|
7175
|
-
|
|
7176
|
-
}
|
|
7170
|
+
if (perField.type === 'grid') {
|
|
7171
|
+
field = await getGridFieldSubFields(perField, formFields);
|
|
7172
|
+
// console.log(`perField.type grid ===> field`, field)
|
|
7173
|
+
} else if (perField.type === 'object') {
|
|
7174
|
+
field = await getObjectFieldSubFields(perField, formFields);
|
|
7175
|
+
// console.log(`perField.type object ===> field`, field)
|
|
7176
|
+
}
|
|
7177
|
+
if (field.name.indexOf(".") < 0) {
|
|
7178
|
+
ctx.__formFields = formFields;
|
|
7179
|
+
const amisField = await convertSFieldToAmisField(field, field.readonly, ctx);
|
|
7180
|
+
// console.log(`${field.name} amisField`, field, amisField)
|
|
7181
|
+
if (amisField) {
|
|
7182
|
+
fieldSetBody.push(amisField);
|
|
7177
7183
|
}
|
|
7184
|
+
}
|
|
7178
7185
|
}
|
|
7179
7186
|
|
|
7180
7187
|
// fieldSet 已支持显隐控制
|
|
7181
|
-
const sectionFieldsVisibleOn = _$1.map(_$1.compact(_$1.map(fieldSetBody, 'visibleOn'))
|
|
7188
|
+
const sectionFieldsVisibleOn = _$1.map(_$1.compact(_$1.map(fieldSetBody, 'visibleOn')), (visibleOn) => {
|
|
7182
7189
|
return visibleOn;
|
|
7183
7190
|
});
|
|
7184
|
-
|
|
7191
|
+
|
|
7192
|
+
let section = {
|
|
7185
7193
|
"type": "fieldSet",
|
|
7186
7194
|
"title": sectionName,
|
|
7187
7195
|
"collapsable": true,
|
|
7188
7196
|
"body": fieldSetBody,
|
|
7189
7197
|
};
|
|
7190
|
-
|
|
7198
|
+
|
|
7199
|
+
if (ctx.enableTabs) {
|
|
7200
|
+
section = {
|
|
7201
|
+
"title": sectionName,
|
|
7202
|
+
"body": fieldSetBody,
|
|
7203
|
+
};
|
|
7204
|
+
}
|
|
7205
|
+
|
|
7206
|
+
if (sectionFieldsVisibleOn.length > 0 && fieldSetBody.length === sectionFieldsVisibleOn.length) {
|
|
7191
7207
|
section.visibleOn = `${sectionFieldsVisibleOn.join(" || ")}`;
|
|
7192
7208
|
}
|
|
7193
7209
|
return section
|
|
7194
7210
|
};
|
|
7195
7211
|
|
|
7196
7212
|
const getSections = async (permissionFields, formFields, ctx) => {
|
|
7213
|
+
if (!ctx) {
|
|
7214
|
+
ctx = {};
|
|
7215
|
+
}
|
|
7197
7216
|
const fieldSchemaArray = getFieldSchemaArray(formFields);
|
|
7198
7217
|
const _sections = _$1.groupBy(fieldSchemaArray, 'group');
|
|
7199
7218
|
const sections = [];
|
|
7200
|
-
var
|
|
7219
|
+
var sectionVisibleOns = [];
|
|
7201
7220
|
for (const key in _sections) {
|
|
7202
7221
|
const section = await getSection(formFields, permissionFields, fieldSchemaArray, key, ctx);
|
|
7203
|
-
if(section.body.length > 0){
|
|
7204
|
-
if(section.visibleOn){
|
|
7205
|
-
|
|
7222
|
+
if (section.body.length > 0) {
|
|
7223
|
+
if (section.visibleOn) {
|
|
7224
|
+
sectionVisibleOns.push(section.visibleOn);
|
|
7225
|
+
}
|
|
7226
|
+
else {
|
|
7227
|
+
sectionVisibleOns.push("true");
|
|
7206
7228
|
}
|
|
7207
7229
|
sections.push(section);
|
|
7208
7230
|
}
|
|
7209
7231
|
}
|
|
7210
7232
|
/*
|
|
7211
7233
|
为了实现只有一个分组时隐藏该分组标题,需要分三种情况(分组如果没有visibleon属性就代表一定显示,有visibleon需要进行判断)
|
|
7212
|
-
1
|
|
7213
|
-
2
|
|
7214
|
-
|
|
7215
|
-
2.2 当前分组为显示时,其他分组只要有一个是显示,就显示该分组标题
|
|
7216
|
-
2.3 当前分组为显示时,其他分组都隐藏,就隐藏该分组标题
|
|
7217
|
-
3.所有分组中有两个以上的分组没有visibleon(这种情况不用处理)
|
|
7234
|
+
1 当前分组为隐藏时,标题就设置为隐藏
|
|
7235
|
+
2 当前分组为显示时,其他分组只要有一个是显示,就显示该分组标题
|
|
7236
|
+
3 当前分组为显示时,其他分组都隐藏,就隐藏该分组标题
|
|
7218
7237
|
*/
|
|
7219
|
-
|
|
7220
|
-
|
|
7221
|
-
|
|
7222
|
-
|
|
7223
|
-
|
|
7224
|
-
|
|
7225
|
-
|
|
7226
|
-
|
|
7227
|
-
|
|
7228
|
-
|
|
7229
|
-
|
|
7230
|
-
|
|
7231
|
-
|
|
7232
|
-
|
|
7233
|
-
|
|
7234
|
-
|
|
7235
|
-
|
|
7236
|
-
|
|
7238
|
+
sections.forEach((section, index) => {
|
|
7239
|
+
var tempSectionVisibleOns = sectionVisibleOns.slice();
|
|
7240
|
+
tempSectionVisibleOns.splice(index, 1);
|
|
7241
|
+
section.headingClassName = {
|
|
7242
|
+
"hidden": `!((${tempSectionVisibleOns.join(" || ") || 'false'}) && ${sectionVisibleOns[index]})`
|
|
7243
|
+
};
|
|
7244
|
+
});
|
|
7245
|
+
|
|
7246
|
+
if (ctx.enableTabs) {
|
|
7247
|
+
return [
|
|
7248
|
+
{
|
|
7249
|
+
"type": "tabs",
|
|
7250
|
+
"tabs": sections,
|
|
7251
|
+
"tabsMode": ctx.tabsMode
|
|
7252
|
+
}
|
|
7253
|
+
]
|
|
7254
|
+
}
|
|
7255
|
+
|
|
7237
7256
|
return sections;
|
|
7238
7257
|
};
|
|
7239
7258
|
|