@marktiderman/genesis-core 2.16.0 → 2.17.0

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 (124) hide show
  1. package/README.md +3 -2
  2. package/dist/{aggregate-Y5IJ5aPn.d.ts → aggregate-v_r-nZbH.d.ts} +1 -1
  3. package/dist/{chunk-M5IX7C6U.js → chunk-24X4HWL5.js} +4 -4
  4. package/dist/{chunk-M5IX7C6U.js.map → chunk-24X4HWL5.js.map} +1 -1
  5. package/dist/chunk-2ORQLYVW.js +115 -0
  6. package/dist/chunk-2ORQLYVW.js.map +1 -0
  7. package/dist/{chunk-XPBS5YE4.js → chunk-4POVYF6P.js} +4 -4
  8. package/dist/{chunk-XPBS5YE4.js.map → chunk-4POVYF6P.js.map} +1 -1
  9. package/dist/{chunk-IYGVJFCV.js → chunk-5KLIFJYG.js} +3 -3
  10. package/dist/{chunk-IYGVJFCV.js.map → chunk-5KLIFJYG.js.map} +1 -1
  11. package/dist/{chunk-ALLWIK62.js → chunk-6B4CN2TC.js} +8 -6
  12. package/dist/chunk-6B4CN2TC.js.map +1 -0
  13. package/dist/chunk-6JOWGO2X.js +266 -0
  14. package/dist/chunk-6JOWGO2X.js.map +1 -0
  15. package/dist/{chunk-E3K2A3PK.js → chunk-6SHGMEA6.js} +3 -3
  16. package/dist/{chunk-E3K2A3PK.js.map → chunk-6SHGMEA6.js.map} +1 -1
  17. package/dist/chunk-6VNM6KAX.js +59 -0
  18. package/dist/chunk-6VNM6KAX.js.map +1 -0
  19. package/dist/{chunk-SOO54YYY.js → chunk-AQX5HQD6.js} +3 -3
  20. package/dist/{chunk-SOO54YYY.js.map → chunk-AQX5HQD6.js.map} +1 -1
  21. package/dist/chunk-BNKP2H7J.js +11 -0
  22. package/dist/chunk-BNKP2H7J.js.map +1 -0
  23. package/dist/{chunk-FXPODKCK.js → chunk-FBMKI22S.js} +6 -6
  24. package/dist/{chunk-FXPODKCK.js.map → chunk-FBMKI22S.js.map} +1 -1
  25. package/dist/{chunk-POUI7GAI.js → chunk-JF7FXSQB.js} +5 -5
  26. package/dist/{chunk-POUI7GAI.js.map → chunk-JF7FXSQB.js.map} +1 -1
  27. package/dist/chunk-JNWTHDGF.js +892 -0
  28. package/dist/chunk-JNWTHDGF.js.map +1 -0
  29. package/dist/chunk-K33LWVUF.js +31 -0
  30. package/dist/chunk-K33LWVUF.js.map +1 -0
  31. package/dist/chunk-KRRESUXT.js +192 -0
  32. package/dist/chunk-KRRESUXT.js.map +1 -0
  33. package/dist/{chunk-LB6FMQQM.js → chunk-KV2HW4G4.js} +3 -11
  34. package/dist/chunk-KV2HW4G4.js.map +1 -0
  35. package/dist/{chunk-42NVJJTT.js → chunk-MMMC37AP.js} +3 -3
  36. package/dist/{chunk-42NVJJTT.js.map → chunk-MMMC37AP.js.map} +1 -1
  37. package/dist/chunk-MZVFOTAE.js +96 -0
  38. package/dist/chunk-MZVFOTAE.js.map +1 -0
  39. package/dist/{chunk-R3YXYVWF.js → chunk-OIZNABG4.js} +5 -4
  40. package/dist/chunk-OIZNABG4.js.map +1 -0
  41. package/dist/{chunk-QGWQ6LK3.js → chunk-QJOKZZKY.js} +9 -6
  42. package/dist/chunk-QJOKZZKY.js.map +1 -0
  43. package/dist/chunk-TWLPC4S3.js +53 -0
  44. package/dist/chunk-TWLPC4S3.js.map +1 -0
  45. package/dist/{chunk-7EFTWOMA.js → chunk-UNEZF3ZP.js} +73 -15
  46. package/dist/chunk-UNEZF3ZP.js.map +1 -0
  47. package/dist/chunk-WNOCPV4A.js +220 -0
  48. package/dist/chunk-WNOCPV4A.js.map +1 -0
  49. package/dist/{chunk-ZYOJWU62.js → chunk-XIBQ5BTZ.js} +12 -53
  50. package/dist/chunk-XIBQ5BTZ.js.map +1 -0
  51. package/dist/chunk-YMFJLBIZ.js +159 -0
  52. package/dist/chunk-YMFJLBIZ.js.map +1 -0
  53. package/dist/{chunk-UDSTWXXZ.js → chunk-ZKLB2HB5.js} +3 -3
  54. package/dist/{chunk-UDSTWXXZ.js.map → chunk-ZKLB2HB5.js.map} +1 -1
  55. package/dist/csv.d.ts +12 -3
  56. package/dist/csv.js +4 -4
  57. package/dist/csv.js.map +1 -1
  58. package/dist/form-types.d.ts +1 -1
  59. package/dist/headless/index.d.ts +1 -1
  60. package/dist/hooks/index.d.ts +16 -6
  61. package/dist/hooks/index.js +27 -15
  62. package/dist/hooks/mutation-mode.d.ts +1 -1
  63. package/dist/hooks/mutation-mode.js +3 -3
  64. package/dist/hooks/related-keys.d.ts +1 -1
  65. package/dist/hooks/use-aggregate.d.ts +2 -2
  66. package/dist/hooks/use-aggregate.js +3 -3
  67. package/dist/hooks/use-board-columns.d.ts +79 -0
  68. package/dist/hooks/use-board-columns.js +4 -0
  69. package/dist/hooks/use-board-columns.js.map +1 -0
  70. package/dist/hooks/use-capabilities.d.ts +1 -1
  71. package/dist/hooks/use-capabilities.js +2 -2
  72. package/dist/hooks/use-infinite-resource.d.ts +1 -1
  73. package/dist/hooks/use-infinite-resource.js +3 -3
  74. package/dist/hooks/use-link-options.d.ts +1 -1
  75. package/dist/hooks/use-link-options.js +5 -5
  76. package/dist/hooks/use-list-state.d.ts +103 -0
  77. package/dist/hooks/use-list-state.js +21 -0
  78. package/dist/hooks/use-list-state.js.map +1 -0
  79. package/dist/hooks/use-live.d.ts +1 -1
  80. package/dist/hooks/use-live.js +2 -2
  81. package/dist/hooks/use-one.d.ts +7 -1
  82. package/dist/hooks/use-one.js +3 -3
  83. package/dist/hooks/use-persisted-ui-state.js +2 -2
  84. package/dist/hooks/use-relation-label.d.ts +1 -1
  85. package/dist/hooks/use-relation-label.js +2 -2
  86. package/dist/hooks/use-resource-form.d.ts +1 -1
  87. package/dist/hooks/use-resource-form.js +7 -7
  88. package/dist/hooks/use-resource.d.ts +7 -1
  89. package/dist/hooks/use-resource.js +5 -5
  90. package/dist/hooks/use-segment-counts.d.ts +23 -0
  91. package/dist/hooks/use-segment-counts.js +19 -0
  92. package/dist/hooks/use-segment-counts.js.map +1 -0
  93. package/dist/hooks/use-view-board.d.ts +120 -0
  94. package/dist/hooks/use-view-board.js +29 -0
  95. package/dist/hooks/use-view-board.js.map +1 -0
  96. package/dist/hooks/use-view-calendar-range.d.ts +91 -0
  97. package/dist/hooks/use-view-calendar-range.js +22 -0
  98. package/dist/hooks/use-view-calendar-range.js.map +1 -0
  99. package/dist/hooks/use-write.d.ts +1 -1
  100. package/dist/index.d.ts +41 -11
  101. package/dist/index.js +119 -26
  102. package/dist/index.js.map +1 -1
  103. package/dist/provider/index.d.ts +61 -8
  104. package/dist/provider/index.js +2 -2
  105. package/dist/resource-view/index.d.ts +162 -757
  106. package/dist/resource-view/index.js +31 -686
  107. package/dist/resource-view/index.js.map +1 -1
  108. package/dist/saved-views-C45lRm7i.d.ts +155 -0
  109. package/dist/schema/index.d.ts +3 -3
  110. package/dist/schema/index.js +2 -1
  111. package/dist/testing/index.d.ts +2 -2
  112. package/dist/types-BAhcze_-.d.ts +1063 -0
  113. package/dist/{types-BriIV4e_.d.ts → types-CiQY6hUy.d.ts} +11 -1
  114. package/dist/{viewer-scope-Dx0N9AYk.d.ts → viewer-oOk0ZZk9.d.ts} +36 -34
  115. package/dist/{workspaces-CxpiFu2-.d.ts → workspaces-DeaFix5Z.d.ts} +1 -1
  116. package/dist/workspaces.d.ts +2 -2
  117. package/dist/{write-outcome-CkQXgtJq.d.ts → write-outcome-DuwfsnyO.d.ts} +1 -1
  118. package/package.json +11 -1
  119. package/dist/chunk-7EFTWOMA.js.map +0 -1
  120. package/dist/chunk-ALLWIK62.js.map +0 -1
  121. package/dist/chunk-LB6FMQQM.js.map +0 -1
  122. package/dist/chunk-QGWQ6LK3.js.map +0 -1
  123. package/dist/chunk-R3YXYVWF.js.map +0 -1
  124. package/dist/chunk-ZYOJWU62.js.map +0 -1
