dara-components 1.18.9__py3-none-any.whl → 1.18.10__py3-none-any.whl

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.
@@ -380,7 +380,18 @@ class Column(BaseModel):
380
380
  sticky: Optional[str] = None
381
381
  tooltip: Optional[str] = None
382
382
  width: Optional[Union[int, str]] = None
383
- type: Optional[Union[Literal['number'], Literal['string'], Literal['datetime']]] = None
383
+ type: Optional[
384
+ Union[
385
+ Literal['number'],
386
+ Literal['string'],
387
+ # Generic datetime, assumes datetime64[ns]
388
+ Literal['datetime'],
389
+ # Specific datetime64 types
390
+ Literal['datetime64[ns]'],
391
+ Literal['datetime64[ms]'],
392
+ Literal['datetime64[s]'],
393
+ ]
394
+ ] = None
384
395
 
385
396
  model_config = ConfigDict(use_enum_values=True)
386
397
 
@@ -61227,11 +61227,43 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
61227
61227
  if (columns) {
61228
61228
  return columns.filter(
61229
61229
  (col) => {
61230
- var _a2;
61231
- return ((_a2 = col == null ? void 0 : col.formatter) == null ? void 0 : _a2.type) === "datetime" || col.type === "datetime" || col.filter === "datetime";
61230
+ var _a2, _b2;
61231
+ return ((_a2 = col == null ? void 0 : col.formatter) == null ? void 0 : _a2.type) === "datetime" || ((_b2 = col == null ? void 0 : col.type) == null ? void 0 : _b2.includes("datetime")) || col.filter === "datetime";
61232
61232
  }
61233
- ).map((c9) => c9.col_id);
61233
+ ).map((c9) => [c9.col_id, c9.type]);
61234
+ }
61235
+ return [];
61236
+ }
61237
+ function extractDatetimeUnit(dtypeString) {
61238
+ if (!dtypeString) {
61239
+ return "ns";
61240
+ }
61241
+ const match2 = dtypeString.match(/datetime64\[(\w+)\]/);
61242
+ return match2 ? match2[1] : "ns";
61243
+ }
61244
+ function parseTimestamp(timestamp, colType) {
61245
+ if (!timestamp) {
61246
+ return String(timestamp);
61247
+ }
61248
+ const unit = extractDatetimeUnit(colType);
61249
+ let timestampMs;
61250
+ switch (unit) {
61251
+ case "s":
61252
+ timestampMs = timestamp * 1e3;
61253
+ break;
61254
+ case "ms":
61255
+ timestampMs = timestamp;
61256
+ break;
61257
+ case "us":
61258
+ timestampMs = timestamp / 1e3;
61259
+ break;
61260
+ case "ns":
61261
+ timestampMs = timestamp / 1e6;
61262
+ break;
61263
+ default:
61264
+ return String(timestamp);
61234
61265
  }
61266
+ return formatISO(new Date(timestampMs));
61235
61267
  }
61236
61268
  function cleanIndex(rows) {
61237
61269
  return rows.map((r9) => {
@@ -61303,14 +61335,20 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
61303
61335
  });
61304
61336
  } else {
61305
61337
  processedColumns = columnsWithoutGeneratedIndex.map((column) => {
61306
- var _a2, _b2;
61338
+ var _a2, _b2, _c2, _d2;
61307
61339
  const isIndex2 = column.startsWith(INDEX_COL);
61340
+ let formatter;
61341
+ if (((_a2 = fieldTypes[column]) == null ? void 0 : _a2.type) === "boolean") {
61342
+ formatter = { type: "boolean" };
61343
+ } else if (((_c2 = (_b2 = fieldTypes[column]) == null ? void 0 : _b2.type) != null ? _c2 : "").includes("datetime")) {
61344
+ formatter = { type: "datetime" };
61345
+ }
61308
61346
  return {
61309
61347
  col_id: column,
61310
61348
  sticky: isIndex2 ? "left" : void 0,
61311
61349
  label: extractColumnLabel(column, isIndex2),
61312
- type: (_a2 = fieldTypes[column]) == null ? void 0 : _a2.type,
61313
- formatter: ((_b2 = fieldTypes[column]) == null ? void 0 : _b2.type) === "boolean" ? { type: "boolean" } : void 0
61350
+ type: (_d2 = fieldTypes[column]) == null ? void 0 : _d2.type,
61351
+ formatter
61314
61352
  };
61315
61353
  });
61316
61354
  if (!props.include_index) {
@@ -61336,15 +61374,9 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
61336
61374
  });
