@malloy-publisher/sdk 0.0.144 → 0.0.146
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 +15 -8
- package/package.json +1 -1
- package/src/components/filter/DimensionFilter.tsx +90 -81
- 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":
|
|
@@ -48226,7 +48226,7 @@ function kz({
|
|
|
48226
48226
|
} finally {
|
|
48227
48227
|
G === R.current && (b(!1), C(!0));
|
|
48228
48228
|
}
|
|
48229
|
-
},
|
|
48229
|
+
}, 500), () => {
|
|
48230
48230
|
S.current && clearTimeout(S.current);
|
|
48231
48231
|
};
|
|
48232
48232
|
}, [g, e, o]), Ot(() => {
|
|
@@ -48267,6 +48267,7 @@ function kz({
|
|
|
48267
48267
|
value: i,
|
|
48268
48268
|
label: "Match Type",
|
|
48269
48269
|
onChange: V,
|
|
48270
|
+
disabled: D.length === 1,
|
|
48270
48271
|
children: D.map((w) => /* @__PURE__ */ m(Ia, { value: w, children: w }, w))
|
|
48271
48272
|
}
|
|
48272
48273
|
)
|
|
@@ -48327,7 +48328,7 @@ function kz({
|
|
|
48327
48328
|
}
|
|
48328
48329
|
)
|
|
48329
48330
|
] }),
|
|
48330
|
-
e.filterType === "Retrieval" && i === "
|
|
48331
|
+
e.filterType === "Retrieval" && i === "Semantic Search" && /* @__PURE__ */ m(
|
|
48331
48332
|
mp,
|
|
48332
48333
|
{
|
|
48333
48334
|
multiple: !0,
|
|
@@ -48358,7 +48359,13 @@ function kz({
|
|
|
48358
48359
|
InputProps: {
|
|
48359
48360
|
...w.InputProps,
|
|
48360
48361
|
endAdornment: /* @__PURE__ */ z(Ct, { children: [
|
|
48361
|
-
h ? /* @__PURE__ */ m(
|
|
48362
|
+
h ? /* @__PURE__ */ m(
|
|
48363
|
+
wf,
|
|
48364
|
+
{
|
|
48365
|
+
color: "inherit",
|
|
48366
|
+
size: 20
|
|
48367
|
+
}
|
|
48368
|
+
) : null,
|
|
48362
48369
|
w.InputProps.endAdornment
|
|
48363
48370
|
] })
|
|
48364
48371
|
}
|
|
@@ -48687,7 +48694,7 @@ function Pz(e, t, n) {
|
|
|
48687
48694
|
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
48695
|
switch (i) {
|
|
48689
48696
|
case "Equals":
|
|
48690
|
-
case "
|
|
48697
|
+
case "Semantic Search":
|
|
48691
48698
|
return Array.isArray(s) && s.length > 0 ? `(${s.map(
|
|
48692
48699
|
(b) => `${d} = ${p(b, f)}`
|
|
48693
48700
|
).join(" or ")})` : `${d} = ${p(s, f)}`;
|
|
@@ -50545,7 +50552,7 @@ function lV(e) {
|
|
|
50545
50552
|
const { dimensionName: t, matchType: n, value: r, value2: o } = e, a = `\`${t}\``, i = r instanceof Date;
|
|
50546
50553
|
switch (n) {
|
|
50547
50554
|
case "Equals":
|
|
50548
|
-
case "
|
|
50555
|
+
case "Semantic Search":
|
|
50549
50556
|
return Array.isArray(r) && r.length > 0 ? `(${r.map(
|
|
50550
50557
|
(l) => `${a} = ${Er(l, i)}`
|
|
50551
50558
|
).join(" or ")})` : Array.isArray(r) ? "" : `${a} = ${Er(r, i)}`;
|
|
@@ -50809,7 +50816,7 @@ function pV(e) {
|
|
|
50809
50816
|
const { dimensionName: t, matchType: n, value: r, value2: o } = e, a = `\`${t}\``, i = r instanceof Date;
|
|
50810
50817
|
switch (n) {
|
|
50811
50818
|
case "Equals":
|
|
50812
|
-
case "
|
|
50819
|
+
case "Semantic Search":
|
|
50813
50820
|
return Array.isArray(r) && r.length > 0 ? `(${r.map(
|
|
50814
50821
|
(l) => `${a} = ${vr(l, i)}`
|
|
50815
50822
|
).join(" or ")})` : Array.isArray(r) ? "" : `${a} = ${vr(r, i)}`;
|
|
@@ -56598,7 +56605,7 @@ function EW(e) {
|
|
|
56598
56605
|
const { dimensionName: t, matchType: n, value: r, value2: o } = e, a = `\`${t}\``, i = r instanceof Date;
|
|
56599
56606
|
switch (n) {
|
|
56600
56607
|
case "Equals":
|
|
56601
|
-
case "
|
|
56608
|
+
case "Semantic Search":
|
|
56602
56609
|
return Array.isArray(r) && r.length > 0 ? `(${r.map(
|
|
56603
56610
|
(l) => `${a} = ${Tr(l, i)}`
|
|
56604
56611
|
).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":
|
|
@@ -187,7 +187,7 @@ export function DimensionFilter({
|
|
|
187
187
|
setRetrievalSearched(true);
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
|
-
},
|
|
190
|
+
}, 500);
|
|
191
191
|
|
|
192
192
|
// Cleanup: cancel timer on unmount or when dependencies change
|
|
193
193
|
return () => {
|
|
@@ -325,6 +325,7 @@ export function DimensionFilter({
|
|
|
325
325
|
value={matchType}
|
|
326
326
|
label="Match Type"
|
|
327
327
|
onChange={handleMatchTypeChange}
|
|
328
|
+
disabled={availableMatchTypes.length === 1}
|
|
328
329
|
>
|
|
329
330
|
{availableMatchTypes.map((type) => (
|
|
330
331
|
<MenuItem key={type} value={type}>
|
|
@@ -421,87 +422,95 @@ export function DimensionFilter({
|
|
|
421
422
|
</FormControl>
|
|
422
423
|
)}
|
|
423
424
|
|
|
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;
|
|
425
|
+
{spec.filterType === "Retrieval" &&
|
|
426
|
+
matchType === "Semantic Search" && (
|
|
427
|
+
<Autocomplete
|
|
428
|
+
multiple
|
|
429
|
+
size="small"
|
|
430
|
+
options={retrievalOptions}
|
|
431
|
+
loading={retrievalLoading}
|
|
432
|
+
getOptionLabel={(option) => {
|
|
433
|
+
if (typeof option === "string") {
|
|
434
|
+
return option;
|
|
463
435
|
}
|
|
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
|
|
436
|
+
if (
|
|
437
|
+
typeof option === "object" &&
|
|
438
|
+
option !== null &&
|
|
439
|
+
"value" in option
|
|
440
|
+
) {
|
|
441
|
+
return String((option as DimensionValue).value);
|
|
487
442
|
}
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
443
|
+
return String(option);
|
|
444
|
+
}}
|
|
445
|
+
value={
|
|
446
|
+
Array.isArray(value1)
|
|
447
|
+
? value1.map((v: string) => {
|
|
448
|
+
const found = retrievalOptions.find(
|
|
449
|
+
(opt) => opt.value === v,
|
|
450
|
+
);
|
|
451
|
+
return found || { value: v };
|
|
452
|
+
})
|
|
453
|
+
: value1
|
|
454
|
+
? [{ value: value1 }]
|
|
455
|
+
: []
|
|
456
|
+
}
|
|
457
|
+
onInputChange={(_, newInputValue) => {
|
|
458
|
+
setRetrievalInputValue(newInputValue);
|
|
459
|
+
}}
|
|
460
|
+
onChange={(_, newValue) => {
|
|
461
|
+
const newValues = newValue.map((item) => {
|
|
462
|
+
if (typeof item === "string") return item;
|
|
463
|
+
if (
|
|
464
|
+
item &&
|
|
465
|
+
typeof item === "object" &&
|
|
466
|
+
"value" in item
|
|
467
|
+
) {
|
|
468
|
+
return (item as DimensionValue).value;
|
|
469
|
+
}
|
|
470
|
+
return item;
|
|
471
|
+
}) as FilterValuePrimitive[];
|
|
472
|
+
handleValueChange(newValues);
|
|
473
|
+
}}
|
|
474
|
+
noOptionsText={
|
|
475
|
+
retrievalInputValue.trim().length <= 2
|
|
476
|
+
? "Type at least 3 characters to search"
|
|
477
|
+
: "No matches found"
|
|
478
|
+
}
|
|
479
|
+
renderInput={(params) => (
|
|
480
|
+
<TextField
|
|
481
|
+
{...params}
|
|
482
|
+
label="Search Values"
|
|
483
|
+
placeholder="Type to search..."
|
|
484
|
+
onFocus={() => setRetrievalFocused(true)}
|
|
485
|
+
onBlur={() => setRetrievalFocused(false)}
|
|
486
|
+
helperText={
|
|
487
|
+
retrievalFocused &&
|
|
488
|
+
!retrievalLoading &&
|
|
489
|
+
retrievalSearched &&
|
|
490
|
+
retrievalOptions.length === 0
|
|
491
|
+
? "No matches found"
|
|
492
|
+
: undefined
|
|
493
|
+
}
|
|
494
|
+
InputProps={{
|
|
495
|
+
...params.InputProps,
|
|
496
|
+
endAdornment: (
|
|
497
|
+
<>
|
|
498
|
+
{retrievalLoading ? (
|
|
499
|
+
<CircularProgress
|
|
500
|
+
color="inherit"
|
|
501
|
+
size={20}
|
|
502
|
+
/>
|
|
503
|
+
) : null}
|
|
504
|
+
{params.InputProps.endAdornment}
|
|
505
|
+
</>
|
|
506
|
+
),
|
|
507
|
+
}}
|
|
508
|
+
/>
|
|
509
|
+
)}
|
|
510
|
+
freeSolo
|
|
511
|
+
filterOptions={(x) => x}
|
|
512
|
+
/>
|
|
513
|
+
)}
|
|
505
514
|
|
|
506
515
|
{spec.filterType === "MinMax" && !needsTwoValues && (
|
|
507
516
|
<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(
|