@databrainhq/plugin 0.8.17 → 0.8.19
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/components/FilterDropDown/index.d.ts +1 -1
- package/dist/components/MetricFilterDropDown/index.d.ts +4 -3
- package/dist/components/index.d.ts +1 -0
- package/dist/index.es.js +63 -73
- package/dist/index.umd.js +71 -71
- package/dist/style.css +1 -1
- package/dist/types/app.d.ts +1 -1
- package/package.json +1 -1
|
@@ -7,5 +7,5 @@ export declare type FilterDropDownProps = Omit<FloatingDropDownProps, 'options'
|
|
|
7
7
|
autoSelected?: boolean;
|
|
8
8
|
};
|
|
9
9
|
export declare const FilterDropDown: ({ companyId, filter, onChange, selectedOption, autoSelected, ...rest }: FilterDropDownProps) => JSX.Element;
|
|
10
|
-
export declare type MultiFilterDropDownProps = Pick<FilterDropDownProps, 'autoSelected' | 'companyId' | 'filter'> & Omit<MultiFloatingDropDownProps, 'options' | 'isDisabled'>;
|
|
10
|
+
export declare type MultiFilterDropDownProps = Pick<FilterDropDownProps, 'autoSelected' | 'companyId' | 'filter' | 'label'> & Omit<MultiFloatingDropDownProps, 'options' | 'isDisabled'>;
|
|
11
11
|
export declare const MultiFilterDropdown: React.FC<MultiFilterDropDownProps>;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { RlsCondition } from '@/types';
|
|
2
|
+
import { FloatingDropDownOption, RlsCondition } from '@/types';
|
|
3
3
|
declare type Props = {
|
|
4
4
|
rlsConditions?: RlsCondition[] | undefined;
|
|
5
|
-
onChangeFilterValue?: (name: string, value: string, customValue?: Record<string, Date
|
|
5
|
+
onChangeFilterValue?: (name: string, value: string, customValue?: Record<string, Date>, stringValues?: FloatingDropDownOption[]) => void;
|
|
6
|
+
companyId: string;
|
|
6
7
|
};
|
|
7
|
-
declare const MetricFilterDropDown: ({ rlsConditions, onChangeFilterValue, }: Props) => JSX.Element;
|
|
8
|
+
export declare const MetricFilterDropDown: ({ rlsConditions, onChangeFilterValue, companyId, }: Props) => JSX.Element;
|
|
8
9
|
export default MetricFilterDropDown;
|
package/dist/index.es.js
CHANGED
|
@@ -2514,7 +2514,6 @@ function useQuery(arg1, arg2, arg3) {
|
|
|
2514
2514
|
}
|
|
2515
2515
|
const container$h = "_container_1o0ns_1";
|
|
2516
2516
|
const fixed = "_fixed_1o0ns_1";
|
|
2517
|
-
const absolute = "_absolute_1o0ns_1";
|
|
2518
2517
|
const flex = "_flex_1o0ns_1";
|
|
2519
2518
|
const table$4 = "_table_1o0ns_1";
|
|
2520
2519
|
const grid = "_grid_1o0ns_1";
|
|
@@ -2536,11 +2535,6 @@ var styles$H = {
|
|
|
2536
2535
|
container: container$h,
|
|
2537
2536
|
"static": "_static_1o0ns_413",
|
|
2538
2537
|
fixed,
|
|
2539
|
-
absolute,
|
|
2540
|
-
"left-2": "_left-2_1o0ns_1",
|
|
2541
|
-
"top-1": "_top-1_1o0ns_1",
|
|
2542
|
-
"mt-2.5": "_mt-2.5_1o0ns_1",
|
|
2543
|
-
"mt-2": "_mt-2_1o0ns_1",
|
|
2544
2538
|
"mb-3": "_mb-3_1o0ns_1",
|
|
2545
2539
|
flex,
|
|
2546
2540
|
table: table$4,
|
|
@@ -2556,10 +2550,8 @@ var styles$H = {
|
|
|
2556
2550
|
truncate,
|
|
2557
2551
|
border,
|
|
2558
2552
|
"p-2": "_p-2_1o0ns_1",
|
|
2559
|
-
"p-1": "_p-1_1o0ns_1",
|
|
2560
2553
|
"text-center": "_text-center_1o0ns_1",
|
|
2561
2554
|
"text-sm": "_text-sm_1o0ns_1",
|
|
2562
|
-
"text-xs": "_text-xs_1o0ns_1",
|
|
2563
2555
|
"text-blue-700": "_text-blue-700_1o0ns_1",
|
|
2564
2556
|
shadow,
|
|
2565
2557
|
filter: filter$1,
|
|
@@ -8002,6 +7994,7 @@ const MultiFloatingDropDown = React__default.memo(({
|
|
|
8002
7994
|
options: options2,
|
|
8003
7995
|
isDisabled,
|
|
8004
7996
|
children: children2,
|
|
7997
|
+
labelDesign,
|
|
8005
7998
|
isSearchEnabled
|
|
8006
7999
|
}) => {
|
|
8007
8000
|
const [isShow, setIsShow] = useState(false);
|
|
@@ -8018,7 +8011,7 @@ const MultiFloatingDropDown = React__default.memo(({
|
|
|
8018
8011
|
children: [label2 ? /* @__PURE__ */ jsx(Text, {
|
|
8019
8012
|
variant: "span",
|
|
8020
8013
|
styleClass: labelVariant === "floating" ? "custom" : "font-14",
|
|
8021
|
-
className: `${styles$u.label} ${labelVariant === "floating" ? "
|
|
8014
|
+
className: `${styles$u.label} ${labelVariant === "floating" ? styles$u.floatingLabel : ""} ${labelDesign === "client" ? styles$u.clientText : styles$u.normalText} `,
|
|
8022
8015
|
children: label2
|
|
8023
8016
|
}) : null, /* @__PURE__ */ jsxs(Button, {
|
|
8024
8017
|
type: "button",
|
|
@@ -8029,7 +8022,7 @@ const MultiFloatingDropDown = React__default.memo(({
|
|
|
8029
8022
|
children: [/* @__PURE__ */ jsx(Text, {
|
|
8030
8023
|
variant: "p",
|
|
8031
8024
|
styleClass: "font-14",
|
|
8032
|
-
className: labelVariant === "floating" ?
|
|
8025
|
+
className: labelVariant === "floating" ? styles$u.floatingText : "",
|
|
8033
8026
|
children: "Select 1 or more option"
|
|
8034
8027
|
}), /* @__PURE__ */ jsx(materialSymbolsKeyboardArrowDown, {})]
|
|
8035
8028
|
}), isShow && !isDisabled && /* @__PURE__ */ jsxs("div", {
|
|
@@ -8119,6 +8112,7 @@ const MultiFilterDropdown = React__default.memo(({
|
|
|
8119
8112
|
autoSelected,
|
|
8120
8113
|
onChange,
|
|
8121
8114
|
selectedOptions,
|
|
8115
|
+
label: label2,
|
|
8122
8116
|
...rest
|
|
8123
8117
|
}) => {
|
|
8124
8118
|
const [data, setData] = useState([]);
|
|
@@ -8160,7 +8154,7 @@ const MultiFilterDropdown = React__default.memo(({
|
|
|
8160
8154
|
}] : selectedOptions,
|
|
8161
8155
|
isDisabled: !!filter2.defaultValue,
|
|
8162
8156
|
options: data,
|
|
8163
|
-
label: filter2.columnName,
|
|
8157
|
+
label: label2 || filter2.columnName,
|
|
8164
8158
|
...rest
|
|
8165
8159
|
});
|
|
8166
8160
|
});
|
|
@@ -88559,7 +88553,7 @@ const cteQuery = (queryStr, groupedConditions, dbName) => {
|
|
|
88559
88553
|
const asStrings = Object.keys(groupedConditions).map(
|
|
88560
88554
|
(key, index2) => `${cteNames[index2]} AS (
|
|
88561
88555
|
SELECT * FROM ${groupedConditions[key][0].tableName} WHERE ${groupedConditions[key].map(
|
|
88562
|
-
(c2) => c2.datatype === "date" ? `${c2.value}` : `${getConvertedColumn(c2.columnName, c2.datatype, dbName)} = ${typeof c2.value === "string" ? `'${c2.value}'` : c2.value}`
|
|
88556
|
+
(c2) => c2.datatype === "date" ? `${c2.value}` : `${getConvertedColumn(c2.columnName, c2.datatype, dbName)} ${Array.isArray(c2.value) ? "IN" : "="} ${Array.isArray(c2.value) ? `(${c2.value.map((v4) => typeof v4 === "string" ? `'${v4}'` : v4).join(", ")})` : typeof c2.value === "string" ? `'${c2.value}'` : c2.value}`
|
|
88563
88557
|
).join(" AND ")}
|
|
88564
88558
|
)`
|
|
88565
88559
|
);
|
|
@@ -95324,10 +95318,44 @@ var styles$5 = {
|
|
|
95324
95318
|
};
|
|
95325
95319
|
const MetricFilterDropDown = ({
|
|
95326
95320
|
rlsConditions,
|
|
95327
|
-
onChangeFilterValue
|
|
95321
|
+
onChangeFilterValue,
|
|
95322
|
+
companyId
|
|
95328
95323
|
}) => {
|
|
95329
95324
|
return /* @__PURE__ */ jsx("div", {
|
|
95330
|
-
children: !!(rlsConditions == null ? void 0 : rlsConditions.length) && onChangeFilterValue ? rlsConditions[0].datatype !== "date" ? /* @__PURE__ */ jsx("div", {
|
|
95325
|
+
children: !!(rlsConditions == null ? void 0 : rlsConditions.length) && onChangeFilterValue ? rlsConditions[0].datatype !== "date" ? rlsConditions[0].datatype === "string" ? rlsConditions[0].options.length ? /* @__PURE__ */ jsx("div", {
|
|
95326
|
+
className: styles$5.metricFilter,
|
|
95327
|
+
children: /* @__PURE__ */ jsx(MultiFloatingDropDown, {
|
|
95328
|
+
selectedOptions: Array.isArray(rlsConditions[0].value) && rlsConditions[0].value.length ? rlsConditions[0].value.map((val) => ({
|
|
95329
|
+
label: val,
|
|
95330
|
+
value: val
|
|
95331
|
+
})) : [],
|
|
95332
|
+
options: rlsConditions[0].options.map((o2) => ({
|
|
95333
|
+
value: o2,
|
|
95334
|
+
label: o2
|
|
95335
|
+
})),
|
|
95336
|
+
onChange: (options2) => onChangeFilterValue(rlsConditions[0].name, options2 == null ? void 0 : options2[0].value, void 0, options2),
|
|
95337
|
+
labelDesign: "client",
|
|
95338
|
+
label: rlsConditions[0].name
|
|
95339
|
+
})
|
|
95340
|
+
}) : /* @__PURE__ */ jsx("div", {
|
|
95341
|
+
className: styles$5.metricFilter,
|
|
95342
|
+
children: /* @__PURE__ */ jsx(MultiFilterDropdown, {
|
|
95343
|
+
selectedOptions: Array.isArray(rlsConditions[0].value) && rlsConditions[0].value.length ? rlsConditions[0].value.map((val) => ({
|
|
95344
|
+
label: val,
|
|
95345
|
+
value: val
|
|
95346
|
+
})) : [],
|
|
95347
|
+
onChange: (options2) => onChangeFilterValue(rlsConditions[0].name, options2 == null ? void 0 : options2[0].value, void 0, options2),
|
|
95348
|
+
filter: {
|
|
95349
|
+
tableName: rlsConditions[0].tableName,
|
|
95350
|
+
columnName: rlsConditions[0].columnName
|
|
95351
|
+
},
|
|
95352
|
+
companyId,
|
|
95353
|
+
isSearchEnabled: true,
|
|
95354
|
+
autoSelected: Array.isArray(rlsConditions[0].value) && !rlsConditions[0].value.length,
|
|
95355
|
+
labelDesign: "client",
|
|
95356
|
+
label: rlsConditions[0].name
|
|
95357
|
+
})
|
|
95358
|
+
}) : /* @__PURE__ */ jsx("div", {
|
|
95331
95359
|
className: styles$5.metricFilter,
|
|
95332
95360
|
children: /* @__PURE__ */ jsx(FloatingDropDown, {
|
|
95333
95361
|
label: rlsConditions[0].name,
|
|
@@ -95932,7 +95960,7 @@ const MetricCard = ({
|
|
|
95932
95960
|
updateDrilledData(dataDb, setGroupedData, drillDownSettings.selectedMeasures, drillDownSettings.selectedDimensions[0]);
|
|
95933
95961
|
}
|
|
95934
95962
|
}, [dataDb, drillDownSettings]);
|
|
95935
|
-
const onChangeFilterValue = (name, value, customValue) => {
|
|
95963
|
+
const onChangeFilterValue = (name, value, customValue, stringValues) => {
|
|
95936
95964
|
if (customValue) {
|
|
95937
95965
|
setRlsConditions((prev) => prev.map((rls) => rls.name === name ? {
|
|
95938
95966
|
...rls,
|
|
@@ -95942,6 +95970,11 @@ const MetricCard = ({
|
|
|
95942
95970
|
...customValue
|
|
95943
95971
|
} : option2)
|
|
95944
95972
|
} : rls));
|
|
95973
|
+
} else if (stringValues) {
|
|
95974
|
+
setRlsConditions((prev) => prev.map((rls) => rls.name === name ? {
|
|
95975
|
+
...rls,
|
|
95976
|
+
value: stringValues.map((v4) => v4.value)
|
|
95977
|
+
} : rls));
|
|
95945
95978
|
} else {
|
|
95946
95979
|
setRlsConditions((prev) => prev.map((rls) => rls.name === name ? {
|
|
95947
95980
|
...rls,
|
|
@@ -96013,7 +96046,8 @@ const MetricCard = ({
|
|
|
96013
96046
|
className: styles$6.features,
|
|
96014
96047
|
children: [/* @__PURE__ */ jsx(MetricFilterDropDown, {
|
|
96015
96048
|
rlsConditions,
|
|
96016
|
-
onChangeFilterValue
|
|
96049
|
+
onChangeFilterValue,
|
|
96050
|
+
companyId: metricItem == null ? void 0 : metricItem.companyId
|
|
96017
96051
|
}), /* @__PURE__ */ jsxs(PopoverMenu, {
|
|
96018
96052
|
buttonClass: styles$6.popup,
|
|
96019
96053
|
button: /* @__PURE__ */ jsx(Icons, {
|
|
@@ -96358,7 +96392,7 @@ const SingleValueCard = ({
|
|
|
96358
96392
|
const chartData = [{
|
|
96359
96393
|
value: singleValueData2[0]
|
|
96360
96394
|
}];
|
|
96361
|
-
const onChangeFilterValue = (name, value, customValue) => {
|
|
96395
|
+
const onChangeFilterValue = (name, value, customValue, stringValues) => {
|
|
96362
96396
|
if (customValue) {
|
|
96363
96397
|
setRlsConditions((prev) => prev.map((rls) => rls.name === name ? {
|
|
96364
96398
|
...rls,
|
|
@@ -96368,6 +96402,11 @@ const SingleValueCard = ({
|
|
|
96368
96402
|
...customValue
|
|
96369
96403
|
} : option2)
|
|
96370
96404
|
} : rls));
|
|
96405
|
+
} else if (stringValues) {
|
|
96406
|
+
setRlsConditions((prev) => prev.map((rls) => rls.name === name ? {
|
|
96407
|
+
...rls,
|
|
96408
|
+
value: stringValues.map((v4) => v4.value)
|
|
96409
|
+
} : rls));
|
|
96371
96410
|
} else {
|
|
96372
96411
|
setRlsConditions((prev) => prev.map((rls) => rls.name === name ? {
|
|
96373
96412
|
...rls,
|
|
@@ -96400,61 +96439,11 @@ const SingleValueCard = ({
|
|
|
96400
96439
|
})]
|
|
96401
96440
|
}), /* @__PURE__ */ jsxs("div", {
|
|
96402
96441
|
className: styles$6.features,
|
|
96403
|
-
children: [
|
|
96404
|
-
|
|
96405
|
-
|
|
96406
|
-
|
|
96407
|
-
|
|
96408
|
-
value: rlsConditions[0].value || rlsConditions[0].options[0],
|
|
96409
|
-
label: rlsConditions[0].value || rlsConditions[0].options[0]
|
|
96410
|
-
},
|
|
96411
|
-
options: rlsConditions[0].options.map((o2) => ({
|
|
96412
|
-
value: o2,
|
|
96413
|
-
label: o2
|
|
96414
|
-
})),
|
|
96415
|
-
onChange: (option2) => onChangeFilterValue(rlsConditions[0].name, option2.value)
|
|
96416
|
-
})
|
|
96417
|
-
}) : /* @__PURE__ */ jsx("div", {
|
|
96418
|
-
className: styles$6.metricFilter,
|
|
96419
|
-
children: /* @__PURE__ */ jsx(FloatingDropDown, {
|
|
96420
|
-
label: rlsConditions[0].name,
|
|
96421
|
-
selectedOption: {
|
|
96422
|
-
value: rlsConditions[0].value.name || rlsConditions[0].options[0].name,
|
|
96423
|
-
label: rlsConditions[0].value.name || rlsConditions[0].options[0].name
|
|
96424
|
-
},
|
|
96425
|
-
options: rlsConditions[0].options.map((o2) => ({
|
|
96426
|
-
value: o2.name,
|
|
96427
|
-
label: o2.name
|
|
96428
|
-
})),
|
|
96429
|
-
onChange: (option2) => onChangeFilterValue(rlsConditions[0].name, option2.value),
|
|
96430
|
-
children: rlsConditions[0].value === "Custom" ? /* @__PURE__ */ jsxs("div", {
|
|
96431
|
-
className: "p-1",
|
|
96432
|
-
children: [/* @__PURE__ */ jsx(InputField, {
|
|
96433
|
-
label: "From Date",
|
|
96434
|
-
type: "date",
|
|
96435
|
-
onChange: ({
|
|
96436
|
-
target: {
|
|
96437
|
-
value
|
|
96438
|
-
}
|
|
96439
|
-
}) => {
|
|
96440
|
-
onChangeFilterValue(rlsConditions[0].name, "Custom", {
|
|
96441
|
-
from: new Date(Date.parse(value))
|
|
96442
|
-
});
|
|
96443
|
-
}
|
|
96444
|
-
}), /* @__PURE__ */ jsx(InputField, {
|
|
96445
|
-
label: "To Date",
|
|
96446
|
-
type: "date",
|
|
96447
|
-
onChange: ({
|
|
96448
|
-
target: {
|
|
96449
|
-
value
|
|
96450
|
-
}
|
|
96451
|
-
}) => onChangeFilterValue(rlsConditions[0].name, "Custom", {
|
|
96452
|
-
to: new Date(Date.parse(value))
|
|
96453
|
-
})
|
|
96454
|
-
})]
|
|
96455
|
-
}) : null
|
|
96456
|
-
})
|
|
96457
|
-
})), (onEdit || onArchive) && /* @__PURE__ */ jsxs(PopoverMenu, {
|
|
96442
|
+
children: [/* @__PURE__ */ jsx(MetricFilterDropDown, {
|
|
96443
|
+
rlsConditions,
|
|
96444
|
+
onChangeFilterValue,
|
|
96445
|
+
companyId: metricItem == null ? void 0 : metricItem.companyId
|
|
96446
|
+
}), (onEdit || onArchive) && /* @__PURE__ */ jsxs(PopoverMenu, {
|
|
96458
96447
|
buttonClass: styles$6.popup,
|
|
96459
96448
|
button: /* @__PURE__ */ jsx(Icons, {
|
|
96460
96449
|
name: "more-icon",
|
|
@@ -96989,7 +96978,8 @@ var index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePropert
|
|
|
96989
96978
|
ToggleButton,
|
|
96990
96979
|
Icons,
|
|
96991
96980
|
ChartPopup,
|
|
96992
|
-
DrillBreadCrumb
|
|
96981
|
+
DrillBreadCrumb,
|
|
96982
|
+
MetricFilterDropDown
|
|
96993
96983
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
96994
96984
|
const icOutlineFilterAltOff = (props) => /* @__PURE__ */ jsx("svg", {
|
|
96995
96985
|
viewBox: "0 0 24 24",
|