@@ -1,692 +1,20 @@
1
1
  import { readinessOf } from '../chunk-PP3XFFQM.js';
2
- import { fieldControl, keyFields, encodeRecordKey } from '../chunk-LB6FMQQM.js';
3
- import { NO_VIEWER } from '../chunk-OZYF55E3.js';
2
+ import { ViewDefinitionError, filterParams, scopeFilter } from '../chunk-JNWTHDGF.js';
3
+ export { RECORD_OPEN_MODES, ViewDefinitionError, boardChoices, boardProblems, calendarProblems, defineView, deriveDisplay, filterParams, galleryProblems, inboxProblems, plural, scopeFilter, scopeValues, singular, valueText } from '../chunk-JNWTHDGF.js';
4
+ import '../chunk-BNKP2H7J.js';
5
+ export { calendarEvents, calendarLanes, calendarWindow, displayZone, eventDays, eventDots, laneKeys, placeEvents, shiftAnchor, timeStorage, warnOnce, windowBounds } from '../chunk-YMFJLBIZ.js';
6
+ import { encodeRecordKey } from '../chunk-KV2HW4G4.js';
7
+ export { applicableListState, createLocalSavedViewStore } from '../chunk-MZVFOTAE.js';
8
+ export { LIST_URL_KEYS, decodeFilterValue, encodeFilterValue, filterOptionLabel, filterValueFor, isFilterSet, listUrlParams, readListUrl, whereParams } from '../chunk-6JOWGO2X.js';
4
9
  export { NO_VIEWER } from '../chunk-OZYF55E3.js';
5
10
  import { toAggregateValues } from '../chunk-J54XXKQD.js';
6
- import { isTimeZone, deviceTimeZone, dayIn, addDays, startOfWeek, isDay } from '../chunk-WXENWPWP.js';
7
- import { isDevelopment, reportError } from '../chunk-NOPS5EIH.js';
11
+ import { deviceTimeZone, dayIn, addDays, startOfWeek, isDay } from '../chunk-WXENWPWP.js';
12
+ import '../chunk-NOPS5EIH.js';
8
13
  import '../chunk-HUNGCTRA.js';
9
- import { titleCase } from '../chunk-RYEXWQFD.js';
14
+ import '../chunk-RYEXWQFD.js';
10
15
  import '../chunk-WLDSIQJ2.js';
11
16
  import { isSafeUrl } from '../chunk-YDDPFSQ6.js';
12
17
 
