@nice2dev/ui-core 1.0.22 → 1.0.23
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/core/filterToSql.d.ts +25 -0
- package/dist/core/filterToSql.d.ts.map +1 -0
- package/dist/core/types.d.ts +30 -8
- package/dist/core/types.d.ts.map +1 -1
- package/dist/index.cjs +23 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +2210 -2113
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { NiceFilterCondition, NiceFilterGroup, NiceSortExpression } from './datasource';
|
|
2
|
+
export interface NiceSqlWhere {
|
|
3
|
+
/** The WHERE body (no leading "WHERE"); empty string when there are no conditions. */
|
|
4
|
+
sql: string;
|
|
5
|
+
/** Positional parameters in the order their placeholders appear in `sql`. */
|
|
6
|
+
params: unknown[];
|
|
7
|
+
}
|
|
8
|
+
export interface FilterToSqlOptions {
|
|
9
|
+
/**
|
|
10
|
+
* Placeholder for parameter at `index` (0-based). Default `'?'` (MySQL/SQLite).
|
|
11
|
+
* For Postgres pass `(i) => '$' + (i + 1)`.
|
|
12
|
+
*/
|
|
13
|
+
placeholder?: (index: number) => string;
|
|
14
|
+
/** Quote/escape an identifier. Default: bare if safe, else double-quoted. */
|
|
15
|
+
quoteField?: (field: string) => string;
|
|
16
|
+
}
|
|
17
|
+
/** Convert a {@link NiceFilterGroup} tree to a parameterised WHERE clause. */
|
|
18
|
+
export declare function filterGroupToWhere(group: NiceFilterGroup, opts?: FilterToSqlOptions): NiceSqlWhere;
|
|
19
|
+
/** Convert a sort model to an ORDER BY body (no leading "ORDER BY"). */
|
|
20
|
+
export declare function sortModelToOrderBy(sort: NiceSortExpression[], opts?: FilterToSqlOptions): string;
|
|
21
|
+
/** Evaluate a single condition against a row (same operator semantics as the SQL gen). */
|
|
22
|
+
export declare function matchesFilterCondition(row: Record<string, unknown>, c: NiceFilterCondition): boolean;
|
|
23
|
+
/** Evaluate a {@link NiceFilterGroup} tree against a row (empty group ⇒ matches). */
|
|
24
|
+
export declare function matchesFilterGroup(row: Record<string, unknown>, group: NiceFilterGroup): boolean;
|
|
25
|
+
//# sourceMappingURL=filterToSql.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filterToSql.d.ts","sourceRoot":"","sources":["../../src/core/filterToSql.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,mBAAmB,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAE7F,MAAM,WAAW,YAAY;IAC3B,sFAAsF;IACtF,GAAG,EAAE,MAAM,CAAC;IACZ,6EAA6E;IAC7E,MAAM,EAAE,OAAO,EAAE,CAAC;CACnB;AAED,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IACxC,6EAA6E;IAC7E,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;CACxC;AAMD,8EAA8E;AAC9E,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,eAAe,EACtB,IAAI,GAAE,kBAAuB,GAC5B,YAAY,CA4Dd;AAED,wEAAwE;AACxE,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,kBAAkB,EAAE,EAC1B,IAAI,GAAE,kBAAuB,GAC5B,MAAM,CAMR;AAQD,0FAA0F;AAC1F,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5B,CAAC,EAAE,mBAAmB,GACrB,OAAO,CAuCT;AAED,qFAAqF;AACrF,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,KAAK,EAAE,eAAe,GAAG,OAAO,CAOhG"}
|
package/dist/core/types.d.ts
CHANGED
|
@@ -1,12 +1,21 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* T-shirt sizing used across all components for consistent visual density.
|
|
3
|
+
* The full names `'small' | 'medium' | 'large'` are accepted aliases for
|
|
4
|
+
* `'sm' | 'md' | 'lg'` (normalized internally via {@link normalizeSize}) — they
|
|
5
|
+
* exist so consumers coming from Material/Chakra/Ant don't hit a type error.
|
|
6
|
+
*/
|
|
7
|
+
export type NiceSize = 'xxs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl' | 'small' | 'medium' | 'large';
|
|
8
|
+
/** The canonical (short) size tokens — what {@link normalizeSize} returns. */
|
|
9
|
+
export type NiceSizeCanonical = 'xxs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
|
|
10
|
+
/** @deprecated Legacy size names — accepted aliases, see {@link NiceSize}. */
|
|
4
11
|
export type NiceSizeLegacy = 'small' | 'medium' | 'large';
|
|
5
12
|
/**
|
|
6
|
-
* Normalizes a size value
|
|
7
|
-
*
|
|
13
|
+
* Normalizes a size value to the canonical short token, mapping the accepted
|
|
14
|
+
* full-name aliases (`small`/`medium`/`large` → `sm`/`md`/`lg`). Pass any
|
|
15
|
+
* {@link NiceSize}; get back a {@link NiceSizeCanonical}. `componentName` is
|
|
16
|
+
* accepted for back-compat and ignored.
|
|
8
17
|
*/
|
|
9
|
-
export declare function normalizeSize(size: string | undefined, componentName?: string):
|
|
18
|
+
export declare function normalizeSize(size: string | undefined, componentName?: string): NiceSizeCanonical;
|
|
10
19
|
/**
|
|
11
20
|
* Layout sizing for editors, viewers and players.
|
|
12
21
|
* - `'minimal'` — smallest usable chrome, toolbar hidden or icon-only
|
|
@@ -15,8 +24,21 @@ export declare function normalizeSize(size: string | undefined, componentName?:
|
|
|
15
24
|
* - `'fullscreen'` — expands to fill the viewport
|
|
16
25
|
*/
|
|
17
26
|
export type NiceEditorSize = 'minimal' | 'compact' | 'standard' | 'fullscreen';
|
|
18
|
-
/**
|
|
19
|
-
|
|
27
|
+
/**
|
|
28
|
+
* Visual style variant for buttons, alerts, badges and other themed controls.
|
|
29
|
+
* `'danger'` is an accepted alias for `'error'` (normalized internally via
|
|
30
|
+
* {@link normalizeVariant}) — it reads more naturally on destructive buttons
|
|
31
|
+
* (Delete, Reset) and matches Bootstrap/Ant/Material conventions.
|
|
32
|
+
*/
|
|
33
|
+
export type NiceVariant = 'primary' | 'secondary' | 'success' | 'warning' | 'error' | 'danger' | 'info' | 'ghost' | 'outline';
|
|
34
|
+
/** The canonical variant tokens — what {@link normalizeVariant} returns (`'danger'` collapses to `'error'`). */
|
|
35
|
+
export type NiceVariantCanonical = Exclude<NiceVariant, 'danger'>;
|
|
36
|
+
/**
|
|
37
|
+
* Normalizes a variant to its canonical token, mapping the `'danger'` alias to
|
|
38
|
+
* `'error'`. Components should call this before emitting `--${variant}` classes
|
|
39
|
+
* or token lookups so the alias renders identically to `'error'`.
|
|
40
|
+
*/
|
|
41
|
+
export declare function normalizeVariant(variant: NiceVariant): NiceVariantCanonical;
|
|
20
42
|
/** Whitespace / padding density preset. */
|
|
21
43
|
export type NiceDensity = 'compact' | 'normal' | 'comfortable';
|
|
22
44
|
/**
|
package/dist/core/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,MAAM,MAAM,QAAQ,GAChB,KAAK,GACL,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,KAAK,GACL,OAAO,GACP,QAAQ,GACR,OAAO,CAAC;AAEZ,8EAA8E;AAC9E,MAAM,MAAM,iBAAiB,GAAG,KAAK,GAAG,IAAI,GAAG,I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