@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.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
|
}
|
|
@@ -57397,10 +57419,13 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
57397
57419
|
const op = api.data.$self.op;
|
|
57398
57420
|
if(!_.isEmpty(op)){
|
|
57399
57421
|
// op不为空,表示处于字段初始编辑状态,不是点击后出现弹窗状态。
|
|
57422
|
+
// 这里不可以用_.pick函数让payload只返回labelField和valueField,因为字段上配置的amis autoFill功能可能依赖了其他字段
|
|
57423
|
+
/*
|
|
57400
57424
|
const rows = _.map(payload.data.rows, (item)=>{
|
|
57401
57425
|
return _.pick(item, ["${referenceTo.labelField.name}", "${referenceTo.valueField.name}"]);
|
|
57402
57426
|
})
|
|
57403
57427
|
payload.data.rows = rows;
|
|
57428
|
+
*/
|
|
57404
57429
|
return payload;
|
|
57405
57430
|
}
|
|
57406
57431
|
if(enable_tree){
|
|
@@ -57481,13 +57506,15 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
57481
57506
|
pickerSchema.headerToolbar = getObjectHeaderToolbar(refObjectConfig, fieldsArr, ctx.formFactor, { headerToolbarItems, isLookup: true, keywordsSearchBoxName });
|
|
57482
57507
|
const isAllowCreate = refObjectConfig.permissions.allowCreate;
|
|
57483
57508
|
const isCreate = lodash.exports.isBoolean(field.create) ? field.create : true;
|
|
57484
|
-
|
|
57509
|
+
// lookup字段配置过滤条件就强制不显示新建按钮
|
|
57510
|
+
let isHasFilters = (field.filters || field._filtersFunction) ? true : false;
|
|
57511
|
+
if (isAllowCreate && isCreate && !isHasFilters) {
|
|
57485
57512
|
const new_button = await getSchema$5(refObjectConfig, { appId: ctx.appId, objectName: refObjectConfig.name, formFactor: ctx.formFactor });
|
|
57486
57513
|
new_button.align = "right";
|
|
57487
57514
|
// 保持快速搜索放在最左侧,新建按钮往里插,而不是push到最后
|
|
57488
57515
|
pickerSchema.headerToolbar.splice(pickerSchema.headerToolbar.length - 1, 0, new_button);
|
|
57489
57516
|
}
|
|
57490
|
-
pickerSchema.footerToolbar = refObjectConfig.enable_tree ? [] : getObjectFooterToolbar();
|
|
57517
|
+
pickerSchema.footerToolbar = refObjectConfig.enable_tree ? [] : getObjectFooterToolbar(refObjectConfig,ctx.formFactor,{isLookup: true});
|
|
57491
57518
|
if (ctx.filterVisible !== false) {
|
|
57492
57519
|
pickerSchema.filter = await getObjectFilter(refObjectConfig, fields, {
|
|
57493
57520
|
...ctx,
|
|
@@ -57615,10 +57642,10 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
57615
57642
|
// const labelFieldKey = referenceTo && referenceTo.labelField?.name || 'name';
|
|
57616
57643
|
|
|
57617
57644
|
let apiInfo;
|
|
57618
|
-
|
|
57645
|
+
let defaultValueOptionsQueryData;
|
|
57619
57646
|
if(referenceTo){
|
|
57620
57647
|
// 字段值单独走一个请求合并到source的同一个GraphQL接口中
|
|
57621
|
-
|
|
57648
|
+
defaultValueOptionsQueryData = await getFindQuery({ name: referenceTo.objectName }, null, [
|
|
57622
57649
|
Object.assign({}, referenceTo.labelField, {alias: 'label'}),
|
|
57623
57650
|
Object.assign({}, referenceTo.valueField, {alias: 'value'})
|
|
57624
57651
|
], {
|
|
@@ -57631,7 +57658,7 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
57631
57658
|
}, null, [
|
|
57632
57659
|
Object.assign({}, referenceTo.labelField, {alias: 'label'}),
|
|
57633
57660
|
Object.assign({}, referenceTo.valueField, {alias: 'value'})
|
|
57634
|
-
], {expand: false, alias: 'options', queryOptions: `filters: {__filters}, top: {__top}, sort: "{__sort}"
|
|
57661
|
+
], {expand: false, alias: 'options', queryOptions: `filters: {__filters}, top: {__top}, sort: "{__sort}"`});
|
|
57635
57662
|
|
|
57636
57663
|
apiInfo.adaptor = `
|
|
57637
57664
|
const data = payload.data;
|
|
@@ -57725,11 +57752,16 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
57725
57752
|
var optionsFiltersOp = "${field.multiple ? "in" : "="}";
|
|
57726
57753
|
var optionsFilters = [["${valueFieldKey}", optionsFiltersOp, []]];
|
|
57727
57754
|
if (defaultValue && !api.data.$term) {
|
|
57755
|
+
const defaultValueOptionsQueryData = ${JSON.stringify(defaultValueOptionsQueryData)};
|
|
57756
|
+
const defaultValueOptionsQuery = defaultValueOptionsQueryData?.query?.replace(/^{/,"").replace(/}$/,"");
|
|
57728
57757
|
// 字段值单独请求,没值的时候在请求中返回空
|
|
57729
57758
|
optionsFilters = [["${valueFieldKey}", optionsFiltersOp, defaultValue]];
|
|
57730
57759
|
if(filters.length > 0){
|
|
57731
57760
|
optionsFilters = [filters, optionsFilters];
|
|
57732
57761
|
}
|
|
57762
|
+
if(defaultValueOptionsQuery){
|
|
57763
|
+
api.data.query = "{"+api.data.query.replace(/^{/,"").replace(/}$/,"")+","+defaultValueOptionsQuery+"}";
|
|
57764
|
+
}
|
|
57733
57765
|
}
|
|
57734
57766
|
api.data.query = api.data.query.replace(/{__options_filters}/g, JSON.stringify(optionsFilters));
|
|
57735
57767
|
return api;
|
|
@@ -57771,7 +57803,7 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
57771
57803
|
disabledOn: `${readonly} || ( (this._master && (this._master.relatedKey ==='${field.name}')) || ((this.relatedKey ==='${field.name}') && (${field.multiple} != true)) )`,
|
|
57772
57804
|
// labelField: labelField,
|
|
57773
57805
|
// valueField: valueField,
|
|
57774
|
-
source: apiInfo,
|
|
57806
|
+
// source: apiInfo,
|
|
57775
57807
|
autoComplete: apiInfo,
|
|
57776
57808
|
searchable: true,
|
|
57777
57809
|
};
|
|
@@ -57850,10 +57882,10 @@ async function lookupToAmis(field, readonly, ctx){
|
|
|
57850
57882
|
|
|
57851
57883
|
const refObject = await getUISchema(referenceTo.objectName);
|
|
57852
57884
|
|
|
57853
|
-
//
|
|
57854
|
-
|
|
57855
|
-
//
|
|
57856
|
-
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){
|
|
57857
57889
|
return await lookupToAmisPicker(field, readonly, ctx);
|
|
57858
57890
|
}else if(refObject.enable_tree) {
|
|
57859
57891
|
return await lookupToAmisTreeSelect(field, readonly, Object.assign({}, ctx, {
|
|
@@ -58166,8 +58198,8 @@ function getAmisStaticFieldType(type, readonly, options){
|
|
|
58166
58198
|
/*
|
|
58167
58199
|
* @Author: baozhoutao@steedos.com
|
|
58168
58200
|
* @Date: 2022-10-28 14:15:09
|
|
58169
|
-
* @LastEditors:
|
|
58170
|
-
* @LastEditTime:
|
|
58201
|
+
* @LastEditors: liaodaxue
|
|
58202
|
+
* @LastEditTime: 2023-10-30 17:51:54
|
|
58171
58203
|
* @Description:
|
|
58172
58204
|
*/
|
|
58173
58205
|
|
|
@@ -58218,11 +58250,26 @@ const getAmisFileEditSchema = (steedosField)=>{
|
|
|
58218
58250
|
useChunk: false, // 关闭分块上传
|
|
58219
58251
|
receiver: {
|
|
58220
58252
|
method: "post",
|
|
58253
|
+
dataType: "form-data",
|
|
58221
58254
|
url: `\${context.rootUrl}/s3/${tableName}`,
|
|
58222
|
-
|
|
58223
|
-
|
|
58224
|
-
|
|
58225
|
-
|
|
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
|
+
`,
|
|
58226
58273
|
adaptor: `
|
|
58227
58274
|
const { context } = api.body;
|
|
58228
58275
|
var rootUrl = context.rootUrl + "/api/files/${tableName}/";
|
|
@@ -58303,8 +58350,6 @@ function getSelectFieldOptions(field){
|
|
|
58303
58350
|
}
|
|
58304
58351
|
|
|
58305
58352
|
async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
58306
|
-
// console.log('convertSFieldToAmisField====>', field, readonly, ctx)
|
|
58307
|
-
const isMobile = window.innerWidth <= 768;
|
|
58308
58353
|
// 创建人和修改人、创建时间和修改时间不显示
|
|
58309
58354
|
if(lodash.exports.includes(OMIT_FIELDS, field.name) && ctx.showSystemFields != true){
|
|
58310
58355
|
return;
|
|
@@ -58393,26 +58438,33 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
58393
58438
|
};
|
|
58394
58439
|
break;
|
|
58395
58440
|
case 'date':
|
|
58396
|
-
convertData = isMobile && !readonly ? {
|
|
58397
|
-
|
|
58398
|
-
|
|
58399
|
-
|
|
58400
|
-
|
|
58401
|
-
|
|
58402
|
-
|
|
58403
|
-
|
|
58404
|
-
|
|
58405
|
-
|
|
58406
|
-
|
|
58407
|
-
|
|
58408
|
-
|
|
58409
|
-
|
|
58410
|
-
|
|
58411
|
-
|
|
58412
|
-
|
|
58413
|
-
|
|
58414
|
-
|
|
58415
|
-
} : {
|
|
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 = {
|
|
58416
58468
|
type: getAmisStaticFieldType('date', readonly),
|
|
58417
58469
|
inputFormat: "YYYY-MM-DD",
|
|
58418
58470
|
format:'YYYY-MM-DDT00:00:00.000[Z]',
|
|
@@ -58431,43 +58483,51 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
58431
58483
|
};
|
|
58432
58484
|
break;
|
|
58433
58485
|
case 'datetime':
|
|
58434
|
-
convertData = isMobile && !readonly ? {
|
|
58435
|
-
|
|
58436
|
-
|
|
58437
|
-
|
|
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
|
-
} : {
|
|
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 = {
|
|
58471
58531
|
type: getAmisStaticFieldType('datetime', readonly),
|
|
58472
58532
|
inputFormat: 'YYYY-MM-DD HH:mm',
|
|
58473
58533
|
format: 'YYYY-MM-DDTHH:mm:ss.SSSZ',
|
|
@@ -58487,26 +58547,34 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
58487
58547
|
};
|
|
58488
58548
|
break;
|
|
58489
58549
|
case 'time':
|
|
58490
|
-
convertData = isMobile && !readonly ? {
|
|
58491
|
-
|
|
58492
|
-
|
|
58493
|
-
|
|
58494
|
-
|
|
58495
|
-
|
|
58496
|
-
|
|
58497
|
-
|
|
58498
|
-
|
|
58499
|
-
|
|
58500
|
-
|
|
58501
|
-
|
|
58502
|
-
|
|
58503
|
-
|
|
58504
|
-
|
|
58505
|
-
|
|
58506
|
-
|
|
58507
|
-
|
|
58508
|
-
|
|
58509
|
-
} : {
|
|
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 = {
|
|
58510
58578
|
type: getAmisStaticFieldType('time', readonly),
|
|
58511
58579
|
inputFormat: 'HH:mm',
|
|
58512
58580
|
timeFormat:'HH:mm',
|
|
@@ -58556,7 +58624,20 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
58556
58624
|
type: getAmisStaticFieldType('number', readonly),
|
|
58557
58625
|
min: field.min,
|
|
58558
58626
|
max: field.max,
|
|
58559
|
-
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
|
+
},
|
|
58560
58641
|
};
|
|
58561
58642
|
}
|
|
58562
58643
|
break;
|
|
@@ -58951,8 +59032,41 @@ var config = {
|
|
|
58951
59032
|
};
|
|
58952
59033
|
|
|
58953
59034
|
async function getQuickEditSchema(field, options){
|
|
58954
|
-
|
|
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传值
|
|
58955
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
|
+
|
|
58956
59070
|
if (field.disabled) {
|
|
58957
59071
|
quickEditSchema = false;
|
|
58958
59072
|
} else {
|
|
@@ -58969,7 +59083,7 @@ async function getQuickEditSchema(field, options){
|
|
|
58969
59083
|
{
|
|
58970
59084
|
"actionType": "custom",
|
|
58971
59085
|
"script": `
|
|
58972
|
-
var _display = event.data._display;
|
|
59086
|
+
var _display = _.cloneDeep(event.data._display);
|
|
58973
59087
|
${displayField}
|
|
58974
59088
|
doAction({actionType: 'setValue', "args": {"value": {_display}},componentId: "${quickEditId}"});
|
|
58975
59089
|
`
|
|
@@ -58991,7 +59105,7 @@ async function getQuickEditSchema(field, options){
|
|
|
58991
59105
|
第二种是增加选项时,按照value的值,找到对应选项,并按照_display的规则为其赋值
|
|
58992
59106
|
*/
|
|
58993
59107
|
TempDisplayField = `
|
|
58994
|
-
const preData = event.data.__super.${field.name};
|
|
59108
|
+
const preData = _.cloneDeep(event.data.__super.${field.name});
|
|
58995
59109
|
if(preData && event.data.${field.name}.length < preData.length){
|
|
58996
59110
|
let deletedIndex;
|
|
58997
59111
|
preData.forEach(function(item,index){
|
|
@@ -59035,7 +59149,7 @@ async function getQuickEditSchema(field, options){
|
|
|
59035
59149
|
break;
|
|
59036
59150
|
case "percent":
|
|
59037
59151
|
TempDisplayField = `
|
|
59038
|
-
_display["${field.name}"] =
|
|
59152
|
+
_display["${field.name}"] = event.data.value.toFixed(${field.scale}) + '%';
|
|
59039
59153
|
`;
|
|
59040
59154
|
quickEditSchema.body[0].onEvent["change"] = quickEditOnEvent(TempDisplayField);
|
|
59041
59155
|
break;
|
|
@@ -59186,6 +59300,131 @@ async function getQuickEditSchema(field, options){
|
|
|
59186
59300
|
}
|
|
59187
59301
|
|
|
59188
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
|
+
}
|
|
59189
59428
|
} else {
|
|
59190
59429
|
quickEditSchema = false;
|
|
59191
59430
|
}
|
|
@@ -59220,6 +59459,8 @@ async function getTableColumns(fields, options){
|
|
|
59220
59459
|
const columns = [];
|
|
59221
59460
|
if(!options.isLookup){
|
|
59222
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"});
|
|
59223
59464
|
}
|
|
59224
59465
|
const allowEdit = options.permissions?.allowEdit && !options.isLookup && options.enable_inline_edit != false;
|
|
59225
59466
|
|
|
@@ -59251,7 +59492,7 @@ async function getTableColumns(fields, options){
|
|
|
59251
59492
|
{
|
|
59252
59493
|
"args": {
|
|
59253
59494
|
"api": {
|
|
59254
|
-
"url": "${context.rootUrl
|
|
59495
|
+
"url": "${(versions[0] && versions[0].url) ? versions[0].url+'?download=true' : context.rootUrl+'/api/files/files/'+versions[0]+'?download=true'}",
|
|
59255
59496
|
"method": "get",
|
|
59256
59497
|
"headers": {
|
|
59257
59498
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
@@ -59298,7 +59539,7 @@ async function getTableColumns(fields, options){
|
|
|
59298
59539
|
else if(field.type === 'select'){
|
|
59299
59540
|
const map = getSelectMap(field.options);
|
|
59300
59541
|
columnItem = Object.assign({}, {
|
|
59301
|
-
type: "mapping",
|
|
59542
|
+
type: "static-mapping",
|
|
59302
59543
|
name: field.name,
|
|
59303
59544
|
label: field.label,
|
|
59304
59545
|
map: map,
|
|
@@ -59313,7 +59554,7 @@ async function getTableColumns(fields, options){
|
|
|
59313
59554
|
const tpl = await getFieldTpl(field, options);
|
|
59314
59555
|
let type = 'text';
|
|
59315
59556
|
if(tpl){
|
|
59316
|
-
type = '
|
|
59557
|
+
type = 'static';
|
|
59317
59558
|
}else if(field.type === 'html'){
|
|
59318
59559
|
type = 'markdown';
|
|
59319
59560
|
}else if(field.type === 'url'){
|
|
@@ -59354,6 +59595,7 @@ async function getTableColumns(fields, options){
|
|
|
59354
59595
|
columnItem.quickEdit = quickEditSchema;
|
|
59355
59596
|
columnItem.quickEditEnabledOn = "${is_system !== true}";
|
|
59356
59597
|
}
|
|
59598
|
+
columnItem.id = `${options.objectName}_${field.name}_\${_index}`;
|
|
59357
59599
|
columns.push(columnItem);
|
|
59358
59600
|
}
|
|
59359
59601
|
}
|
|
@@ -59632,7 +59874,7 @@ async function getTableOperation(ctx){
|
|
|
59632
59874
|
}
|
|
59633
59875
|
return {
|
|
59634
59876
|
type: 'operation',
|
|
59635
|
-
label:
|
|
59877
|
+
label: "",
|
|
59636
59878
|
fixed: 'right',
|
|
59637
59879
|
labelClassName: 'text-center',
|
|
59638
59880
|
className: 'text-center steedos-listview-operation w-10',
|
|
@@ -59666,23 +59908,87 @@ async function getTableOperation(ctx){
|
|
|
59666
59908
|
}
|
|
59667
59909
|
}
|
|
59668
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
|
+
|
|
59669
59945
|
async function getTableSchema$1(fields, options){
|
|
59670
59946
|
if(!options){
|
|
59671
59947
|
options = {};
|
|
59672
59948
|
}
|
|
59673
59949
|
let { isLookup, hiddenColumnOperation } = options;
|
|
59950
|
+
const defaults = options.defaults;
|
|
59951
|
+
const listSchema = (defaults && defaults.listSchema) || {};
|
|
59952
|
+
|
|
59674
59953
|
let columns = [];
|
|
59675
59954
|
let useMobileColumns = options.formFactor === 'SMALL' || ["split"].indexOf(options.displayAs) > -1;
|
|
59676
59955
|
if(isLookup){
|
|
59677
59956
|
// 在lookup手机端列表模式调式好之前不使用getMobileTableColumns
|
|
59678
59957
|
useMobileColumns = false;
|
|
59679
59958
|
}
|
|
59959
|
+
if(listSchema.mode && listSchema.mode !== "table"){
|
|
59960
|
+
// 如果指定的mode,则不走我们内置的手机端列表效果,使用steedos组件内部开发的默认card/list效果,或者由用户自己实现card/list模式的crud列表
|
|
59961
|
+
useMobileColumns = false;
|
|
59962
|
+
}
|
|
59680
59963
|
if(useMobileColumns){
|
|
59681
59964
|
columns = await getMobileTableColumns(fields, options);
|
|
59682
59965
|
}
|
|
59683
59966
|
else {
|
|
59684
59967
|
columns = await getTableColumns(fields, options);
|
|
59685
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
|
+
|
|
59686
59992
|
if(!isLookup && !hiddenColumnOperation){
|
|
59687
59993
|
columns.push(await getTableOperation(options));
|
|
59688
59994
|
}
|
|
@@ -59690,6 +59996,7 @@ async function getTableSchema$1(fields, options){
|
|
|
59690
59996
|
|
|
59691
59997
|
return {
|
|
59692
59998
|
mode: "table",
|
|
59999
|
+
perPageAvailable: [5, 10, 20, 50, 100, 500],
|
|
59693
60000
|
name: "thelist",
|
|
59694
60001
|
headerToolbarClassName: "py-2 px-2 border-gray-300 border-solid border-b",
|
|
59695
60002
|
className: "",
|
|
@@ -59777,8 +60084,8 @@ function isObject(obj) {
|
|
|
59777
60084
|
/*
|
|
59778
60085
|
* @Author: baozhoutao@steedos.com
|
|
59779
60086
|
* @Date: 2022-07-05 15:55:39
|
|
59780
|
-
* @LastEditors:
|
|
59781
|
-
* @LastEditTime: 2023-
|
|
60087
|
+
* @LastEditors: liaodaxue
|
|
60088
|
+
* @LastEditTime: 2023-10-20 11:38:25
|
|
59782
60089
|
* @Description:
|
|
59783
60090
|
*/
|
|
59784
60091
|
|
|
@@ -60075,8 +60382,8 @@ async function getListSchema(
|
|
|
60075
60382
|
"filtersFunction": listview_filters,
|
|
60076
60383
|
"sort": sort,
|
|
60077
60384
|
"ctx": ctx,
|
|
60078
|
-
"requestAdaptor": listView.requestAdaptor,
|
|
60079
|
-
"adaptor": listView.adaptor,
|
|
60385
|
+
"requestAdaptor": listView.requestAdaptor || ctx.requestAdaptor,
|
|
60386
|
+
"adaptor": listView.adaptor || ctx.adaptor,
|
|
60080
60387
|
"headerToolbarItems": ctx.headerToolbarItems,
|
|
60081
60388
|
"filterVisible": ctx.filterVisible,
|
|
60082
60389
|
"rowClassNameExpr": ctx.rowClassNameExpr,
|
|
@@ -65210,7 +65517,13 @@ var PLACEHOLDER_ID = 'placeholder';
|
|
|
65210
65517
|
var empty = [];
|
|
65211
65518
|
function MultipleContainers(props) {
|
|
65212
65519
|
var _this = this;
|
|
65213
|
-
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 ? [{
|
|
65214
65527
|
"type": "tpl",
|
|
65215
65528
|
"tpl": "${label}",
|
|
65216
65529
|
"inline": false,
|
|
@@ -65218,24 +65531,28 @@ function MultipleContainers(props) {
|
|
|
65218
65531
|
"type": "tpl",
|
|
65219
65532
|
"tpl": "${label}",
|
|
65220
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;
|
|
65221
|
-
|
|
65534
|
+
value && delete (value.$$id);
|
|
65222
65535
|
var _w = __read(react.exports.useState(function () {
|
|
65223
65536
|
var _a;
|
|
65224
|
-
return (_a =
|
|
65537
|
+
return (_a = value) !== null && _a !== void 0 ? _a : {
|
|
65225
65538
|
A: ['A1', 'A2'],
|
|
65226
65539
|
B: ['B1', 'B2'],
|
|
65227
65540
|
C: ['C1', 'C2'],
|
|
65228
65541
|
};
|
|
65229
65542
|
}), 2), items = _w[0], setItems = _w[1];
|
|
65230
65543
|
var _x = __read(react.exports.useState(Object.keys(items)), 2), containers = _x[0], setContainers = _x[1];
|
|
65231
|
-
|
|
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 () {
|
|
65232
65549
|
var value, rendererEvent;
|
|
65233
65550
|
return __generator(this, function (_a) {
|
|
65234
65551
|
switch (_a.label) {
|
|
65235
65552
|
case 0:
|
|
65236
65553
|
if (!amisDispatchEvent || !amisOnChange)
|
|
65237
65554
|
return [2 /*return*/];
|
|
65238
|
-
value = items;
|
|
65555
|
+
value = newItems || items;
|
|
65239
65556
|
return [4 /*yield*/, amisDispatchEvent('change', createObject(amisData, {
|
|
65240
65557
|
value: value
|
|
65241
65558
|
}))];
|
|
@@ -65244,7 +65561,7 @@ function MultipleContainers(props) {
|
|
|
65244
65561
|
if (rendererEvent === null || rendererEvent === void 0 ? void 0 : rendererEvent.prevented) {
|
|
65245
65562
|
return [2 /*return*/];
|
|
65246
65563
|
}
|
|
65247
|
-
setTimeout(function () { return amisOnChange(value); },
|
|
65564
|
+
setTimeout(function () { return amisOnChange(value); }, 500);
|
|
65248
65565
|
return [2 /*return*/];
|
|
65249
65566
|
}
|
|
65250
65567
|
});
|
|
@@ -65347,6 +65664,7 @@ function MultipleContainers(props) {
|
|
|
65347
65664
|
var active = _a.active, over = _a.over;
|
|
65348
65665
|
var overId = over === null || over === void 0 ? void 0 : over.id;
|
|
65349
65666
|
if (overId == null || overId === TRASH_ID || active.id in items) {
|
|
65667
|
+
// 拖动的是分组则跳过后面的逻辑
|
|
65350
65668
|
return;
|
|
65351
65669
|
}
|
|
65352
65670
|
var overContainer = findContainer(overId);
|
|
@@ -65422,19 +65740,44 @@ function MultipleContainers(props) {
|
|
|
65422
65740
|
return;
|
|
65423
65741
|
}
|
|
65424
65742
|
var overContainer = findContainer(overId);
|
|
65743
|
+
var newItems = items;
|
|
65425
65744
|
if (overContainer) {
|
|
65426
|
-
|
|
65427
|
-
|
|
65428
|
-
|
|
65429
|
-
|
|
65430
|
-
|
|
65431
|
-
|
|
65432
|
-
|
|
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
|
+
}
|
|
65433
65776
|
}
|
|
65434
65777
|
}
|
|
65435
65778
|
setActiveId(null);
|
|
65436
65779
|
// console.log('拖动结束2,更新form value')
|
|
65437
|
-
handleChange();
|
|
65780
|
+
handleChange(newItems);
|
|
65438
65781
|
}, cancelDrop: cancelDrop, onDragCancel: onDragCancel, modifiers: modifiers },
|
|
65439
65782
|
React.createElement("div", { style: {
|
|
65440
65783
|
display: 'inline-grid',
|