Esempio n. 1
0
    def toggleClass(self, cls_name, delay):
        """
    Toggle class(es) on elements while animating all style changes.

    Related Pages:

      https://jqueryui.com/toggleClass/

    :param cls_name:
    :param delay:

    :return:
    """
        cls_name = JsUtils.jsConvertData(cls_name, None)
        self._js.append("toggleClass(%s, %s)" % (cls_name, delay))
        return self
Esempio n. 2
0
    def setOptions(self, options):
        """
    Description:
    -----------
    Update options of Graph3d. The provided options will be merged with current options.

    Related Pages:

      https://visjs.github.io/vis-graph3d/docs/graph3d/

    Attributes:
    ----------
    :param options:
    """
        return self.fnc_closure("setOptions(%s)" %
                                JsUtils.jsConvertData(options, None))
Esempio n. 3
0
    def setData(self, data):
        """
    Description:
    -----------
    Replace the data in the Graph3d.

    Related Pages:

      https://visjs.github.io/vis-graph3d/docs/graph3d/

    Attributes:
    ----------
    :param data:
    """
        return self.fnc_closure("setData(%s)" %
                                JsUtils.jsConvertData(data, None))
Esempio n. 4
0
    def animate(self, css=None, delay=None):
        """
    Animate the properties of elements between colors.

    Related Pages:

      https://jqueryui.com/animate/

    :param css:
    :param delay:

    :return:
    """
        self._js.append("animate(%s, %s)" %
                        (JsUtils.jsConvertData(css, None), delay))
        return self
Esempio n. 5
0
    def revert(self, target: Union[str, list, primitives.JsDataModel] = None):
        """
    Description:
    -----------
    Export chart as an image.

    Related Pages:

      https://naver.github.io/billboard.js/release/latest/doc/Chart.html#export

    Attributes:
    ----------
    :param Union[str, list, primitives.JsDataModel] target: ids to be reverted.
    """
        target = JsUtils.jsConvertData(target, None)
        return JsObjects.JsVoid("%s.revert(%s)" % (self._selector, target))
Esempio n. 6
0
    def getNamedItem(self, node_name: Union[str, primitives.JsDataModel]):
        """
    Description:
    ------------
    The getNamedItem() method returns the attribute node with the specified name from a NamedNodeMap object.

    Related Pages:

      https://www.w3schools.com/jsref/met_namednodemap_getnameditem.asp

    Attributes:
    ----------
    :param Union[str, primitives.JsDataModel] node_name: The name of the node in the namedNodeMap you want to return.

    :return: A Node object, representing the attribute node with the specified name.
    """
        return "getNamedItem(%s)" % JsUtils.jsConvertData(node_name, None)
Esempio n. 7
0
    def destroy(self, remove=False, checkUndefined=False):
        """
    Restore the tables in the current context to its original state in the DOM by removing all of DataTables enhancements,
    alterations to the DOM structure of the table and event listeners.

    Related Pages:

      https://datatables.net/reference/api/destroy()

    :param remove: Boolean, Completely remove the table from the DOM (true) or leave it in the DOM in its original plain un-enhanced HTML state (default, false).
    :param checkUndefined: Boolean

    :return:
    """
        return self.fnc_closure("destroy(%s)" %
                                JsUtils.jsConvertData(remove, None),
                                checkUndefined=checkUndefined)
Esempio n. 8
0
    def getRowNode(self, row_id):
        """
    Description:
    -----------
    Returns the row node with the given ID. The row node ID is the one you provide with the callback getRowNodeId(data),
    otherwise the ID is a number auto generated by the grid when the row data is set.

    Related Pages:

      https://www.ag-grid.com/javascript-grid-api/

    Attributes:
    ----------
    :param row_id:
    """
        row_id = JsUtils.jsConvertData(row_id, None)
        return JsObjects.JsVoid("%s.api.getRowNode(%s)" % (self.varId, row_id))
Esempio n. 9
0
    def setRowData(self, rows):
        """
    Description:
    -----------
    Set rows.

    Related Pages:

      https://www.ag-grid.com/javascript-grid-api/

    Attributes:
    ----------
    :param rows:
    """
        return JsObjects.JsVoid(
            "%s.api.setRowData(%s)" %
            (self.varId, JsUtils.jsConvertData(rows, None)))
Esempio n. 10
0
    def setColumnDefs(self, col_defs: Any):
        """
    Description:
    -----------
    Call to set new column definitions. The grid will redraw all the column headers, and then redraw all of the rows.

    Related Pages:

      https://www.ag-grid.com/javascript-grid-api/

    Attributes:
    ----------
    :param col_defs:
    """
        return JsObjects.JsVoid(
            "%s.api.setColumnDefs(%s)" %
            (self.varId, JsUtils.jsConvertData(col_defs, None)))
