@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.esm.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.esm.js
CHANGED
|
@@ -2227,7 +2227,23 @@ const getSchema$1 = (uiSchema) => {
|
|
|
2227
2227
|
{
|
|
2228
2228
|
name: "template_url",
|
|
2229
2229
|
label: "导入模板",
|
|
2230
|
-
type: "
|
|
2230
|
+
type: "button-group",
|
|
2231
|
+
buttons: [
|
|
2232
|
+
{
|
|
2233
|
+
type: "button",
|
|
2234
|
+
label: "下载",
|
|
2235
|
+
visibleOn: "${template_url}",
|
|
2236
|
+
level: "link",
|
|
2237
|
+
actionType: "download",
|
|
2238
|
+
api:{
|
|
2239
|
+
url: "${template_url}",
|
|
2240
|
+
method: "get",
|
|
2241
|
+
headers: {
|
|
2242
|
+
Authorization: "Bearer ${context.tenantId},${context.authToken}"
|
|
2243
|
+
}
|
|
2244
|
+
}
|
|
2245
|
+
}
|
|
2246
|
+
],
|
|
2231
2247
|
options: {
|
|
2232
2248
|
html: true
|
|
2233
2249
|
},
|
|
@@ -4987,12 +5003,13 @@ const getSettingListviewToolbarButtonSchema = ()=>{
|
|
|
4987
5003
|
"type": "dropdown-button",
|
|
4988
5004
|
"trigger": "click",
|
|
4989
5005
|
"icon": "fa fa-cog",
|
|
5006
|
+
"tooltip": "列表视图控制",
|
|
4990
5007
|
"btnClassName": "antd-Button--iconOnly bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
4991
5008
|
"align": "right",
|
|
4992
5009
|
"visibleOn": "${!isLookup}",
|
|
4993
5010
|
"buttons": [
|
|
4994
5011
|
{
|
|
4995
|
-
"label": "
|
|
5012
|
+
"label": "列表视图控制",
|
|
4996
5013
|
"children": [
|
|
4997
5014
|
getNewListviewButtonSchema(),
|
|
4998
5015
|
getCopyListviewButtonSchema(),
|
|
@@ -5026,9 +5043,11 @@ const getDisplayAsButton = function(objectName, showDisplayAs){
|
|
|
5026
5043
|
"rightIconClassName": "m-l-sm"
|
|
5027
5044
|
}
|
|
5028
5045
|
];
|
|
5046
|
+
const displayAsLabel = displayAs === 'split'? "分栏视图" : "表格";
|
|
5029
5047
|
return {
|
|
5030
5048
|
"type": "dropdown-button",
|
|
5031
5049
|
"icon": "fa fa-table-columns",
|
|
5050
|
+
"tooltip": `显示为 ${displayAsLabel}`,
|
|
5032
5051
|
"btnClassName": "antd-Button--iconOnly bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
5033
5052
|
"align": "right",
|
|
5034
5053
|
"visibleOn": "${window:innerWidth > 768 && !!!isLookup}",
|
|
@@ -5108,6 +5127,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
|
|
|
5108
5127
|
// "type": "reload",//不可以直接使用reload,因为它不会设置页码到第一页
|
|
5109
5128
|
"type": "button",
|
|
5110
5129
|
"align": "right",
|
|
5130
|
+
"tooltip": "刷新",
|
|
5111
5131
|
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
5112
5132
|
"label": "",
|
|
5113
5133
|
"icon": "fa fa-sync",
|
|
@@ -5127,6 +5147,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
|
|
|
5127
5147
|
"label": "",
|
|
5128
5148
|
"icon": "fa fa-search",
|
|
5129
5149
|
"type": "button",
|
|
5150
|
+
"tooltip": "搜索",
|
|
5130
5151
|
"badge": {
|
|
5131
5152
|
"offset": [
|
|
5132
5153
|
-5,
|
|
@@ -5171,6 +5192,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
|
|
|
5171
5192
|
{
|
|
5172
5193
|
"type": "reload",
|
|
5173
5194
|
"align": "right",
|
|
5195
|
+
"tooltip": "刷新",
|
|
5174
5196
|
"tooltipPlacement": "bottom",
|
|
5175
5197
|
"className": "bg-white p-2 rounded border-gray-300 text-gray-500"
|
|
5176
5198
|
},
|
|
@@ -5178,6 +5200,8 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
|
|
|
5178
5200
|
filterVisible ? {
|
|
5179
5201
|
"label": "",
|
|
5180
5202
|
"icon": "fa fa-search",
|
|
5203
|
+
"tooltip": "搜索",
|
|
5204
|
+
"tooltipPlacement": "bottom",
|
|
5181
5205
|
"type": "button",
|
|
5182
5206
|
"align": "right",
|
|
5183
5207
|
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
@@ -5827,6 +5851,10 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
5827
5851
|
};
|
|
5828
5852
|
}
|
|
5829
5853
|
|
|
5854
|
+
if(field.pickerSchema){
|
|
5855
|
+
pickerSchema = Object.assign({}, pickerSchema, field.pickerSchema);
|
|
5856
|
+
}
|
|
5857
|
+
|
|
5830
5858
|
const data = {
|
|
5831
5859
|
type: getAmisStaticFieldType('picker', readonly),
|
|
5832
5860
|
labelField: referenceTo.labelField.name,
|
|
@@ -6202,8 +6230,8 @@ async function getIdsPickerSchema(field, readonly, ctx){
|
|
|
6202
6230
|
/*
|
|
6203
6231
|
* @Author: baozhoutao@steedos.com
|
|
6204
6232
|
* @Date: 2023-01-13 17:27:54
|
|
6205
|
-
* @LastEditors:
|
|
6206
|
-
* @LastEditTime: 2023-
|
|
6233
|
+
* @LastEditors: Please set LastEditors
|
|
6234
|
+
* @LastEditTime: 2023-05-31 13:34:22
|
|
6207
6235
|
* @Description:
|
|
6208
6236
|
*/
|
|
6209
6237
|
|
|
@@ -6245,8 +6273,12 @@ const getMarkdownFieldSchema = (field, readonly, ctx)=>{
|
|
|
6245
6273
|
const getHtmlFieldSchema = (field, readonly, ctx)=>{
|
|
6246
6274
|
if(readonly){
|
|
6247
6275
|
return {
|
|
6248
|
-
"type": "
|
|
6249
|
-
"
|
|
6276
|
+
"type": "control",
|
|
6277
|
+
"label": field.label,
|
|
6278
|
+
"body": {
|
|
6279
|
+
"type": "html",
|
|
6280
|
+
"name": field.name
|
|
6281
|
+
}
|
|
6250
6282
|
}
|
|
6251
6283
|
}else {
|
|
6252
6284
|
return {
|
|
@@ -6273,8 +6305,8 @@ const getHtmlFieldSchema = (field, readonly, ctx)=>{
|
|
|
6273
6305
|
/*
|
|
6274
6306
|
* @Author: baozhoutao@steedos.com
|
|
6275
6307
|
* @Date: 2022-10-28 14:52:55
|
|
6276
|
-
* @LastEditors:
|
|
6277
|
-
* @LastEditTime:
|
|
6308
|
+
* @LastEditors: Please set LastEditors
|
|
6309
|
+
* @LastEditTime: 2023-05-31 13:25:53
|
|
6278
6310
|
* @Description:
|
|
6279
6311
|
*/
|
|
6280
6312
|
|
|
@@ -6823,8 +6855,19 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
6823
6855
|
break;
|
|
6824
6856
|
case 'url':
|
|
6825
6857
|
convertData = {
|
|
6826
|
-
type: getAmisStaticFieldType('url', readonly)
|
|
6858
|
+
type: getAmisStaticFieldType('url', readonly, field)
|
|
6827
6859
|
};
|
|
6860
|
+
if(readonly && field.show_as_qr){
|
|
6861
|
+
convertData = {
|
|
6862
|
+
type: "control",
|
|
6863
|
+
label: field.label,
|
|
6864
|
+
body: {
|
|
6865
|
+
type: "qr-code",
|
|
6866
|
+
codeSize: 128,
|
|
6867
|
+
name: field.name
|
|
6868
|
+
}
|
|
6869
|
+
};
|
|
6870
|
+
}
|
|
6828
6871
|
break;
|
|
6829
6872
|
case 'email':
|
|
6830
6873
|
convertData = {
|
|
@@ -6859,6 +6902,7 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
6859
6902
|
case 'code':
|
|
6860
6903
|
convertData = {
|
|
6861
6904
|
type: "editor",
|
|
6905
|
+
disabled: readonly ? true : false,
|
|
6862
6906
|
language: field.language,
|
|
6863
6907
|
editorDidMount: new Function('editor', 'monaco', field.editorDidMount)
|
|
6864
6908
|
};
|
|
@@ -7441,12 +7485,12 @@ function getBatchDelete(objectName){
|
|
|
7441
7485
|
/*
|
|
7442
7486
|
* @Author: baozhoutao@steedos.com
|
|
7443
7487
|
* @Date: 2022-05-26 16:02:08
|
|
7444
|
-
* @LastEditors:
|
|
7445
|
-
* @LastEditTime: 2023-
|
|
7488
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
7489
|
+
* @LastEditTime: 2023-06-02 16:54:41
|
|
7446
7490
|
* @Description:
|
|
7447
7491
|
*/
|
|
7448
7492
|
|
|
7449
|
-
const getFieldSchemaArray = (formFields)=>{
|
|
7493
|
+
const getFieldSchemaArray = (formFields) => {
|
|
7450
7494
|
let fieldSchemaArray = [];
|
|
7451
7495
|
fieldSchemaArray.length = 0;
|
|
7452
7496
|
|
|
@@ -7459,10 +7503,10 @@ const getFieldSchemaArray = (formFields)=>{
|
|
|
7459
7503
|
// field.group = field.label
|
|
7460
7504
|
field.is_wide = true;
|
|
7461
7505
|
}
|
|
7462
|
-
|
|
7463
|
-
if (!isObjectField){
|
|
7464
|
-
if(!field.hidden){
|
|
7465
|
-
|
|
7506
|
+
|
|
7507
|
+
if (!isObjectField) {
|
|
7508
|
+
if (!field.hidden) {
|
|
7509
|
+
fieldSchemaArray.push(Object.assign({ name: fieldName }, field, { permission: { allowEdit: true } }));
|
|
7466
7510
|
}
|
|
7467
7511
|
}
|
|
7468
7512
|
});
|
|
@@ -7470,58 +7514,104 @@ const getFieldSchemaArray = (formFields)=>{
|
|
|
7470
7514
|
};
|
|
7471
7515
|
|
|
7472
7516
|
const getSection = async (formFields, permissionFields, fieldSchemaArray, sectionName, ctx) => {
|
|
7517
|
+
if (!ctx) {
|
|
7518
|
+
ctx = {};
|
|
7519
|
+
}
|
|
7473
7520
|
const sectionFields = ___default.filter(fieldSchemaArray, { 'group': sectionName });
|
|
7474
|
-
if(sectionFields.length == ___default.filter(sectionFields, ['hidden', true]).length){
|
|
7475
|
-
return
|
|
7521
|
+
if (sectionFields.length == ___default.filter(sectionFields, ['hidden', true]).length) {
|
|
7522
|
+
return;
|
|
7476
7523
|
}
|
|
7477
7524
|
|
|
7478
7525
|
const fieldSetBody = [];
|
|
7479
7526
|
|
|
7480
7527
|
for (const perField of sectionFields) {
|
|
7481
7528
|
let field = perField;
|
|
7482
|
-
|
|
7483
|
-
|
|
7484
|
-
|
|
7485
|
-
|
|
7486
|
-
|
|
7487
|
-
|
|
7488
|
-
|
|
7489
|
-
|
|
7490
|
-
|
|
7491
|
-
|
|
7492
|
-
|
|
7493
|
-
|
|
7494
|
-
|
|
7495
|
-
}
|
|
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);
|
|
7496
7542
|
}
|
|
7543
|
+
}
|
|
7497
7544
|
}
|
|
7498
7545
|
|
|
7499
7546
|
// fieldSet 已支持显隐控制
|
|
7500
|
-
const sectionFieldsVisibleOn = ___default.map(___default.compact(___default.map(fieldSetBody, 'visibleOn'))
|
|
7547
|
+
const sectionFieldsVisibleOn = ___default.map(___default.compact(___default.map(fieldSetBody, 'visibleOn')), (visibleOn) => {
|
|
7501
7548
|
return visibleOn;
|
|
7502
7549
|
});
|
|
7503
|
-
|
|
7550
|
+
|
|
7551
|
+
let section = {
|
|
7504
7552
|
"type": "fieldSet",
|
|
7505
7553
|
"title": sectionName,
|
|
7506
7554
|
"collapsable": true,
|
|
7507
7555
|
"body": fieldSetBody,
|
|
7508
7556
|
};
|
|
7509
|
-
|
|
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) {
|
|
7510
7566
|
section.visibleOn = `${sectionFieldsVisibleOn.join(" || ")}`;
|
|
7511
7567
|
}
|
|
7512
7568
|
return section
|
|
7513
7569
|
};
|
|
7514
7570
|
|
|
7515
7571
|
const getSections = async (permissionFields, formFields, ctx) => {
|
|
7572
|
+
if (!ctx) {
|
|
7573
|
+
ctx = {};
|
|
7574
|
+
}
|
|
7516
7575
|
const fieldSchemaArray = getFieldSchemaArray(formFields);
|
|
7517
7576
|
const _sections = ___default.groupBy(fieldSchemaArray, 'group');
|
|
7518
7577
|
const sections = [];
|
|
7578
|
+
var sectionVisibleOns = [];
|
|
7519
7579
|
for (const key in _sections) {
|
|
7520
7580
|
const section = await getSection(formFields, permissionFields, fieldSchemaArray, key, ctx);
|
|
7521
|
-
if(section.body.length > 0){
|
|
7581
|
+
if (section.body.length > 0) {
|
|
7582
|
+
if (section.visibleOn) {
|
|
7583
|
+
sectionVisibleOns.push(section.visibleOn);
|
|
7584
|
+
}
|
|
7585
|
+
else {
|
|
7586
|
+
sectionVisibleOns.push("true");
|
|
7587
|
+
}
|
|
7522
7588
|
sections.push(section);
|
|
7523
7589
|
}
|
|
7524
7590
|
}
|
|
7591
|
+
/*
|
|
7592
|
+
为了实现只有一个分组时隐藏该分组标题,需要分三种情况(分组如果没有visibleon属性就代表一定显示,有visibleon需要进行判断)
|
|
7593
|
+
1 当前分组为隐藏时,标题就设置为隐藏
|
|
7594
|
+
2 当前分组为显示时,其他分组只要有一个是显示,就显示该分组标题
|
|
7595
|
+
3 当前分组为显示时,其他分组都隐藏,就隐藏该分组标题
|
|
7596
|
+
*/
|
|
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
|
+
|
|
7525
7615
|
return sections;
|
|
7526
7616
|
};
|
|
7527
7617
|
|
|
@@ -8036,6 +8126,8 @@ async function getTableColumns$1(fields, options){
|
|
|
8036
8126
|
type = 'tpl';
|
|
8037
8127
|
}else if(field.type === 'html'){
|
|
8038
8128
|
type = 'markdown';
|
|
8129
|
+
}else if(field.type === 'url' && field.show_as_qr){
|
|
8130
|
+
type = 'qr-code';
|
|
8039
8131
|
}
|
|
8040
8132
|
let className = "";
|
|
8041
8133
|
if(field.type === 'textarea'){
|
|
@@ -8063,7 +8155,13 @@ async function getTableColumns$1(fields, options){
|
|
|
8063
8155
|
|
|
8064
8156
|
}
|
|
8065
8157
|
// columns.push(getOperation(fields));
|
|
8066
|
-
|
|
8158
|
+
if(!___default.some(columns, { name: options.labelFieldName })){
|
|
8159
|
+
const href = Router$1.getObjectDetailPath({
|
|
8160
|
+
...options, formFactor: options.formFactor, appId: "${appId}", objectName: options.objectName || "${objectName}", recordId: `\${${options.idFieldName}}`
|
|
8161
|
+
});
|
|
8162
|
+
columns[0].type = "tpl";
|
|
8163
|
+
columns[0].tpl = `<a href="${href}">\${${columns[0].name}}</a>`;
|
|
8164
|
+
}
|
|
8067
8165
|
return columns;
|
|
8068
8166
|
}
|
|
8069
8167
|
|
|
@@ -8429,6 +8527,8 @@ async function getTableApi(mainObject, fields, options){
|
|
|
8429
8527
|
|
|
8430
8528
|
const fileFields = {};
|
|
8431
8529
|
const fileFieldsKeys = [];
|
|
8530
|
+
// 含有optionsFunction属性, 无reference_to属性的lookup字段
|
|
8531
|
+
const lookupFields = {};
|
|
8432
8532
|
fields.forEach((item)=>{
|
|
8433
8533
|
if(___default.includes(['image','avatar','file'], item.type)){
|
|
8434
8534
|
fileFieldsKeys.push(item.name);
|
|
@@ -8438,6 +8538,9 @@ async function getTableApi(mainObject, fields, options){
|
|
|
8438
8538
|
multiple: item.multiple
|
|
8439
8539
|
};
|
|
8440
8540
|
}
|
|
8541
|
+
if(___default.includes(['lookup'], item.type) && !item.reference_to ){
|
|
8542
|
+
lookupFields[item.name] = item;
|
|
8543
|
+
}
|
|
8441
8544
|
});
|
|
8442
8545
|
|
|
8443
8546
|
let valueField = mainObject.key_field || '_id';
|
|
@@ -8454,6 +8557,7 @@ async function getTableApi(mainObject, fields, options){
|
|
|
8454
8557
|
api.data.filter = "$filter";
|
|
8455
8558
|
api.data.loaded = "${loaded}";
|
|
8456
8559
|
api.data.listViewId = "${listViewId}";
|
|
8560
|
+
api.data.listName = "${listName}";
|
|
8457
8561
|
api.requestAdaptor = `
|
|
8458
8562
|
// selfData 中的数据由 CRUD 控制. selfData中,只能获取到 CRUD 给定的data. 无法从数据链中获取数据.
|
|
8459
8563
|
let selfData = JSON.parse(JSON.stringify(api.data.$self));
|
|
@@ -8484,9 +8588,13 @@ async function getTableApi(mainObject, fields, options){
|
|
|
8484
8588
|
console.error("本地存储中crud参数解析异常:", ex);
|
|
8485
8589
|
}
|
|
8486
8590
|
${baseFilters ? `var systemFilters = ${JSON.stringify(baseFilters)};` : 'var systemFilters = [];'}
|
|
8591
|
+
var _ids = []
|
|
8487
8592
|
const filtersFunction = ${filtersFunction};
|
|
8488
8593
|
if(filtersFunction){
|
|
8489
8594
|
const _filters = filtersFunction(systemFilters, api.data.$self);
|
|
8595
|
+
if(api.data.listName == "recent"){
|
|
8596
|
+
_ids = _filters[2]
|
|
8597
|
+
}
|
|
8490
8598
|
if(_filters && _filters.length > 0){
|
|
8491
8599
|
if(_.isEmpty(systemFilters)){
|
|
8492
8600
|
systemFilters = _filters || [];
|
|
@@ -8598,6 +8706,7 @@ async function getTableApi(mainObject, fields, options){
|
|
|
8598
8706
|
filters = [filters, 'and', userFilters]
|
|
8599
8707
|
}
|
|
8600
8708
|
}
|
|
8709
|
+
api.data._ids = _ids;
|
|
8601
8710
|
api.data = {
|
|
8602
8711
|
query: api.data.query.replace(/{__filters}/g, JSON.stringify(filters)).replace('{__top}', pageSize).replace('{__skip}', skip).replace('{__sort}', sort.trim())
|
|
8603
8712
|
}
|
|
@@ -8605,6 +8714,11 @@ async function getTableApi(mainObject, fields, options){
|
|
|
8605
8714
|
return api;
|
|
8606
8715
|
`;
|
|
8607
8716
|
api.adaptor = `
|
|
8717
|
+
if(api.body.listName == "recent"){
|
|
8718
|
+
payload.data.rows = _.sortBy(payload.data.rows, function(item){
|
|
8719
|
+
return _.indexOf(api.body._ids, item._id)
|
|
8720
|
+
});
|
|
8721
|
+
}
|
|
8608
8722
|
const enable_tree = ${mainObject.enable_tree};
|
|
8609
8723
|
if(!enable_tree){
|
|
8610
8724
|
_.each(payload.data.rows, function(item, index){
|
|
@@ -8615,9 +8729,10 @@ async function getTableApi(mainObject, fields, options){
|
|
|
8615
8729
|
}
|
|
8616
8730
|
window.postMessage(Object.assign({type: "listview.loaded"}), "*");
|
|
8617
8731
|
let fileFields = ${JSON.stringify(fileFields)};
|
|
8732
|
+
let lookupFields = ${JSON.stringify(lookupFields)};
|
|
8618
8733
|
_.each(payload.data.rows, function(item, index){
|
|
8619
8734
|
_.each(fileFields , (field, key)=>{
|
|
8620
|
-
if(item[key] && item._display && item._display
|
|
8735
|
+
if(item[key] && item._display && item._display[key]){
|
|
8621
8736
|
let value = item._display[key];
|
|
8622
8737
|
if(!_.isArray(value)){
|
|
8623
8738
|
value = [value]
|
|
@@ -8629,6 +8744,14 @@ async function getTableApi(mainObject, fields, options){
|
|
|
8629
8744
|
}
|
|
8630
8745
|
}
|
|
8631
8746
|
})
|
|
8747
|
+
_.each(lookupFields , (field, key)=>{
|
|
8748
|
+
if(item[key]){
|
|
8749
|
+
if(field._optionsFunction){
|
|
8750
|
+
const optionsFunction = eval("(" + field._optionsFunction+ ")")(item);
|
|
8751
|
+
item[key + '__label'] = _.map(_.filter(optionsFunction, function(option){return _.includes(item[key], option.value)}), 'label').join(' ');
|
|
8752
|
+
}
|
|
8753
|
+
}
|
|
8754
|
+
})
|
|
8632
8755
|
})
|
|
8633
8756
|
|
|
8634
8757
|
if(enable_tree){
|
|
@@ -9958,6 +10081,24 @@ async function getListSchema(
|
|
|
9958
10081
|
|
|
9959
10082
|
ctx.defaults = defaults;
|
|
9960
10083
|
|
|
10084
|
+
if (listViewName == "recent") {
|
|
10085
|
+
listview_filters = `
|
|
10086
|
+
function(filters, data) {
|
|
10087
|
+
var result = Steedos.authRequest('/graphql', {
|
|
10088
|
+
type: 'POST',
|
|
10089
|
+
async: false,
|
|
10090
|
+
data: JSON.stringify({
|
|
10091
|
+
query: '{object_recent_viewed(filters: [["record.o","=","' + data.objectName + '"],["space","=","' + data.context.tenantId + '"],["owner","=","' + data.context.userId + '"]],sort:"modified desc",top:50){ _id,record} }'
|
|
10092
|
+
}),
|
|
10093
|
+
});
|
|
10094
|
+
var _ids = []
|
|
10095
|
+
result.data.object_recent_viewed.forEach(function (item) {
|
|
10096
|
+
_ids = _ids.concat(item.record.ids)
|
|
10097
|
+
})
|
|
10098
|
+
return ["_id", "=", _ids];
|
|
10099
|
+
}
|
|
10100
|
+
`;
|
|
10101
|
+
}
|
|
9961
10102
|
const amisSchema = {
|
|
9962
10103
|
"type": "steedos-object-table",
|
|
9963
10104
|
"objectApiName": objectName,
|
|
@@ -13560,11 +13701,11 @@ var SteedosSkeleton = function (props) {
|
|
|
13560
13701
|
};
|
|
13561
13702
|
|
|
13562
13703
|
var AmisObjectForm = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
13563
|
-
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;
|
|
13564
13705
|
return __generator(this, function (_d) {
|
|
13565
13706
|
switch (_d.label) {
|
|
13566
13707
|
case 0:
|
|
13567
|
-
$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;
|
|
13568
13709
|
objectApiName = props.objectApiName || "space_users";
|
|
13569
13710
|
schemaKeys = difference(keys($schema), ["type", "mode", "layout", "defaultData"]);
|
|
13570
13711
|
formSchema = pick(props, schemaKeys);
|
|
@@ -13594,7 +13735,9 @@ var AmisObjectForm = function (props) { return __awaiter(void 0, void 0, void 0,
|
|
|
13594
13735
|
initApiRequestAdaptor: initApiRequestAdaptor,
|
|
13595
13736
|
initApiAdaptor: initApiAdaptor,
|
|
13596
13737
|
apiRequestAdaptor: apiRequestAdaptor,
|
|
13597
|
-
apiAdaptor: apiAdaptor
|
|
13738
|
+
apiAdaptor: apiAdaptor,
|
|
13739
|
+
enableTabs: enableTabs,
|
|
13740
|
+
tabsMode: tabsMode
|
|
13598
13741
|
}))];
|
|
13599
13742
|
case 1:
|
|
13600
13743
|
schema = _d.sent();
|
|
@@ -13693,6 +13836,7 @@ var AmisObjectListView = function (props) { return __awaiter(void 0, void 0, voi
|
|
|
13693
13836
|
// className不传入crud组件,crud单独识别crudClassName属性
|
|
13694
13837
|
listSchema.className = crudClassName;
|
|
13695
13838
|
listSchema.onEvent = {}; // 为啥要将一个内置event放在此处?
|
|
13839
|
+
// 下面expression中_isRelated参数判断的是列表视图分栏模式下,新建、编辑、删除相关子表记录时不应该刷新左侧(主表)列表视图组件
|
|
13696
13840
|
listSchema.onEvent["@data.changed.".concat(objectApiName)] = {
|
|
13697
13841
|
"actions": [
|
|
13698
13842
|
{
|
|
@@ -15272,7 +15416,7 @@ var getSelectFlowSchema = function (id, props) {
|
|
|
15272
15416
|
"method": "post",
|
|
15273
15417
|
"url": "${context.rootUrl}/graphql?keywords=${keywords}",
|
|
15274
15418
|
"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 "),
|
|
15275
|
-
"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 ",
|
|
15419
|
+
"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 ",
|
|
15276
15420
|
"headers": {
|
|
15277
15421
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
15278
15422
|
}
|