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