@steedos-widgets/sortable 6.3.0-beta.8 → 6.3.0
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/assets.json +5 -5
- package/dist/sortable.cjs.js +284 -133
- package/dist/sortable.cjs.js.map +1 -1
- package/dist/sortable.esm.js +284 -133
- package/dist/sortable.esm.js.map +1 -1
- package/dist/sortable.umd.js +284 -133
- package/package.json +3 -3
package/dist/sortable.umd.js
CHANGED
|
@@ -20431,9 +20431,9 @@
|
|
|
20431
20431
|
}
|
|
20432
20432
|
|
|
20433
20433
|
function getNameTplUrl(field, ctx){
|
|
20434
|
-
if(ctx.objectName === 'cms_files'){
|
|
20435
|
-
|
|
20436
|
-
}
|
|
20434
|
+
// if(ctx.objectName === 'cms_files'){
|
|
20435
|
+
// return "${(versions[0] && versions[0].url) ? versions[0].url+'?download=true' : context.rootUrl+'/api/files/files/'+versions[0]+'?download=true'}"
|
|
20436
|
+
// }
|
|
20437
20437
|
const href = Router.getObjectDetailPath({
|
|
20438
20438
|
...ctx, formFactor: ctx.formFactor, appId: "${appId}", objectName: ctx.objectName || "${objectName}", recordId: `\${${ctx.idFieldName}}`
|
|
20439
20439
|
});
|
|
@@ -20448,7 +20448,7 @@
|
|
|
20448
20448
|
}
|
|
20449
20449
|
let nameLabel = field.name;
|
|
20450
20450
|
//若字段类型是lookup,则按照相关表tpl的label规则显示;若是其它类型,则显示_display或字段本身的值
|
|
20451
|
-
if (field.type == "lookup") {
|
|
20451
|
+
if (field.type == "lookup" || field.type == "master_detail") {
|
|
20452
20452
|
if(!field.reference_to && (field.optionsFunction || field._optionsFunction || field.options)){
|
|
20453
20453
|
if(!field.isTableField){
|
|
20454
20454
|
nameLabel = `\${${field.name}__label}`;
|
|
@@ -20623,12 +20623,15 @@
|
|
|
20623
20623
|
}
|
|
20624
20624
|
}
|
|
20625
20625
|
|
|
20626
|
-
async function getFieldsTemplate(fields, display){
|
|
20626
|
+
async function getFieldsTemplate(object, fields, display){
|
|
20627
20627
|
let expandFields = [];
|
|
20628
20628
|
if(display != false){
|
|
20629
20629
|
display = true;
|
|
20630
20630
|
}
|
|
20631
20631
|
let fieldsName = ['_id'];
|
|
20632
|
+
if(!object.datasource || object.datasource === 'default' || object.datasource === 'meteor'){
|
|
20633
|
+
fieldsName.push('space');
|
|
20634
|
+
}
|
|
20632
20635
|
let displayFields = [];
|
|
20633
20636
|
let fieldsArr = [];
|
|
20634
20637
|
if(lodash.exports.isArray(fields)){
|
|
@@ -20714,7 +20717,7 @@
|
|
|
20714
20717
|
// return item.replace(/^{/,"").replace(/}$/,"");
|
|
20715
20718
|
// }).join(",")) : "";
|
|
20716
20719
|
|
|
20717
|
-
const fieldsTemplate = `${await getFieldsTemplate(fields, options.expand)}${treeFields}${cfsFields}`;
|
|
20720
|
+
const fieldsTemplate = `${await getFieldsTemplate(object, fields, options.expand)}${treeFields}${cfsFields}`;
|
|
20718
20721
|
|
|
20719
20722
|
return {
|
|
20720
20723
|
orderBy: "${orderBy}",
|
|
@@ -20729,7 +20732,7 @@
|
|
|
20729
20732
|
function getApi$2 (isMobile){
|
|
20730
20733
|
if(isMobile);else {
|
|
20731
20734
|
// return __meteor_runtime_config__.ROOT_URL_PATH_PREFIX + "/graphql"
|
|
20732
|
-
return `\${context.rootUrl}/graphql?reload=\${additionalFilters}`
|
|
20735
|
+
return `\${context.rootUrl}/graphql?reload=\${additionalFilters|join}`
|
|
20733
20736
|
}
|
|
20734
20737
|
}
|
|
20735
20738
|
|
|
@@ -20797,6 +20800,29 @@
|
|
|
20797
20800
|
}
|
|
20798
20801
|
}
|
|
20799
20802
|
|
|
20803
|
+
/*
|
|
20804
|
+
* @Author: baozhoutao@steedos.com
|
|
20805
|
+
* @Date: 2022-07-13 15:18:03
|
|
20806
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
20807
|
+
* @LastEditTime: 2023-04-11 10:34:26
|
|
20808
|
+
* @Description:
|
|
20809
|
+
*/
|
|
20810
|
+
|
|
20811
|
+
async function getPage({type, pageId = '', appId, objectName = '', recordId = '', formFactor = 'LARGE'}){
|
|
20812
|
+
const api = `/api/pageSchema/${type}?app=${appId}&objectApiName=${objectName}&recordId=${recordId}&pageId=${pageId}&formFactor=${formFactor}`;
|
|
20813
|
+
const page = await fetchAPI(api);
|
|
20814
|
+
if (page && page.schema) {
|
|
20815
|
+
page.schema = JSON.parse(page.schema);
|
|
20816
|
+
if(page.schema.data){
|
|
20817
|
+
delete page.schema.data.recordId;
|
|
20818
|
+
delete page.schema.data.objectName;
|
|
20819
|
+
delete page.schema.data.context;
|
|
20820
|
+
delete page.schema.data.global;
|
|
20821
|
+
}
|
|
20822
|
+
return page;
|
|
20823
|
+
}
|
|
20824
|
+
}
|
|
20825
|
+
|
|
20800
20826
|
/*
|
|
20801
20827
|
* @Author: baozhoutao@steedos.com
|
|
20802
20828
|
* @Date: 2022-10-28 14:15:09
|
|
@@ -20820,9 +20846,74 @@
|
|
|
20820
20846
|
return getAmisStaticFieldType(steedosField.type === 'avatar' ? 'image' : steedosField.type, readonly, {multiple: steedosField.multiple});
|
|
20821
20847
|
};
|
|
20822
20848
|
|
|
20823
|
-
|
|
20849
|
+
async function getLookupLinkOnClick(field, options) {
|
|
20850
|
+
const recordPage = await getPage({ type: 'record', appId: options.appId, objectName: options.objectName, formFactor: options.formFactor });
|
|
20851
|
+
|
|
20852
|
+
const drawerRecordDetailSchema = recordPage ? Object.assign({}, recordPage.schema, {
|
|
20853
|
+
"recordId": "${value}",
|
|
20854
|
+
"data": {
|
|
20855
|
+
...recordPage.schema.data,
|
|
20856
|
+
"_inDrawer": true, // 用于判断是否在抽屉中
|
|
20857
|
+
"recordLoaded": false, // 重置数据加载状态
|
|
20858
|
+
"objectName": options.objectName,
|
|
20859
|
+
}
|
|
20860
|
+
}) : {
|
|
20861
|
+
"type": "steedos-record-detail",
|
|
20862
|
+
"objectApiName": options.objectName,
|
|
20863
|
+
"recordId": "${value}",
|
|
20864
|
+
"showBackButton": false,
|
|
20865
|
+
"showButtons": true,
|
|
20866
|
+
"data": {
|
|
20867
|
+
"_inDrawer": true, // 用于判断是否在抽屉中
|
|
20868
|
+
"recordLoaded": false, // 重置数据加载状态
|
|
20869
|
+
}
|
|
20870
|
+
};
|
|
20871
|
+
return {
|
|
20872
|
+
"click": {
|
|
20873
|
+
"actions": [
|
|
20874
|
+
// {
|
|
20875
|
+
// "type": "custom",
|
|
20876
|
+
// "script": `
|
|
20877
|
+
// let fileRecordId = url.match(${regFileRecordId})[2];
|
|
20878
|
+
// console.log('fileRecordId:',fileRecordId);
|
|
20879
|
+
// event.data.recordId = fileRecordId;
|
|
20880
|
+
// `,
|
|
20881
|
+
// },
|
|
20882
|
+
{
|
|
20883
|
+
"actionType": "drawer",
|
|
20884
|
+
"drawer": {
|
|
20885
|
+
"type": "drawer",
|
|
20886
|
+
"title": " ",
|
|
20887
|
+
"headerClassName": "hidden",
|
|
20888
|
+
"size": "lg",
|
|
20889
|
+
"bodyClassName": "p-0 m-0 bg-gray-100",
|
|
20890
|
+
"closeOnEsc": true,
|
|
20891
|
+
"closeOnOutside": true,
|
|
20892
|
+
"resizable": true,
|
|
20893
|
+
"actions": [],
|
|
20894
|
+
"body": [
|
|
20895
|
+
drawerRecordDetailSchema
|
|
20896
|
+
],
|
|
20897
|
+
"className": "steedos-record-detail-drawer app-popover"
|
|
20898
|
+
},
|
|
20899
|
+
"preventDefault": true
|
|
20900
|
+
}
|
|
20901
|
+
]
|
|
20902
|
+
}
|
|
20903
|
+
}
|
|
20904
|
+
}
|
|
20905
|
+
|
|
20906
|
+
const getAmisFileReadonlySchema = async (steedosField,ctx = {})=>{
|
|
20824
20907
|
const type = steedosField.type;
|
|
20908
|
+
const { appId, formFactor } = ctx.amisData || {};
|
|
20825
20909
|
const amisFieldType = getAmisFieldType$1(steedosField, true);
|
|
20910
|
+
|
|
20911
|
+
let lookupATagClick = 'onclick="return false;"';
|
|
20912
|
+
|
|
20913
|
+
if(window.innerWidth < 768){
|
|
20914
|
+
lookupATagClick = "";
|
|
20915
|
+
}
|
|
20916
|
+
|
|
20826
20917
|
if(_.includes(['avatar','image'], type)){
|
|
20827
20918
|
return {
|
|
20828
20919
|
type: amisFieldType,
|
|
@@ -20857,13 +20948,34 @@
|
|
|
20857
20948
|
}
|
|
20858
20949
|
}
|
|
20859
20950
|
} : {
|
|
20860
|
-
type: amisFieldType,
|
|
20861
|
-
tpl: `
|
|
20862
|
-
<% let fileData = data._display.${steedosField.name}; if (fileData) { %>
|
|
20863
|
-
|
|
20864
|
-
|
|
20865
|
-
|
|
20866
|
-
<% });} %>`
|
|
20951
|
+
// type: amisFieldType,
|
|
20952
|
+
// tpl: `
|
|
20953
|
+
// <% let fileData = data._display.${steedosField.name}; if (fileData) { %>
|
|
20954
|
+
// <% if(!Array.isArray(fileData)){ fileData = [fileData]} %>
|
|
20955
|
+
// <% fileData.forEach(function(item) { %>
|
|
20956
|
+
// <a href='<%= item.url %>' target='_self' class='block'><%= item.name %></a>
|
|
20957
|
+
// <% });} %>`
|
|
20958
|
+
"type": "control",
|
|
20959
|
+
"body": {
|
|
20960
|
+
type: 'each',
|
|
20961
|
+
placeholder: "",
|
|
20962
|
+
// className: `steedos-field-lookup-each flex flex-wrap gap-2`,
|
|
20963
|
+
source: `\${_display.${steedosField.name}|asArray}`,
|
|
20964
|
+
items: {
|
|
20965
|
+
type: 'static',
|
|
20966
|
+
labelClassName: "hidden",
|
|
20967
|
+
label: false,
|
|
20968
|
+
className: 'm-0',
|
|
20969
|
+
tpl: `<a href="/app/-/cfs_files_filerecord/view/\${value}" ${lookupATagClick}>\${name}</a>`,
|
|
20970
|
+
// tpl: "<%= item.name >",
|
|
20971
|
+
// onEvent: window.innerWidth < 768 ? null : REFERENCE_VALUE_ITEM_ONCLICK
|
|
20972
|
+
onEvent: window.innerWidth < 768 ? null : await getLookupLinkOnClick(steedosField, {
|
|
20973
|
+
appId,
|
|
20974
|
+
objectName: "cfs_files_filerecord",
|
|
20975
|
+
formFactor
|
|
20976
|
+
})
|
|
20977
|
+
}
|
|
20978
|
+
}
|
|
20867
20979
|
}
|
|
20868
20980
|
}
|
|
20869
20981
|
};
|
|
@@ -20925,8 +21037,8 @@
|
|
|
20925
21037
|
return convertData;
|
|
20926
21038
|
};
|
|
20927
21039
|
|
|
20928
|
-
const getAmisFileSchema = (steedosField, readonly)=>{
|
|
20929
|
-
return readonly ? getAmisFileReadonlySchema(steedosField) : getAmisFileEditSchema(steedosField);
|
|
21040
|
+
const getAmisFileSchema = async (steedosField, readonly, ctx)=>{
|
|
21041
|
+
return readonly ? await getAmisFileReadonlySchema(steedosField,ctx) : getAmisFileEditSchema(steedosField);
|
|
20930
21042
|
};
|
|
20931
21043
|
|
|
20932
21044
|
var frontend_field_group_generalization$1 = "General";
|
|
@@ -20943,6 +21055,7 @@
|
|
|
20943
21055
|
var frontend_form_delete$1 = "Delete";
|
|
20944
21056
|
var frontend_form_view$1 = "view";
|
|
20945
21057
|
var frontend_form_details$1 = "details";
|
|
21058
|
+
var frontend_form_validation_failed_url$1 = "The URL format is incorrect";
|
|
20946
21059
|
var frontend_delete_confirm_text$1 = "Are you sure you want to delete this item?";
|
|
20947
21060
|
var frontend_delete_many_selected_required$1 = "Please select the item to be deleted";
|
|
20948
21061
|
var frontend_delete_many_confirm_text$1 = "Are you sure you want to delete?";
|
|
@@ -20999,6 +21112,7 @@
|
|
|
20999
21112
|
var frontend_notifications$1 = "Notifications";
|
|
21000
21113
|
var frontend_notifications_allread$1 = "Mark all as read";
|
|
21001
21114
|
var frontend_notifications_allread_message$1 = "All marked as read";
|
|
21115
|
+
var frontend_notifications_close_dialog$1 = "Close";
|
|
21002
21116
|
var frontend_profile$1 = "Profile";
|
|
21003
21117
|
var switch_space$1 = "Switch Space";
|
|
21004
21118
|
var frontend_about$1 = "About";
|
|
@@ -21031,6 +21145,7 @@
|
|
|
21031
21145
|
frontend_form_delete: frontend_form_delete$1,
|
|
21032
21146
|
frontend_form_view: frontend_form_view$1,
|
|
21033
21147
|
frontend_form_details: frontend_form_details$1,
|
|
21148
|
+
frontend_form_validation_failed_url: frontend_form_validation_failed_url$1,
|
|
21034
21149
|
frontend_delete_confirm_text: frontend_delete_confirm_text$1,
|
|
21035
21150
|
frontend_delete_many_selected_required: frontend_delete_many_selected_required$1,
|
|
21036
21151
|
frontend_delete_many_confirm_text: frontend_delete_many_confirm_text$1,
|
|
@@ -21087,6 +21202,7 @@
|
|
|
21087
21202
|
frontend_notifications: frontend_notifications$1,
|
|
21088
21203
|
frontend_notifications_allread: frontend_notifications_allread$1,
|
|
21089
21204
|
frontend_notifications_allread_message: frontend_notifications_allread_message$1,
|
|
21205
|
+
frontend_notifications_close_dialog: frontend_notifications_close_dialog$1,
|
|
21090
21206
|
frontend_profile: frontend_profile$1,
|
|
21091
21207
|
switch_space: switch_space$1,
|
|
21092
21208
|
frontend_about: frontend_about$1,
|
|
@@ -21120,6 +21236,7 @@
|
|
|
21120
21236
|
var frontend_form_delete = "删除";
|
|
21121
21237
|
var frontend_form_view = "查看";
|
|
21122
21238
|
var frontend_form_details = "详情";
|
|
21239
|
+
var frontend_form_validation_failed_url = "URL 格式不正确";
|
|
21123
21240
|
var frontend_delete_confirm_text = "确定要删除此项目?";
|
|
21124
21241
|
var frontend_delete_many_selected_required = "请选择要删除的项";
|
|
21125
21242
|
var frontend_delete_many_confirm_text = "确定要删除吗?";
|
|
@@ -21177,6 +21294,7 @@
|
|
|
21177
21294
|
var frontend_notifications = "通知";
|
|
21178
21295
|
var frontend_notifications_allread = "全部标记为已读";
|
|
21179
21296
|
var frontend_notifications_allread_message = "已全部标记为已读";
|
|
21297
|
+
var frontend_notifications_close_dialog = "关闭";
|
|
21180
21298
|
var frontend_profile = "个人资料";
|
|
21181
21299
|
var switch_space = "切换工作区";
|
|
21182
21300
|
var frontend_about = "关于";
|
|
@@ -21209,6 +21327,7 @@
|
|
|
21209
21327
|
frontend_form_delete: frontend_form_delete,
|
|
21210
21328
|
frontend_form_view: frontend_form_view,
|
|
21211
21329
|
frontend_form_details: frontend_form_details,
|
|
21330
|
+
frontend_form_validation_failed_url: frontend_form_validation_failed_url,
|
|
21212
21331
|
frontend_delete_confirm_text: frontend_delete_confirm_text,
|
|
21213
21332
|
frontend_delete_many_selected_required: frontend_delete_many_selected_required,
|
|
21214
21333
|
frontend_delete_many_confirm_text: frontend_delete_many_confirm_text,
|
|
@@ -21266,6 +21385,7 @@
|
|
|
21266
21385
|
frontend_notifications: frontend_notifications,
|
|
21267
21386
|
frontend_notifications_allread: frontend_notifications_allread,
|
|
21268
21387
|
frontend_notifications_allread_message: frontend_notifications_allread_message,
|
|
21388
|
+
frontend_notifications_close_dialog: frontend_notifications_close_dialog,
|
|
21269
21389
|
frontend_profile: frontend_profile,
|
|
21270
21390
|
switch_space: switch_space,
|
|
21271
21391
|
frontend_about: frontend_about,
|
|
@@ -21438,7 +21558,12 @@
|
|
|
21438
21558
|
break;
|
|
21439
21559
|
case "percent":
|
|
21440
21560
|
TempDisplayField = `
|
|
21441
|
-
|
|
21561
|
+
if(event.data.value){
|
|
21562
|
+
_display["${field.name}"] = event.data.value.toFixed(${field.scale}) + '%';
|
|
21563
|
+
} else {
|
|
21564
|
+
_display["${field.name}"] = event.data.value;
|
|
21565
|
+
}
|
|
21566
|
+
|
|
21442
21567
|
`;
|
|
21443
21568
|
quickEditSchema.body[0].onEvent["change"] = quickEditOnEvent(TempDisplayField);
|
|
21444
21569
|
break;
|
|
@@ -21782,6 +21907,60 @@
|
|
|
21782
21907
|
}
|
|
21783
21908
|
}
|
|
21784
21909
|
|
|
21910
|
+
async function getColumnItemOnClick(field, options){
|
|
21911
|
+
const recordPage = await getPage({ type: 'record', appId: options.appId, objectName: options.objectName, formFactor: options.formFactor });
|
|
21912
|
+
const drawerRecordDetailSchema = recordPage ? Object.assign({}, recordPage.schema, {
|
|
21913
|
+
"recordId": `\${${options.idFieldName}}`,
|
|
21914
|
+
"data": {
|
|
21915
|
+
...recordPage.schema.data,
|
|
21916
|
+
"_inDrawer": true, // 用于判断是否在抽屉中
|
|
21917
|
+
"recordLoaded": false, // 重置数据加载状态
|
|
21918
|
+
"recordId": `\${${options.idFieldName}}`//审批微页面依赖了作用域中的recordId
|
|
21919
|
+
}
|
|
21920
|
+
}) : {
|
|
21921
|
+
"type": "steedos-record-detail",
|
|
21922
|
+
"objectApiName": "${objectName}",
|
|
21923
|
+
"recordId": `\${${options.idFieldName}}`,
|
|
21924
|
+
"showBackButton": false,
|
|
21925
|
+
"showButtons": true,
|
|
21926
|
+
"data": {
|
|
21927
|
+
"_inDrawer": true, // 用于判断是否在抽屉中
|
|
21928
|
+
"recordLoaded": false, // 重置数据加载状态
|
|
21929
|
+
}
|
|
21930
|
+
};
|
|
21931
|
+
|
|
21932
|
+
if(!(field.is_name || field.name === options.labelFieldName)){
|
|
21933
|
+
drawerRecordDetailSchema.objectApiName = field.reference_to;
|
|
21934
|
+
drawerRecordDetailSchema.recordId = `\${_display.${field.name}.value}`;
|
|
21935
|
+
}
|
|
21936
|
+
return {
|
|
21937
|
+
"click": {
|
|
21938
|
+
"actions": [
|
|
21939
|
+
{
|
|
21940
|
+
"actionType": "drawer",
|
|
21941
|
+
"drawer": {
|
|
21942
|
+
"type": "drawer",
|
|
21943
|
+
"title": " ",
|
|
21944
|
+
"headerClassName": "hidden",
|
|
21945
|
+
"size": "lg",
|
|
21946
|
+
"bodyClassName": "p-0 m-0 bg-gray-100",
|
|
21947
|
+
"closeOnEsc": true,
|
|
21948
|
+
"closeOnOutside": true,
|
|
21949
|
+
"resizable": true,
|
|
21950
|
+
"actions": [],
|
|
21951
|
+
"body": [
|
|
21952
|
+
drawerRecordDetailSchema
|
|
21953
|
+
],
|
|
21954
|
+
"className": "steedos-record-detail-drawer app-popover",
|
|
21955
|
+
"id": "u:fc5f055afa8c"
|
|
21956
|
+
},
|
|
21957
|
+
"preventDefault": true
|
|
21958
|
+
}
|
|
21959
|
+
]
|
|
21960
|
+
}
|
|
21961
|
+
};
|
|
21962
|
+
}
|
|
21963
|
+
|
|
21785
21964
|
async function getTableColumns(object, fields, options){
|
|
21786
21965
|
const columns = [];
|
|
21787
21966
|
if(!options.isLookup && !options.isInputTable){
|
|
@@ -21821,7 +22000,10 @@
|
|
|
21821
22000
|
delete fieldAmis?.className;
|
|
21822
22001
|
|
|
21823
22002
|
let columnItem;
|
|
21824
|
-
|
|
22003
|
+
|
|
22004
|
+
// PC客户端点击名称字段直接预览
|
|
22005
|
+
let isNode = !!(window && window.nw && window.nw.require);
|
|
22006
|
+
if((field.is_name || field.name === options.labelFieldName) && options.objectName === 'cms_files' && isNode){
|
|
21825
22007
|
const previewFileScript = `
|
|
21826
22008
|
var data = event.data;
|
|
21827
22009
|
var file_name = data.versions ? data.name : "${field.label}";
|
|
@@ -21836,20 +22018,20 @@
|
|
|
21836
22018
|
"onEvent": {
|
|
21837
22019
|
"click": {
|
|
21838
22020
|
"actions": [
|
|
21839
|
-
{
|
|
21840
|
-
|
|
21841
|
-
|
|
21842
|
-
|
|
21843
|
-
|
|
21844
|
-
|
|
21845
|
-
|
|
21846
|
-
|
|
21847
|
-
|
|
21848
|
-
|
|
21849
|
-
|
|
21850
|
-
|
|
21851
|
-
|
|
21852
|
-
},
|
|
22021
|
+
// {
|
|
22022
|
+
// "args": {
|
|
22023
|
+
// "api": {
|
|
22024
|
+
// "url": "${(versions[0] && versions[0].url) ? versions[0].url+'?download=true' : context.rootUrl+'/api/files/files/'+versions[0]+'?download=true'}",
|
|
22025
|
+
// "method": "get",
|
|
22026
|
+
// "headers": {
|
|
22027
|
+
// "Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
22028
|
+
// }
|
|
22029
|
+
// }
|
|
22030
|
+
// },
|
|
22031
|
+
// "actionType": "download",
|
|
22032
|
+
// // "expression": "!!!window?.nw?.require"//浏览器上直接下载
|
|
22033
|
+
// "expression": "!!!(window && window.nw && window.nw.require)"//浏览器上直接下载
|
|
22034
|
+
// },
|
|
21853
22035
|
{
|
|
21854
22036
|
"args": {},
|
|
21855
22037
|
"actionType": "custom",
|
|
@@ -21880,7 +22062,7 @@
|
|
|
21880
22062
|
toggled: field.toggled,
|
|
21881
22063
|
static: true,
|
|
21882
22064
|
className,
|
|
21883
|
-
...getAmisFileReadonlySchema(field)
|
|
22065
|
+
...await getAmisFileReadonlySchema(field)
|
|
21884
22066
|
}, fieldAmis, {name: field.name});
|
|
21885
22067
|
}
|
|
21886
22068
|
else if(field.type === 'select'){
|
|
@@ -21947,51 +22129,7 @@
|
|
|
21947
22129
|
}
|
|
21948
22130
|
|
|
21949
22131
|
if(window.innerWidth >= 768 && ((field.is_name || field.name === options.labelFieldName) || ((field.type == 'lookup' || field.type == 'master_detail') && lodash.exports.isString(field.reference_to) && field.multiple != true)) && options.isRelated){
|
|
21950
|
-
|
|
21951
|
-
const drawerRecordDetailSchema = {
|
|
21952
|
-
"type": "steedos-record-detail",
|
|
21953
|
-
"objectApiName": "${objectName}",
|
|
21954
|
-
"recordId": `\${${options.idFieldName}}`,
|
|
21955
|
-
"showBackButton": false,
|
|
21956
|
-
"showButtons": true,
|
|
21957
|
-
"data": {
|
|
21958
|
-
"_inDrawer": true, // 用于判断是否在抽屉中
|
|
21959
|
-
"recordLoaded": false, // 重置数据加载状态
|
|
21960
|
-
}
|
|
21961
|
-
};
|
|
21962
|
-
|
|
21963
|
-
|
|
21964
|
-
if(!(field.is_name || field.name === options.labelFieldName)){
|
|
21965
|
-
drawerRecordDetailSchema.objectApiName = field.reference_to;
|
|
21966
|
-
drawerRecordDetailSchema.recordId = `\${_display.${field.name}.value}`;
|
|
21967
|
-
}
|
|
21968
|
-
|
|
21969
|
-
columnItem.onEvent = {
|
|
21970
|
-
"click": {
|
|
21971
|
-
"actions": [
|
|
21972
|
-
{
|
|
21973
|
-
"actionType": "drawer",
|
|
21974
|
-
"drawer": {
|
|
21975
|
-
"type": "drawer",
|
|
21976
|
-
"title": " ",
|
|
21977
|
-
"headerClassName": "hidden",
|
|
21978
|
-
"size": "lg",
|
|
21979
|
-
"bodyClassName": "p-0 m-0",
|
|
21980
|
-
"closeOnEsc": true,
|
|
21981
|
-
"closeOnOutside": true,
|
|
21982
|
-
"resizable": true,
|
|
21983
|
-
"actions": [],
|
|
21984
|
-
"body": [
|
|
21985
|
-
drawerRecordDetailSchema
|
|
21986
|
-
],
|
|
21987
|
-
"className": "steedos-record-detail-drawer app-popover",
|
|
21988
|
-
"id": "u:fc5f055afa8c"
|
|
21989
|
-
},
|
|
21990
|
-
"preventDefault": true
|
|
21991
|
-
}
|
|
21992
|
-
]
|
|
21993
|
-
}
|
|
21994
|
-
};
|
|
22132
|
+
columnItem.onEvent = await getColumnItemOnClick(field, options);
|
|
21995
22133
|
}
|
|
21996
22134
|
|
|
21997
22135
|
}
|
|
@@ -22204,17 +22342,23 @@
|
|
|
22204
22342
|
onEvent: {
|
|
22205
22343
|
"click": {
|
|
22206
22344
|
"actions": [
|
|
22345
|
+
// {
|
|
22346
|
+
// "args": {
|
|
22347
|
+
// "api": {
|
|
22348
|
+
// "url": url,
|
|
22349
|
+
// "method": "get",
|
|
22350
|
+
// "headers": {
|
|
22351
|
+
// "Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
22352
|
+
// }
|
|
22353
|
+
// }
|
|
22354
|
+
// },
|
|
22355
|
+
// "actionType": "download"
|
|
22356
|
+
// }
|
|
22207
22357
|
{
|
|
22358
|
+
"actionType": "link",
|
|
22208
22359
|
"args": {
|
|
22209
|
-
"
|
|
22210
|
-
|
|
22211
|
-
"method": "get",
|
|
22212
|
-
"headers": {
|
|
22213
|
-
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
22214
|
-
}
|
|
22215
|
-
}
|
|
22216
|
-
},
|
|
22217
|
-
"actionType": "download"
|
|
22360
|
+
"link": url
|
|
22361
|
+
}
|
|
22218
22362
|
}
|
|
22219
22363
|
],
|
|
22220
22364
|
"weight": 0
|
|
@@ -22710,16 +22854,6 @@
|
|
|
22710
22854
|
return {
|
|
22711
22855
|
data: formSchema
|
|
22712
22856
|
};
|
|
22713
|
-
`;
|
|
22714
|
-
const onDialogCancelScript = `
|
|
22715
|
-
// 这里加setTimeout是因为amis的Bug,它会先触发cancel事件执行此脚本关闭父窗口然后再关闭子窗口
|
|
22716
|
-
// 正确的顺序应该是先关闭子窗口再关闭父窗口,顺序错了会造成第二次点击新建按钮的时候异常
|
|
22717
|
-
setTimeout(function(){
|
|
22718
|
-
doAction({
|
|
22719
|
-
"actionType": "cancel",
|
|
22720
|
-
"componentId": "object_actions_drawer_${uiSchema.name}"
|
|
22721
|
-
});
|
|
22722
|
-
}, 200);
|
|
22723
22857
|
`;
|
|
22724
22858
|
const getSelectedRowsScript = `
|
|
22725
22859
|
const isLookup = event.data.isLookup;
|
|
@@ -22810,17 +22944,6 @@
|
|
|
22810
22944
|
"closeOnEsc": false,
|
|
22811
22945
|
"closeOnOutside": false,
|
|
22812
22946
|
"size": "lg",
|
|
22813
|
-
"onEvent": {
|
|
22814
|
-
"cancel": {
|
|
22815
|
-
"actions": [
|
|
22816
|
-
{
|
|
22817
|
-
"actionType": "custom",
|
|
22818
|
-
"script": onDialogCancelScript,
|
|
22819
|
-
"expression": "${window:innerWidth < 768}",
|
|
22820
|
-
}
|
|
22821
|
-
]
|
|
22822
|
-
}
|
|
22823
|
-
},
|
|
22824
22947
|
"actions": [
|
|
22825
22948
|
{
|
|
22826
22949
|
type: 'button',
|
|
@@ -23458,21 +23581,11 @@
|
|
|
23458
23581
|
};
|
|
23459
23582
|
}
|
|
23460
23583
|
|
|
23461
|
-
|
|
23462
|
-
/**
|
|
23463
|
-
* 列表视图顶部放大镜过滤条件栏amisSchema
|
|
23464
|
-
* @param {*} objectSchema 对象UISchema
|
|
23465
|
-
* @returns amisSchema
|
|
23466
|
-
*/
|
|
23467
|
-
async function getObjectListHeaderFieldsFilterBar(objectSchema, listViewName, ctx) {
|
|
23468
|
-
const fieldsFilterBarSchema = await getObjectFieldsFilterBarSchema(objectSchema, ctx);
|
|
23469
|
-
return fieldsFilterBarSchema;
|
|
23470
|
-
}
|
|
23471
|
-
|
|
23472
23584
|
const getNewListviewButtonSchema = ()=>{
|
|
23473
23585
|
return {
|
|
23474
23586
|
"type": "button",
|
|
23475
23587
|
"label": instance.t('frontend_listview_control_new_label'),
|
|
23588
|
+
"className": "steedos-listview-new-button",
|
|
23476
23589
|
"onEvent": {
|
|
23477
23590
|
"click": {
|
|
23478
23591
|
"weight": 0,
|
|
@@ -23679,6 +23792,17 @@
|
|
|
23679
23792
|
}
|
|
23680
23793
|
}
|
|
23681
23794
|
|
|
23795
|
+
|
|
23796
|
+
/**
|
|
23797
|
+
* 列表视图顶部放大镜过滤条件栏amisSchema
|
|
23798
|
+
* @param {*} objectSchema 对象UISchema
|
|
23799
|
+
* @returns amisSchema
|
|
23800
|
+
*/
|
|
23801
|
+
async function getObjectListHeaderFieldsFilterBar(objectSchema, listViewName, ctx) {
|
|
23802
|
+
const fieldsFilterBarSchema = await getObjectFieldsFilterBarSchema(objectSchema, ctx);
|
|
23803
|
+
return fieldsFilterBarSchema;
|
|
23804
|
+
}
|
|
23805
|
+
|
|
23682
23806
|
const getCopyListviewButtonSchema = ()=>{
|
|
23683
23807
|
return {
|
|
23684
23808
|
"type": "button",
|
|
@@ -24644,6 +24768,10 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
24644
24768
|
// const scope = event.context.scoped;
|
|
24645
24769
|
// 如果点击过顶部搜索栏表单的取消按钮,会把此处event.data.__super.__super.__super中的搜索表单项的所有字段设置为null
|
|
24646
24770
|
// 点击取消按钮后继续在表单项中输入过滤条件且最后没有点击回车按键或点击表单项搜索按钮的话,在快速搜索中点击回车按钮提交搜索会所顶部搜索表单中的字段值清空
|
|
24771
|
+
let filterForm = SteedosUI.getClosestAmisComponentByType(scope, "form");
|
|
24772
|
+
if(!filterForm){
|
|
24773
|
+
return;
|
|
24774
|
+
}
|
|
24647
24775
|
let isLookup = event.data.isLookup;
|
|
24648
24776
|
let __lookupField = event.data.__lookupField;
|
|
24649
24777
|
let __changedFilterFormValuesKey = "__changedFilterFormValues";
|
|
@@ -24654,9 +24782,8 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
24654
24782
|
}
|
|
24655
24783
|
__changedFilterFormValuesKey += lookupTag;
|
|
24656
24784
|
}
|
|
24657
|
-
let filterForm = SteedosUI.getClosestAmisComponentByType(scope, "form");
|
|
24658
24785
|
setTimeout(function(){
|
|
24659
|
-
filterForm.setValues(event.data[__changedFilterFormValuesKey]);
|
|
24786
|
+
filterForm && filterForm.setValues(event.data[__changedFilterFormValuesKey]);
|
|
24660
24787
|
}, 500);
|
|
24661
24788
|
`;
|
|
24662
24789
|
|
|
@@ -26023,7 +26150,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
26023
26150
|
}
|
|
26024
26151
|
|
|
26025
26152
|
var fieldFilters = ${JSON.stringify(field.filters)};
|
|
26026
|
-
var currentAmis = amisRequire('amis');
|
|
26153
|
+
var currentAmis = (window.amisRequire && window.amisRequire('amis')) || Amis;
|
|
26027
26154
|
//递归fieldFilters数组,检查每一个元素,判断若是公式,就仅把它解析
|
|
26028
26155
|
function traverseNestedArray(arr) {
|
|
26029
26156
|
for (let i = 0; i < arr.length; i++) {
|
|
@@ -26034,7 +26161,11 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
26034
26161
|
// 如果当前元素不是数组,则处理该元素
|
|
26035
26162
|
// 下面正则用于匹配amis公式\${}
|
|
26036
26163
|
if(/\\\$\\\{([^}]*)\\\}/.test(arr[i])) {
|
|
26037
|
-
|
|
26164
|
+
try{
|
|
26165
|
+
arr[i] = currentAmis.evaluate(arr[i], api.context);
|
|
26166
|
+
}catch(ex){
|
|
26167
|
+
console.error("运行lookup过滤公式时出现错误:",ex);
|
|
26168
|
+
}
|
|
26038
26169
|
}
|
|
26039
26170
|
}
|
|
26040
26171
|
}
|
|
@@ -26195,8 +26326,8 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
26195
26326
|
const isAllowCreate = refObjectConfig.permissions.allowCreate;
|
|
26196
26327
|
const isCreate = lodash.exports.isBoolean(field.create) ? field.create : true;
|
|
26197
26328
|
// lookup字段配置过滤条件就强制不显示新建按钮
|
|
26198
|
-
let
|
|
26199
|
-
if (isAllowCreate && isCreate && !
|
|
26329
|
+
let hasFilters = !lodash.exports.isEmpty(field.filters) || !!field.filtersFunction || !!field._filtersFunction;
|
|
26330
|
+
if (isAllowCreate && isCreate && !hasFilters) {
|
|
26200
26331
|
const new_button = await getSchema$5(refObjectConfig, { appId: ctx.appId, objectName: refObjectConfig.name, formFactor: ctx.formFactor });
|
|
26201
26332
|
new_button.align = "right";
|
|
26202
26333
|
// 保持快速搜索放在最左侧,新建按钮往里插,而不是push到最后
|
|
@@ -26440,7 +26571,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
26440
26571
|
// }
|
|
26441
26572
|
|
|
26442
26573
|
var fieldFilters = ${JSON.stringify(field.filters)};
|
|
26443
|
-
var currentAmis = amisRequire('amis');
|
|
26574
|
+
var currentAmis = (window.amisRequire && window.amisRequire('amis')) || Amis;
|
|
26444
26575
|
//递归fieldFilters数组,检查每一个元素,判断若是公式,就仅把它解析
|
|
26445
26576
|
function traverseNestedArray(arr) {
|
|
26446
26577
|
for (let i = 0; i < arr.length; i++) {
|
|
@@ -26451,7 +26582,11 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
26451
26582
|
// 如果当前元素不是数组,则处理该元素
|
|
26452
26583
|
// 下面正则用于匹配amis公式\${}
|
|
26453
26584
|
if(/\\\$\\\{([^}]*)\\\}/.test(arr[i])) {
|
|
26454
|
-
|
|
26585
|
+
try{
|
|
26586
|
+
arr[i] = currentAmis.evaluate(arr[i], api.context);
|
|
26587
|
+
}catch(ex){
|
|
26588
|
+
console.error("运行lookup过滤公式时出现错误:",ex);
|
|
26589
|
+
}
|
|
26455
26590
|
}
|
|
26456
26591
|
}
|
|
26457
26592
|
}
|
|
@@ -26859,8 +26994,8 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
26859
26994
|
/*
|
|
26860
26995
|
* @Author: baozhoutao@steedos.com
|
|
26861
26996
|
* @Date: 2023-01-13 17:27:54
|
|
26862
|
-
* @LastEditors:
|
|
26863
|
-
* @LastEditTime: 2024-
|
|
26997
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
26998
|
+
* @LastEditTime: 2024-06-07 13:39:34
|
|
26864
26999
|
* @Description:
|
|
26865
27000
|
*/
|
|
26866
27001
|
|
|
@@ -26897,6 +27032,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
26897
27032
|
"name": field.name,
|
|
26898
27033
|
"labelClassName": "none",
|
|
26899
27034
|
"language": "markdown",
|
|
27035
|
+
"options": field.amis ? field.amis.editorOptions : null
|
|
26900
27036
|
}
|
|
26901
27037
|
]
|
|
26902
27038
|
},
|
|
@@ -27446,6 +27582,21 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
27446
27582
|
type: getAmisStaticFieldType('url', readonly, field),
|
|
27447
27583
|
static: readonly ? true : false
|
|
27448
27584
|
};
|
|
27585
|
+
if(!readonly){
|
|
27586
|
+
// amis input-url控件不支持相对路径,这里支持下
|
|
27587
|
+
// 如果要使用amis原生input-url控件的默认的isUrl验证效果或自定义字段validations效果,配置字段的amis.validations属性即可,配置为null或空字符串则使用amis默认的isUrl效果
|
|
27588
|
+
let fieldAmisValidations = field.amis?.validations;
|
|
27589
|
+
if(typeof fieldAmisValidations === "undefined"){
|
|
27590
|
+
Object.assign(convertData, {
|
|
27591
|
+
"validations": {
|
|
27592
|
+
"matchRegexp": "^((http:\\/\\/|https:\\/\\/|ftp:\\/\\/|sftp:\\/\\/)+([^\\s\\/\\.]+(\\.[^\\s\\/\\.]+)+))*(\\/[^\\s\\.\\/]+)*$"
|
|
27593
|
+
},
|
|
27594
|
+
"validationErrors": {
|
|
27595
|
+
"matchRegexp": instance.t('frontend_form_validation_failed_url')//"URL 格式不正确"
|
|
27596
|
+
}
|
|
27597
|
+
});
|
|
27598
|
+
}
|
|
27599
|
+
}
|
|
27449
27600
|
if(readonly && field.show_as_qr){
|
|
27450
27601
|
convertData = {
|
|
27451
27602
|
type: "control",
|
|
@@ -27511,13 +27662,13 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
27511
27662
|
};
|
|
27512
27663
|
break;
|
|
27513
27664
|
case 'avatar':
|
|
27514
|
-
convertData = getAmisFileSchema(field, readonly);
|
|
27665
|
+
convertData = await getAmisFileSchema(field, readonly, ctx);
|
|
27515
27666
|
break;
|
|
27516
27667
|
case 'image':
|
|
27517
|
-
convertData = getAmisFileSchema(field, readonly);
|
|
27668
|
+
convertData = await getAmisFileSchema(field, readonly, ctx);
|
|
27518
27669
|
break;
|
|
27519
27670
|
case 'file':
|
|
27520
|
-
convertData = getAmisFileSchema(field, readonly);
|
|
27671
|
+
convertData = await getAmisFileSchema(field, readonly, ctx);
|
|
27521
27672
|
break;
|
|
27522
27673
|
case 'formula':
|
|
27523
27674
|
if(readonly){
|