@nivaro/react 0.2.53 → 0.2.55
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/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +99 -98
- package/dist/index.d.ts +452 -4
- package/dist/index.js +644 -618
- package/dist/layout-editor.d.ts +252 -2
- package/dist/shared/components/BackgroundRunOffer.js +117 -0
- package/dist/shared/components/BroadcastView.js +214 -213
- package/dist/shared/components/CollectionBrowserView.js +2592 -2695
- package/dist/shared/components/FormWhatsNew.js +60 -0
- package/dist/shared/components/ItemEditForm.js +3968 -3618
- package/dist/shared/components/JobsTray.js +100 -55
- package/dist/shared/components/MyWorkView.js +91 -89
- package/dist/shared/components/NotificationBell.js +80 -79
- package/dist/shared/components/ProfileView.js +568 -520
- package/dist/shared/components/RecordCompare.js +254 -0
- package/dist/shared/components/RecordReadView.js +598 -543
- package/dist/shared/components/ReportView.js +578 -543
- package/dist/shared/components/RowPresence.js +91 -0
- package/dist/shared/components/TipLayer.js +27 -27
- package/dist/shared/components/WidgetSlot.js +474 -458
- package/dist/shared/components/ai/AiAnalyticsView.js +16 -6
- package/dist/shared/components/ai/AskPanel.js +139 -119
- package/dist/shared/components/ai/FirstWeekCard.js +126 -0
- package/dist/shared/components/bulk/BulkFieldUpdate.js +289 -0
- package/dist/shared/components/bulk/bulk-field-options.js +45 -0
- package/dist/shared/components/charts/CumulativeFlowChart.js +176 -0
- package/dist/shared/components/chat/ChannelArchive.js +326 -0
- package/dist/shared/components/chat/ChannelExtras.js +141 -121
- package/dist/shared/components/chat/ChatAnalyticsView.js +112 -110
- package/dist/shared/components/chat/ChatPanel.js +1695 -1733
- package/dist/shared/components/chat/Composer.js +357 -303
- package/dist/shared/components/chat/MessageActions.js +92 -0
- package/dist/shared/components/chat/MessageFormat.js +290 -264
- package/dist/shared/components/chat/OutboxBubbles.js +146 -0
- package/dist/shared/components/chat/RequestIdCard.js +135 -0
- package/dist/shared/components/chat/RoomHeaderMenu.js +202 -0
- package/dist/shared/components/chat/RoomParts.js +213 -274
- package/dist/shared/components/chat/ScreenClip.js +184 -0
- package/dist/shared/components/chat/chat-core.js +402 -483
- package/dist/shared/components/chat/chat-drafts.js +59 -0
- package/dist/shared/components/chat/chat-emoji.js +348 -0
- package/dist/shared/components/chat/chat-local-time.js +41 -0
- package/dist/shared/components/chat/chat-outbox.js +303 -0
- package/dist/shared/components/chat/chat-window.js +163 -0
- package/dist/shared/components/chat/huddle/HuddleControls.js +143 -0
- package/dist/shared/components/chat/huddle/HuddleStage.js +164 -0
- package/dist/shared/components/chat/huddle/huddle-store.js +342 -0
- package/dist/shared/components/chat/huddle/useHuddle.js +58 -0
- package/dist/shared/components/help-videos/api.js +80 -67
- package/dist/shared/components/help-videos/editor/DetailsTab.js +147 -130
- package/dist/shared/components/item-edit/CatalogPickerField.js +113 -112
- package/dist/shared/components/item-edit/ChangeReasonDialog.js +13 -13
- package/dist/shared/components/item-edit/FieldAffordances.js +9 -8
- package/dist/shared/components/item-edit/FieldRenderer.js +248 -245
- package/dist/shared/components/item-edit/FieldRow.js +382 -320
- package/dist/shared/components/item-edit/FormHelpVideoButton.js +59 -0
- package/dist/shared/components/item-edit/GroupSection.js +786 -639
- package/dist/shared/components/item-edit/HeaderTools.js +59 -56
- package/dist/shared/components/item-edit/InlineTableField.js +3 -1
- package/dist/shared/components/item-edit/LayoutContentBlock.js +47 -24
- package/dist/shared/components/item-edit/RelationCombobox.js +186 -176
- package/dist/shared/components/item-edit/entry/EntryStrip.js +54 -0
- package/dist/shared/components/item-edit/entry/entry-keys.js +27 -0
- package/dist/shared/components/item-edit/entry/useEntryKeyboard.js +70 -0
- package/dist/shared/components/item-edit/entry/useEntryMode.js +59 -0
- package/dist/shared/components/item-edit/form-structure-ui.js +105 -0
- package/dist/shared/components/item-edit/lazy-sections.js +36 -0
- package/dist/shared/components/item-edit/lock-why.js +94 -0
- package/dist/shared/components/item-edit/picker-miss.js +26 -0
- package/dist/shared/components/item-edit/placement-behaviour.js +196 -0
- package/dist/shared/components/item-edit/useFormUsageBeacon.js +65 -0
- package/dist/shared/components/layout-editor/AddPanel.js +226 -151
- package/dist/shared/components/layout-editor/ArrangeButton.js +34 -0
- package/dist/shared/components/layout-editor/AutoArrange.js +86 -0
- package/dist/shared/components/layout-editor/CanvasCompare.js +79 -0
- package/dist/shared/components/layout-editor/ChangeNote.js +147 -0
- package/dist/shared/components/layout-editor/CollabParts.js +175 -0
- package/dist/shared/components/layout-editor/DesignNode.js +311 -116
- package/dist/shared/components/layout-editor/EditorCanvas.js +30 -26
- package/dist/shared/components/layout-editor/EditorTopBar.js +463 -175
- package/dist/shared/components/layout-editor/FindReplace.js +188 -0
- package/dist/shared/components/layout-editor/FormMapButton.js +141 -0
- package/dist/shared/components/layout-editor/HistoryPanel.js +250 -109
- package/dist/shared/components/layout-editor/LayoutEditor.js +1196 -305
- package/dist/shared/components/layout-editor/LayoutsRail.js +94 -67
- package/dist/shared/components/layout-editor/NoteMarker.js +38 -0
- package/dist/shared/components/layout-editor/PlacementsTable.js +187 -0
- package/dist/shared/components/layout-editor/RestorePiece.js +143 -0
- package/dist/shared/components/layout-editor/ScheduleChange.js +106 -0
- package/dist/shared/components/layout-editor/SessionHistory.js +84 -0
- package/dist/shared/components/layout-editor/StagedChip.js +22 -0
- package/dist/shared/components/layout-editor/StructureMenu.js +464 -0
- package/dist/shared/components/layout-editor/UnsavedConfirm.js +103 -0
- package/dist/shared/components/layout-editor/ai/AiToolsButton.js +625 -0
- package/dist/shared/components/layout-editor/ai/ChangeCheck.js +153 -0
- package/dist/shared/components/layout-editor/ai/ai-tools-api.js +80 -0
- package/dist/shared/components/layout-editor/ai/assist-ops.js +38 -0
- package/dist/shared/components/layout-editor/ai/autofill-ops.js +73 -0
- package/dist/shared/components/layout-editor/ai/canvas-capture.js +41 -0
- package/dist/shared/components/layout-editor/ai-forms/AiComposer.js +271 -0
- package/dist/shared/components/layout-editor/ai-forms/AiFormsButton.js +182 -0
- package/dist/shared/components/layout-editor/ai-forms/MeaningSuggestions.js +109 -0
- package/dist/shared/components/layout-editor/ai-forms/SlimPanel.js +170 -0
- package/dist/shared/components/layout-editor/ai-forms/ai-forms-api.js +40 -0
- package/dist/shared/components/layout-editor/ai-forms/pending.js +25 -0
- package/dist/shared/components/layout-editor/ai-forms/plan.js +263 -0
- package/dist/shared/components/layout-editor/ai-rules/AiAskPopover.js +160 -0
- package/dist/shared/components/layout-editor/ai-rules/CascadeWriter.js +175 -0
- package/dist/shared/components/layout-editor/ai-rules/FieldRuleWriter.js +97 -0
- package/dist/shared/components/layout-editor/ai-rules/RuleWriter.js +94 -0
- package/dist/shared/components/layout-editor/ai-rules/ValidationSuggest.js +153 -0
- package/dist/shared/components/layout-editor/ai-rules/api.js +6 -0
- package/dist/shared/components/layout-editor/ai-text/AiTextTools.js +383 -0
- package/dist/shared/components/layout-editor/ai-text/text-ops.js +125 -0
- package/dist/shared/components/layout-editor/assist/AskPanel.js +278 -0
- package/dist/shared/components/layout-editor/assist/ExplainDiff.js +93 -0
- package/dist/shared/components/layout-editor/assist/ProposalsButton.js +150 -0
- package/dist/shared/components/layout-editor/assist/assist-api.js +63 -0
- package/dist/shared/components/layout-editor/assist/jump.js +142 -0
- package/dist/shared/components/layout-editor/assist/settings-index.js +118 -0
- package/dist/shared/components/layout-editor/auto-arrange.js +101 -0
- package/dist/shared/components/layout-editor/bulk/BulkChangesButton.js +221 -0
- package/dist/shared/components/layout-editor/bulk/BulkRun.js +237 -0
- package/dist/shared/components/layout-editor/bulk/MacrosPanel.js +230 -0
- package/dist/shared/components/layout-editor/bulk/bulk-api.js +65 -0
- package/dist/shared/components/layout-editor/bulk/field-labels.js +22 -0
- package/dist/shared/components/layout-editor/bulk/macro-record.js +142 -0
- package/dist/shared/components/layout-editor/bulk/useMacroRecorder.js +65 -0
- package/dist/shared/components/layout-editor/bundle-to-active.js +1 -0
- package/dist/shared/components/layout-editor/canvas-diff.js +157 -0
- package/dist/shared/components/layout-editor/collab/FormFollowShare.js +388 -0
- package/dist/shared/components/layout-editor/collab/collab-api.js +80 -0
- package/dist/shared/components/layout-editor/commands/CommandPalette.js +221 -0
- package/dist/shared/components/layout-editor/commands/intents.js +214 -0
- package/dist/shared/components/layout-editor/commands/parse.js +242 -0
- package/dist/shared/components/layout-editor/design-context.js +26 -6
- package/dist/shared/components/layout-editor/dnd/LayoutDndProvider.js +181 -164
- package/dist/shared/components/layout-editor/dnd/collision.js +25 -23
- package/dist/shared/components/layout-editor/dnd/node.js +69 -57
- package/dist/shared/components/layout-editor/dnd/rail-drop.js +56 -0
- package/dist/shared/components/layout-editor/draft-recovery.js +131 -0
- package/dist/shared/components/layout-editor/editor-notes.js +78 -0
- package/dist/shared/components/layout-editor/editors/swap-config.js +1 -0
- package/dist/shared/components/layout-editor/entry/PlacementPresets.js +149 -0
- package/dist/shared/components/layout-editor/entry/entry-editor-context.js +10 -0
- package/dist/shared/components/layout-editor/entry/presets.js +71 -0
- package/dist/shared/components/layout-editor/entry/tab-order.js +110 -0
- package/dist/shared/components/layout-editor/entry/theme-preview.js +37 -0
- package/dist/shared/components/layout-editor/explain/CanvasRules.js +142 -0
- package/dist/shared/components/layout-editor/explain/default-ghosts.js +81 -0
- package/dist/shared/components/layout-editor/explain/driver-hover.js +62 -0
- package/dist/shared/components/layout-editor/explain/field-sources.js +246 -0
- package/dist/shared/components/layout-editor/explain/rule-graph.js +215 -0
- package/dist/shared/components/layout-editor/explain/use-explain.js +132 -0
- package/dist/shared/components/layout-editor/field-zones.js +116 -0
- package/dist/shared/components/layout-editor/form-map.js +138 -0
- package/dist/shared/components/layout-editor/grid-guides.js +142 -0
- package/dist/shared/components/layout-editor/history-api.js +87 -0
- package/dist/shared/components/layout-editor/inheritance.js +55 -0
- package/dist/shared/components/layout-editor/inspect/inspect-api.js +66 -0
- package/dist/shared/components/layout-editor/inspect/picker-preview.js +48 -0
- package/dist/shared/components/layout-editor/inspect/width-fit.js +87 -0
- package/dist/shared/components/layout-editor/inspector/AiFillSetting.js +85 -0
- package/dist/shared/components/layout-editor/inspector/BehaviourSettings.js +402 -0
- package/dist/shared/components/layout-editor/inspector/Breadcrumb.js +36 -0
- package/dist/shared/components/layout-editor/inspector/BulkInspector.js +179 -0
- package/dist/shared/components/layout-editor/inspector/ColumnFit.js +112 -0
- package/dist/shared/components/layout-editor/inspector/GroupInspector.js +291 -141
- package/dist/shared/components/layout-editor/inspector/HelpTab.js +174 -0
- package/dist/shared/components/layout-editor/inspector/Inspector.js +282 -180
- package/dist/shared/components/layout-editor/inspector/LookTab.js +166 -109
- package/dist/shared/components/layout-editor/inspector/OverrideNotice.js +61 -0
- package/dist/shared/components/layout-editor/inspector/PickerMisses.js +129 -0
- package/dist/shared/components/layout-editor/inspector/PickerPreview.js +134 -0
- package/dist/shared/components/layout-editor/inspector/PickerTab.js +146 -118
- package/dist/shared/components/layout-editor/inspector/RulesTab.js +162 -111
- package/dist/shared/components/layout-editor/inspector/Translations.js +156 -0
- package/dist/shared/components/layout-editor/inspector/kit.js +71 -70
- package/dist/shared/components/layout-editor/inspector/tab-request.js +21 -0
- package/dist/shared/components/layout-editor/is-typing.js +9 -0
- package/dist/shared/components/layout-editor/keyboard-move.js +66 -0
- package/dist/shared/components/layout-editor/lint/LintPanel.js +190 -0
- package/dist/shared/components/layout-editor/lint/lint-api.js +52 -0
- package/dist/shared/components/layout-editor/load-error.js +37 -0
- package/dist/shared/components/layout-editor/matrix/FieldStateMatrix.js +305 -0
- package/dist/shared/components/layout-editor/matrix/MatrixGrid.js +181 -0
- package/dist/shared/components/layout-editor/matrix/RoleSectionMatrix.js +147 -0
- package/dist/shared/components/layout-editor/matrix/matrix-api.js +48 -0
- package/dist/shared/components/layout-editor/matrix/role-matrix.js +36 -0
- package/dist/shared/components/layout-editor/matrix/state-matrix.js +145 -0
- package/dist/shared/components/layout-editor/nav/FindPanel.js +109 -0
- package/dist/shared/components/layout-editor/nav/NavTools.js +114 -0
- package/dist/shared/components/layout-editor/nav/OutlinePanel.js +228 -0
- package/dist/shared/components/layout-editor/nav/ShortcutSheet.js +31 -0
- package/dist/shared/components/layout-editor/nav/find.js +20 -0
- package/dist/shared/components/layout-editor/nav/tree.js +142 -0
- package/dist/shared/components/layout-editor/nav/useEditorNav.js +101 -0
- package/dist/shared/components/layout-editor/nav/view-prefs.js +34 -0
- package/dist/shared/components/layout-editor/ops/ChangeRequestsPanel.js +143 -0
- package/dist/shared/components/layout-editor/ops/DependencyDiagram.js +179 -0
- package/dist/shared/components/layout-editor/ops/LayoutOpsBlocks.js +92 -0
- package/dist/shared/components/layout-editor/ops/PromotePanel.js +287 -0
- package/dist/shared/components/layout-editor/ops/ops-api.js +122 -0
- package/dist/shared/components/layout-editor/outputs/OutputsButton.js +254 -0
- package/dist/shared/components/layout-editor/outputs/help-sheet.js +154 -0
- package/dist/shared/components/layout-editor/outputs/output-api.js +61 -0
- package/dist/shared/components/layout-editor/overview/OverviewActions.js +15 -3
- package/dist/shared/components/layout-editor/overview/describe-conditions.js +24 -14
- package/dist/shared/components/layout-editor/overview/overview-api.js +105 -88
- package/dist/shared/components/layout-editor/overview/purpose.js +15 -13
- package/dist/shared/components/layout-editor/panel-style.js +8 -7
- package/dist/shared/components/layout-editor/parity-keys.json.js +4 -0
- package/dist/shared/components/layout-editor/pin.js +25 -0
- package/dist/shared/components/layout-editor/presence.js +111 -0
- package/dist/shared/components/layout-editor/preview/PreviewModes.js +224 -0
- package/dist/shared/components/layout-editor/preview/PreviewPanes.js +262 -0
- package/dist/shared/components/layout-editor/preview/preview-api.js +57 -0
- package/dist/shared/components/layout-editor/preview/preview-model.js +157 -0
- package/dist/shared/components/layout-editor/restore-piece.js +192 -0
- package/dist/shared/components/layout-editor/reuse/FieldMapStep.js +70 -0
- package/dist/shared/components/layout-editor/reuse/FormMoreMenu.js +127 -0
- package/dist/shared/components/layout-editor/reuse/LibraryRows.js +150 -0
- package/dist/shared/components/layout-editor/reuse/NewFormStart.js +20 -0
- package/dist/shared/components/layout-editor/reuse/SectionReuseActions.js +291 -0
- package/dist/shared/components/layout-editor/reuse/field-match.js +77 -0
- package/dist/shared/components/layout-editor/reuse/reuse-api.js +73 -0
- package/dist/shared/components/layout-editor/reuse/seed.js +13 -0
- package/dist/shared/components/layout-editor/reuse/useFormFromRecord.js +43 -0
- package/dist/shared/components/layout-editor/reuse/useRailCopy.js +34 -0
- package/dist/shared/components/layout-editor/section-structure.js +241 -0
- package/dist/shared/components/layout-editor/settings/EntrySection.js +296 -0
- package/dist/shared/components/layout-editor/settings/FormSettings.js +125 -103
- package/dist/shared/components/layout-editor/settings/InheritanceSection.js +1 -1
- package/dist/shared/components/layout-editor/settings/ResolveSettings.js +255 -0
- package/dist/shared/components/layout-editor/settings/ToolsSection.js +215 -105
- package/dist/shared/components/layout-editor/settings/WhoSection.js +139 -100
- package/dist/shared/components/layout-editor/settings/controls.js +8 -8
- package/dist/shared/components/layout-editor/settings/settings-registry.js +142 -21
- package/dist/shared/components/layout-editor/shortcuts.js +88 -0
- package/dist/shared/components/layout-editor/show-when.js +35 -0
- package/dist/shared/components/layout-editor/slot-names.js +4 -3
- package/dist/shared/components/layout-editor/staged-api.js +64 -0
- package/dist/shared/components/layout-editor/structure-ops.js +403 -0
- package/dist/shared/components/layout-editor/testing/CostLimitSetting.js +42 -0
- package/dist/shared/components/layout-editor/testing/TestingPanels.js +556 -0
- package/dist/shared/components/layout-editor/testing/testing-api.js +67 -0
- package/dist/shared/components/layout-editor/testing/testing-model.js +406 -0
- package/dist/shared/components/layout-editor/testing/use-record-check.js +44 -0
- package/dist/shared/components/layout-editor/toolbar-kit.js +242 -0
- package/dist/shared/components/layout-editor/unsaved-marks.js +72 -0
- package/dist/shared/components/layout-editor/usage/AbTestSection.js +355 -0
- package/dist/shared/components/layout-editor/usage/FillChip.js +27 -0
- package/dist/shared/components/layout-editor/usage/UsagePanel.js +232 -0
- package/dist/shared/components/layout-editor/usage/ab-api.js +86 -0
- package/dist/shared/components/layout-editor/usage/suggest-collapse.js +32 -0
- package/dist/shared/components/layout-editor/usage/suggest-sections.js +55 -0
- package/dist/shared/components/layout-editor/usage/usage-api.js +104 -0
- package/dist/shared/components/layout-editor/useLayoutDraft.js +573 -306
- package/dist/shared/components/notifications/NotificationAnalyticsView.js +148 -77
- package/dist/shared/components/panels/ErpFailureBanner.js +18 -17
- package/dist/shared/components/panels/ExternalRequestsChip.js +63 -62
- package/dist/shared/components/pipeline/PipelineEditorView.js +106 -104
- package/dist/shared/components/profile/AgentsPanel.js +479 -0
- package/dist/shared/components/queue/QueueWorklist.js +1026 -1040
- package/dist/shared/components/support/SuggestFormChange.js +143 -0
- package/dist/shared/components/support/SupportAnalytics.js +171 -0
- package/dist/shared/components/support/SupportView.js +75 -73
- package/dist/shared/lib/ai-fill.js +37 -0
- package/dist/shared/lib/background-runs.js +150 -0
- package/dist/shared/lib/delivery-ack.js +9 -0
- package/dist/shared/lib/entry-badge-style.js +13 -0
- package/dist/shared/lib/entry-config.js +71 -0
- package/dist/shared/lib/form-sections.js +64 -0
- package/dist/shared/lib/form-structure.js +99 -0
- package/dist/shared/lib/form-usage-beacon.js +133 -0
- package/dist/shared/lib/jobs-tray.js +25 -23
- package/dist/shared/lib/keyset-pager.js +37 -0
- package/dist/shared/lib/layout-i18n.js +66 -0
- package/dist/shared/lib/layout-lint.js +490 -0
- package/dist/shared/lib/layout-ops.js +116 -110
- package/dist/shared/lib/layout-resolve.js +113 -0
- package/dist/shared/lib/placement-behaviour.js +144 -0
- package/dist/shared/lib/prefetch.js +149 -0
- package/dist/shared/lib/presence-hooks.js +199 -0
- package/dist/shared/lib/record-outbox.js +82 -81
- package/dist/shared/lib/replay-socket.js +93 -0
- package/dist/shared/lib/request-gate.js +51 -50
- package/dist/shared/lib/room-gaps.js +96 -0
- package/dist/shared/lib/screenshot.js +54 -28
- package/dist/shared/lib/search-log.js +27 -0
- package/dist/shared/lib/socket-realtime.js +101 -80
- package/dist/shared/lib/visible-when.js +34 -0
- package/dist/shared/lib/worker-socket.js +200 -0
- package/package.json +1 -1
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { HEADER_GROUP_KEY as h, TABLE_FORM_GROUP_KEYS as _, UNGROUPED_KEY as k, isCanvasSlot as d, applyLayoutOps as O } from "../../lib/layout-ops.js";
|
|
2
|
+
import { titleCase as b } from "../../lib/utils.js";
|
|
3
|
+
import { isMultiSelectable as E } from "./design-context.js";
|
|
4
|
+
import { withOverride as v, readOverrides as S } from "./inspector/model.js";
|
|
5
|
+
function y(e) {
|
|
6
|
+
try {
|
|
7
|
+
return O(e, [{ op: "layout_update", patch: {} }]);
|
|
8
|
+
} catch {
|
|
9
|
+
return e;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
const c = (e) => [...e].sort((t, o) => t.sort - o.sort), m = /* @__PURE__ */ new Set(["section", "tab", "metadata"]), f = (e) => e.label || b(e.key);
|
|
13
|
+
function R(e) {
|
|
14
|
+
const t = y(e);
|
|
15
|
+
if (t.layout.layout_type === "table")
|
|
16
|
+
return [
|
|
17
|
+
{ key: null, label: "Columns" },
|
|
18
|
+
{ key: _[0], label: "Apply values" },
|
|
19
|
+
{ key: _[1], label: "Create with defaults" }
|
|
20
|
+
];
|
|
21
|
+
const o = t.groups.some((n) => n.key === k) || t.placements.some((n) => n.group_key === null && !d(n)), l = [], u = c(t.groups.filter((n) => n.parent_key === null));
|
|
22
|
+
for (const n of u) {
|
|
23
|
+
if (n.key === k) {
|
|
24
|
+
l.push({ key: null, label: "Ungrouped" });
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
if (m.has(n.type)) l.push({ key: n.key, label: f(n) });
|
|
28
|
+
else if (n.type === "container")
|
|
29
|
+
for (const s of c(t.groups.filter((i) => i.parent_key === n.key)))
|
|
30
|
+
m.has(s.type) && l.push({ key: s.key, label: `${f(n)} › ${f(s)}` });
|
|
31
|
+
}
|
|
32
|
+
return o && !l.some((n) => n.key === null) && l.push({ key: null, label: "Ungrouped" }), l;
|
|
33
|
+
}
|
|
34
|
+
function D(e, t) {
|
|
35
|
+
return c(e.placements.filter((o) => o.group_key === t && !d(o)));
|
|
36
|
+
}
|
|
37
|
+
const a = (e) => ({
|
|
38
|
+
field: e.field,
|
|
39
|
+
group_key: e.group_key
|
|
40
|
+
}), L = (e, t) => e.field === t.field && e.group_key === t.group_key;
|
|
41
|
+
function F(e, t) {
|
|
42
|
+
const o = [];
|
|
43
|
+
for (const l of t) {
|
|
44
|
+
if (!E(l) || l.kind !== "field" && l.kind !== "slot") continue;
|
|
45
|
+
const u = e.placements.find((n) => n.field === l.field && n.group_key === l.group_key);
|
|
46
|
+
u && !o.includes(u) && o.push(u);
|
|
47
|
+
}
|
|
48
|
+
return o;
|
|
49
|
+
}
|
|
50
|
+
function U(e, t) {
|
|
51
|
+
const o = y(e), l = R(o).map((n) => n.key), u = (n) => {
|
|
52
|
+
const s = o.placements.find((p) => L(p, n)), i = l.indexOf(n.group_key);
|
|
53
|
+
return [i < 0 ? l.length : i, (s == null ? void 0 : s.sort) ?? 0];
|
|
54
|
+
};
|
|
55
|
+
return [...t].sort((n, s) => {
|
|
56
|
+
const [i, p] = u(n), [r, g] = u(s);
|
|
57
|
+
return i - r || p - g;
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
const z = [12, 6, 4, 3], G = { 12: "Full", 6: "½", 4: "⅓", 3: "¼" };
|
|
61
|
+
function w(e) {
|
|
62
|
+
return z.includes(e.col_span ?? 12) ? e.col_span ?? 12 : 12;
|
|
63
|
+
}
|
|
64
|
+
const I = (e) => e === 12 ? null : e, K = (e) => !e.field.startsWith("__"), P = (e, t) => S(e)[t] === !0;
|
|
65
|
+
function H(e, t) {
|
|
66
|
+
return e.filter((o) => w(o) !== t || t === 12 && o.col_span != null).map((o) => ({ op: "update_placement", at: a(o), patch: { col_span: I(t) } }));
|
|
67
|
+
}
|
|
68
|
+
function T(e, t, o) {
|
|
69
|
+
return e.filter((l) => (t === "hidden" || K(l)) && P(l, t) !== o).map((l) => ({
|
|
70
|
+
op: "update_placement",
|
|
71
|
+
at: a(l),
|
|
72
|
+
patch: { overrides: v(l, t, o ? !0 : void 0) }
|
|
73
|
+
}));
|
|
74
|
+
}
|
|
75
|
+
function x(e, t, o) {
|
|
76
|
+
const l = y(e), u = [], n = [];
|
|
77
|
+
let s = 0, i = D(l, o).length;
|
|
78
|
+
const p = new Set(l.placements.filter((r) => r.group_key === o).map((r) => r.field));
|
|
79
|
+
for (const r of U(l, t)) {
|
|
80
|
+
if (r.group_key === o || p.has(r.field) || d({ field: r.field, group_key: o })) {
|
|
81
|
+
s++, r.group_key === o && n.push(a(r));
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
u.push({ op: "move", from: a(r), to_group_key: o, index: i++ }), p.add(r.field), n.push({ field: r.field, group_key: o });
|
|
85
|
+
}
|
|
86
|
+
return { ops: u, moved: n, skipped: s };
|
|
87
|
+
}
|
|
88
|
+
function B(e) {
|
|
89
|
+
return e.group_key === h ? { kind: "header", field: e.field } : {
|
|
90
|
+
kind: e.field.startsWith("__") ? "slot" : "field",
|
|
91
|
+
field: e.field,
|
|
92
|
+
group_key: e.group_key
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
const Y = (e, t, o = `${t}s`) => `${e} ${e === 1 ? t : o}`;
|
|
96
|
+
export {
|
|
97
|
+
m as FIELD_HOLDERS,
|
|
98
|
+
z as GRID_WIDTHS,
|
|
99
|
+
G as WIDTH_LABELS,
|
|
100
|
+
R as fieldZones,
|
|
101
|
+
P as flagOn,
|
|
102
|
+
T as flagOps,
|
|
103
|
+
U as inPageOrder,
|
|
104
|
+
K as isFieldRow,
|
|
105
|
+
a as keyOf,
|
|
106
|
+
x as moveToZoneOps,
|
|
107
|
+
y as normalizedBundle,
|
|
108
|
+
Y as plural,
|
|
109
|
+
L as sameKey,
|
|
110
|
+
F as selectedPlacements,
|
|
111
|
+
I as storedWidth,
|
|
112
|
+
B as targetOfKey,
|
|
113
|
+
w as widthOf,
|
|
114
|
+
H as widthOps,
|
|
115
|
+
D as zoneItems
|
|
116
|
+
};
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { UNGROUPED_KEY as g, HEADER_GROUP_KEY as L } from "../../lib/layout-ops.js";
|
|
2
|
+
import { titleCase as x } from "../../lib/utils.js";
|
|
3
|
+
import { asObject as k } from "./inspector/model.js";
|
|
4
|
+
import { describeShowWhen as C, orList as N, safeParse as D } from "./show-when.js";
|
|
5
|
+
import { slotName as G } from "./slot-names.js";
|
|
6
|
+
const K = { 3: "Quarter", 4: "Third", 6: "Half", 12: "Full" };
|
|
7
|
+
function j(o) {
|
|
8
|
+
if (Array.isArray(o)) return o.map(String);
|
|
9
|
+
if (typeof o != "string" || !o) return [];
|
|
10
|
+
try {
|
|
11
|
+
const r = JSON.parse(o);
|
|
12
|
+
return Array.isArray(r) ? r.map(String) : [];
|
|
13
|
+
} catch {
|
|
14
|
+
return [];
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
const A = (o) => o.length <= 1 ? o[0] ?? "" : `${o.slice(0, -1).join(", ")} and ${o[o.length - 1]}`;
|
|
18
|
+
function I(o, r) {
|
|
19
|
+
return o.type === "tab" ? (r == null ? void 0 : r.tab_mode) === "steps" ? "Step" : "Tab" : o.type === "container" ? o.tab_mode === "steps" ? "Steps" : "Tabs" : o.type === "content" ? "Text block" : o.type === "metadata" ? "Record info" : "Section";
|
|
20
|
+
}
|
|
21
|
+
function ee(o) {
|
|
22
|
+
var v;
|
|
23
|
+
const { bundle: r, fields: n } = o, d = new Map(n.map((e) => [e.field, e])), p = new Map(o.roles.map((e) => [e.id.toUpperCase(), e.name])), a = (e) => e.map((t) => p.get(t.toUpperCase()) ?? t), b = o.choiceLabels ?? {}, h = { groups: 0, fields: 0, required: 0 }, F = (e) => {
|
|
24
|
+
var R, z;
|
|
25
|
+
const t = d.get(e.field), s = k(e.overrides), c = k(s.options), i = e.field.startsWith("__"), T = typeof s.label == "string" && s.label || e.label_override || (i ? G(e.field) : (t == null ? void 0 : t.label) || x(e.field.split(".").pop() ?? e.field)), U = Number(e.col_span ?? c.col_span ?? k(t == null ? void 0 : t.options).col_span ?? 12), q = !i && (s.required !== void 0 ? !!s.required : !!(t != null && t.required)), E = !i && (s.readonly !== void 0 ? !!s.readonly : !!(t != null && t.readonly)), f = [];
|
|
26
|
+
(!e.is_visible || s.hidden === !0) && f.push("Hidden on this form");
|
|
27
|
+
for (const u of P(e.lock_conditions))
|
|
28
|
+
u.type === "role" && ((R = u.role_ids) != null && R.length) && f.push(`Locked for ${N(a(u.role_ids))}`), u.type === "pipeline_state" && ((z = u.state_keys) != null && z.length) && f.push(`Locked in ${N(u.state_keys.map((W) => x(W)))}`);
|
|
29
|
+
return e.field.includes(".") && !i && f.push("Shows a value from a linked record"), h.fields += i ? 0 : 1, q && (h.required += 1), {
|
|
30
|
+
field: e.field,
|
|
31
|
+
label: T,
|
|
32
|
+
width: K[U] ?? "Full",
|
|
33
|
+
required: q,
|
|
34
|
+
readOnly: E,
|
|
35
|
+
rules: f
|
|
36
|
+
};
|
|
37
|
+
}, m = (e) => r.placements.filter((t) => t.group_key === e).slice().sort((t, s) => t.sort - s.sort).map(F), H = (e) => {
|
|
38
|
+
const t = [], s = C(e.visible_when, n, b);
|
|
39
|
+
s && t.push(`Shows only when ${s}`);
|
|
40
|
+
const c = a(j(e.hidden_for_roles));
|
|
41
|
+
c.length && t.push(`Hidden from ${A(c)}`);
|
|
42
|
+
const i = a(j(e.locked_for_roles));
|
|
43
|
+
return i.length && t.push(`Read-only for ${A(i)}`), e.is_collapsed && t.push("Starts folded"), t;
|
|
44
|
+
}, y = r.groups.filter((e) => e.key !== g && e.key !== L), $ = new Map(y.map((e) => [e.key, e])), w = (e) => {
|
|
45
|
+
h.groups += 1;
|
|
46
|
+
const t = e.parent_key ? $.get(e.parent_key) ?? null : null;
|
|
47
|
+
return {
|
|
48
|
+
key: e.key,
|
|
49
|
+
label: e.label || x(e.key),
|
|
50
|
+
kind: I(e, t),
|
|
51
|
+
rules: H(e),
|
|
52
|
+
fields: m(e.key),
|
|
53
|
+
children: y.filter((s) => s.parent_key === e.key).sort((s, c) => s.sort - c.sort).map(w)
|
|
54
|
+
};
|
|
55
|
+
}, M = ((v = r.groups.find((e) => e.key === g)) == null ? void 0 : v.sort) ?? 0, S = y.filter((e) => !e.parent_key || !$.has(e.parent_key)).map((e) => ({ sort: e.sort, build: () => w(e) }));
|
|
56
|
+
S.push({
|
|
57
|
+
sort: M,
|
|
58
|
+
build: () => {
|
|
59
|
+
const e = m(null).filter((t) => t.field !== "__subtitle__");
|
|
60
|
+
return e.length ? {
|
|
61
|
+
key: g,
|
|
62
|
+
label: "Not in a section",
|
|
63
|
+
kind: "Fields",
|
|
64
|
+
rules: [],
|
|
65
|
+
fields: e,
|
|
66
|
+
children: []
|
|
67
|
+
} : null;
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
const O = S.sort((e, t) => e.sort - t.sort).map((e) => e.build()).filter((e) => e !== null);
|
|
71
|
+
return {
|
|
72
|
+
layoutName: String(r.layout.name ?? ""),
|
|
73
|
+
collectionLabel: o.collectionLabel,
|
|
74
|
+
header: m(L),
|
|
75
|
+
groups: O,
|
|
76
|
+
counts: h
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
function P(o) {
|
|
80
|
+
const r = typeof o == "string" ? D(o) : o;
|
|
81
|
+
return Array.isArray(r) ? r : [];
|
|
82
|
+
}
|
|
83
|
+
const l = (o) => String(o ?? "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """), Y = `
|
|
84
|
+
:root { color-scheme: light; }
|
|
85
|
+
* { box-sizing: border-box; }
|
|
86
|
+
body { margin: 0; padding: 32px 40px; background: #fff; color: #0f172a;
|
|
87
|
+
font: 13px/1.45 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
|
|
88
|
+
header { border-bottom: 2px solid #0f172a; padding-bottom: 12px; margin-bottom: 20px; }
|
|
89
|
+
h1 { font-size: 22px; margin: 0 0 2px; }
|
|
90
|
+
.sub { color: #475569; margin: 0; }
|
|
91
|
+
.legend { color: #475569; font-size: 11.5px; margin-top: 8px; }
|
|
92
|
+
section.g { border: 1px solid #cbd5e1; border-radius: 6px; margin: 0 0 14px; break-inside: avoid; }
|
|
93
|
+
section.g section.g { margin: 10px 12px; }
|
|
94
|
+
.gh { display: flex; gap: 8px; align-items: baseline; padding: 8px 12px; background: #f1f5f9;
|
|
95
|
+
border-bottom: 1px solid #cbd5e1; border-radius: 6px 6px 0 0; }
|
|
96
|
+
.kind { font-size: 11px; color: #475569; }
|
|
97
|
+
.gl { font-weight: 600; font-size: 14px; }
|
|
98
|
+
.rules { margin: 6px 12px 0; padding: 0; list-style: none; color: #92400e; font-size: 12px; }
|
|
99
|
+
table { width: 100%; border-collapse: collapse; margin: 6px 0 8px; }
|
|
100
|
+
th, td { text-align: left; padding: 4px 12px; border-top: 1px solid #e2e8f0; vertical-align: top; }
|
|
101
|
+
th { font-size: 11px; font-weight: 600; color: #475569; border-top: 0; }
|
|
102
|
+
td.w { width: 70px; color: #475569; }
|
|
103
|
+
td.m { width: 90px; }
|
|
104
|
+
.req { color: #b91c1c; font-weight: 600; }
|
|
105
|
+
.ro { color: #475569; }
|
|
106
|
+
.rule { color: #92400e; font-size: 12px; }
|
|
107
|
+
.key { color: #94a3b8; font-size: 11px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
|
|
108
|
+
footer { margin-top: 24px; color: #64748b; font-size: 11px; }
|
|
109
|
+
@page { margin: 14mm; }
|
|
110
|
+
@media print { body { padding: 0; } }
|
|
111
|
+
`;
|
|
112
|
+
function B(o) {
|
|
113
|
+
return o.length ? `<table><thead><tr><th>Field</th><th>Width</th><th>Marks</th></tr></thead><tbody>${o.map((n) => {
|
|
114
|
+
const d = [
|
|
115
|
+
n.required ? '<span class="req">Required</span>' : "",
|
|
116
|
+
n.readOnly ? '<span class="ro">Read-only</span>' : ""
|
|
117
|
+
].filter(Boolean).join(" · "), p = n.rules.map((a) => `<div class="rule">${l(a)}</div>`).join("");
|
|
118
|
+
return `<tr><td>${l(n.label)}<div class="key">${l(n.field)}</div>${p}</td><td class="w">${l(n.width)}</td><td class="m">${d}</td></tr>`;
|
|
119
|
+
}).join("")}</tbody></table>` : "";
|
|
120
|
+
}
|
|
121
|
+
function _(o) {
|
|
122
|
+
const r = o.rules.length ? `<ul class="rules">${o.rules.map((n) => `<li>${l(n)}</li>`).join("")}</ul>` : "";
|
|
123
|
+
return `<section class="g"><div class="gh"><span class="kind">${l(o.kind)}</span><span class="gl">${l(o.label)}</span></div>${r}${B(o.fields)}${o.children.map(_).join("")}</section>`;
|
|
124
|
+
}
|
|
125
|
+
function oe(o, r = /* @__PURE__ */ new Date()) {
|
|
126
|
+
const n = `${o.layoutName} — form map`, { groups: d, fields: p, required: a } = o.counts, b = o.header.length ? _({
|
|
127
|
+
label: "Header strip",
|
|
128
|
+
kind: "Top of the record",
|
|
129
|
+
rules: [],
|
|
130
|
+
fields: o.header,
|
|
131
|
+
children: []
|
|
132
|
+
}) : "";
|
|
133
|
+
return `<!doctype html><html lang="en"><head><meta charset="utf-8"><title>${l(n)}</title><style>${Y}</style></head><body><header><h1>${l(o.layoutName)}</h1><p class="sub">${l(o.collectionLabel)} form · ${d} ${d === 1 ? "part" : "parts"} · ${p} ${p === 1 ? "field" : "fields"} · ${a} required</p><p class="legend">Widths are the share of a row a field takes on a wide screen. Rules are shown under the field or section they apply to.</p></header>${b}${o.groups.map(_).join("")}<footer>Generated ${l(r.toLocaleString())}</footer></body></html>`;
|
|
134
|
+
}
|
|
135
|
+
export {
|
|
136
|
+
ee as buildFormMap,
|
|
137
|
+
oe as formMapHtml
|
|
138
|
+
};
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { jsxs as x, Fragment as M, jsx as d } from "react/jsx-runtime";
|
|
2
|
+
import { useContext as E, useRef as C, useState as S, useLayoutEffect as T, useEffect as k, useSyncExternalStore as O } from "react";
|
|
3
|
+
import { cn as L } from "../../lib/utils.js";
|
|
4
|
+
import { useLayoutDesign as j } from "./design-context.js";
|
|
5
|
+
import { DndStoreContext as N } from "./dnd/node.js";
|
|
6
|
+
import { WIDTH_LABELS as D, GRID_WIDTHS as R } from "./field-zones.js";
|
|
7
|
+
const B = () => () => {
|
|
8
|
+
};
|
|
9
|
+
function H() {
|
|
10
|
+
const t = E(N);
|
|
11
|
+
return O(
|
|
12
|
+
(t == null ? void 0 : t.subscribe) ?? B,
|
|
13
|
+
() => !!(t != null && t.guidesOn()),
|
|
14
|
+
() => !1
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
function J({ gapClass: t = "gap-x-4" }) {
|
|
18
|
+
const r = j(), i = H();
|
|
19
|
+
return !r || !i ? null : /* @__PURE__ */ d(
|
|
20
|
+
"div",
|
|
21
|
+
{
|
|
22
|
+
"aria-hidden": !0,
|
|
23
|
+
"data-design-grid-guides": "",
|
|
24
|
+
className: L("pointer-events-none absolute inset-0 grid grid-cols-12", t),
|
|
25
|
+
children: Array.from({ length: 12 }, (a, l) => /* @__PURE__ */ d(
|
|
26
|
+
"div",
|
|
27
|
+
{
|
|
28
|
+
className: "rounded-sm bg-nvr-cyan/[0.05] ring-1 ring-inset ring-nvr-cyan/10 dark:bg-nvr-cyan/[0.06] dark:ring-nvr-cyan/15"
|
|
29
|
+
},
|
|
30
|
+
l
|
|
31
|
+
))
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
function W(t, r, i) {
|
|
36
|
+
const a = (r - 11 * i) / 12;
|
|
37
|
+
if (!(a > 0)) return 12;
|
|
38
|
+
const l = (t + i) / (a + i);
|
|
39
|
+
let c = 12;
|
|
40
|
+
for (const o of R) Math.abs(o - l) < Math.abs(c - l) && (c = o);
|
|
41
|
+
return c;
|
|
42
|
+
}
|
|
43
|
+
const h = [...R].sort((t, r) => t - r), P = (t) => {
|
|
44
|
+
const r = /span\s+(\d+)/.exec(t.style.gridColumn);
|
|
45
|
+
return r ? Number(r[1]) : 12;
|
|
46
|
+
}, _ = (t) => !!t && getComputedStyle(t).display === "grid" && getComputedStyle(t).gridTemplateColumns.trim().split(/\s+/).length === 12;
|
|
47
|
+
function Q({ onCommit: t }) {
|
|
48
|
+
const r = E(N), i = C(null), a = C(null), [l, c] = S(!1), [o, g] = S(null), p = () => {
|
|
49
|
+
var e;
|
|
50
|
+
return ((e = i.current) == null ? void 0 : e.closest("[data-design-target]")) ?? null;
|
|
51
|
+
};
|
|
52
|
+
T(() => {
|
|
53
|
+
var e;
|
|
54
|
+
c(_(((e = p()) == null ? void 0 : e.parentElement) ?? null));
|
|
55
|
+
}, []);
|
|
56
|
+
const u = (e) => {
|
|
57
|
+
const n = a.current;
|
|
58
|
+
n && (a.current = null, n.cell.style.gridColumn = n.original, r == null || r.setResizing(!1), g(null), e && n.span !== n.start && t(n.span));
|
|
59
|
+
};
|
|
60
|
+
k(() => {
|
|
61
|
+
if (o === null) return;
|
|
62
|
+
const e = (n) => {
|
|
63
|
+
n.key === "Escape" && (n.preventDefault(), n.stopPropagation(), u(!1));
|
|
64
|
+
};
|
|
65
|
+
return window.addEventListener("keydown", e, !0), () => window.removeEventListener("keydown", e, !0);
|
|
66
|
+
}), k(() => () => u(!1), []);
|
|
67
|
+
const y = p(), f = y ? P(y) : 12, z = (e) => {
|
|
68
|
+
var b, w;
|
|
69
|
+
const n = p(), s = n == null ? void 0 : n.parentElement;
|
|
70
|
+
if (!n || !s || e.button !== 0) return;
|
|
71
|
+
e.preventDefault(), e.stopPropagation(), (w = (b = e.currentTarget).setPointerCapture) == null || w.call(b, e.pointerId);
|
|
72
|
+
const I = getComputedStyle(s), v = P(n);
|
|
73
|
+
a.current = {
|
|
74
|
+
cell: n,
|
|
75
|
+
left: n.getBoundingClientRect().left,
|
|
76
|
+
width: s.getBoundingClientRect().width,
|
|
77
|
+
gap: Number.parseFloat(I.columnGap) || 0,
|
|
78
|
+
start: v,
|
|
79
|
+
span: v,
|
|
80
|
+
original: n.style.gridColumn
|
|
81
|
+
}, r == null || r.setResizing(!0), g(v);
|
|
82
|
+
}, A = (e) => {
|
|
83
|
+
const n = a.current;
|
|
84
|
+
if (!n) return;
|
|
85
|
+
const s = W(e.clientX - n.left, n.width, n.gap);
|
|
86
|
+
s !== n.span && (n.span = s, n.cell.style.gridColumn = `span ${s}`, g(s));
|
|
87
|
+
}, G = (e) => {
|
|
88
|
+
if (e.key !== "ArrowLeft" && e.key !== "ArrowRight") return;
|
|
89
|
+
e.preventDefault(), e.stopPropagation();
|
|
90
|
+
const n = h.indexOf(f), s = h[Math.max(0, Math.min(h.length - 1, n + (e.key === "ArrowRight" ? 1 : -1)))];
|
|
91
|
+
s !== void 0 && s !== f && t(s);
|
|
92
|
+
}, m = o ?? f;
|
|
93
|
+
return /* @__PURE__ */ x(M, { children: [
|
|
94
|
+
/* @__PURE__ */ x(
|
|
95
|
+
"span",
|
|
96
|
+
{
|
|
97
|
+
ref: i,
|
|
98
|
+
role: "slider",
|
|
99
|
+
tabIndex: 0,
|
|
100
|
+
"aria-label": "Width",
|
|
101
|
+
"aria-valuemin": 3,
|
|
102
|
+
"aria-valuemax": 12,
|
|
103
|
+
"aria-valuenow": m,
|
|
104
|
+
"aria-valuetext": D[m] ?? `${m} of 12 columns`,
|
|
105
|
+
"data-design-resize": "",
|
|
106
|
+
"data-design-pass": "",
|
|
107
|
+
"data-tip": o === null ? "Drag to change the width" : void 0,
|
|
108
|
+
onPointerDown: z,
|
|
109
|
+
onPointerMove: A,
|
|
110
|
+
onPointerUp: () => u(!0),
|
|
111
|
+
onPointerCancel: () => u(!1),
|
|
112
|
+
onLostPointerCapture: () => u(!0),
|
|
113
|
+
onKeyDown: G,
|
|
114
|
+
onClick: (e) => e.stopPropagation(),
|
|
115
|
+
className: L(
|
|
116
|
+
"absolute -right-[7px] top-1/2 z-20 flex h-7 w-3 -translate-y-1/2 cursor-col-resize items-center justify-center gap-[2px] rounded-sm bg-white ring-1 ring-nvr-cyan transition-colors hover:bg-nvr-cyan/10 focus-visible:outline focus-visible:outline-2 focus-visible:outline-nvr-cyan dark:bg-card motion-reduce:transition-none",
|
|
117
|
+
o !== null && "bg-nvr-cyan/10",
|
|
118
|
+
!l && "hidden"
|
|
119
|
+
),
|
|
120
|
+
children: [
|
|
121
|
+
/* @__PURE__ */ d("span", { className: "h-3 w-px bg-nvr-cyan" }),
|
|
122
|
+
/* @__PURE__ */ d("span", { className: "h-3 w-px bg-nvr-cyan" })
|
|
123
|
+
]
|
|
124
|
+
}
|
|
125
|
+
),
|
|
126
|
+
o !== null && /* @__PURE__ */ d(
|
|
127
|
+
"span",
|
|
128
|
+
{
|
|
129
|
+
"aria-hidden": !0,
|
|
130
|
+
"data-design-resize-chip": "",
|
|
131
|
+
className: "pointer-events-none absolute -top-2.5 right-3 z-20 rounded bg-nvr-cyan px-1.5 text-[11px] font-medium leading-5 text-white",
|
|
132
|
+
children: D[o] ?? o
|
|
133
|
+
}
|
|
134
|
+
)
|
|
135
|
+
] });
|
|
136
|
+
}
|
|
137
|
+
export {
|
|
138
|
+
J as GridGuides,
|
|
139
|
+
Q as ResizeHandle,
|
|
140
|
+
W as snapSpan,
|
|
141
|
+
H as useGridGuides
|
|
142
|
+
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { useQuery as h, useQueryClient as y, useMutation as i } from "@tanstack/react-query";
|
|
2
|
+
import { useNivaroClient as a } from "../../context.js";
|
|
3
|
+
import { get as l, patch as m, post as f, del as g } from "../../lib/commands.js";
|
|
4
|
+
import { layoutDraftKeys as q, parseBundle as p } from "./useLayoutDraft.js";
|
|
5
|
+
const d = {
|
|
6
|
+
// Under the versions key: every save (which refreshes versions) refreshes these too.
|
|
7
|
+
sectionChanges: (e) => [...q.versions(e), "section-changes"],
|
|
8
|
+
schedules: (e) => ["layout-editor", "schedules", e]
|
|
9
|
+
};
|
|
10
|
+
async function v(e, t, s) {
|
|
11
|
+
var c;
|
|
12
|
+
const n = await e.request(
|
|
13
|
+
l(`/collection-layouts/${t}/versions/${s}/bundle`)
|
|
14
|
+
), u = p((c = n == null ? void 0 : n.data) == null ? void 0 : c.bundle);
|
|
15
|
+
if (!u) throw new Error("That version could not be read");
|
|
16
|
+
return u;
|
|
17
|
+
}
|
|
18
|
+
function C(e, t) {
|
|
19
|
+
const s = a();
|
|
20
|
+
return h({
|
|
21
|
+
queryKey: d.sectionChanges(e),
|
|
22
|
+
queryFn: () => s.request(
|
|
23
|
+
l(`/collection-layouts/${e}/section-changes`)
|
|
24
|
+
).then((n) => (n == null ? void 0 : n.data) ?? {}),
|
|
25
|
+
enabled: t,
|
|
26
|
+
staleTime: 6e4
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
function K(e, t = !0) {
|
|
30
|
+
const s = a();
|
|
31
|
+
return h({
|
|
32
|
+
queryKey: d.schedules(e),
|
|
33
|
+
queryFn: () => s.request(l("/collection-layouts/schedules", { collection: e })).then((n) => (n == null ? void 0 : n.data) ?? []),
|
|
34
|
+
enabled: t,
|
|
35
|
+
staleTime: 3e4
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
function _(e) {
|
|
39
|
+
const t = a(), s = y(), n = () => s.invalidateQueries({ queryKey: d.schedules(e) }), u = i({
|
|
40
|
+
mutationFn: (o) => t.request(
|
|
41
|
+
f(`/collection-layouts/${o.layoutId}/schedules`, {
|
|
42
|
+
ops: o.ops,
|
|
43
|
+
base_rev: o.base_rev,
|
|
44
|
+
run_at: o.run_at,
|
|
45
|
+
note: o.note || void 0
|
|
46
|
+
})
|
|
47
|
+
),
|
|
48
|
+
onSuccess: n
|
|
49
|
+
}), c = i({
|
|
50
|
+
mutationFn: (o) => t.request(g(`/collection-layouts/schedules/${o}`)),
|
|
51
|
+
onSettled: n
|
|
52
|
+
}), r = i({
|
|
53
|
+
mutationFn: (o) => t.request(m(`/collection-layouts/schedules/${o.id}`, { run_at: o.run_at })),
|
|
54
|
+
onSettled: n
|
|
55
|
+
});
|
|
56
|
+
return { create: u, cancel: c, reschedule: r };
|
|
57
|
+
}
|
|
58
|
+
function N(e) {
|
|
59
|
+
const t = a(), s = y(), n = () => s.invalidateQueries({ queryKey: q.versions(e) }), u = i({
|
|
60
|
+
mutationFn: (r) => t.request(
|
|
61
|
+
m(`/collection-layouts/${e}/versions/${r.versionId}`, { name: r.name })
|
|
62
|
+
),
|
|
63
|
+
onSuccess: n
|
|
64
|
+
}), c = i({
|
|
65
|
+
mutationFn: (r) => t.request(f(`/collection-layouts/${e}/versions/name`, { name: r })),
|
|
66
|
+
onSuccess: n
|
|
67
|
+
});
|
|
68
|
+
return { nameVersion: u, nameCurrent: c };
|
|
69
|
+
}
|
|
70
|
+
function T(e) {
|
|
71
|
+
const t = (s) => String(s).padStart(2, "0");
|
|
72
|
+
return `${e.getFullYear()}-${t(e.getMonth() + 1)}-${t(e.getDate())}T${t(e.getHours())}:${t(e.getMinutes())}`;
|
|
73
|
+
}
|
|
74
|
+
function w(e) {
|
|
75
|
+
const t = new Date(e);
|
|
76
|
+
return Number.isNaN(t.getTime()) ? null : t.toISOString();
|
|
77
|
+
}
|
|
78
|
+
export {
|
|
79
|
+
v as fetchVersionBundle,
|
|
80
|
+
w as fromLocalInput,
|
|
81
|
+
d as historyKeys,
|
|
82
|
+
T as toLocalInput,
|
|
83
|
+
K as useLayoutSchedules,
|
|
84
|
+
_ as useScheduleActions,
|
|
85
|
+
C as useSectionChanges,
|
|
86
|
+
N as useVersionNaming
|
|
87
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { UNGROUPED_KEY as l, HEADER_GROUP_KEY as d } from "../../lib/layout-ops.js";
|
|
2
|
+
import { targetKey as c } from "./design-context.js";
|
|
3
|
+
function g(e) {
|
|
4
|
+
return e.group_key === d ? { kind: "header", field: e.field } : {
|
|
5
|
+
kind: e.field.startsWith("__") ? "slot" : "field",
|
|
6
|
+
field: e.field,
|
|
7
|
+
group_key: e.group_key
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
function _(e, n) {
|
|
11
|
+
const t = String(n.layout.name ?? "the parent layout"), s = new Set(n.placements.map((r) => r.field)), i = new Set(n.groups.filter((r) => r.key !== l).map((r) => r.key)), f = /* @__PURE__ */ new Map();
|
|
12
|
+
for (const r of e.placements)
|
|
13
|
+
s.has(r.field) && f.set(c(g(r)), t);
|
|
14
|
+
for (const r of e.groups)
|
|
15
|
+
r.key !== l && i.has(r.key) && f.set(c({ kind: "group", key: r.key }), t);
|
|
16
|
+
return f;
|
|
17
|
+
}
|
|
18
|
+
function v(e) {
|
|
19
|
+
return {
|
|
20
|
+
text: "Overrides parent",
|
|
21
|
+
tone: "slate",
|
|
22
|
+
tip: `Changed on this form; ${e} has its own. Select it to reset it to the parent.`
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function m(e, n) {
|
|
26
|
+
return e.placements.filter((t) => t.field === n).map((t) => ({ op: "remove", at: { field: t.field, group_key: t.group_key } }));
|
|
27
|
+
}
|
|
28
|
+
function w(e, n, t) {
|
|
29
|
+
if (!e.groups.find((o) => o.key === t) || !n.groups.some((o) => o.key === t))
|
|
30
|
+
return { ok: !1, why: "This section is not an override of the parent" };
|
|
31
|
+
const i = e.groups.filter((o) => o.parent_key === t);
|
|
32
|
+
if (i.length > 0)
|
|
33
|
+
return {
|
|
34
|
+
ok: !1,
|
|
35
|
+
why: `Reset its ${i.length === 1 ? "tab" : `${i.length} tabs`} to the parent first`
|
|
36
|
+
};
|
|
37
|
+
const f = new Set(n.placements.map((o) => o.field)), r = e.placements.filter((o) => o.group_key === t), p = [], u = [], a = [];
|
|
38
|
+
for (const o of r)
|
|
39
|
+
f.has(o.field) ? (p.push(o.field), a.push(...m(e, o.field))) : u.push(o.field);
|
|
40
|
+
return a.push({ op: "group_remove", key: t, placements: "ungroup" }), { ok: !0, ops: h(a), reset: p, ungrouped: u };
|
|
41
|
+
}
|
|
42
|
+
function h(e) {
|
|
43
|
+
const n = /* @__PURE__ */ new Set();
|
|
44
|
+
return e.filter((t) => {
|
|
45
|
+
if (t.op !== "remove") return !0;
|
|
46
|
+
const s = `${t.at.field}\0${t.at.group_key ?? ""}`;
|
|
47
|
+
return n.has(s) ? !1 : (n.add(s), !0);
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
export {
|
|
51
|
+
_ as overriddenTargets,
|
|
52
|
+
v as overrideMark,
|
|
53
|
+
w as resetGroupPlan,
|
|
54
|
+
m as resetPlacementOps
|
|
55
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { useQuery as r } from "@tanstack/react-query";
|
|
2
|
+
import { useNivaroClient as s } from "../../../context.js";
|
|
3
|
+
import { get as a } from "../../../lib/commands.js";
|
|
4
|
+
const u = {
|
|
5
|
+
columns: (e) => ["layout-editor", "inspect", "columns", e],
|
|
6
|
+
lengths: (e, t) => ["layout-editor", "inspect", "lengths", e, t],
|
|
7
|
+
formFields: (e) => ["layout-editor", "inspect", "form-fields", e],
|
|
8
|
+
orphans: (e) => ["layout-editor", "inspect", "orphans", e],
|
|
9
|
+
translations: (e) => ["layout-editor", "inspect", "translations", e]
|
|
10
|
+
}, i = (e) => !!e && typeof e == "object" && !Array.isArray(e);
|
|
11
|
+
function p(e) {
|
|
12
|
+
const t = s();
|
|
13
|
+
return r({
|
|
14
|
+
queryKey: u.columns(e ?? ""),
|
|
15
|
+
queryFn: () => t.request(a(`/layout-inspect/${e}/columns`)).then((n) => i(n.data) ? n.data : {}),
|
|
16
|
+
enabled: !!e,
|
|
17
|
+
staleTime: 5 * 6e4,
|
|
18
|
+
retry: !1
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
function c(e, t) {
|
|
22
|
+
if (!e) return null;
|
|
23
|
+
if (e[t]) return e[t];
|
|
24
|
+
const n = Object.keys(e).find((o) => o.toLowerCase() === t.toLowerCase());
|
|
25
|
+
return n ? e[n] : null;
|
|
26
|
+
}
|
|
27
|
+
function f(e, t, n) {
|
|
28
|
+
const o = s();
|
|
29
|
+
return r({
|
|
30
|
+
queryKey: u.lengths(e, t),
|
|
31
|
+
queryFn: () => o.request(a(`/layout-inspect/${e}/value-lengths`, { field: t })).then((l) => i(l.data) ? l.data : null),
|
|
32
|
+
enabled: n && !!e && !!t,
|
|
33
|
+
staleTime: Number.POSITIVE_INFINITY,
|
|
34
|
+
retry: !1
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
function q(e) {
|
|
38
|
+
const t = s();
|
|
39
|
+
return r({
|
|
40
|
+
queryKey: u.formFields(e),
|
|
41
|
+
queryFn: () => t.request(a(`/layout-inspect/${e}/form-fields`)).then((n) => Array.isArray(n.data) ? n.data : []),
|
|
42
|
+
enabled: !!e,
|
|
43
|
+
staleTime: 6e4,
|
|
44
|
+
retry: !1
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
function h(e) {
|
|
48
|
+
const t = s();
|
|
49
|
+
return r({
|
|
50
|
+
queryKey: u.translations(e),
|
|
51
|
+
queryFn: () => t.request(a(`/layout-inspect/${e}/translations`)).then(
|
|
52
|
+
(n) => i(n.data) && Array.isArray(n.data.locales) ? n.data : null
|
|
53
|
+
),
|
|
54
|
+
enabled: !!e,
|
|
55
|
+
staleTime: 6e4,
|
|
56
|
+
retry: !1
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
export {
|
|
60
|
+
c as columnOf,
|
|
61
|
+
u as inspectKeys,
|
|
62
|
+
p as useColumnFacts,
|
|
63
|
+
q as useFormFields,
|
|
64
|
+
h as useTranslationSummary,
|
|
65
|
+
f as useValueLengths
|
|
66
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { resolveOptionFilterTokens as f } from "../../../lib/option-filter-tokens.js";
|
|
2
|
+
import { userOptionFilter as c } from "../../../lib/utils.js";
|
|
3
|
+
import { buildCascadeFilter as d } from "../../item-edit/helpers.js";
|
|
4
|
+
function y(t) {
|
|
5
|
+
const a = t.linked ?? {}, l = d({
|
|
6
|
+
rules: t.rules,
|
|
7
|
+
parentValue: (n) => {
|
|
8
|
+
const e = t.record[n];
|
|
9
|
+
if (e != null && e !== "" && !(Array.isArray(e) && e.length === 0) && typeof e != "object")
|
|
10
|
+
return e;
|
|
11
|
+
const i = a[n];
|
|
12
|
+
return i != null && i.length ? i.length === 1 ? String(i[0]) : i.map(String) : e && typeof e == "object" && !Array.isArray(e) && "id" in e ? e.id : null;
|
|
13
|
+
}
|
|
14
|
+
}), o = f(
|
|
15
|
+
t.optionFilter && typeof t.optionFilter == "object" ? t.optionFilter : void 0,
|
|
16
|
+
t.record,
|
|
17
|
+
t.itemId
|
|
18
|
+
), r = [];
|
|
19
|
+
return t.target === "nivaro_users" && r.push({ key: "people", label: "Active people", filter: c(!0) }), t.rules.length && r.push({
|
|
20
|
+
key: "cascade",
|
|
21
|
+
label: l.satisfiedParents.length ? `Cascade filters (${l.satisfiedParents.map(t.labelOf).join(", ")})` : "Cascade filters (no parent value)",
|
|
22
|
+
filter: l.filter ?? null
|
|
23
|
+
}), t.optionFilter && Object.keys(t.optionFilter).length && r.push({ key: "option_filter", label: "Option filter", filter: o ?? null }), {
|
|
24
|
+
steps: r,
|
|
25
|
+
satisfied: l.satisfiedParents,
|
|
26
|
+
waitsFor: l.missingRequiredParents[0] ?? null
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
function _(t, a, l) {
|
|
30
|
+
const o = [];
|
|
31
|
+
for (const r of [...new Set(t.map((n) => n.parent_field))]) {
|
|
32
|
+
const n = l.find((i) => i.one_collection === a && i.one_field === r);
|
|
33
|
+
if (!(n != null && n.many_collection) || !n.many_field) continue;
|
|
34
|
+
let e = n.junction_field ?? null;
|
|
35
|
+
if (!e) {
|
|
36
|
+
const i = l.find(
|
|
37
|
+
(s) => s.many_collection === n.many_collection && s !== n && s.many_field !== n.many_field
|
|
38
|
+
);
|
|
39
|
+
e = (i == null ? void 0 : i.many_field) ?? null;
|
|
40
|
+
}
|
|
41
|
+
e && o.push({ parent: r, junction: n.many_collection, parentFk: n.many_field, targetFk: e });
|
|
42
|
+
}
|
|
43
|
+
return o;
|
|
44
|
+
}
|
|
45
|
+
export {
|
|
46
|
+
_ as m2mParents,
|
|
47
|
+
y as previewNarrowing
|
|
48
|
+
};
|