@steedos-widgets/amis-lib 1.3.0-beta.2 → 1.3.0-beta.3
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 +31 -18
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +31 -18
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +19 -17
- package/dist/index.umd.js.map +1 -1
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -787,7 +787,7 @@ function getScriptForRemoveUrlPrefixForImgFields(fields){
|
|
|
787
787
|
if(imgFields[item].multiple){
|
|
788
788
|
if(imgFieldValue instanceof Array){
|
|
789
789
|
formData[item] = imgFieldValue.map((value)=>{
|
|
790
|
-
let itemValue = value
|
|
790
|
+
let itemValue = value && value.split('/');
|
|
791
791
|
return itemValue[itemValue.length - 1];
|
|
792
792
|
});
|
|
793
793
|
}
|
|
@@ -2258,7 +2258,7 @@ const getSchema$2 = (uiSchema) => {
|
|
|
2258
2258
|
"Bearer ${context.tenantId},${context.authToken}",
|
|
2259
2259
|
},
|
|
2260
2260
|
requestAdaptor:
|
|
2261
|
-
"\n const selfData = JSON.parse(JSON.stringify(api.data.$self));\n var filters = [];\n var pageSize = api.data.pageSize || 10;\n var pageNo = api.data.pageNo || 1;\n var skip = (pageNo - 1) * pageSize;\n var orderBy = api.data.orderBy || '';\n var orderDir = api.data.orderDir || '';\n var sort = orderBy + ' ' + orderDir;\n var allowSearchFields = [\"description\"];\n if(api.data.$term){\n filters = [[\"name\", \"contains\", \"'+ api.data.$term +'\"]];\n }else if(selfData.op === 'loadOptions' && selfData.value){\n if(selfData.value
|
|
2261
|
+
"\n const selfData = JSON.parse(JSON.stringify(api.data.$self));\n var filters = [];\n var pageSize = api.data.pageSize || 10;\n var pageNo = api.data.pageNo || 1;\n var skip = (pageNo - 1) * pageSize;\n var orderBy = api.data.orderBy || '';\n var orderDir = api.data.orderDir || '';\n var sort = orderBy + ' ' + orderDir;\n var allowSearchFields = [\"description\"];\n if(api.data.$term){\n filters = [[\"name\", \"contains\", \"'+ api.data.$term +'\"]];\n }else if(selfData.op === 'loadOptions' && selfData.value){\n if(selfData.value && selfData.value.indexOf(',') > 0){\n filters = [[\"_id\", \"=\", selfData.value.split(',')]];\n }else{\n filters = [[\"_id\", \"=\", selfData.value]];\n }\n }\n if(allowSearchFields){\n allowSearchFields.forEach(function(key){\n const keyValue = selfData[key];\n if(keyValue){\n filters.push([key, \"contains\", keyValue]);\n }\n })\n }\n\n const filtersFunction = function(filters, values){return ['object_name', '=', values.object_name]};\n\n if(filtersFunction){\n const _filters = filtersFunction(filters, api.data.$self.__super.__super);\n if(_filters && _filters.length > 0){\n filters.push(_filters);\n }\n }\n\n api.data.query = api.data.query.replace(/{__filters}/g, JSON.stringify(filters)).replace('{__top}', pageSize).replace('{__skip}', skip).replace('{__sort}', sort.trim());\n return api;\n ",
|
|
2262
2262
|
adaptor:
|
|
2263
2263
|
"\n const enable_tree = undefined;\n if(enable_tree){\n const records = payload.data.rows;\n const treeRecords = [];\n const getChildren = (records, childrenIds)=>{\n if(!childrenIds){\n return;\n }\n const children = _.filter(records, (record)=>{\n return _.includes(childrenIds, record._id)\n });\n _.each(children, (item)=>{\n if(item.children){\n item.children = getChildren(records, item.children)\n }\n })\n return children;\n }\n\n _.each(records, (record)=>{\n if(!record.parent){\n treeRecords.push(Object.assign({}, record, {children: getChildren(records, record.children)}));\n }\n });\n payload.data.rows = treeRecords;\n }\n return payload;\n ",
|
|
2264
2264
|
},
|
|
@@ -3640,7 +3640,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
3640
3640
|
const selfData = api.body.$self;
|
|
3641
3641
|
const uiSchema = selfData.uiSchema;
|
|
3642
3642
|
const fields = uiSchema.fields;
|
|
3643
|
-
const options = (payload.data
|
|
3643
|
+
const options = ((payload.data && payload.data.options) || []).filter(function(item){
|
|
3644
3644
|
let field = fields[item.value];
|
|
3645
3645
|
// TODO: 暂时禁用location类型字段的列表搜索
|
|
3646
3646
|
return !!field && window.isFieldTypeSearchable(field.type) && field.type !== 'location'
|
|
@@ -4919,10 +4919,10 @@ function apiRequestAdaptor$1(){
|
|
|
4919
4919
|
const recordId_tmp = api.body.recordId;
|
|
4920
4920
|
|
|
4921
4921
|
if (typeof formData_tmp.columns == 'string') {
|
|
4922
|
-
formData_tmp.columns = formData_tmp.columns
|
|
4922
|
+
formData_tmp.columns = formData_tmp.columns && formData_tmp.columns.split(',');
|
|
4923
4923
|
}
|
|
4924
4924
|
if (typeof formData_tmp.mobile_columns == 'string') {
|
|
4925
|
-
formData_tmp.mobile_columns = formData_tmp.mobile_columns
|
|
4925
|
+
formData_tmp.mobile_columns = formData_tmp.mobile_columns && formData_tmp.mobile_columns.split(',');
|
|
4926
4926
|
}
|
|
4927
4927
|
|
|
4928
4928
|
// 数据格式转换
|
|
@@ -5055,7 +5055,7 @@ function apiRequestAdaptor(){
|
|
|
5055
5055
|
const recordId = api.body.recordId;
|
|
5056
5056
|
//数据格式转换
|
|
5057
5057
|
if (typeof formData.sort == 'string') {
|
|
5058
|
-
formData.sort = formData.sort
|
|
5058
|
+
formData.sort = formData.sort && formData.sort.split(',');
|
|
5059
5059
|
}
|
|
5060
5060
|
formData.sort = lodash.map(formData.sort, (item) => {
|
|
5061
5061
|
const arr = item.split(':');
|
|
@@ -5895,7 +5895,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
5895
5895
|
if(api.data.$term){
|
|
5896
5896
|
filters = [["name", "contains", "'+ api.data.$term +'"]];
|
|
5897
5897
|
}else if(selfData.op === 'loadOptions' && selfData.value){
|
|
5898
|
-
if(selfData.value
|
|
5898
|
+
if(selfData.value && selfData.value.indexOf(',') > 0){
|
|
5899
5899
|
fieldValue = selfData.value.split(',');
|
|
5900
5900
|
filters = [["${referenceTo.valueField.name}", "=", fieldValue]];
|
|
5901
5901
|
}else{
|
|
@@ -6090,7 +6090,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
6090
6090
|
{
|
|
6091
6091
|
"actionType": "custom",
|
|
6092
6092
|
"script": `
|
|
6093
|
-
const masterRecord = event.data._master
|
|
6093
|
+
const masterRecord = event.data._master && event.data._master.record;
|
|
6094
6094
|
const fieldConfig = ${JSON.stringify(field)};
|
|
6095
6095
|
let reference_to = fieldConfig.reference_to;
|
|
6096
6096
|
let saveValue;
|
|
@@ -6473,7 +6473,7 @@ async function getIdsPickerSchema(field, readonly, ctx){
|
|
|
6473
6473
|
var pageNo = api.data.pageNo || 1;
|
|
6474
6474
|
var skip = (pageNo - 1) * pageSize;
|
|
6475
6475
|
if(selfData.op === 'loadOptions' && selfData.value){
|
|
6476
|
-
if(selfData.value
|
|
6476
|
+
if(selfData.value && selfData.value.indexOf(',') > 0){
|
|
6477
6477
|
filters = [["${referenceTo.valueField.name}", "=", selfData.value.split(',')]];
|
|
6478
6478
|
}else{
|
|
6479
6479
|
filters = [["${referenceTo.valueField.name}", "=", selfData.value]];
|
|
@@ -7712,7 +7712,7 @@ async function getQuickEditSchema(field, options){
|
|
|
7712
7712
|
case "number":
|
|
7713
7713
|
case "currency":
|
|
7714
7714
|
TempDisplayField = `
|
|
7715
|
-
_display["${field.name}"] = event.data.value
|
|
7715
|
+
_display["${field.name}"] = event.data.value && event.data.value.toFixed(${field.scale});
|
|
7716
7716
|
`;
|
|
7717
7717
|
quickEditSchema.body[0].onEvent["change"] = quickEditOnEvent(TempDisplayField);
|
|
7718
7718
|
|
|
@@ -7900,13 +7900,15 @@ async function getTableColumns(fields, options){
|
|
|
7900
7900
|
}
|
|
7901
7901
|
},
|
|
7902
7902
|
"actionType": "download",
|
|
7903
|
-
"expression": "!!!window?.nw?.require"//浏览器上直接下载
|
|
7903
|
+
// "expression": "!!!window?.nw?.require"//浏览器上直接下载
|
|
7904
|
+
"expression": "!!!(window && window.nw && window.nw.require)"//浏览器上直接下载
|
|
7904
7905
|
},
|
|
7905
7906
|
{
|
|
7906
7907
|
"args": {},
|
|
7907
7908
|
"actionType": "custom",
|
|
7908
7909
|
"script": previewFileScript,
|
|
7909
|
-
|
|
7910
|
+
// "expression": "!!window?.nw?.require" //PC客户端预览附件
|
|
7911
|
+
"expression": "!!!(window && window.nw && window.nw.require)"//PC客户端预览附件
|
|
7910
7912
|
}
|
|
7911
7913
|
]
|
|
7912
7914
|
}
|
|
@@ -8641,7 +8643,13 @@ async function getTableApi(mainObject, fields, options){
|
|
|
8641
8643
|
const setDataToComponentId = "${setDataToComponentId}";
|
|
8642
8644
|
if(setDataToComponentId){
|
|
8643
8645
|
//https://github.com/baidu/amis/pull/6807 .parent的改动是为适应3.2getComponentById的规则改动,不影响2.9
|
|
8644
|
-
SteedosUI.getRef(api.body.$self.$scopeId)
|
|
8646
|
+
var scope = SteedosUI.getRef(api.body.$self.$scopeId);
|
|
8647
|
+
var scopeParent = scope && scope.parent;
|
|
8648
|
+
var setDataToComponent = scopeParent && scopeParent.getComponentById(setDataToComponentId);
|
|
8649
|
+
if(setDataToComponent){
|
|
8650
|
+
setDataToComponent.setData({$count: payload.data.count});
|
|
8651
|
+
}
|
|
8652
|
+
// SteedosUI.getRef(api.body.$self.$scopeId)?.parent?.getComponentById(setDataToComponentId)?.setData({$count: payload.data.count})
|
|
8645
8653
|
};
|
|
8646
8654
|
${options.adaptor || ''}
|
|
8647
8655
|
return payload;
|
|
@@ -8927,7 +8935,7 @@ async function getEditFormInitApi(object, recordId, fields, options){
|
|
|
8927
8935
|
var uiSchema = api.body.uiSchema;
|
|
8928
8936
|
var defaultData = api.body.defaultData;
|
|
8929
8937
|
var defaultValues = {};
|
|
8930
|
-
_.each(uiSchema
|
|
8938
|
+
_.each(uiSchema && uiSchema.fields, function(field){
|
|
8931
8939
|
var value = SteedosUI.getFieldDefaultValue(field, api.body.global);
|
|
8932
8940
|
if(value){
|
|
8933
8941
|
defaultValues[field.name] = value;
|
|
@@ -9146,7 +9154,12 @@ async function getCalendarApi(mainObject, fields, options) {
|
|
|
9146
9154
|
window.postMessage(Object.assign({type: "listview.loaded"}), "*");
|
|
9147
9155
|
const setDataToComponentId = "${setDataToComponentId}";
|
|
9148
9156
|
if(setDataToComponentId){
|
|
9149
|
-
SteedosUI.getRef(api.body.$self.scopeId)
|
|
9157
|
+
var scope = SteedosUI.getRef(api.body.$self.scopeId);
|
|
9158
|
+
var setDataToComponent = scope && scope.getComponentById(setDataToComponentId);
|
|
9159
|
+
if(setDataToComponent){
|
|
9160
|
+
setDataToComponent.setData({$count: payload.data.count});
|
|
9161
|
+
}
|
|
9162
|
+
// SteedosUI.getRef(api.body.$self.scopeId)?.getComponentById(setDataToComponentId)?.setData({$count: payload.data.count})
|
|
9150
9163
|
}
|
|
9151
9164
|
const rows = payload.data.rows || [];
|
|
9152
9165
|
const selfData = api.data.$self;
|
|
@@ -12254,7 +12267,7 @@ const getNextStepUsersInput = async (instance) => {
|
|
|
12254
12267
|
id: "u:ffff15b76c89",
|
|
12255
12268
|
className: "b-a b-1x p-xs m-b-none m-l-none m-r-none m-t-sm",
|
|
12256
12269
|
subFormMode: "",
|
|
12257
|
-
hiddenOn: "!!!this.new_next_step || this.new_next_step
|
|
12270
|
+
hiddenOn: "!!!this.new_next_step || (this.new_next_step && this.new_next_step.step_type === 'end')"
|
|
12258
12271
|
};
|
|
12259
12272
|
};
|
|
12260
12273
|
|
|
@@ -13174,7 +13187,7 @@ const getFieldReadonlyTpl = async (field, label)=>{
|
|
|
13174
13187
|
map[item.value] = item.label;
|
|
13175
13188
|
});
|
|
13176
13189
|
tpl.type = 'static';
|
|
13177
|
-
tpl.tpl = `<% var options = ${JSON.stringify(map)}; return options
|
|
13190
|
+
tpl.tpl = `<% var options = ${JSON.stringify(map)}; return (options && options[data.${field.code}]) || ''%>`;
|
|
13178
13191
|
}else if(field.type === 'odata'){
|
|
13179
13192
|
tpl.type = 'static';
|
|
13180
13193
|
tpl.tpl = `<div>\${${field.code}['@label']}</div>`;
|
|
@@ -13204,7 +13217,7 @@ const getFieldReadonlyTpl = async (field, label)=>{
|
|
|
13204
13217
|
if(field.is_multiselect){
|
|
13205
13218
|
tpl.tpl = `\${_.map(${field.code}, 'name')}`;
|
|
13206
13219
|
}else {
|
|
13207
|
-
tpl.tpl = `\${${field.code}
|
|
13220
|
+
tpl.tpl = `\${${field.code} && ${field.code}.name}`;
|
|
13208
13221
|
}
|
|
13209
13222
|
}else if(field.type === 'group'){
|
|
13210
13223
|
tpl.type = 'static';
|