13
- // src/resource-view/errors.ts
14
- var ViewDefinitionError = class extends Error {
15
- problems;
16
- constructor(resource, problems) {
17
- super(`defineView(${resource}): ${problems.join("; ")}`);
18
- this.name = "ViewDefinitionError";
19
- this.problems = problems;
20
- }
21
- };
22
-
23
- // src/resource-view/scope.ts
24
- var camel = (key) => key.replace(/_([a-z0-9])/g, (_, c) => c.toUpperCase());
25
- function scopeValues(view, scope) {
26
- const out = {};
27
- const missing = [];
28
- for (const key of view.definition.scope ?? []) {
29
- const value = scope && Object.hasOwn(scope, key) ? scope[key] : scope?.[camel(key)];
30
- if (value === null || typeof value === "string" || typeof value === "number" || typeof value === "boolean") out[key] = value;
31
- else missing.push(key);
32
- }
33
- if (missing.length && process.env.NODE_ENV !== "production") {
34
- throw new ViewDefinitionError(
35
- view.resource,
36
- missing.map((key) => `scope "${key}" has no single value in ViewerScope's scope`)
37
- );
38
- }
39
- return Object.freeze(out);
40
- }
41
- function scopeFilter(view, scope) {
42
- const out = {};
43
- if (!scope) return out;
44
- for (const key of view.definition.scope ?? []) {
45
- const value = Object.hasOwn(scope, key) ? scope[key] : scope[camel(key)];
46
- if (value === null || typeof value === "string" || typeof value === "number" || typeof value === "boolean") out[key] = value;
47
- else if (Array.isArray(value) && value.every((v) => typeof v === "string" || typeof v === "number")) out[key] = value;
48
- }
49
- return Object.freeze(out);
50
- }
51
-
52
- // src/resource-view/link.ts
53
- var IDENTIFIER = /^[A-Za-z_][A-Za-z0-9_]*$/;
54
- function filterParams(filter) {
55
- return Object.entries(filter ?? {}).map(
56
- ([field, value]) => value === null ? { field, operator: "is_null" } : Array.isArray(value) ? { field, operator: "in", value: [...value] } : { field, operator: "eq", value }
57
- );
58
- }
59
- function linkProblems(name, link, reference) {
60
- if (link === void 0) return [];
61
- const where = `fields.${name}.link`;
62
- if (!reference) return [`${where} is set, but "${name}" isn't a link`];
63
- if (!link || typeof link !== "object" || Array.isArray(link)) return [`${where} isn't an object`];
64
- const l = link;
65
- const problems = [];
66
- if (l.view !== void 0 && typeof l.view !== "function") problems.push(...linkedViewProblems(where, l.view, reference, l.preset));
67
- else if (l.view === void 0 && l.preset !== void 0) problems.push(`${where}.preset needs a view`);
68
- if (l.preset !== void 0 && typeof l.preset !== "string") problems.push(`${where}.preset isn't a preset name`);
69
- if (l.filter !== void 0 && typeof l.filter !== "function" && (!l.filter || typeof l.filter !== "object" || Array.isArray(l.filter))) {
70
- problems.push(`${where}.filter isn't a filter or a function`);
71
- }
72
- if (l.searchFields !== void 0 && (!Array.isArray(l.searchFields) || l.searchFields.some((f) => typeof f !== "string" || !IDENTIFIER.test(f)))) {
73
- problems.push(`${where}.searchFields isn't a list of field names`);
74
- }
75
- if (l.orderBy === "view") {
76
- if (l.view === void 0) problems.push(`${where}.orderBy "view" needs a view`);
77
- } else if (l.orderBy !== void 0) {
78
- const o = l.orderBy;
79
- if (!o || typeof o !== "object" || typeof o.field !== "string" || !IDENTIFIER.test(o.field)) {
80
- problems.push(`${where}.orderBy isn't "view" or { field, direction }`);
81
- } else if (o.direction !== void 0 && o.direction !== "asc" && o.direction !== "desc") {
82
- problems.push(`${where}.orderBy.direction is "asc" or "desc", not ${String(o.direction)}`);
83
- }
84
- }
85
- return problems;
86
- }
87
- function linkedViewProblems(where, view, reference, preset) {
88
- const v = view;
89
- if (!v || typeof v !== "object" || typeof v.resource !== "string") return [`${where}.view isn't a view`];
90
- if (v.resource !== reference.resource) return [`${where}.view is a view of "${v.resource}", but the link points at "${reference.resource}"`];
91
- if (preset !== void 0 && !Object.hasOwn(v.definition.presets ?? {}, preset)) {
92
- return [`${where}.preset "${preset}" isn't one of ${v.resource}'s presets`];
93
- }
94
- return [];
95
- }
96
- function resolveLink(owner, name, reference, link, labelField) {
97
- let linked;
98
- let read = false;
99
- const linkedView = () => {
100
- if (read) return linked;
101
- read = true;
102
- linked = typeof link?.view === "function" ? link.view() : link?.view;
103
- if (linked && typeof link?.view === "function") {
104
- const problems = linkedViewProblems(`fields.${name}.link`, linked, reference, link.preset);
105
- if (problems.length) {
106
- const error = new ViewDefinitionError(owner, problems);
107
- if (isDevelopment()) throw error;
108
- reportError(error, { source: "core:resource-view-link", tags: { resource: owner } });
109
- linked = void 0;
110
- }
111
- }
112
- return linked;
113
- };
114
- return Object.freeze({
115
- resource: reference.resource,
116
- field: reference.field,
117
- // Read when asked: a view given as a function may not exist yet while this one is defined.
118
- get labelField() {
119
- return labelField ?? linkedView()?.labelField;
120
- },
121
- ...link?.searchFields ? { searchFields: Object.freeze([...link.searchFields]) } : {},
122
- // Read when asked, like the naming field: `"view"` reads a view given as a function.
123
- get orderBy() {
124
- const order = link?.orderBy === "view" ? linkedView()?.definition.orderBy : link?.orderBy;
125
- if (!order || typeof order.field !== "string" || !IDENTIFIER.test(order.field)) return void 0;
126
- const nulls = order.nulls;
127
- return Object.freeze({
128
- field: order.field,
129
- direction: order.direction === "desc" ? "desc" : "asc",
130
- ...nulls === "first" || nulls === "last" ? { nulls } : {}
131
- });
132
- },
133
- filters(scope, values = {}) {
134
- const view = linkedView();
135
- const preset = view ? view.definition.presets?.[link?.preset ?? "default"]?.filter : void 0;
136
- const own2 = typeof link?.filter === "function" ? link.filter(values) : link?.filter;
137
- return filterParams({ ...view ? scopeFilter(view, scope) : {}, ...preset, ...own2 });
138
- }
139
- });
140
- }
141
-
142
- // src/resource-view/types.ts
143
- var RECORD_OPEN_MODES = Object.freeze(["side-peek", "center-peek", "page"]);
144
-
145
- // src/resource-view/define-view.ts
146
- function deriveDisplay(field) {
147
- if (field.references) return "relation";
148
- switch (fieldControl(field)) {
149
- case "url":
150
- return "url";
151
- case "email":
152
- return "email";
153
- case "image":
154
- return "image";
155
- case "textarea":
156
- return "longText";
157
- case "date":
158
- return "date";
159
- }
160
- if (field.enumValues?.length) return "badge";
161
- switch (field.type) {
162
- case "boolean":
163
- return "boolean";
164
- case "number":
165
- return "number";
166
- case "json":
167
- return "json";
168
- case "relation":
169
- return "relation";
170
- case "datetime":
171
- return /^date$/i.test(field.dbType ?? "") ? "date" : "datetime";
172
- }
173
- return "text";
174
- }
175
- var SAME_OR_IRREGULAR = {
176
- series: "series",
177
- species: "species",
178
- movies: "movie",
179
- cookies: "cookie",
180
- ties: "tie",
181
- pies: "pie",
182
- people: "person"
183
- };
184
- function singular(word) {
185
- const last = word.split(" ").pop();
186
- const head = word.slice(0, word.length - last.length);
187
- const lower = last.toLowerCase();
188
- const one = (s) => head + s;
189
- if (SAME_OR_IRREGULAR[lower]) return one(SAME_OR_IRREGULAR[lower]);
190
- if (/[^aeiou]ies$/.test(lower)) return one(`${last.slice(0, -3)}y`);
191
- if (/(?:s|x|z|ch|sh)es$/.test(lower)) return one(last.slice(0, -2));
192
- if (/(?:ss|us|is)$/.test(lower) || !lower.endsWith("s")) return word;
193
- return one(last.slice(0, -1));
194
- }
195
- var PLURAL_OF = Object.fromEntries(
196
- Object.entries(SAME_OR_IRREGULAR).map(([many, one]) => [one, many])
197
- );
198
- function plural(word) {
199
- const last = word.split(" ").pop();
200
- const head = word.slice(0, word.length - last.length);
201
- const lower = last.toLowerCase();
202
- const many = (s) => head + s;
203
- if (PLURAL_OF[lower]) return many(PLURAL_OF[lower]);
204
- if (/[^aeiou]y$/.test(lower)) return many(`${last.slice(0, -1)}ies`);
205
- if (/(?:s|x|z|ch|sh)$/.test(lower)) return many(`${last}es`);
206
- return many(`${last}s`);
207
- }
208
- var RESERVED_ACTIONS = /* @__PURE__ */ new Set(["create", "update", "delete"]);
209
- var own = (record, key) => record && Object.hasOwn(record, key) ? record[key] : void 0;
210
- function valueText(labels, value) {
211
- const key = String(value);
212
- return own(labels, key) ?? titleCase(key);
213
- }
214
- var KIND = { datetime: "date or timestamp", boolean: "yes/no", number: "number" };
215
- var LAYOUTS = ["month", "weeks", "agenda", "lanes"];
216
- var CALENDAR_KEYS = [
217
- "field",
218
- "endField",
219
- "durationField",
220
- "durationUnit",
221
- "allDayField",
222
- "laneBy",
223
- "layout",
224
- "phoneLayout",
225
- "weeks",
226
- "weekStartsOn"
227
- ];
228
- function calendarProblems(fields, calendar) {
229
- const problems = [];
230
- const byName = new Map(fields.map((f) => [f.name, f]));
231
- const typed = (name, where, type) => {
232
- if (name === void 0) return;
233
- const f = byName.get(name);
234
- if (!f) problems.push(`${where} names "${name}", which isn't a field`);
235
- else if (f.type !== type || f.array) problems.push(`${where} "${name}" isn't a ${KIND[type]} field`);
236
- };
237
- typed(calendar.field, "calendar.field", "datetime");
238
- typed(calendar.endField, "calendar.endField", "datetime");
239
- typed(calendar.durationField, "calendar.durationField", "number");
240
- typed(calendar.allDayField, "calendar.allDayField", "boolean");
241
- if (calendar.durationUnit !== void 0 && !["minutes", "hours", "days"].includes(calendar.durationUnit)) {
242
- problems.push(`calendar.durationUnit "${String(calendar.durationUnit)}" isn't minutes, hours or days`);
243
- }
244
- if (calendar.durationUnit !== void 0 && calendar.durationField === void 0) problems.push("calendar.durationUnit needs a durationField");
245
- if (calendar.laneBy !== void 0 && !byName.has(calendar.laneBy)) problems.push(`calendar.laneBy names "${calendar.laneBy}", which isn't a field`);
246
- for (const key of ["layout", "phoneLayout"]) {
247
- const value = calendar[key];
248
- if (value !== void 0 && !LAYOUTS.includes(value)) problems.push(`calendar.${key} "${String(value)}" isn't month, weeks, agenda or lanes`);
249
- }
250
- if (calendar.weeks !== void 0 && ![1, 2, 3, 4].includes(calendar.weeks)) problems.push(`calendar.weeks is 1 to 4, not ${String(calendar.weeks)}`);
251
- if (calendar.weekStartsOn !== void 0 && calendar.weekStartsOn !== 0 && calendar.weekStartsOn !== 1) {
252
- problems.push(`calendar.weekStartsOn is 0 (Sunday) or 1 (Monday), not ${String(calendar.weekStartsOn)}`);
253
- }
254
- return problems;
255
- }
256
- var BOARD_KEYS = ["field", "columns", "cardFields", "limits"];
257
- function boardChoices(field) {
258
- if (!field || field.array) return void 0;
259
- if (field.enumValues?.length) return field.enumValues;
260
- if (field.type === "boolean") return ["true", "false"];
261
- return void 0;
262
- }
263
- var GALLERY_KEYS = ["image", "width", "height", "caption", "alt", "rowHeight"];
264
- function galleryProblems(fields, gallery) {
265
- const problems = [];
266
- const byName = new Map(fields.map((f) => [f.name, f]));
267
- const named = (key, type) => {
268
- const name = gallery[key];
269
- if (name === void 0) return;
270
- const field = byName.get(name);
271
- if (!field) problems.push(`gallery.${key} names "${name}", which isn't a field`);
272
- else if (type && (field.type !== type || field.array)) problems.push(`gallery.${key} "${name}" is a ${field.array ? "list" : field.type}, not a ${type === "string" ? "text" : "number"} field`);
273
- };
274
- named("image", "string");
275
- named("width", "number");
276
- named("height", "number");
277
- named("caption");
278
- named("alt");
279
- if (gallery.width === void 0 !== (gallery.height === void 0)) problems.push("gallery.width and gallery.height go together: a ratio needs both");
280
- const { rowHeight } = gallery;
281
- if (rowHeight !== void 0 && !(typeof rowHeight === "number" && Number.isFinite(rowHeight) && rowHeight > 0)) problems.push(`gallery.rowHeight is a height above 0, not ${String(rowHeight)}`);
282
- return problems;
283
- }
284
- function boardProblems(fields, board) {
285
- const problems = [];
286
- const byName = new Map(fields.map((f) => [f.name, f]));
287
- const field = board.field === void 0 ? void 0 : byName.get(board.field);
288
- if (board.field !== void 0 && !field) problems.push(`board.field names "${board.field}", which isn't a field`);
289
- const choices = boardChoices(field);
290
- if (field && !choices) problems.push(`board.field "${board.field}" has no fixed values: use an enum or a yes/no field`);
291
- if (board.columns !== void 0) {
292
- if (!Array.isArray(board.columns) || board.columns.length === 0) problems.push("board.columns isn't a list of values");
293
- else {
294
- const seen = /* @__PURE__ */ new Set();
295
- for (const value of board.columns) {
296
- if (choices && !choices.includes(value)) problems.push(`board.columns lists "${String(value)}", which isn't a value of ${board.field}`);
297
- if (seen.has(value)) problems.push(`board.columns lists "${String(value)}" twice`);
298
- seen.add(value);
299
- }
300
- }
301
- }
302
- for (const name of board.cardFields ?? []) {
303
- if (!byName.has(name)) problems.push(`board.cardFields names "${name}", which isn't a field`);
304
- }
305
- for (const [value, limit] of Object.entries(board.limits ?? {})) {
306
- const columns = board.columns ?? choices;
307
- if (columns && !columns.includes(value)) problems.push(`board.limits has "${value}", which isn't one of the board's columns`);
308
- if (!Number.isInteger(limit) || limit < 1) problems.push(`board.limits.${value} is a whole number of cards, 1 or more, not ${String(limit)}`);
309
- }
310
- return problems;
311
- }
312
- function defineView(contract, definition = {}) {
313
- const facts = contract;
314
- const fields = contract.fields;
315
- const byName = new Map(fields.map((f) => [f.name, f]));
316
- const keys = new Set(keyFields(contract));
317
- const scope = new Set(definition.scope ?? []);
318
- const viewFields = Object.freeze(
319
- Object.fromEntries(
320
- Object.entries(definition.fields ?? {}).map(([k, v]) => {
321
- const f = { ...v };
322
- const map = (m) => Boolean(m) && typeof m === "object" && !Array.isArray(m);
323
- if (map(f.tones)) f.tones = Object.freeze({ ...f.tones });
324
- if (map(f.labels)) f.labels = Object.freeze({ ...f.labels });
325
- return [k, Object.freeze(f)];
326
- })
327
- )
328
- );
329
- const columnLists = Object.freeze(
330
- Object.fromEntries(
331
- Object.entries(definition.columns ?? {}).map(([k, list]) => [
332
- k,
333
- Object.freeze((list ?? []).map((c) => typeof c === "string" ? c : Object.freeze({ ...c })))
334
- ])
335
- )
336
- );
337
- const formItems = Object.freeze(
338
- (definition.form ?? []).map((item) => typeof item === "string" ? item : Object.freeze({ ...item, fields: Object.freeze([...item.fields]) }))
339
- );
340
- const presets = Object.freeze(
341
- Object.fromEntries(
342
- Object.entries(definition.presets ?? {}).map(([k, p]) => [k, Object.freeze({ ...p, ...p.filter ? { filter: Object.freeze({ ...p.filter }) } : {} })])
343
- )
344
- );
345
- const actionList = Object.freeze(
346
- // Names are trimmed, so " archive" and "archive" are one name.
347
- (Array.isArray(definition.actions) ? definition.actions : []).map(
348
- (a) => a && typeof a === "object" ? Object.freeze({ ...a, ...typeof a.name === "string" ? { name: a.name.trim() } : {} }) : a
349
- )
350
- );
351
- const problems = [];
352
- const known = (name, where) => {
353
- if (!byName.has(name)) problems.push(`${where} names "${name}", which isn't a field`);
354
- };
355
- for (const name of Object.keys(viewFields)) known(name, "fields");
356
- for (const [name, v] of Object.entries(viewFields)) {
357
- if (v?.labels === void 0) continue;
358
- if (!v.labels || typeof v.labels !== "object" || Array.isArray(v.labels)) {
359
- problems.push(`fields.${name}.labels isn't a map of values to words`);
360
- continue;
361
- }
362
- const values = byName.get(name)?.enumValues;
363
- for (const [value, words] of Object.entries(v.labels)) {
364
- if (typeof words !== "string" || !words.trim()) problems.push(`fields.${name}.labels.${value} isn't text`);
365
- if (values?.length && !values.includes(value)) problems.push(`fields.${name}.labels names "${value}", which isn't one of its values`);
366
- }
367
- }
368
- for (const [name, v] of Object.entries(viewFields)) {
369
- const zone = v?.timeZone;
370
- if (zone === void 0 || zone === "viewer" || zone === "scope") continue;
371
- if (zone === "practice") {
372
- problems.push(
373
- `fields.${name}.timeZone "practice" was renamed "scope" in genesis-core 2; run \`genesis codemod genesis-core-2-scope-names\``
374
- );
375
- } else if (!isTimeZone(zone)) {
376
- problems.push(`fields.${name}.timeZone "${String(zone)}" isn't "viewer", "scope" or a time zone this runtime knows`);
377
- }
378
- }
379
- for (const [name, v] of Object.entries(viewFields)) {
380
- if (v?.missingLabel === void 0) continue;
381
- if (typeof v.missingLabel !== "string" || !v.missingLabel.trim()) problems.push(`fields.${name}.missingLabel isn't text`);
382
- else if (!byName.get(name)?.references) problems.push(`fields.${name}.missingLabel is set, but "${name}" isn't a link`);
383
- }
384
- for (const [name, v] of Object.entries(viewFields)) problems.push(...linkProblems(name, v?.link, byName.get(name)?.references));
385
- if (definition.editLinks !== void 0 && typeof definition.editLinks !== "boolean") problems.push("editLinks isn't true or false");
386
- for (const [name, v] of Object.entries(viewFields)) {
387
- if (v?.labelField === void 0) continue;
388
- if (typeof v.labelField !== "string" || !/^[A-Za-z_][A-Za-z0-9_]*$/.test(v.labelField)) {
389
- problems.push(`fields.${name}.labelField isn't a field name`);
390
- } else if (!byName.get(name)?.references) {
391
- problems.push(`fields.${name}.labelField is set, but "${name}" isn't a link`);
392
- }
393
- }
394
- for (const [preset, list] of Object.entries(columnLists)) {
395
- const seen = /* @__PURE__ */ new Set();
396
- for (const column of list ?? []) {
397
- const key = typeof column === "string" ? column : column.key;
398
- if (typeof column === "string") known(column, `columns.${preset}`);
399
- else if (byName.has(column.key)) problems.push(`columns.${preset}: computed "${column.key}" clashes with a field`);
400
- if (seen.has(key)) problems.push(`columns.${preset} lists "${key}" twice`);
401
- seen.add(key);
402
- }
403
- }
404
- const formSeen = /* @__PURE__ */ new Set();
405
- for (const item of formItems) {
406
- for (const name of typeof item === "string" ? [item] : item.fields) {
407
- known(name, "form");
408
- if (formSeen.has(name)) problems.push(`form lists "${name}" twice`);
409
- formSeen.add(name);
410
- }
411
- }
412
- for (const name of scope) known(name, "scope");
413
- if (definition.groupBy) known(definition.groupBy, "groupBy");
414
- const rawOpen = definition.open;
415
- if (rawOpen !== void 0 && !RECORD_OPEN_MODES.includes(rawOpen)) {
416
- problems.push(`open is ${RECORD_OPEN_MODES.map((m) => `"${m}"`).join(", ")}, not ${JSON.stringify(rawOpen)}`);
417
- }
418
- const rawRecordView = definition.recordView;
419
- if (rawRecordView !== void 0 && typeof rawRecordView !== "function") problems.push("recordView is a function that returns the record view (`() => brandRecordView`)");
420
- const rawCalendar = definition.calendar;
421
- let calendar;
422
- if (rawCalendar !== void 0) {
423
- if (!rawCalendar || typeof rawCalendar !== "object" || Array.isArray(rawCalendar)) {
424
- problems.push("calendar isn't an object");
425
- } else {
426
- for (const key of Object.keys(rawCalendar)) if (!CALENDAR_KEYS.includes(key)) problems.push(`calendar.${key} isn't a calendar setting`);
427
- if (rawCalendar.field === void 0) problems.push("calendar.field is required");
428
- calendar = Object.freeze({ ...rawCalendar });
429
- problems.push(...calendarProblems(fields, calendar));
430
- }
431
- }
432
- const rawBoard = definition.board;
433
- let board;
434
- if (rawBoard !== void 0) {
435
- if (!rawBoard || typeof rawBoard !== "object" || Array.isArray(rawBoard)) {
436
- problems.push("board isn't an object");
437
- } else {
438
- for (const key of Object.keys(rawBoard)) if (!BOARD_KEYS.includes(key)) problems.push(`board.${key} isn't a board setting`);
439
- if (rawBoard.field === void 0) problems.push("board.field is required");
440
- const given = rawBoard;
441
- board = Object.freeze({
442
- ...given,
443
- ...given.columns ? { columns: Object.freeze([...given.columns]) } : {},
444
- ...given.cardFields ? { cardFields: Object.freeze([...given.cardFields]) } : {},
445
- ...given.limits ? { limits: Object.freeze({ ...given.limits }) } : {}
446
- });
447
- problems.push(...boardProblems(fields, board));
448
- }
449
- }
450
- const rawGallery = definition.gallery;
451
- let gallery;
452
- if (rawGallery !== void 0) {
453
- if (!rawGallery || typeof rawGallery !== "object" || Array.isArray(rawGallery)) {
454
- problems.push("gallery isn't an object");
455
- } else {
456
- for (const key of Object.keys(rawGallery)) if (!GALLERY_KEYS.includes(key)) problems.push(`gallery.${key} isn't a gallery setting`);
457
- if (rawGallery.image === void 0) problems.push("gallery.image is required");
458
- gallery = Object.freeze({ ...rawGallery });
459
- problems.push(...galleryProblems(fields, gallery));
460
- }
461
- }
462
- if (definition.orderBy) {
463
- known(definition.orderBy.field, "orderBy");
464
- const { nulls } = definition.orderBy;
465
- if (nulls !== void 0 && nulls !== "first" && nulls !== "last") problems.push(`orderBy.nulls is "first" or "last", not ${String(nulls)}`);
466
- }
467
- for (const [name, preset] of Object.entries(presets)) {
468
- if (preset.columns && preset.columns !== "default" && !own(columnLists, preset.columns)) {
469
- problems.push(`presets.${name} uses columns "${preset.columns}", which isn't defined`);
470
- }
471
- for (const field of Object.keys(preset.filter ?? {})) known(field, `presets.${name}.filter`);
472
- }
473
- if (facts.labelField) known(facts.labelField, "the contract's labelField");
474
- const actionSeen = /* @__PURE__ */ new Set();
475
- if (definition.actions !== void 0 && !Array.isArray(definition.actions)) problems.push("actions isn't a list");
476
- actionList.forEach((action, i) => {
477
- const where = `actions[${i}]`;
478
- if (!action || typeof action !== "object") {
479
- problems.push(`${where} isn't an action`);
480
- return;
481
- }
482
- if (typeof action.name !== "string" || !action.name.trim()) problems.push(`${where} has no name`);
483
- else if (RESERVED_ACTIONS.has(action.name)) problems.push(`${where} is named "${action.name}", which is reserved for the view's own ${action.name}`);
484
- else if (actionSeen.has(action.name)) problems.push(`actions lists "${action.name}" twice`);
485
- else actionSeen.add(action.name);
486
- if (typeof action.label !== "string" || !action.label.trim()) problems.push(`${where} has no label`);
487
- if (action.confirm !== void 0 && typeof action.confirm !== "string") problems.push(`${where}.confirm isn't text`);
488
- if (action.description !== void 0 && typeof action.description !== "string") {
489
- problems.push(`${where}.description isn't text`);
490
- }
491
- if (action.can !== void 0 && typeof action.can !== "function") problems.push(`${where}.can isn't a function`);
492
- if (action.destructive !== void 0 && typeof action.destructive !== "boolean") problems.push(`${where}.destructive isn't true or false`);
493
- });
494
- if (problems.length) throw new ViewDefinitionError(contract.name, problems);
495
- const copy = definition.copy ?? {};
496
- const base = contract.name.split(".").pop() ?? contract.name;
497
- const noun = copy.noun ?? facts.noun ?? singular(base.replace(/_/g, " "));
498
- const labelWords = facts.label?.toLowerCase();
499
- const nounPlural = copy.nounPlural ?? facts.nounPlural ?? (copy.noun || facts.noun ? plural(noun) : labelWords && singular(labelWords) !== labelWords ? labelWords : base.replace(/_/g, " "));
500
- const title = copy.title ?? facts.label ?? titleCase(nounPlural);
501
- const labelField = facts.labelField ?? fields.find((f) => /^(name|title|label|full_name|display_name)$/.test(f.name))?.name;
502
- const label = (name) => own(viewFields, name)?.label ?? byName.get(name)?.label ?? titleCase(name);
503
- const display = (name) => {
504
- const field = byName.get(name);
505
- return own(viewFields, name)?.display ?? (field ? deriveDisplay(field) : "text");
506
- };
507
- const valueLabel = (name, value) => valueText(own(viewFields, name)?.labels, value);
508
- const readable = (name) => byName.get(name)?.permissions?.read !== false;
509
- const editLinks = definition.editLinks === true;
510
- const linkEditable = (f) => Boolean(f.references) && (editLinks || own(viewFields, f.name)?.link !== void 0);
511
- const readOnly = (field) => Boolean(
512
- field.generated || field.readOnly || field.references && !linkEditable(field) || field.permissions?.update === false || own(viewFields, field.name)?.readOnly
513
- );
514
- const quiet = (f) => keys.has(f.name) || scope.has(f.name) || Boolean(f.sensitive) || Boolean(f.references);
515
- const neededLink = (f) => linkEditable(f) && !f.nullable && !f.optional && !f.hasDefault && !scope.has(f.name);
516
- const defaultColumns = own(columnLists, "default") ?? fields.filter((f) => !quiet(f)).map((f) => f.name);
517
- const presetNames = Object.freeze(["default", ...Object.keys(columnLists).filter((p) => p !== "default")]);
518
- const fieldColumns = /* @__PURE__ */ new Map();
519
- const fieldColumn = (column) => {
520
- const cached = fieldColumns.get(column);
521
- if (cached) return cached;
522
- const v = own(viewFields, column);
523
- const resolved = Object.freeze({
524
- key: column,
525
- label: label(column),
526
- display: display(column),
527
- field: byName.get(column),
528
- value: (row) => row[column],
529
- ...v?.tones ? { tones: v.tones } : {},
530
- ...v?.labels ? { labels: v.labels } : {},
531
- ...v?.labelField ? { labelField: v.labelField } : {},
532
- ...v?.missingLabel ? { missingLabel: v.missingLabel } : {},
533
- ...v?.when ? { when: (row, viewer = NO_VIEWER) => v.when(row, viewer) } : {},
534
- ...v?.timeZone ? { timeZone: v.timeZone } : {}
535
- });
536
- fieldColumns.set(column, resolved);
537
- return resolved;
538
- };
539
- const resolvedColumns = /* @__PURE__ */ new Map();
540
- const columns = (preset = "default") => {
541
- const cached = resolvedColumns.get(preset);
542
- if (cached) return cached;
543
- const list = preset === "default" ? defaultColumns : own(columnLists, preset);
544
- if (!list) throw new ViewDefinitionError(contract.name, [`no column preset "${preset}"`]);
545
- const out = Object.freeze(
546
- list.filter((column) => typeof column !== "string" || readable(column)).map((column) => {
547
- if (typeof column !== "string") {
548
- return Object.freeze({ key: column.key, label: column.label, display: column.display ?? "text", value: column.value });
549
- }
550
- return fieldColumn(column);
551
- })
552
- );
553
- resolvedColumns.set(preset, out);
554
- return out;
555
- };
556
- const links = new Map(
557
- fields.filter((f) => linkEditable(f)).map((f) => [f.name, resolveLink(contract.name, f.name, f.references, own(viewFields, f.name)?.link, own(viewFields, f.name)?.labelField)])
558
- );
559
- const placed = definition.form ? formItems.flatMap(
560
- (item) => typeof item === "string" ? [{ name: item, section: null, sectionTitle: null }] : item.fields.map((name) => ({ name, section: item.section, sectionTitle: item.title ?? titleCase(item.section) }))
561
- ) : fields.filter(
562
- (f) => !readOnly(f) && (!quiet(f) || keys.has(f.name) && !f.hasDefault && !f.sensitive || neededLink(f) && !f.sensitive) && f.type !== "json" && !f.array
563
- ).map((f) => ({ name: f.name, section: null, sectionTitle: null }));
564
- const serverKey = (f, mode) => keys.has(f.name) && (mode === "edit" || Boolean(f.hasDefault));
565
- const resolvedForms = /* @__PURE__ */ new Map();
566
- const form = (mode) => {
567
- const cached = resolvedForms.get(mode);
568
- if (cached) return cached;
569
- const out = Object.freeze(placed.filter(({ name }) => !scope.has(name) && readable(name) && !serverKey(byName.get(name), mode)).map(({ name, section, sectionTitle }) => {
570
- const field = byName.get(name);
571
- const v = own(viewFields, name);
572
- const locked = readOnly(field);
573
- return Object.freeze({
574
- field,
575
- label: label(name),
576
- display: display(name),
577
- required: !locked && !field.nullable && !field.optional && (mode === "edit" || !field.hasDefault),
578
- readOnly: locked,
579
- section,
580
- sectionTitle,
581
- ...v?.max !== void 0 ? { max: v.max } : {},
582
- ...v?.autoComplete ? { autoComplete: v.autoComplete } : {},
583
- ...v?.inputMode ? { inputMode: v.inputMode } : {},
584
- ...v?.enterKeyHint ? { enterKeyHint: v.enterKeyHint } : {},
585
- ...v?.labelField ? { labelField: v.labelField } : {},
586
- ...v?.missingLabel ? { missingLabel: v.missingLabel } : {},
587
- ...field.enumValues?.length ? { options: Object.freeze(field.enumValues.map((value) => Object.freeze({ value, label: valueLabel(name, value) }))) } : {},
588
- ...links.has(name) ? { link: links.get(name) } : {},
589
- ...v?.visible ? { visible: v.visible } : {}
590
- });
591
- }));
592
- resolvedForms.set(mode, out);
593
- return out;
594
- };
595
- const writable = (mode) => Object.freeze(form(mode).filter((f) => !f.readOnly).map((f) => f.field.name));
596
- const guards = definition.can ?? {};
597
- function can(action, rowOrViewer, maybeViewer) {
598
- if (action === "create" && maybeViewer !== void 0) throw new TypeError(`[genesis-core] ${contract.name}: can("create", viewer) takes no row`);
599
- if (action === "create") return guards.create?.(rowOrViewer ?? NO_VIEWER) ?? true;
600
- const guard = guards[action];
601
- const row = rowOrViewer;
602
- return guard && row ? guard(row, maybeViewer ?? NO_VIEWER) : true;
603
- }
604
- const actionGuards = new Map(actionList.map((a) => [a.name, a.can]));
605
- const resolvedActions = Object.freeze(
606
- actionList.map(
607
- (a) => Object.freeze({
608
- name: a.name,
609
- label: a.label,
610
- ...a.confirm !== void 0 ? { confirm: a.confirm } : {},
611
- ...a.description !== void 0 ? { description: a.description } : {},
612
- ...a.destructive ? { destructive: true } : {}
613
- })
614
- )
615
- );
616
- function canAction(name, row, viewer = NO_VIEWER) {
617
- if (!actionGuards.has(name)) throw new ViewDefinitionError(contract.name, [`no action "${name}"`]);
618
- const guard = actionGuards.get(name);
619
- if (!guard) return true;
620
- const result = guard(row, viewer);
621
- if (result === true) return true;
622
- return typeof result === "string" && result.trim() ? result : "This isn't allowed.";
623
- }
624
- const summary = (row) => {
625
- if (definition.summary) return definition.summary(row);
626
- const value = labelField ? row[labelField] : void 0;
627
- return { title: value === null || value === void 0 || value === "" ? titleCase(noun) : String(value) };
628
- };
629
- const galleryItem = (row, override) => {
630
- const block = { ...gallery, ...override };
631
- if (!block.image) return void 0;
632
- const image = row[block.image];
633
- const src = typeof image === "string" ? image : "";
634
- const number = (name) => {
635
- const value = name ? Number(row[name]) : NaN;
636
- return Number.isFinite(value) && value > 0 ? value : void 0;
637
- };
638
- const text = (name) => {
639
- const value = name ? row[name] : void 0;
640
- return value === null || value === void 0 || value === "" ? void 0 : String(value);
641
- };
642
- const width = number(block.width);
643
- const height = number(block.height);
644
- const caption = text(block.caption);
645
- const alt = text(block.alt) ?? summary(row).title;
646
- return {
647
- id: String(encodeRecordKey(contract, row)),
648
- src,
649
- alt,
650
- ...width !== void 0 && height !== void 0 ? { width, height } : {},
651
- ...caption !== void 0 ? { caption } : {}
652
- };
653
- };
654
- return Object.freeze({
655
- contract,
656
- definition: Object.freeze({
657
- ...definition,
658
- fields: viewFields,
659
- columns: columnLists,
660
- presets,
661
- ...definition.form ? { form: formItems } : {},
662
- ...definition.scope ? { scope: Object.freeze([...definition.scope]) } : {},
663
- ...definition.actions ? { actions: actionList } : {},
664
- ...calendar ? { calendar } : {},
665
- ...board ? { board } : {},
666
- ...gallery ? { gallery } : {}
667
- }),
668
- resource: contract.name,
669
- noun,
670
- nounPlural,
671
- title,
672
- labelField,
673
- presets: presetNames,
674
- field: (name) => byName.get(name),
675
- column: (name) => byName.has(name) && readable(name) ? fieldColumn(name) : void 0,
676
- label,
677
- display,
678
- valueLabel,
679
- columns,
680
- form,
681
- writable,
682
- can,
683
- actions: () => resolvedActions,
684
- canAction,
685
- summary,
686
- galleryItem
687
- });
688
- }
689
-
690
18
  // src/resource-view/picture.ts
