@@ -9,7 +9,7 @@ import { ActionSelectorControl } from "comps/controls/actionSelector/actionSelec
99import { BoolControl } from "comps/controls/boolControl" ;
1010import { codeControl } from "comps/controls/codeControl" ;
1111import { trans } from "i18n" ;
12- import React , { useContext , useEffect , useMemo , useState } from "react" ;
12+ import { createContext , useContext , useEffect , useMemo , useState } from "react" ;
1313import { toJson } from "really-relaxed-json" ;
1414import { JSONObject } from "util/jsonTypes" ;
1515import {
@@ -23,6 +23,9 @@ import {
2323 WrapperMulti ,
2424} from "./columnTypeUtils/tagUtils" ;
2525
26+ // Context 用于传递列基础配置的 editable 值
27+ export const ColumnEditableContext = createContext < boolean | undefined > ( undefined ) ;
28+
2629/* ------------------------------ 工具函数区 ------------------------------ */
2730
2831// 统一解析 value 为字符串数组
@@ -233,22 +236,28 @@ export const ColumnTagsComp = new ColumnTypeCompBuilder(
233236 </ ColorMapContext . Provider >
234237 ) ;
235238 } )
236- . setPropertyViewFn ( ( children ) => (
237- < >
238- { children . text . propertyView ( {
239- label : trans ( "table.columnValue" ) ,
240- tooltip : ColumnValueTooltip ,
241- } ) }
242- { children . colorMap . propertyView ( {
243- title : trans ( "table.tagConfig" ) ,
244- } ) }
245- { children . allowCustomTags . propertyView ( {
246- label : trans ( "table.allowCustomTags" ) ,
247- tooltip : trans ( "table.allowCustomTagsTooltip" ) ,
248- } ) }
249- { children . onTagClick . propertyView ( {
250- label : trans ( "table.onTagClick" ) ,
251- } ) }
252- </ >
253- ) )
239+ . setPropertyViewFn ( ( children ) => {
240+ const PropertyView = ( ) => {
241+ const columnEditable = useContext ( ColumnEditableContext ) ;
242+ return (
243+ < >
244+ { children . text . propertyView ( {
245+ label : trans ( "table.columnValue" ) ,
246+ tooltip : ColumnValueTooltip ,
247+ } ) }
248+ { children . colorMap . propertyView ( {
249+ title : trans ( "table.tagConfig" ) ,
250+ } ) }
251+ { columnEditable && children . allowCustomTags . propertyView ( {
252+ label : trans ( "table.allowCustomTags" ) ,
253+ tooltip : trans ( "table.allowCustomTagsTooltip" ) ,
254+ } ) }
255+ { children . onTagClick . propertyView ( {
256+ label : trans ( "table.onTagClick" ) ,
257+ } ) }
258+ </ >
259+ ) ;
260+ } ;
261+ return < PropertyView /> ;
262+ } )
254263 . build ( ) ;
0 commit comments