@steedos-widgets/amis-lib 1.2.6 → 1.2.8
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/cjs/tsconfig.tsbuildinfo +1 -1
- package/dist/index.cjs.js +259 -32
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +260 -33
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +259 -32
- package/dist/index.umd.js.map +1 -1
- package/dist/types/lib/converter/amis/fields_filter.d.ts +3 -0
- package/dist/types/lib/converter/amis/header.d.ts +3 -0
- package/dist/types/lib/converter/amis/toolbar.d.ts +3 -0
- package/dist/types/lib/converter/amis/util.d.ts +1 -0
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _$1 from 'lodash';
|
|
2
|
-
import ___default, { isEmpty, isArray, each, find, endsWith, cloneDeep, includes, get, map, toArray, mergeWith, isBoolean, omitBy, isNil, isString, union, has, slice, defaultsDeep as defaultsDeep$1, isObject as isObject$1, filter, startsWith } from 'lodash';
|
|
2
|
+
import ___default, { isEmpty, isArray, each, find, endsWith, cloneDeep, includes, get, map, toArray, mergeWith, forEach, isBoolean, omitBy, isNil, isString, union, has, slice, defaultsDeep as defaultsDeep$1, isObject as isObject$1, filter, startsWith } from 'lodash';
|
|
3
3
|
import { Router as Router$1, getSteedosAuth as getSteedosAuth$1, lookupToAmis as lookupToAmis$1, fetchAPI as fetchAPI$1 } from '@steedos-widgets/amis-lib';
|
|
4
4
|
import isPlainObject from 'lodash/isPlainObject';
|
|
5
5
|
|
|
@@ -2596,7 +2596,7 @@ async function getObjectFieldsFilterFormSchema(ctx) {
|
|
|
2596
2596
|
return Promise.all(filterFormSearchableFields.map(function (item) {
|
|
2597
2597
|
const field = _.clone(fields[item]);
|
|
2598
2598
|
if (
|
|
2599
|
-
!_.includes(
|
|
2599
|
+
field && !_.includes(
|
|
2600
2600
|
[
|
|
2601
2601
|
"grid",
|
|
2602
2602
|
"avatar",
|
|
@@ -2643,7 +2643,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
2643
2643
|
var filterForm = scope.parent.parent.getComponents().find(function(n){
|
|
2644
2644
|
return n.props.type === "form";
|
|
2645
2645
|
});
|
|
2646
|
-
filterForm.handleFormSubmit(event)
|
|
2646
|
+
filterForm.handleFormSubmit(event);
|
|
2647
2647
|
// var filterFormValues = filterForm.getValues();
|
|
2648
2648
|
// var listView = scope.parent.parent.parent.getComponents().find(function(n){
|
|
2649
2649
|
// return n.props.type === "crud";
|
|
@@ -2657,8 +2657,30 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
2657
2657
|
// }
|
|
2658
2658
|
// }
|
|
2659
2659
|
// listView.handleFilterSubmit(Object.assign({}, removedValues, filterFormValues));
|
|
2660
|
+
|
|
2661
|
+
let isMobile = Steedos.isMobile();
|
|
2662
|
+
if(isMobile){
|
|
2663
|
+
// 手机端点击搜索的时候自动收起搜索栏
|
|
2664
|
+
let resizeWindow = function(){
|
|
2665
|
+
//触发amis crud 高度重算
|
|
2666
|
+
setTimeout(()=>{
|
|
2667
|
+
window.dispatchEvent(new Event("resize"))
|
|
2668
|
+
}, 500);
|
|
2669
|
+
}
|
|
2670
|
+
const filterService = filterForm.context.getComponents().find(function(n){
|
|
2671
|
+
return n.props.type === "service";
|
|
2672
|
+
});
|
|
2673
|
+
filterService.setData({showFieldsFilter: false});
|
|
2674
|
+
resizeWindow();
|
|
2675
|
+
// 使用filterForm.getValues()的话,并不能拿到本地存储中的过滤条件,所以需要从event.data中取。
|
|
2676
|
+
let filterFormValues = event.data;
|
|
2677
|
+
let isFieldsFilterEmpty = SteedosUI.isFilterFormValuesEmpty(filterFormValues);
|
|
2678
|
+
let crud = SteedosUI.getClosestAmisComponentByType(scope, "crud");
|
|
2679
|
+
let crudService = crud && SteedosUI.getClosestAmisComponentByType(crud.context, "service");
|
|
2680
|
+
crudService && crudService.setData({isFieldsFilterEmpty, showFieldsFilter: false});
|
|
2681
|
+
}
|
|
2660
2682
|
`;
|
|
2661
|
-
const
|
|
2683
|
+
const onCancelScript = `
|
|
2662
2684
|
const scope = event.context.scoped;
|
|
2663
2685
|
var filterForm = scope.parent.parent.getComponents().find(function(n){
|
|
2664
2686
|
return n.props.type === "form";
|
|
@@ -2686,7 +2708,21 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
2686
2708
|
}
|
|
2687
2709
|
}
|
|
2688
2710
|
listView.handleFilterSubmit(removedValues);
|
|
2689
|
-
|
|
2711
|
+
const filterService = filterForm.context.getComponents().find(function(n){
|
|
2712
|
+
return n.props.type === "service";
|
|
2713
|
+
});
|
|
2714
|
+
filterService.setData({showFieldsFilter: !!!filterService.props.data.showFieldsFilter});
|
|
2715
|
+
//触发amis crud 高度重算
|
|
2716
|
+
setTimeout(()=>{
|
|
2717
|
+
window.dispatchEvent(new Event("resize"))
|
|
2718
|
+
}, 100);
|
|
2719
|
+
let isMobile = Steedos.isMobile();
|
|
2720
|
+
if(isMobile){
|
|
2721
|
+
// 手机端移除搜索按钮上的红点
|
|
2722
|
+
let crudService = scope.getComponentById("service_listview_" + event.data.objectName);
|
|
2723
|
+
crudService && crudService.setData({isFieldsFilterEmpty: true, showFieldsFilter: false});
|
|
2724
|
+
}
|
|
2725
|
+
`;
|
|
2690
2726
|
const dataProviderInited = `
|
|
2691
2727
|
const objectName = data.objectName;
|
|
2692
2728
|
const isLookup = data.isLookup;
|
|
@@ -2740,7 +2776,15 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
2740
2776
|
});
|
|
2741
2777
|
// 有过滤条件时自动展开搜索栏
|
|
2742
2778
|
if(!_.isEmpty(omitedEmptyFormValue)){
|
|
2743
|
-
|
|
2779
|
+
let isMobile = Steedos.isMobile();
|
|
2780
|
+
if(isMobile){
|
|
2781
|
+
// 手机端不展开,只显示搜索按钮上的红点
|
|
2782
|
+
let crudService = SteedosUI.getRef(data.$scopeId).getComponentById("service_listview_" + data.objectName)
|
|
2783
|
+
crudService && crudService.setData({isFieldsFilterEmpty: false});
|
|
2784
|
+
}
|
|
2785
|
+
else{
|
|
2786
|
+
setData({ showFieldsFilter: true });
|
|
2787
|
+
}
|
|
2744
2788
|
}
|
|
2745
2789
|
}
|
|
2746
2790
|
}
|
|
@@ -2882,14 +2926,15 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
2882
2926
|
},
|
|
2883
2927
|
{
|
|
2884
2928
|
"type": "button",
|
|
2885
|
-
"label": "
|
|
2929
|
+
"label": "取消",
|
|
2930
|
+
"name": "btn_filter_form_cancel",
|
|
2886
2931
|
"visibleOn": "this.filterFormSearchableFields && this.filterFormSearchableFields.length",
|
|
2887
2932
|
"onEvent": {
|
|
2888
2933
|
"click": {
|
|
2889
2934
|
"actions": [
|
|
2890
2935
|
{
|
|
2891
2936
|
"actionType": "custom",
|
|
2892
|
-
"script":
|
|
2937
|
+
"script": onCancelScript
|
|
2893
2938
|
}
|
|
2894
2939
|
]
|
|
2895
2940
|
}
|
|
@@ -3493,11 +3538,36 @@ const filterForm = scope.getComponents().find(function(n){
|
|
|
3493
3538
|
const filterService = filterForm.context.getComponents().find(function(n){
|
|
3494
3539
|
return n.props.type === "service";
|
|
3495
3540
|
});
|
|
3496
|
-
filterService.setData({showFieldsFilter: !!!filterService.props.data.showFieldsFilter});
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
3541
|
+
// filterService.setData({showFieldsFilter: !!!filterService.props.data.showFieldsFilter});
|
|
3542
|
+
let resizeWindow = function(){
|
|
3543
|
+
//触发amis crud 高度重算
|
|
3544
|
+
setTimeout(()=>{
|
|
3545
|
+
window.dispatchEvent(new Event("resize"))
|
|
3546
|
+
}, 500);
|
|
3547
|
+
}
|
|
3548
|
+
let isMobile = Steedos.isMobile();
|
|
3549
|
+
if(filterService.props.data.showFieldsFilter){
|
|
3550
|
+
if(isMobile){
|
|
3551
|
+
// 手机上只能通过取消按钮来关闭搜索栏
|
|
3552
|
+
return;
|
|
3553
|
+
}
|
|
3554
|
+
let buttonCancel = SteedosUI.getClosestAmisComponentByType(filterForm.context, "button", {
|
|
3555
|
+
direction: "down",
|
|
3556
|
+
name: "btn_filter_form_cancel"
|
|
3557
|
+
});
|
|
3558
|
+
buttonCancel.props.dispatchEvent('click', {}).then(function(){
|
|
3559
|
+
resizeWindow();
|
|
3560
|
+
});
|
|
3561
|
+
}
|
|
3562
|
+
else{
|
|
3563
|
+
filterService.setData({showFieldsFilter: true});
|
|
3564
|
+
resizeWindow();
|
|
3565
|
+
if(isMobile){
|
|
3566
|
+
// 手机端在显示搜索栏时隐藏刷新按钮
|
|
3567
|
+
let crudService = scope.getComponentById("service_listview_" + event.data.objectName);
|
|
3568
|
+
crudService && crudService.setData({showFieldsFilter: true});
|
|
3569
|
+
}
|
|
3570
|
+
}
|
|
3501
3571
|
`;
|
|
3502
3572
|
|
|
3503
3573
|
function getExportApiRequestAdaptorScript(){
|
|
@@ -3582,6 +3652,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
|
|
|
3582
3652
|
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
3583
3653
|
"label": "",
|
|
3584
3654
|
"icon": "fa fa-sync",
|
|
3655
|
+
"visibleOn": "${!showFieldsFilter}",
|
|
3585
3656
|
"onEvent": {
|
|
3586
3657
|
"click": {
|
|
3587
3658
|
"actions": [
|
|
@@ -3597,6 +3668,15 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
|
|
|
3597
3668
|
"label": "",
|
|
3598
3669
|
"icon": "fa fa-search",
|
|
3599
3670
|
"type": "button",
|
|
3671
|
+
"badge": {
|
|
3672
|
+
"offsetx": [
|
|
3673
|
+
-2,
|
|
3674
|
+
2
|
|
3675
|
+
],
|
|
3676
|
+
"size":8,
|
|
3677
|
+
"animation": true,
|
|
3678
|
+
"visibleOn": "${isFieldsFilterEmpty == false}"
|
|
3679
|
+
},
|
|
3600
3680
|
"align": "right",
|
|
3601
3681
|
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
3602
3682
|
"onEvent": {
|
|
@@ -4236,8 +4316,8 @@ function getObjectFooterToolbar(mainObject, formFactor) {
|
|
|
4236
4316
|
}
|
|
4237
4317
|
else {
|
|
4238
4318
|
return [
|
|
4319
|
+
"switch-per-page",
|
|
4239
4320
|
"statistics",
|
|
4240
|
-
// "switch-per-page",
|
|
4241
4321
|
"pagination"
|
|
4242
4322
|
]
|
|
4243
4323
|
}
|
|
@@ -5429,6 +5509,23 @@ const getAmisFileSchema = (steedosField, readonly)=>{
|
|
|
5429
5509
|
return readonly ? getAmisFileReadonlySchema(steedosField) : getAmisFileEditSchema(steedosField);
|
|
5430
5510
|
};
|
|
5431
5511
|
|
|
5512
|
+
/*
|
|
5513
|
+
* @Author: baozhoutao@steedos.com
|
|
5514
|
+
* @Date: 2022-07-20 16:29:22
|
|
5515
|
+
* @LastEditors: Please set LastEditors
|
|
5516
|
+
* @LastEditTime: 2023-05-11 11:19:54
|
|
5517
|
+
* @Description:
|
|
5518
|
+
*/
|
|
5519
|
+
|
|
5520
|
+
function getContrastColor(bgColor) {
|
|
5521
|
+
var backgroundColor = (bgColor.charAt(0) === '#') ? bgColor.substring(1, 7) : bgColor;
|
|
5522
|
+
var r = parseInt(backgroundColor.substr(0, 2), 16);
|
|
5523
|
+
var g = parseInt(backgroundColor.substr(2, 2), 16);
|
|
5524
|
+
var b = parseInt(backgroundColor.substr(4, 2), 16);
|
|
5525
|
+
var brightness = (r * 299 + g * 587 + b * 114) / 1000;
|
|
5526
|
+
return brightness >= 128 ? "#000000" : "#ffffff";
|
|
5527
|
+
}
|
|
5528
|
+
|
|
5432
5529
|
const OMIT_FIELDS = ['created', 'created_by', 'modified', 'modified_by'];
|
|
5433
5530
|
// const Lookup = require('./lookup');
|
|
5434
5531
|
|
|
@@ -5582,6 +5679,8 @@ function getSelectFieldOptions(field){
|
|
|
5582
5679
|
}
|
|
5583
5680
|
|
|
5584
5681
|
async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
5682
|
+
// console.log('convertSFieldToAmisField====>', field, readonly, ctx)
|
|
5683
|
+
const isMobile = window.innerWidth <= 768;
|
|
5585
5684
|
// 创建人和修改人、创建时间和修改时间不显示
|
|
5586
5685
|
if(_$1.includes(OMIT_FIELDS, field.name) && ctx.showSystemFields != true){
|
|
5587
5686
|
return;
|
|
@@ -5616,20 +5715,42 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
5616
5715
|
// }
|
|
5617
5716
|
// break;
|
|
5618
5717
|
case 'select':
|
|
5619
|
-
|
|
5620
|
-
|
|
5621
|
-
|
|
5622
|
-
|
|
5623
|
-
|
|
5624
|
-
|
|
5625
|
-
|
|
5626
|
-
|
|
5627
|
-
|
|
5628
|
-
|
|
5629
|
-
|
|
5630
|
-
|
|
5631
|
-
|
|
5718
|
+
if(readonly){
|
|
5719
|
+
const selectOptions = field.options;
|
|
5720
|
+
let map = {};
|
|
5721
|
+
_$1.forEach(selectOptions,(option)=>{
|
|
5722
|
+
const optionValue = option.value + '';
|
|
5723
|
+
if(option.color){
|
|
5724
|
+
const background = '#'+option.color;
|
|
5725
|
+
const color = getContrastColor(background);
|
|
5726
|
+
const optionColorStyle = 'background:'+background+';color:'+color;
|
|
5727
|
+
map[optionValue] = `<span class="rounded-xl px-2 py-1" style='${optionColorStyle}'>${option.label}</span>`;
|
|
5728
|
+
}else {
|
|
5729
|
+
map[optionValue] = option.label;
|
|
5730
|
+
}
|
|
5731
|
+
});
|
|
5732
|
+
convertData = {
|
|
5733
|
+
type: "static-mapping",
|
|
5734
|
+
name: field.name,
|
|
5735
|
+
label: field.label,
|
|
5736
|
+
map: map
|
|
5737
|
+
};
|
|
5738
|
+
}else {
|
|
5739
|
+
convertData = {
|
|
5740
|
+
type: getAmisStaticFieldType('select', readonly),
|
|
5741
|
+
joinValues: false,
|
|
5742
|
+
options: getSelectFieldOptions(field),
|
|
5743
|
+
extractValue: true,
|
|
5744
|
+
clearable: true,
|
|
5745
|
+
labelField: 'label',
|
|
5746
|
+
valueField: 'value'
|
|
5747
|
+
};
|
|
5748
|
+
if(field.multiple){
|
|
5749
|
+
convertData.multiple = true;
|
|
5750
|
+
convertData.extractValue = true;
|
|
5751
|
+
}
|
|
5632
5752
|
}
|
|
5753
|
+
|
|
5633
5754
|
break;
|
|
5634
5755
|
case 'boolean':
|
|
5635
5756
|
convertData = {
|
|
@@ -5649,7 +5770,26 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
5649
5770
|
};
|
|
5650
5771
|
break;
|
|
5651
5772
|
case 'date':
|
|
5652
|
-
convertData = {
|
|
5773
|
+
convertData = isMobile && !readonly ? {
|
|
5774
|
+
type: "native-date",
|
|
5775
|
+
pipeIn: (value, data) => {
|
|
5776
|
+
if (value) {
|
|
5777
|
+
value = moment(value).utc().format('YYYY-MM-DD');
|
|
5778
|
+
return value;
|
|
5779
|
+
} else {
|
|
5780
|
+
return "";
|
|
5781
|
+
}
|
|
5782
|
+
|
|
5783
|
+
},
|
|
5784
|
+
pipeOut: (value, oldValue, data) => {
|
|
5785
|
+
if (value) {
|
|
5786
|
+
value = moment(value).format('YYYY-MM-DDT00:00:00.000[Z]');
|
|
5787
|
+
return value;
|
|
5788
|
+
} else {
|
|
5789
|
+
return "";
|
|
5790
|
+
}
|
|
5791
|
+
}
|
|
5792
|
+
} : {
|
|
5653
5793
|
type: getAmisStaticFieldType('date', readonly),
|
|
5654
5794
|
inputFormat: "YYYY-MM-DD",
|
|
5655
5795
|
format:'YYYY-MM-DDT00:00:00.000[Z]',
|
|
@@ -5668,12 +5808,48 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
5668
5808
|
};
|
|
5669
5809
|
break;
|
|
5670
5810
|
case 'datetime':
|
|
5671
|
-
convertData = {
|
|
5811
|
+
convertData = isMobile && !readonly ? {
|
|
5812
|
+
type: "combo",
|
|
5813
|
+
pipeIn: (value, data) => {
|
|
5814
|
+
let revalue = {};
|
|
5815
|
+
if (value && value != "Invalid date") {
|
|
5816
|
+
value = moment(value).format('YYYY-MM-DD HH:mm:ss');
|
|
5817
|
+
revalue[field.name + "-native-date"] = value.split(' ')[0];
|
|
5818
|
+
revalue[field.name + "-native-time"] = value.split(' ')[1];
|
|
5819
|
+
} else {
|
|
5820
|
+
revalue[field.name + "-native-date"] = "";
|
|
5821
|
+
revalue[field.name + "-native-time"] = "";
|
|
5822
|
+
}
|
|
5823
|
+
return revalue;
|
|
5824
|
+
},
|
|
5825
|
+
pipeOut: (value, oldValue, data) => {
|
|
5826
|
+
let revalue = "";
|
|
5827
|
+
if (value[field.name + "-native-date"] && value[field.name + "-native-time"]) {
|
|
5828
|
+
revalue = value[field.name + "-native-date"] + " " + value[field.name + "-native-time"];
|
|
5829
|
+
revalue = moment(revalue).utc().format('YYYY-MM-DDTHH:mm:ss.SSS[Z]');
|
|
5830
|
+
}
|
|
5831
|
+
return revalue;
|
|
5832
|
+
},
|
|
5833
|
+
items: [
|
|
5834
|
+
{
|
|
5835
|
+
type: "native-date",
|
|
5836
|
+
name: field.name + "-native-date",
|
|
5837
|
+
className: "steedos-native-date",
|
|
5838
|
+
value: ""
|
|
5839
|
+
},
|
|
5840
|
+
{
|
|
5841
|
+
type: "native-time",
|
|
5842
|
+
name: field.name + "-native-time",
|
|
5843
|
+
className: "steedos-native-time",
|
|
5844
|
+
value: ""
|
|
5845
|
+
}
|
|
5846
|
+
]
|
|
5847
|
+
} : {
|
|
5672
5848
|
type: getAmisStaticFieldType('datetime', readonly),
|
|
5673
5849
|
inputFormat: 'YYYY-MM-DD HH:mm',
|
|
5674
|
-
format:'YYYY-MM-DDTHH:mm:ss.SSSZ',
|
|
5850
|
+
format: 'YYYY-MM-DDTHH:mm:ss.SSSZ',
|
|
5675
5851
|
tpl: readonly ? getDateTimeTpl(field) : null,
|
|
5676
|
-
utc: true
|
|
5852
|
+
utc: true,
|
|
5677
5853
|
};
|
|
5678
5854
|
break;
|
|
5679
5855
|
case 'input-time-range':
|
|
@@ -5688,7 +5864,26 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
5688
5864
|
};
|
|
5689
5865
|
break;
|
|
5690
5866
|
case 'time':
|
|
5691
|
-
convertData = {
|
|
5867
|
+
convertData = isMobile && !readonly ? {
|
|
5868
|
+
type: "native-time",
|
|
5869
|
+
pipeIn: (value, data) => {
|
|
5870
|
+
if (value) {
|
|
5871
|
+
value = moment(value).utc().format('HH:mm');
|
|
5872
|
+
return value;
|
|
5873
|
+
} else {
|
|
5874
|
+
return "";
|
|
5875
|
+
}
|
|
5876
|
+
|
|
5877
|
+
},
|
|
5878
|
+
pipeOut: (value, oldValue, data) => {
|
|
5879
|
+
if (value) {
|
|
5880
|
+
value = moment('1970-01-01 ' + value).format('1970-01-01THH:mm:00.000[Z]');
|
|
5881
|
+
return value;
|
|
5882
|
+
} else {
|
|
5883
|
+
return "";
|
|
5884
|
+
}
|
|
5885
|
+
}
|
|
5886
|
+
} : {
|
|
5692
5887
|
type: getAmisStaticFieldType('time', readonly),
|
|
5693
5888
|
inputFormat: 'HH:mm',
|
|
5694
5889
|
timeFormat:'HH:mm',
|
|
@@ -5892,6 +6087,13 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
5892
6087
|
convertData.quickEdit = false;
|
|
5893
6088
|
}
|
|
5894
6089
|
|
|
6090
|
+
let fieldTypeClassName = ' steedos-' + convertData.type + (readonly ? '-readonly' : '-edit');
|
|
6091
|
+
if (convertData.className) {
|
|
6092
|
+
convertData.className = convertData.className + fieldTypeClassName;
|
|
6093
|
+
} else {
|
|
6094
|
+
convertData.className = fieldTypeClassName;
|
|
6095
|
+
}
|
|
6096
|
+
|
|
5895
6097
|
if(field.visible_on){
|
|
5896
6098
|
// convertData.visibleOn = `\$${field.visible_on.substring(1, field.visible_on.length -1).replace(/formData./g, '')}`;
|
|
5897
6099
|
if(field.visible_on.startsWith("{{")){
|
|
@@ -6576,6 +6778,7 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
6576
6778
|
hiddenOn: options.tableHiddenOn,
|
|
6577
6779
|
autoFillHeight: options.isRelated ? false : true,
|
|
6578
6780
|
className: `flex-auto ${crudClassName || ""}`,
|
|
6781
|
+
bodyClassName: "bg-white",
|
|
6579
6782
|
crudClassName: crudClassName,
|
|
6580
6783
|
},
|
|
6581
6784
|
bodyProps,
|
|
@@ -6921,7 +7124,31 @@ async function getTableColumns(fields, options){
|
|
|
6921
7124
|
...getAmisFileReadonlySchema(field)
|
|
6922
7125
|
}, field.amis, {name: field.name}));
|
|
6923
7126
|
}
|
|
6924
|
-
|
|
7127
|
+
else if(field.type === 'select'){
|
|
7128
|
+
const selectOptions = field.options;
|
|
7129
|
+
let map = {};
|
|
7130
|
+
forEach(selectOptions,(option)=>{
|
|
7131
|
+
const optionValue = option.value + '';
|
|
7132
|
+
if(option.color){
|
|
7133
|
+
const background = '#'+option.color;
|
|
7134
|
+
const color = getContrastColor(background);
|
|
7135
|
+
const optionColorStyle = 'background:'+background+';color:'+color;
|
|
7136
|
+
map[optionValue] = `<span class="rounded-xl px-2 py-1" style='${optionColorStyle}'>${option.label}</span>`;
|
|
7137
|
+
}else {
|
|
7138
|
+
map[optionValue] = option.label;
|
|
7139
|
+
}
|
|
7140
|
+
});
|
|
7141
|
+
columns.push(Object.assign({}, {
|
|
7142
|
+
type: "mapping",
|
|
7143
|
+
name: field.name,
|
|
7144
|
+
label: field.label,
|
|
7145
|
+
map: map,
|
|
7146
|
+
sortable: field.sortable,
|
|
7147
|
+
width: field.width,
|
|
7148
|
+
toggled: field.toggled,
|
|
7149
|
+
className:"whitespace-nowrap",
|
|
7150
|
+
}, field.amis, {name: field.name}));
|
|
7151
|
+
}
|
|
6925
7152
|
else {
|
|
6926
7153
|
const tpl = await getFieldTpl(field, options);
|
|
6927
7154
|
|