691
19
  var segmenter;
692
20
  var LETTER = /^\p{L}/u;
@@ -745,6 +73,23 @@ function groupRows(view, rows, options = {}) {
745
73
  }
746
74
  return [...groups.values()].map((g) => Object.freeze({ ...g, rows: Object.freeze(g.rows) }));
747
75
  }
76
+ function groupTotals(view, rows) {
77
+ const out = {};
78
+ for (const [field, fn] of Object.entries(view.definition.totals ?? {})) {
79
+ if (fn === "count") {
80
+ out[field] = rows.filter((r) => !isEmpty(r[field])).length;
81
+ continue;
82
+ }
83
+ const numbers = rows.map((r) => isEmpty(r[field]) ? NaN : Number(r[field])).filter((n) => Number.isFinite(n));
84
+ if (!numbers.length) {
85
+ out[field] = null;
86
+ continue;
87
+ }
88
+ const sum = numbers.reduce((a, b) => a + b, 0);
89
+ out[field] = fn === "sum" ? sum : fn === "avg" ? sum / numbers.length : fn === "min" ? Math.min(...numbers) : Math.max(...numbers);
90
+ }
91
+ return Object.freeze(out);
92
+ }
748
93
 
749
94
  // src/resource-view/tree.ts
750
95
  var rootish = (parent) => parent == null || parent === "";
