@steedos-widgets/amis-lib 1.3.22-beta.3 → 3.6.0-beta.4
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 +67 -26
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +67 -26
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +35 -28
- 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
|
@@ -382,8 +382,8 @@ const Router = {
|
|
|
382
382
|
/*
|
|
383
383
|
* @Author: baozhoutao@steedos.com
|
|
384
384
|
* @Date: 2022-07-20 16:29:22
|
|
385
|
-
* @LastEditors:
|
|
386
|
-
* @LastEditTime: 2023-
|
|
385
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
386
|
+
* @LastEditTime: 2023-12-28 14:59:08
|
|
387
387
|
* @Description:
|
|
388
388
|
*/
|
|
389
389
|
|
|
@@ -440,6 +440,21 @@ function getLookupListView(refObjectConfig) {
|
|
|
440
440
|
return listView;
|
|
441
441
|
}
|
|
442
442
|
|
|
443
|
+
|
|
444
|
+
/**
|
|
445
|
+
* 获取可比较的amis版本号
|
|
446
|
+
* @returns 只返回前两位版本,第三位忽略,比如3.6.3返回3.6
|
|
447
|
+
*/
|
|
448
|
+
function getComparableAmisVersion() {
|
|
449
|
+
let amis = (window.amisRequire && window.amisRequire('amis')) || window.Amis;
|
|
450
|
+
let amisVersion = amis && amis.version;
|
|
451
|
+
if(amisVersion){
|
|
452
|
+
let comparableVersions = amisVersion.split(".");
|
|
453
|
+
let comparableVersion = parseFloat(comparableVersions[0].toString() + "." + comparableVersions[1].toString());
|
|
454
|
+
return comparableVersion;
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
|
|
443
458
|
/*
|
|
444
459
|
* @Author: baozhoutao@steedos.com
|
|
445
460
|
* @Date: 2022-05-23 09:53:08
|
|
@@ -1798,7 +1813,7 @@ async function getQuickEditSchema(field, options){
|
|
|
1798
1813
|
"actions":[
|
|
1799
1814
|
{
|
|
1800
1815
|
"actionType": "setValue",
|
|
1801
|
-
"componentId":
|
|
1816
|
+
"componentId": quickEditId,
|
|
1802
1817
|
"args": {
|
|
1803
1818
|
"value":{
|
|
1804
1819
|
"quickedit_record_permissions_loading": true
|
|
@@ -1823,7 +1838,7 @@ async function getQuickEditSchema(field, options){
|
|
|
1823
1838
|
},
|
|
1824
1839
|
{
|
|
1825
1840
|
"actionType": "setValue",
|
|
1826
|
-
"componentId":
|
|
1841
|
+
"componentId": quickEditId,
|
|
1827
1842
|
"args": {
|
|
1828
1843
|
"value":{
|
|
1829
1844
|
"quickedit_record_permissions_loading": false
|
|
@@ -1832,7 +1847,7 @@ async function getQuickEditSchema(field, options){
|
|
|
1832
1847
|
},
|
|
1833
1848
|
{
|
|
1834
1849
|
"actionType": "setValue",
|
|
1835
|
-
"componentId":
|
|
1850
|
+
"componentId": quickEditId,
|
|
1836
1851
|
"args": {
|
|
1837
1852
|
"value":{
|
|
1838
1853
|
"quickedit_record_permissions": "${event.data}"
|
|
@@ -2011,8 +2026,6 @@ function getFieldWidth(width){
|
|
|
2011
2026
|
async function getTableColumns(fields, options){
|
|
2012
2027
|
const columns = [];
|
|
2013
2028
|
if(!options.isLookup && !options.isInputTable){
|
|
2014
|
-
//将_display放入crud的columns中,可以通过setvalue修改行内数据域的_display,而不影响上层items的_display,用于批量编辑
|
|
2015
|
-
columns.push({name: '_display',type: 'static', width: 32, placeholder: "",id: "_display_${_index}", className: "hidden"});
|
|
2016
2029
|
if(!options.enable_tree){
|
|
2017
2030
|
columns.push({name: '_index',type: 'text', width: 32, placeholder: ""});
|
|
2018
2031
|
}
|
|
@@ -2170,8 +2183,8 @@ async function getTableColumns(fields, options){
|
|
|
2170
2183
|
const href = Router.getObjectDetailPath({
|
|
2171
2184
|
...options, formFactor: options.formFactor, appId: "${appId}", objectName: options.objectName || "${objectName}", recordId: `\${${options.idFieldName}}`
|
|
2172
2185
|
});
|
|
2173
|
-
columns[
|
|
2174
|
-
columns[
|
|
2186
|
+
columns[0].type = "tpl";
|
|
2187
|
+
columns[0].tpl = `<a href="${href}">\${${columns[0].name}}</a>`;
|
|
2175
2188
|
}
|
|
2176
2189
|
return columns;
|
|
2177
2190
|
}
|
|
@@ -2557,6 +2570,7 @@ async function getTableSchema$1(fields, options){
|
|
|
2557
2570
|
if(!isLookup && !hiddenColumnOperation){
|
|
2558
2571
|
columns.push(await getTableOperation(options));
|
|
2559
2572
|
}
|
|
2573
|
+
|
|
2560
2574
|
}
|
|
2561
2575
|
|
|
2562
2576
|
return {
|
|
@@ -3665,6 +3679,7 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
|
|
|
3665
3679
|
"dialog": {
|
|
3666
3680
|
"type": "dialog",
|
|
3667
3681
|
"title": title,
|
|
3682
|
+
data,
|
|
3668
3683
|
"body": [
|
|
3669
3684
|
{
|
|
3670
3685
|
"type": "steedos-object-form",
|
|
@@ -8337,6 +8352,11 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
8337
8352
|
crudModeClassName = `steedos-crud-mode-${body.mode}`;
|
|
8338
8353
|
}
|
|
8339
8354
|
|
|
8355
|
+
if(body.columns && options.formFactor != 'SMALL'){
|
|
8356
|
+
//将_display放入crud的columns的倒数第二列中(最后一列会影响固定列),可以通过setvalue修改行内数据域的_display,而不影响上层items的_display,用于批量编辑
|
|
8357
|
+
body.columns.splice(body.columns.length - 1, 0, {name: '_display',type: 'static', width: 32, placeholder: "",id: "_display_${_index}", className: "hidden"});
|
|
8358
|
+
}
|
|
8359
|
+
|
|
8340
8360
|
if (defaults) {
|
|
8341
8361
|
const headerSchema = defaults.headerSchema;
|
|
8342
8362
|
const footerSchema = defaults.footerSchema;
|
|
@@ -8361,6 +8381,7 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
8361
8381
|
body = wrappedBody;
|
|
8362
8382
|
}
|
|
8363
8383
|
}
|
|
8384
|
+
|
|
8364
8385
|
// console.timeEnd('getObjectCRUD');
|
|
8365
8386
|
// TODO: data应该只留loaded,其他属性都改为从上层传递下来
|
|
8366
8387
|
return {
|
|
@@ -10563,6 +10584,9 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
10563
10584
|
*/
|
|
10564
10585
|
return payload;
|
|
10565
10586
|
}
|
|
10587
|
+
if(!payload.data.rows){
|
|
10588
|
+
payload.data.rows = [];
|
|
10589
|
+
}
|
|
10566
10590
|
if(enable_tree){
|
|
10567
10591
|
const records = payload.data.rows;
|
|
10568
10592
|
const treeRecords = [];
|
|
@@ -10843,7 +10867,7 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
10843
10867
|
sendOn.push(`this.${fName}`);
|
|
10844
10868
|
});
|
|
10845
10869
|
if(depend_on.length > 0){
|
|
10846
|
-
apiInfo.url = `${apiInfo.url}
|
|
10870
|
+
apiInfo.url = `${apiInfo.url}&${depend_on.join('&')}`;
|
|
10847
10871
|
apiInfo.sendOn = `${sendOn.join(' && ')}`;
|
|
10848
10872
|
}
|
|
10849
10873
|
}
|
|
@@ -10951,6 +10975,13 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
10951
10975
|
autoComplete: apiInfo,
|
|
10952
10976
|
searchable: true,
|
|
10953
10977
|
};
|
|
10978
|
+
let amisVersion = getComparableAmisVersion();
|
|
10979
|
+
if(amisVersion >= 3.6){
|
|
10980
|
+
// amis 3.6中不加source会造成子表组件中弹出行编辑窗口的lookup字段有时不请求接口(概率现象,同一个地方反复操作有时请求有时不请求)
|
|
10981
|
+
// 但是同时配置autoComplete和source会多请求一次接口
|
|
10982
|
+
// TODO:应该想办法把是否字段在子表组件内,即ctx.isInputTable,如果不在子表组件内不需要加source
|
|
10983
|
+
data.source = apiInfo;
|
|
10984
|
+
}
|
|
10954
10985
|
//删除xlink:href中的rootUrl前缀,解决客户端svg为空的问题
|
|
10955
10986
|
const select_menuTpl = `<span class='flex items-center mt-0.5'>
|
|
10956
10987
|
<span role='img' aria-label='smile' class='anticon anticon-smile'>
|
|
@@ -11310,9 +11341,9 @@ const OMIT_FIELDS = ['created', 'created_by', 'modified', 'modified_by'];
|
|
|
11310
11341
|
// const Lookup = require('./lookup');
|
|
11311
11342
|
|
|
11312
11343
|
function getBaseFields(readonly){
|
|
11313
|
-
let
|
|
11344
|
+
let className = 'm-0';
|
|
11314
11345
|
if(readonly){
|
|
11315
|
-
|
|
11346
|
+
className = `${className}`;
|
|
11316
11347
|
}
|
|
11317
11348
|
return [
|
|
11318
11349
|
{
|
|
@@ -11320,7 +11351,7 @@ function getBaseFields(readonly){
|
|
|
11320
11351
|
label: "创建人",
|
|
11321
11352
|
type: "static",
|
|
11322
11353
|
labelClassName: 'text-left',
|
|
11323
|
-
className:
|
|
11354
|
+
className: className,
|
|
11324
11355
|
tpl: getCreatedInfoTpl()
|
|
11325
11356
|
},
|
|
11326
11357
|
{
|
|
@@ -11328,7 +11359,7 @@ function getBaseFields(readonly){
|
|
|
11328
11359
|
label: "修改人",
|
|
11329
11360
|
type: "static",
|
|
11330
11361
|
labelClassName: 'text-left',
|
|
11331
|
-
className:
|
|
11362
|
+
className: className,
|
|
11332
11363
|
tpl: getModifiedInfoTpl()
|
|
11333
11364
|
}
|
|
11334
11365
|
]
|
|
@@ -12024,9 +12055,9 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
12024
12055
|
}
|
|
12025
12056
|
if(!_$1.isEmpty(convertData)){
|
|
12026
12057
|
if(field.is_wide || convertData.type === 'group'){
|
|
12027
|
-
convertData.className = 'col-span-2 m-
|
|
12058
|
+
convertData.className = 'col-span-2 m-0';
|
|
12028
12059
|
}else {
|
|
12029
|
-
convertData.className = 'm-
|
|
12060
|
+
convertData.className = 'm-0';
|
|
12030
12061
|
}
|
|
12031
12062
|
if(readonly){
|
|
12032
12063
|
convertData.className = `${convertData.className} border-b`;
|
|
@@ -12432,7 +12463,7 @@ async function getFormBody(permissionFields, formFields, ctx){
|
|
|
12432
12463
|
* @Author: 殷亮辉 yinlianghui@hotoa.com
|
|
12433
12464
|
* @Date: 2023-11-15 09:50:22
|
|
12434
12465
|
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
12435
|
-
* @LastEditTime: 2023-12-
|
|
12466
|
+
* @LastEditTime: 2023-12-28 15:54:36
|
|
12436
12467
|
*/
|
|
12437
12468
|
|
|
12438
12469
|
/**
|
|
@@ -12460,20 +12491,22 @@ function getInputTableCell(field, showAsInlineEditMode) {
|
|
|
12460
12491
|
name: field.name,
|
|
12461
12492
|
quickEdit: {
|
|
12462
12493
|
"type": "steedos-field",
|
|
12463
|
-
"config": field,
|
|
12464
|
-
|
|
12494
|
+
"config": Object.assign({}, field, {
|
|
12495
|
+
label: false
|
|
12496
|
+
})
|
|
12465
12497
|
}
|
|
12466
12498
|
}
|
|
12467
12499
|
}
|
|
12468
12500
|
else {
|
|
12469
12501
|
return {
|
|
12470
12502
|
"type": "steedos-field",
|
|
12471
|
-
"config": field,
|
|
12503
|
+
"config": Object.assign({}, field, {
|
|
12504
|
+
label: false
|
|
12505
|
+
}),
|
|
12472
12506
|
"static": true,
|
|
12473
12507
|
"readonly": true,
|
|
12474
12508
|
label: field.label,
|
|
12475
|
-
name: field.name
|
|
12476
|
-
hideLabel: true
|
|
12509
|
+
name: field.name
|
|
12477
12510
|
}
|
|
12478
12511
|
}
|
|
12479
12512
|
}
|
|
@@ -12719,7 +12752,9 @@ function getFormPaginationWrapper(props, form, mode) {
|
|
|
12719
12752
|
let __wrapperServiceId = "${tableServiceId}";
|
|
12720
12753
|
let wrapperService = scope.getComponentById(__wrapperServiceId);
|
|
12721
12754
|
let wrapperServiceData = wrapperService.getData();
|
|
12722
|
-
|
|
12755
|
+
// 这里不可以用event.data["${props.name}"]因为amis input talbe有一层单独的作用域,其值会延迟一拍
|
|
12756
|
+
// 这里如果不.clone的话,在弹出窗口中显示的子表组件,添加行后点窗口的取消按钮关闭窗口后无法把之前的操作还原,即把之前添加的行自动移除
|
|
12757
|
+
let lastestFieldValue = _.clone(wrapperServiceData["${props.name}"] || []);
|
|
12723
12758
|
//不可以直接像event.data.__tableItems = lastestFieldValue; 这样整个赋值,否则作用域会断
|
|
12724
12759
|
let mode = "${mode}";
|
|
12725
12760
|
if(mode === "new"){
|
|
@@ -12909,6 +12944,11 @@ async function getButtonActions(props, mode) {
|
|
|
12909
12944
|
let dialogId = getComponentId("dialog", props.id);
|
|
12910
12945
|
let buttonNextId = getComponentId("button_next", props.id);
|
|
12911
12946
|
let formPaginationId = getComponentId("form_pagination", props.id);
|
|
12947
|
+
let parentFormData = "${__super.__super.__super.__super || {}}";
|
|
12948
|
+
let amisVersion = getComparableAmisVersion();
|
|
12949
|
+
if(amisVersion < 3.6){
|
|
12950
|
+
parentFormData = "${__super.__super || {}}";
|
|
12951
|
+
}
|
|
12912
12952
|
if (mode == "new" || mode == "edit") {
|
|
12913
12953
|
// let actionShowNewDialog = {
|
|
12914
12954
|
// "actionType": "dialog",
|
|
@@ -13050,7 +13090,8 @@ async function getButtonActions(props, mode) {
|
|
|
13050
13090
|
// 换成从__super来映射上级表单数据是因为对象列表视图界面中每行下拉菜单中的编辑按钮弹出的表单中的子表所在作用域中没有record变量
|
|
13051
13091
|
// 映射到中间变量__parentForm而不是直接用&展开映射是为了避免表单中字段名与作用域中变量重名
|
|
13052
13092
|
// "__parentForm": "${__super.__super || {}}",
|
|
13053
|
-
"__parentForm": mode == "new" ? "$$" : "${__super.__super || {}}",
|
|
13093
|
+
// "__parentForm": mode == "new" ? "$$" : "${__super.__super || {}}",
|
|
13094
|
+
"__parentForm": mode == "new" ? "$$" : parentFormData,
|
|
13054
13095
|
"global": "${global}",
|
|
13055
13096
|
"uiSchema": "${uiSchema}",
|
|
13056
13097
|
"index": "${index}",
|
|
@@ -13143,7 +13184,7 @@ async function getButtonActions(props, mode) {
|
|
|
13143
13184
|
// 换成从__super来映射上级表单数据是因为对象列表视图界面中每行下拉菜单中的编辑按钮弹出的表单中的子表所在作用域中没有record变量
|
|
13144
13185
|
// 映射到中间变量__parentForm而不是直接用&展开映射是为了避免表单中字段名与作用域中变量重名
|
|
13145
13186
|
// "__parentForm": "${__super.__super || {}}",
|
|
13146
|
-
"__parentForm":
|
|
13187
|
+
"__parentForm": parentFormData,
|
|
13147
13188
|
"global": "${global}",
|
|
13148
13189
|
"uiSchema": "${uiSchema}",
|
|
13149
13190
|
"index": "${index}",
|
|
@@ -13311,7 +13352,7 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
13311
13352
|
"name": "__op__",
|
|
13312
13353
|
"type": "operation",
|
|
13313
13354
|
"buttons": buttonsForColumnOperations,
|
|
13314
|
-
"width": buttonsForColumnOperations.length > 1 ? "
|
|
13355
|
+
"width": buttonsForColumnOperations.length > 1 ? "60px" : "20px"
|
|
13315
13356
|
});
|
|
13316
13357
|
}
|
|
13317
13358
|
if (showAsInlineEditMode) {
|