@rokkit/data 1.0.0-next.119 → 1.0.0-next.120
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/aggregators.d.ts +2 -0
- package/dist/constants.d.ts +46 -0
- package/dist/convert.d.ts +10 -0
- package/dist/dataset.d.ts +43 -0
- package/dist/filter.d.ts +26 -0
- package/dist/formatter.d.ts +10 -0
- package/dist/hierarchy.d.ts +36 -0
- package/dist/index.d.ts +7 -0
- package/dist/infer.d.ts +80 -0
- package/dist/join.d.ts +95 -0
- package/dist/list.d.ts +121 -0
- package/dist/metadata.d.ts +32 -0
- package/dist/model.d.ts +29 -0
- package/dist/packages/actions/src/delegate.svelte.d.ts +13 -0
- package/dist/packages/actions/src/dismissable.svelte.d.ts +7 -0
- package/dist/packages/actions/src/fillable.svelte.d.ts +8 -0
- package/dist/packages/actions/src/index.d.ts +11 -0
- package/dist/packages/actions/src/kbd.d.ts +44 -0
- package/dist/packages/actions/src/keyboard.svelte.d.ts +7 -0
- package/dist/packages/actions/src/lib/event-manager.d.ts +8 -0
- package/dist/packages/actions/src/lib/index.d.ts +2 -0
- package/dist/packages/actions/src/lib/internal.d.ts +19 -0
- package/dist/packages/actions/src/navigable.svelte.d.ts +8 -0
- package/dist/packages/actions/src/navigator.svelte.d.ts +20 -0
- package/dist/packages/actions/src/pannable.svelte.d.ts +6 -0
- package/dist/packages/actions/src/skinnable.svelte.d.ts +8 -0
- package/dist/packages/actions/src/swipeable.svelte.d.ts +14 -0
- package/dist/packages/actions/src/themable.svelte.d.ts +7 -0
- package/dist/packages/actions/src/types.d.ts +72 -0
- package/dist/packages/actions/src/utils.d.ts +18 -0
- package/dist/packages/bits-ui/src/index.d.ts +2 -0
- package/dist/packages/bits-ui/src/reference.d.ts +22 -0
- package/dist/packages/bits-ui/src/tree/constants.d.ts +13 -0
- package/dist/packages/bits-ui/src/tree/index.d.ts +7 -0
- package/dist/packages/bits-ui/src/tree/types.d.ts +71 -0
- package/dist/packages/core/src/calendar.d.ts +10 -0
- package/dist/packages/core/src/colors/index.d.ts +333 -0
- package/dist/packages/core/src/connector.d.ts +8 -0
- package/dist/packages/core/src/constants.d.ts +39 -0
- package/dist/packages/core/src/events.d.ts +12 -0
- package/dist/packages/core/src/field-mapper.d.ts +63 -0
- package/dist/packages/core/src/index.d.ts +13 -0
- package/dist/packages/core/src/key-event-map.d.ts +18 -0
- package/dist/packages/core/src/mapped-items.d.ts +14 -0
- package/dist/packages/core/src/mapping.d.ts +75 -0
- package/dist/packages/core/src/nested.d.ts +18 -0
- package/dist/packages/core/src/string.d.ts +59 -0
- package/dist/packages/core/src/theme.d.ts +52 -0
- package/dist/packages/core/src/ticks.d.ts +10 -0
- package/dist/packages/core/src/types.d.ts +245 -0
- package/dist/packages/core/src/utils.d.ts +70 -0
- package/dist/packages/data/src/aggregators.d.ts +2 -0
- package/dist/packages/data/src/constants.d.ts +46 -0
- package/dist/packages/data/src/convert.d.ts +10 -0
- package/dist/packages/data/src/dataset.d.ts +43 -0
- package/dist/packages/data/src/filter.d.ts +26 -0
- package/dist/packages/data/src/formatter.d.ts +10 -0
- package/dist/packages/data/src/hierarchy.d.ts +36 -0
- package/dist/packages/data/src/index.d.ts +7 -0
- package/dist/packages/data/src/infer.d.ts +80 -0
- package/dist/packages/data/src/join.d.ts +95 -0
- package/dist/packages/data/src/list.d.ts +121 -0
- package/dist/packages/data/src/metadata.d.ts +32 -0
- package/dist/packages/data/src/model.d.ts +29 -0
- package/dist/packages/data/src/parser.d.ts +31 -0
- package/dist/packages/data/src/renamer.d.ts +37 -0
- package/dist/packages/data/src/rollup.d.ts +51 -0
- package/dist/packages/data/src/types.d.ts +346 -0
- package/dist/packages/data/src/utils.d.ts +6 -0
- package/dist/packages/data/src/view.d.ts +35 -0
- package/dist/packages/helpers/src/components/index.d.ts +2 -0
- package/dist/packages/helpers/src/index.d.ts +1 -0
- package/dist/packages/helpers/src/matchers/action.d.ts +27 -0
- package/dist/packages/helpers/src/matchers/array.d.ts +10 -0
- package/dist/packages/helpers/src/matchers/dataset.d.ts +10 -0
- package/dist/packages/helpers/src/matchers/event.d.ts +10 -0
- package/dist/packages/helpers/src/matchers/index.d.ts +4 -0
- package/dist/packages/helpers/src/matchers/internal.d.ts +1 -0
- package/dist/packages/helpers/src/mocks/animate.d.ts +1 -0
- package/dist/packages/helpers/src/mocks/element.d.ts +60 -0
- package/dist/packages/helpers/src/mocks/index.d.ts +2 -0
- package/dist/packages/helpers/src/mocks/match-media.d.ts +30 -0
- package/dist/packages/helpers/src/mocks/resize-observer.d.ts +9 -0
- package/dist/packages/helpers/src/simulators/index.d.ts +1 -0
- package/dist/packages/helpers/src/simulators/touch.d.ts +40 -0
- package/dist/packages/icons/src/convert.d.ts +22 -0
- package/dist/packages/icons/src/index.d.ts +2 -0
- package/dist/packages/input/src/index.d.ts +18 -0
- package/dist/packages/states/src/constants.d.ts +27 -0
- package/dist/packages/states/src/derive.svelte.d.ts +22 -0
- package/dist/packages/states/src/hierarchy.d.ts +34 -0
- package/dist/packages/states/src/index.d.ts +5 -0
- package/dist/packages/states/src/list-controller.svelte.d.ts +70 -0
- package/dist/packages/states/src/nested-controller.svelte.d.ts +32 -0
- package/dist/packages/states/src/proxy.svelte.d.ts +43 -0
- package/dist/packages/states/src/tabular.svelte.d.ts +5 -0
- package/dist/packages/states/src/traversal.svelte.d.ts +69 -0
- package/dist/packages/states/src/vibe.svelte.d.ts +622 -0
- package/dist/packages/themes/src/constants.d.ts +6 -0
- package/dist/packages/themes/src/index.d.ts +2 -0
- package/dist/packages/tutorial/src/assimilate.d.ts +25 -0
- package/dist/packages/tutorial/src/collector.d.ts +46 -0
- package/dist/packages/tutorial/src/files.d.ts +8 -0
- package/dist/packages/tutorial/src/index.d.ts +2 -0
- package/dist/packages/tutorial/src/metadata/base.d.ts +19 -0
- package/dist/packages/tutorial/src/metadata/factory.d.ts +19 -0
- package/dist/packages/tutorial/src/metadata/index.d.ts +2 -0
- package/dist/packages/tutorial/src/metadata/javascript.d.ts +7 -0
- package/dist/packages/tutorial/src/metadata/json.d.ts +7 -0
- package/dist/packages/tutorial/src/metadata/markdown.d.ts +7 -0
- package/dist/packages/tutorial/src/metadata/registry.d.ts +26 -0
- package/dist/packages/tutorial/src/metamodel.d.ts +45 -0
- package/dist/packages/tutorial/src/tutorial.d.ts +21 -0
- package/dist/packages/tutorial/src/types.d.ts +172 -0
- package/dist/packages/tutorial/src/utils.d.ts +13 -0
- package/dist/packages/ui/src/constants.d.ts +2 -0
- package/dist/packages/ui/src/index.d.ts +42 -0
- package/dist/packages/ui/src/input/types.d.ts +9 -0
- package/dist/packages/ui/src/lib/fields.d.ts +16 -0
- package/dist/packages/ui/src/lib/form.d.ts +95 -0
- package/dist/packages/ui/src/lib/index.d.ts +6 -0
- package/dist/packages/ui/src/lib/layout.d.ts +7 -0
- package/dist/packages/ui/src/lib/nested.d.ts +48 -0
- package/dist/packages/ui/src/lib/schema.d.ts +7 -0
- package/dist/packages/ui/src/lib/select.d.ts +8 -0
- package/dist/packages/ui/src/lib/tree.d.ts +9 -0
- package/dist/packages/ui/src/types.d.ts +5 -0
- package/dist/packages/ui/src/wrappers/index.d.ts +3 -0
- package/dist/parser.d.ts +31 -0
- package/dist/renamer.d.ts +37 -0
- package/dist/rollup.d.ts +51 -0
- package/dist/sites/learn/src/hooks.d.ts +1 -0
- package/dist/sites/learn/src/hooks.server.d.ts +2 -0
- package/dist/sites/learn/src/lib/index.d.ts +7 -0
- package/dist/sites/learn/src/lib/media.d.ts +13 -0
- package/dist/sites/learn/src/lib/paraglide/messages/en.d.ts +3 -0
- package/dist/sites/learn/src/lib/paraglide/messages/fr.d.ts +3 -0
- package/dist/sites/learn/src/lib/paraglide/messages/hi.d.ts +3 -0
- package/dist/sites/learn/src/lib/paraglide/messages.d.ts +5 -0
- package/dist/sites/learn/src/lib/paraglide/runtime.d.ts +52 -0
- package/dist/sites/learn/src/lib/stories/02-elements/01-list/03-mapping/src/data.d.ts +5 -0
- package/dist/sites/learn/src/lib/stories/02-elements/01-list/04-mixed/src/data.d.ts +13 -0
- package/dist/sites/learn/src/lib/stories/02-elements/02-tabs/04-fields/src/data.d.ts +5 -0
- package/dist/sites/learn/src/lib/stories/02-elements/02-tabs/05-using/src/data.d.ts +6 -0
- package/dist/sites/learn/src/lib/stories/02-elements/03-accordion/01-intro/src/data.d.ts +4 -0
- package/dist/sites/learn/src/lib/stories/02-elements/03-accordion/02-fields/src/data.d.ts +9 -0
- package/dist/sites/learn/src/lib/stories/02-elements/03-accordion/03-using/src/data.d.ts +19 -0
- package/dist/sites/learn/src/lib/stories/02-elements/03-accordion/04-mixed/src/data.d.ts +30 -0
- package/dist/sites/learn/src/lib/stories/02-elements/03-accordion/props.d.ts +15 -0
- package/dist/sites/learn/src/lib/stories/02-elements/04-tree/01-intro/src/data.d.ts +12 -0
- package/dist/sites/learn/src/lib/stories/02-elements/06-select/02-fields/src/data.d.ts +5 -0
- package/dist/sites/learn/src/lib/stories/02-elements/07-multi-select/02-fields/src/data.d.ts +5 -0
- package/dist/sites/learn/src/lib/stories/02-elements/08-drop-down/02-fields/src/data.d.ts +5 -0
- package/dist/sites/learn/src/lib/stories/05-templates/01-form/02-schema/src/schema.d.ts +22 -0
- package/dist/sites/learn/src/lib/stories/05-templates/01-form/03-layout/src/layout.d.ts +19 -0
- package/dist/sites/learn/src/lib/stories/05-templates/01-form/03-layout/src/schema.d.ts +36 -0
- package/dist/sites/learn/src/lib/stories/05-templates/01-form/05-validation/src/schema.d.ts +34 -0
- package/dist/sites/learn/src/lib/stories/05-templates/02-editor/01-introduction/src/data.d.ts +39 -0
- package/dist/sites/learn/src/lib/stories/05-templates/02-editor/01-introduction/src/schema.d.ts +187 -0
- package/dist/sites/learn/src/lib/stories/06-layout/03-stepper/01-intro/src/data.d.ts +37 -0
- package/dist/sites/learn/src/lib/stories/06-layout/03-stepper/02-play/src/data.d.ts +37 -0
- package/dist/sites/learn/src/lib/stories/index.d.ts +1 -0
- package/dist/sites/learn/src/lib/theme.svelte.d.ts +70 -0
- package/dist/sites/learn/src/routes/(learn)/+layout.d.ts +12 -0
- package/dist/sites/learn/src/routes/(learn)/[segment]/[...slug]/+page.d.ts +8 -0
- package/dist/sites/learn/src/routes/+layout.d.ts +18 -0
- package/dist/sites/quick-start/src/hooks.d.ts +1 -0
- package/dist/sites/quick-start/src/hooks.server.d.ts +2 -0
- package/dist/sites/quick-start/src/lib/index.d.ts +1 -0
- package/dist/sites/quick-start/src/lib/paraglide/messages/en.d.ts +3 -0
- package/dist/sites/quick-start/src/lib/paraglide/messages/fr.d.ts +3 -0
- package/dist/sites/quick-start/src/lib/paraglide/messages/hi.d.ts +3 -0
- package/dist/sites/quick-start/src/lib/paraglide/messages.d.ts +5 -0
- package/dist/sites/quick-start/src/lib/paraglide/runtime.d.ts +52 -0
- package/dist/sites/quick-start/src/routes/+layout.d.ts +9 -0
- package/dist/types.d.ts +346 -0
- package/dist/utils.d.ts +6 -0
- package/dist/view.d.ts +35 -0
- package/package.json +5 -6
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Finds the closest ancestor of the given element that has the given attribute.
|
|
3
|
+
*
|
|
4
|
+
* @param {HTMLElement} element
|
|
5
|
+
* @param {string} attribute
|
|
6
|
+
* @returns {HTMLElement|null}
|
|
7
|
+
*/
|
|
8
|
+
export function getClosestAncestorWithAttribute(element: HTMLElement, attribute: string): HTMLElement | null;
|
|
9
|
+
/**
|
|
10
|
+
* A function that performs no operations.
|
|
11
|
+
*/
|
|
12
|
+
export function noop(): void;
|
|
13
|
+
/**
|
|
14
|
+
* Generates a random id
|
|
15
|
+
*
|
|
16
|
+
* @returns {string} A random id
|
|
17
|
+
*/
|
|
18
|
+
export function id(): string;
|
|
19
|
+
/**
|
|
20
|
+
* Check if a value is a json object
|
|
21
|
+
*
|
|
22
|
+
* @param {*} val
|
|
23
|
+
* @returns {boolean}
|
|
24
|
+
*/
|
|
25
|
+
export function isObject(val: any): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Converts the value to a string. If the value is an object, it will convert it to a JSON string.
|
|
28
|
+
*
|
|
29
|
+
* @param {*} value
|
|
30
|
+
* @returns {string}
|
|
31
|
+
*/
|
|
32
|
+
export function toString(value: any): string;
|
|
33
|
+
/**
|
|
34
|
+
* Generates icon shortcuts for a collection of icons
|
|
35
|
+
*
|
|
36
|
+
* @param {string[]} icons
|
|
37
|
+
* @param {string} collection
|
|
38
|
+
* @param {string} variants
|
|
39
|
+
* @returns {Object}
|
|
40
|
+
*/
|
|
41
|
+
export function iconShortcuts(icons: string[], collection: string, variants: string): Object;
|
|
42
|
+
/**
|
|
43
|
+
* Scales the path by the size
|
|
44
|
+
*
|
|
45
|
+
* @param {number} size
|
|
46
|
+
* @param {string|number} x
|
|
47
|
+
* @returns {string|number}
|
|
48
|
+
*/
|
|
49
|
+
export function scaledPath(size: number, x: string | number): string | number;
|
|
50
|
+
/**
|
|
51
|
+
* Gets a key string from path
|
|
52
|
+
* @param {string[]} path
|
|
53
|
+
* @returns {string}
|
|
54
|
+
*/
|
|
55
|
+
export function getKeyFromPath(path: string[]): string;
|
|
56
|
+
/**
|
|
57
|
+
* Gets a path array from key string
|
|
58
|
+
* @param {string} key
|
|
59
|
+
* @returns {string[]}
|
|
60
|
+
*/
|
|
61
|
+
export function getPathFromKey(key: string): string[];
|
|
62
|
+
/**
|
|
63
|
+
* Get snippet function from an object
|
|
64
|
+
* @param {Object} obj
|
|
65
|
+
* @param {string} key
|
|
66
|
+
* @param {null|Function} defaultSnippet
|
|
67
|
+
* @returns {Function|undefined}
|
|
68
|
+
*/
|
|
69
|
+
export function getSnippet(obj: Object, key: string, defaultSnippet?: null | Function): Function | undefined;
|
|
70
|
+
export function importIcons(icons: Object): Object;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export const pickAllowedConfig: <U extends Partial<Record<"children" | "actual_flag", any>>>(obj: "children" | "actual_flag" extends keyof U ? U : never) => "children" | "actual_flag" extends keyof U ? Pick<U, keyof U & ("children" | "actual_flag")> : never;
|
|
2
|
+
/** @type {import('./types').DataFrameConfig */
|
|
3
|
+
export const defaultConfig: import("./types").DataFrameConfig;
|
|
4
|
+
export namespace defaultPathOptions {
|
|
5
|
+
let path: null;
|
|
6
|
+
let separator: string;
|
|
7
|
+
let currencySuffix: string;
|
|
8
|
+
}
|
|
9
|
+
export namespace defaultViewOptions {
|
|
10
|
+
let expanded: boolean;
|
|
11
|
+
let actions: never[];
|
|
12
|
+
let language: string;
|
|
13
|
+
let scanMode: string;
|
|
14
|
+
}
|
|
15
|
+
export namespace defaultActionOrder {
|
|
16
|
+
export let select: number;
|
|
17
|
+
export let edit: number;
|
|
18
|
+
let _delete: number;
|
|
19
|
+
export { _delete as delete };
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Returns the default properties for a column
|
|
23
|
+
* @param {string} key - the key to use for the column
|
|
24
|
+
* @returns {Object} the default properties for a column
|
|
25
|
+
*/
|
|
26
|
+
export const filterOperations: {
|
|
27
|
+
'=': (value: any, pattern: any) => boolean;
|
|
28
|
+
'<': (value: any, pattern: any) => boolean;
|
|
29
|
+
'>': (value: any, pattern: any) => boolean;
|
|
30
|
+
'<=': (value: any, pattern: any) => boolean;
|
|
31
|
+
'>=': (value: any, pattern: any) => boolean;
|
|
32
|
+
'~*': (value: any, pattern: any) => any;
|
|
33
|
+
'~': (value: any, pattern: any) => any;
|
|
34
|
+
'!=': (value: any, pattern: any) => boolean;
|
|
35
|
+
'!~*': (value: any, pattern: any) => boolean;
|
|
36
|
+
'!~': (value: any, pattern: any) => boolean;
|
|
37
|
+
};
|
|
38
|
+
export namespace typeConverters {
|
|
39
|
+
export function string(value: any): string;
|
|
40
|
+
export function number(value: any): number;
|
|
41
|
+
export function boolean(value: any): boolean;
|
|
42
|
+
export function date(value: any): Date;
|
|
43
|
+
export { identity as mixed };
|
|
44
|
+
}
|
|
45
|
+
export function includeAll(): boolean;
|
|
46
|
+
import { identity } from 'ramda';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts an array of objects into a columnar structure, returning an object with two attributes:
|
|
3
|
+
*
|
|
4
|
+
* - columns, which contains an array of column names
|
|
5
|
+
* - data, which is an object with column names as keys and arrays as values.
|
|
6
|
+
*
|
|
7
|
+
* @param {Array<Object>} input
|
|
8
|
+
* @returns {import('./types').Dataframe}
|
|
9
|
+
*/
|
|
10
|
+
export function fromArray(input: Array<Object>): import("./types").Dataframe;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the default aggregator which rolls up the columns other than the group_by columns into a single object.
|
|
3
|
+
*
|
|
4
|
+
* @param {import('./types').Metadata} metadata - The metadata for the columns to be aggregated.
|
|
5
|
+
* @param {Object} config - The configuration used to build the aggregator.
|
|
6
|
+
*
|
|
7
|
+
* @returns {Object} An object containing the default aggregator for the specified metadata and configuration.
|
|
8
|
+
*/
|
|
9
|
+
export function defaultAggregator(config: Object): Object;
|
|
10
|
+
export function dataset(data: any, options?: {}): DataSet;
|
|
11
|
+
export class DataSet {
|
|
12
|
+
constructor(data: any);
|
|
13
|
+
set data(values: any[]);
|
|
14
|
+
get data(): any[];
|
|
15
|
+
set config(props: any);
|
|
16
|
+
override(props: any): this;
|
|
17
|
+
where(condition: any): this;
|
|
18
|
+
groupBy(...fields: any[]): this;
|
|
19
|
+
alignBy(...fields: any[]): this;
|
|
20
|
+
usingTemplate(template: any): this;
|
|
21
|
+
summarize(from: any, fields: any): this;
|
|
22
|
+
rename(how: any): this;
|
|
23
|
+
drop(...fields: any[]): DataSet;
|
|
24
|
+
sortBy(...fields: any[]): this;
|
|
25
|
+
remove(): this;
|
|
26
|
+
update(value: any): this;
|
|
27
|
+
fillNA(value: any): this;
|
|
28
|
+
apply(callback: any): this;
|
|
29
|
+
rollup(): DataSet;
|
|
30
|
+
select(...cols: any[]): any[];
|
|
31
|
+
union(other: any): DataSet;
|
|
32
|
+
minus(other: any): DataSet;
|
|
33
|
+
intersect(other: any): DataSet;
|
|
34
|
+
innerJoin(other: any, condition: any): DataSet;
|
|
35
|
+
leftJoin(other: any, condition: any): DataSet;
|
|
36
|
+
rightJoin(other: any, condition: any): DataSet;
|
|
37
|
+
fullJoin(other: any, condition: any): DataSet;
|
|
38
|
+
crossJoin(other: any): DataSet;
|
|
39
|
+
semiJoin(other: any, condition: any): DataSet;
|
|
40
|
+
antiJoin(other: any, condition: any): DataSet;
|
|
41
|
+
nestedJoin(other: any, condition: any): DataSet;
|
|
42
|
+
#private;
|
|
43
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Filters an array of objects based on a specified condition defined in the options.
|
|
3
|
+
* If a column is provided, it filters based on the value of that column. Otherwise, it filters
|
|
4
|
+
* based on a value present in any of the object's properties.
|
|
5
|
+
*
|
|
6
|
+
* @param {Object[]} data - The array of objects to filter.
|
|
7
|
+
* @param {Object} options - The filtering options that define the condition.
|
|
8
|
+
* @param {string} [options.column] - The property name in the objects to filter by. If omitted, all properties are considered.
|
|
9
|
+
* @param {string|number} [options.value] - The value to compare against when filtering.
|
|
10
|
+
* @param {string} [options.operator] - The operator to use for comparison, should match a key in the filterOperations object.
|
|
11
|
+
* @returns {Object[]} - The filtered array of objects.
|
|
12
|
+
*/
|
|
13
|
+
export function filterObjectArray(data: Object[], options: {
|
|
14
|
+
column?: string | undefined;
|
|
15
|
+
value?: string | number | undefined;
|
|
16
|
+
operator?: string | undefined;
|
|
17
|
+
}): Object[];
|
|
18
|
+
/**
|
|
19
|
+
* Applies multiple filtering conditions to an array of objects. This function iterates through each filter option,
|
|
20
|
+
* successively narrowing down the data.
|
|
21
|
+
*
|
|
22
|
+
* @param {Object[]} data - The array of objects to filter.
|
|
23
|
+
* @param {Object[]} filters - An array of filtering options to apply to the data.
|
|
24
|
+
* @returns {Object[]} - The filtered array of objects that meet all conditions specified by the filters.
|
|
25
|
+
*/
|
|
26
|
+
export function filterData(data: Object[], filters: Object[]): Object[];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a formatter function that formats a value according to the specified type and optional locale settings.
|
|
3
|
+
* Supported types include 'default' (no formatting), 'integer', 'number', 'date', 'time',, 'object', 'array', 'currency' & 'ellipsis''
|
|
4
|
+
*
|
|
5
|
+
* @param {string} type - The type of the formatter to use (e.g., 'integer', 'number', 'date', 'time', 'currency').
|
|
6
|
+
* @param {string} [language='en-US'] - Optional IETF language tag used for locale-specific formatting.
|
|
7
|
+
* @param {number} [decimalPlaces=2] - Optional number of decimal places to show with number and currency formatting.
|
|
8
|
+
* @returns {*} - A format function that takes a value and returns a formatted string.
|
|
9
|
+
*/
|
|
10
|
+
export function createFormatter(type: string, language?: string, decimalPlaces?: number): any;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Removes objects from an array where the parent attribute is not null.
|
|
3
|
+
* @param {Array<Object>} arr - The array of objects.
|
|
4
|
+
*/
|
|
5
|
+
export function removeChildren(arr: Array<Object>): void;
|
|
6
|
+
/**
|
|
7
|
+
* Flatten nested children arrays within an array of objects.
|
|
8
|
+
* @param {Array<Object>} arr - The array of objects.
|
|
9
|
+
*/
|
|
10
|
+
export function flattenNestedChildren(arr: Array<Object>): void;
|
|
11
|
+
/**
|
|
12
|
+
* Applies a hierarchical filter to an array of objects.
|
|
13
|
+
* @param {Array<Object>} arr - The array of objects.
|
|
14
|
+
* @param {Function} filterFn - The filter function to apply on each object.
|
|
15
|
+
*/
|
|
16
|
+
export function hierarchicalFilter(arr: Array<Object>, filterFn: Function): void;
|
|
17
|
+
/**
|
|
18
|
+
* Derives the hierarchy from the data.
|
|
19
|
+
*
|
|
20
|
+
* @param {Array} data - The data to derive the hierarchy from.
|
|
21
|
+
* @param {string} path - The column name to be used as hierarchical path.
|
|
22
|
+
* @param {string} separator - The separator to be used in the path.
|
|
23
|
+
* @returns {Array<import('./types').Hierarchy>} - The derived hierarchy.
|
|
24
|
+
*/
|
|
25
|
+
export function deriveHierarchy(data: any[], options: any): Array<import("./types").Hierarchy>;
|
|
26
|
+
/**
|
|
27
|
+
* Toggles the expansion state of a node and updates the visibility of its children accordingly.
|
|
28
|
+
* If the node is a parent (has child nodes), it will invert its 'isExpanded' property and call
|
|
29
|
+
* 'changeVisibilityForChildren' to reflect changes to its child nodes.
|
|
30
|
+
*
|
|
31
|
+
* @param {Object} node - The node to toggle expansion for. The node is expected to have an
|
|
32
|
+
* 'isParent' property indicating if the node has children, an
|
|
33
|
+
* 'isExpanded' property indicating if the node is expanded, and an array
|
|
34
|
+
* of child nodes under the 'children' property if it is a parent.
|
|
35
|
+
*/
|
|
36
|
+
export function toggleExpansion(node: Object): void;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from "./types";
|
|
2
|
+
export { typeOf } from "./utils";
|
|
3
|
+
export { renamer } from "./renamer";
|
|
4
|
+
export { model } from "./model";
|
|
5
|
+
export { dataset } from "./dataset";
|
|
6
|
+
export { dataview } from "./view";
|
|
7
|
+
export { innerJoin, leftJoin, rightJoin, fullJoin, crossJoin, antiJoin, semiJoin } from "./join";
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Derives the sorting information for a column based on the type of the input value.
|
|
3
|
+
*
|
|
4
|
+
* @param {import('./types').SortableColumn} value - The value that determines the sorting behavior of the column.
|
|
5
|
+
* @returns {import('./types').ColumnSorter} An object containing the 'name' of the column and a 'sorter' function.
|
|
6
|
+
* @throws {Error} Throws an error if the value type is not supported or the value format is invalid.
|
|
7
|
+
*/
|
|
8
|
+
export function deriveSortableColumn(value: import("./types").SortableColumn): import("./types").ColumnSorter;
|
|
9
|
+
/**
|
|
10
|
+
* Creates a deep scan sample object that contains a union of all keys from all
|
|
11
|
+
* objects in the array, pulling the values from the last item that contains the key.
|
|
12
|
+
*
|
|
13
|
+
* @param {Array<Object>} data - An array of objects to deep scan and collect sample values.
|
|
14
|
+
* @returns {Object} A sample object consolidating all unique keys with their latest non-null values.
|
|
15
|
+
*/
|
|
16
|
+
export function getSample(data: Array<Object>, deepScan?: boolean): Object;
|
|
17
|
+
/**
|
|
18
|
+
* Derives a unique list of column names from an array of data objects.
|
|
19
|
+
* Each data object represents a row and this function compiles a list of all unique property keys
|
|
20
|
+
* present across these objects.
|
|
21
|
+
*
|
|
22
|
+
* @param {Object[]} data - The array of data objects to analyze for column names.
|
|
23
|
+
* @returns {string[]} - An array of strings representing the unique column names found across all data objects.
|
|
24
|
+
*/
|
|
25
|
+
export function deriveColumns(data: Object[], options: any): string[];
|
|
26
|
+
/**
|
|
27
|
+
* Derives the data types of columns based on the data provided in an array of objects.
|
|
28
|
+
* The function assumes that all values of a single field (column) are of the same type. It uses
|
|
29
|
+
* the first object in the data array as a reference for the field names. Each field is categorized
|
|
30
|
+
* as either 'string' or 'number' based on whether any of the field values in the data set are non-numeric.
|
|
31
|
+
*
|
|
32
|
+
* @param {Object[]} data - The array of data objects to assess for column data types.
|
|
33
|
+
* @returns {Object} - An object with keys being the data types ('string' & 'number') and values
|
|
34
|
+
* being arrays of field names that correspond to that data type.
|
|
35
|
+
*/
|
|
36
|
+
export function deriveDataTypes(data: Object[]): Object;
|
|
37
|
+
/**
|
|
38
|
+
* Infers the data type of a set of values by examining the values in the array.
|
|
39
|
+
* Assumes all values in the array should have the same type, unless they are 'null'.
|
|
40
|
+
* If multiple types are detected (excluding 'null'), the function will return 'mixed'.
|
|
41
|
+
* If all values are 'null', it returns 'null', and it returns 'undefined' for an empty array.
|
|
42
|
+
*
|
|
43
|
+
* @param {Array} values - An array of values for which the data type is to be inferred.
|
|
44
|
+
* @returns {string} - A string representing the inferred data type. Possible values are
|
|
45
|
+
* 'undefined', 'null', 'mixed', or any data type returned by the getType function.
|
|
46
|
+
*/
|
|
47
|
+
export function inferDataType(values: any[]): string;
|
|
48
|
+
/**
|
|
49
|
+
* Adds a formatter function to each column in the array based on the column type. If a formatter
|
|
50
|
+
* function is already present, it will not be overwritten. The formatter is created based on the
|
|
51
|
+
* override formatter if present, or the column type and language.
|
|
52
|
+
*
|
|
53
|
+
* @param {Array<import('./types').ColumnMetadata>} columns - The array of column metadata to add formatters to.
|
|
54
|
+
* @param {string} language - The language to use for formatting.
|
|
55
|
+
* @returns {Array<import('./types').ColumnMetadata>} - The array of column metadata with formatters added.
|
|
56
|
+
*/
|
|
57
|
+
export function addFormatters(columns: Array<import("./types").ColumnMetadata>, language: string): Array<import("./types").ColumnMetadata>;
|
|
58
|
+
/**
|
|
59
|
+
* Converts an array of action names to an array of action objects.
|
|
60
|
+
*
|
|
61
|
+
* @param {Array<string|import('./types').Action>} input - The input to convert to actions.
|
|
62
|
+
* @returns {Array<import('./types').Action>} - The converted actions.
|
|
63
|
+
*/
|
|
64
|
+
export function convertToActions(input: Array<string | import("./types").Action>): Array<import("./types").Action>;
|
|
65
|
+
/**
|
|
66
|
+
* Adds actions to the column metadata. This function updates the columns array in place.
|
|
67
|
+
*
|
|
68
|
+
* @param {Array<import('./types').ColumnMetadata>} columns - The column metadata to update.
|
|
69
|
+
* @param {Array<string|import('./types').Action>} input - The actions to add to the column metadata.
|
|
70
|
+
* @returns {Array<import('./types').ColumnMetadata>} - The updated column metadata.
|
|
71
|
+
*/
|
|
72
|
+
export function deriveActions(columns: Array<import("./types").ColumnMetadata>, input: Array<string | import("./types").Action>): Array<import("./types").ColumnMetadata>;
|
|
73
|
+
/**
|
|
74
|
+
* Derives column metadata from the data to be used in a tabular component.
|
|
75
|
+
*
|
|
76
|
+
* @param {Array} data - The data to derive column metadata from.
|
|
77
|
+
* @param {Object} [options] - The options to use when deriving column metadata.
|
|
78
|
+
* @returns {Array<import('./types').ColumnMetadata>} - The derived column metadata.
|
|
79
|
+
*/
|
|
80
|
+
export function deriveMetadata(dataArray: any, options?: Object): Array<import("./types").ColumnMetadata>;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Filters the results of the first dataset based on the condition using the second dataset.
|
|
3
|
+
*
|
|
4
|
+
* @param {Array<Object>} first - The first dataset to filter.
|
|
5
|
+
* @param {Array<Object>} second - The second dataset to filter by.
|
|
6
|
+
* @param {Function} condition - The condition to filter the first dataset by.
|
|
7
|
+
* @returns {Array<Object>} - The filtered dataset.
|
|
8
|
+
*/
|
|
9
|
+
export function antiJoin(first: Array<Object>, second: Array<Object>, condition: Function): Array<Object>;
|
|
10
|
+
/**
|
|
11
|
+
* Joins two datasets together based on a condition. Result includes all rows from the first
|
|
12
|
+
* dataset and matching rows from the second dataset. In case of multiple matches, all
|
|
13
|
+
* combinations are returned. When combining the rows, the columns from the first dataset take
|
|
14
|
+
* precedence.
|
|
15
|
+
*
|
|
16
|
+
* @param {Array<Object>} first - The first dataset to join.
|
|
17
|
+
* @param {Array<Object>} second - The second dataset to join.
|
|
18
|
+
* @param {Function} condition - The condition to join the datasets on.
|
|
19
|
+
* @returns {Array<Object>} - The joined dataset.
|
|
20
|
+
*/
|
|
21
|
+
export function innerJoin(first: Array<Object>, second: Array<Object>, condition: Function): Array<Object>;
|
|
22
|
+
/**
|
|
23
|
+
* Performs a left join on two datasets based on a condition.
|
|
24
|
+
*
|
|
25
|
+
* - Result includes all rows from the first dataset and matching rows from the second dataset.
|
|
26
|
+
* - In case of multiple matches, all combinations are returned.
|
|
27
|
+
* - When combining the rows, the columns from the first dataset take precedence.
|
|
28
|
+
* - If there is no match in the second dataset, only the row from the first dataset is returned.
|
|
29
|
+
*
|
|
30
|
+
* This can be used to perform a right join by swapping the datasets.
|
|
31
|
+
*
|
|
32
|
+
* @param {Array<Object>} first - The first dataset to join.
|
|
33
|
+
* @param {Array<Object>} second - The second dataset to join.
|
|
34
|
+
* @param {Function} condition - The condition to join the datasets on.
|
|
35
|
+
* @returns {Array<Object>} - The joined dataset.
|
|
36
|
+
*/
|
|
37
|
+
export function leftJoin(first: Array<Object>, second: Array<Object>, condition: Function): Array<Object>;
|
|
38
|
+
/**
|
|
39
|
+
* Performs a right join on two datasets based on a condition.
|
|
40
|
+
*
|
|
41
|
+
* - Result includes all rows from both datasets.
|
|
42
|
+
* - In case of multiple matches, all combinations are returned.
|
|
43
|
+
* - When combining the rows, the columns from the second dataset take precedence.
|
|
44
|
+
* - If there is no match in the first dataset, only the row from the second dataset is returned.
|
|
45
|
+
*
|
|
46
|
+
* @param {Array<Object>} first - The first dataset to join.
|
|
47
|
+
* @param {Array<Object>} second - The second dataset to join.
|
|
48
|
+
* @param {Function} condition - The condition to join the datasets on.
|
|
49
|
+
* @returns {Array<Object>} - The joined dataset.
|
|
50
|
+
*/
|
|
51
|
+
export function rightJoin(first: Array<Object>, second: Array<Object>, condition: Function): Array<Object>;
|
|
52
|
+
/**
|
|
53
|
+
* Performs a full join on two datasets based on a condition.
|
|
54
|
+
*
|
|
55
|
+
* - Result includes all rows from both datasets.
|
|
56
|
+
* - In case of multiple matches, all combinations are returned.
|
|
57
|
+
* - When combining the rows, the columns from the second dataset take precedence.
|
|
58
|
+
* - If there is no match in the first dataset, only the row from the second dataset is returned.
|
|
59
|
+
*
|
|
60
|
+
* @param {Array<Object>} first - The first dataset to join.
|
|
61
|
+
* @param {Array<Object>} second - The second dataset to join.
|
|
62
|
+
* @param {Function} condition - The condition to join the datasets on.
|
|
63
|
+
* @returns {Array<Object>} - The joined dataset.
|
|
64
|
+
*/
|
|
65
|
+
export function fullJoin(first: Array<Object>, second: Array<Object>, condition: Function): Array<Object>;
|
|
66
|
+
/**
|
|
67
|
+
* Performs a cross join on two datasets. Result includes all combinations of rows from both datasets.
|
|
68
|
+
*
|
|
69
|
+
* @param {Array<Object>} first - The first dataset to join.
|
|
70
|
+
* @param {Array<Object>} second - The second dataset to join.
|
|
71
|
+
* @returns {Array<Object>} - The joined dataset.
|
|
72
|
+
*/
|
|
73
|
+
export function crossJoin(first: Array<Object>, second: Array<Object>): Array<Object>;
|
|
74
|
+
/**
|
|
75
|
+
* Performs a semi join on two datasets based on a condition. Result includes all rows from the first
|
|
76
|
+
* dataset that have a match in the second dataset.
|
|
77
|
+
*
|
|
78
|
+
* @param {Array<Object>} first - The first dataset to join.
|
|
79
|
+
* @param {Array<Object>} second - The second dataset to join.
|
|
80
|
+
* @param {Function} condition - The condition to join the datasets on.
|
|
81
|
+
* @returns {Array<Object>} - The joined dataset.
|
|
82
|
+
*/
|
|
83
|
+
export function semiJoin(first: Array<Object>, second: Array<Object>, condition: Function): Array<Object>;
|
|
84
|
+
/**
|
|
85
|
+
* Performs a nested join on two datasets based on a condition. Result includes all rows from the first
|
|
86
|
+
* dataset that have a match in the second dataset. The result is nested with the matching rows from the
|
|
87
|
+
* second dataset.
|
|
88
|
+
*
|
|
89
|
+
* @param {Array<Object>} first - The first dataset to join.
|
|
90
|
+
* @param {Array<Object>} second - The second dataset to join.
|
|
91
|
+
* @param {Function} condition - The condition to join the datasets on.
|
|
92
|
+
* @param {String} [key='children'] - The key to nest the matching rows under.
|
|
93
|
+
* @returns {Array<Object>} - The joined dataset.
|
|
94
|
+
*/
|
|
95
|
+
export function nestedJoin(first: Array<Object>, second: Array<Object>, condition: Function, key?: string): Array<Object>;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compares two items for sorting. When grouped, uses group comparison before item comparison
|
|
3
|
+
*
|
|
4
|
+
* @param {*} a first item
|
|
5
|
+
* @param {*} b second item
|
|
6
|
+
* @param {*} data
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
9
|
+
export function compare(a: any, b: any, data: any): number;
|
|
10
|
+
/**
|
|
11
|
+
* Search the data for existence of string in the data
|
|
12
|
+
*
|
|
13
|
+
* @param {List} data
|
|
14
|
+
* @param {string} value
|
|
15
|
+
* @returns
|
|
16
|
+
*/
|
|
17
|
+
export function quickSearch(data: List, value: string): object[];
|
|
18
|
+
/**
|
|
19
|
+
* Create a new list
|
|
20
|
+
*
|
|
21
|
+
* @param {Array<object>} data
|
|
22
|
+
* @returns
|
|
23
|
+
*/
|
|
24
|
+
export function list(data: Array<object>): List;
|
|
25
|
+
/**
|
|
26
|
+
* Implements a list containing data and functionality for sorting, filtering, and grouping.
|
|
27
|
+
*/
|
|
28
|
+
export class List {
|
|
29
|
+
/**
|
|
30
|
+
* Creates a List instance with initial data and default settings for keys and functions.
|
|
31
|
+
* @param {Array<object>} data - The initial array of objects to populate the list.
|
|
32
|
+
*/
|
|
33
|
+
constructor(data: Array<object>);
|
|
34
|
+
data: object[];
|
|
35
|
+
primaryKey: string;
|
|
36
|
+
filterKey: string | undefined;
|
|
37
|
+
sortKey: string | undefined;
|
|
38
|
+
groupKey: string | undefined;
|
|
39
|
+
lookup: {};
|
|
40
|
+
searchText: string;
|
|
41
|
+
filterUsing: Function | undefined;
|
|
42
|
+
sortUsing: Function | undefined;
|
|
43
|
+
filtered: import("svelte/store").Writable<object[]>;
|
|
44
|
+
/**
|
|
45
|
+
* Sets a primary key attribute for list items and assigns a unique identifier if not present.
|
|
46
|
+
*
|
|
47
|
+
* @param {string} value - The property name to be set as the primary key.
|
|
48
|
+
* @returns {List} This list instance for method chaining.
|
|
49
|
+
*/
|
|
50
|
+
key(value: string): List;
|
|
51
|
+
/**
|
|
52
|
+
* Configures sorting by a given key and sorting function.
|
|
53
|
+
*
|
|
54
|
+
* @param {string} key - The property name to sort by.
|
|
55
|
+
* @param {Function} [using=compare] - The function used to sort the list items.
|
|
56
|
+
* @returns {List} This list instance for method chaining.
|
|
57
|
+
*/
|
|
58
|
+
sortBy(key: string, using?: Function): List;
|
|
59
|
+
/**
|
|
60
|
+
* Groups list items by a given key and maps group keys for display using an optional lookup object.
|
|
61
|
+
*
|
|
62
|
+
* @param {string} key - The property name to group by.
|
|
63
|
+
* @param {object|null} [lookup=null] - An object mapping group keys to display names.
|
|
64
|
+
* @returns {List} This list instance for method chaining.
|
|
65
|
+
*/
|
|
66
|
+
groupBy(key: string, lookup?: object | null): List;
|
|
67
|
+
/**
|
|
68
|
+
* Sets the key and function for filtering list items.
|
|
69
|
+
*
|
|
70
|
+
* @param {string} key - The property name to filter by.
|
|
71
|
+
* @param {Function} [using=quickSearch] - The function used to filter the list items.
|
|
72
|
+
* @returns {List} This list instance for method chaining.
|
|
73
|
+
*/
|
|
74
|
+
filterBy(key: string, using?: Function): List;
|
|
75
|
+
/**
|
|
76
|
+
* Sorts the list based on the configured sorting function.
|
|
77
|
+
*
|
|
78
|
+
* @returns {List} This list instance for method chaining.
|
|
79
|
+
*/
|
|
80
|
+
sort(): List;
|
|
81
|
+
/**
|
|
82
|
+
* Adds a new item to the list, assigning a primary key if necessary, and then sorts and refreshes the list.
|
|
83
|
+
*
|
|
84
|
+
* @param {object} item - The item to add to the list.
|
|
85
|
+
* @returns {List} This list instance for method chaining.
|
|
86
|
+
*/
|
|
87
|
+
add(item: object): List;
|
|
88
|
+
/**
|
|
89
|
+
* Removes an item from the list by primary key and refreshes the list.
|
|
90
|
+
*
|
|
91
|
+
* @param {object} item - The item to remove from the list.
|
|
92
|
+
* @returns {List} This list instance for method chaining.
|
|
93
|
+
*/
|
|
94
|
+
remove(item: object): List;
|
|
95
|
+
/**
|
|
96
|
+
* Modifies an existing item in the list, identified by primary key, and then sorts and refreshes the list.
|
|
97
|
+
*
|
|
98
|
+
* @param {object} item - The item to modify in the list.
|
|
99
|
+
* @returns {List} This list instance for method chaining.
|
|
100
|
+
*/
|
|
101
|
+
modify(item: object): List;
|
|
102
|
+
/**
|
|
103
|
+
* Sets the text to search for in the list's items and then refreshes the list.
|
|
104
|
+
*
|
|
105
|
+
* @param {string} text - The text to search for.
|
|
106
|
+
* @returns {List} This list instance for method chaining.
|
|
107
|
+
*/
|
|
108
|
+
search(text: string): List;
|
|
109
|
+
/**
|
|
110
|
+
* Refreshes the list based on current sorting, grouping, and filtering configuration.
|
|
111
|
+
*
|
|
112
|
+
* @returns {List} This list instance for method chaining.
|
|
113
|
+
*/
|
|
114
|
+
refresh(): List;
|
|
115
|
+
/**
|
|
116
|
+
* Gets the current state of the filtered list data.
|
|
117
|
+
*
|
|
118
|
+
* @returns {Array<object>} The current filtered data of the list.
|
|
119
|
+
*/
|
|
120
|
+
current(): Array<object>;
|
|
121
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adds a path modifier to column definitions that match a specific path.
|
|
3
|
+
*
|
|
4
|
+
* @param {Array<Object>} columns - The original array of column definitions.
|
|
5
|
+
* @param {string|null} path - The path used to identify columns that require path modifiers.
|
|
6
|
+
* @param {string} separator - The separator used in conjunction with the path.
|
|
7
|
+
* @returns {Array<Object>} The array of column definitions with path modifiers added as needed.
|
|
8
|
+
*/
|
|
9
|
+
export function addPathModifier(columns: Array<Object>, path: string | null, separator: string): Array<Object>;
|
|
10
|
+
/**
|
|
11
|
+
* Derives column properties for a given sample and options.
|
|
12
|
+
*
|
|
13
|
+
* @param {Object} sample - The sample object used to derive column properties.
|
|
14
|
+
* @param {Object} options - The options used to modify column properties.
|
|
15
|
+
* It can specify path, separator, and currencySuffix for column customization.
|
|
16
|
+
* @returns {Array<Object>} An array of derived column definitions.
|
|
17
|
+
*/
|
|
18
|
+
export function deriveColumnProperties(sample: Object, options: Object): Array<Object>;
|
|
19
|
+
/**
|
|
20
|
+
* Derives the column metadata from the provided data and options.
|
|
21
|
+
*
|
|
22
|
+
* @param {Array} data - The data to derive the column metadata from.
|
|
23
|
+
* @param {Object} [options] - Optional parameters to control the metadata derivation.
|
|
24
|
+
* @param {Array} [options.metadata] - The metadata to use instead of deriving it from the data.
|
|
25
|
+
* @param {boolean} [options.deepScan=false] - Determines if the metadata derivation should perform a deep scan of the data.
|
|
26
|
+
*
|
|
27
|
+
* @returns {import('./types').Metadata} The derived column metadata.
|
|
28
|
+
*/
|
|
29
|
+
export function deriveColumnMetadata(data: any[], options?: {
|
|
30
|
+
metadata?: any[] | undefined;
|
|
31
|
+
deepScan?: boolean | undefined;
|
|
32
|
+
}): import("./types").Metadata;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A model is a representation of a dataset
|
|
3
|
+
* @returns an object with methods to manipulate the model
|
|
4
|
+
*/
|
|
5
|
+
export function model(): {
|
|
6
|
+
get: () => any[];
|
|
7
|
+
clone: (other: any) => /*elided*/ any;
|
|
8
|
+
/**
|
|
9
|
+
* Renames the reference names using a renamer
|
|
10
|
+
* @param {Function} rename - the renamer function
|
|
11
|
+
*/
|
|
12
|
+
renameUsing: (rename?: Function) => /*elided*/ any;
|
|
13
|
+
/**
|
|
14
|
+
* Analyzes the input data and derives a model from it
|
|
15
|
+
*
|
|
16
|
+
* @param {Array|Object} value - the data to derive the model from
|
|
17
|
+
* @param {boolean} sparseData - indicates that rows may have missing attributes
|
|
18
|
+
* @returns {Object} this
|
|
19
|
+
*/
|
|
20
|
+
from: (value: any[] | Object, sparseData: boolean) => Object;
|
|
21
|
+
/**
|
|
22
|
+
* Merges the model with another model
|
|
23
|
+
*
|
|
24
|
+
* @param {Array} other - the model to merge with
|
|
25
|
+
* @param {Boolean} override - whether to override the type of the first model
|
|
26
|
+
* @returns {Object} this
|
|
27
|
+
*/
|
|
28
|
+
merge: (other: any[], override?: boolean) => Object;
|
|
29
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Constructs a regular expression pattern for matching search filter strings.
|
|
3
|
+
* The pattern captures "column", "operator", and "value" groups for filter expressions.
|
|
4
|
+
* Supported operators include common comparison and wildcard operators.
|
|
5
|
+
*
|
|
6
|
+
* Examples of valid expressions this regex can match:
|
|
7
|
+
* - "username:john_doe"
|
|
8
|
+
* - "age>30"
|
|
9
|
+
* - "status!=active"
|
|
10
|
+
* - "title~\"Product Manager\""
|
|
11
|
+
* - "completed!~*yes"
|
|
12
|
+
*
|
|
13
|
+
* The "column" group matches one or more word characters.
|
|
14
|
+
* The "operator" group matches one among the specified comparison or wildcard operators:
|
|
15
|
+
* :, >, <, >=, <=, =<, =>, =, !=, ~, ~*, !~, !~*.
|
|
16
|
+
* The "value" group matches either a double-quoted string or a single unquoted word
|
|
17
|
+
* that doesn't include whitespace or any of the operator characters.
|
|
18
|
+
*
|
|
19
|
+
* @returns {RegExp} - The regular expression pattern to identify search filter elements.
|
|
20
|
+
*/
|
|
21
|
+
export function getRegex(): RegExp;
|
|
22
|
+
/**
|
|
23
|
+
* Parses a search string and extracts filters based on a predefined regular expression pattern.
|
|
24
|
+
* Each filter captures column, operator, and value components. Any remaining text that
|
|
25
|
+
* does not fit the pattern is considered a general search term.
|
|
26
|
+
*
|
|
27
|
+
* @param {string} string - The search string to parse for filters.
|
|
28
|
+
* @returns {Object[]} - An array of filter objects each containing the column, operator, and value,
|
|
29
|
+
* plus an additional object for general search if there is remaining text.
|
|
30
|
+
*/
|
|
31
|
+
export function parseFilters(string: string): Object[];
|