@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.cjs.js
CHANGED
|
@@ -2623,7 +2623,7 @@ async function getObjectFieldsFilterFormSchema(ctx) {
|
|
|
2623
2623
|
return Promise.all(filterFormSearchableFields.map(function (item) {
|
|
2624
2624
|
const field = _.clone(fields[item]);
|
|
2625
2625
|
if (
|
|
2626
|
-
!_.includes(
|
|
2626
|
+
field && !_.includes(
|
|
2627
2627
|
[
|
|
2628
2628
|
"grid",
|
|
2629
2629
|
"avatar",
|
|
@@ -2670,7 +2670,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
2670
2670
|
var filterForm = scope.parent.parent.getComponents().find(function(n){
|
|
2671
2671
|
return n.props.type === "form";
|
|
2672
2672
|
});
|
|
2673
|
-
filterForm.handleFormSubmit(event)
|
|
2673
|
+
filterForm.handleFormSubmit(event);
|
|
2674
2674
|
// var filterFormValues = filterForm.getValues();
|
|
2675
2675
|
// var listView = scope.parent.parent.parent.getComponents().find(function(n){
|
|
2676
2676
|
// return n.props.type === "crud";
|
|
@@ -2684,8 +2684,30 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
2684
2684
|
// }
|
|
2685
2685
|
// }
|
|
2686
2686
|
// listView.handleFilterSubmit(Object.assign({}, removedValues, filterFormValues));
|
|
2687
|
+
|
|
2688
|
+
let isMobile = Steedos.isMobile();
|
|
2689
|
+
if(isMobile){
|
|
2690
|
+
// 手机端点击搜索的时候自动收起搜索栏
|
|
2691
|
+
let resizeWindow = function(){
|
|
2692
|
+
//触发amis crud 高度重算
|
|
2693
|
+
setTimeout(()=>{
|
|
2694
|
+
window.dispatchEvent(new Event("resize"))
|
|
2695
|
+
}, 500);
|
|
2696
|
+
}
|
|
2697
|
+
const filterService = filterForm.context.getComponents().find(function(n){
|
|
2698
|
+
return n.props.type === "service";
|
|
2699
|
+
});
|
|
2700
|
+
filterService.setData({showFieldsFilter: false});
|
|
2701
|
+
resizeWindow();
|
|
2702
|
+
// 使用filterForm.getValues()的话,并不能拿到本地存储中的过滤条件,所以需要从event.data中取。
|
|
2703
|
+
let filterFormValues = event.data;
|
|
2704
|
+
let isFieldsFilterEmpty = SteedosUI.isFilterFormValuesEmpty(filterFormValues);
|
|
2705
|
+
let crud = SteedosUI.getClosestAmisComponentByType(scope, "crud");
|
|
2706
|
+
let crudService = crud && SteedosUI.getClosestAmisComponentByType(crud.context, "service");
|
|
2707
|
+
crudService && crudService.setData({isFieldsFilterEmpty, showFieldsFilter: false});
|
|
2708
|
+
}
|
|
2687
2709
|
`;
|
|
2688
|
-
const
|
|
2710
|
+
const onCancelScript = `
|
|
2689
2711
|
const scope = event.context.scoped;
|
|
2690
2712
|
var filterForm = scope.parent.parent.getComponents().find(function(n){
|
|
2691
2713
|
return n.props.type === "form";
|
|
@@ -2713,7 +2735,21 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
2713
2735
|
}
|
|
2714
2736
|
}
|
|
2715
2737
|
listView.handleFilterSubmit(removedValues);
|
|
2716
|
-
|
|
2738
|
+
const filterService = filterForm.context.getComponents().find(function(n){
|
|
2739
|
+
return n.props.type === "service";
|
|
2740
|
+
});
|
|
2741
|
+
filterService.setData({showFieldsFilter: !!!filterService.props.data.showFieldsFilter});
|
|
2742
|
+
//触发amis crud 高度重算
|
|
2743
|
+
setTimeout(()=>{
|
|
2744
|
+
window.dispatchEvent(new Event("resize"))
|
|
2745
|
+
}, 100);
|
|
2746
|
+
let isMobile = Steedos.isMobile();
|
|
2747
|
+
if(isMobile){
|
|
2748
|
+
// 手机端移除搜索按钮上的红点
|
|
2749
|
+
let crudService = scope.getComponentById("service_listview_" + event.data.objectName);
|
|
2750
|
+
crudService && crudService.setData({isFieldsFilterEmpty: true, showFieldsFilter: false});
|
|
2751
|
+
}
|
|
2752
|
+
`;
|
|
2717
2753
|
const dataProviderInited = `
|
|
2718
2754
|
const objectName = data.objectName;
|
|
2719
2755
|
const isLookup = data.isLookup;
|
|
@@ -2767,7 +2803,15 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
2767
2803
|
});
|
|
2768
2804
|
// 有过滤条件时自动展开搜索栏
|
|
2769
2805
|
if(!_.isEmpty(omitedEmptyFormValue)){
|
|
2770
|
-
|
|
2806
|
+
let isMobile = Steedos.isMobile();
|
|
2807
|
+
if(isMobile){
|
|
2808
|
+
// 手机端不展开,只显示搜索按钮上的红点
|
|
2809
|
+
let crudService = SteedosUI.getRef(data.$scopeId).getComponentById("service_listview_" + data.objectName)
|
|
2810
|
+
crudService && crudService.setData({isFieldsFilterEmpty: false});
|
|
2811
|
+
}
|
|
2812
|
+
else{
|
|
2813
|
+
setData({ showFieldsFilter: true });
|
|
2814
|
+
}
|
|
2771
2815
|
}
|
|
2772
2816
|
}
|
|
2773
2817
|
}
|
|
@@ -2909,14 +2953,15 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
2909
2953
|
},
|
|
2910
2954
|
{
|
|
2911
2955
|
"type": "button",
|
|
2912
|
-
"label": "
|
|
2956
|
+
"label": "取消",
|
|
2957
|
+
"name": "btn_filter_form_cancel",
|
|
2913
2958
|
"visibleOn": "this.filterFormSearchableFields && this.filterFormSearchableFields.length",
|
|
2914
2959
|
"onEvent": {
|
|
2915
2960
|
"click": {
|
|
2916
2961
|
"actions": [
|
|
2917
2962
|
{
|
|
2918
2963
|
"actionType": "custom",
|
|
2919
|
-
"script":
|
|
2964
|
+
"script": onCancelScript
|
|
2920
2965
|
}
|
|
2921
2966
|
]
|
|
2922
2967
|
}
|
|
@@ -3520,11 +3565,36 @@ const filterForm = scope.getComponents().find(function(n){
|
|
|
3520
3565
|
const filterService = filterForm.context.getComponents().find(function(n){
|
|
3521
3566
|
return n.props.type === "service";
|
|
3522
3567
|
});
|
|
3523
|
-
filterService.setData({showFieldsFilter: !!!filterService.props.data.showFieldsFilter});
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3568
|
+
// filterService.setData({showFieldsFilter: !!!filterService.props.data.showFieldsFilter});
|
|
3569
|
+
let resizeWindow = function(){
|
|
3570
|
+
//触发amis crud 高度重算
|
|
3571
|
+
setTimeout(()=>{
|
|
3572
|
+
window.dispatchEvent(new Event("resize"))
|
|
3573
|
+
}, 500);
|
|
3574
|
+
}
|
|
3575
|
+
let isMobile = Steedos.isMobile();
|
|
3576
|
+
if(filterService.props.data.showFieldsFilter){
|
|
3577
|
+
if(isMobile){
|
|
3578
|
+
// 手机上只能通过取消按钮来关闭搜索栏
|
|
3579
|
+
return;
|
|
3580
|
+
}
|
|
3581
|
+
let buttonCancel = SteedosUI.getClosestAmisComponentByType(filterForm.context, "button", {
|
|
3582
|
+
direction: "down",
|
|
3583
|
+
name: "btn_filter_form_cancel"
|
|
3584
|
+
});
|
|
3585
|
+
buttonCancel.props.dispatchEvent('click', {}).then(function(){
|
|
3586
|
+
resizeWindow();
|
|
3587
|
+
});
|
|
3588
|
+
}
|
|
3589
|
+
else{
|
|
3590
|
+
filterService.setData({showFieldsFilter: true});
|
|
3591
|
+
resizeWindow();
|
|
3592
|
+
if(isMobile){
|
|
3593
|
+
// 手机端在显示搜索栏时隐藏刷新按钮
|
|
3594
|
+
let crudService = scope.getComponentById("service_listview_" + event.data.objectName);
|
|
3595
|
+
crudService && crudService.setData({showFieldsFilter: true});
|
|
3596
|
+
}
|
|
3597
|
+
}
|
|
3528
3598
|
`;
|
|
3529
3599
|
|
|
3530
3600
|
function getExportApiRequestAdaptorScript(){
|
|
@@ -3609,6 +3679,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
|
|
|
3609
3679
|
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
3610
3680
|
"label": "",
|
|
3611
3681
|
"icon": "fa fa-sync",
|
|
3682
|
+
"visibleOn": "${!showFieldsFilter}",
|
|
3612
3683
|
"onEvent": {
|
|
3613
3684
|
"click": {
|
|
3614
3685
|
"actions": [
|
|
@@ -3624,6 +3695,15 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
|
|
|
3624
3695
|
"label": "",
|
|
3625
3696
|
"icon": "fa fa-search",
|
|
3626
3697
|
"type": "button",
|
|
3698
|
+
"badge": {
|
|
3699
|
+
"offsetx": [
|
|
3700
|
+
-2,
|
|
3701
|
+
2
|
|
3702
|
+
],
|
|
3703
|
+
"size":8,
|
|
3704
|
+
"animation": true,
|
|
3705
|
+
"visibleOn": "${isFieldsFilterEmpty == false}"
|
|
3706
|
+
},
|
|
3627
3707
|
"align": "right",
|
|
3628
3708
|
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
3629
3709
|
"onEvent": {
|
|
@@ -4263,8 +4343,8 @@ function getObjectFooterToolbar(mainObject, formFactor) {
|
|
|
4263
4343
|
}
|
|
4264
4344
|
else {
|
|
4265
4345
|
return [
|
|
4346
|
+
"switch-per-page",
|
|
4266
4347
|
"statistics",
|
|
4267
|
-
// "switch-per-page",
|
|
4268
4348
|
"pagination"
|
|
4269
4349
|
]
|
|
4270
4350
|
}
|
|
@@ -5456,6 +5536,23 @@ const getAmisFileSchema = (steedosField, readonly)=>{
|
|
|
5456
5536
|
return readonly ? getAmisFileReadonlySchema(steedosField) : getAmisFileEditSchema(steedosField);
|
|
5457
5537
|
};
|
|
5458
5538
|
|
|
5539
|
+
/*
|
|
5540
|
+
* @Author: baozhoutao@steedos.com
|
|
5541
|
+
* @Date: 2022-07-20 16:29:22
|
|
5542
|
+
* @LastEditors: Please set LastEditors
|
|
5543
|
+
* @LastEditTime: 2023-05-11 11:19:54
|
|
5544
|
+
* @Description:
|
|
5545
|
+
*/
|
|
5546
|
+
|
|
5547
|
+
function getContrastColor(bgColor) {
|
|
5548
|
+
var backgroundColor = (bgColor.charAt(0) === '#') ? bgColor.substring(1, 7) : bgColor;
|
|
5549
|
+
var r = parseInt(backgroundColor.substr(0, 2), 16);
|
|
5550
|
+
var g = parseInt(backgroundColor.substr(2, 2), 16);
|
|
5551
|
+
var b = parseInt(backgroundColor.substr(4, 2), 16);
|
|
5552
|
+
var brightness = (r * 299 + g * 587 + b * 114) / 1000;
|
|
5553
|
+
return brightness >= 128 ? "#000000" : "#ffffff";
|
|
5554
|
+
}
|
|
5555
|
+
|
|
5459
5556
|
const OMIT_FIELDS = ['created', 'created_by', 'modified', 'modified_by'];
|
|
5460
5557
|
// const Lookup = require('./lookup');
|
|
5461
5558
|
|
|
@@ -5609,6 +5706,8 @@ function getSelectFieldOptions(field){
|
|
|
5609
5706
|
}
|
|
5610
5707
|
|
|
5611
5708
|
async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
5709
|
+
// console.log('convertSFieldToAmisField====>', field, readonly, ctx)
|
|
5710
|
+
const isMobile = window.innerWidth <= 768;
|
|
5612
5711
|
// 创建人和修改人、创建时间和修改时间不显示
|
|
5613
5712
|
if(___namespace.includes(OMIT_FIELDS, field.name) && ctx.showSystemFields != true){
|
|
5614
5713
|
return;
|
|
@@ -5643,20 +5742,42 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
5643
5742
|
// }
|
|
5644
5743
|
// break;
|
|
5645
5744
|
case 'select':
|
|
5646
|
-
|
|
5647
|
-
|
|
5648
|
-
|
|
5649
|
-
|
|
5650
|
-
|
|
5651
|
-
|
|
5652
|
-
|
|
5653
|
-
|
|
5654
|
-
|
|
5655
|
-
|
|
5656
|
-
|
|
5657
|
-
|
|
5658
|
-
|
|
5745
|
+
if(readonly){
|
|
5746
|
+
const selectOptions = field.options;
|
|
5747
|
+
let map = {};
|
|
5748
|
+
___namespace.forEach(selectOptions,(option)=>{
|
|
5749
|
+
const optionValue = option.value + '';
|
|
5750
|
+
if(option.color){
|
|
5751
|
+
const background = '#'+option.color;
|
|
5752
|
+
const color = getContrastColor(background);
|
|
5753
|
+
const optionColorStyle = 'background:'+background+';color:'+color;
|
|
5754
|
+
map[optionValue] = `<span class="rounded-xl px-2 py-1" style='${optionColorStyle}'>${option.label}</span>`;
|
|
5755
|
+
}else {
|
|
5756
|
+
map[optionValue] = option.label;
|
|
5757
|
+
}
|
|
5758
|
+
});
|
|
5759
|
+
convertData = {
|
|
5760
|
+
type: "static-mapping",
|
|
5761
|
+
name: field.name,
|
|
5762
|
+
label: field.label,
|
|
5763
|
+
map: map
|
|
5764
|
+
};
|
|
5765
|
+
}else {
|
|
5766
|
+
convertData = {
|
|
5767
|
+
type: getAmisStaticFieldType('select', readonly),
|
|
5768
|
+
joinValues: false,
|
|
5769
|
+
options: getSelectFieldOptions(field),
|
|
5770
|
+
extractValue: true,
|
|
5771
|
+
clearable: true,
|
|
5772
|
+
labelField: 'label',
|
|
5773
|
+
valueField: 'value'
|
|
5774
|
+
};
|
|
5775
|
+
if(field.multiple){
|
|
5776
|
+
convertData.multiple = true;
|
|
5777
|
+
convertData.extractValue = true;
|
|
5778
|
+
}
|
|
5659
5779
|
}
|
|
5780
|
+
|
|
5660
5781
|
break;
|
|
5661
5782
|
case 'boolean':
|
|
5662
5783
|
convertData = {
|
|
@@ -5676,7 +5797,26 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
5676
5797
|
};
|
|
5677
5798
|
break;
|
|
5678
5799
|
case 'date':
|
|
5679
|
-
convertData = {
|
|
5800
|
+
convertData = isMobile && !readonly ? {
|
|
5801
|
+
type: "native-date",
|
|
5802
|
+
pipeIn: (value, data) => {
|
|
5803
|
+
if (value) {
|
|
5804
|
+
value = moment(value).utc().format('YYYY-MM-DD');
|
|
5805
|
+
return value;
|
|
5806
|
+
} else {
|
|
5807
|
+
return "";
|
|
5808
|
+
}
|
|
5809
|
+
|
|
5810
|
+
},
|
|
5811
|
+
pipeOut: (value, oldValue, data) => {
|
|
5812
|
+
if (value) {
|
|
5813
|
+
value = moment(value).format('YYYY-MM-DDT00:00:00.000[Z]');
|
|
5814
|
+
return value;
|
|
5815
|
+
} else {
|
|
5816
|
+
return "";
|
|
5817
|
+
}
|
|
5818
|
+
}
|
|
5819
|
+
} : {
|
|
5680
5820
|
type: getAmisStaticFieldType('date', readonly),
|
|
5681
5821
|
inputFormat: "YYYY-MM-DD",
|
|
5682
5822
|
format:'YYYY-MM-DDT00:00:00.000[Z]',
|
|
@@ -5695,12 +5835,48 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
5695
5835
|
};
|
|
5696
5836
|
break;
|
|
5697
5837
|
case 'datetime':
|
|
5698
|
-
convertData = {
|
|
5838
|
+
convertData = isMobile && !readonly ? {
|
|
5839
|
+
type: "combo",
|
|
5840
|
+
pipeIn: (value, data) => {
|
|
5841
|
+
let revalue = {};
|
|
5842
|
+
if (value && value != "Invalid date") {
|
|
5843
|
+
value = moment(value).format('YYYY-MM-DD HH:mm:ss');
|
|
5844
|
+
revalue[field.name + "-native-date"] = value.split(' ')[0];
|
|
5845
|
+
revalue[field.name + "-native-time"] = value.split(' ')[1];
|
|
5846
|
+
} else {
|
|
5847
|
+
revalue[field.name + "-native-date"] = "";
|
|
5848
|
+
revalue[field.name + "-native-time"] = "";
|
|
5849
|
+
}
|
|
5850
|
+
return revalue;
|
|
5851
|
+
},
|
|
5852
|
+
pipeOut: (value, oldValue, data) => {
|
|
5853
|
+
let revalue = "";
|
|
5854
|
+
if (value[field.name + "-native-date"] && value[field.name + "-native-time"]) {
|
|
5855
|
+
revalue = value[field.name + "-native-date"] + " " + value[field.name + "-native-time"];
|
|
5856
|
+
revalue = moment(revalue).utc().format('YYYY-MM-DDTHH:mm:ss.SSS[Z]');
|
|
5857
|
+
}
|
|
5858
|
+
return revalue;
|
|
5859
|
+
},
|
|
5860
|
+
items: [
|
|
5861
|
+
{
|
|
5862
|
+
type: "native-date",
|
|
5863
|
+
name: field.name + "-native-date",
|
|
5864
|
+
className: "steedos-native-date",
|
|
5865
|
+
value: ""
|
|
5866
|
+
},
|
|
5867
|
+
{
|
|
5868
|
+
type: "native-time",
|
|
5869
|
+
name: field.name + "-native-time",
|
|
5870
|
+
className: "steedos-native-time",
|
|
5871
|
+
value: ""
|
|
5872
|
+
}
|
|
5873
|
+
]
|
|
5874
|
+
} : {
|
|
5699
5875
|
type: getAmisStaticFieldType('datetime', readonly),
|
|
5700
5876
|
inputFormat: 'YYYY-MM-DD HH:mm',
|
|
5701
|
-
format:'YYYY-MM-DDTHH:mm:ss.SSSZ',
|
|
5877
|
+
format: 'YYYY-MM-DDTHH:mm:ss.SSSZ',
|
|
5702
5878
|
tpl: readonly ? getDateTimeTpl(field) : null,
|
|
5703
|
-
utc: true
|
|
5879
|
+
utc: true,
|
|
5704
5880
|
};
|
|
5705
5881
|
break;
|
|
5706
5882
|
case 'input-time-range':
|
|
@@ -5715,7 +5891,26 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
5715
5891
|
};
|
|
5716
5892
|
break;
|
|
5717
5893
|
case 'time':
|
|
5718
|
-
convertData = {
|
|
5894
|
+
convertData = isMobile && !readonly ? {
|
|
5895
|
+
type: "native-time",
|
|
5896
|
+
pipeIn: (value, data) => {
|
|
5897
|
+
if (value) {
|
|
5898
|
+
value = moment(value).utc().format('HH:mm');
|
|
5899
|
+
return value;
|
|
5900
|
+
} else {
|
|
5901
|
+
return "";
|
|
5902
|
+
}
|
|
5903
|
+
|
|
5904
|
+
},
|
|
5905
|
+
pipeOut: (value, oldValue, data) => {
|
|
5906
|
+
if (value) {
|
|
5907
|
+
value = moment('1970-01-01 ' + value).format('1970-01-01THH:mm:00.000[Z]');
|
|
5908
|
+
return value;
|
|
5909
|
+
} else {
|
|
5910
|
+
return "";
|
|
5911
|
+
}
|
|
5912
|
+
}
|
|
5913
|
+
} : {
|
|
5719
5914
|
type: getAmisStaticFieldType('time', readonly),
|
|
5720
5915
|
inputFormat: 'HH:mm',
|
|
5721
5916
|
timeFormat:'HH:mm',
|
|
@@ -5919,6 +6114,13 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
5919
6114
|
convertData.quickEdit = false;
|
|
5920
6115
|
}
|
|
5921
6116
|
|
|
6117
|
+
let fieldTypeClassName = ' steedos-' + convertData.type + (readonly ? '-readonly' : '-edit');
|
|
6118
|
+
if (convertData.className) {
|
|
6119
|
+
convertData.className = convertData.className + fieldTypeClassName;
|
|
6120
|
+
} else {
|
|
6121
|
+
convertData.className = fieldTypeClassName;
|
|
6122
|
+
}
|
|
6123
|
+
|
|
5922
6124
|
if(field.visible_on){
|
|
5923
6125
|
// convertData.visibleOn = `\$${field.visible_on.substring(1, field.visible_on.length -1).replace(/formData./g, '')}`;
|
|
5924
6126
|
if(field.visible_on.startsWith("{{")){
|
|
@@ -6603,6 +6805,7 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
6603
6805
|
hiddenOn: options.tableHiddenOn,
|
|
6604
6806
|
autoFillHeight: options.isRelated ? false : true,
|
|
6605
6807
|
className: `flex-auto ${crudClassName || ""}`,
|
|
6808
|
+
bodyClassName: "bg-white",
|
|
6606
6809
|
crudClassName: crudClassName,
|
|
6607
6810
|
},
|
|
6608
6811
|
bodyProps,
|
|
@@ -6948,7 +7151,31 @@ async function getTableColumns(fields, options){
|
|
|
6948
7151
|
...getAmisFileReadonlySchema(field)
|
|
6949
7152
|
}, field.amis, {name: field.name}));
|
|
6950
7153
|
}
|
|
6951
|
-
|
|
7154
|
+
else if(field.type === 'select'){
|
|
7155
|
+
const selectOptions = field.options;
|
|
7156
|
+
let map = {};
|
|
7157
|
+
_$1.forEach(selectOptions,(option)=>{
|
|
7158
|
+
const optionValue = option.value + '';
|
|
7159
|
+
if(option.color){
|
|
7160
|
+
const background = '#'+option.color;
|
|
7161
|
+
const color = getContrastColor(background);
|
|
7162
|
+
const optionColorStyle = 'background:'+background+';color:'+color;
|
|
7163
|
+
map[optionValue] = `<span class="rounded-xl px-2 py-1" style='${optionColorStyle}'>${option.label}</span>`;
|
|
7164
|
+
}else {
|
|
7165
|
+
map[optionValue] = option.label;
|
|
7166
|
+
}
|
|
7167
|
+
});
|
|
7168
|
+
columns.push(Object.assign({}, {
|
|
7169
|
+
type: "mapping",
|
|
7170
|
+
name: field.name,
|
|
7171
|
+
label: field.label,
|
|
7172
|
+
map: map,
|
|
7173
|
+
sortable: field.sortable,
|
|
7174
|
+
width: field.width,
|
|
7175
|
+
toggled: field.toggled,
|
|
7176
|
+
className:"whitespace-nowrap",
|
|
7177
|
+
}, field.amis, {name: field.name}));
|
|
7178
|
+
}
|
|
6952
7179
|
else {
|
|
6953
7180
|
const tpl = await getFieldTpl(field, options);
|
|
6954
7181
|
|