@revisium/schema-toolkit-ui 0.6.7 → 0.6.8

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/index.cjs CHANGED
@@ -7078,7 +7078,7 @@ function resolveRefColumn(child, fieldPath) {
7078
7078
  systemFieldId: systemDef.id,
7079
7079
  isDeprecated,
7080
7080
  hasFormula,
7081
- isSortable: !isDeprecated && !hasFormula
7081
+ isSortable: !isDeprecated
7082
7082
  };
7083
7083
  }
7084
7084
  if (refValue === _revisium_schema_toolkit.SystemSchemaIds.File) return resolveFileRefColumns(child, fieldPath);
@@ -7104,7 +7104,8 @@ function stripDataPrefix(fieldPath) {
7104
7104
  }
7105
7105
  function createColumn(fieldPath, child, fieldType) {
7106
7106
  const isDeprecated = child.metadata().deprecated ?? false;
7107
- const hasFormula = child.hasFormula();
7107
+ const formula = child.formula();
7108
+ const hasFormula = formula !== void 0;
7108
7109
  return {
7109
7110
  field: fieldPath,
7110
7111
  label: stripDataPrefix(fieldPath),
@@ -7112,7 +7113,8 @@ function createColumn(fieldPath, child, fieldType) {
7112
7113
  isSystem: false,
7113
7114
  isDeprecated,
7114
7115
  hasFormula,
7115
- isSortable: !isDeprecated && !hasFormula && fieldType !== FilterFieldType.File
7116
+ formulaExpression: formula?.expression(),
7117
+ isSortable: !isDeprecated && fieldType !== FilterFieldType.File
7116
7118
  };
7117
7119
  }
7118
7120
 
@@ -13673,6 +13675,35 @@ const RowActionsMenu = ({ rowId, onSelect, onDuplicate, onDelete }) => {
13673
13675
  });
13674
13676
  };
13675
13677
 
13678
+ //#endregion
13679
+ //#region src/table-editor/Status/model/CellInfoModel.ts
13680
+ var CellInfoModel = class {
13681
+ _cellFSM;
13682
+ _columnsModel;
13683
+ constructor(cellFSM, columnsModel) {
13684
+ this._cellFSM = cellFSM;
13685
+ this._columnsModel = columnsModel;
13686
+ (0, mobx.makeAutoObservable)(this, {}, { autoBind: true });
13687
+ }
13688
+ get _focusedColumn() {
13689
+ const focused = this._cellFSM.focusedCell;
13690
+ if (!focused) return null;
13691
+ return this._columnsModel.allColumns.find((c) => c.field === focused.field) ?? null;
13692
+ }
13693
+ get isVisible() {
13694
+ return this._focusedColumn !== null && !this._cellFSM.hasSelection;
13695
+ }
13696
+ get fieldLabel() {
13697
+ return this._focusedColumn?.label ?? "";
13698
+ }
13699
+ get formulaExpression() {
13700
+ return this._focusedColumn?.formulaExpression;
13701
+ }
13702
+ get foreignKeyTableId() {
13703
+ return this._focusedColumn?.foreignKeyTableId;
13704
+ }
13705
+ };
13706
+
13676
13707
  //#endregion
13677
13708
  //#region src/table-editor/Status/model/RowCountModel.ts
