@steedos-widgets/sortable 1.3.4-beta.9 → 1.3.5
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 +479 -139
- package/dist/sortable.cjs.js.map +1 -1
- package/dist/sortable.esm.js +479 -139
- package/dist/sortable.esm.js.map +1 -1
- package/dist/sortable.umd.js +479 -139
- package/package.json +3 -3
- package/src/components/MultipleContainers.tsx +59 -23
package/dist/sortable.esm.js
CHANGED
|
@@ -54076,7 +54076,7 @@ function getSelectMap(selectOptions){
|
|
|
54076
54076
|
if(optionColor){
|
|
54077
54077
|
const background = optionColor.charAt(0) === '#' ? optionColor : '#'+optionColor;
|
|
54078
54078
|
const color = getContrastColor(background);
|
|
54079
|
-
const optionColorStyle = 'background:'+background+';color:'+color;
|
|
54079
|
+
const optionColorStyle = 'background:'+background+';color:'+color+';line-height:1.5rem';
|
|
54080
54080
|
map[optionValue] = `<span class="rounded-xl px-2 py-1" style='${optionColorStyle}'>${option.label}</span>`;
|
|
54081
54081
|
}else {
|
|
54082
54082
|
map[optionValue] = option.label;
|
|
@@ -54337,17 +54337,17 @@ async function getFindQuery(object, recordId, fields, options){
|
|
|
54337
54337
|
}
|
|
54338
54338
|
|
|
54339
54339
|
const countQuery = options.count === false ? "" : `,count:${object.name}__count(filters:{__filters})`;
|
|
54340
|
-
const moreQuerie = options.moreQueries?.length ? ("," + options.moreQueries.map(function(item){
|
|
54341
|
-
|
|
54342
|
-
|
|
54343
|
-
}).join(",")) : "";
|
|
54340
|
+
// const moreQuerie = options.moreQueries?.length ? ("," + options.moreQueries.map(function(item){
|
|
54341
|
+
// // 把最外层的{}去除
|
|
54342
|
+
// return item.replace(/^{/,"").replace(/}$/,"");
|
|
54343
|
+
// }).join(",")) : "";
|
|
54344
54344
|
|
|
54345
54345
|
return {
|
|
54346
54346
|
orderBy: "${orderBy}",
|
|
54347
54347
|
orderDir: "${orderDir}",
|
|
54348
54348
|
pageNo: "${page}",
|
|
54349
54349
|
pageSize: "${perPage}",
|
|
54350
|
-
query: `{${alias}:${object.name}${queryOptions}{${await getFieldsTemplate(fields, options.expand)}${treeFields}${cfsFields}}${countQuery}
|
|
54350
|
+
query: `{${alias}:${object.name}${queryOptions}{${await getFieldsTemplate(fields, options.expand)}${treeFields}${cfsFields}}${countQuery}}`
|
|
54351
54351
|
}
|
|
54352
54352
|
}
|
|
54353
54353
|
|
|
@@ -55213,7 +55213,8 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
55213
55213
|
if(isLookup){
|
|
55214
55214
|
searchableFieldsStoreKey += "/lookup/" + objectName;
|
|
55215
55215
|
}
|
|
55216
|
-
|
|
55216
|
+
searchableFieldsStoreKey = searchableFieldsStoreKey + "/" + (data.context && data.context.userId);
|
|
55217
|
+
let defaultSearchableFields = localStorage.getItem(searchableFieldsStoreKey);
|
|
55217
55218
|
if(defaultSearchableFields){
|
|
55218
55219
|
defaultSearchableFields = defaultSearchableFields.split(",");
|
|
55219
55220
|
}
|
|
@@ -55282,7 +55283,8 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
55282
55283
|
if(isLookup){
|
|
55283
55284
|
searchableFieldsStoreKey += "/lookup/" + objectName;
|
|
55284
55285
|
}
|
|
55285
|
-
|
|
55286
|
+
searchableFieldsStoreKey = searchableFieldsStoreKey + "/" + (data.context && data.context.userId);
|
|
55287
|
+
localStorage.setItem(searchableFieldsStoreKey, value);
|
|
55286
55288
|
|
|
55287
55289
|
// ===START===:当变更可搜索字段时,如果被移除的可搜索字段在本地存储中已经存入过滤条件中则应该清除本地存储中相关字段的过滤条件。
|
|
55288
55290
|
const searchableFields = data.fields;
|
|
@@ -55788,7 +55790,8 @@ const getCopyListviewButtonSchema = ()=>{
|
|
|
55788
55790
|
"&": "${list_view}",
|
|
55789
55791
|
"name":"",
|
|
55790
55792
|
"label": instance.t('frontend_listview_control_clone_defaultData_label_start') + " ${list_view.label} " + instance.t('frontend_listview_control_clone_defaultData_label_end'),
|
|
55791
|
-
"shared":false
|
|
55793
|
+
"shared":false,
|
|
55794
|
+
"object_name": "${targetObjectName}",
|
|
55792
55795
|
},
|
|
55793
55796
|
"fieldsExtend": fieldsExtend$3(),
|
|
55794
55797
|
"fields": fields(),
|
|
@@ -56576,7 +56579,7 @@ let resizeWindow = function(){
|
|
|
56576
56579
|
//触发amis crud 高度重算
|
|
56577
56580
|
setTimeout(()=>{
|
|
56578
56581
|
window.dispatchEvent(new Event("resize"))
|
|
56579
|
-
},
|
|
56582
|
+
}, 1000);
|
|
56580
56583
|
}
|
|
56581
56584
|
resizeWindow();
|
|
56582
56585
|
// 手机端在显示搜索栏时隐藏crud上的刷新按钮,因为点击后crud高度显示有问题
|
|
@@ -56813,6 +56816,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
|
|
|
56813
56816
|
}
|
|
56814
56817
|
|
|
56815
56818
|
function getObjectFooterToolbar(mainObject, formFactor, options) {
|
|
56819
|
+
// crud card模式与table模式两种情况下showPageInput默认值不一样,所以需要显式设置为false
|
|
56816
56820
|
if (formFactor === 'SMALL') {
|
|
56817
56821
|
// return [
|
|
56818
56822
|
// "load-more",
|
|
@@ -56822,14 +56826,17 @@ function getObjectFooterToolbar(mainObject, formFactor, options) {
|
|
|
56822
56826
|
"switch-per-page",
|
|
56823
56827
|
{
|
|
56824
56828
|
"type": "pagination",
|
|
56825
|
-
"maxButtons": 5
|
|
56829
|
+
"maxButtons": 5,
|
|
56830
|
+
"showPageInput": false
|
|
56826
56831
|
}
|
|
56827
56832
|
]
|
|
56828
56833
|
}else {
|
|
56829
56834
|
return [
|
|
56835
|
+
// "statistics",
|
|
56830
56836
|
{
|
|
56831
56837
|
"type": "pagination",
|
|
56832
|
-
"maxButtons": 5
|
|
56838
|
+
"maxButtons": 5,
|
|
56839
|
+
"showPageInput": false
|
|
56833
56840
|
}
|
|
56834
56841
|
]
|
|
56835
56842
|
}
|
|
@@ -56838,16 +56845,31 @@ function getObjectFooterToolbar(mainObject, formFactor, options) {
|
|
|
56838
56845
|
if(options && options.isRelated){
|
|
56839
56846
|
return [
|
|
56840
56847
|
"statistics",
|
|
56841
|
-
|
|
56848
|
+
{
|
|
56849
|
+
"type": "pagination",
|
|
56850
|
+
"maxButtons": 10,
|
|
56851
|
+
"showPageInput": false
|
|
56852
|
+
}
|
|
56842
56853
|
]
|
|
56843
56854
|
|
|
56844
56855
|
}
|
|
56845
56856
|
else {
|
|
56846
|
-
|
|
56847
|
-
|
|
56857
|
+
const no_pagination = mainObject.paging && (mainObject.paging.enabled === false);
|
|
56858
|
+
const is_lookup = options.isLookup;
|
|
56859
|
+
const commonConfig = [
|
|
56848
56860
|
"statistics",
|
|
56849
|
-
|
|
56850
|
-
|
|
56861
|
+
{
|
|
56862
|
+
"type": "pagination",
|
|
56863
|
+
"maxButtons": 10,
|
|
56864
|
+
"showPageInput": false
|
|
56865
|
+
}
|
|
56866
|
+
];
|
|
56867
|
+
|
|
56868
|
+
if (no_pagination && is_lookup) {
|
|
56869
|
+
return commonConfig;
|
|
56870
|
+
} else {
|
|
56871
|
+
return ["switch-per-page", ...commonConfig];
|
|
56872
|
+
}
|
|
56851
56873
|
}
|
|
56852
56874
|
}
|
|
56853
56875
|
}
|
|
@@ -57484,13 +57506,15 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
57484
57506
|
pickerSchema.headerToolbar = getObjectHeaderToolbar(refObjectConfig, fieldsArr, ctx.formFactor, { headerToolbarItems, isLookup: true, keywordsSearchBoxName });
|
|
57485
57507
|
const isAllowCreate = refObjectConfig.permissions.allowCreate;
|
|
57486
57508
|
const isCreate = lodash.exports.isBoolean(field.create) ? field.create : true;
|
|
57487
|
-
|
|
57509
|
+
// lookup字段配置过滤条件就强制不显示新建按钮
|
|
57510
|
+
let isHasFilters = (field.filters || field._filtersFunction) ? true : false;
|
|
57511
|
+
if (isAllowCreate && isCreate && !isHasFilters) {
|
|
57488
57512
|
const new_button = await getSchema$5(refObjectConfig, { appId: ctx.appId, objectName: refObjectConfig.name, formFactor: ctx.formFactor });
|
|
57489
57513
|
new_button.align = "right";
|
|
57490
57514
|
// 保持快速搜索放在最左侧,新建按钮往里插,而不是push到最后
|
|
57491
57515
|
pickerSchema.headerToolbar.splice(pickerSchema.headerToolbar.length - 1, 0, new_button);
|
|
57492
57516
|
}
|
|
57493
|
-
pickerSchema.footerToolbar = refObjectConfig.enable_tree ? [] : getObjectFooterToolbar();
|
|
57517
|
+
pickerSchema.footerToolbar = refObjectConfig.enable_tree ? [] : getObjectFooterToolbar(refObjectConfig,ctx.formFactor,{isLookup: true});
|
|
57494
57518
|
if (ctx.filterVisible !== false) {
|
|
57495
57519
|
pickerSchema.filter = await getObjectFilter(refObjectConfig, fields, {
|
|
57496
57520
|
...ctx,
|
|
@@ -57618,10 +57642,10 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
57618
57642
|
// const labelFieldKey = referenceTo && referenceTo.labelField?.name || 'name';
|
|
57619
57643
|
|
|
57620
57644
|
let apiInfo;
|
|
57621
|
-
|
|
57645
|
+
let defaultValueOptionsQueryData;
|
|
57622
57646
|
if(referenceTo){
|
|
57623
57647
|
// 字段值单独走一个请求合并到source的同一个GraphQL接口中
|
|
57624
|
-
|
|
57648
|
+
defaultValueOptionsQueryData = await getFindQuery({ name: referenceTo.objectName }, null, [
|
|
57625
57649
|
Object.assign({}, referenceTo.labelField, {alias: 'label'}),
|
|
57626
57650
|
Object.assign({}, referenceTo.valueField, {alias: 'value'})
|
|
57627
57651
|
], {
|
|
@@ -57634,7 +57658,7 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
57634
57658
|
}, null, [
|
|
57635
57659
|
Object.assign({}, referenceTo.labelField, {alias: 'label'}),
|
|
57636
57660
|
Object.assign({}, referenceTo.valueField, {alias: 'value'})
|
|
57637
|
-
], {expand: false, alias: 'options', queryOptions: `filters: {__filters}, top: {__top}, sort: "{__sort}"
|
|
57661
|
+
], {expand: false, alias: 'options', queryOptions: `filters: {__filters}, top: {__top}, sort: "{__sort}"`});
|
|
57638
57662
|
|
|
57639
57663
|
apiInfo.adaptor = `
|
|
57640
57664
|
const data = payload.data;
|
|
@@ -57728,11 +57752,16 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
57728
57752
|
var optionsFiltersOp = "${field.multiple ? "in" : "="}";
|
|
57729
57753
|
var optionsFilters = [["${valueFieldKey}", optionsFiltersOp, []]];
|
|
57730
57754
|
if (defaultValue && !api.data.$term) {
|
|
57755
|
+
const defaultValueOptionsQueryData = ${JSON.stringify(defaultValueOptionsQueryData)};
|
|
57756
|
+
const defaultValueOptionsQuery = defaultValueOptionsQueryData?.query?.replace(/^{/,"").replace(/}$/,"");
|
|
57731
57757
|
// 字段值单独请求,没值的时候在请求中返回空
|
|
57732
57758
|
optionsFilters = [["${valueFieldKey}", optionsFiltersOp, defaultValue]];
|
|
57733
57759
|
if(filters.length > 0){
|
|
57734
57760
|
optionsFilters = [filters, optionsFilters];
|
|
57735
57761
|
}
|
|
57762
|
+
if(defaultValueOptionsQuery){
|
|
57763
|
+
api.data.query = "{"+api.data.query.replace(/^{/,"").replace(/}$/,"")+","+defaultValueOptionsQuery+"}";
|
|
57764
|
+
}
|
|
57736
57765
|
}
|
|
57737
57766
|
api.data.query = api.data.query.replace(/{__options_filters}/g, JSON.stringify(optionsFilters));
|
|
57738
57767
|
return api;
|
|
@@ -57774,7 +57803,7 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
57774
57803
|
disabledOn: `${readonly} || ( (this._master && (this._master.relatedKey ==='${field.name}')) || ((this.relatedKey ==='${field.name}') && (${field.multiple} != true)) )`,
|
|
57775
57804
|
// labelField: labelField,
|
|
57776
57805
|
// valueField: valueField,
|
|
57777
|
-
source: apiInfo,
|
|
57806
|
+
// source: apiInfo,
|
|
57778
57807
|
autoComplete: apiInfo,
|
|
57779
57808
|
searchable: true,
|
|
57780
57809
|
};
|
|
@@ -57853,10 +57882,10 @@ async function lookupToAmis(field, readonly, ctx){
|
|
|
57853
57882
|
|
|
57854
57883
|
const refObject = await getUISchema(referenceTo.objectName);
|
|
57855
57884
|
|
|
57856
|
-
//
|
|
57857
|
-
|
|
57858
|
-
//
|
|
57859
|
-
if(
|
|
57885
|
+
// 优先取字段中配置的enable_enhanced_lookup,字段上没配置时,才从对象上取enable_enhanced_lookup属性
|
|
57886
|
+
let enableEnhancedLookup = lodash.exports.isBoolean(field.enable_enhanced_lookup) ? field.enable_enhanced_lookup : refObject.enable_enhanced_lookup;
|
|
57887
|
+
// 默认使用下拉框模式显示lookup选项,只能配置了enable_enhanced_lookup才使用弹出增强模式
|
|
57888
|
+
if(enableEnhancedLookup == true){
|
|
57860
57889
|
return await lookupToAmisPicker(field, readonly, ctx);
|
|
57861
57890
|
}else if(refObject.enable_tree) {
|
|
57862
57891
|
return await lookupToAmisTreeSelect(field, readonly, Object.assign({}, ctx, {
|
|
@@ -58169,8 +58198,8 @@ function getAmisStaticFieldType(type, readonly, options){
|
|
|
58169
58198
|
/*
|
|
58170
58199
|
* @Author: baozhoutao@steedos.com
|
|
58171
58200
|
* @Date: 2022-10-28 14:15:09
|
|
58172
|
-
* @LastEditors:
|
|
58173
|
-
* @LastEditTime:
|
|
58201
|
+
* @LastEditors: liaodaxue
|
|
58202
|
+
* @LastEditTime: 2023-10-30 17:51:54
|
|
58174
58203
|
* @Description:
|
|
58175
58204
|
*/
|
|
58176
58205
|
|
|
@@ -58221,11 +58250,26 @@ const getAmisFileEditSchema = (steedosField)=>{
|
|
|
58221
58250
|
useChunk: false, // 关闭分块上传
|
|
58222
58251
|
receiver: {
|
|
58223
58252
|
method: "post",
|
|
58253
|
+
dataType: "form-data",
|
|
58224
58254
|
url: `\${context.rootUrl}/s3/${tableName}`,
|
|
58225
|
-
|
|
58226
|
-
|
|
58227
|
-
|
|
58228
|
-
|
|
58255
|
+
requestAdaptor: `
|
|
58256
|
+
const { _master, global,context } = api.body;
|
|
58257
|
+
// const { recordId, objectName } = _master;
|
|
58258
|
+
const { spaceId, userId, user } = global;
|
|
58259
|
+
/*
|
|
58260
|
+
record_id: recordId,
|
|
58261
|
+
parent: recordId,
|
|
58262
|
+
object_name: objectName,
|
|
58263
|
+
owner_name: user.name,
|
|
58264
|
+
space: spaceId,
|
|
58265
|
+
owner: userId
|
|
58266
|
+
*/
|
|
58267
|
+
// 参考platform 2.2版本,附件字段保存时cfs.files.filerecord、cfs.images.filerecord表中的metadata下只保存space、owner两个属性值。
|
|
58268
|
+
api.data.append('space', spaceId);
|
|
58269
|
+
api.data.append('owner', userId);
|
|
58270
|
+
|
|
58271
|
+
return api;
|
|
58272
|
+
`,
|
|
58229
58273
|
adaptor: `
|
|
58230
58274
|
const { context } = api.body;
|
|
58231
58275
|
var rootUrl = context.rootUrl + "/api/files/${tableName}/";
|
|
@@ -58306,8 +58350,6 @@ function getSelectFieldOptions(field){
|
|
|
58306
58350
|
}
|
|
58307
58351
|
|
|
58308
58352
|
async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
58309
|
-
// console.log('convertSFieldToAmisField====>', field, readonly, ctx)
|
|
58310
|
-
const isMobile = window.innerWidth <= 768;
|
|
58311
58353
|
// 创建人和修改人、创建时间和修改时间不显示
|
|
58312
58354
|
if(lodash.exports.includes(OMIT_FIELDS, field.name) && ctx.showSystemFields != true){
|
|
58313
58355
|
return;
|
|
@@ -58396,26 +58438,33 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
58396
58438
|
};
|
|
58397
58439
|
break;
|
|
58398
58440
|
case 'date':
|
|
58399
|
-
convertData = isMobile && !readonly ? {
|
|
58400
|
-
|
|
58401
|
-
|
|
58402
|
-
|
|
58403
|
-
|
|
58404
|
-
|
|
58405
|
-
|
|
58406
|
-
|
|
58407
|
-
|
|
58408
|
-
|
|
58409
|
-
|
|
58410
|
-
|
|
58411
|
-
|
|
58412
|
-
|
|
58413
|
-
|
|
58414
|
-
|
|
58415
|
-
|
|
58416
|
-
|
|
58417
|
-
|
|
58418
|
-
} : {
|
|
58441
|
+
// convertData = isMobile && !readonly ? {
|
|
58442
|
+
// type: "native-date",
|
|
58443
|
+
// pipeIn: (value, data) => {
|
|
58444
|
+
// if (value) {
|
|
58445
|
+
// value = moment(value).utc().format('YYYY-MM-DD');
|
|
58446
|
+
// return value;
|
|
58447
|
+
// } else {
|
|
58448
|
+
// return "";
|
|
58449
|
+
// }
|
|
58450
|
+
|
|
58451
|
+
// },
|
|
58452
|
+
// pipeOut: (value, oldValue, data) => {
|
|
58453
|
+
// if (value) {
|
|
58454
|
+
// value = moment(value).format('YYYY-MM-DDT00:00:00.000[Z]');
|
|
58455
|
+
// return value;
|
|
58456
|
+
// } else {
|
|
58457
|
+
// return "";
|
|
58458
|
+
// }
|
|
58459
|
+
// }
|
|
58460
|
+
// } : {
|
|
58461
|
+
// type: getAmisStaticFieldType('date', readonly),
|
|
58462
|
+
// inputFormat: "YYYY-MM-DD",
|
|
58463
|
+
// format:'YYYY-MM-DDT00:00:00.000[Z]',
|
|
58464
|
+
// tpl: readonly ? Tpl.getDateTpl(field) : null,
|
|
58465
|
+
// // utc: true
|
|
58466
|
+
// }
|
|
58467
|
+
convertData = {
|
|
58419
58468
|
type: getAmisStaticFieldType('date', readonly),
|
|
58420
58469
|
inputFormat: "YYYY-MM-DD",
|
|
58421
58470
|
format:'YYYY-MM-DDT00:00:00.000[Z]',
|
|
@@ -58434,43 +58483,51 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
58434
58483
|
};
|
|
58435
58484
|
break;
|
|
58436
58485
|
case 'datetime':
|
|
58437
|
-
convertData = isMobile && !readonly ? {
|
|
58438
|
-
|
|
58439
|
-
|
|
58440
|
-
|
|
58441
|
-
|
|
58442
|
-
|
|
58443
|
-
|
|
58444
|
-
|
|
58445
|
-
|
|
58446
|
-
|
|
58447
|
-
|
|
58448
|
-
|
|
58449
|
-
|
|
58450
|
-
|
|
58451
|
-
|
|
58452
|
-
|
|
58453
|
-
|
|
58454
|
-
|
|
58455
|
-
|
|
58456
|
-
|
|
58457
|
-
|
|
58458
|
-
|
|
58459
|
-
|
|
58460
|
-
|
|
58461
|
-
|
|
58462
|
-
|
|
58463
|
-
|
|
58464
|
-
|
|
58465
|
-
|
|
58466
|
-
|
|
58467
|
-
|
|
58468
|
-
|
|
58469
|
-
|
|
58470
|
-
|
|
58471
|
-
|
|
58472
|
-
|
|
58473
|
-
} : {
|
|
58486
|
+
// convertData = isMobile && !readonly ? {
|
|
58487
|
+
// type: "combo",
|
|
58488
|
+
// pipeIn: (value, data) => {
|
|
58489
|
+
// let revalue = {};
|
|
58490
|
+
// if (value && value != "Invalid date") {
|
|
58491
|
+
// value = moment(value).format('YYYY-MM-DD HH:mm:ss');
|
|
58492
|
+
// revalue[field.name + "-native-date"] = value.split(' ')[0];
|
|
58493
|
+
// revalue[field.name + "-native-time"] = value.split(' ')[1];
|
|
58494
|
+
// } else {
|
|
58495
|
+
// revalue[field.name + "-native-date"] = "";
|
|
58496
|
+
// revalue[field.name + "-native-time"] = "";
|
|
58497
|
+
// }
|
|
58498
|
+
// return revalue;
|
|
58499
|
+
// },
|
|
58500
|
+
// pipeOut: (value, oldValue, data) => {
|
|
58501
|
+
// let revalue = "";
|
|
58502
|
+
// if (value[field.name + "-native-date"] && value[field.name + "-native-time"]) {
|
|
58503
|
+
// revalue = value[field.name + "-native-date"] + " " + value[field.name + "-native-time"];
|
|
58504
|
+
// revalue = moment(revalue).utc().format('YYYY-MM-DDTHH:mm:ss.SSS[Z]');
|
|
58505
|
+
// }
|
|
58506
|
+
// return revalue;
|
|
58507
|
+
// },
|
|
58508
|
+
// items: [
|
|
58509
|
+
// {
|
|
58510
|
+
// type: "native-date",
|
|
58511
|
+
// name: field.name + "-native-date",
|
|
58512
|
+
// className: "steedos-native-date",
|
|
58513
|
+
// value: ""
|
|
58514
|
+
// },
|
|
58515
|
+
// {
|
|
58516
|
+
// type: "native-time",
|
|
58517
|
+
// name: field.name + "-native-time",
|
|
58518
|
+
// className: "steedos-native-time",
|
|
58519
|
+
// value: ""
|
|
58520
|
+
// }
|
|
58521
|
+
// ]
|
|
58522
|
+
// } : {
|
|
58523
|
+
// type: getAmisStaticFieldType('datetime', readonly),
|
|
58524
|
+
// inputFormat: 'YYYY-MM-DD HH:mm',
|
|
58525
|
+
// format: 'YYYY-MM-DDTHH:mm:ss.SSSZ',
|
|
58526
|
+
// tpl: readonly ? Tpl.getDateTimeTpl(field) : null,
|
|
58527
|
+
// utc: true,
|
|
58528
|
+
// }
|
|
58529
|
+
|
|
58530
|
+
convertData = {
|
|
58474
58531
|
type: getAmisStaticFieldType('datetime', readonly),
|
|
58475
58532
|
inputFormat: 'YYYY-MM-DD HH:mm',
|
|
58476
58533
|
format: 'YYYY-MM-DDTHH:mm:ss.SSSZ',
|
|
@@ -58490,26 +58547,34 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
58490
58547
|
};
|
|
58491
58548
|
break;
|
|
58492
58549
|
case 'time':
|
|
58493
|
-
convertData = isMobile && !readonly ? {
|
|
58494
|
-
|
|
58495
|
-
|
|
58496
|
-
|
|
58497
|
-
|
|
58498
|
-
|
|
58499
|
-
|
|
58500
|
-
|
|
58501
|
-
|
|
58502
|
-
|
|
58503
|
-
|
|
58504
|
-
|
|
58505
|
-
|
|
58506
|
-
|
|
58507
|
-
|
|
58508
|
-
|
|
58509
|
-
|
|
58510
|
-
|
|
58511
|
-
|
|
58512
|
-
} : {
|
|
58550
|
+
// convertData = isMobile && !readonly ? {
|
|
58551
|
+
// type: "native-time",
|
|
58552
|
+
// pipeIn: (value, data) => {
|
|
58553
|
+
// if (value) {
|
|
58554
|
+
// value = moment(value).utc().format('HH:mm');
|
|
58555
|
+
// return value;
|
|
58556
|
+
// } else {
|
|
58557
|
+
// return "";
|
|
58558
|
+
// }
|
|
58559
|
+
|
|
58560
|
+
// },
|
|
58561
|
+
// pipeOut: (value, oldValue, data) => {
|
|
58562
|
+
// if (value) {
|
|
58563
|
+
// value = moment('1970-01-01 ' + value).format('1970-01-01THH:mm:00.000[Z]');
|
|
58564
|
+
// return value;
|
|
58565
|
+
// } else {
|
|
58566
|
+
// return "";
|
|
58567
|
+
// }
|
|
58568
|
+
// }
|
|
58569
|
+
// } : {
|
|
58570
|
+
// type: getAmisStaticFieldType('time', readonly),
|
|
58571
|
+
// inputFormat: 'HH:mm',
|
|
58572
|
+
// timeFormat:'HH:mm',
|
|
58573
|
+
// format:'1970-01-01THH:mm:00.000[Z]',
|
|
58574
|
+
// tpl: readonly ? Tpl.getDateTimeTpl(field) : null,
|
|
58575
|
+
// // utc: true
|
|
58576
|
+
// }
|
|
58577
|
+
convertData = {
|
|
58513
58578
|
type: getAmisStaticFieldType('time', readonly),
|
|
58514
58579
|
inputFormat: 'HH:mm',
|
|
58515
58580
|
timeFormat:'HH:mm',
|
|
@@ -58559,7 +58624,20 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
58559
58624
|
type: getAmisStaticFieldType('number', readonly),
|
|
58560
58625
|
min: field.min,
|
|
58561
58626
|
max: field.max,
|
|
58562
|
-
precision: field.scale
|
|
58627
|
+
precision: field.scale,
|
|
58628
|
+
suffix: "%",
|
|
58629
|
+
pipeIn: (value, data) => {
|
|
58630
|
+
if(value){
|
|
58631
|
+
return value*100;
|
|
58632
|
+
}
|
|
58633
|
+
return value;
|
|
58634
|
+
},
|
|
58635
|
+
pipeOut: (value, oldValue, data) => {
|
|
58636
|
+
if(value){
|
|
58637
|
+
return value/100;
|
|
58638
|
+
}
|
|
58639
|
+
return value;
|
|
58640
|
+
},
|
|
58563
58641
|
};
|
|
58564
58642
|
}
|
|
58565
58643
|
break;
|
|
@@ -58954,8 +59032,41 @@ var config = {
|
|
|
58954
59032
|
};
|
|
58955
59033
|
|
|
58956
59034
|
async function getQuickEditSchema(field, options){
|
|
58957
|
-
|
|
59035
|
+
//判断在amis3.2以上环境下,放开批量编辑
|
|
59036
|
+
const isAmisVersionforBatchEdit = amisRequire('amis').version[0] >= 3 && amisRequire('amis').version[2] >= 2;
|
|
59037
|
+
const quickEditId = options.objectName + "_" + field.name + "_quickEdit";//定义快速编辑的表单id,用于setvalue传值
|
|
58958
59038
|
var quickEditSchema = { body: [], id: quickEditId };
|
|
59039
|
+
//select,avatar,image,file等组件无法行记录字段赋值,暂不支持批量编辑;
|
|
59040
|
+
if(field.type != 'avatar' && field.type != 'image' && field.type != 'file' && isAmisVersionforBatchEdit){
|
|
59041
|
+
const submitEvent = {
|
|
59042
|
+
submit: {
|
|
59043
|
+
actions: [
|
|
59044
|
+
{
|
|
59045
|
+
actionType: "custom",
|
|
59046
|
+
script: `
|
|
59047
|
+
let items = _.cloneDeep(event.data.items);
|
|
59048
|
+
let selectedItems = _.cloneDeep(event.data.selectedItems);
|
|
59049
|
+
if(event.data.isBatchEdit){
|
|
59050
|
+
selectedItems.forEach(function(selectedItem){
|
|
59051
|
+
selectedItem._display.${field.name} = event.data._display.${field.name};
|
|
59052
|
+
doAction({actionType: 'setValue', "args": {"value": selectedItem._display},componentId: "_display_" + selectedItem._index});
|
|
59053
|
+
doAction({actionType: 'setValue', "args": {"value": event.data.${field.name}},componentId: "${options.objectName + "_" + field.name + "_"}" + selectedItem._index});
|
|
59054
|
+
})
|
|
59055
|
+
}else{
|
|
59056
|
+
doAction({actionType: 'setValue', "args": {"value": event.data._display},componentId: "_display_" + event.data._index});
|
|
59057
|
+
doAction({actionType: 'setValue', "args": {"value": event.data.${field.name}},componentId: "${options.objectName + "_" + field.name + "_"}" + event.data._index});
|
|
59058
|
+
}
|
|
59059
|
+
`
|
|
59060
|
+
},
|
|
59061
|
+
{
|
|
59062
|
+
"actionType": "closeDialog"
|
|
59063
|
+
}
|
|
59064
|
+
]
|
|
59065
|
+
}
|
|
59066
|
+
};
|
|
59067
|
+
quickEditSchema.onEvent = submitEvent;
|
|
59068
|
+
}
|
|
59069
|
+
|
|
58959
59070
|
if (field.disabled) {
|
|
58960
59071
|
quickEditSchema = false;
|
|
58961
59072
|
} else {
|
|
@@ -58972,7 +59083,7 @@ async function getQuickEditSchema(field, options){
|
|
|
58972
59083
|
{
|
|
58973
59084
|
"actionType": "custom",
|
|
58974
59085
|
"script": `
|
|
58975
|
-
var _display = event.data._display;
|
|
59086
|
+
var _display = _.cloneDeep(event.data._display);
|
|
58976
59087
|
${displayField}
|
|
58977
59088
|
doAction({actionType: 'setValue', "args": {"value": {_display}},componentId: "${quickEditId}"});
|
|
58978
59089
|
`
|
|
@@ -58994,7 +59105,7 @@ async function getQuickEditSchema(field, options){
|
|
|
58994
59105
|
第二种是增加选项时,按照value的值,找到对应选项,并按照_display的规则为其赋值
|
|
58995
59106
|
*/
|
|
58996
59107
|
TempDisplayField = `
|
|
58997
|
-
const preData = event.data.__super.${field.name};
|
|
59108
|
+
const preData = _.cloneDeep(event.data.__super.${field.name});
|
|
58998
59109
|
if(preData && event.data.${field.name}.length < preData.length){
|
|
58999
59110
|
let deletedIndex;
|
|
59000
59111
|
preData.forEach(function(item,index){
|
|
@@ -59038,7 +59149,7 @@ async function getQuickEditSchema(field, options){
|
|
|
59038
59149
|
break;
|
|
59039
59150
|
case "percent":
|
|
59040
59151
|
TempDisplayField = `
|
|
59041
|
-
_display["${field.name}"] =
|
|
59152
|
+
_display["${field.name}"] = event.data.value.toFixed(${field.scale}) + '%';
|
|
59042
59153
|
`;
|
|
59043
59154
|
quickEditSchema.body[0].onEvent["change"] = quickEditOnEvent(TempDisplayField);
|
|
59044
59155
|
break;
|
|
@@ -59189,6 +59300,131 @@ async function getQuickEditSchema(field, options){
|
|
|
59189
59300
|
}
|
|
59190
59301
|
|
|
59191
59302
|
});
|
|
59303
|
+
if(field.type != 'avatar' && field.type != 'image' && field.type != 'file' && isAmisVersionforBatchEdit){
|
|
59304
|
+
quickEditSchema.body.push({
|
|
59305
|
+
"name": "isBatchEdit",
|
|
59306
|
+
"type": "checkbox",
|
|
59307
|
+
"option": [
|
|
59308
|
+
{
|
|
59309
|
+
"type": "tpl",
|
|
59310
|
+
"tpl": "更新${COUNT(selectedItems)}个选定记录"
|
|
59311
|
+
},
|
|
59312
|
+
{
|
|
59313
|
+
"type": "spinner",
|
|
59314
|
+
"showOn": "${batchPermissionLoading}",
|
|
59315
|
+
"size": "sm",
|
|
59316
|
+
"className": "mr-4"
|
|
59317
|
+
}
|
|
59318
|
+
],
|
|
59319
|
+
"visibleOn": "${ARRAYSOME(selectedItems, item => item._id === _id) && COUNT(selectedItems)>1 && quickedit_record_permissions.allowEdit && quickedit_record_permissions_loading == false}",
|
|
59320
|
+
"disabledOn": "${batchPermissionLoading}",
|
|
59321
|
+
"onEvent":{
|
|
59322
|
+
"change":{
|
|
59323
|
+
"actions":[
|
|
59324
|
+
{
|
|
59325
|
+
"actionType": "setValue",
|
|
59326
|
+
"componentId": quickEditId,
|
|
59327
|
+
"args": {
|
|
59328
|
+
"value":{
|
|
59329
|
+
"batchPermissionLoading": true
|
|
59330
|
+
}
|
|
59331
|
+
},
|
|
59332
|
+
"expression":"${event.data.value}"
|
|
59333
|
+
},
|
|
59334
|
+
{
|
|
59335
|
+
"actionType": "ajax",
|
|
59336
|
+
"args": {
|
|
59337
|
+
"api": {
|
|
59338
|
+
"url": "${context.rootUrl}/graphql",
|
|
59339
|
+
"method": "post",
|
|
59340
|
+
"headers": {
|
|
59341
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
59342
|
+
},
|
|
59343
|
+
"data": {
|
|
59344
|
+
"query": "{rows:${objectName}(filters:[\"_id\",\"in\",${selectedItems | pick:_id | split | json}]){_id,_permissions{allowEdit}}}"
|
|
59345
|
+
},
|
|
59346
|
+
"adaptor": `
|
|
59347
|
+
const noPermission = [];
|
|
59348
|
+
payload.data.rows.forEach(function (row) {
|
|
59349
|
+
if(!row._permissions.allowEdit){
|
|
59350
|
+
noPermission.push(row._id);
|
|
59351
|
+
}
|
|
59352
|
+
})
|
|
59353
|
+
payload.data.noPermission = noPermission;
|
|
59354
|
+
return payload;
|
|
59355
|
+
`
|
|
59356
|
+
}
|
|
59357
|
+
},
|
|
59358
|
+
"expression":"${event.data.value}"
|
|
59359
|
+
},
|
|
59360
|
+
{
|
|
59361
|
+
"actionType": "setValue",
|
|
59362
|
+
"componentId": quickEditId,
|
|
59363
|
+
"args": {
|
|
59364
|
+
"value":{
|
|
59365
|
+
"batchPermissionLoading": false
|
|
59366
|
+
}
|
|
59367
|
+
},
|
|
59368
|
+
"expression":"${event.data.value}"
|
|
59369
|
+
},
|
|
59370
|
+
{
|
|
59371
|
+
"actionType": "dialog",
|
|
59372
|
+
"dialog":{
|
|
59373
|
+
"title": "记录权限",
|
|
59374
|
+
"showCloseButton": false,
|
|
59375
|
+
"body":[
|
|
59376
|
+
{
|
|
59377
|
+
"type": "tpl",
|
|
59378
|
+
"tpl": "当前选中记录中,有${COUNT(noPermission)}条记录无编辑权限,是否需要批量编辑其他记录?"
|
|
59379
|
+
}
|
|
59380
|
+
],
|
|
59381
|
+
"onEvent":{
|
|
59382
|
+
"confirm":{
|
|
59383
|
+
"actions":[
|
|
59384
|
+
{
|
|
59385
|
+
"actionType": "custom",
|
|
59386
|
+
"script": `
|
|
59387
|
+
const noPermission = event.data.noPermission;
|
|
59388
|
+
const crudComponent = event.context.scoped.getComponentById("${options.crudId}");
|
|
59389
|
+
const selectedItems = crudComponent && crudComponent.props.store.selectedItems.concat();
|
|
59390
|
+
noPermission.forEach(function (item) {
|
|
59391
|
+
crudComponent && crudComponent.unSelectItem(_.find(selectedItems,{_id:item}));
|
|
59392
|
+
})
|
|
59393
|
+
`
|
|
59394
|
+
},
|
|
59395
|
+
{
|
|
59396
|
+
"actionType": "setValue",
|
|
59397
|
+
"componentId": quickEditId,
|
|
59398
|
+
"args": {
|
|
59399
|
+
"value":{
|
|
59400
|
+
"isBatchEdit": true
|
|
59401
|
+
}
|
|
59402
|
+
},
|
|
59403
|
+
}
|
|
59404
|
+
]
|
|
59405
|
+
},
|
|
59406
|
+
"cancel":{
|
|
59407
|
+
"actions":[
|
|
59408
|
+
{
|
|
59409
|
+
"actionType": "setValue",
|
|
59410
|
+
"componentId": quickEditId,
|
|
59411
|
+
"args": {
|
|
59412
|
+
"value":{
|
|
59413
|
+
"isBatchEdit": false
|
|
59414
|
+
}
|
|
59415
|
+
},
|
|
59416
|
+
}
|
|
59417
|
+
]
|
|
59418
|
+
}
|
|
59419
|
+
}
|
|
59420
|
+
},
|
|
59421
|
+
"expression":"${COUNT(event.data.noPermission)>0}"
|
|
59422
|
+
}
|
|
59423
|
+
]
|
|
59424
|
+
}
|
|
59425
|
+
}
|
|
59426
|
+
});
|
|
59427
|
+
}
|
|
59192
59428
|
} else {
|
|
59193
59429
|
quickEditSchema = false;
|
|
59194
59430
|
}
|
|
@@ -59223,6 +59459,8 @@ async function getTableColumns(fields, options){
|
|
|
59223
59459
|
const columns = [];
|
|
59224
59460
|
if(!options.isLookup){
|
|
59225
59461
|
columns.push({name: '_index',type: 'text', width: 32, placeholder: ""});
|
|
59462
|
+
//将_display放入crud的columns中,可以通过setvalue修改行内数据域的_display,而不影响上层items的_display,用于批量编辑
|
|
59463
|
+
columns.push({name: '_display',type: 'static', width: 32, placeholder: "",id: "_display_${_index}", className: "hidden"});
|
|
59226
59464
|
}
|
|
59227
59465
|
const allowEdit = options.permissions?.allowEdit && !options.isLookup && options.enable_inline_edit != false;
|
|
59228
59466
|
|
|
@@ -59254,7 +59492,7 @@ async function getTableColumns(fields, options){
|
|
|
59254
59492
|
{
|
|
59255
59493
|
"args": {
|
|
59256
59494
|
"api": {
|
|
59257
|
-
"url": "${context.rootUrl
|
|
59495
|
+
"url": "${(versions[0] && versions[0].url) ? versions[0].url+'?download=true' : context.rootUrl+'/api/files/files/'+versions[0]+'?download=true'}",
|
|
59258
59496
|
"method": "get",
|
|
59259
59497
|
"headers": {
|
|
59260
59498
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
@@ -59301,7 +59539,7 @@ async function getTableColumns(fields, options){
|
|
|
59301
59539
|
else if(field.type === 'select'){
|
|
59302
59540
|
const map = getSelectMap(field.options);
|
|
59303
59541
|
columnItem = Object.assign({}, {
|
|
59304
|
-
type: "mapping",
|
|
59542
|
+
type: "static-mapping",
|
|
59305
59543
|
name: field.name,
|
|
59306
59544
|
label: field.label,
|
|
59307
59545
|
map: map,
|
|
@@ -59316,7 +59554,7 @@ async function getTableColumns(fields, options){
|
|
|
59316
59554
|
const tpl = await getFieldTpl(field, options);
|
|
59317
59555
|
let type = 'text';
|
|
59318
59556
|
if(tpl){
|
|
59319
|
-
type = '
|
|
59557
|
+
type = 'static';
|
|
59320
59558
|
}else if(field.type === 'html'){
|
|
59321
59559
|
type = 'markdown';
|
|
59322
59560
|
}else if(field.type === 'url'){
|
|
@@ -59357,6 +59595,7 @@ async function getTableColumns(fields, options){
|
|
|
59357
59595
|
columnItem.quickEdit = quickEditSchema;
|
|
59358
59596
|
columnItem.quickEditEnabledOn = "${is_system !== true}";
|
|
59359
59597
|
}
|
|
59598
|
+
columnItem.id = `${options.objectName}_${field.name}_\${_index}`;
|
|
59360
59599
|
columns.push(columnItem);
|
|
59361
59600
|
}
|
|
59362
59601
|
}
|
|
@@ -59635,7 +59874,7 @@ async function getTableOperation(ctx){
|
|
|
59635
59874
|
}
|
|
59636
59875
|
return {
|
|
59637
59876
|
type: 'operation',
|
|
59638
|
-
label:
|
|
59877
|
+
label: "",
|
|
59639
59878
|
fixed: 'right',
|
|
59640
59879
|
labelClassName: 'text-center',
|
|
59641
59880
|
className: 'text-center steedos-listview-operation w-10',
|
|
@@ -59669,23 +59908,87 @@ async function getTableOperation(ctx){
|
|
|
59669
59908
|
}
|
|
59670
59909
|
}
|
|
59671
59910
|
|
|
59911
|
+
async function getDefaultCrudCard(columns, options) {
|
|
59912
|
+
let labelFieldName = options?.labelFieldName || "name";
|
|
59913
|
+
let titleColumn, bodyColumns = [];
|
|
59914
|
+
columns.forEach(function (item) {
|
|
59915
|
+
delete item.quickEdit;
|
|
59916
|
+
delete item.width;
|
|
59917
|
+
if (item.name === labelFieldName) {
|
|
59918
|
+
titleColumn = item;
|
|
59919
|
+
}
|
|
59920
|
+
else {
|
|
59921
|
+
if (item.name !== "_index") {
|
|
59922
|
+
bodyColumns.push(item);
|
|
59923
|
+
}
|
|
59924
|
+
}
|
|
59925
|
+
});
|
|
59926
|
+
let card = {
|
|
59927
|
+
"header": {
|
|
59928
|
+
"title": titleColumn.tpl
|
|
59929
|
+
},
|
|
59930
|
+
body: bodyColumns,
|
|
59931
|
+
// useCardLabel: false,
|
|
59932
|
+
toolbar: []
|
|
59933
|
+
};
|
|
59934
|
+
let hideToolbarOperation = options.formFactor === 'SMALL' || ["split"].indexOf(options.displayAs) > -1;
|
|
59935
|
+
if(!hideToolbarOperation){
|
|
59936
|
+
let toolbarOperation = await getTableOperation(options);
|
|
59937
|
+
if (toolbarOperation) {
|
|
59938
|
+
toolbarOperation.className += " inline-block w-auto";
|
|
59939
|
+
}
|
|
59940
|
+
card.toolbar.push(toolbarOperation);
|
|
59941
|
+
}
|
|
59942
|
+
return card;
|
|
59943
|
+
}
|
|
59944
|
+
|
|
59672
59945
|
async function getTableSchema$1(fields, options){
|
|
59673
59946
|
if(!options){
|
|
59674
59947
|
options = {};
|
|
59675
59948
|
}
|
|
59676
59949
|
let { isLookup, hiddenColumnOperation } = options;
|
|
59950
|
+
const defaults = options.defaults;
|
|
59951
|
+
const listSchema = (defaults && defaults.listSchema) || {};
|
|
59952
|
+
|
|
59677
59953
|
let columns = [];
|
|
59678
59954
|
let useMobileColumns = options.formFactor === 'SMALL' || ["split"].indexOf(options.displayAs) > -1;
|
|
59679
59955
|
if(isLookup){
|
|
59680
59956
|
// 在lookup手机端列表模式调式好之前不使用getMobileTableColumns
|
|
59681
59957
|
useMobileColumns = false;
|
|
59682
59958
|
}
|
|
59959
|
+
if(listSchema.mode && listSchema.mode !== "table"){
|
|
59960
|
+
// 如果指定的mode,则不走我们内置的手机端列表效果,使用steedos组件内部开发的默认card/list效果,或者由用户自己实现card/list模式的crud列表
|
|
59961
|
+
useMobileColumns = false;
|
|
59962
|
+
}
|
|
59683
59963
|
if(useMobileColumns){
|
|
59684
59964
|
columns = await getMobileTableColumns(fields, options);
|
|
59685
59965
|
}
|
|
59686
59966
|
else {
|
|
59687
59967
|
columns = await getTableColumns(fields, options);
|
|
59688
59968
|
|
|
59969
|
+
if(listSchema.mode === "cards"){
|
|
59970
|
+
let card = listSchema.card;
|
|
59971
|
+
if(!card){
|
|
59972
|
+
card = await getDefaultCrudCard(columns, options);
|
|
59973
|
+
}
|
|
59974
|
+
return {
|
|
59975
|
+
mode: "cards",
|
|
59976
|
+
perPageAvailable: [5, 10, 20, 50, 100, 500],
|
|
59977
|
+
name: "thelist",
|
|
59978
|
+
headerToolbarClassName: "py-2 px-2 border-gray-300 border-solid border-b",
|
|
59979
|
+
className: "",
|
|
59980
|
+
draggable: false,
|
|
59981
|
+
defaultParams: getDefaultParams(options),
|
|
59982
|
+
card: card,
|
|
59983
|
+
syncLocation: false,
|
|
59984
|
+
keepItemSelectionOnPageChange: true,
|
|
59985
|
+
checkOnItemClick: isLookup ? true : false,
|
|
59986
|
+
labelTpl: `\${${options.labelFieldName}}`,
|
|
59987
|
+
autoFillHeight: false, // 自动高度效果不理想,先关闭
|
|
59988
|
+
columnsTogglable: false
|
|
59989
|
+
}
|
|
59990
|
+
}
|
|
59991
|
+
|
|
59689
59992
|
if(!isLookup && !hiddenColumnOperation){
|
|
59690
59993
|
columns.push(await getTableOperation(options));
|
|
59691
59994
|
}
|
|
@@ -59693,6 +59996,7 @@ async function getTableSchema$1(fields, options){
|
|
|
59693
59996
|
|
|
59694
59997
|
return {
|
|
59695
59998
|
mode: "table",
|
|
59999
|
+
perPageAvailable: [5, 10, 20, 50, 100, 500],
|
|
59696
60000
|
name: "thelist",
|
|
59697
60001
|
headerToolbarClassName: "py-2 px-2 border-gray-300 border-solid border-b",
|
|
59698
60002
|
className: "",
|
|
@@ -59780,8 +60084,8 @@ function isObject(obj) {
|
|
|
59780
60084
|
/*
|
|
59781
60085
|
* @Author: baozhoutao@steedos.com
|
|
59782
60086
|
* @Date: 2022-07-05 15:55:39
|
|
59783
|
-
* @LastEditors:
|
|
59784
|
-
* @LastEditTime: 2023-
|
|
60087
|
+
* @LastEditors: liaodaxue
|
|
60088
|
+
* @LastEditTime: 2023-10-20 11:38:25
|
|
59785
60089
|
* @Description:
|
|
59786
60090
|
*/
|
|
59787
60091
|
|
|
@@ -60078,8 +60382,8 @@ async function getListSchema(
|
|
|
60078
60382
|
"filtersFunction": listview_filters,
|
|
60079
60383
|
"sort": sort,
|
|
60080
60384
|
"ctx": ctx,
|
|
60081
|
-
"requestAdaptor": listView.requestAdaptor,
|
|
60082
|
-
"adaptor": listView.adaptor,
|
|
60385
|
+
"requestAdaptor": listView.requestAdaptor || ctx.requestAdaptor,
|
|
60386
|
+
"adaptor": listView.adaptor || ctx.adaptor,
|
|
60083
60387
|
"headerToolbarItems": ctx.headerToolbarItems,
|
|
60084
60388
|
"filterVisible": ctx.filterVisible,
|
|
60085
60389
|
"rowClassNameExpr": ctx.rowClassNameExpr,
|
|
@@ -65213,7 +65517,13 @@ var PLACEHOLDER_ID = 'placeholder';
|
|
|
65213
65517
|
var empty = [];
|
|
65214
65518
|
function MultipleContainers(props) {
|
|
65215
65519
|
var _this = this;
|
|
65216
|
-
var _a = props.adjustScale, adjustScale = _a === void 0 ? false : _a; props.itemCount; var cancelDrop = props.cancelDrop, _c = props.columns, columns = _c === void 0 ? 1 : _c, _d = props.handle, handle = _d === void 0 ? true : _d, containerStyle = props.containerStyle, _e = props.coordinateGetter, coordinateGetter$1 = _e === void 0 ? coordinateGetter : _e, _f = props.getItemStyles, getItemStyles = _f === void 0 ? function () { return ({}); } : _f, _g = props.wrapperStyle, wrapperStyle = _g === void 0 ? function () { return ({}); } : _g, _h = props.minimal, minimal = _h === void 0 ? false : _h, modifiers = props.modifiers, renderItem = props.renderItem,
|
|
65520
|
+
var _a = props.adjustScale, adjustScale = _a === void 0 ? false : _a; props.itemCount; var cancelDrop = props.cancelDrop, _c = props.columns, columns = _c === void 0 ? 1 : _c, _d = props.handle, handle = _d === void 0 ? true : _d, containerStyle = props.containerStyle, _e = props.coordinateGetter, coordinateGetter$1 = _e === void 0 ? coordinateGetter : _e, _f = props.getItemStyles, getItemStyles = _f === void 0 ? function () { return ({}); } : _f, _g = props.wrapperStyle, wrapperStyle = _g === void 0 ? function () { return ({}); } : _g, _h = props.minimal, minimal = _h === void 0 ? false : _h, modifiers = props.modifiers, renderItem = props.renderItem,
|
|
65521
|
+
// strategy = verticalListSortingStrategy,
|
|
65522
|
+
_j = props.strategy,
|
|
65523
|
+
// strategy = verticalListSortingStrategy,
|
|
65524
|
+
strategy = _j === void 0 ? rectSortingStrategy : _j, //这里默认值不用rectSortingStrategy的话,会出现字段在左右两边拖动变更顺序时拖动过程中dragOverlay丢失问题
|
|
65525
|
+
_k = props.addable, //这里默认值不用rectSortingStrategy的话,会出现字段在左右两边拖动变更顺序时拖动过程中dragOverlay丢失问题
|
|
65526
|
+
addable = _k === void 0 ? false : _k, _l = props.trashable, trashable = _l === void 0 ? false : _l, _m = props.vertical, vertical = _m === void 0 ? false : _m, scrollable = props.scrollable, _o = props.boardSource, boardSource = _o === void 0 ? [] : _o, _p = props.cardSource, cardSource = _p === void 0 ? [] : _p, value = props.value, amisOnChange = props.onChange, amisData = props.data, amisDispatchEvent = props.dispatchEvent, amisRender = props.render, _q = props.cardSchema, cardSchema = _q === void 0 ? [{
|
|
65217
65527
|
"type": "tpl",
|
|
65218
65528
|
"tpl": "${label}",
|
|
65219
65529
|
"inline": false,
|
|
@@ -65221,24 +65531,28 @@ function MultipleContainers(props) {
|
|
|
65221
65531
|
"type": "tpl",
|
|
65222
65532
|
"tpl": "${label}",
|
|
65223
65533
|
}] : _r, _s = props.boardFooter, boardFooter = _s === void 0 ? [] : _s, _t = props.wrapperClassName, wrapperClassName = _t === void 0 ? "gap-2" : _t, _u = props.boardClassName, boardClassName = _u === void 0 ? "border rounded" : _u, _v = props.cardClassName, cardClassName = _v === void 0 ? "" : _v;
|
|
65224
|
-
|
|
65534
|
+
value && delete (value.$$id);
|
|
65225
65535
|
var _w = __read(react.exports.useState(function () {
|
|
65226
65536
|
var _a;
|
|
65227
|
-
return (_a =
|
|
65537
|
+
return (_a = value) !== null && _a !== void 0 ? _a : {
|
|
65228
65538
|
A: ['A1', 'A2'],
|
|
65229
65539
|
B: ['B1', 'B2'],
|
|
65230
65540
|
C: ['C1', 'C2'],
|
|
65231
65541
|
};
|
|
65232
65542
|
}), 2), items = _w[0], setItems = _w[1];
|
|
65233
65543
|
var _x = __read(react.exports.useState(Object.keys(items)), 2), containers = _x[0], setContainers = _x[1];
|
|
65234
|
-
|
|
65544
|
+
react.exports.useEffect(function () {
|
|
65545
|
+
setItems(value);
|
|
65546
|
+
setContainers(Object.keys(value));
|
|
65547
|
+
}, [value]);
|
|
65548
|
+
var handleChange = function (newItems) { return __awaiter(_this, void 0, void 0, function () {
|
|
65235
65549
|
var value, rendererEvent;
|
|
65236
65550
|
return __generator(this, function (_a) {
|
|
65237
65551
|
switch (_a.label) {
|
|
65238
65552
|
case 0:
|
|
65239
65553
|
if (!amisDispatchEvent || !amisOnChange)
|
|
65240
65554
|
return [2 /*return*/];
|
|
65241
|
-
value = items;
|
|
65555
|
+
value = newItems || items;
|
|
65242
65556
|
return [4 /*yield*/, amisDispatchEvent('change', createObject(amisData, {
|
|
65243
65557
|
value: value
|
|
65244
65558
|
}))];
|
|
@@ -65247,7 +65561,7 @@ function MultipleContainers(props) {
|
|
|
65247
65561
|
if (rendererEvent === null || rendererEvent === void 0 ? void 0 : rendererEvent.prevented) {
|
|
65248
65562
|
return [2 /*return*/];
|
|
65249
65563
|
}
|
|
65250
|
-
setTimeout(function () { return amisOnChange(value); },
|
|
65564
|
+
setTimeout(function () { return amisOnChange(value); }, 500);
|
|
65251
65565
|
return [2 /*return*/];
|
|
65252
65566
|
}
|
|
65253
65567
|
});
|
|
@@ -65350,6 +65664,7 @@ function MultipleContainers(props) {
|
|
|
65350
65664
|
var active = _a.active, over = _a.over;
|
|
65351
65665
|
var overId = over === null || over === void 0 ? void 0 : over.id;
|
|
65352
65666
|
if (overId == null || overId === TRASH_ID || active.id in items) {
|
|
65667
|
+
// 拖动的是分组则跳过后面的逻辑
|
|
65353
65668
|
return;
|
|
65354
65669
|
}
|
|
65355
65670
|
var overContainer = findContainer(overId);
|
|
@@ -65425,19 +65740,44 @@ function MultipleContainers(props) {
|
|
|
65425
65740
|
return;
|
|
65426
65741
|
}
|
|
65427
65742
|
var overContainer = findContainer(overId);
|
|
65743
|
+
var newItems = items;
|
|
65428
65744
|
if (overContainer) {
|
|
65429
|
-
|
|
65430
|
-
|
|
65431
|
-
|
|
65432
|
-
|
|
65433
|
-
|
|
65434
|
-
|
|
65435
|
-
|
|
65745
|
+
if (activeContainer !== overContainer) {
|
|
65746
|
+
// 拖动变更分组之间的顺序时,activeContainer 与 overContainer 值不相等
|
|
65747
|
+
setTimeout(function () {
|
|
65748
|
+
var sortedGroups = over.data.current.sortable.items; //不加setTimeout的话,这里拿到的会是变更前的数据
|
|
65749
|
+
newItems = {};
|
|
65750
|
+
sortedGroups.forEach(function (groupKey) {
|
|
65751
|
+
newItems[groupKey] = items[groupKey];
|
|
65752
|
+
});
|
|
65753
|
+
delete newItems[TRASH_ID];
|
|
65754
|
+
delete newItems[PLACEHOLDER_ID];
|
|
65755
|
+
if (lodash.exports.keys(items).join(",") !== lodash.exports.keys(newItems).join(",")) {
|
|
65756
|
+
// 只有顺序发生变化时才触发change事件
|
|
65757
|
+
setItems(newItems);
|
|
65758
|
+
// console.log('拖动结束2,更新form value')
|
|
65759
|
+
handleChange(newItems);
|
|
65760
|
+
}
|
|
65761
|
+
setActiveId(null);
|
|
65762
|
+
}, 500);
|
|
65763
|
+
return;
|
|
65764
|
+
}
|
|
65765
|
+
else {
|
|
65766
|
+
// 同一个分组中字段顺序变更以及把一个字段从某个分组拖动到另一个分组内时,activeContainer 与 overContainer 值相等
|
|
65767
|
+
var activeIndex_1 = items[activeContainer].indexOf(active.id);
|
|
65768
|
+
var overIndex_1 = items[overContainer].indexOf(overId);
|
|
65769
|
+
if (activeIndex_1 !== overIndex_1) {
|
|
65770
|
+
setItems(function (items) {
|
|
65771
|
+
var _a;
|
|
65772
|
+
newItems = __assign$1(__assign$1({}, items), (_a = {}, _a[overContainer] = arrayMove(items[overContainer], activeIndex_1, overIndex_1), _a));
|
|
65773
|
+
return newItems;
|
|
65774
|
+
});
|
|
65775
|
+
}
|
|
65436
65776
|
}
|
|
65437
65777
|
}
|
|
65438
65778
|
setActiveId(null);
|
|
65439
65779
|
// console.log('拖动结束2,更新form value')
|
|
65440
|
-
handleChange();
|
|
65780
|
+
handleChange(newItems);
|
|
65441
65781
|
}, cancelDrop: cancelDrop, onDragCancel: onDragCancel, modifiers: modifiers },
|
|
65442
65782
|
React.createElement("div", { style: {
|
|
65443
65783
|
display: 'inline-grid',
|