@malloy-publisher/sdk 0.0.144 → 0.0.145
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/README.md +3 -3
- package/dist/hooks/useDimensionFilters.d.ts +1 -1
- package/dist/index.cjs.js +4 -4
- package/dist/index.es.js +13 -7
- package/package.json +1 -1
- package/src/components/filter/DimensionFilter.tsx +88 -80
- package/src/components/filter/utils.ts +1 -1
- package/src/hooks/useDimensionFilters.ts +2 -2
- package/src/hooks/useDimensionFiltersQuery.ts +1 -1
- package/src/hooks/useDimensionalFilterRangeData.ts +1 -1
package/dist/index.es.js
CHANGED
|
@@ -48179,7 +48179,7 @@ function hd(e) {
|
|
|
48179
48179
|
case "DateMinMax":
|
|
48180
48180
|
return ["Equals", "Before", "After", "Between"];
|
|
48181
48181
|
case "Retrieval":
|
|
48182
|
-
return ["
|
|
48182
|
+
return ["Semantic Search"];
|
|
48183
48183
|
case "Boolean":
|
|
48184
48184
|
return ["Equals"];
|
|
48185
48185
|
case "NONE":
|
|
@@ -48327,7 +48327,7 @@ function kz({
|
|
|
48327
48327
|
}
|
|
48328
48328
|
)
|
|
48329
48329
|
] }),
|
|
48330
|
-
e.filterType === "Retrieval" && i === "
|
|
48330
|
+
e.filterType === "Retrieval" && i === "Semantic Search" && /* @__PURE__ */ m(
|
|
48331
48331
|
mp,
|
|
48332
48332
|
{
|
|
48333
48333
|
multiple: !0,
|
|
@@ -48358,7 +48358,13 @@ function kz({
|
|
|
48358
48358
|
InputProps: {
|
|
48359
48359
|
...w.InputProps,
|
|
48360
48360
|
endAdornment: /* @__PURE__ */ z(Ct, { children: [
|
|
48361
|
-
h ? /* @__PURE__ */ m(
|
|
48361
|
+
h ? /* @__PURE__ */ m(
|
|
48362
|
+
wf,
|
|
48363
|
+
{
|
|
48364
|
+
color: "inherit",
|
|
48365
|
+
size: 20
|
|
48366
|
+
}
|
|
48367
|
+
) : null,
|
|
48362
48368
|
w.InputProps.endAdornment
|
|
48363
48369
|
] })
|
|
48364
48370
|
}
|
|
@@ -48687,7 +48693,7 @@ function Pz(e, t, n) {
|
|
|
48687
48693
|
const { dimensionName: a, matchType: i, value: s, value2: l } = o, u = t.get(a), d = u && u !== n ? `\`${u}\`.\`${a}\`` : `\`${a}\``, f = s instanceof Date, p = (h, b = !1) => h == null ? "null" : b && h instanceof Date ? `@${h.getFullYear()}-${String(h.getMonth() + 1).padStart(2, "0")}-${String(h.getDate()).padStart(2, "0")}` : typeof h == "string" ? `'${h.replace(/'/g, "\\'")}'` : typeof h == "boolean" ? h ? "true" : "false" : String(h);
|
|
48688
48694
|
switch (i) {
|
|
48689
48695
|
case "Equals":
|
|
48690
|
-
case "
|
|
48696
|
+
case "Semantic Search":
|
|
48691
48697
|
return Array.isArray(s) && s.length > 0 ? `(${s.map(
|
|
48692
48698
|
(b) => `${d} = ${p(b, f)}`
|
|
48693
48699
|
).join(" or ")})` : `${d} = ${p(s, f)}`;
|
|
@@ -50545,7 +50551,7 @@ function lV(e) {
|
|
|
50545
50551
|
const { dimensionName: t, matchType: n, value: r, value2: o } = e, a = `\`${t}\``, i = r instanceof Date;
|
|
50546
50552
|
switch (n) {
|
|
50547
50553
|
case "Equals":
|
|
50548
|
-
case "
|
|
50554
|
+
case "Semantic Search":
|
|
50549
50555
|
return Array.isArray(r) && r.length > 0 ? `(${r.map(
|
|
50550
50556
|
(l) => `${a} = ${Er(l, i)}`
|
|
50551
50557
|
).join(" or ")})` : Array.isArray(r) ? "" : `${a} = ${Er(r, i)}`;
|
|
@@ -50809,7 +50815,7 @@ function pV(e) {
|
|
|
50809
50815
|
const { dimensionName: t, matchType: n, value: r, value2: o } = e, a = `\`${t}\``, i = r instanceof Date;
|
|
50810
50816
|
switch (n) {
|
|
50811
50817
|
case "Equals":
|
|
50812
|
-
case "
|
|
50818
|
+
case "Semantic Search":
|
|
50813
50819
|
return Array.isArray(r) && r.length > 0 ? `(${r.map(
|
|
50814
50820
|
(l) => `${a} = ${vr(l, i)}`
|
|
50815
50821
|
).join(" or ")})` : Array.isArray(r) ? "" : `${a} = ${vr(r, i)}`;
|
|
@@ -56598,7 +56604,7 @@ function EW(e) {
|
|
|
56598
56604
|
const { dimensionName: t, matchType: n, value: r, value2: o } = e, a = `\`${t}\``, i = r instanceof Date;
|
|
56599
56605
|
switch (n) {
|
|
56600
56606
|
case "Equals":
|
|
56601
|
-
case "
|
|
56607
|
+
case "Semantic Search":
|
|
56602
56608
|
return Array.isArray(r) && r.length > 0 ? `(${r.map(
|
|
56603
56609
|
(l) => `${a} = ${Tr(l, i)}`
|
|
56604
56610
|
).join(" or ")})` : Array.isArray(r) ? "" : `${a} = ${Tr(r, i)}`;
|
package/package.json
CHANGED
|
@@ -64,7 +64,7 @@ function getAvailableMatchTypes(
|
|
|
64
64
|
case "DateMinMax":
|
|
65
65
|
return ["Equals", "Before", "After", "Between"];
|
|
66
66
|
case "Retrieval":
|
|
67
|
-
return ["
|
|
67
|
+
return ["Semantic Search"];
|
|
68
68
|
case "Boolean":
|
|
69
69
|
return ["Equals"];
|
|
70
70
|
case "NONE":
|
|
@@ -421,87 +421,95 @@ export function DimensionFilter({
|
|
|
421
421
|
</FormControl>
|
|
422
422
|
)}
|
|
423
423
|
|
|
424
|
-
{spec.filterType === "Retrieval" &&
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
if (
|
|
435
|
-
typeof option === "object" &&
|
|
436
|
-
option !== null &&
|
|
437
|
-
"value" in option
|
|
438
|
-
) {
|
|
439
|
-
return String((option as DimensionValue).value);
|
|
440
|
-
}
|
|
441
|
-
return String(option);
|
|
442
|
-
}}
|
|
443
|
-
value={
|
|
444
|
-
Array.isArray(value1)
|
|
445
|
-
? value1.map((v: string) => {
|
|
446
|
-
const found = retrievalOptions.find(
|
|
447
|
-
(opt) => opt.value === v,
|
|
448
|
-
);
|
|
449
|
-
return found || { value: v };
|
|
450
|
-
})
|
|
451
|
-
: value1
|
|
452
|
-
? [{ value: value1 }]
|
|
453
|
-
: []
|
|
454
|
-
}
|
|
455
|
-
onInputChange={(_, newInputValue) => {
|
|
456
|
-
setRetrievalInputValue(newInputValue);
|
|
457
|
-
}}
|
|
458
|
-
onChange={(_, newValue) => {
|
|
459
|
-
const newValues = newValue.map((item) => {
|
|
460
|
-
if (typeof item === "string") return item;
|
|
461
|
-
if (item && typeof item === "object" && "value" in item) {
|
|
462
|
-
return (item as DimensionValue).value;
|
|
424
|
+
{spec.filterType === "Retrieval" &&
|
|
425
|
+
matchType === "Semantic Search" && (
|
|
426
|
+
<Autocomplete
|
|
427
|
+
multiple
|
|
428
|
+
size="small"
|
|
429
|
+
options={retrievalOptions}
|
|
430
|
+
loading={retrievalLoading}
|
|
431
|
+
getOptionLabel={(option) => {
|
|
432
|
+
if (typeof option === "string") {
|
|
433
|
+
return option;
|
|
463
434
|
}
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
? "Type at least 3 characters to search"
|
|
471
|
-
: "No matches found"
|
|
472
|
-
}
|
|
473
|
-
renderInput={(params) => (
|
|
474
|
-
<TextField
|
|
475
|
-
{...params}
|
|
476
|
-
label="Search Values"
|
|
477
|
-
placeholder="Type to search..."
|
|
478
|
-
onFocus={() => setRetrievalFocused(true)}
|
|
479
|
-
onBlur={() => setRetrievalFocused(false)}
|
|
480
|
-
helperText={
|
|
481
|
-
retrievalFocused &&
|
|
482
|
-
!retrievalLoading &&
|
|
483
|
-
retrievalSearched &&
|
|
484
|
-
retrievalOptions.length === 0
|
|
485
|
-
? "No matches found"
|
|
486
|
-
: undefined
|
|
435
|
+
if (
|
|
436
|
+
typeof option === "object" &&
|
|
437
|
+
option !== null &&
|
|
438
|
+
"value" in option
|
|
439
|
+
) {
|
|
440
|
+
return String((option as DimensionValue).value);
|
|
487
441
|
}
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
442
|
+
return String(option);
|
|
443
|
+
}}
|
|
444
|
+
value={
|
|
445
|
+
Array.isArray(value1)
|
|
446
|
+
? value1.map((v: string) => {
|
|
447
|
+
const found = retrievalOptions.find(
|
|
448
|
+
(opt) => opt.value === v,
|
|
449
|
+
);
|
|
450
|
+
return found || { value: v };
|
|
451
|
+
})
|
|
452
|
+
: value1
|
|
453
|
+
? [{ value: value1 }]
|
|
454
|
+
: []
|
|
455
|
+
}
|
|
456
|
+
onInputChange={(_, newInputValue) => {
|
|
457
|
+
setRetrievalInputValue(newInputValue);
|
|
458
|
+
}}
|
|
459
|
+
onChange={(_, newValue) => {
|
|
460
|
+
const newValues = newValue.map((item) => {
|
|
461
|
+
if (typeof item === "string") return item;
|
|
462
|
+
if (
|
|
463
|
+
item &&
|
|
464
|
+
typeof item === "object" &&
|
|
465
|
+
"value" in item
|
|
466
|
+
) {
|
|
467
|
+
return (item as DimensionValue).value;
|
|
468
|
+
}
|
|
469
|
+
return item;
|
|
470
|
+
}) as FilterValuePrimitive[];
|
|
471
|
+
handleValueChange(newValues);
|
|
472
|
+
}}
|
|
473
|
+
noOptionsText={
|
|
474
|
+
retrievalInputValue.trim().length <= 2
|
|
475
|
+
? "Type at least 3 characters to search"
|
|
476
|
+
: "No matches found"
|
|
477
|
+
}
|
|
478
|
+
renderInput={(params) => (
|
|
479
|
+
<TextField
|
|
480
|
+
{...params}
|
|
481
|
+
label="Search Values"
|
|
482
|
+
placeholder="Type to search..."
|
|
483
|
+
onFocus={() => setRetrievalFocused(true)}
|
|
484
|
+
onBlur={() => setRetrievalFocused(false)}
|
|
485
|
+
helperText={
|
|
486
|
+
retrievalFocused &&
|
|
487
|
+
!retrievalLoading &&
|
|
488
|
+
retrievalSearched &&
|
|
489
|
+
retrievalOptions.length === 0
|
|
490
|
+
? "No matches found"
|
|
491
|
+
: undefined
|
|
492
|
+
}
|
|
493
|
+
InputProps={{
|
|
494
|
+
...params.InputProps,
|
|
495
|
+
endAdornment: (
|
|
496
|
+
<>
|
|
497
|
+
{retrievalLoading ? (
|
|
498
|
+
<CircularProgress
|
|
499
|
+
color="inherit"
|
|
500
|
+
size={20}
|
|
501
|
+
/>
|
|
502
|
+
) : null}
|
|
503
|
+
{params.InputProps.endAdornment}
|
|
504
|
+
</>
|
|
505
|
+
),
|
|
506
|
+
}}
|
|
507
|
+
/>
|
|
508
|
+
)}
|
|
509
|
+
freeSolo
|
|
510
|
+
filterOptions={(x) => x}
|
|
511
|
+
/>
|
|
512
|
+
)}
|
|
505
513
|
|
|
506
514
|
{spec.filterType === "MinMax" && !needsTwoValues && (
|
|
507
515
|
<TextField
|
|
@@ -278,7 +278,7 @@ export function generateFilterClause(
|
|
|
278
278
|
|
|
279
279
|
switch (matchType) {
|
|
280
280
|
case "Equals":
|
|
281
|
-
case "
|
|
281
|
+
case "Semantic Search":
|
|
282
282
|
if (Array.isArray(value) && value.length > 0) {
|
|
283
283
|
const conditions = value.map(
|
|
284
284
|
(v) => `${fieldName} = ${formatValue(v, isDate)}`,
|
|
@@ -12,7 +12,7 @@ export type MatchType =
|
|
|
12
12
|
| "Less Than"
|
|
13
13
|
| "Greater Than"
|
|
14
14
|
| "Between"
|
|
15
|
-
| "
|
|
15
|
+
| "Semantic Search";
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Primitive types that can be used as filter values
|
|
@@ -125,7 +125,7 @@ function generateFilterCondition(selection: FilterSelection): string {
|
|
|
125
125
|
|
|
126
126
|
switch (matchType) {
|
|
127
127
|
case "Equals":
|
|
128
|
-
case "
|
|
128
|
+
case "Semantic Search":
|
|
129
129
|
if (Array.isArray(value) && value.length > 0) {
|
|
130
130
|
// Handle multi-select: (field = val1 or field = val2)
|
|
131
131
|
const conditions = value.map(
|
|
@@ -93,7 +93,7 @@ function generateFilterCondition(selection: FilterSelection): string {
|
|
|
93
93
|
|
|
94
94
|
switch (matchType) {
|
|
95
95
|
case "Equals":
|
|
96
|
-
case "
|
|
96
|
+
case "Semantic Search":
|
|
97
97
|
if (Array.isArray(value) && value.length > 0) {
|
|
98
98
|
// Handle multi-select: (field = val1 or field = val2)
|
|
99
99
|
const conditions = value.map(
|
|
@@ -137,7 +137,7 @@ function generateFilterCondition(selection: FilterSelection): string {
|
|
|
137
137
|
|
|
138
138
|
switch (matchType) {
|
|
139
139
|
case "Equals":
|
|
140
|
-
case "
|
|
140
|
+
case "Semantic Search":
|
|
141
141
|
if (Array.isArray(value) && value.length > 0) {
|
|
142
142
|
// Handle multi-select: (field = val1 or field = val2)
|
|
143
143
|
const conditions = value.map(
|