| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 | 'use strict';const JV = require('./jpc_value_define');const JpcCommonHelper = require('./helper/jpc_helper_common');const JpcBandHelper = require('./helper/jpc_helper_band');const JpcBand = {    createNew(rptTpl, defProperties) {        const me = this;        const JpcBandResult = {};        if (rptTpl[JV.NODE_BAND_COLLECTION]) {            for (let i = 0; i < rptTpl[JV.NODE_BAND_COLLECTION].length; i++) {                me.createSingle(rptTpl[JV.NODE_BAND_COLLECTION][i], JpcBandResult, rptTpl, defProperties);            }        }        return JpcBandResult;    },    createSingle(bandNode, parentObj, rptTpl, defProperties) {        const me = this;        if (bandNode && bandNode[JV.BAND_PROP_NAME]) {            const item = { Left: 0, Right: 0, Top: 0, Bottom: 0, Name: bandNode[JV.BAND_PROP_NAME] };            item[JV.BAND_PROP_STYLE] = JpcCommonHelper.getStyle(bandNode[JV.BAND_PROP_STYLE], defProperties.styles, null);            item[JV.BAND_PROP_CONTROL] = JpcCommonHelper.getControl(bandNode[JV.BAND_PROP_CONTROL], defProperties.ctrls, null);            if (bandNode[JV.BAND_PROP_HEIGHT]) {                item[JV.BAND_PROP_HEIGHT] = 1.0 * bandNode[JV.BAND_PROP_HEIGHT];            } else {                item[JV.BAND_PROP_HEIGHT] = 0.0;            }            if (bandNode[JV.BAND_PROP_WIDTH]) {                item[JV.BAND_PROP_WIDTH] = 1.0 * bandNode[JV.BAND_PROP_WIDTH];            } else {                item[JV.BAND_PROP_WIDTH] = 0.0;            }            item[JV.BAND_PROP_DISPLAY_TYPE] = JpcBandHelper.getBandTypeValByString(bandNode[JV.BAND_PROP_DISPLAY_TYPE]);            item[JV.BAND_PROP_ALIGNMENT] = JpcCommonHelper.getLayoutAlignment(bandNode[JV.BAND_PROP_ALIGNMENT]);            item[JV.PROP_CALCULATION] = JpcCommonHelper.getPosCalculationType(bandNode[JV.PROP_CALCULATION]);            if (bandNode.hasOwnProperty(JV.PROP_BAND_NORMAL_ONLY)) {                item[JV.PROP_BAND_NORMAL_ONLY] = JpcCommonHelper.getBoolean(bandNode[JV.PROP_BAND_NORMAL_ONLY]);            }            if (bandNode.hasOwnProperty(JV.PROP_BAND_EX_ONLY)) {                item[JV.PROP_BAND_EX_ONLY] = JpcCommonHelper.getBoolean(bandNode[JV.PROP_BAND_EX_ONLY]);            }            if (bandNode[JV.BAND_PROP_MERGE_BORDER]) {                item[JV.BAND_PROP_MERGE_BORDER] = bandNode[JV.BAND_PROP_MERGE_BORDER];            }            if (bandNode[JV.BAND_PROP_SUB_BANDS]) {                for (let i = 0; i < bandNode[JV.BAND_PROP_SUB_BANDS].length; i++) {                    me.createSingle(bandNode[JV.BAND_PROP_SUB_BANDS][i], parentObj, rptTpl, defProperties);                }            }            parentObj[bandNode[JV.BAND_PROP_NAME]] = item;            if (item[JV.BAND_PROP_MERGE_BORDER] !== null && item[JV.BAND_PROP_MERGE_BORDER] !== undefined && item[JV.BAND_PROP_MERGE_BORDER] === 'T') {                parentObj[JV.BAND_PROP_MERGE_BAND] = item;            }        }    },};module.exports = JpcBand;
 |