Esempio n. 11
0
    def getColumnGroup(self, name):
        """
    Description:
    -----------
    Returns the column group with the given name.

    Related Pages:

      https://www.ag-grid.com/javascript-grid-column-api/

    Attributes:
    ----------
    :param name:
    """
        return JsObjects.JsVoid(
            "%s.getColumnGroup(%s)" %
            (self.varId, JsUtils.jsConvertData(name, None)))
Esempio n. 12
0
    def series(self, names):
        """
    Description:
    ------------

    Attributes:
    ----------
    :param names:
    """
        names = JsUtils.jsConvertData(names, None)
        return JsObjects.JsArray.JsArray.get('''
      (function(records, cols){
        var vector = []; records.forEach(function(rec){
          var row = []; cols.forEach(function(r){row.push(rec[r])}); vector.push(row)});
        return vector
      })(%s, %s)
      ''' % (self.varName, names))
Esempio n. 13
0
  def append(self, html_type, set_var=True):
    """
    Description:
    -----------
    If the specified type is a string, appends a new element of this type (tag name) as the last child of each
    selected element, or before the next following sibling in the update selection if this is an enter selection.

    Related Pages:

      https://github.com/d3/d3-selection/blob/v1.4.0/README.md#selecting-elements

    Attributes:
    ----------
    :param html_type:
    :param bool set_var:
    """
    return self.fnc("append(%s)" % JsUtils.jsConvertData(html_type, None))
Esempio n. 14
0
File: std.py Progetto: ylwb/epyk-ui
def querySelectorAll(selector):
    """
  Description:
  ------------
  The querySelectorAll() method returns all elements in the document that matches a specified CSS selector(s), as a static NodeList object.

  Related Pages:

      https://www.w3schools.com/jsref/met_document_queryselectorall.asp

  Attributes:
  ----------
  :param selector: String. CSS selectors
  """
    return JsDomsList("document.querySelectorAll(%s)" %
                      JsUtils.jsConvertData(selector, None),
                      isPyData=False)
Esempio n. 15
0
    def disable(self, flag):
        """
    Description:
    ------------
    Disable the selection component.

    Related Pages:

      https://developer.snapappointments.com/bootstrap-select/methods/

    Attributes:
    ----------
    :param flag: Boolean. A flag to specify the status of the component.
    """
        flag = JsUtils.jsConvertData(flag, None)
        return JsObjects.JsObjects.get("%s.prop('disabled', %s)" %
                                       (self.component.dom.jquery.varId, flag))
Esempio n. 16
0
    def toggleSeries(self, series_name):
        """
    Description:
    -----------
    This method allows you to toggle the visibility of series programmatically. Useful when you have a custom legend.

    Related Pages:

      https://apexcharts.com/docs/methods/#toggleSeries

    Attributes:
    ----------
    :param series_name: String. The series name which you want to toggle visibility for.
    """
        series_name = JsUtils.jsConvertData(series_name, None)
        return JsObjects.JsVoid("%s.toggleSeries(%s)" %
                                (self.varName, series_name))
Esempio n. 17
0
    def appendData(self, new_data):
        """
    Description:
    -----------
    This method allows you to append new data to the series array.
    If you have existing multiple series, provide the new array in the same indexed order.

    Related Pages:

      https://apexcharts.com/docs/methods/#appendData

    Attributes:
    ----------
    :param new_data: List. The data array to append the existing series datasets.
    """
        new_data = JsUtils.jsConvertData(new_data, None)
        return JsObjects.JsVoid("%s.appendData(%s)" % (self.varName, new_data))
Esempio n. 18
0
    def send(self, msg):
        """
    Description:
    ------------
    This will send an event called message(built in) to our client, four seconds after the client connects.
    The send function on socket object associates the 'message' event.

    Usage::

      https://www.tutorialspoint.com/socket.io/socket.io_event_handling.htm

    Attributes:
    ----------
    :param msg:
    """
        msg = JsUtils.jsConvertData(msg, None)
        return JsObjects.JsVoid("%s.send(%s)" % (self._selector, msg))
Esempio n. 19
0
    def custom(self, func_nam, *argv):
        """
    Description:
    ------------
    Generic function to call any missing function form a package.
    This will automatically convert the object to JavaScript and also put the right object reference.

    Attributes:
    ----------
    :param func_nam: String. The function name
    :param argv: Objects. Optional. The function arguments on the JavasScript side
    """
        js_args = []
        for arg in argv:
            js_args.append(str(JsUtils.jsConvertData(arg, None)))
        return JsObjects.JsObject.JsObject.get(
            "%s.%s(%s)" % (self.varId, func_nam, ", ".join(js_args)))
