@sustaina/shared-ui 1.2.0 → 1.3.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 +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +25 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +25 -14
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -317,9 +317,10 @@ type NavbarBaseProps = {
|
|
|
317
317
|
onMainButtonClick?: () => void;
|
|
318
318
|
onSubButtonClick?: () => void;
|
|
319
319
|
searchButton?: React__default.ReactNode;
|
|
320
|
+
separatorDisable?: boolean;
|
|
320
321
|
};
|
|
321
322
|
type NavbarProps = RequireAtLeastOne<NavbarBaseProps, "title" | "headImageURL">;
|
|
322
|
-
declare const _default: React__default.MemoExoticComponent<({ className, title, subTitle, headImageURL, headImageURLClassName, tooltipTitle, tooltipIcon, tooltipdescription, mainButtonText, mainButtonClassName, mainButtonDisable, subButtonText, subButtonClassName, subButtonDisable, onMainButtonClick, onSubButtonClick, searchButton }: NavbarProps) => react_jsx_runtime.JSX.Element>;
|
|
323
|
+
declare const _default: React__default.MemoExoticComponent<({ className, title, subTitle, headImageURL, headImageURLClassName, tooltipTitle, tooltipIcon, tooltipdescription, mainButtonText, mainButtonClassName, mainButtonDisable, subButtonText, subButtonClassName, subButtonDisable, onMainButtonClick, onSubButtonClick, separatorDisable, searchButton }: NavbarProps) => react_jsx_runtime.JSX.Element>;
|
|
323
324
|
|
|
324
325
|
type FieldType = "text" | "number" | "date" | "datetime" | "checkbox" | "dropdown" | "lookup";
|
|
325
326
|
type Option = {
|
|
@@ -347,6 +348,7 @@ interface AdvanceSearchProps {
|
|
|
347
348
|
limitRows?: number;
|
|
348
349
|
iconColor?: string;
|
|
349
350
|
onSearch?: (param: Record<string, unknown>) => void;
|
|
351
|
+
onClear?: () => void;
|
|
350
352
|
}
|
|
351
353
|
|
|
352
354
|
declare const AdvanceSearch: React__default.FC<AdvanceSearchProps>;
|
package/dist/index.d.ts
CHANGED
|
@@ -317,9 +317,10 @@ type NavbarBaseProps = {
|
|
|
317
317
|
onMainButtonClick?: () => void;
|
|
318
318
|
onSubButtonClick?: () => void;
|
|
319
319
|
searchButton?: React__default.ReactNode;
|
|
320
|
+
separatorDisable?: boolean;
|
|
320
321
|
};
|
|
321
322
|
type NavbarProps = RequireAtLeastOne<NavbarBaseProps, "title" | "headImageURL">;
|
|
322
|
-
declare const _default: React__default.MemoExoticComponent<({ className, title, subTitle, headImageURL, headImageURLClassName, tooltipTitle, tooltipIcon, tooltipdescription, mainButtonText, mainButtonClassName, mainButtonDisable, subButtonText, subButtonClassName, subButtonDisable, onMainButtonClick, onSubButtonClick, searchButton }: NavbarProps) => react_jsx_runtime.JSX.Element>;
|
|
323
|
+
declare const _default: React__default.MemoExoticComponent<({ className, title, subTitle, headImageURL, headImageURLClassName, tooltipTitle, tooltipIcon, tooltipdescription, mainButtonText, mainButtonClassName, mainButtonDisable, subButtonText, subButtonClassName, subButtonDisable, onMainButtonClick, onSubButtonClick, separatorDisable, searchButton }: NavbarProps) => react_jsx_runtime.JSX.Element>;
|
|
323
324
|
|
|
324
325
|
type FieldType = "text" | "number" | "date" | "datetime" | "checkbox" | "dropdown" | "lookup";
|
|
325
326
|
type Option = {
|
|
@@ -347,6 +348,7 @@ interface AdvanceSearchProps {
|
|
|
347
348
|
limitRows?: number;
|
|
348
349
|
iconColor?: string;
|
|
349
350
|
onSearch?: (param: Record<string, unknown>) => void;
|
|
351
|
+
onClear?: () => void;
|
|
350
352
|
}
|
|
351
353
|
|
|
352
354
|
declare const AdvanceSearch: React__default.FC<AdvanceSearchProps>;
|
package/dist/index.js
CHANGED
|
@@ -1505,7 +1505,9 @@ function SortableRow({
|
|
|
1505
1505
|
children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue, { placeholder: "Choose column..." })
|
|
1506
1506
|
}
|
|
1507
1507
|
) }),
|
|
1508
|
-
/* @__PURE__ */ jsxRuntime.jsx(SelectContent, { children: options.filter(
|
|
1508
|
+
/* @__PURE__ */ jsxRuntime.jsx(SelectContent, { children: options.filter(
|
|
1509
|
+
(i2) => i2.id === field.value || !currentColumns?.some((c, idx) => c.id === i2.id && idx !== index)
|
|
1510
|
+
).sort(
|
|
1509
1511
|
(a, b) => a.id === field.value ? -1 : b.id === field.value ? 1 : 0
|
|
1510
1512
|
).map((opt) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1511
1513
|
SelectItem,
|
|
@@ -1719,16 +1721,16 @@ var GridSettingsModal = ({
|
|
|
1719
1721
|
{
|
|
1720
1722
|
items: fields?.slice(1).map((c) => c?.fieldId),
|
|
1721
1723
|
strategy: sortable.verticalListSortingStrategy,
|
|
1722
|
-
children: fields?.slice(1).map((col,
|
|
1724
|
+
children: fields?.slice(1).map((col, index2) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1723
1725
|
SortableRow,
|
|
1724
1726
|
{
|
|
1725
1727
|
value: col?.fieldId,
|
|
1726
1728
|
control,
|
|
1727
|
-
name: `columns.${
|
|
1729
|
+
name: `columns.${index2 + 1}.id`,
|
|
1728
1730
|
isDragging,
|
|
1729
1731
|
availableColumns,
|
|
1730
1732
|
currentColumns: fields,
|
|
1731
|
-
onRemove: () => remove(
|
|
1733
|
+
onRemove: () => remove(index2 + 1)
|
|
1732
1734
|
},
|
|
1733
1735
|
col?.fieldId
|
|
1734
1736
|
))
|
|
@@ -1861,10 +1863,12 @@ var Navbar = ({
|
|
|
1861
1863
|
subButtonDisable = false,
|
|
1862
1864
|
onMainButtonClick,
|
|
1863
1865
|
onSubButtonClick,
|
|
1866
|
+
separatorDisable = false,
|
|
1864
1867
|
searchButton
|
|
1865
1868
|
}) => {
|
|
1866
1869
|
const { isMobile, isTablet, isDesktop } = useScreenSize_default();
|
|
1867
1870
|
const Icon3 = lucideReact.CircleHelp;
|
|
1871
|
+
const shouldShowSeparator = !separatorDisable && React3.isValidElement(searchButton);
|
|
1868
1872
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1869
1873
|
"nav",
|
|
1870
1874
|
{
|
|
@@ -1960,7 +1964,7 @@ var Navbar = ({
|
|
|
1960
1964
|
children: subButtonText
|
|
1961
1965
|
}
|
|
1962
1966
|
),
|
|
1963
|
-
|
|
1967
|
+
shouldShowSeparator && /* @__PURE__ */ jsxRuntime.jsx("div", { role: "separator", className: "ml-1 w-[1px] h-10 bg-white" }),
|
|
1964
1968
|
React3.isValidElement(searchButton) ? searchButton : ""
|
|
1965
1969
|
] })
|
|
1966
1970
|
]
|
|
@@ -2613,8 +2617,8 @@ var TagsInput = ({ value = [], onChange, onClear, error }) => {
|
|
|
2613
2617
|
onChange([...value, trimmed]);
|
|
2614
2618
|
setInputValue("");
|
|
2615
2619
|
};
|
|
2616
|
-
const removeTag = (
|
|
2617
|
-
const newTags = value.filter((_, i2) => i2 !==
|
|
2620
|
+
const removeTag = (index2) => {
|
|
2621
|
+
const newTags = value.filter((_, i2) => i2 !== index2);
|
|
2618
2622
|
onChange(newTags);
|
|
2619
2623
|
};
|
|
2620
2624
|
const handleKeyDown = (e2) => {
|
|
@@ -2953,8 +2957,8 @@ function buildLocalizeFn(args) {
|
|
|
2953
2957
|
const width = options?.width ? String(options.width) : args.defaultWidth;
|
|
2954
2958
|
valuesArray = args.values[width] || args.values[defaultWidth];
|
|
2955
2959
|
}
|
|
2956
|
-
const
|
|
2957
|
-
return valuesArray[
|
|
2960
|
+
const index2 = args.argumentCallback ? args.argumentCallback(value) : value;
|
|
2961
|
+
return valuesArray[index2];
|
|
2958
2962
|
};
|
|
2959
2963
|
}
|
|
2960
2964
|
|
|
@@ -3274,7 +3278,7 @@ var match = {
|
|
|
3274
3278
|
defaultMatchWidth: "wide",
|
|
3275
3279
|
parsePatterns: parseQuarterPatterns,
|
|
3276
3280
|
defaultParseWidth: "any",
|
|
3277
|
-
valueCallback: (
|
|
3281
|
+
valueCallback: (index2) => index2 + 1
|
|
3278
3282
|
}),
|
|
3279
3283
|
month: buildMatchFn({
|
|
3280
3284
|
matchPatterns: matchMonthPatterns,
|
|
@@ -4716,7 +4720,8 @@ var AdvanceSearch = ({
|
|
|
4716
4720
|
portalId,
|
|
4717
4721
|
iconColor = "#ffffff",
|
|
4718
4722
|
limitRows = 4,
|
|
4719
|
-
onSearch
|
|
4723
|
+
onSearch,
|
|
4724
|
+
onClear
|
|
4720
4725
|
}) => {
|
|
4721
4726
|
const fieldsData = React3.useMemo(() => fields || [], [fields]);
|
|
4722
4727
|
const {
|
|
@@ -4759,6 +4764,8 @@ var AdvanceSearch = ({
|
|
|
4759
4764
|
return { [r2.fieldName]: { startsWith: val1 } };
|
|
4760
4765
|
case "endsWith":
|
|
4761
4766
|
return { [r2.fieldName]: { endsWith: val1 } };
|
|
4767
|
+
case "equals":
|
|
4768
|
+
return { [r2.fieldName]: { equals: val1 } };
|
|
4762
4769
|
case "notEquals":
|
|
4763
4770
|
return { [r2.fieldName]: { not: val1 } };
|
|
4764
4771
|
case "gt":
|
|
@@ -4785,8 +4792,12 @@ var AdvanceSearch = ({
|
|
|
4785
4792
|
return { [r2.fieldName]: { hasEvery: String(val1).split(",") } };
|
|
4786
4793
|
case "containsOnly":
|
|
4787
4794
|
return { [r2.fieldName]: { equals: String(val1).split(",") } };
|
|
4788
|
-
|
|
4789
|
-
return { [r2.fieldName]: val1 };
|
|
4795
|
+
case "on":
|
|
4796
|
+
return { [r2.fieldName]: { on: val1 } };
|
|
4797
|
+
case "after":
|
|
4798
|
+
return { [r2.fieldName]: { after: val1 } };
|
|
4799
|
+
case "before":
|
|
4800
|
+
return { [r2.fieldName]: { before: val1 } };
|
|
4790
4801
|
}
|
|
4791
4802
|
}).filter(Boolean)
|
|
4792
4803
|
};
|
|
@@ -4842,7 +4853,7 @@ var AdvanceSearch = ({
|
|
|
4842
4853
|
onClick: () => {
|
|
4843
4854
|
clearAllRow();
|
|
4844
4855
|
Object.keys(getValues()).forEach((k) => resetField(k));
|
|
4845
|
-
|
|
4856
|
+
if (onClear) onClear();
|
|
4846
4857
|
},
|
|
4847
4858
|
children: "Clear Search"
|
|
4848
4859
|
}
|