@steedos-widgets/amis-object 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/amis-object.cjs.js +78 -57
- package/dist/amis-object.cjs.js.map +1 -1
- package/dist/amis-object.esm.js +78 -57
- package/dist/amis-object.esm.js.map +1 -1
- package/dist/amis-object.umd.js +78 -57
- package/dist/amis-object.umd.js.map +1 -1
- package/dist/assets.json +11 -11
- package/package.json +3 -3
package/dist/amis-object.esm.js
CHANGED
|
@@ -5851,6 +5851,10 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
5851
5851
|
};
|
|
5852
5852
|
}
|
|
5853
5853
|
|
|
5854
|
+
if(field.pickerSchema){
|
|
5855
|
+
pickerSchema = Object.assign({}, pickerSchema, field.pickerSchema);
|
|
5856
|
+
}
|
|
5857
|
+
|
|
5854
5858
|
const data = {
|
|
5855
5859
|
type: getAmisStaticFieldType('picker', readonly),
|
|
5856
5860
|
labelField: referenceTo.labelField.name,
|
|
@@ -7481,12 +7485,12 @@ function getBatchDelete(objectName){
|
|
|
7481
7485
|
/*
|
|
7482
7486
|
* @Author: baozhoutao@steedos.com
|
|
7483
7487
|
* @Date: 2022-05-26 16:02:08
|
|
7484
|
-
* @LastEditors:
|
|
7485
|
-
* @LastEditTime: 2023-
|
|
7488
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
7489
|
+
* @LastEditTime: 2023-06-02 16:54:41
|
|
7486
7490
|
* @Description:
|
|
7487
7491
|
*/
|
|
7488
7492
|
|
|
7489
|
-
const getFieldSchemaArray = (formFields)=>{
|
|
7493
|
+
const getFieldSchemaArray = (formFields) => {
|
|
7490
7494
|
let fieldSchemaArray = [];
|
|
7491
7495
|
fieldSchemaArray.length = 0;
|
|
7492
7496
|
|
|
@@ -7499,10 +7503,10 @@ const getFieldSchemaArray = (formFields)=>{
|
|
|
7499
7503
|
// field.group = field.label
|
|
7500
7504
|
field.is_wide = true;
|
|
7501
7505
|
}
|
|
7502
|
-
|
|
7503
|
-
if (!isObjectField){
|
|
7504
|
-
if(!field.hidden){
|
|
7505
|
-
|
|
7506
|
+
|
|
7507
|
+
if (!isObjectField) {
|
|
7508
|
+
if (!field.hidden) {
|
|
7509
|
+
fieldSchemaArray.push(Object.assign({ name: fieldName }, field, { permission: { allowEdit: true } }));
|
|
7506
7510
|
}
|
|
7507
7511
|
}
|
|
7508
7512
|
});
|
|
@@ -7510,89 +7514,104 @@ const getFieldSchemaArray = (formFields)=>{
|
|
|
7510
7514
|
};
|
|
7511
7515
|
|
|
7512
7516
|
const getSection = async (formFields, permissionFields, fieldSchemaArray, sectionName, ctx) => {
|
|
7517
|
+
if (!ctx) {
|
|
7518
|
+
ctx = {};
|
|
7519
|
+
}
|
|
7513
7520
|
const sectionFields = ___default.filter(fieldSchemaArray, { 'group': sectionName });
|
|
7514
|
-
if(sectionFields.length == ___default.filter(sectionFields, ['hidden', true]).length){
|
|
7515
|
-
return
|
|
7521
|
+
if (sectionFields.length == ___default.filter(sectionFields, ['hidden', true]).length) {
|
|
7522
|
+
return;
|
|
7516
7523
|
}
|
|
7517
7524
|
|
|
7518
7525
|
const fieldSetBody = [];
|
|
7519
7526
|
|
|
7520
7527
|
for (const perField of sectionFields) {
|
|
7521
7528
|
let field = perField;
|
|
7522
|
-
|
|
7523
|
-
|
|
7524
|
-
|
|
7525
|
-
|
|
7526
|
-
|
|
7527
|
-
|
|
7528
|
-
|
|
7529
|
-
|
|
7530
|
-
|
|
7531
|
-
|
|
7532
|
-
|
|
7533
|
-
|
|
7534
|
-
|
|
7535
|
-
}
|
|
7529
|
+
if (perField.type === 'grid') {
|
|
7530
|
+
field = await getGridFieldSubFields(perField, formFields);
|
|
7531
|
+
// console.log(`perField.type grid ===> field`, field)
|
|
7532
|
+
} else if (perField.type === 'object') {
|
|
7533
|
+
field = await getObjectFieldSubFields(perField, formFields);
|
|
7534
|
+
// console.log(`perField.type object ===> field`, field)
|
|
7535
|
+
}
|
|
7536
|
+
if (field.name.indexOf(".") < 0) {
|
|
7537
|
+
ctx.__formFields = formFields;
|
|
7538
|
+
const amisField = await convertSFieldToAmisField(field, field.readonly, ctx);
|
|
7539
|
+
// console.log(`${field.name} amisField`, field, amisField)
|
|
7540
|
+
if (amisField) {
|
|
7541
|
+
fieldSetBody.push(amisField);
|
|
7536
7542
|
}
|
|
7543
|
+
}
|
|
7537
7544
|
}
|
|
7538
7545
|
|
|
7539
7546
|
// fieldSet 已支持显隐控制
|
|
7540
|
-
const sectionFieldsVisibleOn = ___default.map(___default.compact(___default.map(fieldSetBody, 'visibleOn'))
|
|
7547
|
+
const sectionFieldsVisibleOn = ___default.map(___default.compact(___default.map(fieldSetBody, 'visibleOn')), (visibleOn) => {
|
|
7541
7548
|
return visibleOn;
|
|
7542
7549
|
});
|
|
7543
|
-
|
|
7550
|
+
|
|
7551
|
+
let section = {
|
|
7544
7552
|
"type": "fieldSet",
|
|
7545
7553
|
"title": sectionName,
|
|
7546
7554
|
"collapsable": true,
|
|
7547
7555
|
"body": fieldSetBody,
|
|
7548
7556
|
};
|
|
7549
|
-
|
|
7557
|
+
|
|
7558
|
+
if (ctx.enableTabs) {
|
|
7559
|
+
section = {
|
|
7560
|
+
"title": sectionName,
|
|
7561
|
+
"body": fieldSetBody,
|
|
7562
|
+
};
|
|
7563
|
+
}
|
|
7564
|
+
|
|
7565
|
+
if (sectionFieldsVisibleOn.length > 0 && fieldSetBody.length === sectionFieldsVisibleOn.length) {
|
|
7550
7566
|
section.visibleOn = `${sectionFieldsVisibleOn.join(" || ")}`;
|
|
7551
7567
|
}
|
|
7552
7568
|
return section
|
|
7553
7569
|
};
|
|
7554
7570
|
|
|
7555
7571
|
const getSections = async (permissionFields, formFields, ctx) => {
|
|
7572
|
+
if (!ctx) {
|
|
7573
|
+
ctx = {};
|
|
7574
|
+
}
|
|
7556
7575
|
const fieldSchemaArray = getFieldSchemaArray(formFields);
|
|
7557
7576
|
const _sections = ___default.groupBy(fieldSchemaArray, 'group');
|
|
7558
7577
|
const sections = [];
|
|
7559
|
-
var
|
|
7578
|
+
var sectionVisibleOns = [];
|
|
7560
7579
|
for (const key in _sections) {
|
|
7561
7580
|
const section = await getSection(formFields, permissionFields, fieldSchemaArray, key, ctx);
|
|
7562
|
-
if(section.body.length > 0){
|
|
7563
|
-
if(section.visibleOn){
|
|
7564
|
-
|
|
7581
|
+
if (section.body.length > 0) {
|
|
7582
|
+
if (section.visibleOn) {
|
|
7583
|
+
sectionVisibleOns.push(section.visibleOn);
|
|
7584
|
+
}
|
|
7585
|
+
else {
|
|
7586
|
+
sectionVisibleOns.push("true");
|
|
7565
7587
|
}
|
|
7566
7588
|
sections.push(section);
|
|
7567
7589
|
}
|
|
7568
7590
|
}
|
|
7569
7591
|
/*
|
|
7570
7592
|
为了实现只有一个分组时隐藏该分组标题,需要分三种情况(分组如果没有visibleon属性就代表一定显示,有visibleon需要进行判断)
|
|
7571
|
-
1
|
|
7572
|
-
2
|
|
7573
|
-
|
|
7574
|
-
2.2 当前分组为显示时,其他分组只要有一个是显示,就显示该分组标题
|
|
7575
|
-
2.3 当前分组为显示时,其他分组都隐藏,就隐藏该分组标题
|
|
7576
|
-
3.所有分组中有两个以上的分组没有visibleon(这种情况不用处理)
|
|
7593
|
+
1 当前分组为隐藏时,标题就设置为隐藏
|
|
7594
|
+
2 当前分组为显示时,其他分组只要有一个是显示,就显示该分组标题
|
|
7595
|
+
3 当前分组为显示时,其他分组都隐藏,就隐藏该分组标题
|
|
7577
7596
|
*/
|
|
7578
|
-
|
|
7579
|
-
|
|
7580
|
-
|
|
7581
|
-
|
|
7582
|
-
|
|
7583
|
-
|
|
7584
|
-
|
|
7585
|
-
|
|
7586
|
-
|
|
7587
|
-
|
|
7588
|
-
|
|
7589
|
-
|
|
7590
|
-
|
|
7591
|
-
|
|
7592
|
-
|
|
7593
|
-
|
|
7594
|
-
|
|
7595
|
-
|
|
7597
|
+
sections.forEach((section, index) => {
|
|
7598
|
+
var tempSectionVisibleOns = sectionVisibleOns.slice();
|
|
7599
|
+
tempSectionVisibleOns.splice(index, 1);
|
|
7600
|
+
section.headingClassName = {
|
|
7601
|
+
"hidden": `!((${tempSectionVisibleOns.join(" || ") || 'false'}) && ${sectionVisibleOns[index]})`
|
|
7602
|
+
};
|
|
7603
|
+
});
|
|
7604
|
+
|
|
7605
|
+
if (ctx.enableTabs) {
|
|
7606
|
+
return [
|
|
7607
|
+
{
|
|
7608
|
+
"type": "tabs",
|
|
7609
|
+
"tabs": sections,
|
|
7610
|
+
"tabsMode": ctx.tabsMode
|
|
7611
|
+
}
|
|
7612
|
+
]
|
|
7613
|
+
}
|
|
7614
|
+
|
|
7596
7615
|
return sections;
|
|
7597
7616
|
};
|
|
7598
7617
|
|
|
@@ -13682,11 +13701,11 @@ var SteedosSkeleton = function (props) {
|
|
|
13682
13701
|
};
|
|
13683
13702
|
|
|
13684
13703
|
var AmisObjectForm = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
13685
|
-
var $schema, recordId, defaultData, mode, layout, labelAlign, appId, fieldsExtend, _a, excludedFields, _b, fields, _c, className, initApiRequestAdaptor, initApiAdaptor, apiRequestAdaptor, apiAdaptor, objectApiName, schemaKeys, formSchema, defaults, options, globalData, amisSchema, uiSchema, schema, schema, formData;
|
|
13704
|
+
var $schema, recordId, defaultData, mode, layout, labelAlign, appId, fieldsExtend, _a, excludedFields, _b, fields, _c, className, initApiRequestAdaptor, initApiAdaptor, apiRequestAdaptor, apiAdaptor, enableTabs, tabsMode, objectApiName, schemaKeys, formSchema, defaults, options, globalData, amisSchema, uiSchema, schema, schema, formData;
|
|
13686
13705
|
return __generator(this, function (_d) {
|
|
13687
13706
|
switch (_d.label) {
|
|
13688
13707
|
case 0:
|
|
13689
|
-
$schema = props.$schema, recordId = props.recordId, defaultData = props.defaultData, mode = props.mode, layout = props.layout, labelAlign = props.labelAlign, appId = props.appId, fieldsExtend = props.fieldsExtend, _a = props.excludedFields, excludedFields = _a === void 0 ? null : _a, _b = props.fields, fields = _b === void 0 ? null : _b, _c = props.className, className = _c === void 0 ? "" : _c, initApiRequestAdaptor = props.initApiRequestAdaptor, initApiAdaptor = props.initApiAdaptor, apiRequestAdaptor = props.apiRequestAdaptor, apiAdaptor = props.apiAdaptor;
|
|
13708
|
+
$schema = props.$schema, recordId = props.recordId, defaultData = props.defaultData, mode = props.mode, layout = props.layout, labelAlign = props.labelAlign, appId = props.appId, fieldsExtend = props.fieldsExtend, _a = props.excludedFields, excludedFields = _a === void 0 ? null : _a, _b = props.fields, fields = _b === void 0 ? null : _b, _c = props.className, className = _c === void 0 ? "" : _c, initApiRequestAdaptor = props.initApiRequestAdaptor, initApiAdaptor = props.initApiAdaptor, apiRequestAdaptor = props.apiRequestAdaptor, apiAdaptor = props.apiAdaptor, enableTabs = props.enableTabs, tabsMode = props.tabsMode;
|
|
13690
13709
|
objectApiName = props.objectApiName || "space_users";
|
|
13691
13710
|
schemaKeys = difference(keys($schema), ["type", "mode", "layout", "defaultData"]);
|
|
13692
13711
|
formSchema = pick(props, schemaKeys);
|
|
@@ -13716,7 +13735,9 @@ var AmisObjectForm = function (props) { return __awaiter(void 0, void 0, void 0,
|
|
|
13716
13735
|
initApiRequestAdaptor: initApiRequestAdaptor,
|
|
13717
13736
|
initApiAdaptor: initApiAdaptor,
|
|
13718
13737
|
apiRequestAdaptor: apiRequestAdaptor,
|
|
13719
|
-
apiAdaptor: apiAdaptor
|
|
13738
|
+
apiAdaptor: apiAdaptor,
|
|
13739
|
+
enableTabs: enableTabs,
|
|
13740
|
+
tabsMode: tabsMode
|
|
13720
13741
|
}))];
|
|
13721
13742
|
case 1:
|
|
13722
13743
|
schema = _d.sent();
|