@databrainhq/plugin 0.8.7 → 0.8.9

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.
@@ -1,3 +1,3 @@
1
1
  /// <reference types="react" />
2
2
  import { EmbeddedMetricCreationProps } from '@/types/metricCreate';
3
- export declare const EmbeddedMetricCreation: ({ clientId, companyId, mode, externalDashboardId, variant, chartColors, }: EmbeddedMetricCreationProps) => JSX.Element;
3
+ export declare const EmbeddedMetricCreation: ({ clientId, companyId, mode, externalDashboardId, variant, chartColors, workspaceId, }: EmbeddedMetricCreationProps) => JSX.Element;
@@ -17,12 +17,13 @@ declare type SelectInput = {
17
17
  containerClass?: string;
18
18
  isSearchEnabled?: boolean;
19
19
  textSize?: string;
20
+ labelDesign?: string;
20
21
  };
21
22
  declare type HookSelectInput = Omit<SelectInput, 'value'> & {
22
23
  control: Control;
23
24
  name: string;
24
25
  };
25
- export declare const Select: ({ label, options, onChange, value, defaultValue, children, placeHolder, className, containerClass, isSearchEnabled, textSize, }: SelectInput) => JSX.Element;
26
+ export declare const Select: ({ label, options, onChange, value, defaultValue, children, placeHolder, className, containerClass, isSearchEnabled, textSize, labelDesign, }: SelectInput) => JSX.Element;
26
27
  export declare const HookSelect: ({ control, name, ...rest }: HookSelectInput) => JSX.Element;
27
28
  export declare const SelectWithSubValue: ({ label, options, onChange, value, defaultValue, }: any) => JSX.Element;
28
29
  export declare const DropDown: ({ control, name, options, label, defaultValue, }: HookSelectInput) => JSX.Element;
@@ -51,5 +51,6 @@ export declare const useEmbeddedDashboard: (token: string) => {
51
51
  companyTenancyType: any;
52
52
  isAllowedToCreateMetrics: boolean;
53
53
  isAllowedToDeleteMetrics: boolean;
54
+ workspace: any;
54
55
  };
55
56
  };
package/dist/index.es.js CHANGED
@@ -4940,37 +4940,39 @@ let xe = "div", ne = S.RenderStrategy, re = C$2(function(e2, s2) {
4940
4940
  let n2 = useContext(F) !== null, m2 = s() !== null;
4941
4941
  return React__default.createElement(React__default.Fragment, null, !n2 && m2 ? React__default.createElement(q, { ref: s$12, ...e2 }) : React__default.createElement(re, { ref: s$12, ...e2 }));
4942
4942
  }), We = Object.assign(q, { Child: Pe, Root: q });
