@steedos-widgets/amis-object 3.6.2-beta.13 → 3.6.2-beta.15
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/amis/AmisInputTable.d.ts +2 -1
- package/dist/amis-object.cjs.css +13 -0
- package/dist/amis-object.cjs.js +208 -45
- package/dist/amis-object.cjs.js.map +1 -1
- package/dist/amis-object.esm.css +13 -0
- package/dist/amis-object.esm.js +208 -45
- package/dist/amis-object.esm.js.map +1 -1
- package/dist/amis-object.umd.css +13 -0
- package/dist/amis-object.umd.js +56 -27
- package/dist/amis-object.umd.js.map +1 -1
- package/dist/assets.json +21 -21
- package/package.json +3 -3
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import './AmisInputTable.less';
|
|
1
2
|
export declare const AmisInputTable: (props: any) => Promise<{
|
|
2
3
|
type: string;
|
|
3
4
|
body: {
|
|
@@ -25,5 +26,5 @@ export declare const AmisInputTable: (props: any) => Promise<{
|
|
|
25
26
|
labelRemark: any;
|
|
26
27
|
labelAlign: any;
|
|
27
28
|
mode: any;
|
|
28
|
-
className:
|
|
29
|
+
className: string;
|
|
29
30
|
}>;
|
package/dist/amis-object.cjs.css
CHANGED
|
@@ -353,6 +353,9 @@ fieldset.antd-Collapse > legend{
|
|
|
353
353
|
.steedos-record-related-crud .antd-Table-table > thead > tr > th:not(:last-child) {
|
|
354
354
|
border-right: 0px;
|
|
355
355
|
}
|
|
356
|
+
.ant-dropdown{
|
|
357
|
+
z-index: 1400;
|
|
358
|
+
}
|
|
356
359
|
|
|
357
360
|
.ant-dropdown-menu {
|
|
358
361
|
border: 1px solid #e5e5e5;
|
|
@@ -601,6 +604,9 @@ fieldset.antd-Collapse > legend{
|
|
|
601
604
|
.mt-2 {
|
|
602
605
|
margin-top: 0.5rem
|
|
603
606
|
}
|
|
607
|
+
.mt-3 {
|
|
608
|
+
margin-top: 0.75rem
|
|
609
|
+
}
|
|
604
610
|
.mt-\[50px\] {
|
|
605
611
|
margin-top: 50px
|
|
606
612
|
}
|
|
@@ -706,6 +712,9 @@ fieldset.antd-Collapse > legend{
|
|
|
706
712
|
.w-8 {
|
|
707
713
|
width: 2rem
|
|
708
714
|
}
|
|
715
|
+
.w-80 {
|
|
716
|
+
width: 20rem
|
|
717
|
+
}
|
|
709
718
|
.w-96 {
|
|
710
719
|
width: 24rem
|
|
711
720
|
}
|
|
@@ -2514,6 +2523,10 @@ body.sidebar #sidebar {
|
|
|
2514
2523
|
color: #000;
|
|
2515
2524
|
}
|
|
2516
2525
|
|
|
2526
|
+
.steedos-input-table .antd-DropDown-popover .antd-PopOver-overlay {
|
|
2527
|
+
display: none;
|
|
2528
|
+
}
|
|
2529
|
+
|
|
2517
2530
|
|
|
2518
2531
|
.steedos-record-selected {
|
|
2519
2532
|
background: var(--Table-onChecked-bg) !important;
|
package/dist/amis-object.cjs.js
CHANGED
|
@@ -3570,8 +3570,8 @@ const Router$1 = {
|
|
|
3570
3570
|
/*
|
|
3571
3571
|
* @Author: baozhoutao@steedos.com
|
|
3572
3572
|
* @Date: 2022-07-20 16:29:22
|
|
3573
|
-
* @LastEditors:
|
|
3574
|
-
* @LastEditTime:
|
|
3573
|
+
* @LastEditors: liaodaxue
|
|
3574
|
+
* @LastEditTime: 2024-01-25 14:44:17
|
|
3575
3575
|
* @Description:
|
|
3576
3576
|
*/
|
|
3577
3577
|
|
|
@@ -3643,6 +3643,25 @@ function getComparableAmisVersion() {
|
|
|
3643
3643
|
}
|
|
3644
3644
|
}
|
|
3645
3645
|
|
|
3646
|
+
/**
|
|
3647
|
+
* 判断浏览器类型
|
|
3648
|
+
* @returns 按需返回浏览器类型;
|
|
3649
|
+
*/
|
|
3650
|
+
function getBowserType() {
|
|
3651
|
+
const userAgent = navigator.userAgent;
|
|
3652
|
+
if (userAgent.indexOf("Chrome")!== -1 && userAgent.indexOf("Safari") !== -1 && userAgent.indexOf("Edg") === -1) {
|
|
3653
|
+
return "Chrome";
|
|
3654
|
+
} else if (userAgent.indexOf("Firefox") !== -1) {
|
|
3655
|
+
return "Firefox";
|
|
3656
|
+
} else if (userAgent.indexOf("Safari") !== -1 && userAgent.indexOf("Chrome") === -1 && userAgent.indexOf("Edge") === -1) {
|
|
3657
|
+
return "Safari";
|
|
3658
|
+
} else if (userAgent.indexOf("Edg") !== -1) {
|
|
3659
|
+
return "Edge";
|
|
3660
|
+
} else {
|
|
3661
|
+
return "Unknown browser"; // 其他浏览器...(可根据自己需要确定是否新增其他浏览器的判断)
|
|
3662
|
+
}
|
|
3663
|
+
}
|
|
3664
|
+
|
|
3646
3665
|
/*
|
|
3647
3666
|
* @Author: baozhoutao@steedos.com
|
|
3648
3667
|
* @Date: 2022-05-23 09:53:08
|
|
@@ -5046,7 +5065,8 @@ async function getQuickEditSchema(field, options){
|
|
|
5046
5065
|
"failed": "失败了呢。。"
|
|
5047
5066
|
}
|
|
5048
5067
|
}
|
|
5049
|
-
}
|
|
5068
|
+
},
|
|
5069
|
+
"expression": "${!recordPermissions.modifyAllRecords}"
|
|
5050
5070
|
},
|
|
5051
5071
|
{
|
|
5052
5072
|
"actionType": "setValue",
|
|
@@ -5062,7 +5082,7 @@ async function getQuickEditSchema(field, options){
|
|
|
5062
5082
|
"componentId": quickEditId,
|
|
5063
5083
|
"args": {
|
|
5064
5084
|
"value":{
|
|
5065
|
-
"quickedit_record_permissions": "${event.data}"
|
|
5085
|
+
"quickedit_record_permissions": "${recordPermissions.modifyAllRecords ? {'allowEdit': true} : event.data}"
|
|
5066
5086
|
}
|
|
5067
5087
|
}
|
|
5068
5088
|
}
|
|
@@ -5126,7 +5146,7 @@ async function getQuickEditSchema(field, options){
|
|
|
5126
5146
|
`
|
|
5127
5147
|
}
|
|
5128
5148
|
},
|
|
5129
|
-
"expression":"${event.data.value}"
|
|
5149
|
+
"expression":"${event.data.value && !recordPermissions.modifyAllRecords}"
|
|
5130
5150
|
},
|
|
5131
5151
|
{
|
|
5132
5152
|
"actionType": "setValue",
|
|
@@ -5157,10 +5177,20 @@ async function getQuickEditSchema(field, options){
|
|
|
5157
5177
|
"script": `
|
|
5158
5178
|
const noPermission = event.data.noPermission;
|
|
5159
5179
|
const crudComponent = event.context.scoped.getComponentById("${options.crudId}");
|
|
5160
|
-
|
|
5180
|
+
let selectedItems = crudComponent && crudComponent.props.store.selectedItems.concat();
|
|
5161
5181
|
noPermission.forEach(function (item) {
|
|
5162
5182
|
crudComponent && crudComponent.unSelectItem(_.find(selectedItems,{_id:item}));
|
|
5183
|
+
_.remove(selectedItems, (selected) => selected._id === item);
|
|
5163
5184
|
})
|
|
5185
|
+
doAction({
|
|
5186
|
+
"componentId": "${quickEditId}",
|
|
5187
|
+
"actionType": "setValue",
|
|
5188
|
+
"args": {
|
|
5189
|
+
"value": {
|
|
5190
|
+
selectedItems
|
|
5191
|
+
}
|
|
5192
|
+
}
|
|
5193
|
+
});
|
|
5164
5194
|
`
|
|
5165
5195
|
},
|
|
5166
5196
|
{
|
|
@@ -5251,7 +5281,8 @@ async function getTableColumns$1(fields, options){
|
|
|
5251
5281
|
//增加quickEdit属性,实现快速编辑
|
|
5252
5282
|
const quickEditSchema = allowEdit ? await getQuickEditSchema(field, options) : allowEdit;
|
|
5253
5283
|
let className = "";
|
|
5254
|
-
|
|
5284
|
+
const bowserType = getBowserType();
|
|
5285
|
+
if(bowserType === "Safari"){
|
|
5255
5286
|
className += " whitespace-nowrap ";
|
|
5256
5287
|
}else {
|
|
5257
5288
|
if(field.wrap != true){
|
|
@@ -5260,6 +5291,18 @@ async function getTableColumns$1(fields, options){
|
|
|
5260
5291
|
className += " break-words ";
|
|
5261
5292
|
}
|
|
5262
5293
|
}
|
|
5294
|
+
|
|
5295
|
+
if (typeof field.amis?.className == "object") {
|
|
5296
|
+
className = {
|
|
5297
|
+
[className]: "true",
|
|
5298
|
+
...field.amis.className
|
|
5299
|
+
};
|
|
5300
|
+
} else if (typeof field.amis?.className == "string") {
|
|
5301
|
+
className = `${className} ${field.amis.className} `;
|
|
5302
|
+
}
|
|
5303
|
+
let fieldAmis = _$1__namespace.clone(field.amis);
|
|
5304
|
+
delete fieldAmis?.className;
|
|
5305
|
+
|
|
5263
5306
|
let columnItem;
|
|
5264
5307
|
if((field.is_name || field.name === options.labelFieldName) && options.objectName === 'cms_files'){
|
|
5265
5308
|
const previewFileScript = `
|
|
@@ -5310,7 +5353,7 @@ async function getTableColumns$1(fields, options){
|
|
|
5310
5353
|
toggled: field.toggled,
|
|
5311
5354
|
static: true,
|
|
5312
5355
|
className,
|
|
5313
|
-
},
|
|
5356
|
+
}, fieldAmis, {name: field.name});
|
|
5314
5357
|
}else if(field.type === 'avatar' || field.type === 'image' || field.type === 'file'){
|
|
5315
5358
|
columnItem = Object.assign({}, {
|
|
5316
5359
|
type: "switch",
|
|
@@ -5321,7 +5364,7 @@ async function getTableColumns$1(fields, options){
|
|
|
5321
5364
|
static: true,
|
|
5322
5365
|
className,
|
|
5323
5366
|
...getAmisFileReadonlySchema(field)
|
|
5324
|
-
},
|
|
5367
|
+
}, fieldAmis, {name: field.name});
|
|
5325
5368
|
}
|
|
5326
5369
|
else if(field.type === 'select'){
|
|
5327
5370
|
const map = getSelectMap(field.options);
|
|
@@ -5336,7 +5379,7 @@ async function getTableColumns$1(fields, options){
|
|
|
5336
5379
|
className,
|
|
5337
5380
|
inputClassName: "inline",
|
|
5338
5381
|
static: true,
|
|
5339
|
-
},
|
|
5382
|
+
}, fieldAmis, {name: field.name});
|
|
5340
5383
|
}
|
|
5341
5384
|
else {
|
|
5342
5385
|
const tpl = await getFieldTpl(field, options);
|
|
@@ -5363,15 +5406,6 @@ async function getTableColumns$1(fields, options){
|
|
|
5363
5406
|
// }
|
|
5364
5407
|
|
|
5365
5408
|
//field上的amis属性里的clssname需要单独判断类型合并
|
|
5366
|
-
if (typeof field.amis?.className == "object") {
|
|
5367
|
-
className = {
|
|
5368
|
-
[className]: "true",
|
|
5369
|
-
...field.amis.className
|
|
5370
|
-
};
|
|
5371
|
-
} else if (typeof field.amis?.className == "string") {
|
|
5372
|
-
className = `${className} ${field.amis.className} `;
|
|
5373
|
-
}
|
|
5374
|
-
delete field.amis?.className;
|
|
5375
5409
|
|
|
5376
5410
|
if(!field.hidden && !field.extra){
|
|
5377
5411
|
columnItem = Object.assign({}, {
|
|
@@ -5388,7 +5422,7 @@ async function getTableColumns$1(fields, options){
|
|
|
5388
5422
|
static: true,
|
|
5389
5423
|
options: field.type === 'html' ? {html: true} : null
|
|
5390
5424
|
// toggled: true
|
|
5391
|
-
},
|
|
5425
|
+
}, fieldAmis, {name: field.name});
|
|
5392
5426
|
|
|
5393
5427
|
if(field.type === 'color'){
|
|
5394
5428
|
columnItem.type = 'color';
|
|
@@ -11792,14 +11826,7 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
11792
11826
|
headers: {
|
|
11793
11827
|
Authorization: "Bearer ${context.tenantId},${context.authToken}",
|
|
11794
11828
|
},
|
|
11795
|
-
requestAdaptor: quickSaveApiRequestAdaptor
|
|
11796
|
-
adaptor: `
|
|
11797
|
-
if(payload.errors){
|
|
11798
|
-
payload.status = 2;
|
|
11799
|
-
payload.msg = window.t ? window.t(payload.errors[0].message) : payload.errors[0].message;
|
|
11800
|
-
}
|
|
11801
|
-
return payload;
|
|
11802
|
-
`
|
|
11829
|
+
requestAdaptor: quickSaveApiRequestAdaptor
|
|
11803
11830
|
},
|
|
11804
11831
|
// 外层data发生变化的时候, 不会重新渲染rowClassNameExpr, 所以先用css标记tr唯一标识
|
|
11805
11832
|
// 使用表达式给tr添加初始选中状态
|
|
@@ -11816,6 +11843,21 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
11816
11843
|
crudModeClassName = `steedos-crud-mode-${body.mode}`;
|
|
11817
11844
|
}
|
|
11818
11845
|
|
|
11846
|
+
body.quickSaveApi.adaptor = `
|
|
11847
|
+
if(payload.errors){
|
|
11848
|
+
payload.status = 2;
|
|
11849
|
+
payload.msg = window.t ? window.t(payload.errors[0].message) : payload.errors[0].message;
|
|
11850
|
+
}
|
|
11851
|
+
debugger;
|
|
11852
|
+
var scope = SteedosUI.getRef(context.scopeId);
|
|
11853
|
+
var scopeParent = scope && scope.parent;
|
|
11854
|
+
var crudScoped = scopeParent.getComponentById('${body.id}');
|
|
11855
|
+
setTimeout(()=>{
|
|
11856
|
+
crudScoped && crudScoped.control.updateAutoFillHeight();
|
|
11857
|
+
}, 500);
|
|
11858
|
+
return payload;
|
|
11859
|
+
`;
|
|
11860
|
+
|
|
11819
11861
|
if(body.columns && options.formFactor != 'SMALL'){
|
|
11820
11862
|
//将_display放入crud的columns的倒数第二列中(最后一列会影响固定列),可以通过setvalue修改行内数据域的_display,而不影响上层items的_display,用于批量编辑
|
|
11821
11863
|
body.columns.splice(body.columns.length -1 , 0, {name: '_display',type: 'static', width: 1, placeholder: "",id: objectSchema.name + "_display_${_index}", tpl: "${''}"});
|
|
@@ -15365,7 +15407,7 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
15365
15407
|
convertData = {
|
|
15366
15408
|
type: getAmisStaticFieldType$1('datetime', readonly),
|
|
15367
15409
|
inputFormat: 'YYYY-MM-DD HH:mm',
|
|
15368
|
-
format: 'YYYY-MM-DDTHH:mm:
|
|
15410
|
+
format: 'YYYY-MM-DDTHH:mm:00.000Z',
|
|
15369
15411
|
tpl: readonly ? getDateTimeTpl(field) : null,
|
|
15370
15412
|
utc: true,
|
|
15371
15413
|
};
|
|
@@ -16137,9 +16179,57 @@ function uuidv4() {
|
|
|
16137
16179
|
* @Author: 殷亮辉 yinlianghui@hotoa.com
|
|
16138
16180
|
* @Date: 2023-11-15 09:50:22
|
|
16139
16181
|
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
16140
|
-
* @LastEditTime: 2024-01-
|
|
16182
|
+
* @LastEditTime: 2024-01-26 17:47:16
|
|
16141
16183
|
*/
|
|
16142
16184
|
|
|
16185
|
+
/**
|
|
16186
|
+
* 子表组件字段值中每行数据补上字段值为空的的字段值,把值统一设置为空字符串,是为了解决amis amis 3.6/6.0 input-table组件bug:行中字段值为空时会显示为父作用域中的同名变量值,见:https://github.com/baidu/amis/issues/9520
|
|
16187
|
+
* amis #9520修正后此函数及相关代码可以移除
|
|
16188
|
+
* @param {*} value 子表组件字段值,数组
|
|
16189
|
+
* @param {*} fields 子表组件fields属性,数组
|
|
16190
|
+
* @returns 转换后的子表组件字段值
|
|
16191
|
+
*/
|
|
16192
|
+
function getTableValueWithEmptyValue(value, fields) {
|
|
16193
|
+
return (value || []).map((itemValue) => {
|
|
16194
|
+
//这里不clone的话,会造成在pipeIn函数执行该函数后像pipeOut一样最终输出到表单项中,即库里字段值会被改了
|
|
16195
|
+
const newItemValue = _$1.clone(itemValue);
|
|
16196
|
+
(fields || []).forEach((itemField) => {
|
|
16197
|
+
if(itemField.name && (newItemValue[itemField.name] === undefined || newItemValue[itemField.name] === null)){
|
|
16198
|
+
// 这里newItemValue中不存在 itemField.name 属性,或者值为null时都会有“显示为父作用域中的同名变量值”的问题,所以null和undefined都要重置为空字符串
|
|
16199
|
+
// 实测数字、下拉框、多选lookup等字段类型重置为空字符串都不会有问题,而且实测amis from组件的清空表单字段值功能就是把表单中的各种字段类型设置为空字符串,所以看起来也符合amis规范
|
|
16200
|
+
newItemValue[itemField.name] = "";
|
|
16201
|
+
}
|
|
16202
|
+
if (newItemValue.children) {
|
|
16203
|
+
newItemValue.children = getTableValueWithEmptyValue(newItemValue.children, fields);
|
|
16204
|
+
}
|
|
16205
|
+
});
|
|
16206
|
+
return newItemValue;
|
|
16207
|
+
});
|
|
16208
|
+
}
|
|
16209
|
+
|
|
16210
|
+
/**
|
|
16211
|
+
* 把子表组件字段值中每行数据中经过上面getTableValueWithEmptyValue函数空字段值移除
|
|
16212
|
+
* amis #9520修正后此函数及相关代码可以移除
|
|
16213
|
+
* @param {*} value 子表组件字段值,数组
|
|
16214
|
+
* @param {*} fields 子表组件fields属性,数组
|
|
16215
|
+
* @returns 转换后的子表组件字段值
|
|
16216
|
+
*/
|
|
16217
|
+
function getTableValueWithoutEmptyValue(value, fields) {
|
|
16218
|
+
return (value || []).map((itemValue) => {
|
|
16219
|
+
const newItemValue = _$1.clone(itemValue);
|
|
16220
|
+
(fields || []).forEach((itemField) => {
|
|
16221
|
+
if(itemField.name && (newItemValue[itemField.name] === "" || newItemValue[itemField.name] === undefined || newItemValue[itemField.name] === null)){
|
|
16222
|
+
// 这里额外把null和undefined值也删除掉纯粹是没必要输出保存它们
|
|
16223
|
+
delete newItemValue[itemField.name];
|
|
16224
|
+
}
|
|
16225
|
+
if (newItemValue.children) {
|
|
16226
|
+
newItemValue.children = getTableValueWithoutEmptyValue(newItemValue.children, fields);
|
|
16227
|
+
}
|
|
16228
|
+
});
|
|
16229
|
+
return newItemValue;
|
|
16230
|
+
});
|
|
16231
|
+
}
|
|
16232
|
+
|
|
16143
16233
|
function getTablePrimaryKey(props) {
|
|
16144
16234
|
return props.primaryKey || "_id";
|
|
16145
16235
|
}
|
|
@@ -16218,6 +16308,7 @@ function getTableValueWithoutFieldPrefix(value, fieldPrefix) {
|
|
|
16218
16308
|
* 子表组件字段值中每行数据的键值key补上指定前缀
|
|
16219
16309
|
* @param {*} value 子表组件字段值,数组
|
|
16220
16310
|
* @param {*} fieldPrefix 字段前缀
|
|
16311
|
+
* @param {*} primaryKey 主键字段名,主键不参与被键值key规则,需要排除,审批王amis表单也是这个规则
|
|
16221
16312
|
* @returns 转换后的子表组件字段值
|
|
16222
16313
|
*/
|
|
16223
16314
|
function getTableValuePrependFieldPrefix(value, fieldPrefix, primaryKey) {
|
|
@@ -16485,9 +16576,14 @@ function getFormPagination(props, mode) {
|
|
|
16485
16576
|
"onEvent": {
|
|
16486
16577
|
"click": {
|
|
16487
16578
|
"actions": [
|
|
16579
|
+
{
|
|
16580
|
+
"actionType": "validate",
|
|
16581
|
+
"componentId": formId
|
|
16582
|
+
},
|
|
16488
16583
|
{
|
|
16489
16584
|
"actionType": "custom",
|
|
16490
|
-
"script": onPageChangeScript
|
|
16585
|
+
"script": onPageChangeScript,
|
|
16586
|
+
"expression": "${!!!event.data.validateResult.error}" //触发表单校验结果会存入validateResult,amis 3.2不支持,高版本比如 3.5.3支持
|
|
16491
16587
|
}
|
|
16492
16588
|
]
|
|
16493
16589
|
}
|
|
@@ -16512,9 +16608,14 @@ function getFormPagination(props, mode) {
|
|
|
16512
16608
|
"onEvent": {
|
|
16513
16609
|
"click": {
|
|
16514
16610
|
"actions": [
|
|
16611
|
+
{
|
|
16612
|
+
"actionType": "validate",
|
|
16613
|
+
"componentId": formId
|
|
16614
|
+
},
|
|
16515
16615
|
{
|
|
16516
16616
|
"actionType": "custom",
|
|
16517
|
-
"script": onPageChangeScript
|
|
16617
|
+
"script": onPageChangeScript,
|
|
16618
|
+
"expression": "${!!!event.data.validateResult.error}" //触发表单校验结果会存入validateResult,amis 3.2不支持,高版本比如 3.5.3支持
|
|
16518
16619
|
}
|
|
16519
16620
|
]
|
|
16520
16621
|
}
|
|
@@ -17006,9 +17107,14 @@ async function getButtonActions(props, mode) {
|
|
|
17006
17107
|
"onEvent": {
|
|
17007
17108
|
"click": {
|
|
17008
17109
|
"actions": [
|
|
17110
|
+
{
|
|
17111
|
+
"actionType": "validate",
|
|
17112
|
+
"componentId": formId
|
|
17113
|
+
},
|
|
17009
17114
|
{
|
|
17010
17115
|
"actionType": "custom",
|
|
17011
|
-
"script": onSaveAndNewItemScript
|
|
17116
|
+
"script": onSaveAndNewItemScript,
|
|
17117
|
+
"expression": "${!!!event.data.validateResult.error}" //触发表单校验结果会存入validateResult,amis 3.2不支持,高版本比如 3.5.3支持
|
|
17012
17118
|
}
|
|
17013
17119
|
]
|
|
17014
17120
|
}
|
|
@@ -17021,9 +17127,14 @@ async function getButtonActions(props, mode) {
|
|
|
17021
17127
|
"onEvent": {
|
|
17022
17128
|
"click": {
|
|
17023
17129
|
"actions": [
|
|
17130
|
+
{
|
|
17131
|
+
"actionType": "validate",
|
|
17132
|
+
"componentId": formId
|
|
17133
|
+
},
|
|
17024
17134
|
{
|
|
17025
17135
|
"actionType": "custom",
|
|
17026
|
-
"script": onSaveAndCopyItemScript
|
|
17136
|
+
"script": onSaveAndCopyItemScript,
|
|
17137
|
+
"expression": "${!!!event.data.validateResult.error}" //触发表单校验结果会存入validateResult,amis 3.2不支持,高版本比如 3.5.3支持
|
|
17027
17138
|
}
|
|
17028
17139
|
]
|
|
17029
17140
|
}
|
|
@@ -17289,18 +17400,51 @@ async function getButtonView(props) {
|
|
|
17289
17400
|
|
|
17290
17401
|
async function getButtonDelete(props) {
|
|
17291
17402
|
return {
|
|
17292
|
-
"type": "button",
|
|
17293
|
-
"label": "",
|
|
17294
|
-
"icon": "fa fa-trash-alt",//不可以用fa-trash-o,因为设计字段布局界面中弹出的设置分组列表中显示不了这个图标
|
|
17403
|
+
"type": "dropdown-button",
|
|
17295
17404
|
"level": "link",
|
|
17296
|
-
"
|
|
17297
|
-
|
|
17298
|
-
|
|
17405
|
+
"icon": "fa fa-trash-alt",
|
|
17406
|
+
"size": "xs",
|
|
17407
|
+
"hideCaret": true,
|
|
17408
|
+
"closeOnClick": true,
|
|
17409
|
+
"body": [
|
|
17410
|
+
{
|
|
17411
|
+
"type": "wrapper",
|
|
17412
|
+
"size": "md",
|
|
17413
|
+
"className": "w-80",
|
|
17414
|
+
"body": [
|
|
17415
|
+
{
|
|
17416
|
+
"tpl": "确定要删除吗?",
|
|
17417
|
+
"type": "tpl"
|
|
17418
|
+
},
|
|
17419
|
+
{
|
|
17420
|
+
"type": "flex",
|
|
17421
|
+
"justify": "flex-end",
|
|
17422
|
+
"className": "mt-3",
|
|
17423
|
+
"items": [
|
|
17424
|
+
{
|
|
17425
|
+
"type": "button",
|
|
17426
|
+
"label": "取消",
|
|
17427
|
+
"className": "mr-2"
|
|
17428
|
+
},
|
|
17429
|
+
{
|
|
17430
|
+
"type": "button",
|
|
17431
|
+
"label": "删除",
|
|
17432
|
+
"level": "danger",
|
|
17433
|
+
"onEvent": {
|
|
17434
|
+
"click": {
|
|
17435
|
+
"actions": await getButtonActions(props, "delete")
|
|
17436
|
+
}
|
|
17437
|
+
}
|
|
17438
|
+
}
|
|
17439
|
+
]
|
|
17440
|
+
}
|
|
17441
|
+
]
|
|
17299
17442
|
}
|
|
17300
|
-
|
|
17301
|
-
}
|
|
17443
|
+
]
|
|
17444
|
+
}
|
|
17302
17445
|
}
|
|
17303
17446
|
|
|
17447
|
+
|
|
17304
17448
|
const getAmisInputTableSchema = async (props) => {
|
|
17305
17449
|
if (!props.id) {
|
|
17306
17450
|
props.id = "steedos_input_table_" + props.name + "_" + Math.random().toString(36).substr(2, 9);
|
|
@@ -17373,6 +17517,7 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
17373
17517
|
if (fieldPrefix) {
|
|
17374
17518
|
value = getTableValueWithoutFieldPrefix(value, fieldPrefix);
|
|
17375
17519
|
}
|
|
17520
|
+
value = getTableValueWithEmptyValue(value, fields);
|
|
17376
17521
|
if (primaryKey) {
|
|
17377
17522
|
// 这里临时给每行数据补上primaryKey字段值,如果库里不需要保存这里补上的字段值,pipeOut中会识别autoGeneratePrimaryKeyValue属性选择最终移除这里补上的字段值
|
|
17378
17523
|
// 这里始终自动生成primaryKey字段值,而不是只在pipeOut输出整个子表字段值时才生成,是因为要支持当数据库里保存的子表字段行数据没有primaryKey字段值时的行嵌套模式(即节点的children属性)功能
|
|
@@ -17394,6 +17539,7 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
17394
17539
|
if (fieldPrefix) {
|
|
17395
17540
|
value = getTableValuePrependFieldPrefix(value, fieldPrefix, primaryKey);
|
|
17396
17541
|
}
|
|
17542
|
+
value = getTableValueWithoutEmptyValue(value, fields);
|
|
17397
17543
|
if (props.autoGeneratePrimaryKeyValue === true) {
|
|
17398
17544
|
// 如果需要把自动生成的primaryKey值输出保存的库中,则补全所有行中的primaryKey值
|
|
17399
17545
|
// 这里如果不全部补全的话,初始从库里返回的字段值中拿到的行没primaryKey值的话就不会自动补上
|
|
@@ -17422,6 +17568,10 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
17422
17568
|
"width": buttonsForColumnOperations.length > 1 ? "60px" : "20px"
|
|
17423
17569
|
});
|
|
17424
17570
|
}
|
|
17571
|
+
// if (showAsInlineEditMode) {
|
|
17572
|
+
// // 因为要支持不同的列上配置inlineEditMode属性,所有不可以把整个子表组件都设置为inlineEditMode
|
|
17573
|
+
// inputTableSchema.needConfirm = false;
|
|
17574
|
+
// }
|
|
17425
17575
|
if (amis) {
|
|
17426
17576
|
// 支持配置amis属性重写或添加最终生成的input-table中任何属性。
|
|
17427
17577
|
delete amis.id;//如果steedos-input-table组件配置了amis.id属性,会造成新建编辑行功能不生效
|
|
@@ -17462,6 +17612,17 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
17462
17612
|
"body": headerToolbar
|
|
17463
17613
|
});
|
|
17464
17614
|
}
|
|
17615
|
+
let className = "steedos-input-table";
|
|
17616
|
+
|
|
17617
|
+
if (typeof props.className == "object") {
|
|
17618
|
+
className = {
|
|
17619
|
+
[className]: "true",
|
|
17620
|
+
...props.className
|
|
17621
|
+
};
|
|
17622
|
+
} else if (typeof props.className == "string") {
|
|
17623
|
+
className = `${className} ${props.className} `;
|
|
17624
|
+
}
|
|
17625
|
+
|
|
17465
17626
|
let schema = {
|
|
17466
17627
|
"type": "control",
|
|
17467
17628
|
"body": {
|
|
@@ -17475,7 +17636,7 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
17475
17636
|
"labelAlign": props.labelAlign,
|
|
17476
17637
|
//控制control的mode属性,https://aisuda.bce.baidu.com/amis/zh-CN/components/form/formitem#表单项展示
|
|
17477
17638
|
"mode": props.mode || null,
|
|
17478
|
-
|
|
17639
|
+
className
|
|
17479
17640
|
};
|
|
17480
17641
|
// console.log("===schema===", schema);
|
|
17481
17642
|
return schema;
|
|
@@ -20374,10 +20535,11 @@ var AmisObjectFieldLookup = function (props) {
|
|
|
20374
20535
|
};
|
|
20375
20536
|
|
|
20376
20537
|
var AmisObjectButton = function (props) {
|
|
20538
|
+
var _a;
|
|
20377
20539
|
// console.log(`AmisObjectButton=====》`, props)
|
|
20378
20540
|
var objectName = props.objectName, name = props.name, data = props.data, render = props.render, className = props.className, listViewId = props.listViewId;
|
|
20379
|
-
var
|
|
20380
|
-
var
|
|
20541
|
+
var _b = __read(React.useState(), 2), button = _b[0], setButton = _b[1];
|
|
20542
|
+
var _c = __read(React.useState(), 2), uiSchema = _c[0], setUiSchema = _c[1];
|
|
20381
20543
|
//TODO 处理上下文参数
|
|
20382
20544
|
var appId = data.appId;
|
|
20383
20545
|
var formFactor = data.formFactor;
|
|
@@ -20446,6 +20608,7 @@ var AmisObjectButton = function (props) {
|
|
|
20446
20608
|
}
|
|
20447
20609
|
if (renderData) {
|
|
20448
20610
|
delete renderData.event;
|
|
20611
|
+
(_a = renderData.record) === null || _a === void 0 ? true : delete _a.event;
|
|
20449
20612
|
}
|
|
20450
20613
|
schema.data = _$1.defaultsDeep({}, renderData, getDefaultRenderData(), schema.data);
|
|
20451
20614
|
delete schema.data.event;
|