@steedos-widgets/amis-object 1.2.12 → 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.css +3 -0
- package/dist/amis-object.cjs.js +186 -42
- package/dist/amis-object.cjs.js.map +1 -1
- package/dist/amis-object.esm.css +3 -0
- package/dist/amis-object.esm.js +186 -42
- package/dist/amis-object.esm.js.map +1 -1
- package/dist/amis-object.umd.css +3 -0
- package/dist/amis-object.umd.js +186 -42
- 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.css
CHANGED
|
@@ -1237,6 +1237,9 @@ body {
|
|
|
1237
1237
|
-moz-column-gap: 1rem;
|
|
1238
1238
|
column-gap: 1rem;
|
|
1239
1239
|
}
|
|
1240
|
+
.steedos-amis-form .antd-Collapse .antd-Collapse-header.hidden {
|
|
1241
|
+
display: none !important;
|
|
1242
|
+
}
|
|
1240
1243
|
|
|
1241
1244
|
@media (max-width: 768px) {
|
|
1242
1245
|
.record-detail-header-name {
|
package/dist/amis-object.cjs.js
CHANGED
|
@@ -2255,7 +2255,23 @@ const getSchema$1 = (uiSchema) => {
|
|
|
2255
2255
|
{
|
|
2256
2256
|
name: "template_url",
|
|
2257
2257
|
label: "导入模板",
|
|
2258
|
-
type: "
|
|
2258
|
+
type: "button-group",
|
|
2259
|
+
buttons: [
|
|
2260
|
+
{
|
|
2261
|
+
type: "button",
|
|
2262
|
+
label: "下载",
|
|
2263
|
+
visibleOn: "${template_url}",
|
|
2264
|
+
level: "link",
|
|
2265
|
+
actionType: "download",
|
|
2266
|
+
api:{
|
|
2267
|
+
url: "${template_url}",
|
|
2268
|
+
method: "get",
|
|
2269
|
+
headers: {
|
|
2270
|
+
Authorization: "Bearer ${context.tenantId},${context.authToken}"
|
|
2271
|
+
}
|
|
2272
|
+
}
|
|
2273
|
+
}
|
|
2274
|
+
],
|
|
2259
2275
|
options: {
|
|
2260
2276
|
html: true
|
|
2261
2277
|
},
|
|
@@ -5015,12 +5031,13 @@ const getSettingListviewToolbarButtonSchema = ()=>{
|
|
|
5015
5031
|
"type": "dropdown-button",
|
|
5016
5032
|
"trigger": "click",
|
|
5017
5033
|
"icon": "fa fa-cog",
|
|
5034
|
+
"tooltip": "列表视图控制",
|
|
5018
5035
|
"btnClassName": "antd-Button--iconOnly bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
5019
5036
|
"align": "right",
|
|
5020
5037
|
"visibleOn": "${!isLookup}",
|
|
5021
5038
|
"buttons": [
|
|
5022
5039
|
{
|
|
5023
|
-
"label": "
|
|
5040
|
+
"label": "列表视图控制",
|
|
5024
5041
|
"children": [
|
|
5025
5042
|
getNewListviewButtonSchema(),
|
|
5026
5043
|
getCopyListviewButtonSchema(),
|
|
@@ -5054,9 +5071,11 @@ const getDisplayAsButton = function(objectName, showDisplayAs){
|
|
|
5054
5071
|
"rightIconClassName": "m-l-sm"
|
|
5055
5072
|
}
|
|
5056
5073
|
];
|
|
5074
|
+
const displayAsLabel = displayAs === 'split'? "分栏视图" : "表格";
|
|
5057
5075
|
return {
|
|
5058
5076
|
"type": "dropdown-button",
|
|
5059
5077
|
"icon": "fa fa-table-columns",
|
|
5078
|
+
"tooltip": `显示为 ${displayAsLabel}`,
|
|
5060
5079
|
"btnClassName": "antd-Button--iconOnly bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
5061
5080
|
"align": "right",
|
|
5062
5081
|
"visibleOn": "${window:innerWidth > 768 && !!!isLookup}",
|
|
@@ -5136,6 +5155,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
|
|
|
5136
5155
|
// "type": "reload",//不可以直接使用reload,因为它不会设置页码到第一页
|
|
5137
5156
|
"type": "button",
|
|
5138
5157
|
"align": "right",
|
|
5158
|
+
"tooltip": "刷新",
|
|
5139
5159
|
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
5140
5160
|
"label": "",
|
|
5141
5161
|
"icon": "fa fa-sync",
|
|
@@ -5155,6 +5175,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
|
|
|
5155
5175
|
"label": "",
|
|
5156
5176
|
"icon": "fa fa-search",
|
|
5157
5177
|
"type": "button",
|
|
5178
|
+
"tooltip": "搜索",
|
|
5158
5179
|
"badge": {
|
|
5159
5180
|
"offset": [
|
|
5160
5181
|
-5,
|
|
@@ -5199,6 +5220,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
|
|
|
5199
5220
|
{
|
|
5200
5221
|
"type": "reload",
|
|
5201
5222
|
"align": "right",
|
|
5223
|
+
"tooltip": "刷新",
|
|
5202
5224
|
"tooltipPlacement": "bottom",
|
|
5203
5225
|
"className": "bg-white p-2 rounded border-gray-300 text-gray-500"
|
|
5204
5226
|
},
|
|
@@ -5206,6 +5228,8 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
|
|
|
5206
5228
|
filterVisible ? {
|
|
5207
5229
|
"label": "",
|
|
5208
5230
|
"icon": "fa fa-search",
|
|
5231
|
+
"tooltip": "搜索",
|
|
5232
|
+
"tooltipPlacement": "bottom",
|
|
5209
5233
|
"type": "button",
|
|
5210
5234
|
"align": "right",
|
|
5211
5235
|
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
@@ -5855,6 +5879,10 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
5855
5879
|
};
|
|
5856
5880
|
}
|
|
5857
5881
|
|
|
5882
|
+
if(field.pickerSchema){
|
|
5883
|
+
pickerSchema = Object.assign({}, pickerSchema, field.pickerSchema);
|
|
5884
|
+
}
|
|
5885
|
+
|
|
5858
5886
|
const data = {
|
|
5859
5887
|
type: getAmisStaticFieldType('picker', readonly),
|
|
5860
5888
|
labelField: referenceTo.labelField.name,
|
|
@@ -6230,8 +6258,8 @@ async function getIdsPickerSchema(field, readonly, ctx){
|
|
|
6230
6258
|
/*
|
|
6231
6259
|
* @Author: baozhoutao@steedos.com
|
|
6232
6260
|
* @Date: 2023-01-13 17:27:54
|
|
6233
|
-
* @LastEditors:
|
|
6234
|
-
* @LastEditTime: 2023-
|
|
6261
|
+
* @LastEditors: Please set LastEditors
|
|
6262
|
+
* @LastEditTime: 2023-05-31 13:34:22
|
|
6235
6263
|
* @Description:
|
|
6236
6264
|
*/
|
|
6237
6265
|
|
|
@@ -6273,8 +6301,12 @@ const getMarkdownFieldSchema = (field, readonly, ctx)=>{
|
|
|
6273
6301
|
const getHtmlFieldSchema = (field, readonly, ctx)=>{
|
|
6274
6302
|
if(readonly){
|
|
6275
6303
|
return {
|
|
6276
|
-
"type": "
|
|
6277
|
-
"
|
|
6304
|
+
"type": "control",
|
|
6305
|
+
"label": field.label,
|
|
6306
|
+
"body": {
|
|
6307
|
+
"type": "html",
|
|
6308
|
+
"name": field.name
|
|
6309
|
+
}
|
|
6278
6310
|
}
|
|
6279
6311
|
}else {
|
|
6280
6312
|
return {
|
|
@@ -6301,8 +6333,8 @@ const getHtmlFieldSchema = (field, readonly, ctx)=>{
|
|
|
6301
6333
|
/*
|
|
6302
6334
|
* @Author: baozhoutao@steedos.com
|
|
6303
6335
|
* @Date: 2022-10-28 14:52:55
|
|
6304
|
-
* @LastEditors:
|
|
6305
|
-
* @LastEditTime:
|
|
6336
|
+
* @LastEditors: Please set LastEditors
|
|
6337
|
+
* @LastEditTime: 2023-05-31 13:25:53
|
|
6306
6338
|
* @Description:
|
|
6307
6339
|
*/
|
|
6308
6340
|
|
|
@@ -6851,8 +6883,19 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
6851
6883
|
break;
|
|
6852
6884
|
case 'url':
|
|
6853
6885
|
convertData = {
|
|
6854
|
-
type: getAmisStaticFieldType('url', readonly)
|
|
6886
|
+
type: getAmisStaticFieldType('url', readonly, field)
|
|
6855
6887
|
};
|
|
6888
|
+
if(readonly && field.show_as_qr){
|
|
6889
|
+
convertData = {
|
|
6890
|
+
type: "control",
|
|
6891
|
+
label: field.label,
|
|
6892
|
+
body: {
|
|
6893
|
+
type: "qr-code",
|
|
6894
|
+
codeSize: 128,
|
|
6895
|
+
name: field.name
|
|
6896
|
+
}
|
|
6897
|
+
};
|
|
6898
|
+
}
|
|
6856
6899
|
break;
|
|
6857
6900
|
case 'email':
|
|
6858
6901
|
convertData = {
|
|
@@ -6887,6 +6930,7 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
6887
6930
|
case 'code':
|
|
6888
6931
|
convertData = {
|
|
6889
6932
|
type: "editor",
|
|
6933
|
+
disabled: readonly ? true : false,
|
|
6890
6934
|
language: field.language,
|
|
6891
6935
|
editorDidMount: new Function('editor', 'monaco', field.editorDidMount)
|
|
6892
6936
|
};
|
|
@@ -7469,12 +7513,12 @@ function getBatchDelete(objectName){
|
|
|
7469
7513
|
/*
|
|
7470
7514
|
* @Author: baozhoutao@steedos.com
|
|
7471
7515
|
* @Date: 2022-05-26 16:02:08
|
|
7472
|
-
* @LastEditors:
|
|
7473
|
-
* @LastEditTime: 2023-
|
|
7516
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
7517
|
+
* @LastEditTime: 2023-06-02 16:54:41
|
|
7474
7518
|
* @Description:
|
|
7475
7519
|
*/
|
|
7476
7520
|
|
|
7477
|
-
const getFieldSchemaArray = (formFields)=>{
|
|
7521
|
+
const getFieldSchemaArray = (formFields) => {
|
|
7478
7522
|
let fieldSchemaArray = [];
|
|
7479
7523
|
fieldSchemaArray.length = 0;
|
|
7480
7524
|
|
|
@@ -7487,10 +7531,10 @@ const getFieldSchemaArray = (formFields)=>{
|
|
|
7487
7531
|
// field.group = field.label
|
|
7488
7532
|
field.is_wide = true;
|
|
7489
7533
|
}
|
|
7490
|
-
|
|
7491
|
-
if (!isObjectField){
|
|
7492
|
-
if(!field.hidden){
|
|
7493
|
-
|
|
7534
|
+
|
|
7535
|
+
if (!isObjectField) {
|
|
7536
|
+
if (!field.hidden) {
|
|
7537
|
+
fieldSchemaArray.push(Object.assign({ name: fieldName }, field, { permission: { allowEdit: true } }));
|
|
7494
7538
|
}
|
|
7495
7539
|
}
|
|
7496
7540
|
});
|
|
@@ -7498,58 +7542,104 @@ const getFieldSchemaArray = (formFields)=>{
|
|
|
7498
7542
|
};
|
|
7499
7543
|
|
|
7500
7544
|
const getSection = async (formFields, permissionFields, fieldSchemaArray, sectionName, ctx) => {
|
|
7545
|
+
if (!ctx) {
|
|
7546
|
+
ctx = {};
|
|
7547
|
+
}
|
|
7501
7548
|
const sectionFields = ___default__namespace.filter(fieldSchemaArray, { 'group': sectionName });
|
|
7502
|
-
if(sectionFields.length == ___default__namespace.filter(sectionFields, ['hidden', true]).length){
|
|
7503
|
-
return
|
|
7549
|
+
if (sectionFields.length == ___default__namespace.filter(sectionFields, ['hidden', true]).length) {
|
|
7550
|
+
return;
|
|
7504
7551
|
}
|
|
7505
7552
|
|
|
7506
7553
|
const fieldSetBody = [];
|
|
7507
7554
|
|
|
7508
7555
|
for (const perField of sectionFields) {
|
|
7509
7556
|
let field = perField;
|
|
7510
|
-
|
|
7511
|
-
|
|
7512
|
-
|
|
7513
|
-
|
|
7514
|
-
|
|
7515
|
-
|
|
7516
|
-
|
|
7517
|
-
|
|
7518
|
-
|
|
7519
|
-
|
|
7520
|
-
|
|
7521
|
-
|
|
7522
|
-
|
|
7523
|
-
}
|
|
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);
|
|
7524
7570
|
}
|
|
7571
|
+
}
|
|
7525
7572
|
}
|
|
7526
7573
|
|
|
7527
7574
|
// fieldSet 已支持显隐控制
|
|
7528
|
-
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) => {
|
|
7529
7576
|
return visibleOn;
|
|
7530
7577
|
});
|
|
7531
|
-
|
|
7578
|
+
|
|
7579
|
+
let section = {
|
|
7532
7580
|
"type": "fieldSet",
|
|
7533
7581
|
"title": sectionName,
|
|
7534
7582
|
"collapsable": true,
|
|
7535
7583
|
"body": fieldSetBody,
|
|
7536
7584
|
};
|
|
7537
|
-
|
|
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) {
|
|
7538
7594
|
section.visibleOn = `${sectionFieldsVisibleOn.join(" || ")}`;
|
|
7539
7595
|
}
|
|
7540
7596
|
return section
|
|
7541
7597
|
};
|
|
7542
7598
|
|
|
7543
7599
|
const getSections = async (permissionFields, formFields, ctx) => {
|
|
7600
|
+
if (!ctx) {
|
|
7601
|
+
ctx = {};
|
|
7602
|
+
}
|
|
7544
7603
|
const fieldSchemaArray = getFieldSchemaArray(formFields);
|
|
7545
7604
|
const _sections = ___default__namespace.groupBy(fieldSchemaArray, 'group');
|
|
7546
7605
|
const sections = [];
|
|
7606
|
+
var sectionVisibleOns = [];
|
|
7547
7607
|
for (const key in _sections) {
|
|
7548
7608
|
const section = await getSection(formFields, permissionFields, fieldSchemaArray, key, ctx);
|
|
7549
|
-
if(section.body.length > 0){
|
|
7609
|
+
if (section.body.length > 0) {
|
|
7610
|
+
if (section.visibleOn) {
|
|
7611
|
+
sectionVisibleOns.push(section.visibleOn);
|
|
7612
|
+
}
|
|
7613
|
+
else {
|
|
7614
|
+
sectionVisibleOns.push("true");
|
|
7615
|
+
}
|
|
7550
7616
|
sections.push(section);
|
|
7551
7617
|
}
|
|
7552
7618
|
}
|
|
7619
|
+
/*
|
|
7620
|
+
为了实现只有一个分组时隐藏该分组标题,需要分三种情况(分组如果没有visibleon属性就代表一定显示,有visibleon需要进行判断)
|
|
7621
|
+
1 当前分组为隐藏时,标题就设置为隐藏
|
|
7622
|
+
2 当前分组为显示时,其他分组只要有一个是显示,就显示该分组标题
|
|
7623
|
+
3 当前分组为显示时,其他分组都隐藏,就隐藏该分组标题
|
|
7624
|
+
*/
|
|
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
|
+
|
|
7553
7643
|
return sections;
|
|
7554
7644
|
};
|
|
7555
7645
|
|
|
@@ -8064,6 +8154,8 @@ async function getTableColumns$1(fields, options){
|
|
|
8064
8154
|
type = 'tpl';
|
|
8065
8155
|
}else if(field.type === 'html'){
|
|
8066
8156
|
type = 'markdown';
|
|
8157
|
+
}else if(field.type === 'url' && field.show_as_qr){
|
|
8158
|
+
type = 'qr-code';
|
|
8067
8159
|
}
|
|
8068
8160
|
let className = "";
|
|
8069
8161
|
if(field.type === 'textarea'){
|
|
@@ -8091,7 +8183,13 @@ async function getTableColumns$1(fields, options){
|
|
|
8091
8183
|
|
|
8092
8184
|
}
|
|
8093
8185
|
// columns.push(getOperation(fields));
|
|
8094
|
-
|
|
8186
|
+
if(!___default__namespace.some(columns, { name: options.labelFieldName })){
|
|
8187
|
+
const href = Router$1.getObjectDetailPath({
|
|
8188
|
+
...options, formFactor: options.formFactor, appId: "${appId}", objectName: options.objectName || "${objectName}", recordId: `\${${options.idFieldName}}`
|
|
8189
|
+
});
|
|
8190
|
+
columns[0].type = "tpl";
|
|
8191
|
+
columns[0].tpl = `<a href="${href}">\${${columns[0].name}}</a>`;
|
|
8192
|
+
}
|
|
8095
8193
|
return columns;
|
|
8096
8194
|
}
|
|
8097
8195
|
|
|
@@ -8457,6 +8555,8 @@ async function getTableApi(mainObject, fields, options){
|
|
|
8457
8555
|
|
|
8458
8556
|
const fileFields = {};
|
|
8459
8557
|
const fileFieldsKeys = [];
|
|
8558
|
+
// 含有optionsFunction属性, 无reference_to属性的lookup字段
|
|
8559
|
+
const lookupFields = {};
|
|
8460
8560
|
fields.forEach((item)=>{
|
|
8461
8561
|
if(___default__namespace.includes(['image','avatar','file'], item.type)){
|
|
8462
8562
|
fileFieldsKeys.push(item.name);
|
|
@@ -8466,6 +8566,9 @@ async function getTableApi(mainObject, fields, options){
|
|
|
8466
8566
|
multiple: item.multiple
|
|
8467
8567
|
};
|
|
8468
8568
|
}
|
|
8569
|
+
if(___default__namespace.includes(['lookup'], item.type) && !item.reference_to ){
|
|
8570
|
+
lookupFields[item.name] = item;
|
|
8571
|
+
}
|
|
8469
8572
|
});
|
|
8470
8573
|
|
|
8471
8574
|
let valueField = mainObject.key_field || '_id';
|
|
@@ -8482,6 +8585,7 @@ async function getTableApi(mainObject, fields, options){
|
|
|
8482
8585
|
api.data.filter = "$filter";
|
|
8483
8586
|
api.data.loaded = "${loaded}";
|
|
8484
8587
|
api.data.listViewId = "${listViewId}";
|
|
8588
|
+
api.data.listName = "${listName}";
|
|
8485
8589
|
api.requestAdaptor = `
|
|
8486
8590
|
// selfData 中的数据由 CRUD 控制. selfData中,只能获取到 CRUD 给定的data. 无法从数据链中获取数据.
|
|
8487
8591
|
let selfData = JSON.parse(JSON.stringify(api.data.$self));
|
|
@@ -8512,9 +8616,13 @@ async function getTableApi(mainObject, fields, options){
|
|
|
8512
8616
|
console.error("本地存储中crud参数解析异常:", ex);
|
|
8513
8617
|
}
|
|
8514
8618
|
${baseFilters ? `var systemFilters = ${JSON.stringify(baseFilters)};` : 'var systemFilters = [];'}
|
|
8619
|
+
var _ids = []
|
|
8515
8620
|
const filtersFunction = ${filtersFunction};
|
|
8516
8621
|
if(filtersFunction){
|
|
8517
8622
|
const _filters = filtersFunction(systemFilters, api.data.$self);
|
|
8623
|
+
if(api.data.listName == "recent"){
|
|
8624
|
+
_ids = _filters[2]
|
|
8625
|
+
}
|
|
8518
8626
|
if(_filters && _filters.length > 0){
|
|
8519
8627
|
if(_.isEmpty(systemFilters)){
|
|
8520
8628
|
systemFilters = _filters || [];
|
|
@@ -8626,6 +8734,7 @@ async function getTableApi(mainObject, fields, options){
|
|
|
8626
8734
|
filters = [filters, 'and', userFilters]
|
|
8627
8735
|
}
|
|
8628
8736
|
}
|
|
8737
|
+
api.data._ids = _ids;
|
|
8629
8738
|
api.data = {
|
|
8630
8739
|
query: api.data.query.replace(/{__filters}/g, JSON.stringify(filters)).replace('{__top}', pageSize).replace('{__skip}', skip).replace('{__sort}', sort.trim())
|
|
8631
8740
|
}
|
|
@@ -8633,6 +8742,11 @@ async function getTableApi(mainObject, fields, options){
|
|
|
8633
8742
|
return api;
|
|
8634
8743
|
`;
|
|
8635
8744
|
api.adaptor = `
|
|
8745
|
+
if(api.body.listName == "recent"){
|
|
8746
|
+
payload.data.rows = _.sortBy(payload.data.rows, function(item){
|
|
8747
|
+
return _.indexOf(api.body._ids, item._id)
|
|
8748
|
+
});
|
|
8749
|
+
}
|
|
8636
8750
|
const enable_tree = ${mainObject.enable_tree};
|
|
8637
8751
|
if(!enable_tree){
|
|
8638
8752
|
_.each(payload.data.rows, function(item, index){
|
|
@@ -8643,9 +8757,10 @@ async function getTableApi(mainObject, fields, options){
|
|
|
8643
8757
|
}
|
|
8644
8758
|
window.postMessage(Object.assign({type: "listview.loaded"}), "*");
|
|
8645
8759
|
let fileFields = ${JSON.stringify(fileFields)};
|
|
8760
|
+
let lookupFields = ${JSON.stringify(lookupFields)};
|
|
8646
8761
|
_.each(payload.data.rows, function(item, index){
|
|
8647
8762
|
_.each(fileFields , (field, key)=>{
|
|
8648
|
-
if(item[key] && item._display && item._display
|
|
8763
|
+
if(item[key] && item._display && item._display[key]){
|
|
8649
8764
|
let value = item._display[key];
|
|
8650
8765
|
if(!_.isArray(value)){
|
|
8651
8766
|
value = [value]
|
|
@@ -8657,6 +8772,14 @@ async function getTableApi(mainObject, fields, options){
|
|
|
8657
8772
|
}
|
|
8658
8773
|
}
|
|
8659
8774
|
})
|
|
8775
|
+
_.each(lookupFields , (field, key)=>{
|
|
8776
|
+
if(item[key]){
|
|
8777
|
+
if(field._optionsFunction){
|
|
8778
|
+
const optionsFunction = eval("(" + field._optionsFunction+ ")")(item);
|
|
8779
|
+
item[key + '__label'] = _.map(_.filter(optionsFunction, function(option){return _.includes(item[key], option.value)}), 'label').join(' ');
|
|
8780
|
+
}
|
|
8781
|
+
}
|
|
8782
|
+
})
|
|
8660
8783
|
})
|
|
8661
8784
|
|
|
8662
8785
|
if(enable_tree){
|
|
@@ -9986,6 +10109,24 @@ async function getListSchema(
|
|
|
9986
10109
|
|
|
9987
10110
|
ctx.defaults = defaults;
|
|
9988
10111
|
|
|
10112
|
+
if (listViewName == "recent") {
|
|
10113
|
+
listview_filters = `
|
|
10114
|
+
function(filters, data) {
|
|
10115
|
+
var result = Steedos.authRequest('/graphql', {
|
|
10116
|
+
type: 'POST',
|
|
10117
|
+
async: false,
|
|
10118
|
+
data: JSON.stringify({
|
|
10119
|
+
query: '{object_recent_viewed(filters: [["record.o","=","' + data.objectName + '"],["space","=","' + data.context.tenantId + '"],["owner","=","' + data.context.userId + '"]],sort:"modified desc",top:50){ _id,record} }'
|
|
10120
|
+
}),
|
|
10121
|
+
});
|
|
10122
|
+
var _ids = []
|
|
10123
|
+
result.data.object_recent_viewed.forEach(function (item) {
|
|
10124
|
+
_ids = _ids.concat(item.record.ids)
|
|
10125
|
+
})
|
|
10126
|
+
return ["_id", "=", _ids];
|
|
10127
|
+
}
|
|
10128
|
+
`;
|
|
10129
|
+
}
|
|
9989
10130
|
const amisSchema = {
|
|
9990
10131
|
"type": "steedos-object-table",
|
|
9991
10132
|
"objectApiName": objectName,
|
|
@@ -13588,11 +13729,11 @@ var SteedosSkeleton = function (props) {
|
|
|
13588
13729
|
};
|
|
13589
13730
|
|
|
13590
13731
|
var AmisObjectForm = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
13591
|
-
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;
|
|
13592
13733
|
return __generator(this, function (_d) {
|
|
13593
13734
|
switch (_d.label) {
|
|
13594
13735
|
case 0:
|
|
13595
|
-
$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;
|
|
13596
13737
|
objectApiName = props.objectApiName || "space_users";
|
|
13597
13738
|
schemaKeys = ___default.difference(___default.keys($schema), ["type", "mode", "layout", "defaultData"]);
|
|
13598
13739
|
formSchema = ___default.pick(props, schemaKeys);
|
|
@@ -13622,7 +13763,9 @@ var AmisObjectForm = function (props) { return __awaiter(void 0, void 0, void 0,
|
|
|
13622
13763
|
initApiRequestAdaptor: initApiRequestAdaptor,
|
|
13623
13764
|
initApiAdaptor: initApiAdaptor,
|
|
13624
13765
|
apiRequestAdaptor: apiRequestAdaptor,
|
|
13625
|
-
apiAdaptor: apiAdaptor
|
|
13766
|
+
apiAdaptor: apiAdaptor,
|
|
13767
|
+
enableTabs: enableTabs,
|
|
13768
|
+
tabsMode: tabsMode
|
|
13626
13769
|
}))];
|
|
13627
13770
|
case 1:
|
|
13628
13771
|
schema = _d.sent();
|
|
@@ -13721,6 +13864,7 @@ var AmisObjectListView = function (props) { return __awaiter(void 0, void 0, voi
|
|
|
13721
13864
|
// className不传入crud组件,crud单独识别crudClassName属性
|
|
13722
13865
|
listSchema.className = crudClassName;
|
|
13723
13866
|
listSchema.onEvent = {}; // 为啥要将一个内置event放在此处?
|
|
13867
|
+
// 下面expression中_isRelated参数判断的是列表视图分栏模式下,新建、编辑、删除相关子表记录时不应该刷新左侧(主表)列表视图组件
|
|
13724
13868
|
listSchema.onEvent["@data.changed.".concat(objectApiName)] = {
|
|
13725
13869
|
"actions": [
|
|
13726
13870
|
{
|
|
@@ -15300,7 +15444,7 @@ var getSelectFlowSchema = function (id, props) {
|
|
|
15300
15444
|
"method": "post",
|
|
15301
15445
|
"url": "${context.rootUrl}/graphql?keywords=${keywords}",
|
|
15302
15446
|
"requestAdaptor": "\n const keywords = api.body.keywords || '';\n const appId = '".concat(data.app_id || '', "';\n api.data = {\n query: `\n {\n options: flows__getList(action: \"").concat(action, "\", keywords: \"${keywords}\", appId: \"${appId}\", distributeInstanceId: \"").concat(distributeInstanceId, "\", distributeStepId: \"").concat(distributeStepId, "\"){\n value:_id\n label:name\n children: flows{\n value: _id,\n label: name\n }\n }\n }\n `\n }\n "),
|
|
15303
|
-
"adaptor": "\n payload.data.options?.forEach(function(item,index) {\n if(!item.children || item.children.length == 0){\n payload.data.options.splice(index)\n }\n })\n return payload;\n ",
|
|
15447
|
+
"adaptor": "\n payload.data.options?.forEach(function(item,index) {\n if(!item.children || item.children.length == 0){\n payload.data.options.splice(index,1)\n }\n })\n return payload;\n ",
|
|
15304
15448
|
"headers": {
|
|
15305
15449
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
15306
15450
|
}
|