@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.umd.js
CHANGED
|
@@ -24648,8 +24648,6 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
24648
24648
|
}
|
|
24649
24649
|
|
|
24650
24650
|
async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
24651
|
-
// console.log('convertSFieldToAmisField====>', field, readonly, ctx)
|
|
24652
|
-
const isMobile = window.innerWidth <= 768;
|
|
24653
24651
|
// 创建人和修改人、创建时间和修改时间不显示
|
|
24654
24652
|
if(lodash.exports.includes(OMIT_FIELDS, field.name) && ctx.showSystemFields != true){
|
|
24655
24653
|
return;
|
|
@@ -24738,26 +24736,33 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
24738
24736
|
};
|
|
24739
24737
|
break;
|
|
24740
24738
|
case 'date':
|
|
24741
|
-
convertData = isMobile && !readonly ? {
|
|
24742
|
-
|
|
24743
|
-
|
|
24744
|
-
|
|
24745
|
-
|
|
24746
|
-
|
|
24747
|
-
|
|
24748
|
-
|
|
24749
|
-
|
|
24750
|
-
|
|
24751
|
-
|
|
24752
|
-
|
|
24753
|
-
|
|
24754
|
-
|
|
24755
|
-
|
|
24756
|
-
|
|
24757
|
-
|
|
24758
|
-
|
|
24759
|
-
|
|
24760
|
-
} : {
|
|
24739
|
+
// convertData = isMobile && !readonly ? {
|
|
24740
|
+
// type: "native-date",
|
|
24741
|
+
// pipeIn: (value, data) => {
|
|
24742
|
+
// if (value) {
|
|
24743
|
+
// value = moment(value).utc().format('YYYY-MM-DD');
|
|
24744
|
+
// return value;
|
|
24745
|
+
// } else {
|
|
24746
|
+
// return "";
|
|
24747
|
+
// }
|
|
24748
|
+
|
|
24749
|
+
// },
|
|
24750
|
+
// pipeOut: (value, oldValue, data) => {
|
|
24751
|
+
// if (value) {
|
|
24752
|
+
// value = moment(value).format('YYYY-MM-DDT00:00:00.000[Z]');
|
|
24753
|
+
// return value;
|
|
24754
|
+
// } else {
|
|
24755
|
+
// return "";
|
|
24756
|
+
// }
|
|
24757
|
+
// }
|
|
24758
|
+
// } : {
|
|
24759
|
+
// type: getAmisStaticFieldType('date', readonly),
|
|
24760
|
+
// inputFormat: "YYYY-MM-DD",
|
|
24761
|
+
// format:'YYYY-MM-DDT00:00:00.000[Z]',
|
|
24762
|
+
// tpl: readonly ? Tpl.getDateTpl(field) : null,
|
|
24763
|
+
// // utc: true
|
|
24764
|
+
// }
|
|
24765
|
+
convertData = {
|
|
24761
24766
|
type: getAmisStaticFieldType('date', readonly),
|
|
24762
24767
|
inputFormat: "YYYY-MM-DD",
|
|
24763
24768
|
format:'YYYY-MM-DDT00:00:00.000[Z]',
|
|
@@ -24776,43 +24781,51 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
24776
24781
|
};
|
|
24777
24782
|
break;
|
|
24778
24783
|
case 'datetime':
|
|
24779
|
-
convertData = isMobile && !readonly ? {
|
|
24780
|
-
|
|
24781
|
-
|
|
24782
|
-
|
|
24783
|
-
|
|
24784
|
-
|
|
24785
|
-
|
|
24786
|
-
|
|
24787
|
-
|
|
24788
|
-
|
|
24789
|
-
|
|
24790
|
-
|
|
24791
|
-
|
|
24792
|
-
|
|
24793
|
-
|
|
24794
|
-
|
|
24795
|
-
|
|
24796
|
-
|
|
24797
|
-
|
|
24798
|
-
|
|
24799
|
-
|
|
24800
|
-
|
|
24801
|
-
|
|
24802
|
-
|
|
24803
|
-
|
|
24804
|
-
|
|
24805
|
-
|
|
24806
|
-
|
|
24807
|
-
|
|
24808
|
-
|
|
24809
|
-
|
|
24810
|
-
|
|
24811
|
-
|
|
24812
|
-
|
|
24813
|
-
|
|
24814
|
-
|
|
24815
|
-
} : {
|
|
24784
|
+
// convertData = isMobile && !readonly ? {
|
|
24785
|
+
// type: "combo",
|
|
24786
|
+
// pipeIn: (value, data) => {
|
|
24787
|
+
// let revalue = {};
|
|
24788
|
+
// if (value && value != "Invalid date") {
|
|
24789
|
+
// value = moment(value).format('YYYY-MM-DD HH:mm:ss');
|
|
24790
|
+
// revalue[field.name + "-native-date"] = value.split(' ')[0];
|
|
24791
|
+
// revalue[field.name + "-native-time"] = value.split(' ')[1];
|
|
24792
|
+
// } else {
|
|
24793
|
+
// revalue[field.name + "-native-date"] = "";
|
|
24794
|
+
// revalue[field.name + "-native-time"] = "";
|
|
24795
|
+
// }
|
|
24796
|
+
// return revalue;
|
|
24797
|
+
// },
|
|
24798
|
+
// pipeOut: (value, oldValue, data) => {
|
|
24799
|
+
// let revalue = "";
|
|
24800
|
+
// if (value[field.name + "-native-date"] && value[field.name + "-native-time"]) {
|
|
24801
|
+
// revalue = value[field.name + "-native-date"] + " " + value[field.name + "-native-time"];
|
|
24802
|
+
// revalue = moment(revalue).utc().format('YYYY-MM-DDTHH:mm:ss.SSS[Z]');
|
|
24803
|
+
// }
|
|
24804
|
+
// return revalue;
|
|
24805
|
+
// },
|
|
24806
|
+
// items: [
|
|
24807
|
+
// {
|
|
24808
|
+
// type: "native-date",
|
|
24809
|
+
// name: field.name + "-native-date",
|
|
24810
|
+
// className: "steedos-native-date",
|
|
24811
|
+
// value: ""
|
|
24812
|
+
// },
|
|
24813
|
+
// {
|
|
24814
|
+
// type: "native-time",
|
|
24815
|
+
// name: field.name + "-native-time",
|
|
24816
|
+
// className: "steedos-native-time",
|
|
24817
|
+
// value: ""
|
|
24818
|
+
// }
|
|
24819
|
+
// ]
|
|
24820
|
+
// } : {
|
|
24821
|
+
// type: getAmisStaticFieldType('datetime', readonly),
|
|
24822
|
+
// inputFormat: 'YYYY-MM-DD HH:mm',
|
|
24823
|
+
// format: 'YYYY-MM-DDTHH:mm:ss.SSSZ',
|
|
24824
|
+
// tpl: readonly ? Tpl.getDateTimeTpl(field) : null,
|
|
24825
|
+
// utc: true,
|
|
24826
|
+
// }
|
|
24827
|
+
|
|
24828
|
+
convertData = {
|
|
24816
24829
|
type: getAmisStaticFieldType('datetime', readonly),
|
|
24817
24830
|
inputFormat: 'YYYY-MM-DD HH:mm',
|
|
24818
24831
|
format: 'YYYY-MM-DDTHH:mm:ss.SSSZ',
|
|
@@ -24832,26 +24845,34 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
24832
24845
|
};
|
|
24833
24846
|
break;
|
|
24834
24847
|
case 'time':
|
|
24835
|
-
convertData = isMobile && !readonly ? {
|
|
24836
|
-
|
|
24837
|
-
|
|
24838
|
-
|
|
24839
|
-
|
|
24840
|
-
|
|
24841
|
-
|
|
24842
|
-
|
|
24843
|
-
|
|
24844
|
-
|
|
24845
|
-
|
|
24846
|
-
|
|
24847
|
-
|
|
24848
|
-
|
|
24849
|
-
|
|
24850
|
-
|
|
24851
|
-
|
|
24852
|
-
|
|
24853
|
-
|
|
24854
|
-
} : {
|
|
24848
|
+
// convertData = isMobile && !readonly ? {
|
|
24849
|
+
// type: "native-time",
|
|
24850
|
+
// pipeIn: (value, data) => {
|
|
24851
|
+
// if (value) {
|
|
24852
|
+
// value = moment(value).utc().format('HH:mm');
|
|
24853
|
+
// return value;
|
|
24854
|
+
// } else {
|
|
24855
|
+
// return "";
|
|
24856
|
+
// }
|
|
24857
|
+
|
|
24858
|
+
// },
|
|
24859
|
+
// pipeOut: (value, oldValue, data) => {
|
|
24860
|
+
// if (value) {
|
|
24861
|
+
// value = moment('1970-01-01 ' + value).format('1970-01-01THH:mm:00.000[Z]');
|
|
24862
|
+
// return value;
|
|
24863
|
+
// } else {
|
|
24864
|
+
// return "";
|
|
24865
|
+
// }
|
|
24866
|
+
// }
|
|
24867
|
+
// } : {
|
|
24868
|
+
// type: getAmisStaticFieldType('time', readonly),
|
|
24869
|
+
// inputFormat: 'HH:mm',
|
|
24870
|
+
// timeFormat:'HH:mm',
|
|
24871
|
+
// format:'1970-01-01THH:mm:00.000[Z]',
|
|
24872
|
+
// tpl: readonly ? Tpl.getDateTimeTpl(field) : null,
|
|
24873
|
+
// // utc: true
|
|
24874
|
+
// }
|
|
24875
|
+
convertData = {
|
|
24855
24876
|
type: getAmisStaticFieldType('time', readonly),
|
|
24856
24877
|
inputFormat: 'HH:mm',
|
|
24857
24878
|
timeFormat:'HH:mm',
|
|
@@ -25311,7 +25332,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
25311
25332
|
async function getQuickEditSchema(field, options){
|
|
25312
25333
|
//判断在amis3.2以上环境下,放开批量编辑
|
|
25313
25334
|
const isAmisVersionforBatchEdit = amisRequire('amis').version[0] >= 3 && amisRequire('amis').version[2] >= 2;
|
|
25314
|
-
const quickEditId = options.objectName + "_" + field.name + "
|
|
25335
|
+
const quickEditId = options.objectName + "_" + field.name + "_quickEdit";//定义快速编辑的表单id,用于setvalue传值
|
|
25315
25336
|
var quickEditSchema = { body: [], id: quickEditId };
|
|
25316
25337
|
//select,avatar,image,file等组件无法行记录字段赋值,暂不支持批量编辑;
|
|
25317
25338
|
if(field.type != 'avatar' && field.type != 'image' && field.type != 'file' && isAmisVersionforBatchEdit){
|
|
@@ -25321,19 +25342,16 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
25321
25342
|
{
|
|
25322
25343
|
actionType: "custom",
|
|
25323
25344
|
script: `
|
|
25324
|
-
|
|
25325
|
-
|
|
25345
|
+
let items = _.cloneDeep(event.data.items);
|
|
25346
|
+
let selectedItems = _.cloneDeep(event.data.selectedItems);
|
|
25326
25347
|
if(event.data.isBatchEdit){
|
|
25327
25348
|
selectedItems.forEach(function(selectedItem){
|
|
25328
|
-
|
|
25329
|
-
|
|
25330
|
-
doAction({actionType: 'setValue', "args": {"value": {items}},componentId: "${options.crudId}","dataMergeMode": "override"});
|
|
25331
|
-
selectedItems.forEach(function(selectedItem){
|
|
25349
|
+
selectedItem._display.${field.name} = event.data._display.${field.name};
|
|
25350
|
+
doAction({actionType: 'setValue', "args": {"value": selectedItem._display},componentId: "_display_" + selectedItem._index});
|
|
25332
25351
|
doAction({actionType: 'setValue', "args": {"value": event.data.${field.name}},componentId: "${options.objectName + "_" + field.name + "_"}" + selectedItem._index});
|
|
25333
25352
|
})
|
|
25334
25353
|
}else{
|
|
25335
|
-
|
|
25336
|
-
doAction({actionType: 'setValue', "args": {"value": {items}},componentId: "${options.crudId}","dataMergeMode": "override"});
|
|
25354
|
+
doAction({actionType: 'setValue', "args": {"value": event.data._display},componentId: "_display_" + event.data._index});
|
|
25337
25355
|
doAction({actionType: 'setValue', "args": {"value": event.data.${field.name}},componentId: "${options.objectName + "_" + field.name + "_"}" + event.data._index});
|
|
25338
25356
|
}
|
|
25339
25357
|
`
|
|
@@ -25363,7 +25381,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
25363
25381
|
{
|
|
25364
25382
|
"actionType": "custom",
|
|
25365
25383
|
"script": `
|
|
25366
|
-
var _display = event.data._display;
|
|
25384
|
+
var _display = _.cloneDeep(event.data._display);
|
|
25367
25385
|
${displayField}
|
|
25368
25386
|
doAction({actionType: 'setValue', "args": {"value": {_display}},componentId: "${quickEditId}"});
|
|
25369
25387
|
`
|
|
@@ -25385,7 +25403,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
25385
25403
|
第二种是增加选项时,按照value的值,找到对应选项,并按照_display的规则为其赋值
|
|
25386
25404
|
*/
|
|
25387
25405
|
TempDisplayField = `
|
|
25388
|
-
const preData = event.data.__super.${field.name};
|
|
25406
|
+
const preData = _.cloneDeep(event.data.__super.${field.name});
|
|
25389
25407
|
if(preData && event.data.${field.name}.length < preData.length){
|
|
25390
25408
|
let deletedIndex;
|
|
25391
25409
|
preData.forEach(function(item,index){
|
|
@@ -25584,8 +25602,124 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
25584
25602
|
quickEditSchema.body.push({
|
|
25585
25603
|
"name": "isBatchEdit",
|
|
25586
25604
|
"type": "checkbox",
|
|
25587
|
-
"option":
|
|
25588
|
-
|
|
25605
|
+
"option": [
|
|
25606
|
+
{
|
|
25607
|
+
"type": "tpl",
|
|
25608
|
+
"tpl": "更新${COUNT(selectedItems)}个选定记录"
|
|
25609
|
+
},
|
|
25610
|
+
{
|
|
25611
|
+
"type": "spinner",
|
|
25612
|
+
"showOn": "${batchPermissionLoading}",
|
|
25613
|
+
"size": "sm",
|
|
25614
|
+
"className": "mr-4"
|
|
25615
|
+
}
|
|
25616
|
+
],
|
|
25617
|
+
"visibleOn": "${ARRAYSOME(selectedItems, item => item._id === _id) && COUNT(selectedItems)>1 && quickedit_record_permissions.allowEdit && quickedit_record_permissions_loading == false}",
|
|
25618
|
+
"disabledOn": "${batchPermissionLoading}",
|
|
25619
|
+
"onEvent":{
|
|
25620
|
+
"change":{
|
|
25621
|
+
"actions":[
|
|
25622
|
+
{
|
|
25623
|
+
"actionType": "setValue",
|
|
25624
|
+
"componentId": `service_listview_${options.objectName}`,
|
|
25625
|
+
"args": {
|
|
25626
|
+
"value":{
|
|
25627
|
+
"batchPermissionLoading": true
|
|
25628
|
+
}
|
|
25629
|
+
},
|
|
25630
|
+
"expression":"${event.data.value}"
|
|
25631
|
+
},
|
|
25632
|
+
{
|
|
25633
|
+
"actionType": "ajax",
|
|
25634
|
+
"args": {
|
|
25635
|
+
"api": {
|
|
25636
|
+
"url": "${context.rootUrl}/graphql",
|
|
25637
|
+
"method": "post",
|
|
25638
|
+
"headers": {
|
|
25639
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
25640
|
+
},
|
|
25641
|
+
"data": {
|
|
25642
|
+
"query": "{rows:${objectName}(filters:[\"_id\",\"in\",${selectedItems | pick:_id | split | json}]){_id,_permissions{allowEdit}}}"
|
|
25643
|
+
},
|
|
25644
|
+
"adaptor": `
|
|
25645
|
+
const noPermission = [];
|
|
25646
|
+
payload.data.rows.forEach(function (row) {
|
|
25647
|
+
if(!row._permissions.allowEdit){
|
|
25648
|
+
noPermission.push(row._id);
|
|
25649
|
+
}
|
|
25650
|
+
})
|
|
25651
|
+
return payload = {data:{noPermission}};
|
|
25652
|
+
`
|
|
25653
|
+
}
|
|
25654
|
+
},
|
|
25655
|
+
"expression":"${event.data.value}"
|
|
25656
|
+
},
|
|
25657
|
+
{
|
|
25658
|
+
"actionType": "setValue",
|
|
25659
|
+
"componentId": `service_listview_${options.objectName}`,
|
|
25660
|
+
"args": {
|
|
25661
|
+
"value":{
|
|
25662
|
+
"batchPermissionLoading": false
|
|
25663
|
+
}
|
|
25664
|
+
},
|
|
25665
|
+
"expression":"${event.data.value}"
|
|
25666
|
+
},
|
|
25667
|
+
{
|
|
25668
|
+
"actionType": "dialog",
|
|
25669
|
+
"dialog":{
|
|
25670
|
+
"title": "记录权限",
|
|
25671
|
+
"showCloseButton": false,
|
|
25672
|
+
"body":[
|
|
25673
|
+
{
|
|
25674
|
+
"type": "tpl",
|
|
25675
|
+
"tpl": "当前选中记录中,有${COUNT(noPermission)}条记录无编辑权限,是否需要批量编辑其他记录?"
|
|
25676
|
+
}
|
|
25677
|
+
],
|
|
25678
|
+
"onEvent":{
|
|
25679
|
+
"confirm":{
|
|
25680
|
+
"actions":[
|
|
25681
|
+
{
|
|
25682
|
+
"actionType": "custom",
|
|
25683
|
+
"script": `
|
|
25684
|
+
const noPermission = event.data.noPermission;
|
|
25685
|
+
const crudComponent = event.context.scoped.getComponentById("${options.crudId}");
|
|
25686
|
+
const selectedItems = crudComponent && crudComponent.props.store.selectedItems.concat();
|
|
25687
|
+
noPermission.forEach(function (item) {
|
|
25688
|
+
crudComponent && crudComponent.unSelectItem(_.find(selectedItems,{_id:item}));
|
|
25689
|
+
})
|
|
25690
|
+
`
|
|
25691
|
+
},
|
|
25692
|
+
{
|
|
25693
|
+
"actionType": "setValue",
|
|
25694
|
+
"componentId": quickEditId,
|
|
25695
|
+
"args": {
|
|
25696
|
+
"value":{
|
|
25697
|
+
"isBatchEdit": true
|
|
25698
|
+
}
|
|
25699
|
+
},
|
|
25700
|
+
}
|
|
25701
|
+
]
|
|
25702
|
+
},
|
|
25703
|
+
"cancel":{
|
|
25704
|
+
"actions":[
|
|
25705
|
+
{
|
|
25706
|
+
"actionType": "setValue",
|
|
25707
|
+
"componentId": quickEditId,
|
|
25708
|
+
"args": {
|
|
25709
|
+
"value":{
|
|
25710
|
+
"isBatchEdit": false
|
|
25711
|
+
}
|
|
25712
|
+
},
|
|
25713
|
+
}
|
|
25714
|
+
]
|
|
25715
|
+
}
|
|
25716
|
+
}
|
|
25717
|
+
},
|
|
25718
|
+
"expression":"${COUNT(event.data.noPermission)>0}"
|
|
25719
|
+
}
|
|
25720
|
+
]
|
|
25721
|
+
}
|
|
25722
|
+
}
|
|
25589
25723
|
});
|
|
25590
25724
|
}
|
|
25591
25725
|
} else {
|
|
@@ -25622,6 +25756,8 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
25622
25756
|
const columns = [];
|
|
25623
25757
|
if(!options.isLookup){
|
|
25624
25758
|
columns.push({name: '_index',type: 'text', width: 32, placeholder: ""});
|
|
25759
|
+
//将_display放入crud的columns中,可以通过setvalue修改行内数据域的_display,而不影响上层items的_display,用于批量编辑
|
|
25760
|
+
columns.push({name: '_display',type: 'static', width: 32, placeholder: "",id: "_display_${_index}", className: "hidden"});
|
|
25625
25761
|
}
|
|
25626
25762
|
const allowEdit = options.permissions?.allowEdit && !options.isLookup && options.enable_inline_edit != false;
|
|
25627
25763
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@steedos-widgets/sortable",
|
|
3
|
-
"version": "1.3.4-beta.
|
|
3
|
+
"version": "1.3.4-beta.21",
|
|
4
4
|
"main": "dist/sortable.cjs.js",
|
|
5
5
|
"module": "dist/sortable.esm.js",
|
|
6
6
|
"unpkg": "dist/sortable.umd.js",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@dnd-kit/core": "^6.0.5",
|
|
47
47
|
"@dnd-kit/sortable": "^7.0.1",
|
|
48
|
-
"@steedos-widgets/amis-lib": "1.3.4-beta.
|
|
48
|
+
"@steedos-widgets/amis-lib": "1.3.4-beta.21"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "bff2dfd927dcf5dcca65232be1b67687393fb9c6"
|
|
51
51
|
}
|