Lines Matching +full:add +full:- +full:matcher
11 /* ---------- Utilities ---------- */
15 * Returns js-"class" of value
17 * @param val {any type} - value
18 * @returns {string} - for example, "[object Function]"
26 * In other cases - throws an exception
28 * @param val {any type} - the value for new node
62 * @param obj {Object | Array} - a list or a dict with child nodes
63 * @param func {Function} - the function for each item
71 isLast = obj.length - 1;
82 isLast = keys.length - 1;
98 * @param Child {Function} - a child constructor
99 * @param Parent {Function} - a parent constructor
114 * @param {any type} jsonObj - a value for root node
115 * @returns {boolean} - true for an object or an array, false otherwise
140 /* ---------- Node constructors ---------- */
155 * <span class="jsontree_label-wrapper">
157 * <span class="jsontree_expand-button" />
167 * @param label {string} - key name
168 * @param val {Object | Array | string | number | boolean | null} - a value of node
169 * @param isLast {boolean} - true if node is last in list of siblings
202 * <span class="jsontree_label-wrapper">
211 * @param label {string} - key name
212 * @param val {string | number | boolean | null} - a value of simple types
213 * @param isLast {boolean} - true if node is last in list of parent childNodes
225 <span class="jsontree_label-wrapper">\
230 <span class="jsontree_value-wrapper">\
243 el.classList.add('jsontree_node');
271 this.el.classList.add('jsontree_node_marked');
291 * @param isRecursive {boolean} - if true, expands all parent nodes
304 * Returns JSON-path of this
306 * @param isInDotNotation {boolean} - kind of notation for returned json-path
336 * @param label {string} - key name
337 * @param val {boolean} - value of boolean type, true or false
338 * @param isLast {boolean} - true if node is last in list of parent childNodes
356 * @param label {string} - key name
357 * @param val {number} - value of number type, for example 123
358 * @param isLast {boolean} - true if node is last in list of parent childNodes
376 * @param label {string} - key name
377 * @param val {string} - value of string type, for example "abc"
378 * @param isLast {boolean} - true if node is last in list of parent childNodes
395 * @param label {string} - key name
396 * @param val {null} - value (only null)
397 * @param isLast {boolean} - true if node is last in list of parent childNodes
416 * <span class="jsontree_label-wrapper">
418 * <span class="jsontree_expand-button" />
425 * <ul class="jsontree_child-nodes" />
432 * @param label {string} - key name
433 * @param val {Object | Array} - a value of complex types, object or array
434 * @param isLast {boolean} - true if node is last in list of parent childNodes
446 <div class="jsontree_value-wrapper">\
449 <span class="jsontree_show-more">…</span>\
450 <ul class="jsontree_child-nodes"></ul>\
457 <span class="jsontree_label-wrapper">\
459 '<span class="jsontree_expand-button"></span>' +
475 el.classList.add('jsontree_node');
476 el.classList.add('jsontree_node_complex');
479 childNodesUl = el.querySelector('.jsontree_child-nodes');
483 moreContentEl = el.querySelector('.jsontree_show-more');
509 el.classList.add('jsontree_node_expanded');
522 el.classList.add('jsontree_node_empty');
532 * Add child node to list of child nodes
534 * @param child {Node} - child node
545 * @param isRecursive {boolean} - if true, expands all child nodes
553 this.el.classList.add('jsontree_node_expanded');
568 * @param isRecursive {boolean} - if true, collapses all child nodes
591 * @param {boolean} isRecursive - Expand all child nodes if this node is expanded
615 * @param {Function} matcher
619 findChildren : function(matcher, handler, isRecursive) {
625 if (matcher(item)) {
630 item.findChildren(matcher, handler, isRecursive);
645 * @param label {string} - key name
646 * @param val {Object} - value of object type, {"abc": "def"}
647 * @param isLast {boolean} - true if node is last in list of siblings
666 * @param label {string} - key name
667 * @param val {Array} - value of array type, [1,2,3]
668 * @param isLast {boolean} - true if node is last in list of siblings
679 /* ---------- The tree constructor ---------- */
684 * CSS-styles of .tree define main tree styles like font-family,
685 * font-size and own margins.
693 * @param jsonObj {Object | Array} - data for tree
694 * @param domEl {DOMElement} - DOM-element, wrapper for tree
714 * @param {Object | Array} jsonObj - json-data
730 * Appends tree to DOM-element (or move it to new place)
741 * @param {Function} filterFunc - 'true' if this node should be expanded
767 * Returns the source json-string (pretty-printed)
769 * @param {boolean} isPrettyPrinted - 'true' for pretty-printed string
770 * @returns {string} - for exemple, '{"a":2,"b":3}'
789 findAndHandle : function(matcher, handler) {
790 this.rootNode.findChildren(matcher, handler, 'isRecursive');
806 /* ---------- Public methods ---------- */
809 * Creates new tree by data and appends it to the DOM-element
811 * @param jsonObj {Object | Array} - json-data
812 * @param domEl {DOMElement} - the wrapper element