@sustaina/shared-ui 1.30.3 → 1.31.0
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 +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +18 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -48,7 +48,9 @@ interface FieldSchemaBase<T extends FieldType> {
|
|
|
48
48
|
interface DropdownFieldSchema extends FieldSchemaBase<"dropdown"> {
|
|
49
49
|
options: Option[];
|
|
50
50
|
}
|
|
51
|
-
|
|
51
|
+
interface TextFieldSchema extends FieldSchemaBase<"text"> {
|
|
52
|
+
allowRegex?: RegExp;
|
|
53
|
+
}
|
|
52
54
|
type NumberFieldSchema = FieldSchemaBase<"number">;
|
|
53
55
|
type DateFieldSchema = FieldSchemaBase<"date">;
|
|
54
56
|
type DateTimeFieldSchema = FieldSchemaBase<"datetime">;
|
|
@@ -84,6 +86,7 @@ type RowState = {
|
|
|
84
86
|
multiTableSearch?: boolean;
|
|
85
87
|
jsonPath?: string[];
|
|
86
88
|
lookupFieldName?: string;
|
|
89
|
+
allowRegex?: RegExp;
|
|
87
90
|
} | {
|
|
88
91
|
id: string;
|
|
89
92
|
fieldName: string;
|
|
@@ -94,6 +97,7 @@ type RowState = {
|
|
|
94
97
|
multiTableSearch?: boolean;
|
|
95
98
|
jsonPath?: string[];
|
|
96
99
|
lookupFieldName?: string;
|
|
100
|
+
allowRegex?: RegExp;
|
|
97
101
|
};
|
|
98
102
|
interface Params {
|
|
99
103
|
AND: Record<string, unknown>[];
|
package/dist/index.d.ts
CHANGED
|
@@ -48,7 +48,9 @@ interface FieldSchemaBase<T extends FieldType> {
|
|
|
48
48
|
interface DropdownFieldSchema extends FieldSchemaBase<"dropdown"> {
|
|
49
49
|
options: Option[];
|
|
50
50
|
}
|
|
51
|
-
|
|
51
|
+
interface TextFieldSchema extends FieldSchemaBase<"text"> {
|
|
52
|
+
allowRegex?: RegExp;
|
|
53
|
+
}
|
|
52
54
|
type NumberFieldSchema = FieldSchemaBase<"number">;
|
|
53
55
|
type DateFieldSchema = FieldSchemaBase<"date">;
|
|
54
56
|
type DateTimeFieldSchema = FieldSchemaBase<"datetime">;
|
|
@@ -84,6 +86,7 @@ type RowState = {
|
|
|
84
86
|
multiTableSearch?: boolean;
|
|
85
87
|
jsonPath?: string[];
|
|
86
88
|
lookupFieldName?: string;
|
|
89
|
+
allowRegex?: RegExp;
|
|
87
90
|
} | {
|
|
88
91
|
id: string;
|
|
89
92
|
fieldName: string;
|
|
@@ -94,6 +97,7 @@ type RowState = {
|
|
|
94
97
|
multiTableSearch?: boolean;
|
|
95
98
|
jsonPath?: string[];
|
|
96
99
|
lookupFieldName?: string;
|
|
100
|
+
allowRegex?: RegExp;
|
|
97
101
|
};
|
|
98
102
|
interface Params {
|
|
99
103
|
AND: Record<string, unknown>[];
|
package/dist/index.js
CHANGED
|
@@ -740,7 +740,8 @@ function makeNewRow(field) {
|
|
|
740
740
|
operator: op,
|
|
741
741
|
value: "",
|
|
742
742
|
multiTableSearch: field.multiTableSearch,
|
|
743
|
-
lookupFieldName: field.lookupFieldName
|
|
743
|
+
lookupFieldName: field.lookupFieldName,
|
|
744
|
+
allowRegex: field.type === "text" ? field.allowRegex : void 0
|
|
744
745
|
};
|
|
745
746
|
}
|
|
746
747
|
function useAdvanceSearch({ fields, limitRows }) {
|
|
@@ -783,7 +784,8 @@ function useAdvanceSearch({ fields, limitRows }) {
|
|
|
783
784
|
value2: "",
|
|
784
785
|
multiTableSearch: r.multiTableSearch,
|
|
785
786
|
jsonPath: r.jsonPath,
|
|
786
|
-
lookupFieldName: r.lookupFieldName
|
|
787
|
+
lookupFieldName: r.lookupFieldName,
|
|
788
|
+
allowRegex: r.allowRegex
|
|
787
789
|
} : {
|
|
788
790
|
id: r.id,
|
|
789
791
|
fieldName: r.fieldName,
|
|
@@ -792,7 +794,8 @@ function useAdvanceSearch({ fields, limitRows }) {
|
|
|
792
794
|
value: "",
|
|
793
795
|
multiTableSearch: r.multiTableSearch,
|
|
794
796
|
jsonPath: r.jsonPath,
|
|
795
|
-
lookupFieldName: r.lookupFieldName
|
|
797
|
+
lookupFieldName: r.lookupFieldName,
|
|
798
|
+
allowRegex: r.allowRegex
|
|
796
799
|
};
|
|
797
800
|
})
|
|
798
801
|
);
|
|
@@ -840,7 +843,8 @@ function useAdvanceSearch({ fields, limitRows }) {
|
|
|
840
843
|
lookupFieldName: r.lookupFieldName,
|
|
841
844
|
jsonPath: r.jsonPath,
|
|
842
845
|
operator,
|
|
843
|
-
value: ""
|
|
846
|
+
value: "",
|
|
847
|
+
allowRegex: r.allowRegex
|
|
844
848
|
};
|
|
845
849
|
})
|
|
846
850
|
);
|
|
@@ -1430,11 +1434,19 @@ var ConditionTextInput = ({ row, control, onClear }) => /* @__PURE__ */ jsxRunti
|
|
|
1430
1434
|
field.onChange("");
|
|
1431
1435
|
onClear("value");
|
|
1432
1436
|
};
|
|
1437
|
+
const handleChange = (e) => {
|
|
1438
|
+
const val = e.target.value;
|
|
1439
|
+
if (val !== "" && row.allowRegex && !row.allowRegex.test(val)) {
|
|
1440
|
+
return;
|
|
1441
|
+
}
|
|
1442
|
+
field.onChange(val);
|
|
1443
|
+
};
|
|
1433
1444
|
return /* @__PURE__ */ jsxRuntime.jsxs(FormItem, { className: "relative", children: [
|
|
1434
1445
|
/* @__PURE__ */ jsxRuntime.jsx(FormControl, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1435
1446
|
Input,
|
|
1436
1447
|
{
|
|
1437
1448
|
...field,
|
|
1449
|
+
onChange: handleChange,
|
|
1438
1450
|
value: field.value ?? "",
|
|
1439
1451
|
autoComplete: "off",
|
|
1440
1452
|
inputMode: "text",
|
|
@@ -3169,7 +3181,8 @@ var DatetimeBuilder = class {
|
|
|
3169
3181
|
case "after":
|
|
3170
3182
|
return {
|
|
3171
3183
|
[row.fieldName]: helper(
|
|
3172
|
-
{ gte:
|
|
3184
|
+
{ gte: dayEnd.toISOString() },
|
|
3185
|
+
// use end of the day time
|
|
3173
3186
|
{ multiTableSearch: row.multiTableSearch }
|
|
3174
3187
|
)
|
|
3175
3188
|
};
|