4943
- const listBoxButton = "_listBoxButton_1uwmw_9";
4944
- const selectedOptionText = "_selectedOptionText_1uwmw_33";
4945
- const transitionDiv = "_transitionDiv_1uwmw_41";
4946
- const listboxButtonWrapper = "_listboxButtonWrapper_1uwmw_49";
4947
- const arrowicon = "_arrowicon_1uwmw_55";
4948
- const leave$2 = "_leave_1uwmw_61";
4949
- const leaveFrom$2 = "_leaveFrom_1uwmw_67";
4950
- const leaveTo$2 = "_leaveTo_1uwmw_73";
4951
- const notAvailable = "_notAvailable_1uwmw_79";
4952
- const option$1 = "_option_1uwmw_85";
4953
- const activeOption = "_activeOption_1uwmw_91";
4954
- const optionSelected = "_optionSelected_1uwmw_97";
4955
- const inactiveOption = "_inactiveOption_1uwmw_103";
4956
- const optionLabel = "_optionLabel_1uwmw_109";
4957
- const optionSubLabel = "_optionSubLabel_1uwmw_115";
4958
- const selectedLabel = "_selectedLabel_1uwmw_121";
4959
- const nonselectedLabel = "_nonselectedLabel_1uwmw_127";
4960
- const check = "_check_1uwmw_133";
4961
- const checkActive = "_checkActive_1uwmw_139";
4962
- const checkInactive = "_checkInactive_1uwmw_145";
4963
- const checkIcon$1 = "_checkIcon_1uwmw_151";
4964
- const checkIconSelected = "_checkIconSelected_1uwmw_157";
4965
- const checkIconUnselected = "_checkIconUnselected_1uwmw_163";
4966
- const loadMore$1 = "_loadMore_1uwmw_169";
4967
- const selectedList = "_selectedList_1uwmw_175";
4968
- const selectedListItem = "_selectedListItem_1uwmw_181";
4943
+ const listBoxButton = "_listBoxButton_kdipy_9";
4944
+ const selectedOptionText = "_selectedOptionText_kdipy_33";
4945
+ const transitionDiv = "_transitionDiv_kdipy_41";
4946
+ const listboxButtonWrapper = "_listboxButtonWrapper_kdipy_49";
4947
+ const arrowicon = "_arrowicon_kdipy_55";
4948
+ const leave$2 = "_leave_kdipy_61";
4949
+ const leaveFrom$2 = "_leaveFrom_kdipy_67";
4950
+ const leaveTo$2 = "_leaveTo_kdipy_73";
4951
+ const notAvailable = "_notAvailable_kdipy_79";
4952
+ const option$1 = "_option_kdipy_85";
4953
+ const activeOption = "_activeOption_kdipy_91";
4954
+ const optionSelected = "_optionSelected_kdipy_97";
4955
+ const inactiveOption = "_inactiveOption_kdipy_103";
4956
+ const optionLabel = "_optionLabel_kdipy_109";
4957
+ const optionSubLabel = "_optionSubLabel_kdipy_115";
4958
+ const selectedLabel = "_selectedLabel_kdipy_121";
4959
+ const nonselectedLabel = "_nonselectedLabel_kdipy_127";
4960
+ const check = "_check_kdipy_133";
4961
+ const checkActive = "_checkActive_kdipy_139";
4962
+ const checkInactive = "_checkInactive_kdipy_145";
4963
+ const checkIcon$1 = "_checkIcon_kdipy_151";
4964
+ const checkIconSelected = "_checkIconSelected_kdipy_157";
4965
+ const checkIconUnselected = "_checkIconUnselected_kdipy_163";
4966
+ const loadMore$1 = "_loadMore_kdipy_169";
4967
+ const selectedList = "_selectedList_kdipy_175";
4968
+ const selectedListItem = "_selectedListItem_kdipy_181";
4969
+ const label$7 = "_label_kdipy_187";
4970
+ const clientText$1 = "_clientText_kdipy_193";
4969
4971
  var style = {
4970
- "listBox-label": "_listBox-label_1uwmw_1",
4971
- "listBoxButton-container": "_listBoxButton-container_1uwmw_9",
4972
+ "listBox-label": "_listBox-label_kdipy_1",
4973
+ "listBoxButton-container": "_listBoxButton-container_kdipy_9",
4972
4974
  listBoxButton,
4973
- "listBox-option": "_listBox-option_1uwmw_25",
4975
+ "listBox-option": "_listBox-option_kdipy_25",
4974
4976
  selectedOptionText,
4975
4977
  transitionDiv,
4976
4978
  listboxButtonWrapper,
@@ -4995,7 +4997,9 @@ var style = {
4995
4997
  checkIconUnselected,
4996
4998
  loadMore: loadMore$1,
4997
4999
  selectedList,
4998
- selectedListItem
5000
+ selectedListItem,
5001
+ label: label$7,
5002
+ clientText: clientText$1
4999
5003
  };
5000
5004
  const primary = "_primary_1ipyg_1";
5001
5005
  const secondary = "_secondary_1ipyg_9";
@@ -5129,7 +5133,8 @@ const Select = ({
5129
5133
  className = "",
5130
5134
  containerClass = "",
5131
5135
  isSearchEnabled,
5132
- textSize
5136
+ textSize,
5137
+ labelDesign
5133
5138
  }) => {
5134
5139
  const [searchKeyword, setSearchKeyword] = useState("");
5135
5140
  const [limit, setLimit] = useState(20);
@@ -5147,16 +5152,21 @@ const Select = ({
5147
5152
  children: ({
5148
5153
  open
5149
5154
  }) => /* @__PURE__ */ jsxs(Fragment, {
5150
- children: [label2 ? /* @__PURE__ */ jsx(pt.Label, {
5155
+ children: [label2 && !labelDesign ? /* @__PURE__ */ jsx(pt.Label, {
5151
5156
  className: style["listBox-label"],
5152
5157
  children: label2
5153
5158
  }) : null, /* @__PURE__ */ jsxs("div", {
5154
5159
  className: `${style.listboxButtonWrapper} ${className}`,
5155
5160
  children: [/* @__PURE__ */ jsxs(pt.Button, {
5156
5161
  className: style["listBoxButton-container"],
5157
- children: [/* @__PURE__ */ jsx("span", {
5162
+ children: [/* @__PURE__ */ jsxs("span", {
5158
5163
  className: style.selectedOptionText,
5159
- children: selectedOption2 == null ? void 0 : selectedOption2.label
5164
+ children: [label2 && labelDesign ? /* @__PURE__ */ jsx(Text, {
5165
+ variant: "span",
5166
+ styleClass: "custom",
5167
+ className: `${style.label} ${labelDesign === "client" ? style.clientText : ""} `,
5168
+ children: label2
5169
+ }) : null, selectedOption2 == null ? void 0 : selectedOption2.label]
5160
5170
  }), /* @__PURE__ */ jsx("span", {
5161
5171
  className: style.listBoxButton,
5162
5172
  children: /* @__PURE__ */ jsx(mdiChevronDown, {
@@ -6678,8 +6688,10 @@ const useGetClientDashboardLayoutQuery = (variables, options2) => useQuery(
6678
6688
  options2
6679
6689
  );
6680
6690
  const CompanySubsetTableDataDocument = `
6681
- mutation CompanySubsetTableData($clientId: String = "", $companyId: String = "") {
6682
- companySubsetTableData(input: {clientId: $clientId, companyId: $companyId}) {
6691
+ mutation CompanySubsetTableData($clientId: String = "", $companyId: String = "", $workspaceId: String = "") {
6692
+ companySubsetTableData(
6693
+ input: {clientId: $clientId, companyId: $companyId, workspaceId: $workspaceId}
6694
+ ) {
6683
6695
  companyIntegrationId
6684
6696
  dbName
6685
6697
  error {
@@ -7084,6 +7096,7 @@ const useEmbeddedDashboard = (token) => {
7084
7096
  const externalDashboardId = (_a2 = params.dashboard) == null ? void 0 : _a2.id;
7085
7097
  const companyId = tokenParams == null ? void 0 : tokenParams.companyId;
7086
7098
  const clientId = tokenParams == null ? void 0 : tokenParams.clientId;
7099
+ const workspace = params == null ? void 0 : params.workspace;
7087
7100
  const mode = (_b2 = params == null ? void 0 : params.dashboard) == null ? void 0 : _b2.isLive;
7088
7101
  const rlsSettings = params == null ? void 0 : params.rlsSettings;
7089
7102
  const companyTenancyType = params == null ? void 0 : params.companyTenancyType;
@@ -7118,7 +7131,8 @@ const useEmbeddedDashboard = (token) => {
7118
7131
  rlsSettings,
7119
7132
  companyTenancyType: companyTenancyType || "TABLE",
7120
7133
  isAllowedToCreateMetrics,
7121
- isAllowedToDeleteMetrics
7134
+ isAllowedToDeleteMetrics,
7135
+ workspace
7122
7136
  }
7123
7137
  };
7124
7138
  };
@@ -79277,7 +79291,7 @@ const BarChart = ({
79277
79291
  axisLabel: {
79278
79292
  show: !!((customSettings == null ? void 0 : customSettings.axisLabels) === "y" || (customSettings == null ? void 0 : customSettings.axisLabels) === "none"),
79279
79293
  interval: 0,
79280
- rotate: 50,
79294
+ rotate: customSettings.xRotation,
79281
79295
  hideOverlap: true,
79282
79296
  overflow: "truncate"
79283
79297
  },
@@ -81481,6 +81495,9 @@ const SingleValueChart = ({
81481
81495
  const value2 = adaptiveFormatter(val, true);
81482
81496
  return value2;
81483
81497
  }
81498
+ case "percent": {
81499
+ return `${val}%`;
81500
+ }
81484
81501
  case "d": {
81485
81502
  const n2 = parseInt(val, 10);
81486
81503
  return n2.toLocaleString();
@@ -87106,6 +87123,26 @@ const ChartConfigure = ({
87106
87123
  }))
87107
87124
  })
87108
87125
  })]
87126
+ }), chartType2 === "bar" && /* @__PURE__ */ jsxs("div", {
87127
+ className: styles$g.seriesWrapper,
87128
+ children: [/* @__PURE__ */ jsxs(Text, {
87129
+ variant: "h1",
87130
+ styleClass: "font-14",
87131
+ className: styles$g.label,
87132
+ children: ["Modify X-Axis label rotation", /* @__PURE__ */ jsx(InfoTooltip, {
87133
+ children: "Rotate X-Axis label to a certain angle"
87134
+ })]
87135
+ }), /* @__PURE__ */ jsx(InputField, {
87136
+ type: "number",
87137
+ max: 100,
87138
+ min: 0,
87139
+ label: "",
87140
+ onChange: (e2) => setCustomSettings((m2) => ({
87141
+ ...m2,
87142
+ xRotation: parseInt(e2.target.value, 10)
87143
+ })),
87144
+ value: customSettings.xRotation
87145
+ })]
87109
87146
  }), chartType2 === "bar" || chartType2 === "row" || chartType2 === "stack" || chartType2 === "histogram" ? /* @__PURE__ */ jsx(InputField, {
87110
87147
  type: "checkbox",
87111
87148
  label: "Show Bar Background",
@@ -87378,6 +87415,9 @@ const ChartConfigure = ({
87378
87415
  }, {
87379
87416
  label: "Adaptive formatting",
87380
87417
  value: "adaptive"
87418
+ }, {
87419
+ label: "Percentage",
87420
+ value: "percent"
87381
87421
  }, {
87382
87422
  label: ",d (12345.432 => 12,345)",
87383
87423
  value: "d"
@@ -88831,6 +88871,7 @@ const MetricForm = ({
88831
88871
  const isBigQuery = database === "Bigquery";
88832
88872
  const isMySql = database === "MySql";
88833
88873
  const isMongoDb = database === "MongoDB";
88874
+ const isPostgres = database === "Postgres" || database === "Redshift";
88834
88875
  const isNullFilter = operator.value === "IS NULL" || operator.value === "IS NOT NULL";
88835
88876
  const isInFilter = operator.value === "IN" || operator.value === "NOT IN";
88836
88877
  const isFilterValue = isNullFilter ? true : isInFilter ? !!selectedFilterValues.length : !!filterValue.value;
@@ -88985,7 +89026,7 @@ const MetricForm = ({
88985
89026
  isDisabled: !metricAggregate.value || !metricColumn.value,
88986
89027
  onClick: () => {
88987
89028
  setMetrics((prev) => [...prev, {
88988
- value: `${metricAggregate.value}(${isBigQuery || isMySql ? `${metricColumn.value}` : isMongoDb ? `\`${metricColumn.value}\`` : `"${metricColumn.value}"`})`,
89029
+ value: `${isPostgres && metricAggregate.value === "COUNT_DISTINCT" ? `COUNT(DISTINCT "${metricColumn.value}" )` : `${metricAggregate.value}(${isBigQuery || isMySql ? `${metricColumn.value}` : isMongoDb ? `\`${metricColumn.value}\`` : `"${metricColumn.value}"`})`}`,
88989
89030
  as: isBigQuery ? aliasValue || `_result` : aliasValue || `${metricAggregate.value}(${metricColumn.label})`
88990
89031
  }]);
88991
89032
  setOpenMetric(false);
@@ -89200,7 +89241,7 @@ const MetricForm = ({
89200
89241
  className: styles$9.fieldValueIcon
89201
89242
  })]
89202
89243
  }), /* @__PURE__ */ jsxs(Modal, {
89203
- headerTitle: !columns.length ? sortColumn.value && sortAggregate.value ? `${sortAggregate.value}(${sortColumn.value})` : "Create sort" : sortColumn.value ? `${sortColumn.value}` : "Create sort",
89244
+ headerTitle: !columns.length ? sortColumn.value && sortAggregate.value ? `${isPostgres && sortAggregate.value === "COUNT_DISTINCT" ? `COUNT(DISTINCT ${sortColumn.value})` : `${sortAggregate.value}(${sortColumn.value})`}` : "Create sort" : sortColumn.value ? `${sortColumn.value}` : "Create sort",
89204
89245
  isOpen: isOpenSort,
89205
89246
  onClose: () => setOpenSort(false),
89206
89247
  children: [/* @__PURE__ */ jsxs("div", {
@@ -89425,7 +89466,8 @@ const EmbeddedMetricCreation = ({
89425
89466
  mode,
89426
89467
  externalDashboardId,
89427
89468
  variant = "static",
89428
- chartColors
89469
+ chartColors,
89470
+ workspaceId
89429
89471
  }) => {
89430
89472
  var _a2;
89431
89473
  const [isLoading, setLoading] = useState(false);
@@ -89479,7 +89521,8 @@ const EmbeddedMetricCreation = ({
89479
89521
  if (clientId && companyId) {
89480
89522
  getCompanySubsetTableData({
89481
89523
  clientId,
89482
- companyId
89524
+ companyId,
89525
+ workspaceId
89483
89526
  }, {
89484
89527
  onSuccess(response) {
89485
89528
  var _a3;
@@ -89527,7 +89570,8 @@ const EmbeddedMetricCreation = ({
89527
89570
  displayText: "",
89528
89571
  subHeaderFontSize: 0,
89529
89572
  dateFormatter: "none",
89530
- numberFormatter: "original"
89573
+ numberFormatter: "original",
89574
+ xRotation: 50
89531
89575
  });
89532
89576
  const [tableSettings, setTableSettings] = useState({
89533
89577
  contentAlignment: "center",
@@ -95741,7 +95785,8 @@ const MetricCard = ({
95741
95785
  displayText: "",
95742
95786
  subHeaderFontSize: 0,
95743
95787
  dateFormatter: "none",
95744
- numberFormatter: "original"
95788
+ numberFormatter: "original",
95789
+ xRotation: 50
95745
95790
  });
95746
95791
  const [backGroundColor, setBackGroundColor] = useState({
95747
95792
  show: false
@@ -95775,7 +95820,8 @@ const MetricCard = ({
95775
95820
  displayText: "",
95776
95821
  subHeaderFontSize: 0,
95777
95822
  dateFormatter: "none",
95778
- numberFormatter: "original"
95823
+ numberFormatter: "original",
95824
+ xRotation: 50
95779
95825
  });
95780
95826
  setEnableGroupBy(metricItem == null ? void 0 : metricItem.isEnableGroupBy);
95781
95827
  setSelectedGroupBy(metricItem == null ? void 0 : metricItem.selectedGroupBy);
@@ -96224,7 +96270,8 @@ const SingleValueCard = ({
96224
96270
  displayText: "",
96225
96271
  subHeaderFontSize: 0,
96226
96272
  dateFormatter: "none",
96227
- numberFormatter: "original"
96273
+ numberFormatter: "original",
96274
+ xRotation: 50
96228
96275
  });
96229
96276
  const {
96230
96277
  data: metricdata,
@@ -96259,7 +96306,8 @@ const SingleValueCard = ({
96259
96306
  displayText: "",
96260
96307
  subHeaderFontSize: 0,
96261
96308
  dateFormatter: "none",
96262
- numberFormatter: "original"
96309
+ numberFormatter: "original",
96310
+ xRotation: 50
96263
96311
  });
96264
96312
  setClickBehaviourConfigs(metricItem.clickActions || {
96265
96313
  card: {
@@ -96815,7 +96863,7 @@ const EmbeddedDashboard = React__default.memo(({
96815
96863
  options: options2,
96816
96864
  theme: theme2
96817
96865
  }) => {
96818
- var _a2, _b2;
96866
+ var _a2, _b2, _c2;
96819
96867
  const {
96820
96868
  data,
96821
96869
  isLoading
@@ -96833,8 +96881,8 @@ const EmbeddedDashboard = React__default.memo(({
96833
96881
  enabled: !!data.companyId
96834
96882
  });
96835
96883
  const [adminTheme, adminThemeChartColors] = useMemo(() => {
96836
- var _a3, _b3, _c2, _d;
96837
- const colors2 = (_d = (_c2 = (_b3 = (_a3 = adminThemeData == null ? void 0 : adminThemeData.themes[0]) == null ? void 0 : _a3.chart) == null ? void 0 : _b3.palettes) == null ? void 0 : _c2.find((palette) => {
96884
+ var _a3, _b3, _c3, _d;
96885
+ const colors2 = (_d = (_c3 = (_b3 = (_a3 = adminThemeData == null ? void 0 : adminThemeData.themes[0]) == null ? void 0 : _a3.chart) == null ? void 0 : _b3.palettes) == null ? void 0 : _c3.find((palette) => {
96838
96886
  var _a4, _b4;
96839
96887
  return palette.name === ((_b4 = (_a4 = adminThemeData.themes[0]) == null ? void 0 : _a4.chart) == null ? void 0 : _b4.selected);
96840
96888
  })) == null ? void 0 : _d.colors;
@@ -96872,7 +96920,8 @@ const EmbeddedDashboard = React__default.memo(({
96872
96920
  mode: data.mode,
96873
96921
  externalDashboardId: data.externalDashboard.id,
96874
96922
  variant: options2 == null ? void 0 : options2.headerVariant,
96875
- chartColors: adminThemeChartColors != null ? adminThemeChartColors : options2 == null ? void 0 : options2.chartColors
96923
+ chartColors: adminThemeChartColors != null ? adminThemeChartColors : options2 == null ? void 0 : options2.chartColors,
96924
+ workspaceId: (_b2 = data.workspace) == null ? void 0 : _b2.id
96876
96925
  })]
96877
96926
  })]
96878
96927
  }), /* @__PURE__ */ jsxs("div", {
@@ -96906,7 +96955,7 @@ const EmbeddedDashboard = React__default.memo(({
96906
96955
  color: "blue"
96907
96956
  }
96908
96957
  })
96909
- }), !isLoading && !((_b2 = data.externalDashboard) == null ? void 0 : _b2.id) && /* @__PURE__ */ jsx("div", {
96958
+ }), !isLoading && !((_c2 = data.externalDashboard) == null ? void 0 : _c2.id) && /* @__PURE__ */ jsx("div", {
96910
96959
  className: styles$F["alt-container"],
96911
96960
  children: "Invalid token or Dashboard id"
96912
96961
  })]