@marktiderman/genesis-core 2.6.0 → 2.8.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.
- package/dist/{chunk-GWQHP3RC.js → chunk-4ZR7472O.js} +3 -3
- package/dist/{chunk-GWQHP3RC.js.map → chunk-4ZR7472O.js.map} +1 -1
- package/dist/{chunk-OSFG3GFY.js → chunk-6WV6ST67.js} +13 -9
- package/dist/chunk-6WV6ST67.js.map +1 -0
- package/dist/chunk-AJGVLF37.js +13 -0
- package/dist/chunk-AJGVLF37.js.map +1 -0
- package/dist/{chunk-2VVZ2KX3.js → chunk-HQAVDVIH.js} +3 -3
- package/dist/{chunk-2VVZ2KX3.js.map → chunk-HQAVDVIH.js.map} +1 -1
- package/dist/{chunk-LZVU5NGV.js → chunk-IQVIHN7C.js} +3 -3
- package/dist/{chunk-LZVU5NGV.js.map → chunk-IQVIHN7C.js.map} +1 -1
- package/dist/{chunk-CC37H7O2.js → chunk-ON2V4RXX.js} +5 -5
- package/dist/{chunk-CC37H7O2.js.map → chunk-ON2V4RXX.js.map} +1 -1
- package/dist/{chunk-OWYX4BEI.js → chunk-RK365SO2.js} +4 -4
- package/dist/{chunk-OWYX4BEI.js.map → chunk-RK365SO2.js.map} +1 -1
- package/dist/{chunk-XQO4OH2N.js → chunk-RVWKVD5Q.js} +7 -6
- package/dist/chunk-RVWKVD5Q.js.map +1 -0
- package/dist/{chunk-BIIENNTW.js → chunk-WXENWPWP.js} +73 -45
- package/dist/chunk-WXENWPWP.js.map +1 -0
- package/dist/{chunk-OKCSGNCU.js → chunk-X6EVE7W4.js} +6 -6
- package/dist/{chunk-OKCSGNCU.js.map → chunk-X6EVE7W4.js.map} +1 -1
- package/dist/{chunk-DF2UWEEB.js → chunk-YQBWXG2G.js} +8 -7
- package/dist/chunk-YQBWXG2G.js.map +1 -0
- package/dist/{chunk-K4ZNAF3G.js → chunk-ZCE3CHPX.js} +2 -2
- package/dist/{chunk-K4ZNAF3G.js.map → chunk-ZCE3CHPX.js.map} +1 -1
- package/dist/dates.d.ts +4 -2
- package/dist/dates.js +1 -1
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.js +14 -13
- package/dist/hooks/mutation-mode.js +3 -2
- package/dist/hooks/page-window.d.ts +5 -0
- package/dist/hooks/page-window.js +3 -0
- package/dist/hooks/page-window.js.map +1 -0
- package/dist/hooks/use-draft.js +2 -1
- package/dist/hooks/use-infinite-resource.js +2 -2
- package/dist/hooks/use-link-options.js +3 -3
- package/dist/hooks/use-live.d.ts +2 -1
- package/dist/hooks/use-live.js +1 -1
- package/dist/hooks/use-one.js +2 -2
- package/dist/hooks/use-resource-form.js +8 -7
- package/dist/hooks/use-resource.js +6 -5
- package/dist/hooks/use-unsaved-changes-guard.js +2 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +15 -14
- package/dist/resource-view/index.d.ts +30 -11
- package/dist/resource-view/index.js +34 -9
- package/dist/resource-view/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-BIIENNTW.js.map +0 -1
- package/dist/chunk-DF2UWEEB.js.map +0 -1
- package/dist/chunk-OSFG3GFY.js.map +0 -1
- package/dist/chunk-XQO4OH2N.js.map +0 -1
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
export { blankValues, buildArrayItemDefaults, useResourceForm } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
3
|
-
import '../chunk-
|
|
4
|
-
import '../chunk-
|
|
1
|
+
export { blankValues, buildArrayItemDefaults, useResourceForm } from '../chunk-X6EVE7W4.js';
|
|
2
|
+
import '../chunk-RVWKVD5Q.js';
|
|
3
|
+
import '../chunk-4ZR7472O.js';
|
|
4
|
+
import '../chunk-ZCE3CHPX.js';
|
|
5
5
|
import '../chunk-AUVKRXRC.js';
|
|
6
|
-
import '../chunk-
|
|
7
|
-
import '../chunk-7PUFVNPB.js';
|
|
8
|
-
import '../chunk-7NUL32W7.js';
|
|
6
|
+
import '../chunk-6WV6ST67.js';
|
|
9
7
|
import '../chunk-LGTXQTHA.js';
|
|
8
|
+
import '../chunk-7PUFVNPB.js';
|
|
10
9
|
import '../chunk-VDEW4AOS.js';
|
|
11
10
|
import '../chunk-ZYJUEJ4Z.js';
|
|
11
|
+
import '../chunk-AJGVLF37.js';
|
|
12
|
+
import '../chunk-7NUL32W7.js';
|
|
12
13
|
import '../chunk-RYEXWQFD.js';
|
|
13
14
|
import '../chunk-LG6TUBVM.js';
|
|
14
15
|
//# sourceMappingURL=use-resource-form.js.map
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
export { useResource } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
1
|
+
export { useResource } from '../chunk-ON2V4RXX.js';
|
|
2
|
+
import '../chunk-ZCE3CHPX.js';
|
|
3
3
|
import '../chunk-AUVKRXRC.js';
|
|
4
|
-
import '../chunk-
|
|
5
|
-
import '../chunk-7PUFVNPB.js';
|
|
6
|
-
import '../chunk-7NUL32W7.js';
|
|
4
|
+
import '../chunk-6WV6ST67.js';
|
|
7
5
|
import '../chunk-LGTXQTHA.js';
|
|
6
|
+
import '../chunk-7PUFVNPB.js';
|
|
8
7
|
import '../chunk-VDEW4AOS.js';
|
|
9
8
|
import '../chunk-ZYJUEJ4Z.js';
|
|
9
|
+
import '../chunk-AJGVLF37.js';
|
|
10
|
+
import '../chunk-7NUL32W7.js';
|
|
10
11
|
//# sourceMappingURL=use-resource.js.map
|
|
11
12
|
//# sourceMappingURL=use-resource.js.map
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export { DEFAULT_UNSAVED_CHANGES_MESSAGE, useUnsavedChangesGuard } from '../chunk-
|
|
1
|
+
export { DEFAULT_UNSAVED_CHANGES_MESSAGE, useUnsavedChangesGuard } from '../chunk-RVWKVD5Q.js';
|
|
2
|
+
import '../chunk-AJGVLF37.js';
|
|
2
3
|
//# sourceMappingURL=use-unsaved-changes-guard.js.map
|
|
3
4
|
//# sourceMappingURL=use-unsaved-changes-guard.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export { UseDraftReturn, useDraft } from './hooks/use-draft.js';
|
|
|
16
16
|
export { DEFAULT_DRAFT_DELAY_MS, DRAFT_NOT_SAVED, DraftAdoption, DraftController, DraftOptions, DraftSeed, DraftState, DraftStatus, DraftValue, isNetworkFailure, stableJson } from './hooks/draft-controller.js';
|
|
17
17
|
export { G as GenesisViewerRoles, N as NO_VIEWER, R as ResourceScope, V as Viewer, a as ViewerContext, b as ViewerScope, c as ViewerScopeProps, d as clearViewerCache, s as scopeClock, u as useOptionalViewerScope, e as useViewer, f as useViewerScope } from './viewer-scope-bthEYSOB.js';
|
|
18
18
|
export { WorkspaceContext, WorkspaceScope, WorkspaceScopeProps, rememberedWorkspaceId, useWorkspace } from './hooks/index.js';
|
|
19
|
-
export { DEFAULT_LIVE_DEBOUNCE_MS, DEFAULT_LIVE_RESYNC_MS, LiveOptions } from './hooks/use-live.js';
|
|
19
|
+
export { DEFAULT_LIVE_DEBOUNCE_MS, DEFAULT_LIVE_RESYNC_MS, LiveOptions, useLiveInvalidation } from './hooks/use-live.js';
|
|
20
20
|
export { UseResourceFormOptions, UseResourceFormReturn, blankValues, buildArrayItemDefaults, useResourceForm } from './hooks/use-resource-form.js';
|
|
21
21
|
export { UseWizardReturn, WizardStep, useWizard } from './hooks/use-wizard.js';
|
|
22
22
|
export { DEFAULT_UNDO_DELAY_MS, MutationMode, MutationModeOptions, UndoableWrite, dropPendingWrites, flushPendingWrites, pendingWriteCount } from './hooks/mutation-mode.js';
|
package/dist/index.js
CHANGED
|
@@ -1,30 +1,31 @@
|
|
|
1
|
-
export { DEFAULT_RPC_MESSAGES, RPC_FAILED, callRpc, createOrAdopt, createSupabaseProvider } from './chunk-7GW3QR63.js';
|
|
2
1
|
export { defineResource } from './chunk-7FVTGKTX.js';
|
|
2
|
+
export { DEFAULT_RPC_MESSAGES, RPC_FAILED, callRpc, createOrAdopt, createSupabaseProvider } from './chunk-7GW3QR63.js';
|
|
3
3
|
export { decodeRecordKey, encodeRecordKey, keyFields } from './chunk-KV2HW4G4.js';
|
|
4
4
|
import './chunk-XCX2TRBL.js';
|
|
5
|
-
export { ViewerScope, WorkspaceScope, clearViewerCache, rememberedWorkspaceId, scopeClock, useOptionalViewerScope, useViewer, useViewerScope, useWorkspace } from './chunk-
|
|
5
|
+
export { ViewerScope, WorkspaceScope, clearViewerCache, rememberedWorkspaceId, scopeClock, useOptionalViewerScope, useViewer, useViewerScope, useWorkspace } from './chunk-RK365SO2.js';
|
|
6
|
+
export { useResource } from './chunk-ON2V4RXX.js';
|
|
6
7
|
export { useWizard } from './chunk-7KOLYF27.js';
|
|
7
8
|
export { WRITE_FAILED, useWrite } from './chunk-52T2EYXH.js';
|
|
8
9
|
export { NO_VIEWER } from './chunk-OZYF55E3.js';
|
|
9
|
-
export { useDraft } from './chunk-
|
|
10
|
-
export { useLinkOptions } from './chunk-
|
|
11
|
-
export { useInfiniteResource } from './chunk-
|
|
10
|
+
export { useDraft } from './chunk-YQBWXG2G.js';
|
|
11
|
+
export { useLinkOptions } from './chunk-IQVIHN7C.js';
|
|
12
|
+
export { useInfiniteResource } from './chunk-HQAVDVIH.js';
|
|
12
13
|
export { loadRelationLabel, relationNamingField, useRelationLabel } from './chunk-EHFYSJJA.js';
|
|
13
|
-
export { blankValues, buildArrayItemDefaults, useResourceForm } from './chunk-
|
|
14
|
-
export { DEFAULT_UNSAVED_CHANGES_MESSAGE, useUnsavedChangesGuard } from './chunk-
|
|
15
|
-
export { useOne } from './chunk-
|
|
16
|
-
export {
|
|
17
|
-
export { DEFAULT_LIVE_DEBOUNCE_MS, DEFAULT_LIVE_RESYNC_MS } from './chunk-K4ZNAF3G.js';
|
|
14
|
+
export { blankValues, buildArrayItemDefaults, useResourceForm } from './chunk-X6EVE7W4.js';
|
|
15
|
+
export { DEFAULT_UNSAVED_CHANGES_MESSAGE, useUnsavedChangesGuard } from './chunk-RVWKVD5Q.js';
|
|
16
|
+
export { useOne } from './chunk-4ZR7472O.js';
|
|
17
|
+
export { DEFAULT_LIVE_DEBOUNCE_MS, DEFAULT_LIVE_RESYNC_MS, useLiveInvalidation } from './chunk-ZCE3CHPX.js';
|
|
18
18
|
import './chunk-UHOMTFBD.js';
|
|
19
19
|
export { DEFAULT_DRAFT_DELAY_MS, DRAFT_NOT_SAVED, DraftController, isNetworkFailure, stableJson } from './chunk-HBAPYA5K.js';
|
|
20
20
|
import './chunk-AUVKRXRC.js';
|
|
21
|
-
export { DEFAULT_UNDO_DELAY_MS, dropPendingWrites, flushPendingWrites, pendingWriteCount } from './chunk-
|
|
22
|
-
export { defineQueryKeys, resourceKeys } from './chunk-7PUFVNPB.js';
|
|
23
|
-
import './chunk-7NUL32W7.js';
|
|
21
|
+
export { DEFAULT_UNDO_DELAY_MS, dropPendingWrites, flushPendingWrites, pendingWriteCount } from './chunk-6WV6ST67.js';
|
|
24
22
|
export { useCapabilities } from './chunk-LGTXQTHA.js';
|
|
23
|
+
export { defineQueryKeys, resourceKeys } from './chunk-7PUFVNPB.js';
|
|
25
24
|
export { DataProviderRoot, GenesisProvider, createMockProvider, useDataProvider, useStorage } from './chunk-VDEW4AOS.js';
|
|
26
25
|
export { createLocalStorageAdapter, createMemoryStorageAdapter, createNoopStorageAdapter } from './chunk-ZYJUEJ4Z.js';
|
|
27
|
-
import './chunk-
|
|
26
|
+
import './chunk-AJGVLF37.js';
|
|
27
|
+
import './chunk-7NUL32W7.js';
|
|
28
|
+
import './chunk-WXENWPWP.js';
|
|
28
29
|
export { classifyError, defaultErrorReporter, errorMessages, getErrorReporter, reportError, setErrorReporter } from './chunk-37RWGNIO.js';
|
|
29
30
|
export { fieldErrorsFromPostgrest, readOutcomeFromCode, toDataWriteError, writeOutcomeFromCode } from './chunk-PA6WJE5E.js';
|
|
30
31
|
export { DataReadError, isDataReadError, readFailureMessage } from './chunk-HUNGCTRA.js';
|
|
@@ -241,10 +241,18 @@ interface ViewCopy {
|
|
|
241
241
|
};
|
|
242
242
|
/** The create button. Default "New". */
|
|
243
243
|
create?: string;
|
|
244
|
-
/**
|
|
244
|
+
/**
|
|
245
|
+
* The form's words. Titles: default "New {noun}" and "Edit {noun}" (the UI catalogue's `form`).
|
|
246
|
+
* Submit buttons: default "Create" and "Save". Descriptions (read out with the title): default
|
|
247
|
+
* the UI catalogue's `form.createDescription` and `form.editDescription`.
|
|
248
|
+
*/
|
|
245
249
|
form?: {
|
|
246
250
|
createTitle?: string;
|
|
247
251
|
editTitle?: string;
|
|
252
|
+
createSubmit?: string;
|
|
253
|
+
editSubmit?: string;
|
|
254
|
+
createDescription?: string;
|
|
255
|
+
editDescription?: string;
|
|
248
256
|
};
|
|
249
257
|
/**
|
|
250
258
|
* The count beside the title. Default "{count} {noun}" for one, "{count} {nouns}" for more, and
|
|
@@ -423,6 +431,14 @@ declare function singular(word: string): string;
|
|
|
423
431
|
declare function plural(word: string): string;
|
|
424
432
|
/** A value in words: its entry in `labels`, else the value in title case (`draft` → "Draft"). */
|
|
425
433
|
declare function valueText(labels: Readonly<Record<string, string>> | undefined, value: unknown): string;
|
|
434
|
+
/**
|
|
435
|
+
* What's wrong with a calendar block for these fields, one sentence each (empty when it's fine).
|
|
436
|
+
* `defineView` checks the view's own block with it; a renderer checks a screen's overrides merged
|
|
437
|
+
* over that block with it too, so neither can name a field that isn't there or isn't a date.
|
|
438
|
+
*
|
|
439
|
+
* @stability Beta
|
|
440
|
+
*/
|
|
441
|
+
declare function calendarProblems(fields: readonly Pick<FieldSchema, "name" | "type" | "array">[], calendar: Partial<ViewCalendar>): string[];
|
|
426
442
|
/**
|
|
427
443
|
* Describe what a resource means to people. The result is frozen and platform-neutral:
|
|
428
444
|
*
|
|
@@ -441,21 +457,18 @@ declare function valueText(labels: Readonly<Record<string, string>> | undefined,
|
|
|
441
457
|
* Throws {@link ViewDefinitionError} when it names something the contract doesn't have, so a
|
|
442
458
|
* renamed column fails at start-up, not as a blank cell.
|
|
443
459
|
*/
|
|
444
|
-
/**
|
|
445
|
-
* What's wrong with a calendar block for these fields, one sentence each (empty when it's fine).
|
|
446
|
-
* `defineView` checks the view's own block with it; a renderer checks a screen's overrides merged
|
|
447
|
-
* over that block with it too, so neither can name a field that isn't there or isn't a date.
|
|
448
|
-
*
|
|
449
|
-
* @stability Beta
|
|
450
|
-
*/
|
|
451
|
-
declare function calendarProblems(fields: readonly Pick<FieldSchema, "name" | "type" | "array">[], calendar: Partial<ViewCalendar>): string[];
|
|
452
460
|
declare function defineView<C extends ResourceContract, Row extends DataRow = RowOf<C>>(contract: C, definition?: ViewDefinition<C, Row>): ResourceView<C, Row>;
|
|
453
461
|
|
|
454
462
|
/**
|
|
455
463
|
* First and last initial of a name, from letters only: "Ada Lovelace" → "AL", "Ana-María López"
|
|
456
464
|
* → "AL", "李 小龙" → "李小", "Cher" → "C". Empty when the name has no letters (" ", "🎉🎉").
|
|
465
|
+
*
|
|
466
|
+
* `distinct: true` gives a one-word name its first two letters ("Probe" → "Pr", "Polish" → "Po"),
|
|
467
|
+
* so people who share an initial still differ in a list. Names of two words or more are unchanged.
|
|
457
468
|
*/
|
|
458
|
-
declare function initialsOf(name: string | undefined
|
|
469
|
+
declare function initialsOf(name: string | undefined, options?: {
|
|
470
|
+
distinct?: boolean | undefined;
|
|
471
|
+
}): string;
|
|
459
472
|
/**
|
|
460
473
|
* What to draw for a summary's picture:
|
|
461
474
|
*
|
|
@@ -729,6 +742,12 @@ interface RecordView<C extends ResourceContract = ResourceContract, Row extends
|
|
|
729
742
|
*/
|
|
730
743
|
readinessSummary(row: Row): Readiness | null;
|
|
731
744
|
}
|
|
745
|
+
/**
|
|
746
|
+
* Whether two values are the same as a settings form holds them: 2 and "2", and null, undefined
|
|
747
|
+
* and "", are the same. A settings section compares an edit with the row through it, so an edit
|
|
748
|
+
* back to the stored value isn't a change (web and native RecordView).
|
|
749
|
+
*/
|
|
750
|
+
declare function sameFormValue(a: unknown, b: unknown): boolean;
|
|
732
751
|
/** Whether a value is a record view (`defineRecordView`'s result). */
|
|
733
752
|
declare function isRecordView(value: unknown): value is RecordView;
|
|
734
753
|
/**
|
|
@@ -763,4 +782,4 @@ type WorkspaceSection<Row extends DataRow = DataRow, Name extends string = strin
|
|
|
763
782
|
/** @deprecated Renamed `RecordViewHeaderAction`. */
|
|
764
783
|
type WorkspaceHeaderAction = RecordViewHeaderAction;
|
|
765
784
|
|
|
766
|
-
export { type Allowed, type ComputedColumn, type DisplayHint, type FieldNameOf, type LinkFilter, type LinkedView, type RecordView, type RecordViewDefinition, type RecordViewFilter, type RecordViewHeader, type RecordViewHeaderAction, type RecordViewHeaderOptions, type RecordViewListSection, type RecordViewReadinessItem, type RecordViewSection, type RecordViewSettingsSection, type RecordViewSlotSection, type ResolvedColumn, type ResolvedFormField, type ResolvedLink, type ResolvedReadinessItem, type ResolvedRecordViewSection, type ResolvedViewAction, type ResourceTree, type ResourceView, type ResourceWorkspace, type RowImage, RowOf, type RowPicture, type RowSummary, type TimeZoneName, type TreeNode, type TreeOptions, type TreeResult, type ViewAction, type ViewCalendar, type ViewCalendarLayout, type ViewColumn, type ViewCopy, type ViewDefinition, ViewDefinitionError, type ViewField, type ViewFormItem, type ViewGuards, type ViewLink, type ViewPreset, type ViewTimeZone, type ViewTone, Viewer, type WorkspaceDefinition, type WorkspaceHeaderAction, type WorkspaceSection, calendarProblems, cascadeSelection, defineRecordView, defineView, defineWorkspace, deriveDisplay, filterParams, initialExpanded, initialsOf, isRecordView, isWorkspace, plural, rowPicture, scopeFilter, scopeValues, setExpanded, singular, treeRows, valueText };
|
|
785
|
+
export { type Allowed, type ComputedColumn, type DisplayHint, type FieldNameOf, type LinkFilter, type LinkedView, type RecordView, type RecordViewDefinition, type RecordViewFilter, type RecordViewHeader, type RecordViewHeaderAction, type RecordViewHeaderOptions, type RecordViewListSection, type RecordViewReadinessItem, type RecordViewSection, type RecordViewSettingsSection, type RecordViewSlotSection, type ResolvedColumn, type ResolvedFormField, type ResolvedLink, type ResolvedReadinessItem, type ResolvedRecordViewSection, type ResolvedViewAction, type ResourceTree, type ResourceView, type ResourceWorkspace, type RowImage, RowOf, type RowPicture, type RowSummary, type TimeZoneName, type TreeNode, type TreeOptions, type TreeResult, type ViewAction, type ViewCalendar, type ViewCalendarLayout, type ViewColumn, type ViewCopy, type ViewDefinition, ViewDefinitionError, type ViewField, type ViewFormItem, type ViewGuards, type ViewLink, type ViewPreset, type ViewTimeZone, type ViewTone, Viewer, type WorkspaceDefinition, type WorkspaceHeaderAction, type WorkspaceSection, calendarProblems, cascadeSelection, defineRecordView, defineView, defineWorkspace, deriveDisplay, filterParams, initialExpanded, initialsOf, isRecordView, isWorkspace, plural, rowPicture, sameFormValue, scopeFilter, scopeValues, setExpanded, singular, treeRows, valueText };
|
|
@@ -2,7 +2,7 @@ import { readinessOf } from '../chunk-PP3XFFQM.js';
|
|
|
2
2
|
import { keyFields, encodeRecordKey } from '../chunk-KV2HW4G4.js';
|
|
3
3
|
import { NO_VIEWER } from '../chunk-OZYF55E3.js';
|
|
4
4
|
export { NO_VIEWER } from '../chunk-OZYF55E3.js';
|
|
5
|
-
import { isTimeZone } from '../chunk-
|
|
5
|
+
import { isTimeZone } from '../chunk-WXENWPWP.js';
|
|
6
6
|
import { isDevelopment, reportError } from '../chunk-37RWGNIO.js';
|
|
7
7
|
import '../chunk-PA6WJE5E.js';
|
|
8
8
|
import '../chunk-HUNGCTRA.js';
|
|
@@ -310,8 +310,19 @@ function defineView(contract, definition = {}) {
|
|
|
310
310
|
}
|
|
311
311
|
for (const name of scope) known(name, "scope");
|
|
312
312
|
if (definition.groupBy) known(definition.groupBy, "groupBy");
|
|
313
|
-
const
|
|
314
|
-
|
|
313
|
+
const rawCalendar = definition.calendar;
|
|
314
|
+
let calendar;
|
|
315
|
+
if (rawCalendar !== void 0) {
|
|
316
|
+
if (!rawCalendar || typeof rawCalendar !== "object" || Array.isArray(rawCalendar)) {
|
|
317
|
+
problems.push("calendar isn't an object");
|
|
318
|
+
} else {
|
|
319
|
+
const known2 = ["field", "endField", "allDayField", "laneBy", "layout", "weeks", "weekStartsOn"];
|
|
320
|
+
for (const key of Object.keys(rawCalendar)) if (!known2.includes(key)) problems.push(`calendar.${key} isn't a calendar setting`);
|
|
321
|
+
if (rawCalendar.field === void 0) problems.push("calendar.field is required");
|
|
322
|
+
calendar = Object.freeze({ ...rawCalendar });
|
|
323
|
+
problems.push(...calendarProblems(fields, calendar));
|
|
324
|
+
}
|
|
325
|
+
}
|
|
315
326
|
if (definition.orderBy) known(definition.orderBy.field, "orderBy");
|
|
316
327
|
for (const [name, preset] of Object.entries(presets)) {
|
|
317
328
|
if (preset.columns && preset.columns !== "default" && !own(columnLists, preset.columns)) {
|
|
@@ -502,18 +513,28 @@ function defineView(contract, definition = {}) {
|
|
|
502
513
|
// src/resource-view/picture.ts
|
|
503
514
|
var segmenter;
|
|
504
515
|
var LETTER = /^\p{L}/u;
|
|
505
|
-
function
|
|
516
|
+
function lettersOf(word) {
|
|
506
517
|
if (segmenter === void 0) {
|
|
507
518
|
segmenter = typeof Intl !== "undefined" && typeof Intl.Segmenter === "function" ? new Intl.Segmenter(void 0, { granularity: "grapheme" }) : null;
|
|
508
519
|
}
|
|
509
520
|
const parts = segmenter ? Array.from(segmenter.segment(word), (s) => s.segment) : Array.from(word);
|
|
510
|
-
return parts.
|
|
521
|
+
return parts.filter((part) => LETTER.test(part));
|
|
511
522
|
}
|
|
512
|
-
function
|
|
513
|
-
|
|
523
|
+
function firstLetter(word) {
|
|
524
|
+
return lettersOf(word)[0] ?? "";
|
|
525
|
+
}
|
|
526
|
+
function initialsOf(name, options = {}) {
|
|
527
|
+
const words = (name ?? "").trim().split(/\s+/);
|
|
528
|
+
const letters = words.map(firstLetter).filter(Boolean);
|
|
514
529
|
if (letters.length === 0) return "";
|
|
530
|
+
const upper = (l) => l.toUpperCase().length === l.length ? l.toUpperCase() : l;
|
|
531
|
+
if (letters.length === 1 && options.distinct) {
|
|
532
|
+
const word = words.find((w) => firstLetter(w));
|
|
533
|
+
const second = lettersOf(word)[1];
|
|
534
|
+
return upper(letters[0]) + (second ? second.toLowerCase().length === second.length ? second.toLowerCase() : second : "");
|
|
535
|
+
}
|
|
515
536
|
const pair = letters.length === 1 ? [letters[0]] : [letters[0], letters[letters.length - 1]];
|
|
516
|
-
return pair.map(
|
|
537
|
+
return pair.map(upper).join("");
|
|
517
538
|
}
|
|
518
539
|
function isImageSrc(src) {
|
|
519
540
|
if (!isSafeUrl(src)) return false;
|
|
@@ -661,6 +682,10 @@ function unsettable(field) {
|
|
|
661
682
|
if (facts.sensitive) return "is sensitive";
|
|
662
683
|
return null;
|
|
663
684
|
}
|
|
685
|
+
function sameFormValue(a, b) {
|
|
686
|
+
const text = (v) => v === null || v === void 0 ? "" : Array.isArray(v) ? v.join(",") : String(v);
|
|
687
|
+
return text(a) === text(b);
|
|
688
|
+
}
|
|
664
689
|
function isRecordView(value) {
|
|
665
690
|
return typeof value === "object" && value !== null && value[WORKSPACE] === true;
|
|
666
691
|
}
|
|
@@ -851,6 +876,6 @@ function defineRecordView(view, definition) {
|
|
|
851
876
|
var defineWorkspace = defineRecordView;
|
|
852
877
|
var isWorkspace = isRecordView;
|
|
853
878
|
|
|
854
|
-
export { ViewDefinitionError, calendarProblems, cascadeSelection, defineRecordView, defineView, defineWorkspace, deriveDisplay, filterParams, initialExpanded, initialsOf, isRecordView, isWorkspace, plural, rowPicture, scopeFilter, scopeValues, setExpanded, singular, treeRows, valueText };
|
|
879
|
+
export { ViewDefinitionError, calendarProblems, cascadeSelection, defineRecordView, defineView, defineWorkspace, deriveDisplay, filterParams, initialExpanded, initialsOf, isRecordView, isWorkspace, plural, rowPicture, sameFormValue, scopeFilter, scopeValues, setExpanded, singular, treeRows, valueText };
|
|
855
880
|
//# sourceMappingURL=index.js.map
|
|
856
881
|
//# sourceMappingURL=index.js.map
|