61337
61375
  return {
61338
61376
  data: response.data.map((row) => {
61339
- for (const val of datetimeColumns) {
61340
- if (typeof row[val] === "number") {
61341
- let timestamp = row[val];
61342
- if (timestamp < 1e12) {
61343
- timestamp *= 1e3;
61344
- } else if (timestamp > 1e15) {
61345
- timestamp /= 1e6;
61346
- }
61347
- row[val] = formatISO(new Date(timestamp));
61377
+ for (const [colId, colType] of datetimeColumns) {
61378
+ if (typeof row[colId] === "number") {
61379
+ row[colId] = parseTimestamp(row[colId], colType);
61348
61380
  }
61349
61381
  }
61350
61382
  return row;
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dara-components
3
- Version: 1.18.9
3
+ Version: 1.18.10
4
4
  Summary: Components for the Dara Framework
5
5
  Home-page: https://dara.causalens.com/
6
6
  License: Apache-2.0
@@ -16,7 +16,7 @@ Classifier: Programming Language :: Python :: 3.12
16
16
  Requires-Dist: bokeh (>=3.1.0,<3.2.0)
17
17
  Requires-Dist: cai-causal-graph (>=0.3.6)
18
18
  Requires-Dist: certifi (>=2024.7.4)
19
- Requires-Dist: dara-core (==1.18.9)
19
+ Requires-Dist: dara-core (==1.18.10)
20
20
  Requires-Dist: dill (>=0.3.0,<0.4.0)
21
21
  Requires-Dist: matplotlib (>=2.0.0)
22
22
  Requires-Dist: pandas (>=1.1.0,<3.0.0)
@@ -28,7 +28,7 @@ Description-Content-Type: text/markdown
28
28
 
29
29
  # Dara Components
30
30
 
31
- <img src="https://github.com/causalens/dara/blob/v1.18.9/img/dara_light.svg?raw=true">
31
+ <img src="https://github.com/causalens/dara/blob/v1.18.10/img/dara_light.svg?raw=true">
32
32
 
33
33
  ![Master tests](https://github.com/causalens/dara/actions/workflows/tests.yml/badge.svg?branch=master)
34
34
  [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0)
@@ -35,7 +35,7 @@ dara/components/common/spacer.py,sha256=ZRSl_fLntnumalaL41FYpBKDxOUgWgndkkLdDLl8
35
35
  dara/components/common/stack.py,sha256=FLw0IbQpW7l9A6LDS_KPCeQP0J7QKGYhVZ1RhAjBjpE,5562
36
36
  dara/components/common/switch.py,sha256=KjFUFT-1XHyJoJYkJLeEBgUb0fTArsFuWfowniTgl3E,1594
37
37
  dara/components/common/tabbed_card.py,sha256=zftir9hSj_l_dx2dPYis0NWy5q290sdg3Q1Nx8RvFbg,2344
38
- dara/components/common/table.py,sha256=P-qXaoFHMM69FiMH9T2Yeg0y0ZTx-89_JGj1Ls2_KbQ,24571
38
+ dara/components/common/table.py,sha256=30W9pPZLANPqpZr_KL8u79qRq9Nw0WZvi4U9SlVXUTg,24843
39
39
  dara/components/common/text.py,sha256=bYgX_IhSLPa-KuWbcCSdrNgAL6MhYQRpCNtV5octUbQ,1990
40
40
  dara/components/common/textarea.py,sha256=F8dmyinylAjjXMhNwfiWInrCFuAnWuCPTsKKiEUkmOw,2106
41
41
  dara/components/common/time_utils.py,sha256=UbAws5HBptJ-xH-m4QRDDET-9leOQu9WdywmExBuqIc,1746
@@ -78,9 +78,9 @@ dara/components/smart/data_slicer/utils/core.py,sha256=4M_HA8oBzAkHklHgmaJ-qiKA3
78
78
  dara/components/smart/data_slicer/utils/data_preview.py,sha256=OAphjMrm3F76XmJ09X7sZSeOeKqGJFwN5ooo3qcyrG4,1722
79
79
  dara/components/smart/data_slicer/utils/plotting.py,sha256=TB00576kbA6y1eRuZBe09UAcZmluY4iJsKmYnXZ3hWQ,3389
80
80
  dara/components/smart/hierarchy.py,sha256=9-QzEtbvP-arejhjsgl4Y5o5KHHzg6H1IGmwrX63450,2905
81
- dara/components/umd/dara.components.umd.js,sha256=Hp3Gj2fB-gEJXSZNdalE4NYHoCn-cLtdfOLmrBxNZzQ,18315018
81
+ dara/components/umd/dara.components.umd.js,sha256=jpocXPfEyjxMuAUd1JlVFlq8ij2_P9ASkgRFE6Z7Cf8,18315953
82
82
  dara/components/umd/style.css,sha256=Qm0_kcxXBDoXvvPTc7YCttkl1zMFifdcp-KufTunPNY,162729
83
- dara_components-1.18.9.dist-info/LICENSE,sha256=r9u1w2RvpLMV6YjuXHIKXRBKzia3fx_roPwboGcLqCc,10944
84
- dara_components-1.18.9.dist-info/METADATA,sha256=MFvbhu-_2LB_H1vw5aIsqi_hzJfoF5PyTIIc1rDLJU8,2743
85
- dara_components-1.18.9.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
86
- dara_components-1.18.9.dist-info/RECORD,,
83
+ dara_components-1.18.10.dist-info/LICENSE,sha256=r9u1w2RvpLMV6YjuXHIKXRBKzia3fx_roPwboGcLqCc,10944
84
+ dara_components-1.18.10.dist-info/METADATA,sha256=qdnMv3P9tS1Erg2dKtuNQFglgw1ihYcPTVDWbIvP0Nc,2746
85
+ dara_components-1.18.10.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
86
+ dara_components-1.18.10.dist-info/RECORD,,