/** * Hack module to handle WebResource handling problems in both * the unified and traditional web UI. Includes functions when * shimming or working with WebResource initialization processing. */ import {CLIENT, DEBUG} from "BuildSettings" /** * In targetWindow (defaults to this window), search for an iframe with * the specific id and return the attribute. */ export function getAttributeFromIFrame(frameId: string, attribute: string, targetWindow: Window = window): T | null { for(let i=0; i) { for (var property in propertyObject) { el.style[property] = propertyObject[property] } } export interface AdjustProps { [styleName: string]: string } export const uciFormLineProps: AdjustProps = { borderBottom: "1px solid rgb(216, 216, 216)", flexDirection: "row", minHeight: "49px", marginLeft: "23px", height: "49px" } /** * Adjust parent object assuming "this" el is * a web resource. Do nothing if layout is not UNIFIED. Uses "guessLayout". * Write your own adjustment function if you do not like this version. */ export function adjustFormLineForUci(props: AdjustProps = uciFormLineProps) { if (guessLayout() === "UNIFIED") { const p = findParentOfIFrame() if(p) setStyle(p, props) } } /** * Search up the parent, starting at `start`'s parent, until * predicate is true or return null. */ export function findParent(start: Node | null, predicate: (el: Node) => boolean): Node | null { if (!start) return null let current = start.parentNode while (current != null) { if (predicate(current)) return current current = current.parentNode } return null } /** * Given a target, if its is an