@steedos-widgets/sortable 1.3.4-beta.19 → 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 +232 -94
- package/dist/sortable.cjs.js.map +1 -1
- package/dist/sortable.esm.js +232 -94
- package/dist/sortable.esm.js.map +1 -1
- package/dist/sortable.umd.js +232 -94
- package/package.json +3 -3
package/dist/sortable.umd.js
CHANGED
|
@@ -21518,7 +21518,8 @@
|
|
|
21518
21518
|
if(isLookup){
|
|
21519
21519
|
searchableFieldsStoreKey += "/lookup/" + objectName;
|
|
21520
21520
|
}
|
|
21521
|
-
|
|
21521
|
+
searchableFieldsStoreKey = searchableFieldsStoreKey + "/" + (data.context && data.context.userId);
|
|
21522
|
+
let defaultSearchableFields = localStorage.getItem(searchableFieldsStoreKey);
|
|
21522
21523
|
if(defaultSearchableFields){
|
|
21523
21524
|
defaultSearchableFields = defaultSearchableFields.split(",");
|
|
21524
21525
|
}
|
|
@@ -21587,7 +21588,8 @@
|
|
|
21587
21588
|
if(isLookup){
|
|
21588
21589
|
searchableFieldsStoreKey += "/lookup/" + objectName;
|
|
21589
21590
|
}
|
|
21590
|
-
|
|
21591
|
+
searchableFieldsStoreKey = searchableFieldsStoreKey + "/" + (data.context && data.context.userId);
|
|
21592
|
+
localStorage.setItem(searchableFieldsStoreKey, value);
|
|
21591
21593
|
|
|
21592
21594
|
// ===START===:当变更可搜索字段时,如果被移除的可搜索字段在本地存储中已经存入过滤条件中则应该清除本地存储中相关字段的过滤条件。
|
|
21593
21595
|
const searchableFields = data.fields;
|
|
@@ -24646,8 +24648,6 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
24646
24648
|
}
|
|
24647
24649
|
|
|
24648
24650
|
async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
24649
|
-
// console.log('convertSFieldToAmisField====>', field, readonly, ctx)
|
|
24650
|
-
const isMobile = window.innerWidth <= 768;
|
|
24651
24651
|
// 创建人和修改人、创建时间和修改时间不显示
|
|
24652
24652
|
if(lodash.exports.includes(OMIT_FIELDS, field.name) && ctx.showSystemFields != true){
|
|
24653
24653
|
return;
|
|
@@ -24736,26 +24736,33 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
24736
24736
|
};
|
|
24737
24737
|
break;
|
|
24738
24738
|
case 'date':
|
|
24739
|
-
convertData = isMobile && !readonly ? {
|
|
24740
|
-
|
|
24741
|
-
|
|
24742
|
-
|
|
24743
|
-
|
|
24744
|
-
|
|
24745
|
-
|
|
24746
|
-
|
|
24747
|
-
|
|
24748
|
-
|
|
24749
|
-
|
|
24750
|
-
|
|
24751
|
-
|
|
24752
|
-
|
|
24753
|
-
|
|
24754
|
-
|
|
24755
|
-
|
|
24756
|
-
|
|
24757
|
-
|
|
24758
|
-
} : {
|
|
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 = {
|
|
24759
24766
|
type: getAmisStaticFieldType('date', readonly),
|
|
24760
24767
|
inputFormat: "YYYY-MM-DD",
|
|
24761
24768
|
format:'YYYY-MM-DDT00:00:00.000[Z]',
|
|
@@ -24774,43 +24781,51 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
24774
24781
|
};
|
|
24775
24782
|
break;
|
|
24776
24783
|
case 'datetime':
|
|
24777
|
-
convertData = isMobile && !readonly ? {
|
|
24778
|
-
|
|
24779
|
-
|
|
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
|
-
} : {
|
|
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 = {
|
|
24814
24829
|
type: getAmisStaticFieldType('datetime', readonly),
|
|
24815
24830
|
inputFormat: 'YYYY-MM-DD HH:mm',
|
|
24816
24831
|
format: 'YYYY-MM-DDTHH:mm:ss.SSSZ',
|
|
@@ -24830,26 +24845,34 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
24830
24845
|
};
|
|
24831
24846
|
break;
|
|
24832
24847
|
case 'time':
|
|
24833
|
-
convertData = isMobile && !readonly ? {
|
|
24834
|
-
|
|
24835
|
-
|
|
24836
|
-
|
|
24837
|
-
|
|
24838
|
-
|
|
24839
|
-
|
|
24840
|
-
|
|
24841
|
-
|
|
24842
|
-
|
|
24843
|
-
|
|
24844
|
-
|
|
24845
|
-
|
|
24846
|
-
|
|
24847
|
-
|
|
24848
|
-
|
|
24849
|
-
|
|
24850
|
-
|
|
24851
|
-
|
|
24852
|
-
} : {
|
|
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 = {
|
|
24853
24876
|
type: getAmisStaticFieldType('time', readonly),
|
|
24854
24877
|
inputFormat: 'HH:mm',
|
|
24855
24878
|
timeFormat:'HH:mm',
|
|
@@ -25309,7 +25332,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
25309
25332
|
async function getQuickEditSchema(field, options){
|
|
25310
25333
|
//判断在amis3.2以上环境下,放开批量编辑
|
|
25311
25334
|
const isAmisVersionforBatchEdit = amisRequire('amis').version[0] >= 3 && amisRequire('amis').version[2] >= 2;
|
|
25312
|
-
const quickEditId = options.objectName + "_" + field.name + "
|
|
25335
|
+
const quickEditId = options.objectName + "_" + field.name + "_quickEdit";//定义快速编辑的表单id,用于setvalue传值
|
|
25313
25336
|
var quickEditSchema = { body: [], id: quickEditId };
|
|
25314
25337
|
//select,avatar,image,file等组件无法行记录字段赋值,暂不支持批量编辑;
|
|
25315
25338
|
if(field.type != 'avatar' && field.type != 'image' && field.type != 'file' && isAmisVersionforBatchEdit){
|
|
@@ -25319,19 +25342,16 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
25319
25342
|
{
|
|
25320
25343
|
actionType: "custom",
|
|
25321
25344
|
script: `
|
|
25322
|
-
|
|
25323
|
-
|
|
25345
|
+
let items = _.cloneDeep(event.data.items);
|
|
25346
|
+
let selectedItems = _.cloneDeep(event.data.selectedItems);
|
|
25324
25347
|
if(event.data.isBatchEdit){
|
|
25325
25348
|
selectedItems.forEach(function(selectedItem){
|
|
25326
|
-
|
|
25327
|
-
|
|
25328
|
-
doAction({actionType: 'setValue', "args": {"value": {items}},componentId: "${options.crudId}","dataMergeMode": "override"});
|
|
25329
|
-
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});
|
|
25330
25351
|
doAction({actionType: 'setValue', "args": {"value": event.data.${field.name}},componentId: "${options.objectName + "_" + field.name + "_"}" + selectedItem._index});
|
|
25331
25352
|
})
|
|
25332
25353
|
}else{
|
|
25333
|
-
|
|
25334
|
-
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});
|
|
25335
25355
|
doAction({actionType: 'setValue', "args": {"value": event.data.${field.name}},componentId: "${options.objectName + "_" + field.name + "_"}" + event.data._index});
|
|
25336
25356
|
}
|
|
25337
25357
|
`
|
|
@@ -25361,7 +25381,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
25361
25381
|
{
|
|
25362
25382
|
"actionType": "custom",
|
|
25363
25383
|
"script": `
|
|
25364
|
-
var _display = event.data._display;
|
|
25384
|
+
var _display = _.cloneDeep(event.data._display);
|
|
25365
25385
|
${displayField}
|
|
25366
25386
|
doAction({actionType: 'setValue', "args": {"value": {_display}},componentId: "${quickEditId}"});
|
|
25367
25387
|
`
|
|
@@ -25383,7 +25403,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
25383
25403
|
第二种是增加选项时,按照value的值,找到对应选项,并按照_display的规则为其赋值
|
|
25384
25404
|
*/
|
|
25385
25405
|
TempDisplayField = `
|
|
25386
|
-
const preData = event.data.__super.${field.name};
|
|
25406
|
+
const preData = _.cloneDeep(event.data.__super.${field.name});
|
|
25387
25407
|
if(preData && event.data.${field.name}.length < preData.length){
|
|
25388
25408
|
let deletedIndex;
|
|
25389
25409
|
preData.forEach(function(item,index){
|
|
@@ -25582,8 +25602,124 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
25582
25602
|
quickEditSchema.body.push({
|
|
25583
25603
|
"name": "isBatchEdit",
|
|
25584
25604
|
"type": "checkbox",
|
|
25585
|
-
"option":
|
|
25586
|
-
|
|
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
|
+
}
|
|
25587
25723
|
});
|
|
25588
25724
|
}
|
|
25589
25725
|
} else {
|
|
@@ -25620,6 +25756,8 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
25620
25756
|
const columns = [];
|
|
25621
25757
|
if(!options.isLookup){
|
|
25622
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"});
|
|
25623
25761
|
}
|
|
25624
25762
|
const allowEdit = options.permissions?.allowEdit && !options.isLookup && options.enable_inline_edit != false;
|
|
25625
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
|
}
|