@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.cjs.js
CHANGED
|
@@ -5879,6 +5879,10 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
5879
5879
|
};
|
|
5880
5880
|
}
|
|
5881
5881
|
|
|
5882
|
+
if(field.pickerSchema){
|
|
5883
|
+
pickerSchema = Object.assign({}, pickerSchema, field.pickerSchema);
|
|
5884
|
+
}
|
|
5885
|
+
|
|
5882
5886
|
const data = {
|
|
5883
5887
|
type: getAmisStaticFieldType('picker', readonly),
|
|
5884
5888
|
labelField: referenceTo.labelField.name,
|
|
@@ -7509,12 +7513,12 @@ function getBatchDelete(objectName){
|
|
|
7509
7513
|
/*
|
|
7510
7514
|
* @Author: baozhoutao@steedos.com
|
|
7511
7515
|
* @Date: 2022-05-26 16:02:08
|
|
7512
|
-
* @LastEditors:
|
|
7513
|
-
* @LastEditTime: 2023-
|
|
7516
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
7517
|
+
* @LastEditTime: 2023-06-02 16:54:41
|
|
7514
7518
|
* @Description:
|
|
7515
7519
|
*/
|
|
7516
7520
|
|
|
7517
|
-
const getFieldSchemaArray = (formFields)=>{
|
|
7521
|
+
const getFieldSchemaArray = (formFields) => {
|
|
7518
7522
|
let fieldSchemaArray = [];
|
|
7519
7523
|
fieldSchemaArray.length = 0;
|
|
7520
7524
|
|
|
@@ -7527,10 +7531,10 @@ const getFieldSchemaArray = (formFields)=>{
|
|
|
7527
7531
|
// field.group = field.label
|
|
7528
7532
|
field.is_wide = true;
|
|
7529
7533
|
}
|
|
7530
|
-
|
|
7531
|
-
if (!isObjectField){
|
|
7532
|
-
if(!field.hidden){
|
|
7533
|
-
|
|
7534
|
+
|
|
7535
|
+
if (!isObjectField) {
|
|
7536
|
+
if (!field.hidden) {
|
|
7537
|
+
fieldSchemaArray.push(Object.assign({ name: fieldName }, field, { permission: { allowEdit: true } }));
|
|
7534
7538
|
}
|
|
7535
7539
|
}
|
|
7536
7540
|
});
|
|
@@ -7538,89 +7542,104 @@ const getFieldSchemaArray = (formFields)=>{
|
|
|
7538
7542
|
};
|
|
7539
7543
|
|
|
7540
7544
|
const getSection = async (formFields, permissionFields, fieldSchemaArray, sectionName, ctx) => {
|
|
7545
|
+
if (!ctx) {
|
|
7546
|
+
ctx = {};
|
|
7547
|
+
}
|
|
7541
7548
|
const sectionFields = ___default__namespace.filter(fieldSchemaArray, { 'group': sectionName });
|
|
7542
|
-
if(sectionFields.length == ___default__namespace.filter(sectionFields, ['hidden', true]).length){
|
|
7543
|
-
return
|
|
7549
|
+
if (sectionFields.length == ___default__namespace.filter(sectionFields, ['hidden', true]).length) {
|
|
7550
|
+
return;
|
|
7544
7551
|
}
|
|
7545
7552
|
|
|
7546
7553
|
const fieldSetBody = [];
|
|
7547
7554
|
|
|
7548
7555
|
for (const perField of sectionFields) {
|
|
7549
7556
|
let field = perField;
|
|
7550
|
-
|
|
7551
|
-
|
|
7552
|
-
|
|
7553
|
-
|
|
7554
|
-
|
|
7555
|
-
|
|
7556
|
-
|
|
7557
|
-
|
|
7558
|
-
|
|
7559
|
-
|
|
7560
|
-
|
|
7561
|
-
|
|
7562
|
-
|
|
7563
|
-
}
|
|
7557
|
+
if (perField.type === 'grid') {
|
|
7558
|
+
field = await getGridFieldSubFields(perField, formFields);
|
|
7559
|
+
// console.log(`perField.type grid ===> field`, field)
|
|
7560
|
+
} else if (perField.type === 'object') {
|
|
7561
|
+
field = await getObjectFieldSubFields(perField, formFields);
|
|
7562
|
+
// console.log(`perField.type object ===> field`, field)
|
|
7563
|
+
}
|
|
7564
|
+
if (field.name.indexOf(".") < 0) {
|
|
7565
|
+
ctx.__formFields = formFields;
|
|
7566
|
+
const amisField = await convertSFieldToAmisField(field, field.readonly, ctx);
|
|
7567
|
+
// console.log(`${field.name} amisField`, field, amisField)
|
|
7568
|
+
if (amisField) {
|
|
7569
|
+
fieldSetBody.push(amisField);
|
|
7564
7570
|
}
|
|
7571
|
+
}
|
|
7565
7572
|
}
|
|
7566
7573
|
|
|
7567
7574
|
// fieldSet 已支持显隐控制
|
|
7568
|
-
const sectionFieldsVisibleOn = ___default__namespace.map(___default__namespace.compact(___default__namespace.map(fieldSetBody, 'visibleOn'))
|
|
7575
|
+
const sectionFieldsVisibleOn = ___default__namespace.map(___default__namespace.compact(___default__namespace.map(fieldSetBody, 'visibleOn')), (visibleOn) => {
|
|
7569
7576
|
return visibleOn;
|
|
7570
7577
|
});
|
|
7571
|
-
|
|
7578
|
+
|
|
7579
|
+
let section = {
|
|
7572
7580
|
"type": "fieldSet",
|
|
7573
7581
|
"title": sectionName,
|
|
7574
7582
|
"collapsable": true,
|
|
7575
7583
|
"body": fieldSetBody,
|
|
7576
7584
|
};
|
|
7577
|
-
|
|
7585
|
+
|
|
7586
|
+
if (ctx.enableTabs) {
|
|
7587
|
+
section = {
|
|
7588
|
+
"title": sectionName,
|
|
7589
|
+
"body": fieldSetBody,
|
|
7590
|
+
};
|
|
7591
|
+
}
|
|
7592
|
+
|
|
7593
|
+
if (sectionFieldsVisibleOn.length > 0 && fieldSetBody.length === sectionFieldsVisibleOn.length) {
|
|
7578
7594
|
section.visibleOn = `${sectionFieldsVisibleOn.join(" || ")}`;
|
|
7579
7595
|
}
|
|
7580
7596
|
return section
|
|
7581
7597
|
};
|
|
7582
7598
|
|
|
7583
7599
|
const getSections = async (permissionFields, formFields, ctx) => {
|
|
7600
|
+
if (!ctx) {
|
|
7601
|
+
ctx = {};
|
|
7602
|
+
}
|
|
7584
7603
|
const fieldSchemaArray = getFieldSchemaArray(formFields);
|
|
7585
7604
|
const _sections = ___default__namespace.groupBy(fieldSchemaArray, 'group');
|
|
7586
7605
|
const sections = [];
|
|
7587
|
-
var
|
|
7606
|
+
var sectionVisibleOns = [];
|
|
7588
7607
|
for (const key in _sections) {
|
|
7589
7608
|
const section = await getSection(formFields, permissionFields, fieldSchemaArray, key, ctx);
|
|
7590
|
-
if(section.body.length > 0){
|
|
7591
|
-
if(section.visibleOn){
|
|
7592
|
-
|
|
7609
|
+
if (section.body.length > 0) {
|
|
7610
|
+
if (section.visibleOn) {
|
|
7611
|
+
sectionVisibleOns.push(section.visibleOn);
|
|
7612
|
+
}
|
|
7613
|
+
else {
|
|
7614
|
+
sectionVisibleOns.push("true");
|
|
7593
7615
|
}
|
|
7594
7616
|
sections.push(section);
|
|
7595
7617
|
}
|
|
7596
7618
|
}
|
|
7597
7619
|
/*
|
|
7598
7620
|
为了实现只有一个分组时隐藏该分组标题,需要分三种情况(分组如果没有visibleon属性就代表一定显示,有visibleon需要进行判断)
|
|
7599
|
-
1
|
|
7600
|
-
2
|
|
7601
|
-
|
|
7602
|
-
2.2 当前分组为显示时,其他分组只要有一个是显示,就显示该分组标题
|
|
7603
|
-
2.3 当前分组为显示时,其他分组都隐藏,就隐藏该分组标题
|
|
7604
|
-
3.所有分组中有两个以上的分组没有visibleon(这种情况不用处理)
|
|
7621
|
+
1 当前分组为隐藏时,标题就设置为隐藏
|
|
7622
|
+
2 当前分组为显示时,其他分组只要有一个是显示,就显示该分组标题
|
|
7623
|
+
3 当前分组为显示时,其他分组都隐藏,就隐藏该分组标题
|
|
7605
7624
|
*/
|
|
7606
|
-
|
|
7607
|
-
|
|
7608
|
-
|
|
7609
|
-
|
|
7610
|
-
|
|
7611
|
-
|
|
7612
|
-
|
|
7613
|
-
|
|
7614
|
-
|
|
7615
|
-
|
|
7616
|
-
|
|
7617
|
-
|
|
7618
|
-
|
|
7619
|
-
|
|
7620
|
-
|
|
7621
|
-
|
|
7622
|
-
|
|
7623
|
-
|
|
7625
|
+
sections.forEach((section, index) => {
|
|
7626
|
+
var tempSectionVisibleOns = sectionVisibleOns.slice();
|
|
7627
|
+
tempSectionVisibleOns.splice(index, 1);
|
|
7628
|
+
section.headingClassName = {
|
|
7629
|
+
"hidden": `!((${tempSectionVisibleOns.join(" || ") || 'false'}) && ${sectionVisibleOns[index]})`
|
|
7630
|
+
};
|
|
7631
|
+
});
|
|
7632
|
+
|
|
7633
|
+
if (ctx.enableTabs) {
|
|
7634
|
+
return [
|
|
7635
|
+
{
|
|
7636
|
+
"type": "tabs",
|
|
7637
|
+
"tabs": sections,
|
|
7638
|
+
"tabsMode": ctx.tabsMode
|
|
7639
|
+
}
|
|
7640
|
+
]
|
|
7641
|
+
}
|
|
7642
|
+
|
|
7624
7643
|
return sections;
|
|
7625
7644
|
};
|
|
7626
7645
|
|
|
@@ -13710,11 +13729,11 @@ var SteedosSkeleton = function (props) {
|
|
|
13710
13729
|
};
|
|
13711
13730
|
|
|
13712
13731
|
var AmisObjectForm = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
13713
|
-
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;
|
|
13732
|
+
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;
|
|
13714
13733
|
return __generator(this, function (_d) {
|
|
13715
13734
|
switch (_d.label) {
|
|
13716
13735
|
case 0:
|
|
13717
|
-
$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;
|
|
13736
|
+
$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;
|
|
13718
13737
|
objectApiName = props.objectApiName || "space_users";
|
|
13719
13738
|
schemaKeys = ___default.difference(___default.keys($schema), ["type", "mode", "layout", "defaultData"]);
|
|
13720
13739
|
formSchema = ___default.pick(props, schemaKeys);
|
|
@@ -13744,7 +13763,9 @@ var AmisObjectForm = function (props) { return __awaiter(void 0, void 0, void 0,
|
|
|
13744
13763
|
initApiRequestAdaptor: initApiRequestAdaptor,
|
|
13745
13764
|
initApiAdaptor: initApiAdaptor,
|
|
13746
13765
|
apiRequestAdaptor: apiRequestAdaptor,
|
|
13747
|
-
apiAdaptor: apiAdaptor
|
|
13766
|
+
apiAdaptor: apiAdaptor,
|
|
13767
|
+
enableTabs: enableTabs,
|
|
13768
|
+
tabsMode: tabsMode
|
|
13748
13769
|
}))];
|
|
13749
13770
|
case 1:
|
|
13750
13771
|
schema = _d.sent();
|