예제 #1
0
 def lay_tbl_body(self, snz, sny, closed_x, position):
     r_code = None if sny.origin is None else sny.origin.get_rc_label()
     if not r_code:
         r_code = f'r{position}'
     cnt = -1
     for snx in closed_x:
         if snx.is_abstract:
             continue
         cnt += 1
         c_code = snx.origin.get_rc_label(
         ) if snx.origin is not None else ''
         if not c_code:
             c_code = f'c{cnt}'
         cls = 'xbrl_grayed' if sny.is_abstract else 'xbrl_fact'
         lbl = f'{sny.get_caption().strip()}/{snx.get_caption().strip()}'
         c = cell.Cell(label=lbl,
                       html_class=cls,
                       is_fact=True,
                       r_code=r_code,
                       c_code=c_code,
                       is_grayed=sny.is_abstract)
         self.new_cell(c)
         self.lay_constraint_set({'x': snx, 'y': sny, 'z': snz}, c)
         if not self.validate(c):
             c.is_grayed = True
             c.html_classes.add('xbrl_grayed')
예제 #2
0
 def lay_closed_y_header(self, sny, rc):
     sny_rc_cap = sny.origin.get_rc_label(
     ) if sny.origin is not None else ""
     rc.add(sny_rc_cap)
     cls = f'xbrl_header_abstract' if sny.is_abstract else 'xbrl_header'
     self.new_cell(
         cell.Cell(label=sny.get_caption(False),
                   indent=sny.level * 10,
                   html_class=cls))
예제 #3
0
 def lay_y_agg(self, tbl, snz, sny, h_open, h_closed, position):
     rc = set({})
     self.new_row()
     if h_open['y']:
         self.lay_open_y_header(h_open['y'], rc)
     if sny is not None:
         self.lay_closed_y_header(sny, rc)
     if tbl.has_rc_labels:
         self.new_cell(cell.Cell(label=" ".join(rc), html_class='xbrl_rc'))
     self.lay_tbl_body(snz, sny, h_closed['x'], position)
예제 #4
0
 def lay_yx(self, tbl, snz, hdr, h_open, h_closed):
     for row, hx in hdr['x'].items():
         self.new_row()
         if row == 0:
             # Left upper cell
             colspan = len(h_open['y']) + (1 if h_closed['y'] else 0) + (
                 1 if tbl.has_rc_labels else 0)
             rowspan = len(hdr['x']) + (1 if tbl.has_rc_labels else 0)
             self.new_cell(
                 cell.Cell(label=tbl.get_rc_label(),
                           colspan=colspan,
                           rowspan=rowspan,
                           is_header=True,
                           html_class='xbrl_lu'))
         # X-Headers
         for snx in hx:
             if isinstance(snx.origin, breakdown.Breakdown) and snx.origin.is_open \
                     or isinstance(snx.origin, aspect_node.AspectNode):
                 continue
             colspan = snx.span if row == snx.level else 1
             cls = 'xbrl_fake' if snx.is_fake else 'xbrl_header'
             gry = snx.is_fake or snx.is_abstract
             self.new_cell(
                 cell.Cell(label=snx.get_caption(False),
                           colspan=colspan,
                           is_header=True,
                           html_class=cls,
                           is_fake=snx.is_fake))
     # Optional RC header
     self.new_row()
     for snx in h_closed['x']:
         if snx.is_abstract:
             continue
         self.new_cell(
             cell.Cell(label=''
                       if snx.origin is None else snx.origin.get_rc_label(),
                       is_header=True,
                       html_class='xbrl_rc'))
     self.lay_y(tbl, snz, h_open, h_closed)
예제 #5
0
 def lay_y(self, tbl, snz, h_open, h_closed):
     if h_open['y']:
         # Extra header for open-y nodes
         self.new_row()
         if h_closed['y']:
             # Extra cell for closed-Y nodes if any
             self.new_cell(cell.Cell(html_class='xbrl_header'))
         for sno in h_open['y']:
             self.new_cell(
                 cell.Cell(label=sno.get_rc_caption(),
                           html_class='xbrl_header'))
         if tbl.has_rc_labels:
             # Extra cell for RC labels if any
             self.new_cell(cell.Cell(html_class='xbrl_rc'))
         # Filling row with empty cells for extra open-Y header
         for snx in h_closed['x']:
             if snx.is_abstract:
                 continue
             self.new_cell(cell.Cell(html_class='xbrl_other'))
     cnt = -1
     for sny in h_closed['y']:
         cnt += 1
         self.lay_y_agg(tbl, snz, sny, h_open, h_closed, cnt)
예제 #6
0
 def lay_open_y_header(self, open_y, rc):
     for sno in open_y:
         rc.add(sno.origin.get_rc_label())
         self.new_cell(cell.Cell(html_class='xbrl_header'))