@steedos-widgets/amis-lib 3.6.2-beta.13 → 3.6.2-beta.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 +87 -37
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +87 -37
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +23 -14
- package/dist/index.umd.js.map +1 -1
- package/dist/types/lib/converter/amis/util.d.ts +5 -0
- package/package.json +2 -2
package/dist/index.cjs.js
CHANGED
|
@@ -416,8 +416,8 @@ const Router = {
|
|
|
416
416
|
/*
|
|
417
417
|
* @Author: baozhoutao@steedos.com
|
|
418
418
|
* @Date: 2022-07-20 16:29:22
|
|
419
|
-
* @LastEditors:
|
|
420
|
-
* @LastEditTime:
|
|
419
|
+
* @LastEditors: liaodaxue
|
|
420
|
+
* @LastEditTime: 2024-01-25 14:44:17
|
|
421
421
|
* @Description:
|
|
422
422
|
*/
|
|
423
423
|
|
|
@@ -489,6 +489,25 @@ function getComparableAmisVersion() {
|
|
|
489
489
|
}
|
|
490
490
|
}
|
|
491
491
|
|
|
492
|
+
/**
|
|
493
|
+
* 判断浏览器类型
|
|
494
|
+
* @returns 按需返回浏览器类型;
|
|
495
|
+
*/
|
|
496
|
+
function getBowserType() {
|
|
497
|
+
const userAgent = navigator.userAgent;
|
|
498
|
+
if (userAgent.indexOf("Chrome")!== -1 && userAgent.indexOf("Safari") !== -1 && userAgent.indexOf("Edg") === -1) {
|
|
499
|
+
return "Chrome";
|
|
500
|
+
} else if (userAgent.indexOf("Firefox") !== -1) {
|
|
501
|
+
return "Firefox";
|
|
502
|
+
} else if (userAgent.indexOf("Safari") !== -1 && userAgent.indexOf("Chrome") === -1 && userAgent.indexOf("Edge") === -1) {
|
|
503
|
+
return "Safari";
|
|
504
|
+
} else if (userAgent.indexOf("Edg") !== -1) {
|
|
505
|
+
return "Edge";
|
|
506
|
+
} else {
|
|
507
|
+
return "Unknown browser"; // 其他浏览器...(可根据自己需要确定是否新增其他浏览器的判断)
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
|
|
492
511
|
/*
|
|
493
512
|
* @Author: baozhoutao@steedos.com
|
|
494
513
|
* @Date: 2022-05-23 09:53:08
|
|
@@ -1892,7 +1911,8 @@ async function getQuickEditSchema(field, options){
|
|
|
1892
1911
|
"failed": "失败了呢。。"
|
|
1893
1912
|
}
|
|
1894
1913
|
}
|
|
1895
|
-
}
|
|
1914
|
+
},
|
|
1915
|
+
"expression": "${!recordPermissions.modifyAllRecords}"
|
|
1896
1916
|
},
|
|
1897
1917
|
{
|
|
1898
1918
|
"actionType": "setValue",
|
|
@@ -1908,7 +1928,7 @@ async function getQuickEditSchema(field, options){
|
|
|
1908
1928
|
"componentId": quickEditId,
|
|
1909
1929
|
"args": {
|
|
1910
1930
|
"value":{
|
|
1911
|
-
"quickedit_record_permissions": "${event.data}"
|
|
1931
|
+
"quickedit_record_permissions": "${recordPermissions.modifyAllRecords ? {'allowEdit': true} : event.data}"
|
|
1912
1932
|
}
|
|
1913
1933
|
}
|
|
1914
1934
|
}
|
|
@@ -1972,7 +1992,7 @@ async function getQuickEditSchema(field, options){
|
|
|
1972
1992
|
`
|
|
1973
1993
|
}
|
|
1974
1994
|
},
|
|
1975
|
-
"expression":"${event.data.value}"
|
|
1995
|
+
"expression":"${event.data.value && !recordPermissions.modifyAllRecords}"
|
|
1976
1996
|
},
|
|
1977
1997
|
{
|
|
1978
1998
|
"actionType": "setValue",
|
|
@@ -2003,10 +2023,20 @@ async function getQuickEditSchema(field, options){
|
|
|
2003
2023
|
"script": `
|
|
2004
2024
|
const noPermission = event.data.noPermission;
|
|
2005
2025
|
const crudComponent = event.context.scoped.getComponentById("${options.crudId}");
|
|
2006
|
-
|
|
2026
|
+
let selectedItems = crudComponent && crudComponent.props.store.selectedItems.concat();
|
|
2007
2027
|
noPermission.forEach(function (item) {
|
|
2008
2028
|
crudComponent && crudComponent.unSelectItem(_.find(selectedItems,{_id:item}));
|
|
2029
|
+
_.remove(selectedItems, (selected) => selected._id === item);
|
|
2009
2030
|
})
|
|
2031
|
+
doAction({
|
|
2032
|
+
"componentId": "${quickEditId}",
|
|
2033
|
+
"actionType": "setValue",
|
|
2034
|
+
"args": {
|
|
2035
|
+
"value": {
|
|
2036
|
+
selectedItems
|
|
2037
|
+
}
|
|
2038
|
+
}
|
|
2039
|
+
});
|
|
2010
2040
|
`
|
|
2011
2041
|
},
|
|
2012
2042
|
{
|
|
@@ -2097,7 +2127,8 @@ async function getTableColumns(fields, options){
|
|
|
2097
2127
|
//增加quickEdit属性,实现快速编辑
|
|
2098
2128
|
const quickEditSchema = allowEdit ? await getQuickEditSchema(field, options) : allowEdit;
|
|
2099
2129
|
let className = "";
|
|
2100
|
-
|
|
2130
|
+
const bowserType = getBowserType();
|
|
2131
|
+
if(bowserType === "Safari"){
|
|
2101
2132
|
className += " whitespace-nowrap ";
|
|
2102
2133
|
}else {
|
|
2103
2134
|
if(field.wrap != true){
|
|
@@ -2106,6 +2137,18 @@ async function getTableColumns(fields, options){
|
|
|
2106
2137
|
className += " break-words ";
|
|
2107
2138
|
}
|
|
2108
2139
|
}
|
|
2140
|
+
|
|
2141
|
+
if (typeof field.amis?.className == "object") {
|
|
2142
|
+
className = {
|
|
2143
|
+
[className]: "true",
|
|
2144
|
+
...field.amis.className
|
|
2145
|
+
};
|
|
2146
|
+
} else if (typeof field.amis?.className == "string") {
|
|
2147
|
+
className = `${className} ${field.amis.className} `;
|
|
2148
|
+
}
|
|
2149
|
+
let fieldAmis = ___namespace.clone(field.amis);
|
|
2150
|
+
delete fieldAmis?.className;
|
|
2151
|
+
|
|
2109
2152
|
let columnItem;
|
|
2110
2153
|
if((field.is_name || field.name === options.labelFieldName) && options.objectName === 'cms_files'){
|
|
2111
2154
|
const previewFileScript = `
|
|
@@ -2156,7 +2199,7 @@ async function getTableColumns(fields, options){
|
|
|
2156
2199
|
toggled: field.toggled,
|
|
2157
2200
|
static: true,
|
|
2158
2201
|
className,
|
|
2159
|
-
},
|
|
2202
|
+
}, fieldAmis, {name: field.name});
|
|
2160
2203
|
}else if(field.type === 'avatar' || field.type === 'image' || field.type === 'file'){
|
|
2161
2204
|
columnItem = Object.assign({}, {
|
|
2162
2205
|
type: "switch",
|
|
@@ -2167,7 +2210,7 @@ async function getTableColumns(fields, options){
|
|
|
2167
2210
|
static: true,
|
|
2168
2211
|
className,
|
|
2169
2212
|
...getAmisFileReadonlySchema(field)
|
|
2170
|
-
},
|
|
2213
|
+
}, fieldAmis, {name: field.name});
|
|
2171
2214
|
}
|
|
2172
2215
|
else if(field.type === 'select'){
|
|
2173
2216
|
const map = getSelectMap(field.options);
|
|
@@ -2182,7 +2225,7 @@ async function getTableColumns(fields, options){
|
|
|
2182
2225
|
className,
|
|
2183
2226
|
inputClassName: "inline",
|
|
2184
2227
|
static: true,
|
|
2185
|
-
},
|
|
2228
|
+
}, fieldAmis, {name: field.name});
|
|
2186
2229
|
}
|
|
2187
2230
|
else {
|
|
2188
2231
|
const tpl = await getFieldTpl(field, options);
|
|
@@ -2209,15 +2252,6 @@ async function getTableColumns(fields, options){
|
|
|
2209
2252
|
// }
|
|
2210
2253
|
|
|
2211
2254
|
//field上的amis属性里的clssname需要单独判断类型合并
|
|
2212
|
-
if (typeof field.amis?.className == "object") {
|
|
2213
|
-
className = {
|
|
2214
|
-
[className]: "true",
|
|
2215
|
-
...field.amis.className
|
|
2216
|
-
};
|
|
2217
|
-
} else if (typeof field.amis?.className == "string") {
|
|
2218
|
-
className = `${className} ${field.amis.className} `;
|
|
2219
|
-
}
|
|
2220
|
-
delete field.amis?.className;
|
|
2221
2255
|
|
|
2222
2256
|
if(!field.hidden && !field.extra){
|
|
2223
2257
|
columnItem = Object.assign({}, {
|
|
@@ -2234,7 +2268,7 @@ async function getTableColumns(fields, options){
|
|
|
2234
2268
|
static: true,
|
|
2235
2269
|
options: field.type === 'html' ? {html: true} : null
|
|
2236
2270
|
// toggled: true
|
|
2237
|
-
},
|
|
2271
|
+
}, fieldAmis, {name: field.name});
|
|
2238
2272
|
|
|
2239
2273
|
if(field.type === 'color'){
|
|
2240
2274
|
columnItem.type = 'color';
|
|
@@ -8638,14 +8672,7 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
8638
8672
|
headers: {
|
|
8639
8673
|
Authorization: "Bearer ${context.tenantId},${context.authToken}",
|
|
8640
8674
|
},
|
|
8641
|
-
requestAdaptor: quickSaveApiRequestAdaptor
|
|
8642
|
-
adaptor: `
|
|
8643
|
-
if(payload.errors){
|
|
8644
|
-
payload.status = 2;
|
|
8645
|
-
payload.msg = window.t ? window.t(payload.errors[0].message) : payload.errors[0].message;
|
|
8646
|
-
}
|
|
8647
|
-
return payload;
|
|
8648
|
-
`
|
|
8675
|
+
requestAdaptor: quickSaveApiRequestAdaptor
|
|
8649
8676
|
},
|
|
8650
8677
|
// 外层data发生变化的时候, 不会重新渲染rowClassNameExpr, 所以先用css标记tr唯一标识
|
|
8651
8678
|
// 使用表达式给tr添加初始选中状态
|
|
@@ -8662,6 +8689,21 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
8662
8689
|
crudModeClassName = `steedos-crud-mode-${body.mode}`;
|
|
8663
8690
|
}
|
|
8664
8691
|
|
|
8692
|
+
body.quickSaveApi.adaptor = `
|
|
8693
|
+
if(payload.errors){
|
|
8694
|
+
payload.status = 2;
|
|
8695
|
+
payload.msg = window.t ? window.t(payload.errors[0].message) : payload.errors[0].message;
|
|
8696
|
+
}
|
|
8697
|
+
debugger;
|
|
8698
|
+
var scope = SteedosUI.getRef(context.scopeId);
|
|
8699
|
+
var scopeParent = scope && scope.parent;
|
|
8700
|
+
var crudScoped = scopeParent.getComponentById('${body.id}');
|
|
8701
|
+
setTimeout(()=>{
|
|
8702
|
+
crudScoped && crudScoped.control.updateAutoFillHeight();
|
|
8703
|
+
}, 500);
|
|
8704
|
+
return payload;
|
|
8705
|
+
`;
|
|
8706
|
+
|
|
8665
8707
|
if(body.columns && options.formFactor != 'SMALL'){
|
|
8666
8708
|
//将_display放入crud的columns的倒数第二列中(最后一列会影响固定列),可以通过setvalue修改行内数据域的_display,而不影响上层items的_display,用于批量编辑
|
|
8667
8709
|
body.columns.splice(body.columns.length -1 , 0, {name: '_display',type: 'static', width: 1, placeholder: "",id: objectSchema.name + "_display_${_index}", tpl: "${''}"});
|
|
@@ -12983,7 +13025,7 @@ function uuidv4() {
|
|
|
12983
13025
|
* @Author: 殷亮辉 yinlianghui@hotoa.com
|
|
12984
13026
|
* @Date: 2023-11-15 09:50:22
|
|
12985
13027
|
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
12986
|
-
* @LastEditTime: 2024-01-
|
|
13028
|
+
* @LastEditTime: 2024-01-25 14:11:50
|
|
12987
13029
|
*/
|
|
12988
13030
|
|
|
12989
13031
|
function getTablePrimaryKey(props) {
|
|
@@ -13135,16 +13177,20 @@ function getInputTableCell(field, showAsInlineEditMode) {
|
|
|
13135
13177
|
}
|
|
13136
13178
|
}
|
|
13137
13179
|
else {
|
|
13180
|
+
// 这里加一层service是因为amis 3.6/6.0中有bug,不加的话,这里会显示为父作用域中中的同名变量值,见:https://github.com/baidu/amis/issues/9520
|
|
13138
13181
|
return {
|
|
13139
|
-
"type": "
|
|
13140
|
-
"config": Object.assign({}, field, {
|
|
13141
|
-
label: false
|
|
13142
|
-
}),
|
|
13143
|
-
inInputTable: true,
|
|
13144
|
-
"static": true,
|
|
13145
|
-
"readonly": true,
|
|
13182
|
+
"type": "service",
|
|
13146
13183
|
label: field.label,
|
|
13147
|
-
name: field.name
|
|
13184
|
+
name: field.name,
|
|
13185
|
+
"body":[{
|
|
13186
|
+
"type": "steedos-field",
|
|
13187
|
+
"config": Object.assign({}, field, {
|
|
13188
|
+
label: false
|
|
13189
|
+
}),
|
|
13190
|
+
inInputTable: true,
|
|
13191
|
+
"static": true,
|
|
13192
|
+
"readonly": true
|
|
13193
|
+
}]
|
|
13148
13194
|
}
|
|
13149
13195
|
}
|
|
13150
13196
|
}
|
|
@@ -14268,6 +14314,10 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
14268
14314
|
"width": buttonsForColumnOperations.length > 1 ? "60px" : "20px"
|
|
14269
14315
|
});
|
|
14270
14316
|
}
|
|
14317
|
+
// if (showAsInlineEditMode) {
|
|
14318
|
+
// // 因为要支持不同的列上配置inlineEditMode属性,所有不可以把整个子表组件都设置为inlineEditMode
|
|
14319
|
+
// inputTableSchema.needConfirm = false;
|
|
14320
|
+
// }
|
|
14271
14321
|
if (amis) {
|
|
14272
14322
|
// 支持配置amis属性重写或添加最终生成的input-table中任何属性。
|
|
14273
14323
|
delete amis.id;//如果steedos-input-table组件配置了amis.id属性,会造成新建编辑行功能不生效
|