From d89ed1ae77eecbeae082d690868934c5b0e492e0 Mon Sep 17 00:00:00 2001 From: Nikolai Ommundsen Date: Wed, 6 Jun 2018 13:17:51 +0200 Subject: [PATCH 1/4] Support extension options --- types/jquery.fancytree/index.d.ts | 278 +++++++++++++++++++++--------- 1 file changed, 194 insertions(+), 84 deletions(-) diff --git a/types/jquery.fancytree/index.d.ts b/types/jquery.fancytree/index.d.ts index 34d90d9e8f..70f3f7a2de 100644 --- a/types/jquery.fancytree/index.d.ts +++ b/types/jquery.fancytree/index.d.ts @@ -303,7 +303,7 @@ declare namespace Fancytree { * @param map callback function(NodeData) that could modify the new node * @returns new node. */ - copyTo(node: FancytreeNode, mode?: string, map?: (node: NodeData) => void) : FancytreeNode; + copyTo(node: FancytreeNode, mode?: string, map?: (node: NodeData) => void): FancytreeNode; /** Count direct and indirect children. * @@ -528,7 +528,7 @@ declare namespace Fancytree { resetLazy(): void; /** Schedule activity for delayed execution (cancel any pending request). scheduleAction('cancel') will only cancel a pending request (if any). */ - scheduleAction(mode: string, ms: number) : void; + scheduleAction(mode: string, ms: number): void; /** * @param effects animation options. @@ -757,7 +757,7 @@ declare namespace Fancytree { /** Accept passing ajax data in a property named `d` (default: true). */ enableAspx?: boolean; /** List of active extensions (default: []) */ - extensions?: string[]; + extensions?: Array; /** Set focus when node is checked by a mouse click (default: false) */ focusOnSelect?: boolean; /** Add `id="..."` to node markup (default: true). */ @@ -792,91 +792,201 @@ declare namespace Fancytree { titlesTabbable?: boolean; /** Animation options, false:off (default: { effect: "blind", options: {direction: "vertical", scale: "box"}, duration: 200 }) */ toggleEffect?: JQueryUI.EffectOptions; + + //////////////// + // EXTENSIONS // + //////////////// + dnd5?: ExtensionDragAndDrop5; + filter?: ExtensionFilter; + table?: ExtensionTable; + + /** Options for misc extensions - see docs for typings */ + [extension: string]: any; } - - /** Data object passed to FancytreeNode() constructor. Note: typically these attributes are accessed by meber methods, e.g. `node.isExpanded()` and `node.setSelected(false)`. */ - interface NodeData { - /** node text (may contain HTML tags) */ - title: string; - icon?: string; - /** unique key for this node (auto-generated if omitted) */ - key?: string; - /** (reserved) */ - refKey?: string; - expanded?: boolean; - /** (initialization only, but will not be stored with the node). */ - active?: boolean; - /** (initialization only, but will not be stored with the node). */ - focus?: boolean; - folder?: boolean; - hideCheckbox?: boolean; - lazy?: boolean; - selected?: boolean; - unselectable?: boolean; - /** optional array of child nodes */ - children?: NodeData[]; - tooltip?: string; - /** class names added to the node markup (separate with space) */ - extraClasses?: string; - /** all properties from will be copied to `node.data` */ - data?: Object; + interface Extensions { + dnd5?: ExtensionDragAndDrop5; + filter?: ExtensionFilter; + table?: ExtensionTable; + [extension: string]: any; } - - /** Data object similar to NodeData, but with additional options. - * May be passed to FancytreeNode#applyPatch (Every property that is omitted (or set to undefined) will be ignored) */ - interface NodePatch { - /** (not yet implemented) */ - appendChildren?: NodeData; - /** (not yet implemented) */ - replaceChildren?: NodeData; - /** (not yet implemented) */ - insertChildren?: NodeData; + interface ExtensionDragAndDrop5 { + /** + * Expand nodes after n milliseconds of hovering. + */ + autoExpandMS?: number; + /** + * Absolute position offset for .fancytree-drop-marker + */ + dropMarkerOffsetX?: number; + /** + * Additional offset for drop-marker with hitMode = "before"/"after" + */ + dropMarkerInsertOffsetX?: number; + /** + * true: Drag multiple (i.e. selected) nodes. + */ + multiSource?: boolean; + /** + * Prevent dropping nodes from different Fancytrees + */ + preventForeignNodes?: boolean; + /** + * Prevent dropping items other than Fancytree nodes + */ + preventNonNodes?: boolean; + /** + * Prevent dropping nodes on own descendants + */ + preventRecursiveMoves?: boolean; + /** + * Prevent dropping nodes 'before self', etc. + */ + preventVoidMoves?: boolean; + /** + * Enable auto-scrolling while dragging + */ + scroll?: boolean; + /** + * Active top/bottom margin in pixel + */ + scrollSensitivity?: number; + /** + * Pixel per event + */ + scrollSpeed?: number; + /** + * Core options + */ + source: { + url: string; + } + /** + * Events (drag support) + */ + dragStart?: (sourceNode: FancytreeNode, data: any) => void; + /** + * Events (drop support) + */ + dragEnter: (targetNode: FancytreeNode, data: any) => void; + /** + * Events (drag over) + */ + dragOver: (targetNode: FancytreeNode, data: any) => void; + /** + * Events (drag drop) + */ + dragDrop: (node: FancytreeNode, data: any) => void; + /** + * Support misc options + */ + [key: string]: any; } - - /** May be passed to Fancytree#applyPatch. */ - interface TreePatch { - [key: string]: NodePatch; + /** + * Define filter-extension options + */ + interface ExtensionFilter { + mode: string; + /** + * Support misc options + */ + [key: string]: any; } - - interface FancytreeStatic { - buildType: string; - debugLevel: number; - version: string; - - /** Throw an error if condition fails (debug method). */ - assert(cond: boolean, msg: string): void; - - /** Return a function that executes *fn* at most every *timeout* ms. */ - debounce void>(timeout: number, fn: T, invokeAsap?: boolean, ctx?: any): T; - - debug(msg: string): void; - - error(msg: string): void; - - escapeHtml(s: string): string; - - getEventTarget(event: Event): Object; - - getEventTargetType(event: Event): string; - - getNode(el: JQuery): FancytreeNode; - getNode(el: Event): FancytreeNode; - getNode(el: Element): FancytreeNode; - - info(msg: string): void; - - /** Convert a keydown event to a string like 'ctrl+a', 'ctrl+shift+f2'. */ - keyEventToString(event: Event): string; - - /** Parse tree data from HTML markup */ - parseHtml($ul: JQuery): NodeData[]; - - /** Add Fancytree extension definition to the list of globally available extensions. */ - registerExtension(definition: Object): void; - - unescapeHtml(s: string): string; - - warn(msg: string): void; + /** + * Define table-extension options + */ + interface ExtensionTable { + indentation: number; + nodeColumnIdx: number; + /** + * Support misc options + */ + [key: string]: any; } } +/** Data object passed to FancytreeNode() constructor. Note: typically these attributes are accessed by meber methods, e.g. `node.isExpanded()` and `node.setSelected(false)`. */ +interface NodeData { + /** node text (may contain HTML tags) */ + title: string; + icon?: string; + /** unique key for this node (auto-generated if omitted) */ + key?: string; + /** (reserved) */ + refKey?: string; + expanded?: boolean; + /** (initialization only, but will not be stored with the node). */ + active?: boolean; + /** (initialization only, but will not be stored with the node). */ + focus?: boolean; + folder?: boolean; + hideCheckbox?: boolean; + lazy?: boolean; + selected?: boolean; + unselectable?: boolean; + /** optional array of child nodes */ + children?: NodeData[]; + tooltip?: string; + /** class names added to the node markup (separate with space) */ + extraClasses?: string; + /** all properties from will be copied to `node.data` */ + data?: Object; +} + +/** Data object similar to NodeData, but with additional options. + * May be passed to FancytreeNode#applyPatch (Every property that is omitted (or set to undefined) will be ignored) */ +interface NodePatch { + /** (not yet implemented) */ + appendChildren?: NodeData; + /** (not yet implemented) */ + replaceChildren?: NodeData; + /** (not yet implemented) */ + insertChildren?: NodeData; +} + +/** May be passed to Fancytree#applyPatch. */ +interface TreePatch { + [key: string]: NodePatch; +} + +interface FancytreeStatic { + buildType: string; + debugLevel: number; + version: string; + + /** Throw an error if condition fails (debug method). */ + assert(cond: boolean, msg: string): void; + + /** Return a function that executes *fn* at most every *timeout* ms. */ + debounce void>(timeout: number, fn: T, invokeAsap?: boolean, ctx?: any): T; + + debug(msg: string): void; + + error(msg: string): void; + + escapeHtml(s: string): string; + + getEventTarget(event: Event): Object; + + getEventTargetType(event: Event): string; + + getNode(el: JQuery): FancytreeNode; + getNode(el: Event): FancytreeNode; + getNode(el: Element): FancytreeNode; + + info(msg: string): void; + + /** Convert a keydown event to a string like 'ctrl+a', 'ctrl+shift+f2'. */ + keyEventToString(event: Event): string; + + /** Parse tree data from HTML markup */ + parseHtml($ul: JQuery): NodeData[]; + + /** Add Fancytree extension definition to the list of globally available extensions. */ + registerExtension(definition: Object): void; + + unescapeHtml(s: string): string; + + warn(msg: string): void; +} +} + From 6b02a536fbb9eb4def5bdedc9438d0c407baf852 Mon Sep 17 00:00:00 2001 From: Nikolai Ommundsen Date: Wed, 6 Jun 2018 14:06:07 +0200 Subject: [PATCH 2/4] Finalize changes and upped typescript version --- types/jquery.fancytree/index.d.ts | 479 +++++++++++------- .../jquery.fancytree-tests.ts | 20 +- 2 files changed, 298 insertions(+), 201 deletions(-) diff --git a/types/jquery.fancytree/index.d.ts b/types/jquery.fancytree/index.d.ts index 70f3f7a2de..de1e93c273 100644 --- a/types/jquery.fancytree/index.d.ts +++ b/types/jquery.fancytree/index.d.ts @@ -2,8 +2,9 @@ // Project: https://github.com/mar10/fancytree // Definitions by: Peter Palotas // Mahdi Abedi +// Nikolai Ommundsen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.8 /// @@ -737,7 +738,20 @@ declare namespace Fancytree { /** Make sure that the active node is always visible, i.e. its parents are expanded (default: true). */ activeVisible?: boolean; /** Default options for ajax requests. */ - ajax?: Object; + ajax?: { + /** + * HTTP Method (default: 'GET') + */ + type: string; + /** + * false: Append random '_' argument to the request url to prevent caching. + */ + cache: boolean; + /** + * Default 'json' -> Expect json format and pass json object to callbacks. + */ + dataType: string; + }; /** (default: false) Add WAI-ARIA attributes to markup */ aria?: boolean; /** Activate a node when focused with the keyboard (default: true) */ @@ -750,21 +764,23 @@ declare namespace Fancytree { checkbox?: boolean; /** Defines what happens, when the user click a folder node. (default: activate_dblclick_expands) */ clickFolderMode?: FancytreeClickFolderMode; - /** 0..2 (null: use global setting $.ui.fancytree.debugInfo) */ - debugLevel?: number; + /** 0..4 (null: use global setting $.ui.fancytree.debugInfo) */ + debugLevel?: 0 | 1 | 2 | 3 | 4; /** callback(node) is called for new nodes without a key. Must return a new unique key. (default null: generates default keys like that: "_" + counter) */ defaultKey?: (node: FancytreeNode) => string; /** Accept passing ajax data in a property named `d` (default: true). */ enableAspx?: boolean; + /** Enable titles (default: false) */ + enableTitles?: boolean; /** List of active extensions (default: []) */ - extensions?: Array; + extensions?: Array; /** Set focus when node is checked by a mouse click (default: false) */ focusOnSelect?: boolean; /** Add `id="..."` to node markup (default: true). */ generateIds?: boolean; - /** Display node icons (default: true) */ - icons?: boolean; - /** (default: "ft_") */ + /** Node icon url, if only filename, please use imagePath to set the path */ + icon?: boolean | string; + /** Prefix (default: "ft_") */ idPrefix?: string; /** Path to a folder containing icons (default: null, using 'skin/' subdirectory). */ imagePath?: string; @@ -776,217 +792,298 @@ declare namespace Fancytree { minExpandLevel?: number; /** navigate to next node by typing the first letters (default: false) */ quicksearch?: boolean; + /** Right to left mode (default: false) */ + rtl?: false; /** optional margins for node.scrollIntoView() (default: {top: 0, bottom: 0}) */ - scrollOfs?: Object; + scrollOfs?: { top: number, bottom: number }; /** scrollable container for node.scrollIntoView() (default: $container) */ - scrollParent?: JQuery; + scrollParent?: JQuery | null; /** default: multi_hier */ selectMode?: FancytreeSelectMode; /** Used to Initialize the tree. */ - source?: any; + source?: any[] | any; /** Translation table */ - strings?: Object; + strings?: TranslationTable; /** Add tabindex='0' to container, so tree can be reached using TAB */ tabbable?: boolean; /** Add tabindex='0' to node title span, so it can receive keyboard focus */ titlesTabbable?: boolean; /** Animation options, false:off (default: { effect: "blind", options: {direction: "vertical", scale: "box"}, duration: 200 }) */ toggleEffect?: JQueryUI.EffectOptions; + /** Tooltips */ + tooltip?: boolean; //////////////// // EXTENSIONS // //////////////// - dnd5?: ExtensionDragAndDrop5; - filter?: ExtensionFilter; - table?: ExtensionTable; + dnd5?: Extensions.DragAndDrop5; + filter?: Extensions.Filter; + table?: Extensions.Table; /** Options for misc extensions - see docs for typings */ [extension: string]: any; } - interface Extensions { - dnd5?: ExtensionDragAndDrop5; - filter?: ExtensionFilter; - table?: ExtensionTable; - [extension: string]: any; + + interface TranslationTable { + /** + * "Loading..." // … would be escaped when escapeTitles is true + */ + loading: string; + /** + * "Load error!" + */ + loadError: string; + /** + * "More..." + */ + moreData: string; + /** + * "No data." + */ + noData: string; } - interface ExtensionDragAndDrop5 { - /** - * Expand nodes after n milliseconds of hovering. - */ - autoExpandMS?: number; - /** - * Absolute position offset for .fancytree-drop-marker - */ - dropMarkerOffsetX?: number; - /** - * Additional offset for drop-marker with hitMode = "before"/"after" - */ - dropMarkerInsertOffsetX?: number; - /** - * true: Drag multiple (i.e. selected) nodes. - */ - multiSource?: boolean; - /** - * Prevent dropping nodes from different Fancytrees - */ - preventForeignNodes?: boolean; - /** - * Prevent dropping items other than Fancytree nodes - */ - preventNonNodes?: boolean; - /** - * Prevent dropping nodes on own descendants - */ - preventRecursiveMoves?: boolean; - /** - * Prevent dropping nodes 'before self', etc. - */ - preventVoidMoves?: boolean; - /** - * Enable auto-scrolling while dragging - */ - scroll?: boolean; - /** - * Active top/bottom margin in pixel - */ - scrollSensitivity?: number; - /** - * Pixel per event - */ - scrollSpeed?: number; - /** - * Core options - */ - source: { - url: string; + + namespace Extensions { + interface List { + dnd5?: DragAndDrop5; + filter?: Filter; + table?: Table; + [extension: string]: any; + } + + interface DragAndDrop5 { + /** + * Expand nodes after n milliseconds of hovering. + */ + autoExpandMS?: number; + /** + * Absolute position offset for .fancytree-drop-marker + */ + dropMarkerOffsetX?: number; + /** + * Additional offset for drop-marker with hitMode = "before"/"after" + */ + dropMarkerInsertOffsetX?: number; + /** + * true: Drag multiple (i.e. selected) nodes. + */ + multiSource?: boolean; + /** + * Prevent dropping nodes from different Fancytrees + */ + preventForeignNodes?: boolean; + /** + * Prevent dropping items other than Fancytree nodes + */ + preventNonNodes?: boolean; + /** + * Prevent dropping nodes on own descendants + */ + preventRecursiveMoves?: boolean; + /** + * Prevent dropping nodes 'before self', etc. + */ + preventVoidMoves?: boolean; + /** + * Enable auto-scrolling while dragging + */ + scroll?: boolean; + /** + * Active top/bottom margin in pixel + */ + scrollSensitivity?: number; + /** + * Pixel per event + */ + scrollSpeed?: number; + /** + * Allow dragging of nodes to different IE windows, default: false + */ + setTextTypeJson?: boolean; + /** + * Callback(sourceNode, data), return true, to enable dnd drag + */ + dragStart?: (sourceNode: FancytreeNode, data: any) => void; + dragDrag?: (sourceNode: FancytreeNode, data: any) => void; + dragEnd?: (sourceNode: FancytreeNode, data: any) => void; + /** + * Callback(targetNode, data), return true, to enable dnd drop + */ + dragEnter?: (targetNode: FancytreeNode, data: any) => void; + /** + * Events (drag over) + */ + dragOver?: (targetNode: FancytreeNode, data: any) => void; + /** + * Callback(targetNode, data), return false to prevent autoExpand + */ + dragExpand?: (targetNode: FancytreeNode, data: any) => void; + /** + * Events (drag drop) + */ + dragDrop?: (node: FancytreeNode, data: any) => void; + dragLeave?: (targetNode: FancytreeNode, data: any) => void; + /** + * Support misc options + */ + [key: string]: any; } /** - * Events (drag support) + * Define filter-extension options */ - dragStart?: (sourceNode: FancytreeNode, data: any) => void; + interface Filter { + /** + * Re-apply last filter if lazy data is loaded + */ + autoApply: boolean; + /** + * Expand all branches that contain matches while filtered + */ + autoExpand: boolean; + /** + * Show a badge with number of matching child nodes near parent icons + */ + counter: boolean; + /** + * Match single characters in order, e.g. 'fb' will match 'FooBar' + */ + fuzzy: boolean; + /** + * Hide counter badge if parent is expanded + */ + hideExpandedCounter: boolean; + /** + * Hide expanders if all child nodes are hidden by filter + */ + hideExpanders: boolean; + /** + * Highlight matches by wrapping inside tags + */ + highlight: boolean; + /** + * Match end nodes only + */ + leavesOnly: boolean; + /** + * Display a 'no data' status node if result is empty + */ + nodata: boolean; + /** + * Grayout unmatched nodes (pass "hide" to remove unmatched node instead); default 'dimm' + */ + mode: 'dimm' | 'string'; + /** + * Support misc options + */ + [key: string]: any; + } /** - * Events (drop support) + * Define table-extension options */ - dragEnter: (targetNode: FancytreeNode, data: any) => void; - /** - * Events (drag over) - */ - dragOver: (targetNode: FancytreeNode, data: any) => void; - /** - * Events (drag drop) - */ - dragDrop: (node: FancytreeNode, data: any) => void; - /** - * Support misc options - */ - [key: string]: any; + interface Table { + /** + * Render the checkboxes into the this column index (default: nodeColumnIdx) + */ + checkboxColumnIdx: any; + /** + * Indent every node level by 16px; default: 16 + */ + indentation: number; + /** + * Render node expander, icon, and title to this column (default: 0) + */ + nodeColumnIdx: number; + /** + * Support misc options + */ + [key: string]: any; + } } - /** - * Define filter-extension options - */ - interface ExtensionFilter { - mode: string; - /** - * Support misc options - */ - [key: string]: any; + + + /** Data object passed to FancytreeNode() constructor. Note: typically these attributes are accessed by meber methods, e.g. `node.isExpanded()` and `node.setSelected(false)`. */ + interface NodeData { + /** node text (may contain HTML tags) */ + title: string; + icon?: string; + /** unique key for this node (auto-generated if omitted) */ + key?: string; + /** (reserved) */ + refKey?: string; + expanded?: boolean; + /** (initialization only, but will not be stored with the node). */ + active?: boolean; + /** (initialization only, but will not be stored with the node). */ + focus?: boolean; + folder?: boolean; + hideCheckbox?: boolean; + lazy?: boolean; + selected?: boolean; + unselectable?: boolean; + /** optional array of child nodes */ + children?: NodeData[]; + tooltip?: string; + /** class names added to the node markup (separate with space) */ + extraClasses?: string; + /** all properties from will be copied to `node.data` */ + data?: Object; } - /** - * Define table-extension options - */ - interface ExtensionTable { - indentation: number; - nodeColumnIdx: number; - /** - * Support misc options - */ - [key: string]: any; + + /** Data object similar to NodeData, but with additional options. + * May be passed to FancytreeNode#applyPatch (Every property that is omitted (or set to undefined) will be ignored) */ + interface NodePatch { + /** (not yet implemented) */ + appendChildren?: NodeData; + /** (not yet implemented) */ + replaceChildren?: NodeData; + /** (not yet implemented) */ + insertChildren?: NodeData; + } + + /** May be passed to Fancytree#applyPatch. */ + interface TreePatch { + [key: string]: NodePatch; + } + + interface FancytreeStatic { + buildType: string; + debugLevel: number; + version: string; + + /** Throw an error if condition fails (debug method). */ + assert(cond: boolean, msg: string): void; + + /** Return a function that executes *fn* at most every *timeout* ms. */ + debounce void>(timeout: number, fn: T, invokeAsap?: boolean, ctx?: any): T; + + debug(msg: string): void; + + error(msg: string): void; + + escapeHtml(s: string): string; + + getEventTarget(event: Event): Object; + + getEventTargetType(event: Event): string; + + getNode(el: JQuery): FancytreeNode; + getNode(el: Event): FancytreeNode; + getNode(el: Element): FancytreeNode; + + info(msg: string): void; + + /** Convert a keydown event to a string like 'ctrl+a', 'ctrl+shift+f2'. */ + keyEventToString(event: Event): string; + + /** Parse tree data from HTML markup */ + parseHtml($ul: JQuery): NodeData[]; + + /** Add Fancytree extension definition to the list of globally available extensions. */ + registerExtension(definition: Object): void; + + unescapeHtml(s: string): string; + + warn(msg: string): void; } } -/** Data object passed to FancytreeNode() constructor. Note: typically these attributes are accessed by meber methods, e.g. `node.isExpanded()` and `node.setSelected(false)`. */ -interface NodeData { - /** node text (may contain HTML tags) */ - title: string; - icon?: string; - /** unique key for this node (auto-generated if omitted) */ - key?: string; - /** (reserved) */ - refKey?: string; - expanded?: boolean; - /** (initialization only, but will not be stored with the node). */ - active?: boolean; - /** (initialization only, but will not be stored with the node). */ - focus?: boolean; - folder?: boolean; - hideCheckbox?: boolean; - lazy?: boolean; - selected?: boolean; - unselectable?: boolean; - /** optional array of child nodes */ - children?: NodeData[]; - tooltip?: string; - /** class names added to the node markup (separate with space) */ - extraClasses?: string; - /** all properties from will be copied to `node.data` */ - data?: Object; -} - -/** Data object similar to NodeData, but with additional options. - * May be passed to FancytreeNode#applyPatch (Every property that is omitted (or set to undefined) will be ignored) */ -interface NodePatch { - /** (not yet implemented) */ - appendChildren?: NodeData; - /** (not yet implemented) */ - replaceChildren?: NodeData; - /** (not yet implemented) */ - insertChildren?: NodeData; -} - -/** May be passed to Fancytree#applyPatch. */ -interface TreePatch { - [key: string]: NodePatch; -} - -interface FancytreeStatic { - buildType: string; - debugLevel: number; - version: string; - - /** Throw an error if condition fails (debug method). */ - assert(cond: boolean, msg: string): void; - - /** Return a function that executes *fn* at most every *timeout* ms. */ - debounce void>(timeout: number, fn: T, invokeAsap?: boolean, ctx?: any): T; - - debug(msg: string): void; - - error(msg: string): void; - - escapeHtml(s: string): string; - - getEventTarget(event: Event): Object; - - getEventTargetType(event: Event): string; - - getNode(el: JQuery): FancytreeNode; - getNode(el: Event): FancytreeNode; - getNode(el: Element): FancytreeNode; - - info(msg: string): void; - - /** Convert a keydown event to a string like 'ctrl+a', 'ctrl+shift+f2'. */ - keyEventToString(event: Event): string; - - /** Parse tree data from HTML markup */ - parseHtml($ul: JQuery): NodeData[]; - - /** Add Fancytree extension definition to the list of globally available extensions. */ - registerExtension(definition: Object): void; - - unescapeHtml(s: string): string; - - warn(msg: string): void; -} -} - diff --git a/types/jquery.fancytree/jquery.fancytree-tests.ts b/types/jquery.fancytree/jquery.fancytree-tests.ts index 4fa52c790a..9f90f74779 100644 --- a/types/jquery.fancytree/jquery.fancytree-tests.ts +++ b/types/jquery.fancytree/jquery.fancytree-tests.ts @@ -1,4 +1,4 @@ -$("#tree").fancytree({ +$("#tree").fancytree({ source: [ { title: "Node 1", key: "1" }, { @@ -12,9 +12,9 @@ $("#tree").fancytree({ { title: "Node 1", key: "1" }, { title: "Folder 2", key: "2", folder: true, children: [ - { title: "Node 2.1", key: "3" }, - { title: "Node 2.2", key: "4" } - ] + { title: "Node 2.1", key: "3" }, + { title: "Node 2.2", key: "4" } + ] } ] } @@ -44,9 +44,9 @@ $("#tree").fancytree({ //$("#tree").fancytree(); -var tree : Fancytree.Fancytree = $("#tree").fancytree("getTree"); +var tree: Fancytree.Fancytree = $("#tree").fancytree("getTree"); -var activeNode : Fancytree.FancytreeNode = tree.getRootNode(); +var activeNode: Fancytree.FancytreeNode = tree.getRootNode(); // Sort children of active node: activeNode.sortChildren(); @@ -65,15 +65,15 @@ activeNode.addChildren({ tree.loadKeyPath("/1/2", function (node, status) { if (status === "loaded") { console.log("loaded intermiediate node " + node); - } else if (status === "ok") { + } else if (status === "ok") { node.setActive(); } }); -var node = $.ui.fancytree.getNode($("#tree")); +var node = $.ui.fancytree.getNode($("#tree")); alert($.ui.fancytree.version); -var f = $.ui.fancytree.debounce(50, (a : number) => { console.log(a); }, true); -f(2); +var f = $.ui.fancytree.debounce(50, (a: number) => { console.log(a); }, true); +f(2); node = tree.getFirstChild(); node.setExpanded().done(function () { From 4c2753ac90f35cbfecd94f17d7cd3fc46c30ddcc Mon Sep 17 00:00:00 2001 From: Nikolai Ommundsen Date: Wed, 6 Jun 2018 14:23:06 +0200 Subject: [PATCH 3/4] Updated tests --- types/jquery.fancytree/jquery.fancytree-tests.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/types/jquery.fancytree/jquery.fancytree-tests.ts b/types/jquery.fancytree/jquery.fancytree-tests.ts index cbdbec0782..8f9707597e 100644 --- a/types/jquery.fancytree/jquery.fancytree-tests.ts +++ b/types/jquery.fancytree/jquery.fancytree-tests.ts @@ -22,6 +22,10 @@ $("#tree").fancytree({ ] } ], + extensions: ['dnd5'], + dnd5: { + dragDrag: (node, data) => { } + }, click: (ev: JQueryEventObject, node: Fancytree.EventData) => { return true; }, From 5f701a0df2536e3ba5e5a0ca8c4fe7a9d840295a Mon Sep 17 00:00:00 2001 From: Nikolai Ommundsen Date: Wed, 6 Jun 2018 14:25:03 +0200 Subject: [PATCH 4/4] Set correct version number --- types/jquery.fancytree/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/jquery.fancytree/index.d.ts b/types/jquery.fancytree/index.d.ts index 2e3c8b5223..d370b06f4d 100644 --- a/types/jquery.fancytree/index.d.ts +++ b/types/jquery.fancytree/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for jquery.fancytree 2.7.0 +// Type definitions for jquery.fancytree 2.28.2-0 // Project: https://github.com/mar10/fancytree // Definitions by: Peter Palotas // Mahdi Abedi