@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.esm.js
CHANGED
|
@@ -389,8 +389,8 @@ const Router = {
|
|
|
389
389
|
/*
|
|
390
390
|
* @Author: baozhoutao@steedos.com
|
|
391
391
|
* @Date: 2022-07-20 16:29:22
|
|
392
|
-
* @LastEditors:
|
|
393
|
-
* @LastEditTime:
|
|
392
|
+
* @LastEditors: liaodaxue
|
|
393
|
+
* @LastEditTime: 2024-01-25 14:44:17
|
|
394
394
|
* @Description:
|
|
395
395
|
*/
|
|
396
396
|
|
|
@@ -462,6 +462,25 @@ function getComparableAmisVersion() {
|
|
|
462
462
|
}
|
|
463
463
|
}
|
|
464
464
|
|
|
465
|
+
/**
|
|
466
|
+
* 判断浏览器类型
|
|
467
|
+
* @returns 按需返回浏览器类型;
|
|
468
|
+
*/
|
|
469
|
+
function getBowserType() {
|
|
470
|
+
const userAgent = navigator.userAgent;
|
|
471
|
+
if (userAgent.indexOf("Chrome")!== -1 && userAgent.indexOf("Safari") !== -1 && userAgent.indexOf("Edg") === -1) {
|
|
472
|
+
return "Chrome";
|
|
473
|
+
} else if (userAgent.indexOf("Firefox") !== -1) {
|
|
474
|
+
return "Firefox";
|
|
475
|
+
} else if (userAgent.indexOf("Safari") !== -1 && userAgent.indexOf("Chrome") === -1 && userAgent.indexOf("Edge") === -1) {
|
|
476
|
+
return "Safari";
|
|
477
|
+
} else if (userAgent.indexOf("Edg") !== -1) {
|
|
478
|
+
return "Edge";
|
|
479
|
+
} else {
|
|
480
|
+
return "Unknown browser"; // 其他浏览器...(可根据自己需要确定是否新增其他浏览器的判断)
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
|
|
465
484
|
/*
|
|
466
485
|
* @Author: baozhoutao@steedos.com
|
|
467
486
|
* @Date: 2022-05-23 09:53:08
|
|
@@ -1865,7 +1884,8 @@ async function getQuickEditSchema(field, options){
|
|
|
1865
1884
|
"failed": "失败了呢。。"
|
|
1866
1885
|
}
|
|
1867
1886
|
}
|
|
1868
|
-
}
|
|
1887
|
+
},
|
|
1888
|
+
"expression": "${!recordPermissions.modifyAllRecords}"
|
|
1869
1889
|
},
|
|
1870
1890
|
{
|
|
1871
1891
|
"actionType": "setValue",
|
|
@@ -1881,7 +1901,7 @@ async function getQuickEditSchema(field, options){
|
|
|
1881
1901
|
"componentId": quickEditId,
|
|
1882
1902
|
"args": {
|
|
1883
1903
|
"value":{
|
|
1884
|
-
"quickedit_record_permissions": "${event.data}"
|
|
1904
|
+
"quickedit_record_permissions": "${recordPermissions.modifyAllRecords ? {'allowEdit': true} : event.data}"
|
|
1885
1905
|
}
|
|
1886
1906
|
}
|
|
1887
1907
|
}
|
|
@@ -1945,7 +1965,7 @@ async function getQuickEditSchema(field, options){
|
|
|
1945
1965
|
`
|
|
1946
1966
|
}
|
|
1947
1967
|
},
|
|
1948
|
-
"expression":"${event.data.value}"
|
|
1968
|
+
"expression":"${event.data.value && !recordPermissions.modifyAllRecords}"
|
|
1949
1969
|
},
|
|
1950
1970
|
{
|
|
1951
1971
|
"actionType": "setValue",
|
|
@@ -1976,10 +1996,20 @@ async function getQuickEditSchema(field, options){
|
|
|
1976
1996
|
"script": `
|
|
1977
1997
|
const noPermission = event.data.noPermission;
|
|
1978
1998
|
const crudComponent = event.context.scoped.getComponentById("${options.crudId}");
|
|
1979
|
-
|
|
1999
|
+
let selectedItems = crudComponent && crudComponent.props.store.selectedItems.concat();
|
|
1980
2000
|
noPermission.forEach(function (item) {
|
|
1981
2001
|
crudComponent && crudComponent.unSelectItem(_.find(selectedItems,{_id:item}));
|
|
2002
|
+
_.remove(selectedItems, (selected) => selected._id === item);
|
|
1982
2003
|
})
|
|
2004
|
+
doAction({
|
|
2005
|
+
"componentId": "${quickEditId}",
|
|
2006
|
+
"actionType": "setValue",
|
|
2007
|
+
"args": {
|
|
2008
|
+
"value": {
|
|
2009
|
+
selectedItems
|
|
2010
|
+
}
|
|
2011
|
+
}
|
|
2012
|
+
});
|
|
1983
2013
|
`
|
|
1984
2014
|
},
|
|
1985
2015
|
{
|
|
@@ -2070,7 +2100,8 @@ async function getTableColumns(fields, options){
|
|
|
2070
2100
|
//增加quickEdit属性,实现快速编辑
|
|
2071
2101
|
const quickEditSchema = allowEdit ? await getQuickEditSchema(field, options) : allowEdit;
|
|
2072
2102
|
let className = "";
|
|
2073
|
-
|
|
2103
|
+
const bowserType = getBowserType();
|
|
2104
|
+
if(bowserType === "Safari"){
|
|
2074
2105
|
className += " whitespace-nowrap ";
|
|
2075
2106
|
}else {
|
|
2076
2107
|
if(field.wrap != true){
|
|
@@ -2079,6 +2110,18 @@ async function getTableColumns(fields, options){
|
|
|
2079
2110
|
className += " break-words ";
|
|
2080
2111
|
}
|
|
2081
2112
|
}
|
|
2113
|
+
|
|
2114
|
+
if (typeof field.amis?.className == "object") {
|
|
2115
|
+
className = {
|
|
2116
|
+
[className]: "true",
|
|
2117
|
+
...field.amis.className
|
|
2118
|
+
};
|
|
2119
|
+
} else if (typeof field.amis?.className == "string") {
|
|
2120
|
+
className = `${className} ${field.amis.className} `;
|
|
2121
|
+
}
|
|
2122
|
+
let fieldAmis = _$1.clone(field.amis);
|
|
2123
|
+
delete fieldAmis?.className;
|
|
2124
|
+
|
|
2082
2125
|
let columnItem;
|
|
2083
2126
|
if((field.is_name || field.name === options.labelFieldName) && options.objectName === 'cms_files'){
|
|
2084
2127
|
const previewFileScript = `
|
|
@@ -2129,7 +2172,7 @@ async function getTableColumns(fields, options){
|
|
|
2129
2172
|
toggled: field.toggled,
|
|
2130
2173
|
static: true,
|
|
2131
2174
|
className,
|
|
2132
|
-
},
|
|
2175
|
+
}, fieldAmis, {name: field.name});
|
|
2133
2176
|
}else if(field.type === 'avatar' || field.type === 'image' || field.type === 'file'){
|
|
2134
2177
|
columnItem = Object.assign({}, {
|
|
2135
2178
|
type: "switch",
|
|
@@ -2140,7 +2183,7 @@ async function getTableColumns(fields, options){
|
|
|
2140
2183
|
static: true,
|
|
2141
2184
|
className,
|
|
2142
2185
|
...getAmisFileReadonlySchema(field)
|
|
2143
|
-
},
|
|
2186
|
+
}, fieldAmis, {name: field.name});
|
|
2144
2187
|
}
|
|
2145
2188
|
else if(field.type === 'select'){
|
|
2146
2189
|
const map = getSelectMap(field.options);
|
|
@@ -2155,7 +2198,7 @@ async function getTableColumns(fields, options){
|
|
|
2155
2198
|
className,
|
|
2156
2199
|
inputClassName: "inline",
|
|
2157
2200
|
static: true,
|
|
2158
|
-
},
|
|
2201
|
+
}, fieldAmis, {name: field.name});
|
|
2159
2202
|
}
|
|
2160
2203
|
else {
|
|
2161
2204
|
const tpl = await getFieldTpl(field, options);
|
|
@@ -2182,15 +2225,6 @@ async function getTableColumns(fields, options){
|
|
|
2182
2225
|
// }
|
|
2183
2226
|
|
|
2184
2227
|
//field上的amis属性里的clssname需要单独判断类型合并
|
|
2185
|
-
if (typeof field.amis?.className == "object") {
|
|
2186
|
-
className = {
|
|
2187
|
-
[className]: "true",
|
|
2188
|
-
...field.amis.className
|
|
2189
|
-
};
|
|
2190
|
-
} else if (typeof field.amis?.className == "string") {
|
|
2191
|
-
className = `${className} ${field.amis.className} `;
|
|
2192
|
-
}
|
|
2193
|
-
delete field.amis?.className;
|
|
2194
2228
|
|
|
2195
2229
|
if(!field.hidden && !field.extra){
|
|
2196
2230
|
columnItem = Object.assign({}, {
|
|
@@ -2207,7 +2241,7 @@ async function getTableColumns(fields, options){
|
|
|
2207
2241
|
static: true,
|
|
2208
2242
|
options: field.type === 'html' ? {html: true} : null
|
|
2209
2243
|
// toggled: true
|
|
2210
|
-
},
|
|
2244
|
+
}, fieldAmis, {name: field.name});
|
|
2211
2245
|
|
|
2212
2246
|
if(field.type === 'color'){
|
|
2213
2247
|
columnItem.type = 'color';
|
|
@@ -8611,14 +8645,7 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
8611
8645
|
headers: {
|
|
8612
8646
|
Authorization: "Bearer ${context.tenantId},${context.authToken}",
|
|
8613
8647
|
},
|
|
8614
|
-
requestAdaptor: quickSaveApiRequestAdaptor
|
|
8615
|
-
adaptor: `
|
|
8616
|
-
if(payload.errors){
|
|
8617
|
-
payload.status = 2;
|
|
8618
|
-
payload.msg = window.t ? window.t(payload.errors[0].message) : payload.errors[0].message;
|
|
8619
|
-
}
|
|
8620
|
-
return payload;
|
|
8621
|
-
`
|
|
8648
|
+
requestAdaptor: quickSaveApiRequestAdaptor
|
|
8622
8649
|
},
|
|
8623
8650
|
// 外层data发生变化的时候, 不会重新渲染rowClassNameExpr, 所以先用css标记tr唯一标识
|
|
8624
8651
|
// 使用表达式给tr添加初始选中状态
|
|
@@ -8635,6 +8662,21 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
8635
8662
|
crudModeClassName = `steedos-crud-mode-${body.mode}`;
|
|
8636
8663
|
}
|
|
8637
8664
|
|
|
8665
|
+
body.quickSaveApi.adaptor = `
|
|
8666
|
+
if(payload.errors){
|
|
8667
|
+
payload.status = 2;
|
|
8668
|
+
payload.msg = window.t ? window.t(payload.errors[0].message) : payload.errors[0].message;
|
|
8669
|
+
}
|
|
8670
|
+
debugger;
|
|
8671
|
+
var scope = SteedosUI.getRef(context.scopeId);
|
|
8672
|
+
var scopeParent = scope && scope.parent;
|
|
8673
|
+
var crudScoped = scopeParent.getComponentById('${body.id}');
|
|
8674
|
+
setTimeout(()=>{
|
|
8675
|
+
crudScoped && crudScoped.control.updateAutoFillHeight();
|
|
8676
|
+
}, 500);
|
|
8677
|
+
return payload;
|
|
8678
|
+
`;
|
|
8679
|
+
|
|
8638
8680
|
if(body.columns && options.formFactor != 'SMALL'){
|
|
8639
8681
|
//将_display放入crud的columns的倒数第二列中(最后一列会影响固定列),可以通过setvalue修改行内数据域的_display,而不影响上层items的_display,用于批量编辑
|
|
8640
8682
|
body.columns.splice(body.columns.length -1 , 0, {name: '_display',type: 'static', width: 1, placeholder: "",id: objectSchema.name + "_display_${_index}", tpl: "${''}"});
|
|
@@ -12956,7 +12998,7 @@ function uuidv4() {
|
|
|
12956
12998
|
* @Author: 殷亮辉 yinlianghui@hotoa.com
|
|
12957
12999
|
* @Date: 2023-11-15 09:50:22
|
|
12958
13000
|
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
12959
|
-
* @LastEditTime: 2024-01-
|
|
13001
|
+
* @LastEditTime: 2024-01-25 14:11:50
|
|
12960
13002
|
*/
|
|
12961
13003
|
|
|
12962
13004
|
function getTablePrimaryKey(props) {
|
|
@@ -13108,16 +13150,20 @@ function getInputTableCell(field, showAsInlineEditMode) {
|
|
|
13108
13150
|
}
|
|
13109
13151
|
}
|
|
13110
13152
|
else {
|
|
13153
|
+
// 这里加一层service是因为amis 3.6/6.0中有bug,不加的话,这里会显示为父作用域中中的同名变量值,见:https://github.com/baidu/amis/issues/9520
|
|
13111
13154
|
return {
|
|
13112
|
-
"type": "
|
|
13113
|
-
"config": Object.assign({}, field, {
|
|
13114
|
-
label: false
|
|
13115
|
-
}),
|
|
13116
|
-
inInputTable: true,
|
|
13117
|
-
"static": true,
|
|
13118
|
-
"readonly": true,
|
|
13155
|
+
"type": "service",
|
|
13119
13156
|
label: field.label,
|
|
13120
|
-
name: field.name
|
|
13157
|
+
name: field.name,
|
|
13158
|
+
"body":[{
|
|
13159
|
+
"type": "steedos-field",
|
|
13160
|
+
"config": Object.assign({}, field, {
|
|
13161
|
+
label: false
|
|
13162
|
+
}),
|
|
13163
|
+
inInputTable: true,
|
|
13164
|
+
"static": true,
|
|
13165
|
+
"readonly": true
|
|
13166
|
+
}]
|
|
13121
13167
|
}
|
|
13122
13168
|
}
|
|
13123
13169
|
}
|
|
@@ -14241,6 +14287,10 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
14241
14287
|
"width": buttonsForColumnOperations.length > 1 ? "60px" : "20px"
|
|
14242
14288
|
});
|
|
14243
14289
|
}
|
|
14290
|
+
// if (showAsInlineEditMode) {
|
|
14291
|
+
// // 因为要支持不同的列上配置inlineEditMode属性,所有不可以把整个子表组件都设置为inlineEditMode
|
|
14292
|
+
// inputTableSchema.needConfirm = false;
|
|
14293
|
+
// }
|
|
14244
14294
|
if (amis) {
|
|
14245
14295
|
// 支持配置amis属性重写或添加最终生成的input-table中任何属性。
|
|
14246
14296
|
delete amis.id;//如果steedos-input-table组件配置了amis.id属性,会造成新建编辑行功能不生效
|