@steedos-widgets/sortable 1.3.4-beta.9 → 1.3.6
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 +526 -144
- package/dist/sortable.cjs.js.map +1 -1
- package/dist/sortable.esm.js +526 -144
- package/dist/sortable.esm.js.map +1 -1
- package/dist/sortable.umd.js +526 -144
- 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
|
|
|
@@ -55153,7 +55153,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
55153
55153
|
showFieldsFilter = true;
|
|
55154
55154
|
}
|
|
55155
55155
|
filterService.setData({showFieldsFilter});
|
|
55156
|
-
resizeWindow()
|
|
55156
|
+
// resizeWindow();//已迁移到搜索栏表单提交事件中执行,因为表单项change后也会触发表单提交了
|
|
55157
55157
|
// 使用filterForm.getValues()的话,并不能拿到本地存储中的过滤条件,所以需要从event.data中取。
|
|
55158
55158
|
let filterFormValues = event.data;
|
|
55159
55159
|
let isFieldsFilterEmpty = SteedosUI.isFilterFormValuesEmpty(filterFormValues);
|
|
@@ -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高度显示有问题
|
|
@@ -56642,7 +56645,8 @@ function getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLooku
|
|
|
56642
56645
|
"placeholder": "搜索此列表",
|
|
56643
56646
|
"value": crudKeywords,
|
|
56644
56647
|
"clearable": true,
|
|
56645
|
-
"clearAndSubmit": true
|
|
56648
|
+
"clearAndSubmit": true,
|
|
56649
|
+
"searchImediately": true
|
|
56646
56650
|
}
|
|
56647
56651
|
]
|
|
56648
56652
|
}
|
|
@@ -56817,6 +56821,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
|
|
|
56817
56821
|
}
|
|
56818
56822
|
|
|
56819
56823
|
function getObjectFooterToolbar(mainObject, formFactor, options) {
|
|
56824
|
+
// crud card模式与table模式两种情况下showPageInput默认值不一样,所以需要显式设置为false
|
|
56820
56825
|
if (formFactor === 'SMALL') {
|
|
56821
56826
|
// return [
|
|
56822
56827
|
// "load-more",
|
|
@@ -56826,14 +56831,17 @@ function getObjectFooterToolbar(mainObject, formFactor, options) {
|
|
|
56826
56831
|
"switch-per-page",
|
|
56827
56832
|
{
|
|
56828
56833
|
"type": "pagination",
|
|
56829
|
-
"maxButtons": 5
|
|
56834
|
+
"maxButtons": 5,
|
|
56835
|
+
"showPageInput": false
|
|
56830
56836
|
}
|
|
56831
56837
|
]
|
|
56832
56838
|
}else {
|
|
56833
56839
|
return [
|
|
56840
|
+
// "statistics",
|
|
56834
56841
|
{
|
|
56835
56842
|
"type": "pagination",
|
|
56836
|
-
"maxButtons": 5
|
|
56843
|
+
"maxButtons": 5,
|
|
56844
|
+
"showPageInput": false
|
|
56837
56845
|
}
|
|
56838
56846
|
]
|
|
56839
56847
|
}
|
|
@@ -56842,32 +56850,81 @@ function getObjectFooterToolbar(mainObject, formFactor, options) {
|
|
|
56842
56850
|
if(options && options.isRelated){
|
|
56843
56851
|
return [
|
|
56844
56852
|
"statistics",
|
|
56845
|
-
|
|
56853
|
+
{
|
|
56854
|
+
"type": "pagination",
|
|
56855
|
+
"maxButtons": 10,
|
|
56856
|
+
"showPageInput": false
|
|
56857
|
+
}
|
|
56846
56858
|
]
|
|
56847
56859
|
|
|
56848
56860
|
}
|
|
56849
56861
|
else {
|
|
56850
|
-
|
|
56851
|
-
|
|
56862
|
+
const no_pagination = mainObject.paging && (mainObject.paging.enabled === false);
|
|
56863
|
+
const is_lookup = options.isLookup;
|
|
56864
|
+
const commonConfig = [
|
|
56852
56865
|
"statistics",
|
|
56853
|
-
|
|
56854
|
-
|
|
56866
|
+
{
|
|
56867
|
+
"type": "pagination",
|
|
56868
|
+
"maxButtons": 10,
|
|
56869
|
+
"showPageInput": false
|
|
56870
|
+
}
|
|
56871
|
+
];
|
|
56872
|
+
|
|
56873
|
+
if (no_pagination && is_lookup) {
|
|
56874
|
+
return commonConfig;
|
|
56875
|
+
} else {
|
|
56876
|
+
return ["switch-per-page", ...commonConfig];
|
|
56877
|
+
}
|
|
56855
56878
|
}
|
|
56856
56879
|
}
|
|
56857
56880
|
}
|
|
56858
56881
|
|
|
56859
56882
|
async function getObjectFilter(objectSchema, fields, options) {
|
|
56860
56883
|
const fieldsFilterBarSchema = await getObjectListHeaderFieldsFilterBar(objectSchema, null, options);
|
|
56884
|
+
let onSubmitSuccScript = `
|
|
56885
|
+
let isLookup = event.data.isLookup;
|
|
56886
|
+
if(isLookup){
|
|
56887
|
+
return;
|
|
56888
|
+
}
|
|
56889
|
+
// 列表搜索栏字段值变更后立刻触发提交表单执行crud搜索,所以这里需要额外重算crud高度及筛选按钮红色星号图标显示隐藏
|
|
56890
|
+
let resizeWindow = function(){
|
|
56891
|
+
//触发amis crud 高度重算
|
|
56892
|
+
setTimeout(()=>{
|
|
56893
|
+
window.dispatchEvent(new Event("resize"))
|
|
56894
|
+
}, 1000);
|
|
56895
|
+
}
|
|
56896
|
+
resizeWindow();
|
|
56897
|
+
const scope = event.context.scoped;
|
|
56898
|
+
// let filterFormValues = event.data;
|
|
56899
|
+
let filterForm = SteedosUI.getClosestAmisComponentByType(scope, "form");
|
|
56900
|
+
let filterFormService = SteedosUI.getClosestAmisComponentByType(filterForm.context, "service");
|
|
56901
|
+
// 使用event.data的话,并不能拿到本地存储中的过滤条件,所以需要从filterFormService中取。
|
|
56902
|
+
let filterFormValues = filterFormService.getData()
|
|
56903
|
+
let isFieldsFilterEmpty = SteedosUI.isFilterFormValuesEmpty(filterFormValues);
|
|
56904
|
+
let crud = SteedosUI.getClosestAmisComponentByType(scope, "crud");
|
|
56905
|
+
let crudService = crud && SteedosUI.getClosestAmisComponentByType(crud.context, "service");
|
|
56906
|
+
crudService && crudService.setData({isFieldsFilterEmpty});
|
|
56907
|
+
`;
|
|
56861
56908
|
return {
|
|
56862
56909
|
"title": "",
|
|
56863
56910
|
"submitText": "",
|
|
56864
56911
|
"className": "",
|
|
56865
|
-
|
|
56912
|
+
"debug": true,
|
|
56866
56913
|
"mode": "normal",
|
|
56867
56914
|
"wrapWithPanel": false,
|
|
56868
56915
|
"body": [
|
|
56869
56916
|
fieldsFilterBarSchema
|
|
56870
|
-
]
|
|
56917
|
+
],
|
|
56918
|
+
"onEvent": {
|
|
56919
|
+
"submitSucc": {
|
|
56920
|
+
"actions": [
|
|
56921
|
+
{
|
|
56922
|
+
"actionType": "custom",
|
|
56923
|
+
"script": onSubmitSuccScript
|
|
56924
|
+
}
|
|
56925
|
+
]
|
|
56926
|
+
}
|
|
56927
|
+
}
|
|
56871
56928
|
}
|
|
56872
56929
|
}
|
|
56873
56930
|
|
|
@@ -57488,13 +57545,15 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
57488
57545
|
pickerSchema.headerToolbar = getObjectHeaderToolbar(refObjectConfig, fieldsArr, ctx.formFactor, { headerToolbarItems, isLookup: true, keywordsSearchBoxName });
|
|
57489
57546
|
const isAllowCreate = refObjectConfig.permissions.allowCreate;
|
|
57490
57547
|
const isCreate = lodash.exports.isBoolean(field.create) ? field.create : true;
|
|
57491
|
-
|
|
57548
|
+
// lookup字段配置过滤条件就强制不显示新建按钮
|
|
57549
|
+
let isHasFilters = (field.filters || field._filtersFunction) ? true : false;
|
|
57550
|
+
if (isAllowCreate && isCreate && !isHasFilters) {
|
|
57492
57551
|
const new_button = await getSchema$5(refObjectConfig, { appId: ctx.appId, objectName: refObjectConfig.name, formFactor: ctx.formFactor });
|
|
57493
57552
|
new_button.align = "right";
|
|
57494
57553
|
// 保持快速搜索放在最左侧,新建按钮往里插,而不是push到最后
|
|
57495
57554
|
pickerSchema.headerToolbar.splice(pickerSchema.headerToolbar.length - 1, 0, new_button);
|
|
57496
57555
|
}
|
|
57497
|
-
pickerSchema.footerToolbar = refObjectConfig.enable_tree ? [] : getObjectFooterToolbar();
|
|
57556
|
+
pickerSchema.footerToolbar = refObjectConfig.enable_tree ? [] : getObjectFooterToolbar(refObjectConfig,ctx.formFactor,{isLookup: true});
|
|
57498
57557
|
if (ctx.filterVisible !== false) {
|
|
57499
57558
|
pickerSchema.filter = await getObjectFilter(refObjectConfig, fields, {
|
|
57500
57559
|
...ctx,
|
|
@@ -57622,10 +57681,10 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
57622
57681
|
// const labelFieldKey = referenceTo && referenceTo.labelField?.name || 'name';
|
|
57623
57682
|
|
|
57624
57683
|
let apiInfo;
|
|
57625
|
-
|
|
57684
|
+
let defaultValueOptionsQueryData;
|
|
57626
57685
|
if(referenceTo){
|
|
57627
57686
|
// 字段值单独走一个请求合并到source的同一个GraphQL接口中
|
|
57628
|
-
|
|
57687
|
+
defaultValueOptionsQueryData = await getFindQuery({ name: referenceTo.objectName }, null, [
|
|
57629
57688
|
Object.assign({}, referenceTo.labelField, {alias: 'label'}),
|
|
57630
57689
|
Object.assign({}, referenceTo.valueField, {alias: 'value'})
|
|
57631
57690
|
], {
|
|
@@ -57638,7 +57697,7 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
57638
57697
|
}, null, [
|
|
57639
57698
|
Object.assign({}, referenceTo.labelField, {alias: 'label'}),
|
|
57640
57699
|
Object.assign({}, referenceTo.valueField, {alias: 'value'})
|
|
57641
|
-
], {expand: false, alias: 'options', queryOptions: `filters: {__filters}, top: {__top}, sort: "{__sort}"
|
|
57700
|
+
], {expand: false, alias: 'options', queryOptions: `filters: {__filters}, top: {__top}, sort: "{__sort}"`});
|
|
57642
57701
|
|
|
57643
57702
|
apiInfo.adaptor = `
|
|
57644
57703
|
const data = payload.data;
|
|
@@ -57732,11 +57791,16 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
57732
57791
|
var optionsFiltersOp = "${field.multiple ? "in" : "="}";
|
|
57733
57792
|
var optionsFilters = [["${valueFieldKey}", optionsFiltersOp, []]];
|
|
57734
57793
|
if (defaultValue && !api.data.$term) {
|
|
57794
|
+
const defaultValueOptionsQueryData = ${JSON.stringify(defaultValueOptionsQueryData)};
|
|
57795
|
+
const defaultValueOptionsQuery = defaultValueOptionsQueryData?.query?.replace(/^{/,"").replace(/}$/,"");
|
|
57735
57796
|
// 字段值单独请求,没值的时候在请求中返回空
|
|
57736
57797
|
optionsFilters = [["${valueFieldKey}", optionsFiltersOp, defaultValue]];
|
|
57737
57798
|
if(filters.length > 0){
|
|
57738
57799
|
optionsFilters = [filters, optionsFilters];
|
|
57739
57800
|
}
|
|
57801
|
+
if(defaultValueOptionsQuery){
|
|
57802
|
+
api.data.query = "{"+api.data.query.replace(/^{/,"").replace(/}$/,"")+","+defaultValueOptionsQuery+"}";
|
|
57803
|
+
}
|
|
57740
57804
|
}
|
|
57741
57805
|
api.data.query = api.data.query.replace(/{__options_filters}/g, JSON.stringify(optionsFilters));
|
|
57742
57806
|
return api;
|
|
@@ -57778,7 +57842,7 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
57778
57842
|
disabledOn: `${readonly} || ( (this._master && (this._master.relatedKey ==='${field.name}')) || ((this.relatedKey ==='${field.name}') && (${field.multiple} != true)) )`,
|
|
57779
57843
|
// labelField: labelField,
|
|
57780
57844
|
// valueField: valueField,
|
|
57781
|
-
source: apiInfo,
|
|
57845
|
+
// source: apiInfo,
|
|
57782
57846
|
autoComplete: apiInfo,
|
|
57783
57847
|
searchable: true,
|
|
57784
57848
|
};
|
|
@@ -57857,10 +57921,10 @@ async function lookupToAmis(field, readonly, ctx){
|
|
|
57857
57921
|
|
|
57858
57922
|
const refObject = await getUISchema(referenceTo.objectName);
|
|
57859
57923
|
|
|
57860
|
-
//
|
|
57861
|
-
|
|
57862
|
-
//
|
|
57863
|
-
if(
|
|
57924
|
+
// 优先取字段中配置的enable_enhanced_lookup,字段上没配置时,才从对象上取enable_enhanced_lookup属性
|
|
57925
|
+
let enableEnhancedLookup = lodash.exports.isBoolean(field.enable_enhanced_lookup) ? field.enable_enhanced_lookup : refObject.enable_enhanced_lookup;
|
|
57926
|
+
// 默认使用下拉框模式显示lookup选项,只能配置了enable_enhanced_lookup才使用弹出增强模式
|
|
57927
|
+
if(enableEnhancedLookup == true){
|
|
57864
57928
|
return await lookupToAmisPicker(field, readonly, ctx);
|
|
57865
57929
|
}else if(refObject.enable_tree) {
|
|
57866
57930
|
return await lookupToAmisTreeSelect(field, readonly, Object.assign({}, ctx, {
|
|
@@ -58173,8 +58237,8 @@ function getAmisStaticFieldType(type, readonly, options){
|
|
|
58173
58237
|
/*
|
|
58174
58238
|
* @Author: baozhoutao@steedos.com
|
|
58175
58239
|
* @Date: 2022-10-28 14:15:09
|
|
58176
|
-
* @LastEditors:
|
|
58177
|
-
* @LastEditTime:
|
|
58240
|
+
* @LastEditors: liaodaxue
|
|
58241
|
+
* @LastEditTime: 2023-10-30 17:51:54
|
|
58178
58242
|
* @Description:
|
|
58179
58243
|
*/
|
|
58180
58244
|
|
|
@@ -58225,11 +58289,26 @@ const getAmisFileEditSchema = (steedosField)=>{
|
|
|
58225
58289
|
useChunk: false, // 关闭分块上传
|
|
58226
58290
|
receiver: {
|
|
58227
58291
|
method: "post",
|
|
58292
|
+
dataType: "form-data",
|
|
58228
58293
|
url: `\${context.rootUrl}/s3/${tableName}`,
|
|
58229
|
-
|
|
58230
|
-
|
|
58231
|
-
|
|
58232
|
-
|
|
58294
|
+
requestAdaptor: `
|
|
58295
|
+
const { _master, global,context } = api.body;
|
|
58296
|
+
// const { recordId, objectName } = _master;
|
|
58297
|
+
const { spaceId, userId, user } = global;
|
|
58298
|
+
/*
|
|
58299
|
+
record_id: recordId,
|
|
58300
|
+
parent: recordId,
|
|
58301
|
+
object_name: objectName,
|
|
58302
|
+
owner_name: user.name,
|
|
58303
|
+
space: spaceId,
|
|
58304
|
+
owner: userId
|
|
58305
|
+
*/
|
|
58306
|
+
// 参考platform 2.2版本,附件字段保存时cfs.files.filerecord、cfs.images.filerecord表中的metadata下只保存space、owner两个属性值。
|
|
58307
|
+
api.data.append('space', spaceId);
|
|
58308
|
+
api.data.append('owner', userId);
|
|
58309
|
+
|
|
58310
|
+
return api;
|
|
58311
|
+
`,
|
|
58233
58312
|
adaptor: `
|
|
58234
58313
|
const { context } = api.body;
|
|
58235
58314
|
var rootUrl = context.rootUrl + "/api/files/${tableName}/";
|
|
@@ -58310,8 +58389,6 @@ function getSelectFieldOptions(field){
|
|
|
58310
58389
|
}
|
|
58311
58390
|
|
|
58312
58391
|
async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
58313
|
-
// console.log('convertSFieldToAmisField====>', field, readonly, ctx)
|
|
58314
|
-
const isMobile = window.innerWidth <= 768;
|
|
58315
58392
|
// 创建人和修改人、创建时间和修改时间不显示
|
|
58316
58393
|
if(lodash.exports.includes(OMIT_FIELDS, field.name) && ctx.showSystemFields != true){
|
|
58317
58394
|
return;
|
|
@@ -58400,26 +58477,33 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
58400
58477
|
};
|
|
58401
58478
|
break;
|
|
58402
58479
|
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
|
-
} : {
|
|
58480
|
+
// convertData = isMobile && !readonly ? {
|
|
58481
|
+
// type: "native-date",
|
|
58482
|
+
// pipeIn: (value, data) => {
|
|
58483
|
+
// if (value) {
|
|
58484
|
+
// value = moment(value).utc().format('YYYY-MM-DD');
|
|
58485
|
+
// return value;
|
|
58486
|
+
// } else {
|
|
58487
|
+
// return "";
|
|
58488
|
+
// }
|
|
58489
|
+
|
|
58490
|
+
// },
|
|
58491
|
+
// pipeOut: (value, oldValue, data) => {
|
|
58492
|
+
// if (value) {
|
|
58493
|
+
// value = moment(value).format('YYYY-MM-DDT00:00:00.000[Z]');
|
|
58494
|
+
// return value;
|
|
58495
|
+
// } else {
|
|
58496
|
+
// return "";
|
|
58497
|
+
// }
|
|
58498
|
+
// }
|
|
58499
|
+
// } : {
|
|
58500
|
+
// type: getAmisStaticFieldType('date', readonly),
|
|
58501
|
+
// inputFormat: "YYYY-MM-DD",
|
|
58502
|
+
// format:'YYYY-MM-DDT00:00:00.000[Z]',
|
|
58503
|
+
// tpl: readonly ? Tpl.getDateTpl(field) : null,
|
|
58504
|
+
// // utc: true
|
|
58505
|
+
// }
|
|
58506
|
+
convertData = {
|
|
58423
58507
|
type: getAmisStaticFieldType('date', readonly),
|
|
58424
58508
|
inputFormat: "YYYY-MM-DD",
|
|
58425
58509
|
format:'YYYY-MM-DDT00:00:00.000[Z]',
|
|
@@ -58438,43 +58522,51 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
58438
58522
|
};
|
|
58439
58523
|
break;
|
|
58440
58524
|
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
|
-
} : {
|
|
58525
|
+
// convertData = isMobile && !readonly ? {
|
|
58526
|
+
// type: "combo",
|
|
58527
|
+
// pipeIn: (value, data) => {
|
|
58528
|
+
// let revalue = {};
|
|
58529
|
+
// if (value && value != "Invalid date") {
|
|
58530
|
+
// value = moment(value).format('YYYY-MM-DD HH:mm:ss');
|
|
58531
|
+
// revalue[field.name + "-native-date"] = value.split(' ')[0];
|
|
58532
|
+
// revalue[field.name + "-native-time"] = value.split(' ')[1];
|
|
58533
|
+
// } else {
|
|
58534
|
+
// revalue[field.name + "-native-date"] = "";
|
|
58535
|
+
// revalue[field.name + "-native-time"] = "";
|
|
58536
|
+
// }
|
|
58537
|
+
// return revalue;
|
|
58538
|
+
// },
|
|
58539
|
+
// pipeOut: (value, oldValue, data) => {
|
|
58540
|
+
// let revalue = "";
|
|
58541
|
+
// if (value[field.name + "-native-date"] && value[field.name + "-native-time"]) {
|
|
58542
|
+
// revalue = value[field.name + "-native-date"] + " " + value[field.name + "-native-time"];
|
|
58543
|
+
// revalue = moment(revalue).utc().format('YYYY-MM-DDTHH:mm:ss.SSS[Z]');
|
|
58544
|
+
// }
|
|
58545
|
+
// return revalue;
|
|
58546
|
+
// },
|
|
58547
|
+
// items: [
|
|
58548
|
+
// {
|
|
58549
|
+
// type: "native-date",
|
|
58550
|
+
// name: field.name + "-native-date",
|
|
58551
|
+
// className: "steedos-native-date",
|
|
58552
|
+
// value: ""
|
|
58553
|
+
// },
|
|
58554
|
+
// {
|
|
58555
|
+
// type: "native-time",
|
|
58556
|
+
// name: field.name + "-native-time",
|
|
58557
|
+
// className: "steedos-native-time",
|
|
58558
|
+
// value: ""
|
|
58559
|
+
// }
|
|
58560
|
+
// ]
|
|
58561
|
+
// } : {
|
|
58562
|
+
// type: getAmisStaticFieldType('datetime', readonly),
|
|
58563
|
+
// inputFormat: 'YYYY-MM-DD HH:mm',
|
|
58564
|
+
// format: 'YYYY-MM-DDTHH:mm:ss.SSSZ',
|
|
58565
|
+
// tpl: readonly ? Tpl.getDateTimeTpl(field) : null,
|
|
58566
|
+
// utc: true,
|
|
58567
|
+
// }
|
|
58568
|
+
|
|
58569
|
+
convertData = {
|
|
58478
58570
|
type: getAmisStaticFieldType('datetime', readonly),
|
|
58479
58571
|
inputFormat: 'YYYY-MM-DD HH:mm',
|
|
58480
58572
|
format: 'YYYY-MM-DDTHH:mm:ss.SSSZ',
|
|
@@ -58494,26 +58586,34 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
58494
58586
|
};
|
|
58495
58587
|
break;
|
|
58496
58588
|
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
|
-
} : {
|
|
58589
|
+
// convertData = isMobile && !readonly ? {
|
|
58590
|
+
// type: "native-time",
|
|
58591
|
+
// pipeIn: (value, data) => {
|
|
58592
|
+
// if (value) {
|
|
58593
|
+
// value = moment(value).utc().format('HH:mm');
|
|
58594
|
+
// return value;
|
|
58595
|
+
// } else {
|
|
58596
|
+
// return "";
|
|
58597
|
+
// }
|
|
58598
|
+
|
|
58599
|
+
// },
|
|
58600
|
+
// pipeOut: (value, oldValue, data) => {
|
|
58601
|
+
// if (value) {
|
|
58602
|
+
// value = moment('1970-01-01 ' + value).format('1970-01-01THH:mm:00.000[Z]');
|
|
58603
|
+
// return value;
|
|
58604
|
+
// } else {
|
|
58605
|
+
// return "";
|
|
58606
|
+
// }
|
|
58607
|
+
// }
|
|
58608
|
+
// } : {
|
|
58609
|
+
// type: getAmisStaticFieldType('time', readonly),
|
|
58610
|
+
// inputFormat: 'HH:mm',
|
|
58611
|
+
// timeFormat:'HH:mm',
|
|
58612
|
+
// format:'1970-01-01THH:mm:00.000[Z]',
|
|
58613
|
+
// tpl: readonly ? Tpl.getDateTimeTpl(field) : null,
|
|
58614
|
+
// // utc: true
|
|
58615
|
+
// }
|
|
58616
|
+
convertData = {
|
|
58517
58617
|
type: getAmisStaticFieldType('time', readonly),
|
|
58518
58618
|
inputFormat: 'HH:mm',
|
|
58519
58619
|
timeFormat:'HH:mm',
|
|
@@ -58563,7 +58663,20 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
58563
58663
|
type: getAmisStaticFieldType('number', readonly),
|
|
58564
58664
|
min: field.min,
|
|
58565
58665
|
max: field.max,
|
|
58566
|
-
precision: field.scale
|
|
58666
|
+
precision: field.scale,
|
|
58667
|
+
suffix: "%",
|
|
58668
|
+
pipeIn: (value, data) => {
|
|
58669
|
+
if(value){
|
|
58670
|
+
return value*100;
|
|
58671
|
+
}
|
|
58672
|
+
return value;
|
|
58673
|
+
},
|
|
58674
|
+
pipeOut: (value, oldValue, data) => {
|
|
58675
|
+
if(value){
|
|
58676
|
+
return value/100;
|
|
58677
|
+
}
|
|
58678
|
+
return value;
|
|
58679
|
+
},
|
|
58567
58680
|
};
|
|
58568
58681
|
}
|
|
58569
58682
|
break;
|
|
@@ -58897,7 +59010,9 @@ async function getFieldSearchable(perField, permissionFields, ctx){
|
|
|
58897
59010
|
|
|
58898
59011
|
const amisField = await convertSFieldToAmisField(_field, false, Object.assign({}, ctx, {fieldNamePrefix: fieldNamePrefix, required: false, showSystemFields: true, inFilterForm: true}));
|
|
58899
59012
|
if(amisField){
|
|
58900
|
-
return amisField
|
|
59013
|
+
return Object.assign({}, amisField,{
|
|
59014
|
+
submitOnChange: true
|
|
59015
|
+
});
|
|
58901
59016
|
}
|
|
58902
59017
|
}
|
|
58903
59018
|
}
|
|
@@ -58958,8 +59073,46 @@ var config = {
|
|
|
58958
59073
|
};
|
|
58959
59074
|
|
|
58960
59075
|
async function getQuickEditSchema(field, options){
|
|
58961
|
-
|
|
59076
|
+
//判断在amis3.2以上环境下,放开批量编辑
|
|
59077
|
+
let isAmisVersionforBatchEdit = false;
|
|
59078
|
+
if(window.amisRequire && window.amisRequire('amis')){
|
|
59079
|
+
isAmisVersionforBatchEdit = window.amisRequire('amis').version[0] >= 3 && window.amisRequire('amis').version[2] >= 2;
|
|
59080
|
+
}else if(window.Amis){
|
|
59081
|
+
isAmisVersionforBatchEdit = window.Amis.version[0] >= 3 && window.Amis.version[2] >= 2;
|
|
59082
|
+
}
|
|
59083
|
+
const quickEditId = options.objectName + "_" + field.name + "_quickEdit";//定义快速编辑的表单id,用于setvalue传值
|
|
58962
59084
|
var quickEditSchema = { body: [], id: quickEditId };
|
|
59085
|
+
//select,avatar,image,file等组件无法行记录字段赋值,暂不支持批量编辑;
|
|
59086
|
+
if(field.type != 'avatar' && field.type != 'image' && field.type != 'file' && isAmisVersionforBatchEdit){
|
|
59087
|
+
const submitEvent = {
|
|
59088
|
+
submit: {
|
|
59089
|
+
actions: [
|
|
59090
|
+
{
|
|
59091
|
+
actionType: "custom",
|
|
59092
|
+
script: `
|
|
59093
|
+
let items = _.cloneDeep(event.data.items);
|
|
59094
|
+
let selectedItems = _.cloneDeep(event.data.selectedItems);
|
|
59095
|
+
if(event.data.isBatchEdit){
|
|
59096
|
+
selectedItems.forEach(function(selectedItem){
|
|
59097
|
+
selectedItem._display.${field.name} = event.data._display.${field.name};
|
|
59098
|
+
doAction({actionType: 'setValue', "args": {"value": selectedItem._display},componentId: "_display_" + selectedItem._index});
|
|
59099
|
+
doAction({actionType: 'setValue', "args": {"value": event.data.${field.name}},componentId: "${options.objectName + "_" + field.name + "_"}" + selectedItem._index});
|
|
59100
|
+
})
|
|
59101
|
+
}else{
|
|
59102
|
+
doAction({actionType: 'setValue', "args": {"value": event.data._display},componentId: "_display_" + event.data._index});
|
|
59103
|
+
doAction({actionType: 'setValue', "args": {"value": event.data.${field.name}},componentId: "${options.objectName + "_" + field.name + "_"}" + event.data._index});
|
|
59104
|
+
}
|
|
59105
|
+
`
|
|
59106
|
+
},
|
|
59107
|
+
{
|
|
59108
|
+
"actionType": "closeDialog"
|
|
59109
|
+
}
|
|
59110
|
+
]
|
|
59111
|
+
}
|
|
59112
|
+
};
|
|
59113
|
+
quickEditSchema.onEvent = submitEvent;
|
|
59114
|
+
}
|
|
59115
|
+
|
|
58963
59116
|
if (field.disabled) {
|
|
58964
59117
|
quickEditSchema = false;
|
|
58965
59118
|
} else {
|
|
@@ -58976,7 +59129,7 @@ async function getQuickEditSchema(field, options){
|
|
|
58976
59129
|
{
|
|
58977
59130
|
"actionType": "custom",
|
|
58978
59131
|
"script": `
|
|
58979
|
-
var _display = event.data._display;
|
|
59132
|
+
var _display = _.cloneDeep(event.data._display);
|
|
58980
59133
|
${displayField}
|
|
58981
59134
|
doAction({actionType: 'setValue', "args": {"value": {_display}},componentId: "${quickEditId}"});
|
|
58982
59135
|
`
|
|
@@ -58998,7 +59151,7 @@ async function getQuickEditSchema(field, options){
|
|
|
58998
59151
|
第二种是增加选项时,按照value的值,找到对应选项,并按照_display的规则为其赋值
|
|
58999
59152
|
*/
|
|
59000
59153
|
TempDisplayField = `
|
|
59001
|
-
const preData = event.data.__super.${field.name};
|
|
59154
|
+
const preData = _.cloneDeep(event.data.__super.${field.name});
|
|
59002
59155
|
if(preData && event.data.${field.name}.length < preData.length){
|
|
59003
59156
|
let deletedIndex;
|
|
59004
59157
|
preData.forEach(function(item,index){
|
|
@@ -59042,7 +59195,7 @@ async function getQuickEditSchema(field, options){
|
|
|
59042
59195
|
break;
|
|
59043
59196
|
case "percent":
|
|
59044
59197
|
TempDisplayField = `
|
|
59045
|
-
_display["${field.name}"] =
|
|
59198
|
+
_display["${field.name}"] = event.data.value.toFixed(${field.scale}) + '%';
|
|
59046
59199
|
`;
|
|
59047
59200
|
quickEditSchema.body[0].onEvent["change"] = quickEditOnEvent(TempDisplayField);
|
|
59048
59201
|
break;
|
|
@@ -59193,6 +59346,131 @@ async function getQuickEditSchema(field, options){
|
|
|
59193
59346
|
}
|
|
59194
59347
|
|
|
59195
59348
|
});
|
|
59349
|
+
if(field.type != 'avatar' && field.type != 'image' && field.type != 'file' && isAmisVersionforBatchEdit){
|
|
59350
|
+
quickEditSchema.body.push({
|
|
59351
|
+
"name": "isBatchEdit",
|
|
59352
|
+
"type": "checkbox",
|
|
59353
|
+
"option": [
|
|
59354
|
+
{
|
|
59355
|
+
"type": "tpl",
|
|
59356
|
+
"tpl": "更新${COUNT(selectedItems)}个选定记录"
|
|
59357
|
+
},
|
|
59358
|
+
{
|
|
59359
|
+
"type": "spinner",
|
|
59360
|
+
"showOn": "${batchPermissionLoading}",
|
|
59361
|
+
"size": "sm",
|
|
59362
|
+
"className": "mr-4"
|
|
59363
|
+
}
|
|
59364
|
+
],
|
|
59365
|
+
"visibleOn": "${ARRAYSOME(selectedItems, item => item._id === _id) && COUNT(selectedItems)>1 && quickedit_record_permissions.allowEdit && quickedit_record_permissions_loading == false}",
|
|
59366
|
+
"disabledOn": "${batchPermissionLoading}",
|
|
59367
|
+
"onEvent":{
|
|
59368
|
+
"change":{
|
|
59369
|
+
"actions":[
|
|
59370
|
+
{
|
|
59371
|
+
"actionType": "setValue",
|
|
59372
|
+
"componentId": quickEditId,
|
|
59373
|
+
"args": {
|
|
59374
|
+
"value":{
|
|
59375
|
+
"batchPermissionLoading": true
|
|
59376
|
+
}
|
|
59377
|
+
},
|
|
59378
|
+
"expression":"${event.data.value}"
|
|
59379
|
+
},
|
|
59380
|
+
{
|
|
59381
|
+
"actionType": "ajax",
|
|
59382
|
+
"args": {
|
|
59383
|
+
"api": {
|
|
59384
|
+
"url": "${context.rootUrl}/graphql",
|
|
59385
|
+
"method": "post",
|
|
59386
|
+
"headers": {
|
|
59387
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
59388
|
+
},
|
|
59389
|
+
"data": {
|
|
59390
|
+
"query": "{rows:${objectName}(filters:[\"_id\",\"in\",${selectedItems | pick:_id | split | json}]){_id,_permissions{allowEdit}}}"
|
|
59391
|
+
},
|
|
59392
|
+
"adaptor": `
|
|
59393
|
+
const noPermission = [];
|
|
59394
|
+
payload.data.rows.forEach(function (row) {
|
|
59395
|
+
if(!row._permissions.allowEdit){
|
|
59396
|
+
noPermission.push(row._id);
|
|
59397
|
+
}
|
|
59398
|
+
})
|
|
59399
|
+
payload.data.noPermission = noPermission;
|
|
59400
|
+
return payload;
|
|
59401
|
+
`
|
|
59402
|
+
}
|
|
59403
|
+
},
|
|
59404
|
+
"expression":"${event.data.value}"
|
|
59405
|
+
},
|
|
59406
|
+
{
|
|
59407
|
+
"actionType": "setValue",
|
|
59408
|
+
"componentId": quickEditId,
|
|
59409
|
+
"args": {
|
|
59410
|
+
"value":{
|
|
59411
|
+
"batchPermissionLoading": false
|
|
59412
|
+
}
|
|
59413
|
+
},
|
|
59414
|
+
"expression":"${event.data.value}"
|
|
59415
|
+
},
|
|
59416
|
+
{
|
|
59417
|
+
"actionType": "dialog",
|
|
59418
|
+
"dialog":{
|
|
59419
|
+
"title": "记录权限",
|
|
59420
|
+
"showCloseButton": false,
|
|
59421
|
+
"body":[
|
|
59422
|
+
{
|
|
59423
|
+
"type": "tpl",
|
|
59424
|
+
"tpl": "当前选中记录中,有${COUNT(noPermission)}条记录无编辑权限,是否需要批量编辑其他记录?"
|
|
59425
|
+
}
|
|
59426
|
+
],
|
|
59427
|
+
"onEvent":{
|
|
59428
|
+
"confirm":{
|
|
59429
|
+
"actions":[
|
|
59430
|
+
{
|
|
59431
|
+
"actionType": "custom",
|
|
59432
|
+
"script": `
|
|
59433
|
+
const noPermission = event.data.noPermission;
|
|
59434
|
+
const crudComponent = event.context.scoped.getComponentById("${options.crudId}");
|
|
59435
|
+
const selectedItems = crudComponent && crudComponent.props.store.selectedItems.concat();
|
|
59436
|
+
noPermission.forEach(function (item) {
|
|
59437
|
+
crudComponent && crudComponent.unSelectItem(_.find(selectedItems,{_id:item}));
|
|
59438
|
+
})
|
|
59439
|
+
`
|
|
59440
|
+
},
|
|
59441
|
+
{
|
|
59442
|
+
"actionType": "setValue",
|
|
59443
|
+
"componentId": quickEditId,
|
|
59444
|
+
"args": {
|
|
59445
|
+
"value":{
|
|
59446
|
+
"isBatchEdit": true
|
|
59447
|
+
}
|
|
59448
|
+
},
|
|
59449
|
+
}
|
|
59450
|
+
]
|
|
59451
|
+
},
|
|
59452
|
+
"cancel":{
|
|
59453
|
+
"actions":[
|
|
59454
|
+
{
|
|
59455
|
+
"actionType": "setValue",
|
|
59456
|
+
"componentId": quickEditId,
|
|
59457
|
+
"args": {
|
|
59458
|
+
"value":{
|
|
59459
|
+
"isBatchEdit": false
|
|
59460
|
+
}
|
|
59461
|
+
},
|
|
59462
|
+
}
|
|
59463
|
+
]
|
|
59464
|
+
}
|
|
59465
|
+
}
|
|
59466
|
+
},
|
|
59467
|
+
"expression":"${COUNT(event.data.noPermission)>0}"
|
|
59468
|
+
}
|
|
59469
|
+
]
|
|
59470
|
+
}
|
|
59471
|
+
}
|
|
59472
|
+
});
|
|
59473
|
+
}
|
|
59196
59474
|
} else {
|
|
59197
59475
|
quickEditSchema = false;
|
|
59198
59476
|
}
|
|
@@ -59227,6 +59505,8 @@ async function getTableColumns(fields, options){
|
|
|
59227
59505
|
const columns = [];
|
|
59228
59506
|
if(!options.isLookup){
|
|
59229
59507
|
columns.push({name: '_index',type: 'text', width: 32, placeholder: ""});
|
|
59508
|
+
//将_display放入crud的columns中,可以通过setvalue修改行内数据域的_display,而不影响上层items的_display,用于批量编辑
|
|
59509
|
+
columns.push({name: '_display',type: 'static', width: 32, placeholder: "",id: "_display_${_index}", className: "hidden"});
|
|
59230
59510
|
}
|
|
59231
59511
|
const allowEdit = options.permissions?.allowEdit && !options.isLookup && options.enable_inline_edit != false;
|
|
59232
59512
|
|
|
@@ -59258,7 +59538,7 @@ async function getTableColumns(fields, options){
|
|
|
59258
59538
|
{
|
|
59259
59539
|
"args": {
|
|
59260
59540
|
"api": {
|
|
59261
|
-
"url": "${context.rootUrl
|
|
59541
|
+
"url": "${(versions[0] && versions[0].url) ? versions[0].url+'?download=true' : context.rootUrl+'/api/files/files/'+versions[0]+'?download=true'}",
|
|
59262
59542
|
"method": "get",
|
|
59263
59543
|
"headers": {
|
|
59264
59544
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
@@ -59305,7 +59585,7 @@ async function getTableColumns(fields, options){
|
|
|
59305
59585
|
else if(field.type === 'select'){
|
|
59306
59586
|
const map = getSelectMap(field.options);
|
|
59307
59587
|
columnItem = Object.assign({}, {
|
|
59308
|
-
type: "mapping",
|
|
59588
|
+
type: "static-mapping",
|
|
59309
59589
|
name: field.name,
|
|
59310
59590
|
label: field.label,
|
|
59311
59591
|
map: map,
|
|
@@ -59320,7 +59600,7 @@ async function getTableColumns(fields, options){
|
|
|
59320
59600
|
const tpl = await getFieldTpl(field, options);
|
|
59321
59601
|
let type = 'text';
|
|
59322
59602
|
if(tpl){
|
|
59323
|
-
type = '
|
|
59603
|
+
type = 'static';
|
|
59324
59604
|
}else if(field.type === 'html'){
|
|
59325
59605
|
type = 'markdown';
|
|
59326
59606
|
}else if(field.type === 'url'){
|
|
@@ -59361,6 +59641,7 @@ async function getTableColumns(fields, options){
|
|
|
59361
59641
|
columnItem.quickEdit = quickEditSchema;
|
|
59362
59642
|
columnItem.quickEditEnabledOn = "${is_system !== true}";
|
|
59363
59643
|
}
|
|
59644
|
+
columnItem.id = `${options.objectName}_${field.name}_\${_index}`;
|
|
59364
59645
|
columns.push(columnItem);
|
|
59365
59646
|
}
|
|
59366
59647
|
}
|
|
@@ -59639,7 +59920,7 @@ async function getTableOperation(ctx){
|
|
|
59639
59920
|
}
|
|
59640
59921
|
return {
|
|
59641
59922
|
type: 'operation',
|
|
59642
|
-
label:
|
|
59923
|
+
label: "",
|
|
59643
59924
|
fixed: 'right',
|
|
59644
59925
|
labelClassName: 'text-center',
|
|
59645
59926
|
className: 'text-center steedos-listview-operation w-10',
|
|
@@ -59673,23 +59954,87 @@ async function getTableOperation(ctx){
|
|
|
59673
59954
|
}
|
|
59674
59955
|
}
|
|
59675
59956
|
|
|
59957
|
+
async function getDefaultCrudCard(columns, options) {
|
|
59958
|
+
let labelFieldName = options?.labelFieldName || "name";
|
|
59959
|
+
let titleColumn, bodyColumns = [];
|
|
59960
|
+
columns.forEach(function (item) {
|
|
59961
|
+
delete item.quickEdit;
|
|
59962
|
+
delete item.width;
|
|
59963
|
+
if (item.name === labelFieldName) {
|
|
59964
|
+
titleColumn = item;
|
|
59965
|
+
}
|
|
59966
|
+
else {
|
|
59967
|
+
if (item.name !== "_index") {
|
|
59968
|
+
bodyColumns.push(item);
|
|
59969
|
+
}
|
|
59970
|
+
}
|
|
59971
|
+
});
|
|
59972
|
+
let card = {
|
|
59973
|
+
"header": {
|
|
59974
|
+
"title": titleColumn.tpl
|
|
59975
|
+
},
|
|
59976
|
+
body: bodyColumns,
|
|
59977
|
+
// useCardLabel: false,
|
|
59978
|
+
toolbar: []
|
|
59979
|
+
};
|
|
59980
|
+
let hideToolbarOperation = options.formFactor === 'SMALL' || ["split"].indexOf(options.displayAs) > -1;
|
|
59981
|
+
if(!hideToolbarOperation){
|
|
59982
|
+
let toolbarOperation = await getTableOperation(options);
|
|
59983
|
+
if (toolbarOperation) {
|
|
59984
|
+
toolbarOperation.className += " inline-block w-auto";
|
|
59985
|
+
}
|
|
59986
|
+
card.toolbar.push(toolbarOperation);
|
|
59987
|
+
}
|
|
59988
|
+
return card;
|
|
59989
|
+
}
|
|
59990
|
+
|
|
59676
59991
|
async function getTableSchema$1(fields, options){
|
|
59677
59992
|
if(!options){
|
|
59678
59993
|
options = {};
|
|
59679
59994
|
}
|
|
59680
59995
|
let { isLookup, hiddenColumnOperation } = options;
|
|
59996
|
+
const defaults = options.defaults;
|
|
59997
|
+
const listSchema = (defaults && defaults.listSchema) || {};
|
|
59998
|
+
|
|
59681
59999
|
let columns = [];
|
|
59682
60000
|
let useMobileColumns = options.formFactor === 'SMALL' || ["split"].indexOf(options.displayAs) > -1;
|
|
59683
60001
|
if(isLookup){
|
|
59684
60002
|
// 在lookup手机端列表模式调式好之前不使用getMobileTableColumns
|
|
59685
60003
|
useMobileColumns = false;
|
|
59686
60004
|
}
|
|
60005
|
+
if(listSchema.mode && listSchema.mode !== "table"){
|
|
60006
|
+
// 如果指定的mode,则不走我们内置的手机端列表效果,使用steedos组件内部开发的默认card/list效果,或者由用户自己实现card/list模式的crud列表
|
|
60007
|
+
useMobileColumns = false;
|
|
60008
|
+
}
|
|
59687
60009
|
if(useMobileColumns){
|
|
59688
60010
|
columns = await getMobileTableColumns(fields, options);
|
|
59689
60011
|
}
|
|
59690
60012
|
else {
|
|
59691
60013
|
columns = await getTableColumns(fields, options);
|
|
59692
60014
|
|
|
60015
|
+
if(listSchema.mode === "cards"){
|
|
60016
|
+
let card = listSchema.card;
|
|
60017
|
+
if(!card){
|
|
60018
|
+
card = await getDefaultCrudCard(columns, options);
|
|
60019
|
+
}
|
|
60020
|
+
return {
|
|
60021
|
+
mode: "cards",
|
|
60022
|
+
perPageAvailable: [5, 10, 20, 50, 100, 500],
|
|
60023
|
+
name: "thelist",
|
|
60024
|
+
headerToolbarClassName: "py-2 px-2 border-gray-300 border-solid border-b",
|
|
60025
|
+
className: "",
|
|
60026
|
+
draggable: false,
|
|
60027
|
+
defaultParams: getDefaultParams(options),
|
|
60028
|
+
card: card,
|
|
60029
|
+
syncLocation: false,
|
|
60030
|
+
keepItemSelectionOnPageChange: true,
|
|
60031
|
+
checkOnItemClick: isLookup ? true : false,
|
|
60032
|
+
labelTpl: `\${${options.labelFieldName}}`,
|
|
60033
|
+
autoFillHeight: false, // 自动高度效果不理想,先关闭
|
|
60034
|
+
columnsTogglable: false
|
|
60035
|
+
}
|
|
60036
|
+
}
|
|
60037
|
+
|
|
59693
60038
|
if(!isLookup && !hiddenColumnOperation){
|
|
59694
60039
|
columns.push(await getTableOperation(options));
|
|
59695
60040
|
}
|
|
@@ -59697,6 +60042,7 @@ async function getTableSchema$1(fields, options){
|
|
|
59697
60042
|
|
|
59698
60043
|
return {
|
|
59699
60044
|
mode: "table",
|
|
60045
|
+
perPageAvailable: [5, 10, 20, 50, 100, 500],
|
|
59700
60046
|
name: "thelist",
|
|
59701
60047
|
headerToolbarClassName: "py-2 px-2 border-gray-300 border-solid border-b",
|
|
59702
60048
|
className: "",
|
|
@@ -59784,8 +60130,8 @@ function isObject(obj) {
|
|
|
59784
60130
|
/*
|
|
59785
60131
|
* @Author: baozhoutao@steedos.com
|
|
59786
60132
|
* @Date: 2022-07-05 15:55:39
|
|
59787
|
-
* @LastEditors:
|
|
59788
|
-
* @LastEditTime: 2023-
|
|
60133
|
+
* @LastEditors: liaodaxue
|
|
60134
|
+
* @LastEditTime: 2023-10-20 11:38:25
|
|
59789
60135
|
* @Description:
|
|
59790
60136
|
*/
|
|
59791
60137
|
|
|
@@ -60082,8 +60428,8 @@ async function getListSchema(
|
|
|
60082
60428
|
"filtersFunction": listview_filters,
|
|
60083
60429
|
"sort": sort,
|
|
60084
60430
|
"ctx": ctx,
|
|
60085
|
-
"requestAdaptor": listView.requestAdaptor,
|
|
60086
|
-
"adaptor": listView.adaptor,
|
|
60431
|
+
"requestAdaptor": listView.requestAdaptor || ctx.requestAdaptor,
|
|
60432
|
+
"adaptor": listView.adaptor || ctx.adaptor,
|
|
60087
60433
|
"headerToolbarItems": ctx.headerToolbarItems,
|
|
60088
60434
|
"filterVisible": ctx.filterVisible,
|
|
60089
60435
|
"rowClassNameExpr": ctx.rowClassNameExpr,
|
|
@@ -65217,7 +65563,13 @@ var PLACEHOLDER_ID = 'placeholder';
|
|
|
65217
65563
|
var empty = [];
|
|
65218
65564
|
function MultipleContainers(props) {
|
|
65219
65565
|
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,
|
|
65566
|
+
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,
|
|
65567
|
+
// strategy = verticalListSortingStrategy,
|
|
65568
|
+
_j = props.strategy,
|
|
65569
|
+
// strategy = verticalListSortingStrategy,
|
|
65570
|
+
strategy = _j === void 0 ? rectSortingStrategy : _j, //这里默认值不用rectSortingStrategy的话,会出现字段在左右两边拖动变更顺序时拖动过程中dragOverlay丢失问题
|
|
65571
|
+
_k = props.addable, //这里默认值不用rectSortingStrategy的话,会出现字段在左右两边拖动变更顺序时拖动过程中dragOverlay丢失问题
|
|
65572
|
+
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
65573
|
"type": "tpl",
|
|
65222
65574
|
"tpl": "${label}",
|
|
65223
65575
|
"inline": false,
|
|
@@ -65225,24 +65577,28 @@ function MultipleContainers(props) {
|
|
|
65225
65577
|
"type": "tpl",
|
|
65226
65578
|
"tpl": "${label}",
|
|
65227
65579
|
}] : _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
|
-
|
|
65580
|
+
value && delete (value.$$id);
|
|
65229
65581
|
var _w = __read(react.exports.useState(function () {
|
|
65230
65582
|
var _a;
|
|
65231
|
-
return (_a =
|
|
65583
|
+
return (_a = value) !== null && _a !== void 0 ? _a : {
|
|
65232
65584
|
A: ['A1', 'A2'],
|
|
65233
65585
|
B: ['B1', 'B2'],
|
|
65234
65586
|
C: ['C1', 'C2'],
|
|
65235
65587
|
};
|
|
65236
65588
|
}), 2), items = _w[0], setItems = _w[1];
|
|
65237
65589
|
var _x = __read(react.exports.useState(Object.keys(items)), 2), containers = _x[0], setContainers = _x[1];
|
|
65238
|
-
|
|
65590
|
+
react.exports.useEffect(function () {
|
|
65591
|
+
setItems(value);
|
|
65592
|
+
setContainers(Object.keys(value));
|
|
65593
|
+
}, [value]);
|
|
65594
|
+
var handleChange = function (newItems) { return __awaiter(_this, void 0, void 0, function () {
|
|
65239
65595
|
var value, rendererEvent;
|
|
65240
65596
|
return __generator(this, function (_a) {
|
|
65241
65597
|
switch (_a.label) {
|
|
65242
65598
|
case 0:
|
|
65243
65599
|
if (!amisDispatchEvent || !amisOnChange)
|
|
65244
65600
|
return [2 /*return*/];
|
|
65245
|
-
value = items;
|
|
65601
|
+
value = newItems || items;
|
|
65246
65602
|
return [4 /*yield*/, amisDispatchEvent('change', createObject(amisData, {
|
|
65247
65603
|
value: value
|
|
65248
65604
|
}))];
|
|
@@ -65251,7 +65607,7 @@ function MultipleContainers(props) {
|
|
|
65251
65607
|
if (rendererEvent === null || rendererEvent === void 0 ? void 0 : rendererEvent.prevented) {
|
|
65252
65608
|
return [2 /*return*/];
|
|
65253
65609
|
}
|
|
65254
|
-
setTimeout(function () { return amisOnChange(value); },
|
|
65610
|
+
setTimeout(function () { return amisOnChange(value); }, 500);
|
|
65255
65611
|
return [2 /*return*/];
|
|
65256
65612
|
}
|
|
65257
65613
|
});
|
|
@@ -65354,6 +65710,7 @@ function MultipleContainers(props) {
|
|
|
65354
65710
|
var active = _a.active, over = _a.over;
|
|
65355
65711
|
var overId = over === null || over === void 0 ? void 0 : over.id;
|
|
65356
65712
|
if (overId == null || overId === TRASH_ID || active.id in items) {
|
|
65713
|
+
// 拖动的是分组则跳过后面的逻辑
|
|
65357
65714
|
return;
|
|
65358
65715
|
}
|
|
65359
65716
|
var overContainer = findContainer(overId);
|
|
@@ -65429,19 +65786,44 @@ function MultipleContainers(props) {
|
|
|
65429
65786
|
return;
|
|
65430
65787
|
}
|
|
65431
65788
|
var overContainer = findContainer(overId);
|
|
65789
|
+
var newItems = items;
|
|
65432
65790
|
if (overContainer) {
|
|
65433
|
-
|
|
65434
|
-
|
|
65435
|
-
|
|
65436
|
-
|
|
65437
|
-
|
|
65438
|
-
|
|
65439
|
-
|
|
65791
|
+
if (activeContainer !== overContainer) {
|
|
65792
|
+
// 拖动变更分组之间的顺序时,activeContainer 与 overContainer 值不相等
|
|
65793
|
+
setTimeout(function () {
|
|
65794
|
+
var sortedGroups = over.data.current.sortable.items; //不加setTimeout的话,这里拿到的会是变更前的数据
|
|
65795
|
+
newItems = {};
|
|
65796
|
+
sortedGroups.forEach(function (groupKey) {
|
|
65797
|
+
newItems[groupKey] = items[groupKey];
|
|
65798
|
+
});
|
|
65799
|
+
delete newItems[TRASH_ID];
|
|
65800
|
+
delete newItems[PLACEHOLDER_ID];
|
|
65801
|
+
if (lodash.exports.keys(items).join(",") !== lodash.exports.keys(newItems).join(",")) {
|
|
65802
|
+
// 只有顺序发生变化时才触发change事件
|
|
65803
|
+
setItems(newItems);
|
|
65804
|
+
// console.log('拖动结束2,更新form value')
|
|
65805
|
+
handleChange(newItems);
|
|
65806
|
+
}
|
|
65807
|
+
setActiveId(null);
|
|
65808
|
+
}, 500);
|
|
65809
|
+
return;
|
|
65810
|
+
}
|
|
65811
|
+
else {
|
|
65812
|
+
// 同一个分组中字段顺序变更以及把一个字段从某个分组拖动到另一个分组内时,activeContainer 与 overContainer 值相等
|
|
65813
|
+
var activeIndex_1 = items[activeContainer].indexOf(active.id);
|
|
65814
|
+
var overIndex_1 = items[overContainer].indexOf(overId);
|
|
65815
|
+
if (activeIndex_1 !== overIndex_1) {
|
|
65816
|
+
setItems(function (items) {
|
|
65817
|
+
var _a;
|
|
65818
|
+
newItems = __assign$1(__assign$1({}, items), (_a = {}, _a[overContainer] = arrayMove(items[overContainer], activeIndex_1, overIndex_1), _a));
|
|
65819
|
+
return newItems;
|
|
65820
|
+
});
|
|
65821
|
+
}
|
|
65440
65822
|
}
|
|
65441
65823
|
}
|
|
65442
65824
|
setActiveId(null);
|
|
65443
65825
|
// console.log('拖动结束2,更新form value')
|
|
65444
|
-
handleChange();
|
|
65826
|
+
handleChange(newItems);
|
|
65445
65827
|
}, cancelDrop: cancelDrop, onDragCancel: onDragCancel, modifiers: modifiers },
|
|
65446
65828
|
React.createElement("div", { style: {
|
|
65447
65829
|
display: 'inline-grid',
|