編集イベントに新しい関数でスタイルを追加する
This commit is contained in:
@@ -59,10 +59,16 @@ export class StyleFieldAction implements IAction{
|
||||
}
|
||||
this.props = actionNode.ActionValue as IStyleFieldProps;
|
||||
//書式設定
|
||||
if(event.type==="app.record.index.show"){
|
||||
this.setStyleForView(event,this.props,context);
|
||||
}else if(event.type==="app.record.detail.show"){
|
||||
this.setStyleForDetail(event,this.props,context);
|
||||
console.log(event.type)
|
||||
if (event.type === "app.record.index.show") {
|
||||
this.setStyleForView(event, this.props, context);
|
||||
} else if (event.type === "app.record.detail.show") {
|
||||
this.setStyleForDetail(event, this.props, context);
|
||||
} else if (
|
||||
event.type.includes("app.record.create.change.") ||
|
||||
event.type.includes("app.record.edit.change.")
|
||||
) {
|
||||
this.setStyleForEdit(event, this.props, context);
|
||||
}
|
||||
result= {
|
||||
canNext:true,
|
||||
@@ -77,6 +83,36 @@ export class StyleFieldAction implements IAction{
|
||||
|
||||
}
|
||||
|
||||
setStyleForEdit(event:any,props:IStyleFieldProps,context:IContext){
|
||||
const recordTable = document.getElementById('record-gaia');
|
||||
if (recordTable) {
|
||||
Array.from(
|
||||
recordTable.getElementsByTagName("span")
|
||||
)
|
||||
.filter((span) => span.innerText === props.field.code)
|
||||
.map((span) =>
|
||||
span.parentElement?.nextElementSibling
|
||||
?.querySelector(".input-text-outer-cybozu")
|
||||
?.firstElementChild as HTMLElement | null
|
||||
)
|
||||
.filter((inputElement): inputElement is HTMLElement => !!inputElement)
|
||||
.forEach((inputElement) => {
|
||||
const conditionResult = this.getConditionResult(
|
||||
this.getCondition(props.condition),
|
||||
context
|
||||
);
|
||||
|
||||
if (conditionResult) {
|
||||
this.setFieldStyle(props, inputElement);
|
||||
} else {
|
||||
inputElement.removeAttribute('style');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 詳細表示時のスタイル設定
|
||||
* @param event
|
||||
|
||||
Reference in New Issue
Block a user