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