@sustaina/shared-ui 1.13.1 → 1.13.2
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/index.d.mts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +33 -28
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +33 -28
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -629,7 +629,19 @@ function makeNewRow(field) {
|
|
|
629
629
|
value: "",
|
|
630
630
|
value2: "",
|
|
631
631
|
multiTableSearch: field.multiTableSearch,
|
|
632
|
-
|
|
632
|
+
lookupFieldName: field.lookupFieldName
|
|
633
|
+
};
|
|
634
|
+
}
|
|
635
|
+
if (field.type === "json") {
|
|
636
|
+
return {
|
|
637
|
+
id: crypto.randomUUID(),
|
|
638
|
+
fieldName: field.name,
|
|
639
|
+
fieldType: field.type,
|
|
640
|
+
operator: op,
|
|
641
|
+
value: "",
|
|
642
|
+
multiTableSearch: field.multiTableSearch,
|
|
643
|
+
jsonPath: field.jsonPath,
|
|
644
|
+
lookupFieldName: field.lookupFieldName
|
|
633
645
|
};
|
|
634
646
|
}
|
|
635
647
|
return {
|
|
@@ -639,7 +651,7 @@ function makeNewRow(field) {
|
|
|
639
651
|
operator: op,
|
|
640
652
|
value: "",
|
|
641
653
|
multiTableSearch: field.multiTableSearch,
|
|
642
|
-
|
|
654
|
+
lookupFieldName: field.lookupFieldName
|
|
643
655
|
};
|
|
644
656
|
}
|
|
645
657
|
function useAdvanceSearch({ fields, limitRows }) {
|
|
@@ -681,7 +693,8 @@ function useAdvanceSearch({ fields, limitRows }) {
|
|
|
681
693
|
value: "",
|
|
682
694
|
value2: "",
|
|
683
695
|
multiTableSearch: r.multiTableSearch,
|
|
684
|
-
jsonPath: r.jsonPath
|
|
696
|
+
jsonPath: r.jsonPath,
|
|
697
|
+
lookupFieldName: r.lookupFieldName
|
|
685
698
|
} : {
|
|
686
699
|
id: r.id,
|
|
687
700
|
fieldName: r.fieldName,
|
|
@@ -689,7 +702,8 @@ function useAdvanceSearch({ fields, limitRows }) {
|
|
|
689
702
|
operator: nextOp,
|
|
690
703
|
value: "",
|
|
691
704
|
multiTableSearch: r.multiTableSearch,
|
|
692
|
-
jsonPath: r.jsonPath
|
|
705
|
+
jsonPath: r.jsonPath,
|
|
706
|
+
lookupFieldName: r.lookupFieldName
|
|
693
707
|
};
|
|
694
708
|
})
|
|
695
709
|
);
|
|
@@ -722,6 +736,7 @@ function useAdvanceSearch({ fields, limitRows }) {
|
|
|
722
736
|
fieldName: r.fieldName,
|
|
723
737
|
fieldType: r.fieldType,
|
|
724
738
|
multiTableSearch: r.multiTableSearch,
|
|
739
|
+
lookupFieldName: r.lookupFieldName,
|
|
725
740
|
jsonPath: r.jsonPath,
|
|
726
741
|
operator,
|
|
727
742
|
value: "",
|
|
@@ -733,6 +748,7 @@ function useAdvanceSearch({ fields, limitRows }) {
|
|
|
733
748
|
fieldName: r.fieldName,
|
|
734
749
|
fieldType: r.fieldType,
|
|
735
750
|
multiTableSearch: r.multiTableSearch,
|
|
751
|
+
lookupFieldName: r.lookupFieldName,
|
|
736
752
|
jsonPath: r.jsonPath,
|
|
737
753
|
operator,
|
|
738
754
|
value: ""
|
|
@@ -3081,40 +3097,29 @@ var JSONBuilder = class {
|
|
|
3081
3097
|
// src/components/advanceSearch/builder/lookup.ts
|
|
3082
3098
|
var LookupBuilder = class {
|
|
3083
3099
|
build(row) {
|
|
3100
|
+
if (!Array.isArray(row.value)) {
|
|
3101
|
+
return {};
|
|
3102
|
+
}
|
|
3103
|
+
const lookupField = row.lookupFieldName ?? "id";
|
|
3084
3104
|
switch (row.operator) {
|
|
3085
3105
|
case "containsAny":
|
|
3086
3106
|
return {
|
|
3087
|
-
[row.fieldName]:
|
|
3088
|
-
{ hasSome: String(row.value).split(",") },
|
|
3089
|
-
{ multiTableSearch: row.multiTableSearch }
|
|
3090
|
-
)
|
|
3107
|
+
OR: row.value.map((v) => ({ [row.fieldName]: { some: { [lookupField]: v } } }))
|
|
3091
3108
|
};
|
|
3092
|
-
case "
|
|
3109
|
+
case "containsOnly":
|
|
3093
3110
|
return {
|
|
3094
|
-
[row.fieldName]:
|
|
3095
|
-
{ hasEvery: String(row.value).split(",") },
|
|
3096
|
-
{ multiTableSearch: row.multiTableSearch }
|
|
3097
|
-
)
|
|
3111
|
+
AND: row.value.map((v) => ({ [row.fieldName]: { some: { [lookupField]: v } } }))
|
|
3098
3112
|
};
|
|
3099
|
-
case "
|
|
3113
|
+
case "containsAll": {
|
|
3114
|
+
const includes = row.value.map((v) => ({ [row.fieldName]: { some: { [lookupField]: v } } }));
|
|
3115
|
+
const excludes = { [row.fieldName]: { none: { [lookupField]: { notIn: row.value } } } };
|
|
3100
3116
|
return {
|
|
3101
|
-
[
|
|
3102
|
-
{ equals: String(row.value).split(",") },
|
|
3103
|
-
{
|
|
3104
|
-
multiTableSearch: row.multiTableSearch,
|
|
3105
|
-
insensitive: true
|
|
3106
|
-
}
|
|
3107
|
-
)
|
|
3117
|
+
AND: [...includes, excludes]
|
|
3108
3118
|
};
|
|
3119
|
+
}
|
|
3109
3120
|
case "notContains":
|
|
3110
3121
|
return {
|
|
3111
|
-
[row.fieldName]:
|
|
3112
|
-
{ not: { contains: row.value } },
|
|
3113
|
-
{
|
|
3114
|
-
multiTableSearch: row.multiTableSearch,
|
|
3115
|
-
insensitive: true
|
|
3116
|
-
}
|
|
3117
|
-
)
|
|
3122
|
+
NOT: { OR: row.value.map((v) => ({ [row.fieldName]: { some: { [lookupField]: v } } })) }
|
|
3118
3123
|
};
|
|
3119
3124
|
default:
|
|
3120
3125
|
return {};
|