@databrainhq/plugin 0.8.8 → 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.
@@ -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;
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, {
@@ -79281,7 +79291,7 @@ const BarChart = ({
79281
79291
  axisLabel: {
79282
79292
  show: !!((customSettings == null ? void 0 : customSettings.axisLabels) === "y" || (customSettings == null ? void 0 : customSettings.axisLabels) === "none"),
79283
79293
  interval: 0,
79284
- rotate: 50,
79294
+ rotate: customSettings.xRotation,
79285
79295
  hideOverlap: true,
79286
79296
  overflow: "truncate"
79287
79297
  },
@@ -81485,6 +81495,9 @@ const SingleValueChart = ({
81485
81495
  const value2 = adaptiveFormatter(val, true);
81486
81496
  return value2;
81487
81497
  }
81498
+ case "percent": {
81499
+ return `${val}%`;
81500
+ }
81488
81501
  case "d": {
81489
81502
  const n2 = parseInt(val, 10);
81490
81503
  return n2.toLocaleString();
@@ -87110,6 +87123,26 @@ const ChartConfigure = ({
87110
87123
  }))
87111
87124
  })
87112
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
+ })]
87113
87146
  }), chartType2 === "bar" || chartType2 === "row" || chartType2 === "stack" || chartType2 === "histogram" ? /* @__PURE__ */ jsx(InputField, {
87114
87147
  type: "checkbox",
87115
87148
  label: "Show Bar Background",
@@ -87382,6 +87415,9 @@ const ChartConfigure = ({
87382
87415
  }, {
87383
87416
  label: "Adaptive formatting",
87384
87417
  value: "adaptive"
87418
+ }, {
87419
+ label: "Percentage",
87420
+ value: "percent"
87385
87421
  }, {
87386
87422
  label: ",d (12345.432 => 12,345)",
87387
87423
  value: "d"
@@ -88835,6 +88871,7 @@ const MetricForm = ({
88835
88871
  const isBigQuery = database === "Bigquery";
88836
88872
  const isMySql = database === "MySql";
88837
88873
  const isMongoDb = database === "MongoDB";
88874
+ const isPostgres = database === "Postgres" || database === "Redshift";
88838
88875
  const isNullFilter = operator.value === "IS NULL" || operator.value === "IS NOT NULL";
88839
88876
  const isInFilter = operator.value === "IN" || operator.value === "NOT IN";
88840
88877
  const isFilterValue = isNullFilter ? true : isInFilter ? !!selectedFilterValues.length : !!filterValue.value;
@@ -88989,7 +89026,7 @@ const MetricForm = ({
88989
89026
  isDisabled: !metricAggregate.value || !metricColumn.value,
88990
89027
  onClick: () => {
88991
89028
  setMetrics((prev) => [...prev, {
88992
- 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}"`})`}`,
88993
89030
  as: isBigQuery ? aliasValue || `_result` : aliasValue || `${metricAggregate.value}(${metricColumn.label})`
88994
89031
  }]);
88995
89032
  setOpenMetric(false);
@@ -89204,7 +89241,7 @@ const MetricForm = ({
89204
89241
  className: styles$9.fieldValueIcon
89205
89242
  })]
89206
89243
  }), /* @__PURE__ */ jsxs(Modal, {
89207
- 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",
89208
89245
  isOpen: isOpenSort,
89209
89246
  onClose: () => setOpenSort(false),
89210
89247
  children: [/* @__PURE__ */ jsxs("div", {
@@ -89533,7 +89570,8 @@ const EmbeddedMetricCreation = ({
89533
89570
  displayText: "",
89534
89571
  subHeaderFontSize: 0,
89535
89572
  dateFormatter: "none",
89536
- numberFormatter: "original"
89573
+ numberFormatter: "original",
89574
+ xRotation: 50
89537
89575
  });
89538
89576
  const [tableSettings, setTableSettings] = useState({
89539
89577
  contentAlignment: "center",
@@ -95747,7 +95785,8 @@ const MetricCard = ({
95747
95785
  displayText: "",
95748
95786
  subHeaderFontSize: 0,
95749
95787
  dateFormatter: "none",
95750
- numberFormatter: "original"
95788
+ numberFormatter: "original",
95789
+ xRotation: 50
95751
95790
  });
95752
95791
  const [backGroundColor, setBackGroundColor] = useState({
95753
95792
  show: false
@@ -95781,7 +95820,8 @@ const MetricCard = ({
95781
95820
  displayText: "",
95782
95821
  subHeaderFontSize: 0,
95783
95822
  dateFormatter: "none",
95784
- numberFormatter: "original"
95823
+ numberFormatter: "original",
95824
+ xRotation: 50
95785
95825
  });
95786
95826
  setEnableGroupBy(metricItem == null ? void 0 : metricItem.isEnableGroupBy);
95787
95827
  setSelectedGroupBy(metricItem == null ? void 0 : metricItem.selectedGroupBy);
@@ -96230,7 +96270,8 @@ const SingleValueCard = ({
96230
96270
  displayText: "",
96231
96271
  subHeaderFontSize: 0,
96232
96272
  dateFormatter: "none",
96233
- numberFormatter: "original"
96273
+ numberFormatter: "original",
96274
+ xRotation: 50
96234
96275
  });
96235
96276
  const {
96236
96277
  data: metricdata,
@@ -96265,7 +96306,8 @@ const SingleValueCard = ({
96265
96306
  displayText: "",
96266
96307
  subHeaderFontSize: 0,
96267
96308
  dateFormatter: "none",
96268
- numberFormatter: "original"
96309
+ numberFormatter: "original",
96310
+ xRotation: 50
96269
96311
  });
96270
96312
  setClickBehaviourConfigs(metricItem.clickActions || {
96271
96313
  card: {