mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-16 19:09:18 +08:00
d3-selection: Combine "insert" signatures (#13666)
This commit is contained in:
73
d3-selection/index.d.ts
vendored
73
d3-selection/index.d.ts
vendored
@@ -503,63 +503,24 @@ interface Selection<GElement extends BaseType, Datum, PElement extends BaseType,
|
||||
*
|
||||
* The generic refers to the type of the child element to be appended.
|
||||
*
|
||||
* @param type A string representing the tag name for the element type to be inserted. The specified name may have a namespace prefix,
|
||||
* such as svg:text to specify a text attribute in the SVG namespace. If no namespace is specified, the namespace will be inherited
|
||||
* from the parent element; or, if the name is one of the known prefixes, the corresponding namespace will be used
|
||||
* (for example, svg implies svg:svg)
|
||||
* @param before A CSS selector string for the element before which the insertion should occur.
|
||||
* @param type One of:
|
||||
* * A string representing the tag name for the element type to be inserted. The specified name may have a namespace prefix,
|
||||
* such as svg:text to specify a text attribute in the SVG namespace. If no namespace is specified, the namespace will be inherited
|
||||
* from the parent element; or, if the name is one of the known prefixes, the corresponding namespace will be used
|
||||
* (for example, svg implies svg:svg)
|
||||
* * A creator function which is evaluated for each selected element, in order, being passed the current datum (d),
|
||||
* the current index (i), and the current group (nodes), with this as the current DOM element. This function should return
|
||||
* an element to be inserted. (The function typically creates a new element, but it may instead return an existing element.)
|
||||
* @param before One of:
|
||||
* * A CSS selector string for the element before which the insertion should occur.
|
||||
* * A child selector function which is evaluated for each selected element, in order, being passed the current datum (d),
|
||||
* the current index (i), and the current group (nodes), with this as the current DOM element. This function should return the child element
|
||||
* before which the element should be inserted.
|
||||
*/
|
||||
insert<ChildElement extends BaseType>(type: string, before: string): Selection<ChildElement, Datum, PElement, PDatum>;
|
||||
/**
|
||||
* Inserts a new element of the type provided by the element creator function before the element matching the specified "before"
|
||||
* selector string for each selected element.
|
||||
*
|
||||
* This method returns a new selection containing the appended elements.
|
||||
* Each new element inherits the data of the current elements, if any.
|
||||
*
|
||||
* The generic refers to the type of the child element to be appended.
|
||||
*
|
||||
* @param type A creator function which is evaluated for each selected element, in order, being passed the current datum (d),
|
||||
* the current index (i), and the current group (nodes), with this as the current DOM element. This function should return
|
||||
* an element to be inserted. (The function typically creates a new element, but it may instead return an existing element.)
|
||||
* @param before A CSS selector string for the element before which the insertion should occur.
|
||||
*/
|
||||
insert<ChildElement extends BaseType>(type: ValueFn<GElement, Datum, ChildElement>, before: string): Selection<ChildElement, Datum, PElement, PDatum>;
|
||||
/**
|
||||
* Inserts a new element of the specified type (tag name) before the element returned by the "before" child selector function
|
||||
* for each selected element.
|
||||
*
|
||||
* This method returns a new selection containing the appended elements.
|
||||
* Each new element inherits the data of the current elements, if any.
|
||||
*
|
||||
* The generic refers to the type of the child element to be appended.
|
||||
*
|
||||
* @param type A string representing the tag name for the element type to be inserted. The specified name may have a namespace prefix,
|
||||
* such as svg:text to specify a text attribute in the SVG namespace. If no namespace is specified, the namespace will be inherited
|
||||
* from the parent element; or, if the name is one of the known prefixes, the corresponding namespace will be used
|
||||
* (for example, svg implies svg:svg)
|
||||
* @param before A child selector function which is evaluated for each selected element, in order, being passed the current datum (d),
|
||||
* the current index (i), and the current group (nodes), with this as the current DOM element. This function should return the child element
|
||||
* before which the element should be inserted.
|
||||
*/
|
||||
insert<ChildElement extends BaseType>(type: string, before: ValueFn<GElement, Datum, BaseType>): Selection<ChildElement, Datum, PElement, PDatum>;
|
||||
/**
|
||||
* Inserts a new element of the type provided by the element creator function before the element returned by the "before" child selector function
|
||||
* for each selected element.
|
||||
*
|
||||
* This method returns a new selection containing the appended elements.
|
||||
* Each new element inherits the data of the current elements, if any.
|
||||
*
|
||||
* The generic refers to the type of the child element to be appended.
|
||||
*
|
||||
* @param type A creator function which is evaluated for each selected element, in order, being passed the current datum (d),
|
||||
* the current index (i), and the current group (nodes), with this as the current DOM element. This function should return
|
||||
* an element to be inserted. (The function typically creates a new element, but it may instead return an existing element.)
|
||||
* @param before A child selector function which is evaluated for each selected element, in order, being passed the current datum (d),
|
||||
* the current index (i), and the current group (nodes), with this as the current DOM element. This function should return the child element
|
||||
* before which the element should be inserted.
|
||||
*/
|
||||
insert<ChildElement extends BaseType>(type: ValueFn<GElement, Datum, ChildElement>, before: ValueFn<GElement, Datum, BaseType>): Selection<ChildElement, Datum, PElement, PDatum>;
|
||||
insert<ChildElement extends BaseType>(
|
||||
type: string | ValueFn<GElement, Datum, ChildElement>,
|
||||
before: string | ValueFn<GElement, Datum, BaseType>
|
||||
): Selection<ChildElement, Datum, PElement, PDatum>;
|
||||
|
||||
/**
|
||||
* Removes the selected elements from the document.
|
||||
|
||||
Reference in New Issue
Block a user