Esempio n. 20
0
    def update(self, attrs: Union[Datamap, dict]):
        """
    Description:
    ------------

    Attributes:
    ----------
    :param Union[Datamap, dict] attrs:
    """
        appends = []
        if isinstance(attrs, Datamap):
            for k, v in attrs._data:
                appends.append(self.append(k, v))
        else:
            for k, v in attrs.items():
                appends.append(self.append(k, JsUtils.jsConvertData(v, None)))
        return appends
Esempio n. 21
0
    def getColumn(self, name):
        """
    Description:
    -----------
    Returns the column with the given colKey, which can either be the colId (a string) or the colDef (an object).

    Related Pages:

      https://www.ag-grid.com/javascript-grid-column-api/

    Attributes:
    ----------
    :param name:
    """
        return JsObjects.JsVoid(
            "%s.getColumn(%s)" %
            (self.varId, JsUtils.jsConvertData(name, None)))
Esempio n. 22
0
    def effectAllowed(self, flag: Union[bool, primitives.JsDataModel] = False):
        """
    Description:
    -----------

    Related Pages:

      https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer/effectAllowed
    """
        if flag == False:
            return JsBoolean.JsBoolean("%s.effectAllowed" % self.varId)

        if flag not in [None, 'move', 'link', 'copy']:
            raise ValueError("")

        flag = JsUtils.jsConvertData(flag, None)
        return JsFncs.JsFunction("%s.effectAllowed = %s" % (self.varId, flag))
Esempio n. 23
0
    def applyTransaction(self, transaction):
        """
    Description:
    -----------
    Update row data. Pass a transaction object with lists for add, remove and update.

    Related Pages:

      https://www.ag-grid.com/javascript-grid-api/

    Attributes:
    ----------
    :param transaction:
    """
        return JsObjects.JsVoid(
            "%s.api.applyTransaction(%s)" %
            (self.varId, JsUtils.jsConvertData(transaction, None)))
Esempio n. 24
0
    def showColumn(self, column):
        """
    Description:
    ------------
    You can show a hidden column at any point using the showColumn function. Pass the field name of the column you wish to show as the first parameter of the function.

    Related Pages:

			http://tabulator.info/docs/4.0/columns

    Attributes:
    ----------
    :param column: String. The column name to be displayed
    """
        return JsObjects.JsPromise(
            "%s.showColumn(%s)" %
            (self.varId, JsUtils.jsConvertData(column, None)))
Esempio n. 25
0
    def info(self, jsFlag=None):
        """
    Get / set the information summary display state.

    Related Pages:

      https://datatables.net/reference/api/select.info()

    :param jsFlag: Value to set for the information summary display state - true to enable, false to disable.
    :return:
    """
        if jsFlag is None:
            return JsObjects.JsBoolean.JsBoolean("%s.info()" % self._selector)

        return JsObjects.JsObject.JsObject(
            "%s.info(%s)" %
            (self._selector, JsUtils.jsConvertData(jsFlag, None)))
Esempio n. 26
0
  def tickValues(self, values):
    """
    Description:
    ------------
    Chart axis settings.

    Usage::

       chart.xAxis.tickValues(10)

    Attributes:
    ----------
    :param values:
    """
    values = JsUtils.jsConvertData(values, None)
    self._js.append("tickValues(%s)" % values)
    return self
Esempio n. 27
0
    def order(self, data=None):
        """

    Example


    Related Pages:

      https://datatables.net/reference/api/order()

    :return:
    """
        if data is not None:
            data = JsUtils.jsConvertData(data, None)
            return self.fnc("order(%s)" % data)

        return self.fnc("order()")
Esempio n. 28
0
  def donutRatio(self, value):
    """
    Description:
    ------------
    Configure how big you want the donut hole size to be.

    Related Pages:

      http://nvd3.org/examples/pie.html

    Attributes:
    ----------
    :param value:
    """
    self.donut(True)
    self.fnc("donutRatio(%s)" % JsUtils.jsConvertData(value, None))
    return self
Esempio n. 29
0
  def abort(self, reason: Union[str, primitives.JsDataModel] = None):
    """
    Description:
    ------------
    The abort() method of the WritableStream interface aborts the stream, signaling that the producer can no longer
    successfully write to the stream and it is to be immediately moved to an error state, with any queued writes
    discarded.

    Related Pages:

      https://developer.mozilla.org/en-US/docs/Web/API/WritableStream/abort
    """
    if reason is None:
      return JsObjects.JsPromise("%s.abort()" % self.varId)

    reason = JsUtils.jsConvertData(reason, None)
    return JsObjects.JsPromise("%s.abort(%s)" % (self.varId, reason))
Esempio n. 30
0
  def axisLabel(self, text: str):
    """
    Description:
    ------------
    Chart axis settings.

    Usage::

      chart.xAxis.axisLabel('Time (ms)')

    Attributes:
    ----------
    :param text: String.
    """
    text = JsUtils.jsConvertData(text, None)
    self._js.append("axisLabel(%s)" % text)
    return self