@@ -1022,9 +367,9 @@ function defineRecordView(view, definition) {
1022
367
  if (options.runnable !== false) {
1023
368
  for (const name of headerActions) {
1024
369
  if (served && !served.has(name)) continue;
1025
- const own2 = options.can?.(name, row);
1026
- if (own2 === false) continue;
1027
- const allowed = typeof own2 === "string" ? own2 || REFUSED : view.canAction(name, row, options.viewer);
370
+ const own = options.can?.(name, row);
371
+ if (own === false) continue;
372
+ const allowed = typeof own === "string" ? own || REFUSED : view.canAction(name, row, options.viewer);
1028
373
  actions.push(Object.freeze({ ...actionByName.get(name), allowed }));
1029
374
  }
1030
375
  }
@@ -1289,6 +634,6 @@ function resolveProgress(value, goal) {
1289
634
  return Math.max(0, value / goal);
1290
635
  }
1291
636
 
1292
- export { RECORD_OPEN_MODES, ViewDefinitionError, boardChoices, boardProblems, calendarProblems, cascadeSelection, defineRecordView, defineView, defineWidget, defineWorkspace, deriveDisplay, filterParams, galleryProblems, groupRows, initialExpanded, initialsOf, isRecordView, isWidget, isWorkspace, plural, resolveChartSeries, resolveProgress, resolveStreak, resolveWidgetAccess, resolveWidgetRequest, rowPicture, sameFormValue, scopeFilter, scopeValues, setExpanded, singular, toWidgetText, treeRows, valueText, widgetProblems };
637
+ export { cascadeSelection, defineRecordView, defineWidget, defineWorkspace, groupRows, groupTotals, initialExpanded, initialsOf, isRecordView, isWidget, isWorkspace, resolveChartSeries, resolveProgress, resolveStreak, resolveWidgetAccess, resolveWidgetRequest, rowPicture, sameFormValue, setExpanded, toWidgetText, treeRows, widgetProblems };
1293
638
  //# sourceMappingURL=index.js.map
1294
639
  //# sourceMappingURL=index.js.map