/*
 * Copyright (c) 2018, 2025, Oracle and/or its affiliates.
 * Licensed under The Universal Permissive License (UPL), Version 1.0
 * as shown at https://oss.oracle.com/licenses/upl/
 */
const RULENAME="oj-html-form-layout-colspan-wrap";const DESCRIPTION="When an <oj-form-layout> has <oj-label-value> children that specify a 'colspan' "+"attribute, <oj-form-layout>'s 'colspan-wrap' attribute specifies the column spanning "+"behavior.  The 'nowrap' behavior has been deprecated as it is not specified by the "+"Redwood Design System.  In these cases, colspan-wrap=\"wrap\" needs to be specified "+"on the <oj-form-layout> so that it will produce the correct layout as specified "+"by the Redwood Design System.";const SHORT_DESCRIPTION=DESCRIPTION;const ISSUE="<oj-form-layout> has column spanning elements, and the 'colspan-wrap' property's default value "+"'nowrap' has been deprecated.  Please add colspan-wrap=\"wrap\" to avoid using this deprecated "+"value and producing a layout that is no longer supported.";class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(){return{"<oj-form-layout>":this._onFormLayout}}_onFormLayout(ruleCtx){var attribs,ojLabelValues,attrNode,val,i;attribs=ruleCtx.tagNode.attribs;if(attribs){if((val=attribs["colspan-wrap"])&&val==="wrap"){return}}if(!(ojLabelValues=this._getOjLabelValueDirectChilds(ruleCtx))){return}for(i=0;i<ojLabelValues.length;i++){if((attrNode=ojLabelValues[i])&&(val=attrNode.attribs["col-span"])){if(val==="1"){continue}this._emitIssue(ruleCtx)}}}_getOjLabelValueDirectChilds(ruleCtx){var childs,child,i,ret=null;childs=ruleCtx.tagNode.children;for(i=0;i<childs.length;i++){child=childs[i];if(child.type==="tag"&&child.name==="oj-label-value"){if(!ret){ret=[]}ret.push(child)}}return ret}_emitIssue(ruleCtx){ruleCtx.reporter.addIssue(new ruleCtx.Issue(ISSUE),ruleCtx)}}module.exports=Rule;