13678
13709
  var RowCountModel = class {
@@ -13786,6 +13817,7 @@ var TableEditorCore = class {
13786
13817
  cellFSM;
13787
13818
  selection;
13788
13819
  rowCount;
13820
+ cellInfo;
13789
13821
  _dataSource;
13790
13822
  _pageSize;
13791
13823
  _breadcrumbs;
@@ -13814,6 +13846,7 @@ var TableEditorCore = class {
13814
13846
  this.cellFSM = new CellFSM();
13815
13847
  this.selection = new SelectionModel();
13816
13848
  this.rowCount = new RowCountModel();
13849
+ this.cellInfo = new CellInfoModel(this.cellFSM, this.columns);
13817
13850
  this.columns.setOnChange(() => this._handleColumnsChange());
13818
13851
  this.filters.setOnChange(() => this._handleFilterChange());
13819
13852
  this.filters.setOnApply((_where) => this._handleFilterApply());
@@ -14158,6 +14191,50 @@ var MockDataSource = class {
14158
14191
  }
14159
14192
  };
14160
14193
 
14194
+ //#endregion
14195
+ //#region src/table-editor/Status/ui/CellInfoWidget.tsx
14196
+ const CellInfoWidget = (0, mobx_react_lite.observer)(({ model }) => {
14197
+ if (!model.isVisible) return null;
14198
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_chakra_ui_react.Flex, {
14199
+ alignItems: "center",
14200
+ gap: 2,
14201
+ overflow: "hidden",
14202
+ flexShrink: 1,
14203
+ minW: 0,
14204
+ children: [
14205
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_chakra_ui_react.Text, {
14206
+ fontSize: "sm",
14207
+ color: "gray.500",
14208
+ overflow: "hidden",
14209
+ textOverflow: "ellipsis",
14210
+ whiteSpace: "nowrap",
14211
+ "data-testid": "cell-info-field",
14212
+ children: model.fieldLabel
14213
+ }),
14214
+ model.formulaExpression && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_chakra_ui_react.Text, {
14215
+ fontSize: "sm",
14216
+ color: "purple.400",
14217
+ fontFamily: "mono",
14218
+ overflow: "hidden",
14219
+ textOverflow: "ellipsis",
14220
+ whiteSpace: "nowrap",
14221
+ "data-testid": "cell-info-formula",
14222
+ children: ["= ", model.formulaExpression]
14223
+ }),
14224
+ model.foreignKeyTableId && !model.formulaExpression && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_chakra_ui_react.Text, {
14225
+ fontSize: "sm",
14226
+ color: "blue.400",
14227
+ fontFamily: "mono",
14228
+ overflow: "hidden",
14229
+ textOverflow: "ellipsis",
14230
+ whiteSpace: "nowrap",
14231
+ "data-testid": "cell-info-fk",
14232
+ children: ["→ ", model.foreignKeyTableId]
14233
+ })
14234
+ ]
14235
+ });
14236
+ });
14237
+
14161
14238
  //#endregion
14162
14239
  //#region src/table-editor/Status/ui/RowCountWidget.tsx
14163
14240
  const RowCountWidget = (0, mobx_react_lite.observer)(({ model }) => {
@@ -14340,14 +14417,24 @@ const TableEditor = (0, mobx_react_lite.observer)(({ viewModel, useWindowScroll
14340
14417
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_chakra_ui_react.Flex, {
14341
14418
  px: 3,
14342
14419
  py: 2,
14343
- justifyContent: "space-between",
14420
+ alignItems: "center",
14421
+ overflow: "hidden",
14344
14422
  ...useWindowScroll && {
14345
14423
  position: "sticky",
14346
14424
  bottom: 0,
14347
14425
  bg: "white",
14348
14426
  zIndex: 3
14349
14427
  },
14350
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(RowCountWidget, { model: viewModel.rowCount }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ViewSettingsBadge, { model: viewModel.viewBadge })]
14428
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(RowCountWidget, { model: viewModel.rowCount }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_chakra_ui_react.Flex, {
14429
+ alignItems: "center",
14430
+ gap: 3,
14431
+ overflow: "hidden",
14432
+ flexShrink: 1,
14433
+ minW: 0,
14434
+ flex: 1,
14435
+ justifyContent: "flex-end",
14436
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(CellInfoWidget, { model: viewModel.cellInfo }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ViewSettingsBadge, { model: viewModel.viewBadge })]
14437
+ })]
14351
14438
  })
14352
14439
  ]
14353
14440
  });