示例#1
0
  def add_tab(self, name: str):
    """
    Description:
    ------------
    Add a tab to the panel.

    Attributes:
    ----------
    :param str name: The name of the new tab.
    """
    return JsFncs.JsFunctions([
      JsObjects.JsNodeDom.JsDoms.new("div", js_code="new_table"),
      JsObjects.JsNodeDom.JsDoms.new("div", js_code="new_table_content"),
      JsObjects.JsNodeDom.JsDoms.get("new_table").css({
        "width": "100px", "display": 'inline-block', "vertical-align": "middle", "box-sizing": 'border-box',
        'text-align': 'left'}),
      JsObjects.JsNodeDom.JsDoms.get("new_table_content").innerText(name),
      JsObjects.JsNodeDom.JsDoms.get("new_table_content").setAttribute("name", self.component.tabs_name),
      JsObjects.JsNodeDom.JsDoms.get("new_table_content").css({"width": "100px"}),
      JsObjects.JsNodeDom.JsDoms.get("new_table_content").css(self.component.options.css_tab),
      JsObjects.JsNodeDom.JsDoms.get("new_table_content").css({"padding": '5px 0'}),
      JsObjects.JsNodeDom.JsDoms.get("new_table").appendChild(JsObjects.JsObjects.get("new_table_content")),
      JsObjects.JsNodeDom.JsDoms.new("div", js_code="tab_container"),
      self.querySelector("div").appendChild(JsObjects.JsObjects.get("new_table")),
     ])
示例#2
0
 def add_tab(self, name):
     return JsFncs.JsFunctions([
         JsObjects.JsNodeDom.JsDoms.new("div", varName="new_table"),
         JsObjects.JsNodeDom.JsDoms.new("div", varName="new_table_content"),
         JsObjects.JsNodeDom.JsDoms.get("new_table").css({
             "width":
             "100px",
             "display":
             'inline-block',
             "vertical-align":
             "middle",
             "box-sizing":
             'border-box',
             'text-align':
             'left'
         }),
         JsObjects.JsNodeDom.JsDoms.get("new_table_content").innerText(
             name),
         JsObjects.JsNodeDom.JsDoms.get("new_table_content").setAttribute(
             "name", self._src.tabs_name),
         JsObjects.JsNodeDom.JsDoms.get("new_table_content").css(
             {"width": "100px"}),
         JsObjects.JsNodeDom.JsDoms.get("new_table_content").css(
             self._src.options.css_tab),
         JsObjects.JsNodeDom.JsDoms.get("new_table_content").css(
             {"padding": '5px 0'}),
         JsObjects.JsNodeDom.JsDoms.get("new_table").appendChild(
             JsObjects.JsObjects.get("new_table_content")),
         JsObjects.JsNodeDom.JsDoms.new("div", varName="tab_container"),
         self.querySelector("div").appendChild(
             JsObjects.JsObjects.get("new_table")),
     ])
示例#3
0
文件: JsHtml.py 项目: ylwb/epyk-ui
  def release(self, by_name=False):
    """
    Description:
    -----------

    Attributes:
    ----------
    :param by_name:
    """
    if by_name:
      fncs = JsFncs.JsFunctions(self.by_name.css("color", ''))
      fncs.append(self.by_name.css("background-color", ''))
      fncs.append(self.by_name.css("cursor", "pointer"))
      fncs.append(self.by_name.attr('data-locked', False))
    else:
      fncs = JsFncs.JsFunctions(self.css("color", ''))
      fncs.append(self.css("background-color", ''))
      fncs.append(self.css("cursor", "pointer"))
      fncs.append(self.attr('data-locked', False))
    return fncs
示例#4
0
文件: JsHtml.py 项目: ylwb/epyk-ui
  def disable(self, bool=True):
    """
    Description:
    -----------

    Attributes:
    ----------
    :param bool:
    """
    bool = JsUtils.jsConvertData(bool, None)
    return JsFncs.JsFunctions("%s.disabled = %s" % (self.varName, bool))
示例#5
0
 def open(self):
   """
   Description:
   ------------
   Open the sliding panel.
   """
   return JsFncs.JsFunctions([
     self.page.js.if_(self.component.icon.dom.content.toString().indexOf(self.component.options.icon_closed.split(" ")[-1]) >= 0, [
       self.page.js.getElementsByName("panel_%s" % self.htmlCode).first.toggle(),
       self.component.icon.dom.switchClass(self.component.options.icon_closed, self.component.options.icon_expanded)
     ])
   ])
示例#6
0
 def deselect_tabs(self):
   """
   Description:
   ------------
   Deselect all the tabs in the component.
   """
   return JsFncs.JsFunctions([
     self.page.js.getElementsByName(self.component.tabs_name).all([
       self.page.js.data.all.element.setAttribute("data-selected", False),
       self.page.js.getElementsByName(self.component.tabs_name).all([
         self.page.js.data.all.element.css(self.component.options.tab_not_clicked_style())])
     ])
   ])
示例#7
0
文件: JsHtml.py 项目: ylwb/epyk-ui
  def target(self, name):
    """
    Description:
    -----------
    The target attribute specifies where to open the linked document.

    Related Pages:
    --------------
    https://www.w3schools.com/tags/att_a_target.asp

    :param url:
    """
    name = JsUtils.jsConvertData(name, None)
    return JsFncs.JsFunctions("%s.target = %s" % (self.varName, name))
示例#8
0
文件: JsHtml.py 项目: ylwb/epyk-ui
  def href(self, url):
    """
    Description:
    -----------
    The href attribute specifies the URL of the page the link goes to.

    Related Pages:
    --------------
    https://www.w3schools.com/tags/att_a_href.asp

    :param url:
    """
    url = JsUtils.jsConvertData(url, None)
    return JsFncs.JsFunctions("%s.href = %s" % (self.varName, url))
示例#9
0
文件: JsHtml.py 项目: ylwb/epyk-ui
  def lock(self, not_allowed=True):
    """
    Description:
    -----------

    Attributes:
    ----------
    :param not_allowed:
    """
    fncs = JsFncs.JsFunctions(self.css("color", self.getComputedStyle('color')))
    fncs.append(self.css("background-color", self.getComputedStyle('background-color')))
    if not_allowed:
      fncs.append(self.css("cursor", "not-allowed"))
      fncs.append(self.attr('data-locked', True))
    else:
      fncs.append(self.css("cursor", "default"))
      fncs.append(self.attr('data-locked', True))
    return fncs
示例#10
0
文件: JsHtml.py 项目: ylwb/epyk-ui
 def src(self, image):
   image = JsUtils.jsConvertData(image, None)
   return JsFncs.JsFunctions("%s.src = %s" % (self.varName, image))