@steedos-widgets/sortable 1.3.4-beta.8 → 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 +482 -139
- package/dist/sortable.cjs.js.map +1 -1
- package/dist/sortable.esm.js +482 -139
- package/dist/sortable.esm.js.map +1 -1
- package/dist/sortable.umd.js +482 -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
|
}
|
|
@@ -57401,10 +57423,13 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
57401
57423
|
const op = api.data.$self.op;
|
|
57402
57424
|
if(!_.isEmpty(op)){
|
|
57403
57425
|
// op不为空,表示处于字段初始编辑状态,不是点击后出现弹窗状态。
|
|
57426
|
+
// 这里不可以用_.pick函数让payload只返回labelField和valueField,因为字段上配置的amis autoFill功能可能依赖了其他字段
|
|
57427
|
+
/*
|
|
57404
57428
|
const rows = _.map(payload.data.rows, (item)=>{
|
|
57405
57429
|
return _.pick(item, ["${referenceTo.labelField.name}", "${referenceTo.valueField.name}"]);
|
|
57406
57430
|
})
|
|
57407
57431
|
payload.data.rows = rows;
|
|
57432
|
+
*/
|
|
57408
57433
|
return payload;
|
|
57409
57434
|
}
|
|
57410
57435
|
if(enable_tree){
|
|
@@ -57485,13 +57510,15 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
57485
57510
|
pickerSchema.headerToolbar = getObjectHeaderToolbar(refObjectConfig, fieldsArr, ctx.formFactor, { headerToolbarItems, isLookup: true, keywordsSearchBoxName });
|
|
57486
57511
|
const isAllowCreate = refObjectConfig.permissions.allowCreate;
|
|
57487
57512
|
const isCreate = lodash.exports.isBoolean(field.create) ? field.create : true;
|
|
57488
|
-
|
|
57513
|
+
// lookup字段配置过滤条件就强制不显示新建按钮
|
|
57514
|
+
let isHasFilters = (field.filters || field._filtersFunction) ? true : false;
|
|
57515
|
+
if (isAllowCreate && isCreate && !isHasFilters) {
|
|
57489
57516
|
const new_button = await getSchema$5(refObjectConfig, { appId: ctx.appId, objectName: refObjectConfig.name, formFactor: ctx.formFactor });
|
|
57490
57517
|
new_button.align = "right";
|
|
57491
57518
|
// 保持快速搜索放在最左侧,新建按钮往里插,而不是push到最后
|
|
57492
57519
|
pickerSchema.headerToolbar.splice(pickerSchema.headerToolbar.length - 1, 0, new_button);
|
|
57493
57520
|
}
|
|
57494
|
-
pickerSchema.footerToolbar = refObjectConfig.enable_tree ? [] : getObjectFooterToolbar();
|
|
57521
|
+
pickerSchema.footerToolbar = refObjectConfig.enable_tree ? [] : getObjectFooterToolbar(refObjectConfig,ctx.formFactor,{isLookup: true});
|
|
57495
57522
|
if (ctx.filterVisible !== false) {
|
|
57496
57523
|
pickerSchema.filter = await getObjectFilter(refObjectConfig, fields, {
|
|
57497
57524
|
...ctx,
|
|
@@ -57619,10 +57646,10 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
57619
57646
|
// const labelFieldKey = referenceTo && referenceTo.labelField?.name || 'name';
|
|
57620
57647
|
|
|
57621
57648
|
let apiInfo;
|
|
57622
|
-
|
|
57649
|
+
let defaultValueOptionsQueryData;
|
|
57623
57650
|
if(referenceTo){
|
|
57624
57651
|
// 字段值单独走一个请求合并到source的同一个GraphQL接口中
|
|
57625
|
-
|
|
57652
|
+
defaultValueOptionsQueryData = await getFindQuery({ name: referenceTo.objectName }, null, [
|
|
57626
57653
|
Object.assign({}, referenceTo.labelField, {alias: 'label'}),
|
|
57627
57654
|
Object.assign({}, referenceTo.valueField, {alias: 'value'})
|
|
57628
57655
|
], {
|
|
@@ -57635,7 +57662,7 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
57635
57662
|
}, null, [
|
|
57636
57663
|
Object.assign({}, referenceTo.labelField, {alias: 'label'}),
|
|
57637
57664
|
Object.assign({}, referenceTo.valueField, {alias: 'value'})
|
|
57638
|
-
], {expand: false, alias: 'options', queryOptions: `filters: {__filters}, top: {__top}, sort: "{__sort}"
|
|
57665
|
+
], {expand: false, alias: 'options', queryOptions: `filters: {__filters}, top: {__top}, sort: "{__sort}"`});
|
|
57639
57666
|
|
|
57640
57667
|
apiInfo.adaptor = `
|
|
57641
57668
|
const data = payload.data;
|
|
@@ -57729,11 +57756,16 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
57729
57756
|
var optionsFiltersOp = "${field.multiple ? "in" : "="}";
|
|
57730
57757
|
var optionsFilters = [["${valueFieldKey}", optionsFiltersOp, []]];
|
|
57731
57758
|
if (defaultValue && !api.data.$term) {
|
|
57759
|
+
const defaultValueOptionsQueryData = ${JSON.stringify(defaultValueOptionsQueryData)};
|
|
57760
|
+
const defaultValueOptionsQuery = defaultValueOptionsQueryData?.query?.replace(/^{/,"").replace(/}$/,"");
|
|
57732
57761
|
// 字段值单独请求,没值的时候在请求中返回空
|
|
57733
57762
|
optionsFilters = [["${valueFieldKey}", optionsFiltersOp, defaultValue]];
|
|
57734
57763
|
if(filters.length > 0){
|
|
57735
57764
|
optionsFilters = [filters, optionsFilters];
|
|
57736
57765
|
}
|
|
57766
|
+
if(defaultValueOptionsQuery){
|
|
57767
|
+
api.data.query = "{"+api.data.query.replace(/^{/,"").replace(/}$/,"")+","+defaultValueOptionsQuery+"}";
|
|
57768
|
+
}
|
|
57737
57769
|
}
|
|
57738
57770
|
api.data.query = api.data.query.replace(/{__options_filters}/g, JSON.stringify(optionsFilters));
|
|
57739
57771
|
return api;
|
|
@@ -57775,7 +57807,7 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
57775
57807
|
disabledOn: `${readonly} || ( (this._master && (this._master.relatedKey ==='${field.name}')) || ((this.relatedKey ==='${field.name}') && (${field.multiple} != true)) )`,
|
|
57776
57808
|
// labelField: labelField,
|
|
57777
57809
|
// valueField: valueField,
|
|
57778
|
-
source: apiInfo,
|
|
57810
|
+
// source: apiInfo,
|
|
57779
57811
|
autoComplete: apiInfo,
|
|
57780
57812
|
searchable: true,
|
|
57781
57813
|
};
|
|
@@ -57854,10 +57886,10 @@ async function lookupToAmis(field, readonly, ctx){
|
|
|
57854
57886
|
|
|
57855
57887
|
const refObject = await getUISchema(referenceTo.objectName);
|
|
57856
57888
|
|
|
57857
|
-
//
|
|
57858
|
-
|
|
57859
|
-
//
|
|
57860
|
-
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){
|
|
57861
57893
|
return await lookupToAmisPicker(field, readonly, ctx);
|
|
57862
57894
|
}else if(refObject.enable_tree) {
|
|
57863
57895
|
return await lookupToAmisTreeSelect(field, readonly, Object.assign({}, ctx, {
|
|
@@ -58170,8 +58202,8 @@ function getAmisStaticFieldType(type, readonly, options){
|
|
|
58170
58202
|
/*
|
|
58171
58203
|
* @Author: baozhoutao@steedos.com
|
|
58172
58204
|
* @Date: 2022-10-28 14:15:09
|
|
58173
|
-
* @LastEditors:
|
|
58174
|
-
* @LastEditTime:
|
|
58205
|
+
* @LastEditors: liaodaxue
|
|
58206
|
+
* @LastEditTime: 2023-10-30 17:51:54
|
|
58175
58207
|
* @Description:
|
|
58176
58208
|
*/
|
|
58177
58209
|
|
|
@@ -58222,11 +58254,26 @@ const getAmisFileEditSchema = (steedosField)=>{
|
|
|
58222
58254
|
useChunk: false, // 关闭分块上传
|
|
58223
58255
|
receiver: {
|
|
58224
58256
|
method: "post",
|
|
58257
|
+
dataType: "form-data",
|
|
58225
58258
|
url: `\${context.rootUrl}/s3/${tableName}`,
|
|
58226
|
-
|
|
58227
|
-
|
|
58228
|
-
|
|
58229
|
-
|
|
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
|
+
`,
|
|
58230
58277
|
adaptor: `
|
|
58231
58278
|
const { context } = api.body;
|
|
58232
58279
|
var rootUrl = context.rootUrl + "/api/files/${tableName}/";
|
|
@@ -58307,8 +58354,6 @@ function getSelectFieldOptions(field){
|
|
|
58307
58354
|
}
|
|
58308
58355
|
|
|
58309
58356
|
async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
58310
|
-
// console.log('convertSFieldToAmisField====>', field, readonly, ctx)
|
|
58311
|
-
const isMobile = window.innerWidth <= 768;
|
|
58312
58357
|
// 创建人和修改人、创建时间和修改时间不显示
|
|
58313
58358
|
if(lodash.exports.includes(OMIT_FIELDS, field.name) && ctx.showSystemFields != true){
|
|
58314
58359
|
return;
|
|
@@ -58397,26 +58442,33 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
58397
58442
|
};
|
|
58398
58443
|
break;
|
|
58399
58444
|
case 'date':
|
|
58400
|
-
convertData = isMobile && !readonly ? {
|
|
58401
|
-
|
|
58402
|
-
|
|
58403
|
-
|
|
58404
|
-
|
|
58405
|
-
|
|
58406
|
-
|
|
58407
|
-
|
|
58408
|
-
|
|
58409
|
-
|
|
58410
|
-
|
|
58411
|
-
|
|
58412
|
-
|
|
58413
|
-
|
|
58414
|
-
|
|
58415
|
-
|
|
58416
|
-
|
|
58417
|
-
|
|
58418
|
-
|
|
58419
|
-
} : {
|
|
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 = {
|
|
58420
58472
|
type: getAmisStaticFieldType('date', readonly),
|
|
58421
58473
|
inputFormat: "YYYY-MM-DD",
|
|
58422
58474
|
format:'YYYY-MM-DDT00:00:00.000[Z]',
|
|
@@ -58435,43 +58487,51 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
58435
58487
|
};
|
|
58436
58488
|
break;
|
|
58437
58489
|
case 'datetime':
|
|
58438
|
-
convertData = isMobile && !readonly ? {
|
|
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
|
-
|
|
58474
|
-
} : {
|
|
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 = {
|
|
58475
58535
|
type: getAmisStaticFieldType('datetime', readonly),
|
|
58476
58536
|
inputFormat: 'YYYY-MM-DD HH:mm',
|
|
58477
58537
|
format: 'YYYY-MM-DDTHH:mm:ss.SSSZ',
|
|
@@ -58491,26 +58551,34 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
58491
58551
|
};
|
|
58492
58552
|
break;
|
|
58493
58553
|
case 'time':
|
|
58494
|
-
convertData = isMobile && !readonly ? {
|
|
58495
|
-
|
|
58496
|
-
|
|
58497
|
-
|
|
58498
|
-
|
|
58499
|
-
|
|
58500
|
-
|
|
58501
|
-
|
|
58502
|
-
|
|
58503
|
-
|
|
58504
|
-
|
|
58505
|
-
|
|
58506
|
-
|
|
58507
|
-
|
|
58508
|
-
|
|
58509
|
-
|
|
58510
|
-
|
|
58511
|
-
|
|
58512
|
-
|
|
58513
|
-
} : {
|
|
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 = {
|
|
58514
58582
|
type: getAmisStaticFieldType('time', readonly),
|
|
58515
58583
|
inputFormat: 'HH:mm',
|
|
58516
58584
|
timeFormat:'HH:mm',
|
|
@@ -58560,7 +58628,20 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
58560
58628
|
type: getAmisStaticFieldType('number', readonly),
|
|
58561
58629
|
min: field.min,
|
|
58562
58630
|
max: field.max,
|
|
58563
|
-
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
|
+
},
|
|
58564
58645
|
};
|
|
58565
58646
|
}
|
|
58566
58647
|
break;
|
|
@@ -58955,8 +59036,41 @@ var config = {
|
|
|
58955
59036
|
};
|
|
58956
59037
|
|
|
58957
59038
|
async function getQuickEditSchema(field, options){
|
|
58958
|
-
|
|
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传值
|
|
58959
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
|
+
|
|
58960
59074
|
if (field.disabled) {
|
|
58961
59075
|
quickEditSchema = false;
|
|
58962
59076
|
} else {
|
|
@@ -58973,7 +59087,7 @@ async function getQuickEditSchema(field, options){
|
|
|
58973
59087
|
{
|
|
58974
59088
|
"actionType": "custom",
|
|
58975
59089
|
"script": `
|
|
58976
|
-
var _display = event.data._display;
|
|
59090
|
+
var _display = _.cloneDeep(event.data._display);
|
|
58977
59091
|
${displayField}
|
|
58978
59092
|
doAction({actionType: 'setValue', "args": {"value": {_display}},componentId: "${quickEditId}"});
|
|
58979
59093
|
`
|
|
@@ -58995,7 +59109,7 @@ async function getQuickEditSchema(field, options){
|
|
|
58995
59109
|
第二种是增加选项时,按照value的值,找到对应选项,并按照_display的规则为其赋值
|
|
58996
59110
|
*/
|
|
58997
59111
|
TempDisplayField = `
|
|
58998
|
-
const preData = event.data.__super.${field.name};
|
|
59112
|
+
const preData = _.cloneDeep(event.data.__super.${field.name});
|
|
58999
59113
|
if(preData && event.data.${field.name}.length < preData.length){
|
|
59000
59114
|
let deletedIndex;
|
|
59001
59115
|
preData.forEach(function(item,index){
|
|
@@ -59039,7 +59153,7 @@ async function getQuickEditSchema(field, options){
|
|
|
59039
59153
|
break;
|
|
59040
59154
|
case "percent":
|
|
59041
59155
|
TempDisplayField = `
|
|
59042
|
-
_display["${field.name}"] =
|
|
59156
|
+
_display["${field.name}"] = event.data.value.toFixed(${field.scale}) + '%';
|
|
59043
59157
|
`;
|
|
59044
59158
|
quickEditSchema.body[0].onEvent["change"] = quickEditOnEvent(TempDisplayField);
|
|
59045
59159
|
break;
|
|
@@ -59190,6 +59304,131 @@ async function getQuickEditSchema(field, options){
|
|
|
59190
59304
|
}
|
|
59191
59305
|
|
|
59192
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
|
+
}
|
|
59193
59432
|
} else {
|
|
59194
59433
|
quickEditSchema = false;
|
|
59195
59434
|
}
|
|
@@ -59224,6 +59463,8 @@ async function getTableColumns(fields, options){
|
|
|
59224
59463
|
const columns = [];
|
|
59225
59464
|
if(!options.isLookup){
|
|
59226
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"});
|
|
59227
59468
|
}
|
|
59228
59469
|
const allowEdit = options.permissions?.allowEdit && !options.isLookup && options.enable_inline_edit != false;
|
|
59229
59470
|
|
|
@@ -59255,7 +59496,7 @@ async function getTableColumns(fields, options){
|
|
|
59255
59496
|
{
|
|
59256
59497
|
"args": {
|
|
59257
59498
|
"api": {
|
|
59258
|
-
"url": "${context.rootUrl
|
|
59499
|
+
"url": "${(versions[0] && versions[0].url) ? versions[0].url+'?download=true' : context.rootUrl+'/api/files/files/'+versions[0]+'?download=true'}",
|
|
59259
59500
|
"method": "get",
|
|
59260
59501
|
"headers": {
|
|
59261
59502
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
@@ -59302,7 +59543,7 @@ async function getTableColumns(fields, options){
|
|
|
59302
59543
|
else if(field.type === 'select'){
|
|
59303
59544
|
const map = getSelectMap(field.options);
|
|
59304
59545
|
columnItem = Object.assign({}, {
|
|
59305
|
-
type: "mapping",
|
|
59546
|
+
type: "static-mapping",
|
|
59306
59547
|
name: field.name,
|
|
59307
59548
|
label: field.label,
|
|
59308
59549
|
map: map,
|
|
@@ -59317,7 +59558,7 @@ async function getTableColumns(fields, options){
|
|
|
59317
59558
|
const tpl = await getFieldTpl(field, options);
|
|
59318
59559
|
let type = 'text';
|
|
59319
59560
|
if(tpl){
|
|
59320
|
-
type = '
|
|
59561
|
+
type = 'static';
|
|
59321
59562
|
}else if(field.type === 'html'){
|
|
59322
59563
|
type = 'markdown';
|
|
59323
59564
|
}else if(field.type === 'url'){
|
|
@@ -59358,6 +59599,7 @@ async function getTableColumns(fields, options){
|
|
|
59358
59599
|
columnItem.quickEdit = quickEditSchema;
|
|
59359
59600
|
columnItem.quickEditEnabledOn = "${is_system !== true}";
|
|
59360
59601
|
}
|
|
59602
|
+
columnItem.id = `${options.objectName}_${field.name}_\${_index}`;
|
|
59361
59603
|
columns.push(columnItem);
|
|
59362
59604
|
}
|
|
59363
59605
|
}
|
|
@@ -59636,7 +59878,7 @@ async function getTableOperation(ctx){
|
|
|
59636
59878
|
}
|
|
59637
59879
|
return {
|
|
59638
59880
|
type: 'operation',
|
|
59639
|
-
label:
|
|
59881
|
+
label: "",
|
|
59640
59882
|
fixed: 'right',
|
|
59641
59883
|
labelClassName: 'text-center',
|
|
59642
59884
|
className: 'text-center steedos-listview-operation w-10',
|
|
@@ -59670,23 +59912,87 @@ async function getTableOperation(ctx){
|
|
|
59670
59912
|
}
|
|
59671
59913
|
}
|
|
59672
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
|
+
|
|
59673
59949
|
async function getTableSchema$1(fields, options){
|
|
59674
59950
|
if(!options){
|
|
59675
59951
|
options = {};
|
|
59676
59952
|
}
|
|
59677
59953
|
let { isLookup, hiddenColumnOperation } = options;
|
|
59954
|
+
const defaults = options.defaults;
|
|
59955
|
+
const listSchema = (defaults && defaults.listSchema) || {};
|
|
59956
|
+
|
|
59678
59957
|
let columns = [];
|
|
59679
59958
|
let useMobileColumns = options.formFactor === 'SMALL' || ["split"].indexOf(options.displayAs) > -1;
|
|
59680
59959
|
if(isLookup){
|
|
59681
59960
|
// 在lookup手机端列表模式调式好之前不使用getMobileTableColumns
|
|
59682
59961
|
useMobileColumns = false;
|
|
59683
59962
|
}
|
|
59963
|
+
if(listSchema.mode && listSchema.mode !== "table"){
|
|
59964
|
+
// 如果指定的mode,则不走我们内置的手机端列表效果,使用steedos组件内部开发的默认card/list效果,或者由用户自己实现card/list模式的crud列表
|
|
59965
|
+
useMobileColumns = false;
|
|
59966
|
+
}
|
|
59684
59967
|
if(useMobileColumns){
|
|
59685
59968
|
columns = await getMobileTableColumns(fields, options);
|
|
59686
59969
|
}
|
|
59687
59970
|
else {
|
|
59688
59971
|
columns = await getTableColumns(fields, options);
|
|
59689
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
|
+
|
|
59690
59996
|
if(!isLookup && !hiddenColumnOperation){
|
|
59691
59997
|
columns.push(await getTableOperation(options));
|
|
59692
59998
|
}
|
|
@@ -59694,6 +60000,7 @@ async function getTableSchema$1(fields, options){
|
|
|
59694
60000
|
|
|
59695
60001
|
return {
|
|
59696
60002
|
mode: "table",
|
|
60003
|
+
perPageAvailable: [5, 10, 20, 50, 100, 500],
|
|
59697
60004
|
name: "thelist",
|
|
59698
60005
|
headerToolbarClassName: "py-2 px-2 border-gray-300 border-solid border-b",
|
|
59699
60006
|
className: "",
|
|
@@ -59781,8 +60088,8 @@ function isObject(obj) {
|
|
|
59781
60088
|
/*
|
|
59782
60089
|
* @Author: baozhoutao@steedos.com
|
|
59783
60090
|
* @Date: 2022-07-05 15:55:39
|
|
59784
|
-
* @LastEditors:
|
|
59785
|
-
* @LastEditTime: 2023-
|
|
60091
|
+
* @LastEditors: liaodaxue
|
|
60092
|
+
* @LastEditTime: 2023-10-20 11:38:25
|
|
59786
60093
|
* @Description:
|
|
59787
60094
|
*/
|
|
59788
60095
|
|
|
@@ -60079,8 +60386,8 @@ async function getListSchema(
|
|
|
60079
60386
|
"filtersFunction": listview_filters,
|
|
60080
60387
|
"sort": sort,
|
|
60081
60388
|
"ctx": ctx,
|
|
60082
|
-
"requestAdaptor": listView.requestAdaptor,
|
|
60083
|
-
"adaptor": listView.adaptor,
|
|
60389
|
+
"requestAdaptor": listView.requestAdaptor || ctx.requestAdaptor,
|
|
60390
|
+
"adaptor": listView.adaptor || ctx.adaptor,
|
|
60084
60391
|
"headerToolbarItems": ctx.headerToolbarItems,
|
|
60085
60392
|
"filterVisible": ctx.filterVisible,
|
|
60086
60393
|
"rowClassNameExpr": ctx.rowClassNameExpr,
|
|
@@ -65214,7 +65521,13 @@ var PLACEHOLDER_ID = 'placeholder';
|
|
|
65214
65521
|
var empty = [];
|
|
65215
65522
|
function MultipleContainers(props) {
|
|
65216
65523
|
var _this = this;
|
|
65217
|
-
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 ? [{
|
|
65218
65531
|
"type": "tpl",
|
|
65219
65532
|
"tpl": "${label}",
|
|
65220
65533
|
"inline": false,
|
|
@@ -65222,24 +65535,28 @@ function MultipleContainers(props) {
|
|
|
65222
65535
|
"type": "tpl",
|
|
65223
65536
|
"tpl": "${label}",
|
|
65224
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;
|
|
65225
|
-
|
|
65538
|
+
value && delete (value.$$id);
|
|
65226
65539
|
var _w = __read(react.exports.useState(function () {
|
|
65227
65540
|
var _a;
|
|
65228
|
-
return (_a =
|
|
65541
|
+
return (_a = value) !== null && _a !== void 0 ? _a : {
|
|
65229
65542
|
A: ['A1', 'A2'],
|
|
65230
65543
|
B: ['B1', 'B2'],
|
|
65231
65544
|
C: ['C1', 'C2'],
|
|
65232
65545
|
};
|
|
65233
65546
|
}), 2), items = _w[0], setItems = _w[1];
|
|
65234
65547
|
var _x = __read(react.exports.useState(Object.keys(items)), 2), containers = _x[0], setContainers = _x[1];
|
|
65235
|
-
|
|
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 () {
|
|
65236
65553
|
var value, rendererEvent;
|
|
65237
65554
|
return __generator(this, function (_a) {
|
|
65238
65555
|
switch (_a.label) {
|
|
65239
65556
|
case 0:
|
|
65240
65557
|
if (!amisDispatchEvent || !amisOnChange)
|
|
65241
65558
|
return [2 /*return*/];
|
|
65242
|
-
value = items;
|
|
65559
|
+
value = newItems || items;
|
|
65243
65560
|
return [4 /*yield*/, amisDispatchEvent('change', createObject(amisData, {
|
|
65244
65561
|
value: value
|
|
65245
65562
|
}))];
|
|
@@ -65248,7 +65565,7 @@ function MultipleContainers(props) {
|
|
|
65248
65565
|
if (rendererEvent === null || rendererEvent === void 0 ? void 0 : rendererEvent.prevented) {
|
|
65249
65566
|
return [2 /*return*/];
|
|
65250
65567
|
}
|
|
65251
|
-
setTimeout(function () { return amisOnChange(value); },
|
|
65568
|
+
setTimeout(function () { return amisOnChange(value); }, 500);
|
|
65252
65569
|
return [2 /*return*/];
|
|
65253
65570
|
}
|
|
65254
65571
|
});
|
|
@@ -65351,6 +65668,7 @@ function MultipleContainers(props) {
|
|
|
65351
65668
|
var active = _a.active, over = _a.over;
|
|
65352
65669
|
var overId = over === null || over === void 0 ? void 0 : over.id;
|
|
65353
65670
|
if (overId == null || overId === TRASH_ID || active.id in items) {
|
|
65671
|
+
// 拖动的是分组则跳过后面的逻辑
|
|
65354
65672
|
return;
|
|
65355
65673
|
}
|
|
65356
65674
|
var overContainer = findContainer(overId);
|
|
@@ -65426,19 +65744,44 @@ function MultipleContainers(props) {
|
|
|
65426
65744
|
return;
|
|
65427
65745
|
}
|
|
65428
65746
|
var overContainer = findContainer(overId);
|
|
65747
|
+
var newItems = items;
|
|
65429
65748
|
if (overContainer) {
|
|
65430
|
-
|
|
65431
|
-
|
|
65432
|
-
|
|
65433
|
-
|
|
65434
|
-
|
|
65435
|
-
|
|
65436
|
-
|
|
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
|
+
}
|
|
65437
65780
|
}
|
|
65438
65781
|
}
|
|
65439
65782
|
setActiveId(null);
|
|
65440
65783
|
// console.log('拖动结束2,更新form value')
|
|
65441
|
-
handleChange();
|
|
65784
|
+
handleChange(newItems);
|
|
65442
65785
|
}, cancelDrop: cancelDrop, onDragCancel: onDragCancel, modifiers: modifiers },
|
|
65443
65786
|
React.createElement("div", { style: {
|
|
65444
65787
|
display: 'inline-grid',
|