@databrainhq/plugin 0.11.25 → 0.11.26

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.
@@ -216,6 +216,7 @@ export type DashboardType = {
216
216
  export type FloatingDropDownOption = {
217
217
  key?: string;
218
218
  label: string;
219
+ labelType?: string;
219
220
  value: string;
220
221
  };
221
222
  export type FilterType = {
@@ -7241,7 +7241,8 @@ const br = (r, t, e) => async () => {
7241
7241
  variant: "custom",
7242
7242
  className: S ? jt.checkedOption : jt.option,
7243
7243
  onClick: () => {
7244
- n(b), p(!1);
7244
+ var D;
7245
+ n(b), ((D = b.labelType) == null ? void 0 : D.toLowerCase()) !== "custom" && p(!1);
7245
7246
  },
7246
7247
  children: b.label
7247
7248
  },
@@ -92244,23 +92245,28 @@ const aPe = "_cardContainer_1pd1n_1", oPe = "_morePopup_1pd1n_9", sPe = "_featur
92244
92245
  workspaceId: e,
92245
92246
  clientId: n
92246
92247
  }) => {
92247
- var i, a;
92248
+ var s, l, u, c;
92249
+ const i = (s = r == null ? void 0 : r.options) == null ? void 0 : s.find((h) => h.name === (r == null ? void 0 : r.value)), [a, o] = te.useState({
92250
+ value: (r == null ? void 0 : r.value) || (i == null ? void 0 : i.name) || "",
92251
+ label: (r == null ? void 0 : r.value) || (i == null ? void 0 : i.name) || "",
92252
+ labelType: (i == null ? void 0 : i.range) || ""
92253
+ });
92248
92254
  return /* @__PURE__ */ A.jsx(A.Fragment, { children: r && t ? r.datatype !== "date" ? r.datatype === "string" ? r.options.length ? /* @__PURE__ */ A.jsx(
92249
92255
  cf,
92250
92256
  {
92251
- selectedOptions: Array.isArray(r.value) && r.value.length ? r.value.map((o) => ({
92252
- label: o,
92253
- value: o
92257
+ selectedOptions: Array.isArray(r.value) && r.value.length ? r.value.map((h) => ({
92258
+ label: h,
92259
+ value: h
92254
92260
  })) : [],
92255
- options: r.options.map((o) => ({
92256
- value: o,
92257
- label: o
92261
+ options: r.options.map((h) => ({
92262
+ value: h,
92263
+ label: h
92258
92264
  })),
92259
- onChange: (o) => t(
92265
+ onChange: (h) => t(
92260
92266
  r.name,
92261
- o == null ? void 0 : o[0].value,
92267
+ h == null ? void 0 : h[0].value,
92262
92268
  void 0,
92263
- o
92269
+ h
92264
92270
  ),
92265
92271
  label: r.name,
92266
92272
  className: Td.metricFilter
@@ -92268,15 +92274,15 @@ const aPe = "_cardContainer_1pd1n_1", oPe = "_morePopup_1pd1n_9", sPe = "_featur
92268
92274
  ) : /* @__PURE__ */ A.jsx(
92269
92275
  PD,
92270
92276
  {
92271
- selectedOptions: Array.isArray(r.value) && r.value.length ? r.value.map((o) => ({
92272
- label: o,
92273
- value: o
92277
+ selectedOptions: Array.isArray(r.value) && r.value.length ? r.value.map((h) => ({
92278
+ label: h,
92279
+ value: h
92274
92280
  })) : [],
92275
- onChange: (o) => t(
92281
+ onChange: (h) => t(
92276
92282
  r.name,
92277
- o == null ? void 0 : o[0].value,
92283
+ h == null ? void 0 : h[0].value,
92278
92284
  void 0,
92279
- o
92285
+ h
92280
92286
  ),
92281
92287
  filter: {
92282
92288
  tableName: r.tableName,
@@ -92287,8 +92293,8 @@ const aPe = "_cardContainer_1pd1n_1", oPe = "_morePopup_1pd1n_9", sPe = "_featur
92287
92293
  label: r.name,
92288
92294
  className: Td.metricFilter,
92289
92295
  workspaceId: e,
92290
- filterClause: (i = r == null ? void 0 : r.client) != null && i.isEnable ? {
92291
- columnName: (a = r == null ? void 0 : r.client) == null ? void 0 : a.columnName,
92296
+ filterClause: (l = r == null ? void 0 : r.client) != null && l.isEnable ? {
92297
+ columnName: (u = r == null ? void 0 : r.client) == null ? void 0 : u.columnName,
92292
92298
  value: n
92293
92299
  } : void 0
92294
92300
  }
@@ -92300,36 +92306,41 @@ const aPe = "_cardContainer_1pd1n_1", oPe = "_morePopup_1pd1n_9", sPe = "_featur
92300
92306
  value: r.value || r.options[0],
92301
92307
  label: r.value || r.options[0]
92302
92308
  },
92303
- options: r.options.map((o) => ({
92304
- value: o,
92305
- label: o
92309
+ options: r.options.map((h) => ({
92310
+ value: h,
92311
+ label: h
92306
92312
  })),
92307
- onChange: (o) => t(r.name, o.value),
92313
+ onChange: (h) => t(r.name, h.value),
92308
92314
  className: Td.metricFilter
92309
92315
  }
92310
92316
  ) : /* @__PURE__ */ A.jsx(
92311
92317
  $r,
92312
92318
  {
92313
92319
  label: r.name,
92314
- selectedOption: {
92315
- value: r.value || r.options[0].name,
92316
- label: r.value || r.options[0].name
92317
- },
92318
- options: r.options.map((o) => ({
92319
- value: o.name,
92320
- label: o.name
92320
+ selectedOption: a,
92321
+ options: r.options.map((h) => ({
92322
+ value: h.name,
92323
+ label: h.name,
92324
+ labelType: h.range
92321
92325
  })),
92322
- onChange: (o) => t(r.name, o.value),
92326
+ onChange: (h) => {
92327
+ o(h), t(r.name, h.value);
92328
+ },
92323
92329
  className: Td.metricFilter,
92324
- children: r.value === "Custom" ? /* @__PURE__ */ A.jsx("div", { className: Td.customContainer, children: /* @__PURE__ */ A.jsx(
92330
+ children: r.datatype === "date" && ((c = a.labelType) == null ? void 0 : c.toLowerCase()) === "custom" ? /* @__PURE__ */ A.jsx("div", { className: Td.customContainer, children: /* @__PURE__ */ A.jsx(
92325
92331
  TI,
92326
92332
  {
92327
92333
  label: "Date Range",
92328
- onChange: (o) => {
92334
+ onChange: (h) => {
92329
92335
  t(r.name, "Custom", {
92330
- startDate: o == null ? void 0 : o.startDate,
92331
- endDate: o == null ? void 0 : o.endDate
92336
+ startDate: h == null ? void 0 : h.startDate,
92337
+ endDate: h == null ? void 0 : h.endDate
92332
92338
  });
92339
+ },
92340
+ defaultValues: {
92341
+ startDate: i != null && i.startDate ? new Date(i == null ? void 0 : i.startDate) : /* @__PURE__ */ new Date(),
92342
+ endDate: i != null && i.endDate ? new Date(i == null ? void 0 : i.endDate) : /* @__PURE__ */ new Date(),
92343
+ timeGrainValue: ""
92333
92344
  }
92334
92345
  }
92335
92346
  ) }) : null