@steedos-widgets/sortable 1.3.4-beta.20 → 1.3.4-beta.21
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/assets.json +5 -5
- package/dist/sortable.cjs.js +228 -92
- package/dist/sortable.cjs.js.map +1 -1
- package/dist/sortable.esm.js +228 -92
- package/dist/sortable.esm.js.map +1 -1
- package/dist/sortable.umd.js +228 -92
- package/package.json +3 -3
package/dist/sortable.esm.js
CHANGED
|
@@ -58343,8 +58343,6 @@ function getSelectFieldOptions(field){
|
|
|
58343
58343
|
}
|
|
58344
58344
|
|
|
58345
58345
|
async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
58346
|
-
// console.log('convertSFieldToAmisField====>', field, readonly, ctx)
|
|
58347
|
-
const isMobile = window.innerWidth <= 768;
|
|
58348
58346
|
// 创建人和修改人、创建时间和修改时间不显示
|
|
58349
58347
|
if(lodash.exports.includes(OMIT_FIELDS, field.name) && ctx.showSystemFields != true){
|
|
58350
58348
|
return;
|
|
@@ -58433,26 +58431,33 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
58433
58431
|
};
|
|
58434
58432
|
break;
|
|
58435
58433
|
case 'date':
|
|
58436
|
-
convertData = isMobile && !readonly ? {
|
|
58437
|
-
|
|
58438
|
-
|
|
58439
|
-
|
|
58440
|
-
|
|
58441
|
-
|
|
58442
|
-
|
|
58443
|
-
|
|
58444
|
-
|
|
58445
|
-
|
|
58446
|
-
|
|
58447
|
-
|
|
58448
|
-
|
|
58449
|
-
|
|
58450
|
-
|
|
58451
|
-
|
|
58452
|
-
|
|
58453
|
-
|
|
58454
|
-
|
|
58455
|
-
} : {
|
|
58434
|
+
// convertData = isMobile && !readonly ? {
|
|
58435
|
+
// type: "native-date",
|
|
58436
|
+
// pipeIn: (value, data) => {
|
|
58437
|
+
// if (value) {
|
|
58438
|
+
// value = moment(value).utc().format('YYYY-MM-DD');
|
|
58439
|
+
// return value;
|
|
58440
|
+
// } else {
|
|
58441
|
+
// return "";
|
|
58442
|
+
// }
|
|
58443
|
+
|
|
58444
|
+
// },
|
|
58445
|
+
// pipeOut: (value, oldValue, data) => {
|
|
58446
|
+
// if (value) {
|
|
58447
|
+
// value = moment(value).format('YYYY-MM-DDT00:00:00.000[Z]');
|
|
58448
|
+
// return value;
|
|
58449
|
+
// } else {
|
|
58450
|
+
// return "";
|
|
58451
|
+
// }
|
|
58452
|
+
// }
|
|
58453
|
+
// } : {
|
|
58454
|
+
// type: getAmisStaticFieldType('date', readonly),
|
|
58455
|
+
// inputFormat: "YYYY-MM-DD",
|
|
58456
|
+
// format:'YYYY-MM-DDT00:00:00.000[Z]',
|
|
58457
|
+
// tpl: readonly ? Tpl.getDateTpl(field) : null,
|
|
58458
|
+
// // utc: true
|
|
58459
|
+
// }
|
|
58460
|
+
convertData = {
|
|
58456
58461
|
type: getAmisStaticFieldType('date', readonly),
|
|
58457
58462
|
inputFormat: "YYYY-MM-DD",
|
|
58458
58463
|
format:'YYYY-MM-DDT00:00:00.000[Z]',
|
|
@@ -58471,43 +58476,51 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
58471
58476
|
};
|
|
58472
58477
|
break;
|
|
58473
58478
|
case 'datetime':
|
|
58474
|
-
convertData = isMobile && !readonly ? {
|
|
58475
|
-
|
|
58476
|
-
|
|
58477
|
-
|
|
58478
|
-
|
|
58479
|
-
|
|
58480
|
-
|
|
58481
|
-
|
|
58482
|
-
|
|
58483
|
-
|
|
58484
|
-
|
|
58485
|
-
|
|
58486
|
-
|
|
58487
|
-
|
|
58488
|
-
|
|
58489
|
-
|
|
58490
|
-
|
|
58491
|
-
|
|
58492
|
-
|
|
58493
|
-
|
|
58494
|
-
|
|
58495
|
-
|
|
58496
|
-
|
|
58497
|
-
|
|
58498
|
-
|
|
58499
|
-
|
|
58500
|
-
|
|
58501
|
-
|
|
58502
|
-
|
|
58503
|
-
|
|
58504
|
-
|
|
58505
|
-
|
|
58506
|
-
|
|
58507
|
-
|
|
58508
|
-
|
|
58509
|
-
|
|
58510
|
-
} : {
|
|
58479
|
+
// convertData = isMobile && !readonly ? {
|
|
58480
|
+
// type: "combo",
|
|
58481
|
+
// pipeIn: (value, data) => {
|
|
58482
|
+
// let revalue = {};
|
|
58483
|
+
// if (value && value != "Invalid date") {
|
|
58484
|
+
// value = moment(value).format('YYYY-MM-DD HH:mm:ss');
|
|
58485
|
+
// revalue[field.name + "-native-date"] = value.split(' ')[0];
|
|
58486
|
+
// revalue[field.name + "-native-time"] = value.split(' ')[1];
|
|
58487
|
+
// } else {
|
|
58488
|
+
// revalue[field.name + "-native-date"] = "";
|
|
58489
|
+
// revalue[field.name + "-native-time"] = "";
|
|
58490
|
+
// }
|
|
58491
|
+
// return revalue;
|
|
58492
|
+
// },
|
|
58493
|
+
// pipeOut: (value, oldValue, data) => {
|
|
58494
|
+
// let revalue = "";
|
|
58495
|
+
// if (value[field.name + "-native-date"] && value[field.name + "-native-time"]) {
|
|
58496
|
+
// revalue = value[field.name + "-native-date"] + " " + value[field.name + "-native-time"];
|
|
58497
|
+
// revalue = moment(revalue).utc().format('YYYY-MM-DDTHH:mm:ss.SSS[Z]');
|
|
58498
|
+
// }
|
|
58499
|
+
// return revalue;
|
|
58500
|
+
// },
|
|
58501
|
+
// items: [
|
|
58502
|
+
// {
|
|
58503
|
+
// type: "native-date",
|
|
58504
|
+
// name: field.name + "-native-date",
|
|
58505
|
+
// className: "steedos-native-date",
|
|
58506
|
+
// value: ""
|
|
58507
|
+
// },
|
|
58508
|
+
// {
|
|
58509
|
+
// type: "native-time",
|
|
58510
|
+
// name: field.name + "-native-time",
|
|
58511
|
+
// className: "steedos-native-time",
|
|
58512
|
+
// value: ""
|
|
58513
|
+
// }
|
|
58514
|
+
// ]
|
|
58515
|
+
// } : {
|
|
58516
|
+
// type: getAmisStaticFieldType('datetime', readonly),
|
|
58517
|
+
// inputFormat: 'YYYY-MM-DD HH:mm',
|
|
58518
|
+
// format: 'YYYY-MM-DDTHH:mm:ss.SSSZ',
|
|
58519
|
+
// tpl: readonly ? Tpl.getDateTimeTpl(field) : null,
|
|
58520
|
+
// utc: true,
|
|
58521
|
+
// }
|
|
58522
|
+
|
|
58523
|
+
convertData = {
|
|
58511
58524
|
type: getAmisStaticFieldType('datetime', readonly),
|
|
58512
58525
|
inputFormat: 'YYYY-MM-DD HH:mm',
|
|
58513
58526
|
format: 'YYYY-MM-DDTHH:mm:ss.SSSZ',
|
|
@@ -58527,26 +58540,34 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
58527
58540
|
};
|
|
58528
58541
|
break;
|
|
58529
58542
|
case 'time':
|
|
58530
|
-
convertData = isMobile && !readonly ? {
|
|
58531
|
-
|
|
58532
|
-
|
|
58533
|
-
|
|
58534
|
-
|
|
58535
|
-
|
|
58536
|
-
|
|
58537
|
-
|
|
58538
|
-
|
|
58539
|
-
|
|
58540
|
-
|
|
58541
|
-
|
|
58542
|
-
|
|
58543
|
-
|
|
58544
|
-
|
|
58545
|
-
|
|
58546
|
-
|
|
58547
|
-
|
|
58548
|
-
|
|
58549
|
-
} : {
|
|
58543
|
+
// convertData = isMobile && !readonly ? {
|
|
58544
|
+
// type: "native-time",
|
|
58545
|
+
// pipeIn: (value, data) => {
|
|
58546
|
+
// if (value) {
|
|
58547
|
+
// value = moment(value).utc().format('HH:mm');
|
|
58548
|
+
// return value;
|
|
58549
|
+
// } else {
|
|
58550
|
+
// return "";
|
|
58551
|
+
// }
|
|
58552
|
+
|
|
58553
|
+
// },
|
|
58554
|
+
// pipeOut: (value, oldValue, data) => {
|
|
58555
|
+
// if (value) {
|
|
58556
|
+
// value = moment('1970-01-01 ' + value).format('1970-01-01THH:mm:00.000[Z]');
|
|
58557
|
+
// return value;
|
|
58558
|
+
// } else {
|
|
58559
|
+
// return "";
|
|
58560
|
+
// }
|
|
58561
|
+
// }
|
|
58562
|
+
// } : {
|
|
58563
|
+
// type: getAmisStaticFieldType('time', readonly),
|
|
58564
|
+
// inputFormat: 'HH:mm',
|
|
58565
|
+
// timeFormat:'HH:mm',
|
|
58566
|
+
// format:'1970-01-01THH:mm:00.000[Z]',
|
|
58567
|
+
// tpl: readonly ? Tpl.getDateTimeTpl(field) : null,
|
|
58568
|
+
// // utc: true
|
|
58569
|
+
// }
|
|
58570
|
+
convertData = {
|
|
58550
58571
|
type: getAmisStaticFieldType('time', readonly),
|
|
58551
58572
|
inputFormat: 'HH:mm',
|
|
58552
58573
|
timeFormat:'HH:mm',
|
|
@@ -59006,7 +59027,7 @@ var config = {
|
|
|
59006
59027
|
async function getQuickEditSchema(field, options){
|
|
59007
59028
|
//判断在amis3.2以上环境下,放开批量编辑
|
|
59008
59029
|
const isAmisVersionforBatchEdit = amisRequire('amis').version[0] >= 3 && amisRequire('amis').version[2] >= 2;
|
|
59009
|
-
const quickEditId = options.objectName + "_" + field.name + "
|
|
59030
|
+
const quickEditId = options.objectName + "_" + field.name + "_quickEdit";//定义快速编辑的表单id,用于setvalue传值
|
|
59010
59031
|
var quickEditSchema = { body: [], id: quickEditId };
|
|
59011
59032
|
//select,avatar,image,file等组件无法行记录字段赋值,暂不支持批量编辑;
|
|
59012
59033
|
if(field.type != 'avatar' && field.type != 'image' && field.type != 'file' && isAmisVersionforBatchEdit){
|
|
@@ -59016,19 +59037,16 @@ async function getQuickEditSchema(field, options){
|
|
|
59016
59037
|
{
|
|
59017
59038
|
actionType: "custom",
|
|
59018
59039
|
script: `
|
|
59019
|
-
|
|
59020
|
-
|
|
59040
|
+
let items = _.cloneDeep(event.data.items);
|
|
59041
|
+
let selectedItems = _.cloneDeep(event.data.selectedItems);
|
|
59021
59042
|
if(event.data.isBatchEdit){
|
|
59022
59043
|
selectedItems.forEach(function(selectedItem){
|
|
59023
|
-
|
|
59024
|
-
|
|
59025
|
-
doAction({actionType: 'setValue', "args": {"value": {items}},componentId: "${options.crudId}","dataMergeMode": "override"});
|
|
59026
|
-
selectedItems.forEach(function(selectedItem){
|
|
59044
|
+
selectedItem._display.${field.name} = event.data._display.${field.name};
|
|
59045
|
+
doAction({actionType: 'setValue', "args": {"value": selectedItem._display},componentId: "_display_" + selectedItem._index});
|
|
59027
59046
|
doAction({actionType: 'setValue', "args": {"value": event.data.${field.name}},componentId: "${options.objectName + "_" + field.name + "_"}" + selectedItem._index});
|
|
59028
59047
|
})
|
|
59029
59048
|
}else{
|
|
59030
|
-
|
|
59031
|
-
doAction({actionType: 'setValue', "args": {"value": {items}},componentId: "${options.crudId}","dataMergeMode": "override"});
|
|
59049
|
+
doAction({actionType: 'setValue', "args": {"value": event.data._display},componentId: "_display_" + event.data._index});
|
|
59032
59050
|
doAction({actionType: 'setValue', "args": {"value": event.data.${field.name}},componentId: "${options.objectName + "_" + field.name + "_"}" + event.data._index});
|
|
59033
59051
|
}
|
|
59034
59052
|
`
|
|
@@ -59058,7 +59076,7 @@ async function getQuickEditSchema(field, options){
|
|
|
59058
59076
|
{
|
|
59059
59077
|
"actionType": "custom",
|
|
59060
59078
|
"script": `
|
|
59061
|
-
var _display = event.data._display;
|
|
59079
|
+
var _display = _.cloneDeep(event.data._display);
|
|
59062
59080
|
${displayField}
|
|
59063
59081
|
doAction({actionType: 'setValue', "args": {"value": {_display}},componentId: "${quickEditId}"});
|
|
59064
59082
|
`
|
|
@@ -59080,7 +59098,7 @@ async function getQuickEditSchema(field, options){
|
|
|
59080
59098
|
第二种是增加选项时,按照value的值,找到对应选项,并按照_display的规则为其赋值
|
|
59081
59099
|
*/
|
|
59082
59100
|
TempDisplayField = `
|
|
59083
|
-
const preData = event.data.__super.${field.name};
|
|
59101
|
+
const preData = _.cloneDeep(event.data.__super.${field.name});
|
|
59084
59102
|
if(preData && event.data.${field.name}.length < preData.length){
|
|
59085
59103
|
let deletedIndex;
|
|
59086
59104
|
preData.forEach(function(item,index){
|
|
@@ -59279,8 +59297,124 @@ async function getQuickEditSchema(field, options){
|
|
|
59279
59297
|
quickEditSchema.body.push({
|
|
59280
59298
|
"name": "isBatchEdit",
|
|
59281
59299
|
"type": "checkbox",
|
|
59282
|
-
"option":
|
|
59283
|
-
|
|
59300
|
+
"option": [
|
|
59301
|
+
{
|
|
59302
|
+
"type": "tpl",
|
|
59303
|
+
"tpl": "更新${COUNT(selectedItems)}个选定记录"
|
|
59304
|
+
},
|
|
59305
|
+
{
|
|
59306
|
+
"type": "spinner",
|
|
59307
|
+
"showOn": "${batchPermissionLoading}",
|
|
59308
|
+
"size": "sm",
|
|
59309
|
+
"className": "mr-4"
|
|
59310
|
+
}
|
|
59311
|
+
],
|
|
59312
|
+
"visibleOn": "${ARRAYSOME(selectedItems, item => item._id === _id) && COUNT(selectedItems)>1 && quickedit_record_permissions.allowEdit && quickedit_record_permissions_loading == false}",
|
|
59313
|
+
"disabledOn": "${batchPermissionLoading}",
|
|
59314
|
+
"onEvent":{
|
|
59315
|
+
"change":{
|
|
59316
|
+
"actions":[
|
|
59317
|
+
{
|
|
59318
|
+
"actionType": "setValue",
|
|
59319
|
+
"componentId": `service_listview_${options.objectName}`,
|
|
59320
|
+
"args": {
|
|
59321
|
+
"value":{
|
|
59322
|
+
"batchPermissionLoading": true
|
|
59323
|
+
}
|
|
59324
|
+
},
|
|
59325
|
+
"expression":"${event.data.value}"
|
|
59326
|
+
},
|
|
59327
|
+
{
|
|
59328
|
+
"actionType": "ajax",
|
|
59329
|
+
"args": {
|
|
59330
|
+
"api": {
|
|
59331
|
+
"url": "${context.rootUrl}/graphql",
|
|
59332
|
+
"method": "post",
|
|
59333
|
+
"headers": {
|
|
59334
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
59335
|
+
},
|
|
59336
|
+
"data": {
|
|
59337
|
+
"query": "{rows:${objectName}(filters:[\"_id\",\"in\",${selectedItems | pick:_id | split | json}]){_id,_permissions{allowEdit}}}"
|
|
59338
|
+
},
|
|
59339
|
+
"adaptor": `
|
|
59340
|
+
const noPermission = [];
|
|
59341
|
+
payload.data.rows.forEach(function (row) {
|
|
59342
|
+
if(!row._permissions.allowEdit){
|
|
59343
|
+
noPermission.push(row._id);
|
|
59344
|
+
}
|
|
59345
|
+
})
|
|
59346
|
+
return payload = {data:{noPermission}};
|
|
59347
|
+
`
|
|
59348
|
+
}
|
|
59349
|
+
},
|
|
59350
|
+
"expression":"${event.data.value}"
|
|
59351
|
+
},
|
|
59352
|
+
{
|
|
59353
|
+
"actionType": "setValue",
|
|
59354
|
+
"componentId": `service_listview_${options.objectName}`,
|
|
59355
|
+
"args": {
|
|
59356
|
+
"value":{
|
|
59357
|
+
"batchPermissionLoading": false
|
|
59358
|
+
}
|
|
59359
|
+
},
|
|
59360
|
+
"expression":"${event.data.value}"
|
|
59361
|
+
},
|
|
59362
|
+
{
|
|
59363
|
+
"actionType": "dialog",
|
|
59364
|
+
"dialog":{
|
|
59365
|
+
"title": "记录权限",
|
|
59366
|
+
"showCloseButton": false,
|
|
59367
|
+
"body":[
|
|
59368
|
+
{
|
|
59369
|
+
"type": "tpl",
|
|
59370
|
+
"tpl": "当前选中记录中,有${COUNT(noPermission)}条记录无编辑权限,是否需要批量编辑其他记录?"
|
|
59371
|
+
}
|
|
59372
|
+
],
|
|
59373
|
+
"onEvent":{
|
|
59374
|
+
"confirm":{
|
|
59375
|
+
"actions":[
|
|
59376
|
+
{
|
|
59377
|
+
"actionType": "custom",
|
|
59378
|
+
"script": `
|
|
59379
|
+
const noPermission = event.data.noPermission;
|
|
59380
|
+
const crudComponent = event.context.scoped.getComponentById("${options.crudId}");
|
|
59381
|
+
const selectedItems = crudComponent && crudComponent.props.store.selectedItems.concat();
|
|
59382
|
+
noPermission.forEach(function (item) {
|
|
59383
|
+
crudComponent && crudComponent.unSelectItem(_.find(selectedItems,{_id:item}));
|
|
59384
|
+
})
|
|
59385
|
+
`
|
|
59386
|
+
},
|
|
59387
|
+
{
|
|
59388
|
+
"actionType": "setValue",
|
|
59389
|
+
"componentId": quickEditId,
|
|
59390
|
+
"args": {
|
|
59391
|
+
"value":{
|
|
59392
|
+
"isBatchEdit": true
|
|
59393
|
+
}
|
|
59394
|
+
},
|
|
59395
|
+
}
|
|
59396
|
+
]
|
|
59397
|
+
},
|
|
59398
|
+
"cancel":{
|
|
59399
|
+
"actions":[
|
|
59400
|
+
{
|
|
59401
|
+
"actionType": "setValue",
|
|
59402
|
+
"componentId": quickEditId,
|
|
59403
|
+
"args": {
|
|
59404
|
+
"value":{
|
|
59405
|
+
"isBatchEdit": false
|
|
59406
|
+
}
|
|
59407
|
+
},
|
|
59408
|
+
}
|
|
59409
|
+
]
|
|
59410
|
+
}
|
|
59411
|
+
}
|
|
59412
|
+
},
|
|
59413
|
+
"expression":"${COUNT(event.data.noPermission)>0}"
|
|
59414
|
+
}
|
|
59415
|
+
]
|
|
59416
|
+
}
|
|
59417
|
+
}
|
|
59284
59418
|
});
|
|
59285
59419
|
}
|
|
59286
59420
|
} else {
|
|
@@ -59317,6 +59451,8 @@ async function getTableColumns(fields, options){
|
|
|
59317
59451
|
const columns = [];
|
|
59318
59452
|
if(!options.isLookup){
|
|
59319
59453
|
columns.push({name: '_index',type: 'text', width: 32, placeholder: ""});
|
|
59454
|
+
//将_display放入crud的columns中,可以通过setvalue修改行内数据域的_display,而不影响上层items的_display,用于批量编辑
|
|
59455
|
+
columns.push({name: '_display',type: 'static', width: 32, placeholder: "",id: "_display_${_index}", className: "hidden"});
|
|
59320
59456
|
}
|
|
59321
59457
|
const allowEdit = options.permissions?.allowEdit && !options.isLookup && options.enable_inline_edit != false;
|
|
59322
59458
|
|