@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.cjs.js
CHANGED
|
@@ -54080,7 +54080,7 @@ function getSelectMap(selectOptions){
|
|
|
54080
54080
|
if(optionColor){
|
|
54081
54081
|
const background = optionColor.charAt(0) === '#' ? optionColor : '#'+optionColor;
|
|
54082
54082
|
const color = getContrastColor(background);
|
|
54083
|
-
const optionColorStyle = 'background:'+background+';color:'+color;
|
|
54083
|
+
const optionColorStyle = 'background:'+background+';color:'+color+';line-height:1.5rem';
|
|
54084
54084
|
map[optionValue] = `<span class="rounded-xl px-2 py-1" style='${optionColorStyle}'>${option.label}</span>`;
|
|
54085
54085
|
}else {
|
|
54086
54086
|
map[optionValue] = option.label;
|
|
@@ -54341,17 +54341,17 @@ async function getFindQuery(object, recordId, fields, options){
|
|
|
54341
54341
|
}
|
|
54342
54342
|
|
|
54343
54343
|
const countQuery = options.count === false ? "" : `,count:${object.name}__count(filters:{__filters})`;
|
|
54344
|
-
const moreQuerie = options.moreQueries?.length ? ("," + options.moreQueries.map(function(item){
|
|
54345
|
-
|
|
54346
|
-
|
|
54347
|
-
}).join(",")) : "";
|
|
54344
|
+
// const moreQuerie = options.moreQueries?.length ? ("," + options.moreQueries.map(function(item){
|
|
54345
|
+
// // 把最外层的{}去除
|
|
54346
|
+
// return item.replace(/^{/,"").replace(/}$/,"");
|
|
54347
|
+
// }).join(",")) : "";
|
|
54348
54348
|
|
|
54349
54349
|
return {
|
|
54350
54350
|
orderBy: "${orderBy}",
|
|
54351
54351
|
orderDir: "${orderDir}",
|
|
54352
54352
|
pageNo: "${page}",
|
|
54353
54353
|
pageSize: "${perPage}",
|
|
54354
|
-
query: `{${alias}:${object.name}${queryOptions}{${await getFieldsTemplate(fields, options.expand)}${treeFields}${cfsFields}}${countQuery}
|
|
54354
|
+
query: `{${alias}:${object.name}${queryOptions}{${await getFieldsTemplate(fields, options.expand)}${treeFields}${cfsFields}}${countQuery}}`
|
|
54355
54355
|
}
|
|
54356
54356
|
}
|
|
54357
54357
|
|
|
@@ -55217,7 +55217,8 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
55217
55217
|
if(isLookup){
|
|
55218
55218
|
searchableFieldsStoreKey += "/lookup/" + objectName;
|
|
55219
55219
|
}
|
|
55220
|
-
|
|
55220
|
+
searchableFieldsStoreKey = searchableFieldsStoreKey + "/" + (data.context && data.context.userId);
|
|
55221
|
+
let defaultSearchableFields = localStorage.getItem(searchableFieldsStoreKey);
|
|
55221
55222
|
if(defaultSearchableFields){
|
|
55222
55223
|
defaultSearchableFields = defaultSearchableFields.split(",");
|
|
55223
55224
|
}
|
|
@@ -55286,7 +55287,8 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
55286
55287
|
if(isLookup){
|
|
55287
55288
|
searchableFieldsStoreKey += "/lookup/" + objectName;
|
|
55288
55289
|
}
|
|
55289
|
-
|
|
55290
|
+
searchableFieldsStoreKey = searchableFieldsStoreKey + "/" + (data.context && data.context.userId);
|
|
55291
|
+
localStorage.setItem(searchableFieldsStoreKey, value);
|
|
55290
55292
|
|
|
55291
55293
|
// ===START===:当变更可搜索字段时,如果被移除的可搜索字段在本地存储中已经存入过滤条件中则应该清除本地存储中相关字段的过滤条件。
|
|
55292
55294
|
const searchableFields = data.fields;
|
|
@@ -55792,7 +55794,8 @@ const getCopyListviewButtonSchema = ()=>{
|
|
|
55792
55794
|
"&": "${list_view}",
|
|
55793
55795
|
"name":"",
|
|
55794
55796
|
"label": instance.t('frontend_listview_control_clone_defaultData_label_start') + " ${list_view.label} " + instance.t('frontend_listview_control_clone_defaultData_label_end'),
|
|
55795
|
-
"shared":false
|
|
55797
|
+
"shared":false,
|
|
55798
|
+
"object_name": "${targetObjectName}",
|
|
55796
55799
|
},
|
|
55797
55800
|
"fieldsExtend": fieldsExtend$3(),
|
|
55798
55801
|
"fields": fields(),
|
|
@@ -56580,7 +56583,7 @@ let resizeWindow = function(){
|
|
|
56580
56583
|
//触发amis crud 高度重算
|
|
56581
56584
|
setTimeout(()=>{
|
|
56582
56585
|
window.dispatchEvent(new Event("resize"))
|
|
56583
|
-
},
|
|
56586
|
+
}, 1000);
|
|
56584
56587
|
}
|
|
56585
56588
|
resizeWindow();
|
|
56586
56589
|
// 手机端在显示搜索栏时隐藏crud上的刷新按钮,因为点击后crud高度显示有问题
|
|
@@ -56817,6 +56820,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
|
|
|
56817
56820
|
}
|
|
56818
56821
|
|
|
56819
56822
|
function getObjectFooterToolbar(mainObject, formFactor, options) {
|
|
56823
|
+
// crud card模式与table模式两种情况下showPageInput默认值不一样,所以需要显式设置为false
|
|
56820
56824
|
if (formFactor === 'SMALL') {
|
|
56821
56825
|
// return [
|
|
56822
56826
|
// "load-more",
|
|
@@ -56826,14 +56830,17 @@ function getObjectFooterToolbar(mainObject, formFactor, options) {
|
|
|
56826
56830
|
"switch-per-page",
|
|
56827
56831
|
{
|
|
56828
56832
|
"type": "pagination",
|
|
56829
|
-
"maxButtons": 5
|
|
56833
|
+
"maxButtons": 5,
|
|
56834
|
+
"showPageInput": false
|
|
56830
56835
|
}
|
|
56831
56836
|
]
|
|
56832
56837
|
}else {
|
|
56833
56838
|
return [
|
|
56839
|
+
// "statistics",
|
|
56834
56840
|
{
|
|
56835
56841
|
"type": "pagination",
|
|
56836
|
-
"maxButtons": 5
|
|
56842
|
+
"maxButtons": 5,
|
|
56843
|
+
"showPageInput": false
|
|
56837
56844
|
}
|
|
56838
56845
|
]
|
|
56839
56846
|
}
|
|
@@ -56842,16 +56849,31 @@ function getObjectFooterToolbar(mainObject, formFactor, options) {
|
|
|
56842
56849
|
if(options && options.isRelated){
|
|
56843
56850
|
return [
|
|
56844
56851
|
"statistics",
|
|
56845
|
-
|
|
56852
|
+
{
|
|
56853
|
+
"type": "pagination",
|
|
56854
|
+
"maxButtons": 10,
|
|
56855
|
+
"showPageInput": false
|
|
56856
|
+
}
|
|
56846
56857
|
]
|
|
56847
56858
|
|
|
56848
56859
|
}
|
|
56849
56860
|
else {
|
|
56850
|
-
|
|
56851
|
-
|
|
56861
|
+
const no_pagination = mainObject.paging && (mainObject.paging.enabled === false);
|
|
56862
|
+
const is_lookup = options.isLookup;
|
|
56863
|
+
const commonConfig = [
|
|
56852
56864
|
"statistics",
|
|
56853
|
-
|
|
56854
|
-
|
|
56865
|
+
{
|
|
56866
|
+
"type": "pagination",
|
|
56867
|
+
"maxButtons": 10,
|
|
56868
|
+
"showPageInput": false
|
|
56869
|
+
}
|
|
56870
|
+
];
|
|
56871
|
+
|
|
56872
|
+
if (no_pagination && is_lookup) {
|
|
56873
|
+
return commonConfig;
|
|
56874
|
+
} else {
|
|
56875
|
+
return ["switch-per-page", ...commonConfig];
|
|
56876
|
+
}
|
|
56855
56877
|
}
|
|
56856
56878
|
}
|
|
56857
56879
|
}
|
|
@@ -57488,13 +57510,15 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
57488
57510
|
pickerSchema.headerToolbar = getObjectHeaderToolbar(refObjectConfig, fieldsArr, ctx.formFactor, { headerToolbarItems, isLookup: true, keywordsSearchBoxName });
|
|
57489
57511
|
const isAllowCreate = refObjectConfig.permissions.allowCreate;
|
|
57490
57512
|
const isCreate = lodash.exports.isBoolean(field.create) ? field.create : true;
|
|
57491
|
-
|
|
57513
|
+
// lookup字段配置过滤条件就强制不显示新建按钮
|
|
57514
|
+
let isHasFilters = (field.filters || field._filtersFunction) ? true : false;
|
|
57515
|
+
if (isAllowCreate && isCreate && !isHasFilters) {
|
|
57492
57516
|
const new_button = await getSchema$5(refObjectConfig, { appId: ctx.appId, objectName: refObjectConfig.name, formFactor: ctx.formFactor });
|
|
57493
57517
|
new_button.align = "right";
|
|
57494
57518
|
// 保持快速搜索放在最左侧,新建按钮往里插,而不是push到最后
|
|
57495
57519
|
pickerSchema.headerToolbar.splice(pickerSchema.headerToolbar.length - 1, 0, new_button);
|
|
57496
57520
|
}
|
|
57497
|
-
pickerSchema.footerToolbar = refObjectConfig.enable_tree ? [] : getObjectFooterToolbar();
|
|
57521
|
+
pickerSchema.footerToolbar = refObjectConfig.enable_tree ? [] : getObjectFooterToolbar(refObjectConfig,ctx.formFactor,{isLookup: true});
|
|
57498
57522
|
if (ctx.filterVisible !== false) {
|
|
57499
57523
|
pickerSchema.filter = await getObjectFilter(refObjectConfig, fields, {
|
|
57500
57524
|
...ctx,
|
|
@@ -57622,10 +57646,10 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
57622
57646
|
// const labelFieldKey = referenceTo && referenceTo.labelField?.name || 'name';
|
|
57623
57647
|
|
|
57624
57648
|
let apiInfo;
|
|
57625
|
-
|
|
57649
|
+
let defaultValueOptionsQueryData;
|
|
57626
57650
|
if(referenceTo){
|
|
57627
57651
|
// 字段值单独走一个请求合并到source的同一个GraphQL接口中
|
|
57628
|
-
|
|
57652
|
+
defaultValueOptionsQueryData = await getFindQuery({ name: referenceTo.objectName }, null, [
|
|
57629
57653
|
Object.assign({}, referenceTo.labelField, {alias: 'label'}),
|
|
57630
57654
|
Object.assign({}, referenceTo.valueField, {alias: 'value'})
|
|
57631
57655
|
], {
|
|
@@ -57638,7 +57662,7 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
57638
57662
|
}, null, [
|
|
57639
57663
|
Object.assign({}, referenceTo.labelField, {alias: 'label'}),
|
|
57640
57664
|
Object.assign({}, referenceTo.valueField, {alias: 'value'})
|
|
57641
|
-
], {expand: false, alias: 'options', queryOptions: `filters: {__filters}, top: {__top}, sort: "{__sort}"
|
|
57665
|
+
], {expand: false, alias: 'options', queryOptions: `filters: {__filters}, top: {__top}, sort: "{__sort}"`});
|
|
57642
57666
|
|
|
57643
57667
|
apiInfo.adaptor = `
|
|
57644
57668
|
const data = payload.data;
|
|
@@ -57732,11 +57756,16 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
57732
57756
|
var optionsFiltersOp = "${field.multiple ? "in" : "="}";
|
|
57733
57757
|
var optionsFilters = [["${valueFieldKey}", optionsFiltersOp, []]];
|
|
57734
57758
|
if (defaultValue && !api.data.$term) {
|
|
57759
|
+
const defaultValueOptionsQueryData = ${JSON.stringify(defaultValueOptionsQueryData)};
|
|
57760
|
+
const defaultValueOptionsQuery = defaultValueOptionsQueryData?.query?.replace(/^{/,"").replace(/}$/,"");
|
|
57735
57761
|
// 字段值单独请求,没值的时候在请求中返回空
|
|
57736
57762
|
optionsFilters = [["${valueFieldKey}", optionsFiltersOp, defaultValue]];
|
|
57737
57763
|
if(filters.length > 0){
|
|
57738
57764
|
optionsFilters = [filters, optionsFilters];
|
|
57739
57765
|
}
|
|
57766
|
+
if(defaultValueOptionsQuery){
|
|
57767
|
+
api.data.query = "{"+api.data.query.replace(/^{/,"").replace(/}$/,"")+","+defaultValueOptionsQuery+"}";
|
|
57768
|
+
}
|
|
57740
57769
|
}
|
|
57741
57770
|
api.data.query = api.data.query.replace(/{__options_filters}/g, JSON.stringify(optionsFilters));
|
|
57742
57771
|
return api;
|
|
@@ -57778,7 +57807,7 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
57778
57807
|
disabledOn: `${readonly} || ( (this._master && (this._master.relatedKey ==='${field.name}')) || ((this.relatedKey ==='${field.name}') && (${field.multiple} != true)) )`,
|
|
57779
57808
|
// labelField: labelField,
|
|
57780
57809
|
// valueField: valueField,
|
|
57781
|
-
source: apiInfo,
|
|
57810
|
+
// source: apiInfo,
|
|
57782
57811
|
autoComplete: apiInfo,
|
|
57783
57812
|
searchable: true,
|
|
57784
57813
|
};
|
|
@@ -57857,10 +57886,10 @@ async function lookupToAmis(field, readonly, ctx){
|
|
|
57857
57886
|
|
|
57858
57887
|
const refObject = await getUISchema(referenceTo.objectName);
|
|
57859
57888
|
|
|
57860
|
-
//
|
|
57861
|
-
|
|
57862
|
-
//
|
|
57863
|
-
if(
|
|
57889
|
+
// 优先取字段中配置的enable_enhanced_lookup,字段上没配置时,才从对象上取enable_enhanced_lookup属性
|
|
57890
|
+
let enableEnhancedLookup = lodash.exports.isBoolean(field.enable_enhanced_lookup) ? field.enable_enhanced_lookup : refObject.enable_enhanced_lookup;
|
|
57891
|
+
// 默认使用下拉框模式显示lookup选项,只能配置了enable_enhanced_lookup才使用弹出增强模式
|
|
57892
|
+
if(enableEnhancedLookup == true){
|
|
57864
57893
|
return await lookupToAmisPicker(field, readonly, ctx);
|
|
57865
57894
|
}else if(refObject.enable_tree) {
|
|
57866
57895
|
return await lookupToAmisTreeSelect(field, readonly, Object.assign({}, ctx, {
|
|
@@ -58173,8 +58202,8 @@ function getAmisStaticFieldType(type, readonly, options){
|
|
|
58173
58202
|
/*
|
|
58174
58203
|
* @Author: baozhoutao@steedos.com
|
|
58175
58204
|
* @Date: 2022-10-28 14:15:09
|
|
58176
|
-
* @LastEditors:
|
|
58177
|
-
* @LastEditTime:
|
|
58205
|
+
* @LastEditors: liaodaxue
|
|
58206
|
+
* @LastEditTime: 2023-10-30 17:51:54
|
|
58178
58207
|
* @Description:
|
|
58179
58208
|
*/
|
|
58180
58209
|
|
|
@@ -58225,11 +58254,26 @@ const getAmisFileEditSchema = (steedosField)=>{
|
|
|
58225
58254
|
useChunk: false, // 关闭分块上传
|
|
58226
58255
|
receiver: {
|
|
58227
58256
|
method: "post",
|
|
58257
|
+
dataType: "form-data",
|
|
58228
58258
|
url: `\${context.rootUrl}/s3/${tableName}`,
|
|
58229
|
-
|
|
58230
|
-
|
|
58231
|
-
|
|
58232
|
-
|
|
58259
|
+
requestAdaptor: `
|
|
58260
|
+
const { _master, global,context } = api.body;
|
|
58261
|
+
// const { recordId, objectName } = _master;
|
|
58262
|
+
const { spaceId, userId, user } = global;
|
|
58263
|
+
/*
|
|
58264
|
+
record_id: recordId,
|
|
58265
|
+
parent: recordId,
|
|
58266
|
+
object_name: objectName,
|
|
58267
|
+
owner_name: user.name,
|
|
58268
|
+
space: spaceId,
|
|
58269
|
+
owner: userId
|
|
58270
|
+
*/
|
|
58271
|
+
// 参考platform 2.2版本,附件字段保存时cfs.files.filerecord、cfs.images.filerecord表中的metadata下只保存space、owner两个属性值。
|
|
58272
|
+
api.data.append('space', spaceId);
|
|
58273
|
+
api.data.append('owner', userId);
|
|
58274
|
+
|
|
58275
|
+
return api;
|
|
58276
|
+
`,
|
|
58233
58277
|
adaptor: `
|
|
58234
58278
|
const { context } = api.body;
|
|
58235
58279
|
var rootUrl = context.rootUrl + "/api/files/${tableName}/";
|
|
@@ -58310,8 +58354,6 @@ function getSelectFieldOptions(field){
|
|
|
58310
58354
|
}
|
|
58311
58355
|
|
|
58312
58356
|
async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
58313
|
-
// console.log('convertSFieldToAmisField====>', field, readonly, ctx)
|
|
58314
|
-
const isMobile = window.innerWidth <= 768;
|
|
58315
58357
|
// 创建人和修改人、创建时间和修改时间不显示
|
|
58316
58358
|
if(lodash.exports.includes(OMIT_FIELDS, field.name) && ctx.showSystemFields != true){
|
|
58317
58359
|
return;
|
|
@@ -58400,26 +58442,33 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
58400
58442
|
};
|
|
58401
58443
|
break;
|
|
58402
58444
|
case 'date':
|
|
58403
|
-
convertData = isMobile && !readonly ? {
|
|
58404
|
-
|
|
58405
|
-
|
|
58406
|
-
|
|
58407
|
-
|
|
58408
|
-
|
|
58409
|
-
|
|
58410
|
-
|
|
58411
|
-
|
|
58412
|
-
|
|
58413
|
-
|
|
58414
|
-
|
|
58415
|
-
|
|
58416
|
-
|
|
58417
|
-
|
|
58418
|
-
|
|
58419
|
-
|
|
58420
|
-
|
|
58421
|
-
|
|
58422
|
-
} : {
|
|
58445
|
+
// convertData = isMobile && !readonly ? {
|
|
58446
|
+
// type: "native-date",
|
|
58447
|
+
// pipeIn: (value, data) => {
|
|
58448
|
+
// if (value) {
|
|
58449
|
+
// value = moment(value).utc().format('YYYY-MM-DD');
|
|
58450
|
+
// return value;
|
|
58451
|
+
// } else {
|
|
58452
|
+
// return "";
|
|
58453
|
+
// }
|
|
58454
|
+
|
|
58455
|
+
// },
|
|
58456
|
+
// pipeOut: (value, oldValue, data) => {
|
|
58457
|
+
// if (value) {
|
|
58458
|
+
// value = moment(value).format('YYYY-MM-DDT00:00:00.000[Z]');
|
|
58459
|
+
// return value;
|
|
58460
|
+
// } else {
|
|
58461
|
+
// return "";
|
|
58462
|
+
// }
|
|
58463
|
+
// }
|
|
58464
|
+
// } : {
|
|
58465
|
+
// type: getAmisStaticFieldType('date', readonly),
|
|
58466
|
+
// inputFormat: "YYYY-MM-DD",
|
|
58467
|
+
// format:'YYYY-MM-DDT00:00:00.000[Z]',
|
|
58468
|
+
// tpl: readonly ? Tpl.getDateTpl(field) : null,
|
|
58469
|
+
// // utc: true
|
|
58470
|
+
// }
|
|
58471
|
+
convertData = {
|
|
58423
58472
|
type: getAmisStaticFieldType('date', readonly),
|
|
58424
58473
|
inputFormat: "YYYY-MM-DD",
|
|
58425
58474
|
format:'YYYY-MM-DDT00:00:00.000[Z]',
|
|
@@ -58438,43 +58487,51 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
58438
58487
|
};
|
|
58439
58488
|
break;
|
|
58440
58489
|
case 'datetime':
|
|
58441
|
-
convertData = isMobile && !readonly ? {
|
|
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
|
-
|
|
58474
|
-
|
|
58475
|
-
|
|
58476
|
-
|
|
58477
|
-
} : {
|
|
58490
|
+
// convertData = isMobile && !readonly ? {
|
|
58491
|
+
// type: "combo",
|
|
58492
|
+
// pipeIn: (value, data) => {
|
|
58493
|
+
// let revalue = {};
|
|
58494
|
+
// if (value && value != "Invalid date") {
|
|
58495
|
+
// value = moment(value).format('YYYY-MM-DD HH:mm:ss');
|
|
58496
|
+
// revalue[field.name + "-native-date"] = value.split(' ')[0];
|
|
58497
|
+
// revalue[field.name + "-native-time"] = value.split(' ')[1];
|
|
58498
|
+
// } else {
|
|
58499
|
+
// revalue[field.name + "-native-date"] = "";
|
|
58500
|
+
// revalue[field.name + "-native-time"] = "";
|
|
58501
|
+
// }
|
|
58502
|
+
// return revalue;
|
|
58503
|
+
// },
|
|
58504
|
+
// pipeOut: (value, oldValue, data) => {
|
|
58505
|
+
// let revalue = "";
|
|
58506
|
+
// if (value[field.name + "-native-date"] && value[field.name + "-native-time"]) {
|
|
58507
|
+
// revalue = value[field.name + "-native-date"] + " " + value[field.name + "-native-time"];
|
|
58508
|
+
// revalue = moment(revalue).utc().format('YYYY-MM-DDTHH:mm:ss.SSS[Z]');
|
|
58509
|
+
// }
|
|
58510
|
+
// return revalue;
|
|
58511
|
+
// },
|
|
58512
|
+
// items: [
|
|
58513
|
+
// {
|
|
58514
|
+
// type: "native-date",
|
|
58515
|
+
// name: field.name + "-native-date",
|
|
58516
|
+
// className: "steedos-native-date",
|
|
58517
|
+
// value: ""
|
|
58518
|
+
// },
|
|
58519
|
+
// {
|
|
58520
|
+
// type: "native-time",
|
|
58521
|
+
// name: field.name + "-native-time",
|
|
58522
|
+
// className: "steedos-native-time",
|
|
58523
|
+
// value: ""
|
|
58524
|
+
// }
|
|
58525
|
+
// ]
|
|
58526
|
+
// } : {
|
|
58527
|
+
// type: getAmisStaticFieldType('datetime', readonly),
|
|
58528
|
+
// inputFormat: 'YYYY-MM-DD HH:mm',
|
|
58529
|
+
// format: 'YYYY-MM-DDTHH:mm:ss.SSSZ',
|
|
58530
|
+
// tpl: readonly ? Tpl.getDateTimeTpl(field) : null,
|
|
58531
|
+
// utc: true,
|
|
58532
|
+
// }
|
|
58533
|
+
|
|
58534
|
+
convertData = {
|
|
58478
58535
|
type: getAmisStaticFieldType('datetime', readonly),
|
|
58479
58536
|
inputFormat: 'YYYY-MM-DD HH:mm',
|
|
58480
58537
|
format: 'YYYY-MM-DDTHH:mm:ss.SSSZ',
|
|
@@ -58494,26 +58551,34 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
58494
58551
|
};
|
|
58495
58552
|
break;
|
|
58496
58553
|
case 'time':
|
|
58497
|
-
convertData = isMobile && !readonly ? {
|
|
58498
|
-
|
|
58499
|
-
|
|
58500
|
-
|
|
58501
|
-
|
|
58502
|
-
|
|
58503
|
-
|
|
58504
|
-
|
|
58505
|
-
|
|
58506
|
-
|
|
58507
|
-
|
|
58508
|
-
|
|
58509
|
-
|
|
58510
|
-
|
|
58511
|
-
|
|
58512
|
-
|
|
58513
|
-
|
|
58514
|
-
|
|
58515
|
-
|
|
58516
|
-
} : {
|
|
58554
|
+
// convertData = isMobile && !readonly ? {
|
|
58555
|
+
// type: "native-time",
|
|
58556
|
+
// pipeIn: (value, data) => {
|
|
58557
|
+
// if (value) {
|
|
58558
|
+
// value = moment(value).utc().format('HH:mm');
|
|
58559
|
+
// return value;
|
|
58560
|
+
// } else {
|
|
58561
|
+
// return "";
|
|
58562
|
+
// }
|
|
58563
|
+
|
|
58564
|
+
// },
|
|
58565
|
+
// pipeOut: (value, oldValue, data) => {
|
|
58566
|
+
// if (value) {
|
|
58567
|
+
// value = moment('1970-01-01 ' + value).format('1970-01-01THH:mm:00.000[Z]');
|
|
58568
|
+
// return value;
|
|
58569
|
+
// } else {
|
|
58570
|
+
// return "";
|
|
58571
|
+
// }
|
|
58572
|
+
// }
|
|
58573
|
+
// } : {
|
|
58574
|
+
// type: getAmisStaticFieldType('time', readonly),
|
|
58575
|
+
// inputFormat: 'HH:mm',
|
|
58576
|
+
// timeFormat:'HH:mm',
|
|
58577
|
+
// format:'1970-01-01THH:mm:00.000[Z]',
|
|
58578
|
+
// tpl: readonly ? Tpl.getDateTimeTpl(field) : null,
|
|
58579
|
+
// // utc: true
|
|
58580
|
+
// }
|
|
58581
|
+
convertData = {
|
|
58517
58582
|
type: getAmisStaticFieldType('time', readonly),
|
|
58518
58583
|
inputFormat: 'HH:mm',
|
|
58519
58584
|
timeFormat:'HH:mm',
|
|
@@ -58563,7 +58628,20 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
58563
58628
|
type: getAmisStaticFieldType('number', readonly),
|
|
58564
58629
|
min: field.min,
|
|
58565
58630
|
max: field.max,
|
|
58566
|
-
precision: field.scale
|
|
58631
|
+
precision: field.scale,
|
|
58632
|
+
suffix: "%",
|
|
58633
|
+
pipeIn: (value, data) => {
|
|
58634
|
+
if(value){
|
|
58635
|
+
return value*100;
|
|
58636
|
+
}
|
|
58637
|
+
return value;
|
|
58638
|
+
},
|
|
58639
|
+
pipeOut: (value, oldValue, data) => {
|
|
58640
|
+
if(value){
|
|
58641
|
+
return value/100;
|
|
58642
|
+
}
|
|
58643
|
+
return value;
|
|
58644
|
+
},
|
|
58567
58645
|
};
|
|
58568
58646
|
}
|
|
58569
58647
|
break;
|
|
@@ -58958,8 +59036,41 @@ var config = {
|
|
|
58958
59036
|
};
|
|
58959
59037
|
|
|
58960
59038
|
async function getQuickEditSchema(field, options){
|
|
58961
|
-
|
|
59039
|
+
//判断在amis3.2以上环境下,放开批量编辑
|
|
59040
|
+
const isAmisVersionforBatchEdit = amisRequire('amis').version[0] >= 3 && amisRequire('amis').version[2] >= 2;
|
|
59041
|
+
const quickEditId = options.objectName + "_" + field.name + "_quickEdit";//定义快速编辑的表单id,用于setvalue传值
|
|
58962
59042
|
var quickEditSchema = { body: [], id: quickEditId };
|
|
59043
|
+
//select,avatar,image,file等组件无法行记录字段赋值,暂不支持批量编辑;
|
|
59044
|
+
if(field.type != 'avatar' && field.type != 'image' && field.type != 'file' && isAmisVersionforBatchEdit){
|
|
59045
|
+
const submitEvent = {
|
|
59046
|
+
submit: {
|
|
59047
|
+
actions: [
|
|
59048
|
+
{
|
|
59049
|
+
actionType: "custom",
|
|
59050
|
+
script: `
|
|
59051
|
+
let items = _.cloneDeep(event.data.items);
|
|
59052
|
+
let selectedItems = _.cloneDeep(event.data.selectedItems);
|
|
59053
|
+
if(event.data.isBatchEdit){
|
|
59054
|
+
selectedItems.forEach(function(selectedItem){
|
|
59055
|
+
selectedItem._display.${field.name} = event.data._display.${field.name};
|
|
59056
|
+
doAction({actionType: 'setValue', "args": {"value": selectedItem._display},componentId: "_display_" + selectedItem._index});
|
|
59057
|
+
doAction({actionType: 'setValue', "args": {"value": event.data.${field.name}},componentId: "${options.objectName + "_" + field.name + "_"}" + selectedItem._index});
|
|
59058
|
+
})
|
|
59059
|
+
}else{
|
|
59060
|
+
doAction({actionType: 'setValue', "args": {"value": event.data._display},componentId: "_display_" + event.data._index});
|
|
59061
|
+
doAction({actionType: 'setValue', "args": {"value": event.data.${field.name}},componentId: "${options.objectName + "_" + field.name + "_"}" + event.data._index});
|
|
59062
|
+
}
|
|
59063
|
+
`
|
|
59064
|
+
},
|
|
59065
|
+
{
|
|
59066
|
+
"actionType": "closeDialog"
|
|
59067
|
+
}
|
|
59068
|
+
]
|
|
59069
|
+
}
|
|
59070
|
+
};
|
|
59071
|
+
quickEditSchema.onEvent = submitEvent;
|
|
59072
|
+
}
|
|
59073
|
+
|
|
58963
59074
|
if (field.disabled) {
|
|
58964
59075
|
quickEditSchema = false;
|
|
58965
59076
|
} else {
|
|
@@ -58976,7 +59087,7 @@ async function getQuickEditSchema(field, options){
|
|
|
58976
59087
|
{
|
|
58977
59088
|
"actionType": "custom",
|
|
58978
59089
|
"script": `
|
|
58979
|
-
var _display = event.data._display;
|
|
59090
|
+
var _display = _.cloneDeep(event.data._display);
|
|
58980
59091
|
${displayField}
|
|
58981
59092
|
doAction({actionType: 'setValue', "args": {"value": {_display}},componentId: "${quickEditId}"});
|
|
58982
59093
|
`
|
|
@@ -58998,7 +59109,7 @@ async function getQuickEditSchema(field, options){
|
|
|
58998
59109
|
第二种是增加选项时,按照value的值,找到对应选项,并按照_display的规则为其赋值
|
|
58999
59110
|
*/
|
|
59000
59111
|
TempDisplayField = `
|
|
59001
|
-
const preData = event.data.__super.${field.name};
|
|
59112
|
+
const preData = _.cloneDeep(event.data.__super.${field.name});
|
|
59002
59113
|
if(preData && event.data.${field.name}.length < preData.length){
|
|
59003
59114
|
let deletedIndex;
|
|
59004
59115
|
preData.forEach(function(item,index){
|
|
@@ -59042,7 +59153,7 @@ async function getQuickEditSchema(field, options){
|
|
|
59042
59153
|
break;
|
|
59043
59154
|
case "percent":
|
|
59044
59155
|
TempDisplayField = `
|
|
59045
|
-
_display["${field.name}"] =
|
|
59156
|
+
_display["${field.name}"] = event.data.value.toFixed(${field.scale}) + '%';
|
|
59046
59157
|
`;
|
|
59047
59158
|
quickEditSchema.body[0].onEvent["change"] = quickEditOnEvent(TempDisplayField);
|
|
59048
59159
|
break;
|
|
@@ -59193,6 +59304,131 @@ async function getQuickEditSchema(field, options){
|
|
|
59193
59304
|
}
|
|
59194
59305
|
|
|
59195
59306
|
});
|
|
59307
|
+
if(field.type != 'avatar' && field.type != 'image' && field.type != 'file' && isAmisVersionforBatchEdit){
|
|
59308
|
+
quickEditSchema.body.push({
|
|
59309
|
+
"name": "isBatchEdit",
|
|
59310
|
+
"type": "checkbox",
|
|
59311
|
+
"option": [
|
|
59312
|
+
{
|
|
59313
|
+
"type": "tpl",
|
|
59314
|
+
"tpl": "更新${COUNT(selectedItems)}个选定记录"
|
|
59315
|
+
},
|
|
59316
|
+
{
|
|
59317
|
+
"type": "spinner",
|
|
59318
|
+
"showOn": "${batchPermissionLoading}",
|
|
59319
|
+
"size": "sm",
|
|
59320
|
+
"className": "mr-4"
|
|
59321
|
+
}
|
|
59322
|
+
],
|
|
59323
|
+
"visibleOn": "${ARRAYSOME(selectedItems, item => item._id === _id) && COUNT(selectedItems)>1 && quickedit_record_permissions.allowEdit && quickedit_record_permissions_loading == false}",
|
|
59324
|
+
"disabledOn": "${batchPermissionLoading}",
|
|
59325
|
+
"onEvent":{
|
|
59326
|
+
"change":{
|
|
59327
|
+
"actions":[
|
|
59328
|
+
{
|
|
59329
|
+
"actionType": "setValue",
|
|
59330
|
+
"componentId": quickEditId,
|
|
59331
|
+
"args": {
|
|
59332
|
+
"value":{
|
|
59333
|
+
"batchPermissionLoading": true
|
|
59334
|
+
}
|
|
59335
|
+
},
|
|
59336
|
+
"expression":"${event.data.value}"
|
|
59337
|
+
},
|
|
59338
|
+
{
|
|
59339
|
+
"actionType": "ajax",
|
|
59340
|
+
"args": {
|
|
59341
|
+
"api": {
|
|
59342
|
+
"url": "${context.rootUrl}/graphql",
|
|
59343
|
+
"method": "post",
|
|
59344
|
+
"headers": {
|
|
59345
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
59346
|
+
},
|
|
59347
|
+
"data": {
|
|
59348
|
+
"query": "{rows:${objectName}(filters:[\"_id\",\"in\",${selectedItems | pick:_id | split | json}]){_id,_permissions{allowEdit}}}"
|
|
59349
|
+
},
|
|
59350
|
+
"adaptor": `
|
|
59351
|
+
const noPermission = [];
|
|
59352
|
+
payload.data.rows.forEach(function (row) {
|
|
59353
|
+
if(!row._permissions.allowEdit){
|
|
59354
|
+
noPermission.push(row._id);
|
|
59355
|
+
}
|
|
59356
|
+
})
|
|
59357
|
+
payload.data.noPermission = noPermission;
|
|
59358
|
+
return payload;
|
|
59359
|
+
`
|
|
59360
|
+
}
|
|
59361
|
+
},
|
|
59362
|
+
"expression":"${event.data.value}"
|
|
59363
|
+
},
|
|
59364
|
+
{
|
|
59365
|
+
"actionType": "setValue",
|
|
59366
|
+
"componentId": quickEditId,
|
|
59367
|
+
"args": {
|
|
59368
|
+
"value":{
|
|
59369
|
+
"batchPermissionLoading": false
|
|
59370
|
+
}
|
|
59371
|
+
},
|
|
59372
|
+
"expression":"${event.data.value}"
|
|
59373
|
+
},
|
|
59374
|
+
{
|
|
59375
|
+
"actionType": "dialog",
|
|
59376
|
+
"dialog":{
|
|
59377
|
+
"title": "记录权限",
|
|
59378
|
+
"showCloseButton": false,
|
|
59379
|
+
"body":[
|
|
59380
|
+
{
|
|
59381
|
+
"type": "tpl",
|
|
59382
|
+
"tpl": "当前选中记录中,有${COUNT(noPermission)}条记录无编辑权限,是否需要批量编辑其他记录?"
|
|
59383
|
+
}
|
|
59384
|
+
],
|
|
59385
|
+
"onEvent":{
|
|
59386
|
+
"confirm":{
|
|
59387
|
+
"actions":[
|
|
59388
|
+
{
|
|
59389
|
+
"actionType": "custom",
|
|
59390
|
+
"script": `
|
|
59391
|
+
const noPermission = event.data.noPermission;
|
|
59392
|
+
const crudComponent = event.context.scoped.getComponentById("${options.crudId}");
|
|
59393
|
+
const selectedItems = crudComponent && crudComponent.props.store.selectedItems.concat();
|
|
59394
|
+
noPermission.forEach(function (item) {
|
|
59395
|
+
crudComponent && crudComponent.unSelectItem(_.find(selectedItems,{_id:item}));
|
|
59396
|
+
})
|
|
59397
|
+
`
|
|
59398
|
+
},
|
|
59399
|
+
{
|
|
59400
|
+
"actionType": "setValue",
|
|
59401
|
+
"componentId": quickEditId,
|
|
59402
|
+
"args": {
|
|
59403
|
+
"value":{
|
|
59404
|
+
"isBatchEdit": true
|
|
59405
|
+
}
|
|
59406
|
+
},
|
|
59407
|
+
}
|
|
59408
|
+
]
|
|
59409
|
+
},
|
|
59410
|
+
"cancel":{
|
|
59411
|
+
"actions":[
|
|
59412
|
+
{
|
|
59413
|
+
"actionType": "setValue",
|
|
59414
|
+
"componentId": quickEditId,
|
|
59415
|
+
"args": {
|
|
59416
|
+
"value":{
|
|
59417
|
+
"isBatchEdit": false
|
|
59418
|
+
}
|
|
59419
|
+
},
|
|
59420
|
+
}
|
|
59421
|
+
]
|
|
59422
|
+
}
|
|
59423
|
+
}
|
|
59424
|
+
},
|
|
59425
|
+
"expression":"${COUNT(event.data.noPermission)>0}"
|
|
59426
|
+
}
|
|
59427
|
+
]
|
|
59428
|
+
}
|
|
59429
|
+
}
|
|
59430
|
+
});
|
|
59431
|
+
}
|
|
59196
59432
|
} else {
|
|
59197
59433
|
quickEditSchema = false;
|
|
59198
59434
|
}
|
|
@@ -59227,6 +59463,8 @@ async function getTableColumns(fields, options){
|
|
|
59227
59463
|
const columns = [];
|
|
59228
59464
|
if(!options.isLookup){
|
|
59229
59465
|
columns.push({name: '_index',type: 'text', width: 32, placeholder: ""});
|
|
59466
|
+
//将_display放入crud的columns中,可以通过setvalue修改行内数据域的_display,而不影响上层items的_display,用于批量编辑
|
|
59467
|
+
columns.push({name: '_display',type: 'static', width: 32, placeholder: "",id: "_display_${_index}", className: "hidden"});
|
|
59230
59468
|
}
|
|
59231
59469
|
const allowEdit = options.permissions?.allowEdit && !options.isLookup && options.enable_inline_edit != false;
|
|
59232
59470
|
|
|
@@ -59258,7 +59496,7 @@ async function getTableColumns(fields, options){
|
|
|
59258
59496
|
{
|
|
59259
59497
|
"args": {
|
|
59260
59498
|
"api": {
|
|
59261
|
-
"url": "${context.rootUrl
|
|
59499
|
+
"url": "${(versions[0] && versions[0].url) ? versions[0].url+'?download=true' : context.rootUrl+'/api/files/files/'+versions[0]+'?download=true'}",
|
|
59262
59500
|
"method": "get",
|
|
59263
59501
|
"headers": {
|
|
59264
59502
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
@@ -59305,7 +59543,7 @@ async function getTableColumns(fields, options){
|
|
|
59305
59543
|
else if(field.type === 'select'){
|
|
59306
59544
|
const map = getSelectMap(field.options);
|
|
59307
59545
|
columnItem = Object.assign({}, {
|
|
59308
|
-
type: "mapping",
|
|
59546
|
+
type: "static-mapping",
|
|
59309
59547
|
name: field.name,
|
|
59310
59548
|
label: field.label,
|
|
59311
59549
|
map: map,
|
|
@@ -59320,7 +59558,7 @@ async function getTableColumns(fields, options){
|
|
|
59320
59558
|
const tpl = await getFieldTpl(field, options);
|
|
59321
59559
|
let type = 'text';
|
|
59322
59560
|
if(tpl){
|
|
59323
|
-
type = '
|
|
59561
|
+
type = 'static';
|
|
59324
59562
|
}else if(field.type === 'html'){
|
|
59325
59563
|
type = 'markdown';
|
|
59326
59564
|
}else if(field.type === 'url'){
|
|
@@ -59361,6 +59599,7 @@ async function getTableColumns(fields, options){
|
|
|
59361
59599
|
columnItem.quickEdit = quickEditSchema;
|
|
59362
59600
|
columnItem.quickEditEnabledOn = "${is_system !== true}";
|
|
59363
59601
|
}
|
|
59602
|
+
columnItem.id = `${options.objectName}_${field.name}_\${_index}`;
|
|
59364
59603
|
columns.push(columnItem);
|
|
59365
59604
|
}
|
|
59366
59605
|
}
|
|
@@ -59639,7 +59878,7 @@ async function getTableOperation(ctx){
|
|
|
59639
59878
|
}
|
|
59640
59879
|
return {
|
|
59641
59880
|
type: 'operation',
|
|
59642
|
-
label:
|
|
59881
|
+
label: "",
|
|
59643
59882
|
fixed: 'right',
|
|
59644
59883
|
labelClassName: 'text-center',
|
|
59645
59884
|
className: 'text-center steedos-listview-operation w-10',
|
|
@@ -59673,23 +59912,87 @@ async function getTableOperation(ctx){
|
|
|
59673
59912
|
}
|
|
59674
59913
|
}
|
|
59675
59914
|
|
|
59915
|
+
async function getDefaultCrudCard(columns, options) {
|
|
59916
|
+
let labelFieldName = options?.labelFieldName || "name";
|
|
59917
|
+
let titleColumn, bodyColumns = [];
|
|
59918
|
+
columns.forEach(function (item) {
|
|
59919
|
+
delete item.quickEdit;
|
|
59920
|
+
delete item.width;
|
|
59921
|
+
if (item.name === labelFieldName) {
|
|
59922
|
+
titleColumn = item;
|
|
59923
|
+
}
|
|
59924
|
+
else {
|
|
59925
|
+
if (item.name !== "_index") {
|
|
59926
|
+
bodyColumns.push(item);
|
|
59927
|
+
}
|
|
59928
|
+
}
|
|
59929
|
+
});
|
|
59930
|
+
let card = {
|
|
59931
|
+
"header": {
|
|
59932
|
+
"title": titleColumn.tpl
|
|
59933
|
+
},
|
|
59934
|
+
body: bodyColumns,
|
|
59935
|
+
// useCardLabel: false,
|
|
59936
|
+
toolbar: []
|
|
59937
|
+
};
|
|
59938
|
+
let hideToolbarOperation = options.formFactor === 'SMALL' || ["split"].indexOf(options.displayAs) > -1;
|
|
59939
|
+
if(!hideToolbarOperation){
|
|
59940
|
+
let toolbarOperation = await getTableOperation(options);
|
|
59941
|
+
if (toolbarOperation) {
|
|
59942
|
+
toolbarOperation.className += " inline-block w-auto";
|
|
59943
|
+
}
|
|
59944
|
+
card.toolbar.push(toolbarOperation);
|
|
59945
|
+
}
|
|
59946
|
+
return card;
|
|
59947
|
+
}
|
|
59948
|
+
|
|
59676
59949
|
async function getTableSchema$1(fields, options){
|
|
59677
59950
|
if(!options){
|
|
59678
59951
|
options = {};
|
|
59679
59952
|
}
|
|
59680
59953
|
let { isLookup, hiddenColumnOperation } = options;
|
|
59954
|
+
const defaults = options.defaults;
|
|
59955
|
+
const listSchema = (defaults && defaults.listSchema) || {};
|
|
59956
|
+
|
|
59681
59957
|
let columns = [];
|
|
59682
59958
|
let useMobileColumns = options.formFactor === 'SMALL' || ["split"].indexOf(options.displayAs) > -1;
|
|
59683
59959
|
if(isLookup){
|
|
59684
59960
|
// 在lookup手机端列表模式调式好之前不使用getMobileTableColumns
|
|
59685
59961
|
useMobileColumns = false;
|
|
59686
59962
|
}
|
|
59963
|
+
if(listSchema.mode && listSchema.mode !== "table"){
|
|
59964
|
+
// 如果指定的mode,则不走我们内置的手机端列表效果,使用steedos组件内部开发的默认card/list效果,或者由用户自己实现card/list模式的crud列表
|
|
59965
|
+
useMobileColumns = false;
|
|
59966
|
+
}
|
|
59687
59967
|
if(useMobileColumns){
|
|
59688
59968
|
columns = await getMobileTableColumns(fields, options);
|
|
59689
59969
|
}
|
|
59690
59970
|
else {
|
|
59691
59971
|
columns = await getTableColumns(fields, options);
|
|
59692
59972
|
|
|
59973
|
+
if(listSchema.mode === "cards"){
|
|
59974
|
+
let card = listSchema.card;
|
|
59975
|
+
if(!card){
|
|
59976
|
+
card = await getDefaultCrudCard(columns, options);
|
|
59977
|
+
}
|
|
59978
|
+
return {
|
|
59979
|
+
mode: "cards",
|
|
59980
|
+
perPageAvailable: [5, 10, 20, 50, 100, 500],
|
|
59981
|
+
name: "thelist",
|
|
59982
|
+
headerToolbarClassName: "py-2 px-2 border-gray-300 border-solid border-b",
|
|
59983
|
+
className: "",
|
|
59984
|
+
draggable: false,
|
|
59985
|
+
defaultParams: getDefaultParams(options),
|
|
59986
|
+
card: card,
|
|
59987
|
+
syncLocation: false,
|
|
59988
|
+
keepItemSelectionOnPageChange: true,
|
|
59989
|
+
checkOnItemClick: isLookup ? true : false,
|
|
59990
|
+
labelTpl: `\${${options.labelFieldName}}`,
|
|
59991
|
+
autoFillHeight: false, // 自动高度效果不理想,先关闭
|
|
59992
|
+
columnsTogglable: false
|
|
59993
|
+
}
|
|
59994
|
+
}
|
|
59995
|
+
|
|
59693
59996
|
if(!isLookup && !hiddenColumnOperation){
|
|
59694
59997
|
columns.push(await getTableOperation(options));
|
|
59695
59998
|
}
|
|
@@ -59697,6 +60000,7 @@ async function getTableSchema$1(fields, options){
|
|
|
59697
60000
|
|
|
59698
60001
|
return {
|
|
59699
60002
|
mode: "table",
|
|
60003
|
+
perPageAvailable: [5, 10, 20, 50, 100, 500],
|
|
59700
60004
|
name: "thelist",
|
|
59701
60005
|
headerToolbarClassName: "py-2 px-2 border-gray-300 border-solid border-b",
|
|
59702
60006
|
className: "",
|
|
@@ -59784,8 +60088,8 @@ function isObject(obj) {
|
|
|
59784
60088
|
/*
|
|
59785
60089
|
* @Author: baozhoutao@steedos.com
|
|
59786
60090
|
* @Date: 2022-07-05 15:55:39
|
|
59787
|
-
* @LastEditors:
|
|
59788
|
-
* @LastEditTime: 2023-
|
|
60091
|
+
* @LastEditors: liaodaxue
|
|
60092
|
+
* @LastEditTime: 2023-10-20 11:38:25
|
|
59789
60093
|
* @Description:
|
|
59790
60094
|
*/
|
|
59791
60095
|
|
|
@@ -60082,8 +60386,8 @@ async function getListSchema(
|
|
|
60082
60386
|
"filtersFunction": listview_filters,
|
|
60083
60387
|
"sort": sort,
|
|
60084
60388
|
"ctx": ctx,
|
|
60085
|
-
"requestAdaptor": listView.requestAdaptor,
|
|
60086
|
-
"adaptor": listView.adaptor,
|
|
60389
|
+
"requestAdaptor": listView.requestAdaptor || ctx.requestAdaptor,
|
|
60390
|
+
"adaptor": listView.adaptor || ctx.adaptor,
|
|
60087
60391
|
"headerToolbarItems": ctx.headerToolbarItems,
|
|
60088
60392
|
"filterVisible": ctx.filterVisible,
|
|
60089
60393
|
"rowClassNameExpr": ctx.rowClassNameExpr,
|
|
@@ -65217,7 +65521,13 @@ var PLACEHOLDER_ID = 'placeholder';
|
|
|
65217
65521
|
var empty = [];
|
|
65218
65522
|
function MultipleContainers(props) {
|
|
65219
65523
|
var _this = this;
|
|
65220
|
-
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,
|
|
65524
|
+
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,
|
|
65525
|
+
// strategy = verticalListSortingStrategy,
|
|
65526
|
+
_j = props.strategy,
|
|
65527
|
+
// strategy = verticalListSortingStrategy,
|
|
65528
|
+
strategy = _j === void 0 ? rectSortingStrategy : _j, //这里默认值不用rectSortingStrategy的话,会出现字段在左右两边拖动变更顺序时拖动过程中dragOverlay丢失问题
|
|
65529
|
+
_k = props.addable, //这里默认值不用rectSortingStrategy的话,会出现字段在左右两边拖动变更顺序时拖动过程中dragOverlay丢失问题
|
|
65530
|
+
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 ? [{
|
|
65221
65531
|
"type": "tpl",
|
|
65222
65532
|
"tpl": "${label}",
|
|
65223
65533
|
"inline": false,
|
|
@@ -65225,24 +65535,28 @@ function MultipleContainers(props) {
|
|
|
65225
65535
|
"type": "tpl",
|
|
65226
65536
|
"tpl": "${label}",
|
|
65227
65537
|
}] : _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;
|
|
65228
|
-
|
|
65538
|
+
value && delete (value.$$id);
|
|
65229
65539
|
var _w = __read(react.exports.useState(function () {
|
|
65230
65540
|
var _a;
|
|
65231
|
-
return (_a =
|
|
65541
|
+
return (_a = value) !== null && _a !== void 0 ? _a : {
|
|
65232
65542
|
A: ['A1', 'A2'],
|
|
65233
65543
|
B: ['B1', 'B2'],
|
|
65234
65544
|
C: ['C1', 'C2'],
|
|
65235
65545
|
};
|
|
65236
65546
|
}), 2), items = _w[0], setItems = _w[1];
|
|
65237
65547
|
var _x = __read(react.exports.useState(Object.keys(items)), 2), containers = _x[0], setContainers = _x[1];
|
|
65238
|
-
|
|
65548
|
+
react.exports.useEffect(function () {
|
|
65549
|
+
setItems(value);
|
|
65550
|
+
setContainers(Object.keys(value));
|
|
65551
|
+
}, [value]);
|
|
65552
|
+
var handleChange = function (newItems) { return __awaiter(_this, void 0, void 0, function () {
|
|
65239
65553
|
var value, rendererEvent;
|
|
65240
65554
|
return __generator(this, function (_a) {
|
|
65241
65555
|
switch (_a.label) {
|
|
65242
65556
|
case 0:
|
|
65243
65557
|
if (!amisDispatchEvent || !amisOnChange)
|
|
65244
65558
|
return [2 /*return*/];
|
|
65245
|
-
value = items;
|
|
65559
|
+
value = newItems || items;
|
|
65246
65560
|
return [4 /*yield*/, amisDispatchEvent('change', createObject(amisData, {
|
|
65247
65561
|
value: value
|
|
65248
65562
|
}))];
|
|
@@ -65251,7 +65565,7 @@ function MultipleContainers(props) {
|
|
|
65251
65565
|
if (rendererEvent === null || rendererEvent === void 0 ? void 0 : rendererEvent.prevented) {
|
|
65252
65566
|
return [2 /*return*/];
|
|
65253
65567
|
}
|
|
65254
|
-
setTimeout(function () { return amisOnChange(value); },
|
|
65568
|
+
setTimeout(function () { return amisOnChange(value); }, 500);
|
|
65255
65569
|
return [2 /*return*/];
|
|
65256
65570
|
}
|
|
65257
65571
|
});
|
|
@@ -65354,6 +65668,7 @@ function MultipleContainers(props) {
|
|
|
65354
65668
|
var active = _a.active, over = _a.over;
|
|
65355
65669
|
var overId = over === null || over === void 0 ? void 0 : over.id;
|
|
65356
65670
|
if (overId == null || overId === TRASH_ID || active.id in items) {
|
|
65671
|
+
// 拖动的是分组则跳过后面的逻辑
|
|
65357
65672
|
return;
|
|
65358
65673
|
}
|
|
65359
65674
|
var overContainer = findContainer(overId);
|
|
@@ -65429,19 +65744,44 @@ function MultipleContainers(props) {
|
|
|
65429
65744
|
return;
|
|
65430
65745
|
}
|
|
65431
65746
|
var overContainer = findContainer(overId);
|
|
65747
|
+
var newItems = items;
|
|
65432
65748
|
if (overContainer) {
|
|
65433
|
-
|
|
65434
|
-
|
|
65435
|
-
|
|
65436
|
-
|
|
65437
|
-
|
|
65438
|
-
|
|
65439
|
-
|
|
65749
|
+
if (activeContainer !== overContainer) {
|
|
65750
|
+
// 拖动变更分组之间的顺序时,activeContainer 与 overContainer 值不相等
|
|
65751
|
+
setTimeout(function () {
|
|
65752
|
+
var sortedGroups = over.data.current.sortable.items; //不加setTimeout的话,这里拿到的会是变更前的数据
|
|
65753
|
+
newItems = {};
|
|
65754
|
+
sortedGroups.forEach(function (groupKey) {
|
|
65755
|
+
newItems[groupKey] = items[groupKey];
|
|
65756
|
+
});
|
|
65757
|
+
delete newItems[TRASH_ID];
|
|
65758
|
+
delete newItems[PLACEHOLDER_ID];
|
|
65759
|
+
if (lodash.exports.keys(items).join(",") !== lodash.exports.keys(newItems).join(",")) {
|
|
65760
|
+
// 只有顺序发生变化时才触发change事件
|
|
65761
|
+
setItems(newItems);
|
|
65762
|
+
// console.log('拖动结束2,更新form value')
|
|
65763
|
+
handleChange(newItems);
|
|
65764
|
+
}
|
|
65765
|
+
setActiveId(null);
|
|
65766
|
+
}, 500);
|
|
65767
|
+
return;
|
|
65768
|
+
}
|
|
65769
|
+
else {
|
|
65770
|
+
// 同一个分组中字段顺序变更以及把一个字段从某个分组拖动到另一个分组内时,activeContainer 与 overContainer 值相等
|
|
65771
|
+
var activeIndex_1 = items[activeContainer].indexOf(active.id);
|
|
65772
|
+
var overIndex_1 = items[overContainer].indexOf(overId);
|
|
65773
|
+
if (activeIndex_1 !== overIndex_1) {
|
|
65774
|
+
setItems(function (items) {
|
|
65775
|
+
var _a;
|
|
65776
|
+
newItems = __assign$1(__assign$1({}, items), (_a = {}, _a[overContainer] = arrayMove(items[overContainer], activeIndex_1, overIndex_1), _a));
|
|
65777
|
+
return newItems;
|
|
65778
|
+
});
|
|
65779
|
+
}
|
|
65440
65780
|
}
|
|
65441
65781
|
}
|
|
65442
65782
|
setActiveId(null);
|
|
65443
65783
|
// console.log('拖动结束2,更新form value')
|
|
65444
|
-
handleChange();
|
|
65784
|
+
handleChange(newItems);
|
|
65445
65785
|
}, cancelDrop: cancelDrop, onDragCancel: onDragCancel, modifiers: modifiers },
|
|
65446
65786
|
React.createElement("div", { style: {
|
|
65447
65787
|
display: 'inline-grid',
|