@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.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
|
|
|
@@ -55149,7 +55149,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
55149
55149
|
showFieldsFilter = true;
|
|
55150
55150
|
}
|
|
55151
55151
|
filterService.setData({showFieldsFilter});
|
|
55152
|
-
resizeWindow()
|
|
55152
|
+
// resizeWindow();//已迁移到搜索栏表单提交事件中执行,因为表单项change后也会触发表单提交了
|
|
55153
55153
|
// 使用filterForm.getValues()的话,并不能拿到本地存储中的过滤条件,所以需要从event.data中取。
|
|
55154
55154
|
let filterFormValues = event.data;
|
|
55155
55155
|
let isFieldsFilterEmpty = SteedosUI.isFilterFormValuesEmpty(filterFormValues);
|
|
@@ -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高度显示有问题
|
|
@@ -56638,7 +56641,8 @@ function getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLooku
|
|
|
56638
56641
|
"placeholder": "搜索此列表",
|
|
56639
56642
|
"value": crudKeywords,
|
|
56640
56643
|
"clearable": true,
|
|
56641
|
-
"clearAndSubmit": true
|
|
56644
|
+
"clearAndSubmit": true,
|
|
56645
|
+
"searchImediately": true
|
|
56642
56646
|
}
|
|
56643
56647
|
]
|
|
56644
56648
|
}
|
|
@@ -56813,6 +56817,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
|
|
|
56813
56817
|
}
|
|
56814
56818
|
|
|
56815
56819
|
function getObjectFooterToolbar(mainObject, formFactor, options) {
|
|
56820
|
+
// crud card模式与table模式两种情况下showPageInput默认值不一样,所以需要显式设置为false
|
|
56816
56821
|
if (formFactor === 'SMALL') {
|
|
56817
56822
|
// return [
|
|
56818
56823
|
// "load-more",
|
|
@@ -56822,14 +56827,17 @@ function getObjectFooterToolbar(mainObject, formFactor, options) {
|
|
|
56822
56827
|
"switch-per-page",
|
|
56823
56828
|
{
|
|
56824
56829
|
"type": "pagination",
|
|
56825
|
-
"maxButtons": 5
|
|
56830
|
+
"maxButtons": 5,
|
|
56831
|
+
"showPageInput": false
|
|
56826
56832
|
}
|
|
56827
56833
|
]
|
|
56828
56834
|
}else {
|
|
56829
56835
|
return [
|
|
56836
|
+
// "statistics",
|
|
56830
56837
|
{
|
|
56831
56838
|
"type": "pagination",
|
|
56832
|
-
"maxButtons": 5
|
|
56839
|
+
"maxButtons": 5,
|
|
56840
|
+
"showPageInput": false
|
|
56833
56841
|
}
|
|
56834
56842
|
]
|
|
56835
56843
|
}
|
|
@@ -56838,32 +56846,81 @@ function getObjectFooterToolbar(mainObject, formFactor, options) {
|
|
|
56838
56846
|
if(options && options.isRelated){
|
|
56839
56847
|
return [
|
|
56840
56848
|
"statistics",
|
|
56841
|
-
|
|
56849
|
+
{
|
|
56850
|
+
"type": "pagination",
|
|
56851
|
+
"maxButtons": 10,
|
|
56852
|
+
"showPageInput": false
|
|
56853
|
+
}
|
|
56842
56854
|
]
|
|
56843
56855
|
|
|
56844
56856
|
}
|
|
56845
56857
|
else {
|
|
56846
|
-
|
|
56847
|
-
|
|
56858
|
+
const no_pagination = mainObject.paging && (mainObject.paging.enabled === false);
|
|
56859
|
+
const is_lookup = options.isLookup;
|
|
56860
|
+
const commonConfig = [
|
|
56848
56861
|
"statistics",
|
|
56849
|
-
|
|
56850
|
-
|
|
56862
|
+
{
|
|
56863
|
+
"type": "pagination",
|
|
56864
|
+
"maxButtons": 10,
|
|
56865
|
+
"showPageInput": false
|
|
56866
|
+
}
|
|
56867
|
+
];
|
|
56868
|
+
|
|
56869
|
+
if (no_pagination && is_lookup) {
|
|
56870
|
+
return commonConfig;
|
|
56871
|
+
} else {
|
|
56872
|
+
return ["switch-per-page", ...commonConfig];
|
|
56873
|
+
}
|
|
56851
56874
|
}
|
|
56852
56875
|
}
|
|
56853
56876
|
}
|
|
56854
56877
|
|
|
56855
56878
|
async function getObjectFilter(objectSchema, fields, options) {
|
|
56856
56879
|
const fieldsFilterBarSchema = await getObjectListHeaderFieldsFilterBar(objectSchema, null, options);
|
|
56880
|
+
let onSubmitSuccScript = `
|
|
56881
|
+
let isLookup = event.data.isLookup;
|
|
56882
|
+
if(isLookup){
|
|
56883
|
+
return;
|
|
56884
|
+
}
|
|
56885
|
+
// 列表搜索栏字段值变更后立刻触发提交表单执行crud搜索,所以这里需要额外重算crud高度及筛选按钮红色星号图标显示隐藏
|
|
56886
|
+
let resizeWindow = function(){
|
|
56887
|
+
//触发amis crud 高度重算
|
|
56888
|
+
setTimeout(()=>{
|
|
56889
|
+
window.dispatchEvent(new Event("resize"))
|
|
56890
|
+
}, 1000);
|
|
56891
|
+
}
|
|
56892
|
+
resizeWindow();
|
|
56893
|
+
const scope = event.context.scoped;
|
|
56894
|
+
// let filterFormValues = event.data;
|
|
56895
|
+
let filterForm = SteedosUI.getClosestAmisComponentByType(scope, "form");
|
|
56896
|
+
let filterFormService = SteedosUI.getClosestAmisComponentByType(filterForm.context, "service");
|
|
56897
|
+
// 使用event.data的话,并不能拿到本地存储中的过滤条件,所以需要从filterFormService中取。
|
|
56898
|
+
let filterFormValues = filterFormService.getData()
|
|
56899
|
+
let isFieldsFilterEmpty = SteedosUI.isFilterFormValuesEmpty(filterFormValues);
|
|
56900
|
+
let crud = SteedosUI.getClosestAmisComponentByType(scope, "crud");
|
|
56901
|
+
let crudService = crud && SteedosUI.getClosestAmisComponentByType(crud.context, "service");
|
|
56902
|
+
crudService && crudService.setData({isFieldsFilterEmpty});
|
|
56903
|
+
`;
|
|
56857
56904
|
return {
|
|
56858
56905
|
"title": "",
|
|
56859
56906
|
"submitText": "",
|
|
56860
56907
|
"className": "",
|
|
56861
|
-
|
|
56908
|
+
"debug": true,
|
|
56862
56909
|
"mode": "normal",
|
|
56863
56910
|
"wrapWithPanel": false,
|
|
56864
56911
|
"body": [
|
|
56865
56912
|
fieldsFilterBarSchema
|
|
56866
|
-
]
|
|
56913
|
+
],
|
|
56914
|
+
"onEvent": {
|
|
56915
|
+
"submitSucc": {
|
|
56916
|
+
"actions": [
|
|
56917
|
+
{
|
|
56918
|
+
"actionType": "custom",
|
|
56919
|
+
"script": onSubmitSuccScript
|
|
56920
|
+
}
|
|
56921
|
+
]
|
|
56922
|
+
}
|
|
56923
|
+
}
|
|
56867
56924
|
}
|
|
56868
56925
|
}
|
|
56869
56926
|
|
|
@@ -57484,13 +57541,15 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
57484
57541
|
pickerSchema.headerToolbar = getObjectHeaderToolbar(refObjectConfig, fieldsArr, ctx.formFactor, { headerToolbarItems, isLookup: true, keywordsSearchBoxName });
|
|
57485
57542
|
const isAllowCreate = refObjectConfig.permissions.allowCreate;
|
|
57486
57543
|
const isCreate = lodash.exports.isBoolean(field.create) ? field.create : true;
|
|
57487
|
-
|
|
57544
|
+
// lookup字段配置过滤条件就强制不显示新建按钮
|
|
57545
|
+
let isHasFilters = (field.filters || field._filtersFunction) ? true : false;
|
|
57546
|
+
if (isAllowCreate && isCreate && !isHasFilters) {
|
|
57488
57547
|
const new_button = await getSchema$5(refObjectConfig, { appId: ctx.appId, objectName: refObjectConfig.name, formFactor: ctx.formFactor });
|
|
57489
57548
|
new_button.align = "right";
|
|
57490
57549
|
// 保持快速搜索放在最左侧,新建按钮往里插,而不是push到最后
|
|
57491
57550
|
pickerSchema.headerToolbar.splice(pickerSchema.headerToolbar.length - 1, 0, new_button);
|
|
57492
57551
|
}
|
|
57493
|
-
pickerSchema.footerToolbar = refObjectConfig.enable_tree ? [] : getObjectFooterToolbar();
|
|
57552
|
+
pickerSchema.footerToolbar = refObjectConfig.enable_tree ? [] : getObjectFooterToolbar(refObjectConfig,ctx.formFactor,{isLookup: true});
|
|
57494
57553
|
if (ctx.filterVisible !== false) {
|
|
57495
57554
|
pickerSchema.filter = await getObjectFilter(refObjectConfig, fields, {
|
|
57496
57555
|
...ctx,
|
|
@@ -57618,10 +57677,10 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
57618
57677
|
// const labelFieldKey = referenceTo && referenceTo.labelField?.name || 'name';
|
|
57619
57678
|
|
|
57620
57679
|
let apiInfo;
|
|
57621
|
-
|
|
57680
|
+
let defaultValueOptionsQueryData;
|
|
57622
57681
|
if(referenceTo){
|
|
57623
57682
|
// 字段值单独走一个请求合并到source的同一个GraphQL接口中
|
|
57624
|
-
|
|
57683
|
+
defaultValueOptionsQueryData = await getFindQuery({ name: referenceTo.objectName }, null, [
|
|
57625
57684
|
Object.assign({}, referenceTo.labelField, {alias: 'label'}),
|
|
57626
57685
|
Object.assign({}, referenceTo.valueField, {alias: 'value'})
|
|
57627
57686
|
], {
|
|
@@ -57634,7 +57693,7 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
57634
57693
|
}, null, [
|
|
57635
57694
|
Object.assign({}, referenceTo.labelField, {alias: 'label'}),
|
|
57636
57695
|
Object.assign({}, referenceTo.valueField, {alias: 'value'})
|
|
57637
|
-
], {expand: false, alias: 'options', queryOptions: `filters: {__filters}, top: {__top}, sort: "{__sort}"
|
|
57696
|
+
], {expand: false, alias: 'options', queryOptions: `filters: {__filters}, top: {__top}, sort: "{__sort}"`});
|
|
57638
57697
|
|
|
57639
57698
|
apiInfo.adaptor = `
|
|
57640
57699
|
const data = payload.data;
|
|
@@ -57728,11 +57787,16 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
57728
57787
|
var optionsFiltersOp = "${field.multiple ? "in" : "="}";
|
|
57729
57788
|
var optionsFilters = [["${valueFieldKey}", optionsFiltersOp, []]];
|
|
57730
57789
|
if (defaultValue && !api.data.$term) {
|
|
57790
|
+
const defaultValueOptionsQueryData = ${JSON.stringify(defaultValueOptionsQueryData)};
|
|
57791
|
+
const defaultValueOptionsQuery = defaultValueOptionsQueryData?.query?.replace(/^{/,"").replace(/}$/,"");
|
|
57731
57792
|
// 字段值单独请求,没值的时候在请求中返回空
|
|
57732
57793
|
optionsFilters = [["${valueFieldKey}", optionsFiltersOp, defaultValue]];
|
|
57733
57794
|
if(filters.length > 0){
|
|
57734
57795
|
optionsFilters = [filters, optionsFilters];
|
|
57735
57796
|
}
|
|
57797
|
+
if(defaultValueOptionsQuery){
|
|
57798
|
+
api.data.query = "{"+api.data.query.replace(/^{/,"").replace(/}$/,"")+","+defaultValueOptionsQuery+"}";
|
|
57799
|
+
}
|
|
57736
57800
|
}
|
|
57737
57801
|
api.data.query = api.data.query.replace(/{__options_filters}/g, JSON.stringify(optionsFilters));
|
|
57738
57802
|
return api;
|
|
@@ -57774,7 +57838,7 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
57774
57838
|
disabledOn: `${readonly} || ( (this._master && (this._master.relatedKey ==='${field.name}')) || ((this.relatedKey ==='${field.name}') && (${field.multiple} != true)) )`,
|
|
57775
57839
|
// labelField: labelField,
|
|
57776
57840
|
// valueField: valueField,
|
|
57777
|
-
source: apiInfo,
|
|
57841
|
+
// source: apiInfo,
|
|
57778
57842
|
autoComplete: apiInfo,
|
|
57779
57843
|
searchable: true,
|
|
57780
57844
|
};
|
|
@@ -57853,10 +57917,10 @@ async function lookupToAmis(field, readonly, ctx){
|
|
|
57853
57917
|
|
|
57854
57918
|
const refObject = await getUISchema(referenceTo.objectName);
|
|
57855
57919
|
|
|
57856
|
-
//
|
|
57857
|
-
|
|
57858
|
-
//
|
|
57859
|
-
if(
|
|
57920
|
+
// 优先取字段中配置的enable_enhanced_lookup,字段上没配置时,才从对象上取enable_enhanced_lookup属性
|
|
57921
|
+
let enableEnhancedLookup = lodash.exports.isBoolean(field.enable_enhanced_lookup) ? field.enable_enhanced_lookup : refObject.enable_enhanced_lookup;
|
|
57922
|
+
// 默认使用下拉框模式显示lookup选项,只能配置了enable_enhanced_lookup才使用弹出增强模式
|
|
57923
|
+
if(enableEnhancedLookup == true){
|
|
57860
57924
|
return await lookupToAmisPicker(field, readonly, ctx);
|
|
57861
57925
|
}else if(refObject.enable_tree) {
|
|
57862
57926
|
return await lookupToAmisTreeSelect(field, readonly, Object.assign({}, ctx, {
|
|
@@ -58169,8 +58233,8 @@ function getAmisStaticFieldType(type, readonly, options){
|
|
|
58169
58233
|
/*
|
|
58170
58234
|
* @Author: baozhoutao@steedos.com
|
|
58171
58235
|
* @Date: 2022-10-28 14:15:09
|
|
58172
|
-
* @LastEditors:
|
|
58173
|
-
* @LastEditTime:
|
|
58236
|
+
* @LastEditors: liaodaxue
|
|
58237
|
+
* @LastEditTime: 2023-10-30 17:51:54
|
|
58174
58238
|
* @Description:
|
|
58175
58239
|
*/
|
|
58176
58240
|
|
|
@@ -58221,11 +58285,26 @@ const getAmisFileEditSchema = (steedosField)=>{
|
|
|
58221
58285
|
useChunk: false, // 关闭分块上传
|
|
58222
58286
|
receiver: {
|
|
58223
58287
|
method: "post",
|
|
58288
|
+
dataType: "form-data",
|
|
58224
58289
|
url: `\${context.rootUrl}/s3/${tableName}`,
|
|
58225
|
-
|
|
58226
|
-
|
|
58227
|
-
|
|
58228
|
-
|
|
58290
|
+
requestAdaptor: `
|
|
58291
|
+
const { _master, global,context } = api.body;
|
|
58292
|
+
// const { recordId, objectName } = _master;
|
|
58293
|
+
const { spaceId, userId, user } = global;
|
|
58294
|
+
/*
|
|
58295
|
+
record_id: recordId,
|
|
58296
|
+
parent: recordId,
|
|
58297
|
+
object_name: objectName,
|
|
58298
|
+
owner_name: user.name,
|
|
58299
|
+
space: spaceId,
|
|
58300
|
+
owner: userId
|
|
58301
|
+
*/
|
|
58302
|
+
// 参考platform 2.2版本,附件字段保存时cfs.files.filerecord、cfs.images.filerecord表中的metadata下只保存space、owner两个属性值。
|
|
58303
|
+
api.data.append('space', spaceId);
|
|
58304
|
+
api.data.append('owner', userId);
|
|
58305
|
+
|
|
58306
|
+
return api;
|
|
58307
|
+
`,
|
|
58229
58308
|
adaptor: `
|
|
58230
58309
|
const { context } = api.body;
|
|
58231
58310
|
var rootUrl = context.rootUrl + "/api/files/${tableName}/";
|
|
@@ -58306,8 +58385,6 @@ function getSelectFieldOptions(field){
|
|
|
58306
58385
|
}
|
|
58307
58386
|
|
|
58308
58387
|
async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
58309
|
-
// console.log('convertSFieldToAmisField====>', field, readonly, ctx)
|
|
58310
|
-
const isMobile = window.innerWidth <= 768;
|
|
58311
58388
|
// 创建人和修改人、创建时间和修改时间不显示
|
|
58312
58389
|
if(lodash.exports.includes(OMIT_FIELDS, field.name) && ctx.showSystemFields != true){
|
|
58313
58390
|
return;
|
|
@@ -58396,26 +58473,33 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
58396
58473
|
};
|
|
58397
58474
|
break;
|
|
58398
58475
|
case 'date':
|
|
58399
|
-
convertData = isMobile && !readonly ? {
|
|
58400
|
-
|
|
58401
|
-
|
|
58402
|
-
|
|
58403
|
-
|
|
58404
|
-
|
|
58405
|
-
|
|
58406
|
-
|
|
58407
|
-
|
|
58408
|
-
|
|
58409
|
-
|
|
58410
|
-
|
|
58411
|
-
|
|
58412
|
-
|
|
58413
|
-
|
|
58414
|
-
|
|
58415
|
-
|
|
58416
|
-
|
|
58417
|
-
|
|
58418
|
-
} : {
|
|
58476
|
+
// convertData = isMobile && !readonly ? {
|
|
58477
|
+
// type: "native-date",
|
|
58478
|
+
// pipeIn: (value, data) => {
|
|
58479
|
+
// if (value) {
|
|
58480
|
+
// value = moment(value).utc().format('YYYY-MM-DD');
|
|
58481
|
+
// return value;
|
|
58482
|
+
// } else {
|
|
58483
|
+
// return "";
|
|
58484
|
+
// }
|
|
58485
|
+
|
|
58486
|
+
// },
|
|
58487
|
+
// pipeOut: (value, oldValue, data) => {
|
|
58488
|
+
// if (value) {
|
|
58489
|
+
// value = moment(value).format('YYYY-MM-DDT00:00:00.000[Z]');
|
|
58490
|
+
// return value;
|
|
58491
|
+
// } else {
|
|
58492
|
+
// return "";
|
|
58493
|
+
// }
|
|
58494
|
+
// }
|
|
58495
|
+
// } : {
|
|
58496
|
+
// type: getAmisStaticFieldType('date', readonly),
|
|
58497
|
+
// inputFormat: "YYYY-MM-DD",
|
|
58498
|
+
// format:'YYYY-MM-DDT00:00:00.000[Z]',
|
|
58499
|
+
// tpl: readonly ? Tpl.getDateTpl(field) : null,
|
|
58500
|
+
// // utc: true
|
|
58501
|
+
// }
|
|
58502
|
+
convertData = {
|
|
58419
58503
|
type: getAmisStaticFieldType('date', readonly),
|
|
58420
58504
|
inputFormat: "YYYY-MM-DD",
|
|
58421
58505
|
format:'YYYY-MM-DDT00:00:00.000[Z]',
|
|
@@ -58434,43 +58518,51 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
58434
58518
|
};
|
|
58435
58519
|
break;
|
|
58436
58520
|
case 'datetime':
|
|
58437
|
-
convertData = isMobile && !readonly ? {
|
|
58438
|
-
|
|
58439
|
-
|
|
58440
|
-
|
|
58441
|
-
|
|
58442
|
-
|
|
58443
|
-
|
|
58444
|
-
|
|
58445
|
-
|
|
58446
|
-
|
|
58447
|
-
|
|
58448
|
-
|
|
58449
|
-
|
|
58450
|
-
|
|
58451
|
-
|
|
58452
|
-
|
|
58453
|
-
|
|
58454
|
-
|
|
58455
|
-
|
|
58456
|
-
|
|
58457
|
-
|
|
58458
|
-
|
|
58459
|
-
|
|
58460
|
-
|
|
58461
|
-
|
|
58462
|
-
|
|
58463
|
-
|
|
58464
|
-
|
|
58465
|
-
|
|
58466
|
-
|
|
58467
|
-
|
|
58468
|
-
|
|
58469
|
-
|
|
58470
|
-
|
|
58471
|
-
|
|
58472
|
-
|
|
58473
|
-
} : {
|
|
58521
|
+
// convertData = isMobile && !readonly ? {
|
|
58522
|
+
// type: "combo",
|
|
58523
|
+
// pipeIn: (value, data) => {
|
|
58524
|
+
// let revalue = {};
|
|
58525
|
+
// if (value && value != "Invalid date") {
|
|
58526
|
+
// value = moment(value).format('YYYY-MM-DD HH:mm:ss');
|
|
58527
|
+
// revalue[field.name + "-native-date"] = value.split(' ')[0];
|
|
58528
|
+
// revalue[field.name + "-native-time"] = value.split(' ')[1];
|
|
58529
|
+
// } else {
|
|
58530
|
+
// revalue[field.name + "-native-date"] = "";
|
|
58531
|
+
// revalue[field.name + "-native-time"] = "";
|
|
58532
|
+
// }
|
|
58533
|
+
// return revalue;
|
|
58534
|
+
// },
|
|
58535
|
+
// pipeOut: (value, oldValue, data) => {
|
|
58536
|
+
// let revalue = "";
|
|
58537
|
+
// if (value[field.name + "-native-date"] && value[field.name + "-native-time"]) {
|
|
58538
|
+
// revalue = value[field.name + "-native-date"] + " " + value[field.name + "-native-time"];
|
|
58539
|
+
// revalue = moment(revalue).utc().format('YYYY-MM-DDTHH:mm:ss.SSS[Z]');
|
|
58540
|
+
// }
|
|
58541
|
+
// return revalue;
|
|
58542
|
+
// },
|
|
58543
|
+
// items: [
|
|
58544
|
+
// {
|
|
58545
|
+
// type: "native-date",
|
|
58546
|
+
// name: field.name + "-native-date",
|
|
58547
|
+
// className: "steedos-native-date",
|
|
58548
|
+
// value: ""
|
|
58549
|
+
// },
|
|
58550
|
+
// {
|
|
58551
|
+
// type: "native-time",
|
|
58552
|
+
// name: field.name + "-native-time",
|
|
58553
|
+
// className: "steedos-native-time",
|
|
58554
|
+
// value: ""
|
|
58555
|
+
// }
|
|
58556
|
+
// ]
|
|
58557
|
+
// } : {
|
|
58558
|
+
// type: getAmisStaticFieldType('datetime', readonly),
|
|
58559
|
+
// inputFormat: 'YYYY-MM-DD HH:mm',
|
|
58560
|
+
// format: 'YYYY-MM-DDTHH:mm:ss.SSSZ',
|
|
58561
|
+
// tpl: readonly ? Tpl.getDateTimeTpl(field) : null,
|
|
58562
|
+
// utc: true,
|
|
58563
|
+
// }
|
|
58564
|
+
|
|
58565
|
+
convertData = {
|
|
58474
58566
|
type: getAmisStaticFieldType('datetime', readonly),
|
|
58475
58567
|
inputFormat: 'YYYY-MM-DD HH:mm',
|
|
58476
58568
|
format: 'YYYY-MM-DDTHH:mm:ss.SSSZ',
|
|
@@ -58490,26 +58582,34 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
58490
58582
|
};
|
|
58491
58583
|
break;
|
|
58492
58584
|
case 'time':
|
|
58493
|
-
convertData = isMobile && !readonly ? {
|
|
58494
|
-
|
|
58495
|
-
|
|
58496
|
-
|
|
58497
|
-
|
|
58498
|
-
|
|
58499
|
-
|
|
58500
|
-
|
|
58501
|
-
|
|
58502
|
-
|
|
58503
|
-
|
|
58504
|
-
|
|
58505
|
-
|
|
58506
|
-
|
|
58507
|
-
|
|
58508
|
-
|
|
58509
|
-
|
|
58510
|
-
|
|
58511
|
-
|
|
58512
|
-
} : {
|
|
58585
|
+
// convertData = isMobile && !readonly ? {
|
|
58586
|
+
// type: "native-time",
|
|
58587
|
+
// pipeIn: (value, data) => {
|
|
58588
|
+
// if (value) {
|
|
58589
|
+
// value = moment(value).utc().format('HH:mm');
|
|
58590
|
+
// return value;
|
|
58591
|
+
// } else {
|
|
58592
|
+
// return "";
|
|
58593
|
+
// }
|
|
58594
|
+
|
|
58595
|
+
// },
|
|
58596
|
+
// pipeOut: (value, oldValue, data) => {
|
|
58597
|
+
// if (value) {
|
|
58598
|
+
// value = moment('1970-01-01 ' + value).format('1970-01-01THH:mm:00.000[Z]');
|
|
58599
|
+
// return value;
|
|
58600
|
+
// } else {
|
|
58601
|
+
// return "";
|
|
58602
|
+
// }
|
|
58603
|
+
// }
|
|
58604
|
+
// } : {
|
|
58605
|
+
// type: getAmisStaticFieldType('time', readonly),
|
|
58606
|
+
// inputFormat: 'HH:mm',
|
|
58607
|
+
// timeFormat:'HH:mm',
|
|
58608
|
+
// format:'1970-01-01THH:mm:00.000[Z]',
|
|
58609
|
+
// tpl: readonly ? Tpl.getDateTimeTpl(field) : null,
|
|
58610
|
+
// // utc: true
|
|
58611
|
+
// }
|
|
58612
|
+
convertData = {
|
|
58513
58613
|
type: getAmisStaticFieldType('time', readonly),
|
|
58514
58614
|
inputFormat: 'HH:mm',
|
|
58515
58615
|
timeFormat:'HH:mm',
|
|
@@ -58559,7 +58659,20 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
58559
58659
|
type: getAmisStaticFieldType('number', readonly),
|
|
58560
58660
|
min: field.min,
|
|
58561
58661
|
max: field.max,
|
|
58562
|
-
precision: field.scale
|
|
58662
|
+
precision: field.scale,
|
|
58663
|
+
suffix: "%",
|
|
58664
|
+
pipeIn: (value, data) => {
|
|
58665
|
+
if(value){
|
|
58666
|
+
return value*100;
|
|
58667
|
+
}
|
|
58668
|
+
return value;
|
|
58669
|
+
},
|
|
58670
|
+
pipeOut: (value, oldValue, data) => {
|
|
58671
|
+
if(value){
|
|
58672
|
+
return value/100;
|
|
58673
|
+
}
|
|
58674
|
+
return value;
|
|
58675
|
+
},
|
|
58563
58676
|
};
|
|
58564
58677
|
}
|
|
58565
58678
|
break;
|
|
@@ -58893,7 +59006,9 @@ async function getFieldSearchable(perField, permissionFields, ctx){
|
|
|
58893
59006
|
|
|
58894
59007
|
const amisField = await convertSFieldToAmisField(_field, false, Object.assign({}, ctx, {fieldNamePrefix: fieldNamePrefix, required: false, showSystemFields: true, inFilterForm: true}));
|
|
58895
59008
|
if(amisField){
|
|
58896
|
-
return amisField
|
|
59009
|
+
return Object.assign({}, amisField,{
|
|
59010
|
+
submitOnChange: true
|
|
59011
|
+
});
|
|
58897
59012
|
}
|
|
58898
59013
|
}
|
|
58899
59014
|
}
|
|
@@ -58954,8 +59069,46 @@ var config = {
|
|
|
58954
59069
|
};
|
|
58955
59070
|
|
|
58956
59071
|
async function getQuickEditSchema(field, options){
|
|
58957
|
-
|
|
59072
|
+
//判断在amis3.2以上环境下,放开批量编辑
|
|
59073
|
+
let isAmisVersionforBatchEdit = false;
|
|
59074
|
+
if(window.amisRequire && window.amisRequire('amis')){
|
|
59075
|
+
isAmisVersionforBatchEdit = window.amisRequire('amis').version[0] >= 3 && window.amisRequire('amis').version[2] >= 2;
|
|
59076
|
+
}else if(window.Amis){
|
|
59077
|
+
isAmisVersionforBatchEdit = window.Amis.version[0] >= 3 && window.Amis.version[2] >= 2;
|
|
59078
|
+
}
|
|
59079
|
+
const quickEditId = options.objectName + "_" + field.name + "_quickEdit";//定义快速编辑的表单id,用于setvalue传值
|
|
58958
59080
|
var quickEditSchema = { body: [], id: quickEditId };
|
|
59081
|
+
//select,avatar,image,file等组件无法行记录字段赋值,暂不支持批量编辑;
|
|
59082
|
+
if(field.type != 'avatar' && field.type != 'image' && field.type != 'file' && isAmisVersionforBatchEdit){
|
|
59083
|
+
const submitEvent = {
|
|
59084
|
+
submit: {
|
|
59085
|
+
actions: [
|
|
59086
|
+
{
|
|
59087
|
+
actionType: "custom",
|
|
59088
|
+
script: `
|
|
59089
|
+
let items = _.cloneDeep(event.data.items);
|
|
59090
|
+
let selectedItems = _.cloneDeep(event.data.selectedItems);
|
|
59091
|
+
if(event.data.isBatchEdit){
|
|
59092
|
+
selectedItems.forEach(function(selectedItem){
|
|
59093
|
+
selectedItem._display.${field.name} = event.data._display.${field.name};
|
|
59094
|
+
doAction({actionType: 'setValue', "args": {"value": selectedItem._display},componentId: "_display_" + selectedItem._index});
|
|
59095
|
+
doAction({actionType: 'setValue', "args": {"value": event.data.${field.name}},componentId: "${options.objectName + "_" + field.name + "_"}" + selectedItem._index});
|
|
59096
|
+
})
|
|
59097
|
+
}else{
|
|
59098
|
+
doAction({actionType: 'setValue', "args": {"value": event.data._display},componentId: "_display_" + event.data._index});
|
|
59099
|
+
doAction({actionType: 'setValue', "args": {"value": event.data.${field.name}},componentId: "${options.objectName + "_" + field.name + "_"}" + event.data._index});
|
|
59100
|
+
}
|
|
59101
|
+
`
|
|
59102
|
+
},
|
|
59103
|
+
{
|
|
59104
|
+
"actionType": "closeDialog"
|
|
59105
|
+
}
|
|
59106
|
+
]
|
|
59107
|
+
}
|
|
59108
|
+
};
|
|
59109
|
+
quickEditSchema.onEvent = submitEvent;
|
|
59110
|
+
}
|
|
59111
|
+
|
|
58959
59112
|
if (field.disabled) {
|
|
58960
59113
|
quickEditSchema = false;
|
|
58961
59114
|
} else {
|
|
@@ -58972,7 +59125,7 @@ async function getQuickEditSchema(field, options){
|
|
|
58972
59125
|
{
|
|
58973
59126
|
"actionType": "custom",
|
|
58974
59127
|
"script": `
|
|
58975
|
-
var _display = event.data._display;
|
|
59128
|
+
var _display = _.cloneDeep(event.data._display);
|
|
58976
59129
|
${displayField}
|
|
58977
59130
|
doAction({actionType: 'setValue', "args": {"value": {_display}},componentId: "${quickEditId}"});
|
|
58978
59131
|
`
|
|
@@ -58994,7 +59147,7 @@ async function getQuickEditSchema(field, options){
|
|
|
58994
59147
|
第二种是增加选项时,按照value的值,找到对应选项,并按照_display的规则为其赋值
|
|
58995
59148
|
*/
|
|
58996
59149
|
TempDisplayField = `
|
|
58997
|
-
const preData = event.data.__super.${field.name};
|
|
59150
|
+
const preData = _.cloneDeep(event.data.__super.${field.name});
|
|
58998
59151
|
if(preData && event.data.${field.name}.length < preData.length){
|
|
58999
59152
|
let deletedIndex;
|
|
59000
59153
|
preData.forEach(function(item,index){
|
|
@@ -59038,7 +59191,7 @@ async function getQuickEditSchema(field, options){
|
|
|
59038
59191
|
break;
|
|
59039
59192
|
case "percent":
|
|
59040
59193
|
TempDisplayField = `
|
|
59041
|
-
_display["${field.name}"] =
|
|
59194
|
+
_display["${field.name}"] = event.data.value.toFixed(${field.scale}) + '%';
|
|
59042
59195
|
`;
|
|
59043
59196
|
quickEditSchema.body[0].onEvent["change"] = quickEditOnEvent(TempDisplayField);
|
|
59044
59197
|
break;
|
|
@@ -59189,6 +59342,131 @@ async function getQuickEditSchema(field, options){
|
|
|
59189
59342
|
}
|
|
59190
59343
|
|
|
59191
59344
|
});
|
|
59345
|
+
if(field.type != 'avatar' && field.type != 'image' && field.type != 'file' && isAmisVersionforBatchEdit){
|
|
59346
|
+
quickEditSchema.body.push({
|
|
59347
|
+
"name": "isBatchEdit",
|
|
59348
|
+
"type": "checkbox",
|
|
59349
|
+
"option": [
|
|
59350
|
+
{
|
|
59351
|
+
"type": "tpl",
|
|
59352
|
+
"tpl": "更新${COUNT(selectedItems)}个选定记录"
|
|
59353
|
+
},
|
|
59354
|
+
{
|
|
59355
|
+
"type": "spinner",
|
|
59356
|
+
"showOn": "${batchPermissionLoading}",
|
|
59357
|
+
"size": "sm",
|
|
59358
|
+
"className": "mr-4"
|
|
59359
|
+
}
|
|
59360
|
+
],
|
|
59361
|
+
"visibleOn": "${ARRAYSOME(selectedItems, item => item._id === _id) && COUNT(selectedItems)>1 && quickedit_record_permissions.allowEdit && quickedit_record_permissions_loading == false}",
|
|
59362
|
+
"disabledOn": "${batchPermissionLoading}",
|
|
59363
|
+
"onEvent":{
|
|
59364
|
+
"change":{
|
|
59365
|
+
"actions":[
|
|
59366
|
+
{
|
|
59367
|
+
"actionType": "setValue",
|
|
59368
|
+
"componentId": quickEditId,
|
|
59369
|
+
"args": {
|
|
59370
|
+
"value":{
|
|
59371
|
+
"batchPermissionLoading": true
|
|
59372
|
+
}
|
|
59373
|
+
},
|
|
59374
|
+
"expression":"${event.data.value}"
|
|
59375
|
+
},
|
|
59376
|
+
{
|
|
59377
|
+
"actionType": "ajax",
|
|
59378
|
+
"args": {
|
|
59379
|
+
"api": {
|
|
59380
|
+
"url": "${context.rootUrl}/graphql",
|
|
59381
|
+
"method": "post",
|
|
59382
|
+
"headers": {
|
|
59383
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
59384
|
+
},
|
|
59385
|
+
"data": {
|
|
59386
|
+
"query": "{rows:${objectName}(filters:[\"_id\",\"in\",${selectedItems | pick:_id | split | json}]){_id,_permissions{allowEdit}}}"
|
|
59387
|
+
},
|
|
59388
|
+
"adaptor": `
|
|
59389
|
+
const noPermission = [];
|
|
59390
|
+
payload.data.rows.forEach(function (row) {
|
|
59391
|
+
if(!row._permissions.allowEdit){
|
|
59392
|
+
noPermission.push(row._id);
|
|
59393
|
+
}
|
|
59394
|
+
})
|
|
59395
|
+
payload.data.noPermission = noPermission;
|
|
59396
|
+
return payload;
|
|
59397
|
+
`
|
|
59398
|
+
}
|
|
59399
|
+
},
|
|
59400
|
+
"expression":"${event.data.value}"
|
|
59401
|
+
},
|
|
59402
|
+
{
|
|
59403
|
+
"actionType": "setValue",
|
|
59404
|
+
"componentId": quickEditId,
|
|
59405
|
+
"args": {
|
|
59406
|
+
"value":{
|
|
59407
|
+
"batchPermissionLoading": false
|
|
59408
|
+
}
|
|
59409
|
+
},
|
|
59410
|
+
"expression":"${event.data.value}"
|
|
59411
|
+
},
|
|
59412
|
+
{
|
|
59413
|
+
"actionType": "dialog",
|
|
59414
|
+
"dialog":{
|
|
59415
|
+
"title": "记录权限",
|
|
59416
|
+
"showCloseButton": false,
|
|
59417
|
+
"body":[
|
|
59418
|
+
{
|
|
59419
|
+
"type": "tpl",
|
|
59420
|
+
"tpl": "当前选中记录中,有${COUNT(noPermission)}条记录无编辑权限,是否需要批量编辑其他记录?"
|
|
59421
|
+
}
|
|
59422
|
+
],
|
|
59423
|
+
"onEvent":{
|
|
59424
|
+
"confirm":{
|
|
59425
|
+
"actions":[
|
|
59426
|
+
{
|
|
59427
|
+
"actionType": "custom",
|
|
59428
|
+
"script": `
|
|
59429
|
+
const noPermission = event.data.noPermission;
|
|
59430
|
+
const crudComponent = event.context.scoped.getComponentById("${options.crudId}");
|
|
59431
|
+
const selectedItems = crudComponent && crudComponent.props.store.selectedItems.concat();
|
|
59432
|
+
noPermission.forEach(function (item) {
|
|
59433
|
+
crudComponent && crudComponent.unSelectItem(_.find(selectedItems,{_id:item}));
|
|
59434
|
+
})
|
|
59435
|
+
`
|
|
59436
|
+
},
|
|
59437
|
+
{
|
|
59438
|
+
"actionType": "setValue",
|
|
59439
|
+
"componentId": quickEditId,
|
|
59440
|
+
"args": {
|
|
59441
|
+
"value":{
|
|
59442
|
+
"isBatchEdit": true
|
|
59443
|
+
}
|
|
59444
|
+
},
|
|
59445
|
+
}
|
|
59446
|
+
]
|
|
59447
|
+
},
|
|
59448
|
+
"cancel":{
|
|
59449
|
+
"actions":[
|
|
59450
|
+
{
|
|
59451
|
+
"actionType": "setValue",
|
|
59452
|
+
"componentId": quickEditId,
|
|
59453
|
+
"args": {
|
|
59454
|
+
"value":{
|
|
59455
|
+
"isBatchEdit": false
|
|
59456
|
+
}
|
|
59457
|
+
},
|
|
59458
|
+
}
|
|
59459
|
+
]
|
|
59460
|
+
}
|
|
59461
|
+
}
|
|
59462
|
+
},
|
|
59463
|
+
"expression":"${COUNT(event.data.noPermission)>0}"
|
|
59464
|
+
}
|
|
59465
|
+
]
|
|
59466
|
+
}
|
|
59467
|
+
}
|
|
59468
|
+
});
|
|
59469
|
+
}
|
|
59192
59470
|
} else {
|
|
59193
59471
|
quickEditSchema = false;
|
|
59194
59472
|
}
|
|
@@ -59223,6 +59501,8 @@ async function getTableColumns(fields, options){
|
|
|
59223
59501
|
const columns = [];
|
|
59224
59502
|
if(!options.isLookup){
|
|
59225
59503
|
columns.push({name: '_index',type: 'text', width: 32, placeholder: ""});
|
|
59504
|
+
//将_display放入crud的columns中,可以通过setvalue修改行内数据域的_display,而不影响上层items的_display,用于批量编辑
|
|
59505
|
+
columns.push({name: '_display',type: 'static', width: 32, placeholder: "",id: "_display_${_index}", className: "hidden"});
|
|
59226
59506
|
}
|
|
59227
59507
|
const allowEdit = options.permissions?.allowEdit && !options.isLookup && options.enable_inline_edit != false;
|
|
59228
59508
|
|
|
@@ -59254,7 +59534,7 @@ async function getTableColumns(fields, options){
|
|
|
59254
59534
|
{
|
|
59255
59535
|
"args": {
|
|
59256
59536
|
"api": {
|
|
59257
|
-
"url": "${context.rootUrl
|
|
59537
|
+
"url": "${(versions[0] && versions[0].url) ? versions[0].url+'?download=true' : context.rootUrl+'/api/files/files/'+versions[0]+'?download=true'}",
|
|
59258
59538
|
"method": "get",
|
|
59259
59539
|
"headers": {
|
|
59260
59540
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
@@ -59301,7 +59581,7 @@ async function getTableColumns(fields, options){
|
|
|
59301
59581
|
else if(field.type === 'select'){
|
|
59302
59582
|
const map = getSelectMap(field.options);
|
|
59303
59583
|
columnItem = Object.assign({}, {
|
|
59304
|
-
type: "mapping",
|
|
59584
|
+
type: "static-mapping",
|
|
59305
59585
|
name: field.name,
|
|
59306
59586
|
label: field.label,
|
|
59307
59587
|
map: map,
|
|
@@ -59316,7 +59596,7 @@ async function getTableColumns(fields, options){
|
|
|
59316
59596
|
const tpl = await getFieldTpl(field, options);
|
|
59317
59597
|
let type = 'text';
|
|
59318
59598
|
if(tpl){
|
|
59319
|
-
type = '
|
|
59599
|
+
type = 'static';
|
|
59320
59600
|
}else if(field.type === 'html'){
|
|
59321
59601
|
type = 'markdown';
|
|
59322
59602
|
}else if(field.type === 'url'){
|
|
@@ -59357,6 +59637,7 @@ async function getTableColumns(fields, options){
|
|
|
59357
59637
|
columnItem.quickEdit = quickEditSchema;
|
|
59358
59638
|
columnItem.quickEditEnabledOn = "${is_system !== true}";
|
|
59359
59639
|
}
|
|
59640
|
+
columnItem.id = `${options.objectName}_${field.name}_\${_index}`;
|
|
59360
59641
|
columns.push(columnItem);
|
|
59361
59642
|
}
|
|
59362
59643
|
}
|
|
@@ -59635,7 +59916,7 @@ async function getTableOperation(ctx){
|
|
|
59635
59916
|
}
|
|
59636
59917
|
return {
|
|
59637
59918
|
type: 'operation',
|
|
59638
|
-
label:
|
|
59919
|
+
label: "",
|
|
59639
59920
|
fixed: 'right',
|
|
59640
59921
|
labelClassName: 'text-center',
|
|
59641
59922
|
className: 'text-center steedos-listview-operation w-10',
|
|
@@ -59669,23 +59950,87 @@ async function getTableOperation(ctx){
|
|
|
59669
59950
|
}
|
|
59670
59951
|
}
|
|
59671
59952
|
|
|
59953
|
+
async function getDefaultCrudCard(columns, options) {
|
|
59954
|
+
let labelFieldName = options?.labelFieldName || "name";
|
|
59955
|
+
let titleColumn, bodyColumns = [];
|
|
59956
|
+
columns.forEach(function (item) {
|
|
59957
|
+
delete item.quickEdit;
|
|
59958
|
+
delete item.width;
|
|
59959
|
+
if (item.name === labelFieldName) {
|
|
59960
|
+
titleColumn = item;
|
|
59961
|
+
}
|
|
59962
|
+
else {
|
|
59963
|
+
if (item.name !== "_index") {
|
|
59964
|
+
bodyColumns.push(item);
|
|
59965
|
+
}
|
|
59966
|
+
}
|
|
59967
|
+
});
|
|
59968
|
+
let card = {
|
|
59969
|
+
"header": {
|
|
59970
|
+
"title": titleColumn.tpl
|
|
59971
|
+
},
|
|
59972
|
+
body: bodyColumns,
|
|
59973
|
+
// useCardLabel: false,
|
|
59974
|
+
toolbar: []
|
|
59975
|
+
};
|
|
59976
|
+
let hideToolbarOperation = options.formFactor === 'SMALL' || ["split"].indexOf(options.displayAs) > -1;
|
|
59977
|
+
if(!hideToolbarOperation){
|
|
59978
|
+
let toolbarOperation = await getTableOperation(options);
|
|
59979
|
+
if (toolbarOperation) {
|
|
59980
|
+
toolbarOperation.className += " inline-block w-auto";
|
|
59981
|
+
}
|
|
59982
|
+
card.toolbar.push(toolbarOperation);
|
|
59983
|
+
}
|
|
59984
|
+
return card;
|
|
59985
|
+
}
|
|
59986
|
+
|
|
59672
59987
|
async function getTableSchema$1(fields, options){
|
|
59673
59988
|
if(!options){
|
|
59674
59989
|
options = {};
|
|
59675
59990
|
}
|
|
59676
59991
|
let { isLookup, hiddenColumnOperation } = options;
|
|
59992
|
+
const defaults = options.defaults;
|
|
59993
|
+
const listSchema = (defaults && defaults.listSchema) || {};
|
|
59994
|
+
|
|
59677
59995
|
let columns = [];
|
|
59678
59996
|
let useMobileColumns = options.formFactor === 'SMALL' || ["split"].indexOf(options.displayAs) > -1;
|
|
59679
59997
|
if(isLookup){
|
|
59680
59998
|
// 在lookup手机端列表模式调式好之前不使用getMobileTableColumns
|
|
59681
59999
|
useMobileColumns = false;
|
|
59682
60000
|
}
|
|
60001
|
+
if(listSchema.mode && listSchema.mode !== "table"){
|
|
60002
|
+
// 如果指定的mode,则不走我们内置的手机端列表效果,使用steedos组件内部开发的默认card/list效果,或者由用户自己实现card/list模式的crud列表
|
|
60003
|
+
useMobileColumns = false;
|
|
60004
|
+
}
|
|
59683
60005
|
if(useMobileColumns){
|
|
59684
60006
|
columns = await getMobileTableColumns(fields, options);
|
|
59685
60007
|
}
|
|
59686
60008
|
else {
|
|
59687
60009
|
columns = await getTableColumns(fields, options);
|
|
59688
60010
|
|
|
60011
|
+
if(listSchema.mode === "cards"){
|
|
60012
|
+
let card = listSchema.card;
|
|
60013
|
+
if(!card){
|
|
60014
|
+
card = await getDefaultCrudCard(columns, options);
|
|
60015
|
+
}
|
|
60016
|
+
return {
|
|
60017
|
+
mode: "cards",
|
|
60018
|
+
perPageAvailable: [5, 10, 20, 50, 100, 500],
|
|
60019
|
+
name: "thelist",
|
|
60020
|
+
headerToolbarClassName: "py-2 px-2 border-gray-300 border-solid border-b",
|
|
60021
|
+
className: "",
|
|
60022
|
+
draggable: false,
|
|
60023
|
+
defaultParams: getDefaultParams(options),
|
|
60024
|
+
card: card,
|
|
60025
|
+
syncLocation: false,
|
|
60026
|
+
keepItemSelectionOnPageChange: true,
|
|
60027
|
+
checkOnItemClick: isLookup ? true : false,
|
|
60028
|
+
labelTpl: `\${${options.labelFieldName}}`,
|
|
60029
|
+
autoFillHeight: false, // 自动高度效果不理想,先关闭
|
|
60030
|
+
columnsTogglable: false
|
|
60031
|
+
}
|
|
60032
|
+
}
|
|
60033
|
+
|
|
59689
60034
|
if(!isLookup && !hiddenColumnOperation){
|
|
59690
60035
|
columns.push(await getTableOperation(options));
|
|
59691
60036
|
}
|
|
@@ -59693,6 +60038,7 @@ async function getTableSchema$1(fields, options){
|
|
|
59693
60038
|
|
|
59694
60039
|
return {
|
|
59695
60040
|
mode: "table",
|
|
60041
|
+
perPageAvailable: [5, 10, 20, 50, 100, 500],
|
|
59696
60042
|
name: "thelist",
|
|
59697
60043
|
headerToolbarClassName: "py-2 px-2 border-gray-300 border-solid border-b",
|
|
59698
60044
|
className: "",
|
|
@@ -59780,8 +60126,8 @@ function isObject(obj) {
|
|
|
59780
60126
|
/*
|
|
59781
60127
|
* @Author: baozhoutao@steedos.com
|
|
59782
60128
|
* @Date: 2022-07-05 15:55:39
|
|
59783
|
-
* @LastEditors:
|
|
59784
|
-
* @LastEditTime: 2023-
|
|
60129
|
+
* @LastEditors: liaodaxue
|
|
60130
|
+
* @LastEditTime: 2023-10-20 11:38:25
|
|
59785
60131
|
* @Description:
|
|
59786
60132
|
*/
|
|
59787
60133
|
|
|
@@ -60078,8 +60424,8 @@ async function getListSchema(
|
|
|
60078
60424
|
"filtersFunction": listview_filters,
|
|
60079
60425
|
"sort": sort,
|
|
60080
60426
|
"ctx": ctx,
|
|
60081
|
-
"requestAdaptor": listView.requestAdaptor,
|
|
60082
|
-
"adaptor": listView.adaptor,
|
|
60427
|
+
"requestAdaptor": listView.requestAdaptor || ctx.requestAdaptor,
|
|
60428
|
+
"adaptor": listView.adaptor || ctx.adaptor,
|
|
60083
60429
|
"headerToolbarItems": ctx.headerToolbarItems,
|
|
60084
60430
|
"filterVisible": ctx.filterVisible,
|
|
60085
60431
|
"rowClassNameExpr": ctx.rowClassNameExpr,
|
|
@@ -65213,7 +65559,13 @@ var PLACEHOLDER_ID = 'placeholder';
|
|
|
65213
65559
|
var empty = [];
|
|
65214
65560
|
function MultipleContainers(props) {
|
|
65215
65561
|
var _this = this;
|
|
65216
|
-
var _a = props.adjustScale, adjustScale = _a === void 0 ? false : _a; props.itemCount; var cancelDrop = props.cancelDrop, _c = props.columns, columns = _c === void 0 ? 1 : _c, _d = props.handle, handle = _d === void 0 ? true : _d, containerStyle = props.containerStyle, _e = props.coordinateGetter, coordinateGetter$1 = _e === void 0 ? coordinateGetter : _e, _f = props.getItemStyles, getItemStyles = _f === void 0 ? function () { return ({}); } : _f, _g = props.wrapperStyle, wrapperStyle = _g === void 0 ? function () { return ({}); } : _g, _h = props.minimal, minimal = _h === void 0 ? false : _h, modifiers = props.modifiers, renderItem = props.renderItem,
|
|
65562
|
+
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,
|
|
65563
|
+
// strategy = verticalListSortingStrategy,
|
|
65564
|
+
_j = props.strategy,
|
|
65565
|
+
// strategy = verticalListSortingStrategy,
|
|
65566
|
+
strategy = _j === void 0 ? rectSortingStrategy : _j, //这里默认值不用rectSortingStrategy的话,会出现字段在左右两边拖动变更顺序时拖动过程中dragOverlay丢失问题
|
|
65567
|
+
_k = props.addable, //这里默认值不用rectSortingStrategy的话,会出现字段在左右两边拖动变更顺序时拖动过程中dragOverlay丢失问题
|
|
65568
|
+
addable = _k === void 0 ? false : _k, _l = props.trashable, trashable = _l === void 0 ? false : _l, _m = props.vertical, vertical = _m === void 0 ? false : _m, scrollable = props.scrollable, _o = props.boardSource, boardSource = _o === void 0 ? [] : _o, _p = props.cardSource, cardSource = _p === void 0 ? [] : _p, value = props.value, amisOnChange = props.onChange, amisData = props.data, amisDispatchEvent = props.dispatchEvent, amisRender = props.render, _q = props.cardSchema, cardSchema = _q === void 0 ? [{
|
|
65217
65569
|
"type": "tpl",
|
|
65218
65570
|
"tpl": "${label}",
|
|
65219
65571
|
"inline": false,
|
|
@@ -65221,24 +65573,28 @@ function MultipleContainers(props) {
|
|
|
65221
65573
|
"type": "tpl",
|
|
65222
65574
|
"tpl": "${label}",
|
|
65223
65575
|
}] : _r, _s = props.boardFooter, boardFooter = _s === void 0 ? [] : _s, _t = props.wrapperClassName, wrapperClassName = _t === void 0 ? "gap-2" : _t, _u = props.boardClassName, boardClassName = _u === void 0 ? "border rounded" : _u, _v = props.cardClassName, cardClassName = _v === void 0 ? "" : _v;
|
|
65224
|
-
|
|
65576
|
+
value && delete (value.$$id);
|
|
65225
65577
|
var _w = __read(react.exports.useState(function () {
|
|
65226
65578
|
var _a;
|
|
65227
|
-
return (_a =
|
|
65579
|
+
return (_a = value) !== null && _a !== void 0 ? _a : {
|
|
65228
65580
|
A: ['A1', 'A2'],
|
|
65229
65581
|
B: ['B1', 'B2'],
|
|
65230
65582
|
C: ['C1', 'C2'],
|
|
65231
65583
|
};
|
|
65232
65584
|
}), 2), items = _w[0], setItems = _w[1];
|
|
65233
65585
|
var _x = __read(react.exports.useState(Object.keys(items)), 2), containers = _x[0], setContainers = _x[1];
|
|
65234
|
-
|
|
65586
|
+
react.exports.useEffect(function () {
|
|
65587
|
+
setItems(value);
|
|
65588
|
+
setContainers(Object.keys(value));
|
|
65589
|
+
}, [value]);
|
|
65590
|
+
var handleChange = function (newItems) { return __awaiter(_this, void 0, void 0, function () {
|
|
65235
65591
|
var value, rendererEvent;
|
|
65236
65592
|
return __generator(this, function (_a) {
|
|
65237
65593
|
switch (_a.label) {
|
|
65238
65594
|
case 0:
|
|
65239
65595
|
if (!amisDispatchEvent || !amisOnChange)
|
|
65240
65596
|
return [2 /*return*/];
|
|
65241
|
-
value = items;
|
|
65597
|
+
value = newItems || items;
|
|
65242
65598
|
return [4 /*yield*/, amisDispatchEvent('change', createObject(amisData, {
|
|
65243
65599
|
value: value
|
|
65244
65600
|
}))];
|
|
@@ -65247,7 +65603,7 @@ function MultipleContainers(props) {
|
|
|
65247
65603
|
if (rendererEvent === null || rendererEvent === void 0 ? void 0 : rendererEvent.prevented) {
|
|
65248
65604
|
return [2 /*return*/];
|
|
65249
65605
|
}
|
|
65250
|
-
setTimeout(function () { return amisOnChange(value); },
|
|
65606
|
+
setTimeout(function () { return amisOnChange(value); }, 500);
|
|
65251
65607
|
return [2 /*return*/];
|
|
65252
65608
|
}
|
|
65253
65609
|
});
|
|
@@ -65350,6 +65706,7 @@ function MultipleContainers(props) {
|
|
|
65350
65706
|
var active = _a.active, over = _a.over;
|
|
65351
65707
|
var overId = over === null || over === void 0 ? void 0 : over.id;
|
|
65352
65708
|
if (overId == null || overId === TRASH_ID || active.id in items) {
|
|
65709
|
+
// 拖动的是分组则跳过后面的逻辑
|
|
65353
65710
|
return;
|
|
65354
65711
|
}
|
|
65355
65712
|
var overContainer = findContainer(overId);
|
|
@@ -65425,19 +65782,44 @@ function MultipleContainers(props) {
|
|
|
65425
65782
|
return;
|
|
65426
65783
|
}
|
|
65427
65784
|
var overContainer = findContainer(overId);
|
|
65785
|
+
var newItems = items;
|
|
65428
65786
|
if (overContainer) {
|
|
65429
|
-
|
|
65430
|
-
|
|
65431
|
-
|
|
65432
|
-
|
|
65433
|
-
|
|
65434
|
-
|
|
65435
|
-
|
|
65787
|
+
if (activeContainer !== overContainer) {
|
|
65788
|
+
// 拖动变更分组之间的顺序时,activeContainer 与 overContainer 值不相等
|
|
65789
|
+
setTimeout(function () {
|
|
65790
|
+
var sortedGroups = over.data.current.sortable.items; //不加setTimeout的话,这里拿到的会是变更前的数据
|
|
65791
|
+
newItems = {};
|
|
65792
|
+
sortedGroups.forEach(function (groupKey) {
|
|
65793
|
+
newItems[groupKey] = items[groupKey];
|
|
65794
|
+
});
|
|
65795
|
+
delete newItems[TRASH_ID];
|
|
65796
|
+
delete newItems[PLACEHOLDER_ID];
|
|
65797
|
+
if (lodash.exports.keys(items).join(",") !== lodash.exports.keys(newItems).join(",")) {
|
|
65798
|
+
// 只有顺序发生变化时才触发change事件
|
|
65799
|
+
setItems(newItems);
|
|
65800
|
+
// console.log('拖动结束2,更新form value')
|
|
65801
|
+
handleChange(newItems);
|
|
65802
|
+
}
|
|
65803
|
+
setActiveId(null);
|
|
65804
|
+
}, 500);
|
|
65805
|
+
return;
|
|
65806
|
+
}
|
|
65807
|
+
else {
|
|
65808
|
+
// 同一个分组中字段顺序变更以及把一个字段从某个分组拖动到另一个分组内时,activeContainer 与 overContainer 值相等
|
|
65809
|
+
var activeIndex_1 = items[activeContainer].indexOf(active.id);
|
|
65810
|
+
var overIndex_1 = items[overContainer].indexOf(overId);
|
|
65811
|
+
if (activeIndex_1 !== overIndex_1) {
|
|
65812
|
+
setItems(function (items) {
|
|
65813
|
+
var _a;
|
|
65814
|
+
newItems = __assign$1(__assign$1({}, items), (_a = {}, _a[overContainer] = arrayMove(items[overContainer], activeIndex_1, overIndex_1), _a));
|
|
65815
|
+
return newItems;
|
|
65816
|
+
});
|
|
65817
|
+
}
|
|
65436
65818
|
}
|
|
65437
65819
|
}
|
|
65438
65820
|
setActiveId(null);
|
|
65439
65821
|
// console.log('拖动结束2,更新form value')
|
|
65440
|
-
handleChange();
|
|
65822
|
+
handleChange(newItems);
|
|
65441
65823
|
}, cancelDrop: cancelDrop, onDragCancel: onDragCancel, modifiers: modifiers },
|
|
65442
65824
|
React.createElement("div", { style: {
|
|
65443
65825
|
display: 'inline-grid',
|