@protobase/ui 0.21.1 → 0.21.3

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.
Files changed (44) hide show
  1. package/dist/app/current-address.js +2 -2
  2. package/dist/app/displays/display-controls.js +3 -4
  3. package/dist/app/displays/list-displays.js +58 -4
  4. package/dist/app/displays/record-card.js +2 -2
  5. package/dist/app/embedded-list/embedded-columns.js +1 -1
  6. package/dist/app/embedded-list/embedded-display.js +6 -2
  7. package/dist/app/embedded-list/embedded-list.js +1 -1
  8. package/dist/app/field-editor.js +1 -1
  9. package/dist/app/hand-order/hand-order.js +21 -0
  10. package/dist/app/hand-order/hand-sorted-list.js +98 -0
  11. package/dist/app/hand-order/sort-button.js +20 -0
  12. package/dist/app/hand-order/use-hand-order.js +105 -0
  13. package/dist/app/list-page.js +39 -12
  14. package/dist/app/pages/field-value.js +1 -1
  15. package/dist/app/record-page.js +2 -2
  16. package/dist/app/related-dots/related-dots-columns.js +2 -1
  17. package/dist/app/related-dots/related-dots.js +1 -1
  18. package/dist/app/related-section.js +37 -8
  19. package/dist/data-grid/cell-text.js +30 -0
  20. package/dist/data-grid/cells.js +27 -35
  21. package/dist/data-grid/content-widths.js +81 -0
  22. package/dist/data-grid/data-grid.js +58 -40
  23. package/dist/data-grid/default-pins.js +13 -0
  24. package/dist/data-grid/grid-row.js +16 -4
  25. package/dist/data-grid/pinned-storage.js +2 -1
  26. package/dist/data-grid/row-reorder.js +68 -0
  27. package/dist/data-grid/truncated-text.js +16 -0
  28. package/dist/data-grid/use-fitted-columns.js +28 -0
  29. package/dist/data-grid/use-pinned-columns.js +6 -5
  30. package/dist/live/columns-from-model.js +6 -6
  31. package/dist/package.js +1 -1
  32. package/dist/shell/assets/app-wZRscg1o.js +69 -0
  33. package/dist/shell/assets/index-C1fzTv_X.css +2 -0
  34. package/dist/shell/assets/{index-CW037BBI.js → index-RHKnIOOP.js} +1 -1
  35. package/dist/shell/assets/{maplibre-Ck9abcyu.js → maplibre-DN_v_fcJ.js} +1 -1
  36. package/dist/shell/assets/{markdown-content-BDjSKrC7.js → markdown-content-Be4vIiWm.js} +1 -1
  37. package/dist/shell/assets/{record-map-CKPZ2KJs.js → record-map-CVeshts3.js} +1 -1
  38. package/dist/shell/assets/{records-map-DadV3GNO.js → records-map-ClnWq-RH.js} +1 -1
  39. package/dist/shell/assets/{shared-protobase-ui-tJCYxj7E.js → shared-protobase-ui-DWCBNg3c.js} +1 -1
  40. package/dist/shell/index.html +4 -4
  41. package/dist/shell/protobase.shell.json +1 -1
  42. package/package.json +4 -4
  43. package/dist/shell/assets/app-DGVgRtZo.js +0 -69
  44. package/dist/shell/assets/index-Dc6xgHsz.css +0 -2
@@ -1,6 +1,8 @@
1
+ import { recordTitleField } from "./model-helpers.js";
1
2
  import { humanize } from "./naming.js";
2
- import { isMarkdown } from "../markdown/markdown-hint.js";
3
+ import { badgeWidth, headerWidth } from "../data-grid/content-widths.js";
3
4
  import { markdownExcerpt } from "../markdown/markdown-excerpt.js";
5
+ import { isMarkdown } from "../markdown/markdown-hint.js";
4
6
  import { enumLabel } from "@protobase/schema";
5
7
  //#region src/live/columns-from-model.ts
6
8
  const tones = {
@@ -37,10 +39,6 @@ const widths = {
37
39
  user: 130,
38
40
  file: 180
39
41
  };
40
- /** Room for a header at 12px plus cell padding, the sort arrow and the column menu button. */
41
- const headerWidth = (header, sortable) => Math.ceil(header.length * 7.2) + 24 + (sortable ? 16 : 0) + 28;
42
- /** A status badge: dot, padding and the longest label. */
43
- const badgeWidth = (labels) => Math.ceil(Math.max(0, ...labels.map((label) => label.length)) * 7.2) + 56;
44
42
  const fixedKinds = /* @__PURE__ */ new Set([
45
43
  "datetime",
46
44
  "date",
@@ -67,6 +65,7 @@ const currencyCents = (value) => Math.round(Number.parseFloat(String(value)) * 1
67
65
  const listColumnNames = (resource, view) => view?.list?.columns ?? Object.keys(resource.fields).slice(0, 6);
68
66
  /** Grid columns for `names`, by default the view's list: kinds follow the field types and the view's format hints. */
69
67
  const columnsFromModel = (resource, view, highlight = [], names = listColumnNames(resource, view)) => {
68
+ const title = recordTitleField(resource, view);
70
69
  return names.flatMap((name, index) => {
71
70
  const field = resource.fields[name];
72
71
  if (!field) return [];
@@ -82,6 +81,7 @@ const columnsFromModel = (resource, view, highlight = [], names = listColumnName
82
81
  sortable: field.sortable,
83
82
  minWidth: Math.max(kind === "id" ? 150 : 0, headerWidth(viewField?.label ?? humanize(name), field.sortable), kind === "status" ? badgeWidth(Object.values(labels)) : 0, suffixWidth > 0 ? widths[kind] + suffixWidth : 0),
84
83
  ...fixedKinds.has(kind) && { fixed: true },
84
+ ...name === title && { title: true },
85
85
  ...highlight.includes(name) && { highlight: true },
86
86
  ...field.type === "enum" && {
87
87
  tones: Object.fromEntries((field.enumValues ?? []).map((value) => [value, toneFor(value)])),
@@ -102,4 +102,4 @@ const columnsFromModel = (resource, view, highlight = [], names = listColumnName
102
102
  });
103
103
  };
104
104
  //#endregion
105
- export { columnsFromModel, headerWidth, listColumnNames, toneFor };
105
+ export { columnsFromModel, listColumnNames, toneFor };
package/dist/package.js CHANGED
@@ -1,5 +1,5 @@
1
1
  //#region package.json
2
- var version = "0.21.1";
2
+ var version = "0.21.3";
3
3
  var protobase = { "pluginApi": 1 };
4
4
  //#endregion
5
5
  export { protobase, version };