@steedos-widgets/amis-lib 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/cjs/tsconfig.tsbuildinfo +1 -1
- package/dist/index.cjs.js +179 -38
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +179 -38
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +179 -38
- package/dist/index.umd.js.map +1 -1
- package/dist/types/lib/converter/amis/fields/editor.d.ts +10 -0
- package/dist/types/lib/converter/amis/fields/lookup.d.ts +1 -67
- package/dist/types/lib/converter/amis/fields/sections.d.ts +9 -0
- package/dist/types/lib/converter/amis/form.d.ts +9 -0
- package/dist/types/lib/converter/amis/index.d.ts +9 -0
- package/dist/types/lib/converter/amis/toolbars/setting_listview.d.ts +1 -0
- package/dist/types/lib/objects.d.ts +9 -0
- package/dist/types/schema/standard_import_data.amis.d.ts +16 -0
- package/dist/types/standard/button.d.ts +16 -0
- package/package.json +2 -2
package/dist/index.umd.js
CHANGED
|
@@ -1894,7 +1894,23 @@
|
|
|
1894
1894
|
{
|
|
1895
1895
|
name: "template_url",
|
|
1896
1896
|
label: "导入模板",
|
|
1897
|
-
type: "
|
|
1897
|
+
type: "button-group",
|
|
1898
|
+
buttons: [
|
|
1899
|
+
{
|
|
1900
|
+
type: "button",
|
|
1901
|
+
label: "下载",
|
|
1902
|
+
visibleOn: "${template_url}",
|
|
1903
|
+
level: "link",
|
|
1904
|
+
actionType: "download",
|
|
1905
|
+
api:{
|
|
1906
|
+
url: "${template_url}",
|
|
1907
|
+
method: "get",
|
|
1908
|
+
headers: {
|
|
1909
|
+
Authorization: "Bearer ${context.tenantId},${context.authToken}"
|
|
1910
|
+
}
|
|
1911
|
+
}
|
|
1912
|
+
}
|
|
1913
|
+
],
|
|
1898
1914
|
options: {
|
|
1899
1915
|
html: true
|
|
1900
1916
|
},
|
|
@@ -4654,12 +4670,13 @@
|
|
|
4654
4670
|
"type": "dropdown-button",
|
|
4655
4671
|
"trigger": "click",
|
|
4656
4672
|
"icon": "fa fa-cog",
|
|
4673
|
+
"tooltip": "列表视图控制",
|
|
4657
4674
|
"btnClassName": "antd-Button--iconOnly bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
4658
4675
|
"align": "right",
|
|
4659
4676
|
"visibleOn": "${!isLookup}",
|
|
4660
4677
|
"buttons": [
|
|
4661
4678
|
{
|
|
4662
|
-
"label": "
|
|
4679
|
+
"label": "列表视图控制",
|
|
4663
4680
|
"children": [
|
|
4664
4681
|
getNewListviewButtonSchema(),
|
|
4665
4682
|
getCopyListviewButtonSchema(),
|
|
@@ -4693,9 +4710,11 @@
|
|
|
4693
4710
|
"rightIconClassName": "m-l-sm"
|
|
4694
4711
|
}
|
|
4695
4712
|
];
|
|
4713
|
+
const displayAsLabel = displayAs === 'split'? "分栏视图" : "表格";
|
|
4696
4714
|
return {
|
|
4697
4715
|
"type": "dropdown-button",
|
|
4698
4716
|
"icon": "fa fa-table-columns",
|
|
4717
|
+
"tooltip": `显示为 ${displayAsLabel}`,
|
|
4699
4718
|
"btnClassName": "antd-Button--iconOnly bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
4700
4719
|
"align": "right",
|
|
4701
4720
|
"visibleOn": "${window:innerWidth > 768 && !!!isLookup}",
|
|
@@ -4775,6 +4794,7 @@ else{
|
|
|
4775
4794
|
// "type": "reload",//不可以直接使用reload,因为它不会设置页码到第一页
|
|
4776
4795
|
"type": "button",
|
|
4777
4796
|
"align": "right",
|
|
4797
|
+
"tooltip": "刷新",
|
|
4778
4798
|
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
4779
4799
|
"label": "",
|
|
4780
4800
|
"icon": "fa fa-sync",
|
|
@@ -4794,6 +4814,7 @@ else{
|
|
|
4794
4814
|
"label": "",
|
|
4795
4815
|
"icon": "fa fa-search",
|
|
4796
4816
|
"type": "button",
|
|
4817
|
+
"tooltip": "搜索",
|
|
4797
4818
|
"badge": {
|
|
4798
4819
|
"offset": [
|
|
4799
4820
|
-5,
|
|
@@ -4838,6 +4859,7 @@ else{
|
|
|
4838
4859
|
{
|
|
4839
4860
|
"type": "reload",
|
|
4840
4861
|
"align": "right",
|
|
4862
|
+
"tooltip": "刷新",
|
|
4841
4863
|
"tooltipPlacement": "bottom",
|
|
4842
4864
|
"className": "bg-white p-2 rounded border-gray-300 text-gray-500"
|
|
4843
4865
|
},
|
|
@@ -4845,6 +4867,8 @@ else{
|
|
|
4845
4867
|
filterVisible ? {
|
|
4846
4868
|
"label": "",
|
|
4847
4869
|
"icon": "fa fa-search",
|
|
4870
|
+
"tooltip": "搜索",
|
|
4871
|
+
"tooltipPlacement": "bottom",
|
|
4848
4872
|
"type": "button",
|
|
4849
4873
|
"align": "right",
|
|
4850
4874
|
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
@@ -5494,6 +5518,10 @@ else{
|
|
|
5494
5518
|
};
|
|
5495
5519
|
}
|
|
5496
5520
|
|
|
5521
|
+
if(field.pickerSchema){
|
|
5522
|
+
pickerSchema = Object.assign({}, pickerSchema, field.pickerSchema);
|
|
5523
|
+
}
|
|
5524
|
+
|
|
5497
5525
|
const data = {
|
|
5498
5526
|
type: getAmisStaticFieldType('picker', readonly),
|
|
5499
5527
|
labelField: referenceTo.labelField.name,
|
|
@@ -5869,8 +5897,8 @@ else{
|
|
|
5869
5897
|
/*
|
|
5870
5898
|
* @Author: baozhoutao@steedos.com
|
|
5871
5899
|
* @Date: 2023-01-13 17:27:54
|
|
5872
|
-
* @LastEditors:
|
|
5873
|
-
* @LastEditTime: 2023-
|
|
5900
|
+
* @LastEditors: Please set LastEditors
|
|
5901
|
+
* @LastEditTime: 2023-05-31 13:34:22
|
|
5874
5902
|
* @Description:
|
|
5875
5903
|
*/
|
|
5876
5904
|
|
|
@@ -5912,8 +5940,12 @@ else{
|
|
|
5912
5940
|
const getHtmlFieldSchema = (field, readonly, ctx)=>{
|
|
5913
5941
|
if(readonly){
|
|
5914
5942
|
return {
|
|
5915
|
-
"type": "
|
|
5916
|
-
"
|
|
5943
|
+
"type": "control",
|
|
5944
|
+
"label": field.label,
|
|
5945
|
+
"body": {
|
|
5946
|
+
"type": "html",
|
|
5947
|
+
"name": field.name
|
|
5948
|
+
}
|
|
5917
5949
|
}
|
|
5918
5950
|
}else {
|
|
5919
5951
|
return {
|
|
@@ -5940,8 +5972,8 @@ else{
|
|
|
5940
5972
|
/*
|
|
5941
5973
|
* @Author: baozhoutao@steedos.com
|
|
5942
5974
|
* @Date: 2022-10-28 14:52:55
|
|
5943
|
-
* @LastEditors:
|
|
5944
|
-
* @LastEditTime:
|
|
5975
|
+
* @LastEditors: Please set LastEditors
|
|
5976
|
+
* @LastEditTime: 2023-05-31 13:25:53
|
|
5945
5977
|
* @Description:
|
|
5946
5978
|
*/
|
|
5947
5979
|
|
|
@@ -6490,8 +6522,19 @@ else{
|
|
|
6490
6522
|
break;
|
|
6491
6523
|
case 'url':
|
|
6492
6524
|
convertData = {
|
|
6493
|
-
type: getAmisStaticFieldType('url', readonly)
|
|
6525
|
+
type: getAmisStaticFieldType('url', readonly, field)
|
|
6494
6526
|
};
|
|
6527
|
+
if(readonly && field.show_as_qr){
|
|
6528
|
+
convertData = {
|
|
6529
|
+
type: "control",
|
|
6530
|
+
label: field.label,
|
|
6531
|
+
body: {
|
|
6532
|
+
type: "qr-code",
|
|
6533
|
+
codeSize: 128,
|
|
6534
|
+
name: field.name
|
|
6535
|
+
}
|
|
6536
|
+
};
|
|
6537
|
+
}
|
|
6495
6538
|
break;
|
|
6496
6539
|
case 'email':
|
|
6497
6540
|
convertData = {
|
|
@@ -6526,6 +6569,7 @@ else{
|
|
|
6526
6569
|
case 'code':
|
|
6527
6570
|
convertData = {
|
|
6528
6571
|
type: "editor",
|
|
6572
|
+
disabled: readonly ? true : false,
|
|
6529
6573
|
language: field.language,
|
|
6530
6574
|
editorDidMount: new Function('editor', 'monaco', field.editorDidMount)
|
|
6531
6575
|
};
|
|
@@ -7108,12 +7152,12 @@ else{
|
|
|
7108
7152
|
/*
|
|
7109
7153
|
* @Author: baozhoutao@steedos.com
|
|
7110
7154
|
* @Date: 2022-05-26 16:02:08
|
|
7111
|
-
* @LastEditors:
|
|
7112
|
-
* @LastEditTime: 2023-
|
|
7155
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
7156
|
+
* @LastEditTime: 2023-06-02 16:54:41
|
|
7113
7157
|
* @Description:
|
|
7114
7158
|
*/
|
|
7115
7159
|
|
|
7116
|
-
const getFieldSchemaArray = (formFields)=>{
|
|
7160
|
+
const getFieldSchemaArray = (formFields) => {
|
|
7117
7161
|
let fieldSchemaArray = [];
|
|
7118
7162
|
fieldSchemaArray.length = 0;
|
|
7119
7163
|
|
|
@@ -7126,10 +7170,10 @@ else{
|
|
|
7126
7170
|
// field.group = field.label
|
|
7127
7171
|
field.is_wide = true;
|
|
7128
7172
|
}
|
|
7129
|
-
|
|
7130
|
-
if (!isObjectField){
|
|
7131
|
-
if(!field.hidden){
|
|
7132
|
-
|
|
7173
|
+
|
|
7174
|
+
if (!isObjectField) {
|
|
7175
|
+
if (!field.hidden) {
|
|
7176
|
+
fieldSchemaArray.push(Object.assign({ name: fieldName }, field, { permission: { allowEdit: true } }));
|
|
7133
7177
|
}
|
|
7134
7178
|
}
|
|
7135
7179
|
});
|
|
@@ -7137,58 +7181,104 @@ else{
|
|
|
7137
7181
|
};
|
|
7138
7182
|
|
|
7139
7183
|
const getSection = async (formFields, permissionFields, fieldSchemaArray, sectionName, ctx) => {
|
|
7184
|
+
if (!ctx) {
|
|
7185
|
+
ctx = {};
|
|
7186
|
+
}
|
|
7140
7187
|
const sectionFields = ___namespace.filter(fieldSchemaArray, { 'group': sectionName });
|
|
7141
|
-
if(sectionFields.length == ___namespace.filter(sectionFields, ['hidden', true]).length){
|
|
7142
|
-
return
|
|
7188
|
+
if (sectionFields.length == ___namespace.filter(sectionFields, ['hidden', true]).length) {
|
|
7189
|
+
return;
|
|
7143
7190
|
}
|
|
7144
7191
|
|
|
7145
7192
|
const fieldSetBody = [];
|
|
7146
7193
|
|
|
7147
7194
|
for (const perField of sectionFields) {
|
|
7148
7195
|
let field = perField;
|
|
7149
|
-
|
|
7150
|
-
|
|
7151
|
-
|
|
7152
|
-
|
|
7153
|
-
|
|
7154
|
-
|
|
7155
|
-
|
|
7156
|
-
|
|
7157
|
-
|
|
7158
|
-
|
|
7159
|
-
|
|
7160
|
-
|
|
7161
|
-
|
|
7162
|
-
}
|
|
7196
|
+
if (perField.type === 'grid') {
|
|
7197
|
+
field = await getGridFieldSubFields(perField, formFields);
|
|
7198
|
+
// console.log(`perField.type grid ===> field`, field)
|
|
7199
|
+
} else if (perField.type === 'object') {
|
|
7200
|
+
field = await getObjectFieldSubFields(perField, formFields);
|
|
7201
|
+
// console.log(`perField.type object ===> field`, field)
|
|
7202
|
+
}
|
|
7203
|
+
if (field.name.indexOf(".") < 0) {
|
|
7204
|
+
ctx.__formFields = formFields;
|
|
7205
|
+
const amisField = await convertSFieldToAmisField(field, field.readonly, ctx);
|
|
7206
|
+
// console.log(`${field.name} amisField`, field, amisField)
|
|
7207
|
+
if (amisField) {
|
|
7208
|
+
fieldSetBody.push(amisField);
|
|
7163
7209
|
}
|
|
7210
|
+
}
|
|
7164
7211
|
}
|
|
7165
7212
|
|
|
7166
7213
|
// fieldSet 已支持显隐控制
|
|
7167
|
-
const sectionFieldsVisibleOn = ___namespace.map(___namespace.compact(___namespace.map(fieldSetBody, 'visibleOn'))
|
|
7214
|
+
const sectionFieldsVisibleOn = ___namespace.map(___namespace.compact(___namespace.map(fieldSetBody, 'visibleOn')), (visibleOn) => {
|
|
7168
7215
|
return visibleOn;
|
|
7169
7216
|
});
|
|
7170
|
-
|
|
7217
|
+
|
|
7218
|
+
let section = {
|
|
7171
7219
|
"type": "fieldSet",
|
|
7172
7220
|
"title": sectionName,
|
|
7173
7221
|
"collapsable": true,
|
|
7174
7222
|
"body": fieldSetBody,
|
|
7175
7223
|
};
|
|
7176
|
-
|
|
7224
|
+
|
|
7225
|
+
if (ctx.enableTabs) {
|
|
7226
|
+
section = {
|
|
7227
|
+
"title": sectionName,
|
|
7228
|
+
"body": fieldSetBody,
|
|
7229
|
+
};
|
|
7230
|
+
}
|
|
7231
|
+
|
|
7232
|
+
if (sectionFieldsVisibleOn.length > 0 && fieldSetBody.length === sectionFieldsVisibleOn.length) {
|
|
7177
7233
|
section.visibleOn = `${sectionFieldsVisibleOn.join(" || ")}`;
|
|
7178
7234
|
}
|
|
7179
7235
|
return section
|
|
7180
7236
|
};
|
|
7181
7237
|
|
|
7182
7238
|
const getSections = async (permissionFields, formFields, ctx) => {
|
|
7239
|
+
if (!ctx) {
|
|
7240
|
+
ctx = {};
|
|
7241
|
+
}
|
|
7183
7242
|
const fieldSchemaArray = getFieldSchemaArray(formFields);
|
|
7184
7243
|
const _sections = ___namespace.groupBy(fieldSchemaArray, 'group');
|
|
7185
7244
|
const sections = [];
|
|
7245
|
+
var sectionVisibleOns = [];
|
|
7186
7246
|
for (const key in _sections) {
|
|
7187
7247
|
const section = await getSection(formFields, permissionFields, fieldSchemaArray, key, ctx);
|
|
7188
|
-
if(section.body.length > 0){
|
|
7248
|
+
if (section.body.length > 0) {
|
|
7249
|
+
if (section.visibleOn) {
|
|
7250
|
+
sectionVisibleOns.push(section.visibleOn);
|
|
7251
|
+
}
|
|
7252
|
+
else {
|
|
7253
|
+
sectionVisibleOns.push("true");
|
|
7254
|
+
}
|
|
7189
7255
|
sections.push(section);
|
|
7190
7256
|
}
|
|
7191
7257
|
}
|
|
7258
|
+
/*
|
|
7259
|
+
为了实现只有一个分组时隐藏该分组标题,需要分三种情况(分组如果没有visibleon属性就代表一定显示,有visibleon需要进行判断)
|
|
7260
|
+
1 当前分组为隐藏时,标题就设置为隐藏
|
|
7261
|
+
2 当前分组为显示时,其他分组只要有一个是显示,就显示该分组标题
|
|
7262
|
+
3 当前分组为显示时,其他分组都隐藏,就隐藏该分组标题
|
|
7263
|
+
*/
|
|
7264
|
+
sections.forEach((section, index) => {
|
|
7265
|
+
var tempSectionVisibleOns = sectionVisibleOns.slice();
|
|
7266
|
+
tempSectionVisibleOns.splice(index, 1);
|
|
7267
|
+
section.headingClassName = {
|
|
7268
|
+
"hidden": `!((${tempSectionVisibleOns.join(" || ") || 'false'}) && ${sectionVisibleOns[index]})`
|
|
7269
|
+
};
|
|
7270
|
+
});
|
|
7271
|
+
|
|
7272
|
+
if (ctx.enableTabs) {
|
|
7273
|
+
return [
|
|
7274
|
+
{
|
|
7275
|
+
"type": "tabs",
|
|
7276
|
+
"tabs": sections,
|
|
7277
|
+
"tabsMode": ctx.tabsMode
|
|
7278
|
+
}
|
|
7279
|
+
]
|
|
7280
|
+
}
|
|
7281
|
+
|
|
7192
7282
|
return sections;
|
|
7193
7283
|
};
|
|
7194
7284
|
|
|
@@ -7703,6 +7793,8 @@ else{
|
|
|
7703
7793
|
type = 'tpl';
|
|
7704
7794
|
}else if(field.type === 'html'){
|
|
7705
7795
|
type = 'markdown';
|
|
7796
|
+
}else if(field.type === 'url' && field.show_as_qr){
|
|
7797
|
+
type = 'qr-code';
|
|
7706
7798
|
}
|
|
7707
7799
|
let className = "";
|
|
7708
7800
|
if(field.type === 'textarea'){
|
|
@@ -7730,7 +7822,13 @@ else{
|
|
|
7730
7822
|
|
|
7731
7823
|
}
|
|
7732
7824
|
// columns.push(getOperation(fields));
|
|
7733
|
-
|
|
7825
|
+
if(!___namespace.some(columns, { name: options.labelFieldName })){
|
|
7826
|
+
const href = Router.getObjectDetailPath({
|
|
7827
|
+
...options, formFactor: options.formFactor, appId: "${appId}", objectName: options.objectName || "${objectName}", recordId: `\${${options.idFieldName}}`
|
|
7828
|
+
});
|
|
7829
|
+
columns[0].type = "tpl";
|
|
7830
|
+
columns[0].tpl = `<a href="${href}">\${${columns[0].name}}</a>`;
|
|
7831
|
+
}
|
|
7734
7832
|
return columns;
|
|
7735
7833
|
}
|
|
7736
7834
|
|
|
@@ -8096,6 +8194,8 @@ else{
|
|
|
8096
8194
|
|
|
8097
8195
|
const fileFields = {};
|
|
8098
8196
|
const fileFieldsKeys = [];
|
|
8197
|
+
// 含有optionsFunction属性, 无reference_to属性的lookup字段
|
|
8198
|
+
const lookupFields = {};
|
|
8099
8199
|
fields.forEach((item)=>{
|
|
8100
8200
|
if(___namespace.includes(['image','avatar','file'], item.type)){
|
|
8101
8201
|
fileFieldsKeys.push(item.name);
|
|
@@ -8105,6 +8205,9 @@ else{
|
|
|
8105
8205
|
multiple: item.multiple
|
|
8106
8206
|
};
|
|
8107
8207
|
}
|
|
8208
|
+
if(___namespace.includes(['lookup'], item.type) && !item.reference_to ){
|
|
8209
|
+
lookupFields[item.name] = item;
|
|
8210
|
+
}
|
|
8108
8211
|
});
|
|
8109
8212
|
|
|
8110
8213
|
let valueField = mainObject.key_field || '_id';
|
|
@@ -8121,6 +8224,7 @@ else{
|
|
|
8121
8224
|
api.data.filter = "$filter";
|
|
8122
8225
|
api.data.loaded = "${loaded}";
|
|
8123
8226
|
api.data.listViewId = "${listViewId}";
|
|
8227
|
+
api.data.listName = "${listName}";
|
|
8124
8228
|
api.requestAdaptor = `
|
|
8125
8229
|
// selfData 中的数据由 CRUD 控制. selfData中,只能获取到 CRUD 给定的data. 无法从数据链中获取数据.
|
|
8126
8230
|
let selfData = JSON.parse(JSON.stringify(api.data.$self));
|
|
@@ -8151,9 +8255,13 @@ else{
|
|
|
8151
8255
|
console.error("本地存储中crud参数解析异常:", ex);
|
|
8152
8256
|
}
|
|
8153
8257
|
${baseFilters ? `var systemFilters = ${JSON.stringify(baseFilters)};` : 'var systemFilters = [];'}
|
|
8258
|
+
var _ids = []
|
|
8154
8259
|
const filtersFunction = ${filtersFunction};
|
|
8155
8260
|
if(filtersFunction){
|
|
8156
8261
|
const _filters = filtersFunction(systemFilters, api.data.$self);
|
|
8262
|
+
if(api.data.listName == "recent"){
|
|
8263
|
+
_ids = _filters[2]
|
|
8264
|
+
}
|
|
8157
8265
|
if(_filters && _filters.length > 0){
|
|
8158
8266
|
if(_.isEmpty(systemFilters)){
|
|
8159
8267
|
systemFilters = _filters || [];
|
|
@@ -8265,6 +8373,7 @@ else{
|
|
|
8265
8373
|
filters = [filters, 'and', userFilters]
|
|
8266
8374
|
}
|
|
8267
8375
|
}
|
|
8376
|
+
api.data._ids = _ids;
|
|
8268
8377
|
api.data = {
|
|
8269
8378
|
query: api.data.query.replace(/{__filters}/g, JSON.stringify(filters)).replace('{__top}', pageSize).replace('{__skip}', skip).replace('{__sort}', sort.trim())
|
|
8270
8379
|
}
|
|
@@ -8272,6 +8381,11 @@ else{
|
|
|
8272
8381
|
return api;
|
|
8273
8382
|
`;
|
|
8274
8383
|
api.adaptor = `
|
|
8384
|
+
if(api.body.listName == "recent"){
|
|
8385
|
+
payload.data.rows = _.sortBy(payload.data.rows, function(item){
|
|
8386
|
+
return _.indexOf(api.body._ids, item._id)
|
|
8387
|
+
});
|
|
8388
|
+
}
|
|
8275
8389
|
const enable_tree = ${mainObject.enable_tree};
|
|
8276
8390
|
if(!enable_tree){
|
|
8277
8391
|
_.each(payload.data.rows, function(item, index){
|
|
@@ -8282,9 +8396,10 @@ else{
|
|
|
8282
8396
|
}
|
|
8283
8397
|
window.postMessage(Object.assign({type: "listview.loaded"}), "*");
|
|
8284
8398
|
let fileFields = ${JSON.stringify(fileFields)};
|
|
8399
|
+
let lookupFields = ${JSON.stringify(lookupFields)};
|
|
8285
8400
|
_.each(payload.data.rows, function(item, index){
|
|
8286
8401
|
_.each(fileFields , (field, key)=>{
|
|
8287
|
-
if(item[key] && item._display && item._display
|
|
8402
|
+
if(item[key] && item._display && item._display[key]){
|
|
8288
8403
|
let value = item._display[key];
|
|
8289
8404
|
if(!_.isArray(value)){
|
|
8290
8405
|
value = [value]
|
|
@@ -8296,6 +8411,14 @@ else{
|
|
|
8296
8411
|
}
|
|
8297
8412
|
}
|
|
8298
8413
|
})
|
|
8414
|
+
_.each(lookupFields , (field, key)=>{
|
|
8415
|
+
if(item[key]){
|
|
8416
|
+
if(field._optionsFunction){
|
|
8417
|
+
const optionsFunction = eval("(" + field._optionsFunction+ ")")(item);
|
|
8418
|
+
item[key + '__label'] = _.map(_.filter(optionsFunction, function(option){return _.includes(item[key], option.value)}), 'label').join(' ');
|
|
8419
|
+
}
|
|
8420
|
+
}
|
|
8421
|
+
})
|
|
8299
8422
|
})
|
|
8300
8423
|
|
|
8301
8424
|
if(enable_tree){
|
|
@@ -9625,6 +9748,24 @@ else{
|
|
|
9625
9748
|
|
|
9626
9749
|
ctx.defaults = defaults;
|
|
9627
9750
|
|
|
9751
|
+
if (listViewName == "recent") {
|
|
9752
|
+
listview_filters = `
|
|
9753
|
+
function(filters, data) {
|
|
9754
|
+
var result = Steedos.authRequest('/graphql', {
|
|
9755
|
+
type: 'POST',
|
|
9756
|
+
async: false,
|
|
9757
|
+
data: JSON.stringify({
|
|
9758
|
+
query: '{object_recent_viewed(filters: [["record.o","=","' + data.objectName + '"],["space","=","' + data.context.tenantId + '"],["owner","=","' + data.context.userId + '"]],sort:"modified desc",top:50){ _id,record} }'
|
|
9759
|
+
}),
|
|
9760
|
+
});
|
|
9761
|
+
var _ids = []
|
|
9762
|
+
result.data.object_recent_viewed.forEach(function (item) {
|
|
9763
|
+
_ids = _ids.concat(item.record.ids)
|
|
9764
|
+
})
|
|
9765
|
+
return ["_id", "=", _ids];
|
|
9766
|
+
}
|
|
9767
|
+
`;
|
|
9768
|
+
}
|
|
9628
9769
|
const amisSchema = {
|
|
9629
9770
|
"type": "steedos-object-table",
|
|
9630
9771
|
"objectApiName": objectName,
|