@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,87 @@
|
|
|
1
|
+
const s = [12, 6, 4, 3], x = { 12: "Full", 6: "½", 4: "⅓", 3: "¼" }, f = 960, h = 40, c = 7;
|
|
2
|
+
function a(t) {
|
|
3
|
+
const e = Math.max(1, Math.min(12, Number(t) || 12));
|
|
4
|
+
return Math.max(1, Math.floor((e / 12 * f - h) / c));
|
|
5
|
+
}
|
|
6
|
+
function m(t) {
|
|
7
|
+
for (const e of [...s].reverse()) if (a(e) >= t) return e;
|
|
8
|
+
return 12;
|
|
9
|
+
}
|
|
10
|
+
function y(t, e) {
|
|
11
|
+
const n = Number(t) || 12, l = m(e);
|
|
12
|
+
return {
|
|
13
|
+
cut: a(n) < e,
|
|
14
|
+
suggest: l,
|
|
15
|
+
roomy: e > 0 && s.indexOf(l) - s.indexOf(n) >= 2
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
function p(t) {
|
|
19
|
+
if (t.relKind || t.isPath || ["text", "json", "boolean", "alias"].includes(t.type)) return !1;
|
|
20
|
+
const e = t.iface ?? "";
|
|
21
|
+
return !/textarea|rich|markdown|wysiwyg|code|tags|repeater|file|image/i.test(e);
|
|
22
|
+
}
|
|
23
|
+
function b(t) {
|
|
24
|
+
return t.max_length != null ? `${t.type}(${t.max_length})` : /^n?varchar$/.test(t.type) ? `${t.type}(max)` : t.precision != null ? `${t.type}(${t.precision},${t.scale ?? 0})` : t.type;
|
|
25
|
+
}
|
|
26
|
+
function g(t) {
|
|
27
|
+
return [...t].filter((e) => e === "#" || e === "A" || e === "*").length;
|
|
28
|
+
}
|
|
29
|
+
const d = {
|
|
30
|
+
tinyint: 255,
|
|
31
|
+
smallint: 32767,
|
|
32
|
+
int: 2147483647,
|
|
33
|
+
integer: 2147483647
|
|
34
|
+
};
|
|
35
|
+
function $(t, e) {
|
|
36
|
+
if (e == null || e === "" || typeof e == "object") return null;
|
|
37
|
+
const n = String(e);
|
|
38
|
+
if (n.startsWith("$") || n.includes("{{")) return null;
|
|
39
|
+
if (t.max_length != null && n.length > t.max_length)
|
|
40
|
+
return `${n.length} characters; the column holds ${t.max_length}`;
|
|
41
|
+
const l = d[t.type];
|
|
42
|
+
if (l != null) {
|
|
43
|
+
const r = Number(n);
|
|
44
|
+
if (Number.isFinite(r) && Math.abs(r) > l) return `larger than ${t.type} holds (${l})`;
|
|
45
|
+
}
|
|
46
|
+
if (t.precision != null && /^-?\d+(\.\d+)?$/.test(n)) {
|
|
47
|
+
const [r = "", i = ""] = n.replace("-", "").split("."), o = r.replace(/^0+/, "").length, u = t.precision - (t.scale ?? 0);
|
|
48
|
+
if (o > u) return `${o} digits before the point; the column allows ${u}`;
|
|
49
|
+
if (t.scale != null && i.length > t.scale)
|
|
50
|
+
return `${i.length} decimals; the column keeps ${t.scale}`;
|
|
51
|
+
}
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
function _(t) {
|
|
55
|
+
const e = [], n = t.column;
|
|
56
|
+
if (n && t.mask) {
|
|
57
|
+
const l = g(t.mask);
|
|
58
|
+
n.max_length != null && l > n.max_length && e.push({
|
|
59
|
+
key: "mask",
|
|
60
|
+
text: `The input mask stores ${l} characters; the column holds ${n.max_length}.`
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
if (n && t.defaultValue !== void 0) {
|
|
64
|
+
const l = $(n, t.defaultValue);
|
|
65
|
+
l && e.push({ key: "default", text: `This form's default value does not fit: ${l}.` });
|
|
66
|
+
}
|
|
67
|
+
if (t.label && t.layoutType !== "table") {
|
|
68
|
+
const l = a(t.span);
|
|
69
|
+
t.label.length > l && e.push({
|
|
70
|
+
key: "label",
|
|
71
|
+
text: `The label (${t.label.length} characters) is cut off at this width, which shows about ${l}.`
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
return e;
|
|
75
|
+
}
|
|
76
|
+
export {
|
|
77
|
+
s as SPANS,
|
|
78
|
+
x as SPAN_WORDS,
|
|
79
|
+
a as capacityChars,
|
|
80
|
+
_ as fitWarnings,
|
|
81
|
+
g as maskStoredLength,
|
|
82
|
+
m as suggestSpan,
|
|
83
|
+
b as typeWords,
|
|
84
|
+
$ as valueMisfit,
|
|
85
|
+
p as widthCheckApplies,
|
|
86
|
+
y as widthVerdict
|
|
87
|
+
};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { jsxs as p, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as c } from "react";
|
|
3
|
+
import { readAiFill as I, promptTokens as x, AI_FILL_KEY as w, PROMPT_MAX as $ } from "../../../lib/ai-fill.js";
|
|
4
|
+
import { SimpleSelect as v } from "../../ui/SimpleSelect.js";
|
|
5
|
+
import { useFieldCtx as k } from "./field-context.js";
|
|
6
|
+
import { Toggle as _, Setting as g, TextArea as y } from "./kit.js";
|
|
7
|
+
function j() {
|
|
8
|
+
const m = k(), { ov: h, info: n, globals: i } = m, t = I(h), f = !!(t != null && t.enabled), o = (t == null ? void 0 : t.prompt) ?? "", r = n.label, u = c(() => new Set(i.map((e) => e.field)), [i]), d = x(o).filter((e) => !u.has(e)), b = c(
|
|
9
|
+
() => [
|
|
10
|
+
{ value: "", label: "Insert a field…" },
|
|
11
|
+
...i.filter((e) => e.field !== n.field && !e.field.startsWith("__")).map((e) => {
|
|
12
|
+
var l;
|
|
13
|
+
return { value: e.field, label: ((l = e.label) == null ? void 0 : l.trim()) || e.field };
|
|
14
|
+
})
|
|
15
|
+
],
|
|
16
|
+
[i, n.field]
|
|
17
|
+
), s = (e, l, A) => m.setOverride(
|
|
18
|
+
w,
|
|
19
|
+
{ enabled: e.enabled, prompt: e.prompt.slice(0, $) },
|
|
20
|
+
l,
|
|
21
|
+
A
|
|
22
|
+
);
|
|
23
|
+
return /* @__PURE__ */ p("div", { className: "space-y-3", "data-ai-fill-setting": "", children: [
|
|
24
|
+
/* @__PURE__ */ a(
|
|
25
|
+
_,
|
|
26
|
+
{
|
|
27
|
+
k: "field.ai_generate",
|
|
28
|
+
label: "AI fill button",
|
|
29
|
+
effect: `Shows an AI button on ${r} that writes a value from your prompt. Overrides the form-wide AI switch for this field.`,
|
|
30
|
+
checked: f,
|
|
31
|
+
onChange: (e) => s(
|
|
32
|
+
{
|
|
33
|
+
enabled: e,
|
|
34
|
+
prompt: o || `Write the ${r.toLowerCase()} for this record.`
|
|
35
|
+
},
|
|
36
|
+
e ? `Turn on AI fill for ${r}` : `Turn off AI fill for ${r}`
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
),
|
|
40
|
+
f && /* @__PURE__ */ p(
|
|
41
|
+
g,
|
|
42
|
+
{
|
|
43
|
+
k: "field.ai_generate_prompt",
|
|
44
|
+
label: "AI prompt",
|
|
45
|
+
effect: "What the AI is asked. {{field_name}} is replaced by that field’s current value; nothing else from the record is sent.",
|
|
46
|
+
children: [
|
|
47
|
+
/* @__PURE__ */ a(
|
|
48
|
+
y,
|
|
49
|
+
{
|
|
50
|
+
ariaLabel: "AI prompt",
|
|
51
|
+
rows: 4,
|
|
52
|
+
value: o,
|
|
53
|
+
onChange: (e) => s({ enabled: !0, prompt: e }, `Edit the AI prompt of ${r}`, !0)
|
|
54
|
+
}
|
|
55
|
+
),
|
|
56
|
+
/* @__PURE__ */ a("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ a(
|
|
57
|
+
v,
|
|
58
|
+
{
|
|
59
|
+
value: "",
|
|
60
|
+
ariaLabel: "Insert a field into the prompt",
|
|
61
|
+
className: "h-7 flex-1 text-[12px]",
|
|
62
|
+
options: b,
|
|
63
|
+
onChange: (e) => {
|
|
64
|
+
if (!e) return;
|
|
65
|
+
const l = o && !/\s$/.test(o) ? " " : "";
|
|
66
|
+
s(
|
|
67
|
+
{ enabled: !0, prompt: `${o}${l}{{${e}}}` },
|
|
68
|
+
`Edit the AI prompt of ${r}`
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
) }),
|
|
73
|
+
d.length > 0 && /* @__PURE__ */ p("p", { className: "text-[12px] text-amber-700 dark:text-amber-300", "data-ai-fill-unknown": "", children: [
|
|
74
|
+
"Not fields of this collection: ",
|
|
75
|
+
d.map((e) => `{{${e}}}`).join(", "),
|
|
76
|
+
" — they stay empty."
|
|
77
|
+
] })
|
|
78
|
+
]
|
|
79
|
+
}
|
|
80
|
+
)
|
|
81
|
+
] });
|
|
82
|
+
}
|
|
83
|
+
export {
|
|
84
|
+
j as AiFillSetting
|
|
85
|
+
};
|
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
import { jsxs as h, jsx as a, Fragment as C } from "react/jsx-runtime";
|
|
2
|
+
import { X as $ } from "lucide-react";
|
|
3
|
+
import { useMemo as N } from "react";
|
|
4
|
+
import { validateExpression as R } from "../../../lib/expression.js";
|
|
5
|
+
import { displayFormulaOf as T, textRulesOf as O, counterOf as L, confirmChangeOf as F } from "../../../lib/placement-behaviour.js";
|
|
6
|
+
import { cn as A } from "../../../lib/utils.js";
|
|
7
|
+
import { RoleConditionRow as M, PipelineStateConditionRow as w } from "../editors/lock-conditions.js";
|
|
8
|
+
import { useColumnFacts as I, columnOf as W } from "../inspect/inspect-api.js";
|
|
9
|
+
import { effectText as D, tintCard as P } from "../panel-style.js";
|
|
10
|
+
import { isRelational as j } from "./applies.js";
|
|
11
|
+
import { useFieldCtx as b } from "./field-context.js";
|
|
12
|
+
import { useInspectorEnv as q, Setting as p, TextInput as v, TextArea as K, Segmented as k, DraftInput as E, AddButton as H, Toggle as _ } from "./kit.js";
|
|
13
|
+
const U = "rounded p-0.5 text-slate-400 transition-colors hover:bg-muted hover:text-slate-700 dark:hover:text-foreground";
|
|
14
|
+
function z(o) {
|
|
15
|
+
if (j(o)) return !1;
|
|
16
|
+
const s = o.iface ?? "";
|
|
17
|
+
return ["string", "text", "richtext", "rich_text", "markdown", "wysiwyg"].includes(o.type) || /textarea|rich|wysiwyg|markdown/i.test(s);
|
|
18
|
+
}
|
|
19
|
+
function S(o, s) {
|
|
20
|
+
return !s.startsWith("__") && !o.isPath && o.type !== "alias" && o.relKind !== "M2M" && o.relKind !== "O2M" && o.computedType !== "virtual" && o.computedType !== "read";
|
|
21
|
+
}
|
|
22
|
+
function re() {
|
|
23
|
+
const o = b(), { ov: s, info: d, env: f, row: l } = o, i = d.label, c = O(s), u = (r, n, e) => o.setOverride("text_rules", r.length ? r : void 0, n, e), t = (r, n, e, m) => u(
|
|
24
|
+
c.map((g, y) => y === r ? { ...g, ...n } : g),
|
|
25
|
+
e,
|
|
26
|
+
m
|
|
27
|
+
);
|
|
28
|
+
return l.field.startsWith("__") ? null : /* @__PURE__ */ h(
|
|
29
|
+
p,
|
|
30
|
+
{
|
|
31
|
+
k: "field.text_rules",
|
|
32
|
+
label: "Label and help by state or role",
|
|
33
|
+
effect: "Different words in a workflow state or for a role: “Requested date” becomes “Delivered date” once Completed. The first rule that matches wins; the record page, read view and PDF follow it.",
|
|
34
|
+
children: [
|
|
35
|
+
c.map((r, n) => /* @__PURE__ */ h(
|
|
36
|
+
"div",
|
|
37
|
+
{
|
|
38
|
+
"data-text-rule": n,
|
|
39
|
+
className: A(P, "space-y-2 px-2.5 py-2"),
|
|
40
|
+
children: [
|
|
41
|
+
/* @__PURE__ */ h("div", { className: "flex items-center gap-2", children: [
|
|
42
|
+
/* @__PURE__ */ a("div", { className: "flex-1", children: /* @__PURE__ */ a(
|
|
43
|
+
k,
|
|
44
|
+
{
|
|
45
|
+
value: r.type,
|
|
46
|
+
options: [
|
|
47
|
+
{ value: "pipeline_state", label: "In a state" },
|
|
48
|
+
{ value: "role", label: "For a role" }
|
|
49
|
+
],
|
|
50
|
+
onChange: (e) => t(
|
|
51
|
+
n,
|
|
52
|
+
e === "role" ? {
|
|
53
|
+
type: "role",
|
|
54
|
+
role_ids: [],
|
|
55
|
+
state_keys: void 0,
|
|
56
|
+
pipeline_id: void 0
|
|
57
|
+
} : { type: "pipeline_state", state_keys: [], role_ids: void 0 },
|
|
58
|
+
`Change when ${i} reads differently`
|
|
59
|
+
)
|
|
60
|
+
}
|
|
61
|
+
) }),
|
|
62
|
+
/* @__PURE__ */ a(
|
|
63
|
+
"button",
|
|
64
|
+
{
|
|
65
|
+
type: "button",
|
|
66
|
+
"aria-label": "Remove this rule",
|
|
67
|
+
"data-tip": "Remove this rule",
|
|
68
|
+
className: U,
|
|
69
|
+
onClick: () => u(
|
|
70
|
+
c.filter((e, m) => m !== n),
|
|
71
|
+
`Remove a label rule from ${i}`
|
|
72
|
+
),
|
|
73
|
+
children: /* @__PURE__ */ a($, { className: "h-3.5 w-3.5" })
|
|
74
|
+
}
|
|
75
|
+
)
|
|
76
|
+
] }),
|
|
77
|
+
r.type === "role" ? /* @__PURE__ */ a(
|
|
78
|
+
M,
|
|
79
|
+
{
|
|
80
|
+
roleIds: r.role_ids ?? [],
|
|
81
|
+
onRoleIdsChange: (e) => t(n, { role_ids: e }, `Change the roles for ${i}`)
|
|
82
|
+
}
|
|
83
|
+
) : /* @__PURE__ */ a(
|
|
84
|
+
w,
|
|
85
|
+
{
|
|
86
|
+
collection: f.collection,
|
|
87
|
+
pipelineId: r.pipeline_id,
|
|
88
|
+
stateKeys: r.state_keys ?? [],
|
|
89
|
+
onPipelineChange: (e) => t(n, { pipeline_id: e, state_keys: [] }, `Change the pipeline for ${i}`),
|
|
90
|
+
onStateKeysChange: (e) => t(n, { state_keys: e }, `Change the states for ${i}`)
|
|
91
|
+
}
|
|
92
|
+
),
|
|
93
|
+
/* @__PURE__ */ a(
|
|
94
|
+
v,
|
|
95
|
+
{
|
|
96
|
+
ariaLabel: "Label in this case",
|
|
97
|
+
value: r.label ?? "",
|
|
98
|
+
placeholder: `Label (${i})`,
|
|
99
|
+
onChange: (e) => t(n, { label: e || void 0 }, `Change a label rule of ${i}`, !0)
|
|
100
|
+
}
|
|
101
|
+
),
|
|
102
|
+
/* @__PURE__ */ a(
|
|
103
|
+
v,
|
|
104
|
+
{
|
|
105
|
+
ariaLabel: "Help text in this case",
|
|
106
|
+
value: r.note ?? "",
|
|
107
|
+
placeholder: "Help text (unchanged when empty)",
|
|
108
|
+
onChange: (e) => t(n, { note: e || void 0 }, `Change a help rule of ${i}`, !0)
|
|
109
|
+
}
|
|
110
|
+
)
|
|
111
|
+
]
|
|
112
|
+
},
|
|
113
|
+
n
|
|
114
|
+
)),
|
|
115
|
+
/* @__PURE__ */ a(
|
|
116
|
+
H,
|
|
117
|
+
{
|
|
118
|
+
onClick: () => u(
|
|
119
|
+
[...c, { type: "pipeline_state", state_keys: [] }],
|
|
120
|
+
`Add a label rule to ${i}`
|
|
121
|
+
),
|
|
122
|
+
children: "+ Add a rule"
|
|
123
|
+
}
|
|
124
|
+
)
|
|
125
|
+
]
|
|
126
|
+
}
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
function le() {
|
|
130
|
+
const o = b(), { ov: s, info: d, env: f, row: l } = o, { data: i } = I(f.collection), c = W(i, l.field);
|
|
131
|
+
if (!z(d) || l.field.startsWith("__")) return null;
|
|
132
|
+
const u = d.label, t = L(s), r = (c == null ? void 0 : c.max_length) != null && c.max_length > 0 ? c.max_length : null, n = (e, m, g) => o.setOverride("counter", e, m, g);
|
|
133
|
+
return /* @__PURE__ */ h("div", { "data-setting": "field.counter", className: "space-y-3", children: [
|
|
134
|
+
/* @__PURE__ */ a(
|
|
135
|
+
_,
|
|
136
|
+
{
|
|
137
|
+
k: "field.counter.on",
|
|
138
|
+
label: "Counter and limit",
|
|
139
|
+
effect: r ? `Counts as people type. The limit starts at the column size (${r.toLocaleString()} characters); past it the form will not save.` : "Counts as people type; past a limit the form will not save.",
|
|
140
|
+
checked: !!t,
|
|
141
|
+
onChange: (e) => n(
|
|
142
|
+
e ? { unit: "characters", ...r ? { limit: r } : {} } : void 0,
|
|
143
|
+
e ? `Count the characters of ${u}` : `Stop counting ${u}`
|
|
144
|
+
)
|
|
145
|
+
}
|
|
146
|
+
),
|
|
147
|
+
t && /* @__PURE__ */ h(C, { children: [
|
|
148
|
+
/* @__PURE__ */ a(p, { k: "field.counter.unit", label: "Count", effect: "Characters or words.", children: /* @__PURE__ */ a(
|
|
149
|
+
k,
|
|
150
|
+
{
|
|
151
|
+
value: t.unit,
|
|
152
|
+
options: [
|
|
153
|
+
{ value: "characters", label: "Characters" },
|
|
154
|
+
{ value: "words", label: "Words" }
|
|
155
|
+
],
|
|
156
|
+
onChange: (e) => n(
|
|
157
|
+
{
|
|
158
|
+
unit: e,
|
|
159
|
+
...e === "words" ? {} : t.limit != null ? { limit: t.limit } : r ? { limit: r } : {}
|
|
160
|
+
},
|
|
161
|
+
`Count the ${e} of ${u}`
|
|
162
|
+
)
|
|
163
|
+
}
|
|
164
|
+
) }),
|
|
165
|
+
/* @__PURE__ */ a(
|
|
166
|
+
p,
|
|
167
|
+
{
|
|
168
|
+
k: "field.counter.limit",
|
|
169
|
+
label: "Limit",
|
|
170
|
+
effect: t.unit === "words" ? "Most words allowed. Empty counts without a limit." : `Most characters allowed. Empty counts without a limit${r ? `; the column holds ${r.toLocaleString()}` : ""}.`,
|
|
171
|
+
children: /* @__PURE__ */ a(
|
|
172
|
+
v,
|
|
173
|
+
{
|
|
174
|
+
type: "number",
|
|
175
|
+
ariaLabel: "Limit",
|
|
176
|
+
value: t.limit == null ? "" : String(t.limit),
|
|
177
|
+
placeholder: t.unit === "characters" && r ? String(r) : "No limit",
|
|
178
|
+
onChange: (e) => {
|
|
179
|
+
const m = e === "" ? void 0 : Math.max(1, Math.floor(Number(e)));
|
|
180
|
+
m !== void 0 && !Number.isFinite(m) || n(
|
|
181
|
+
{ unit: t.unit, ...m ? { limit: m } : {} },
|
|
182
|
+
`Set the limit of ${u}`,
|
|
183
|
+
!0
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
)
|
|
188
|
+
}
|
|
189
|
+
)
|
|
190
|
+
] })
|
|
191
|
+
] });
|
|
192
|
+
}
|
|
193
|
+
function ie() {
|
|
194
|
+
var i;
|
|
195
|
+
const o = b(), { ov: s, info: d, row: f } = o;
|
|
196
|
+
if (f.field.startsWith("__")) return null;
|
|
197
|
+
const l = s.required === !0 || s.required === void 0 && !!((i = d.global) != null && i.required);
|
|
198
|
+
return /* @__PURE__ */ a(
|
|
199
|
+
_,
|
|
200
|
+
{
|
|
201
|
+
k: "field.recommended",
|
|
202
|
+
label: "Recommended",
|
|
203
|
+
effect: l ? "Required already wins; switch Required off to make this a recommendation." : "An amber marker and a reminder on save listing what is still empty. Saving is never blocked.",
|
|
204
|
+
checked: s.recommended === !0 && !l,
|
|
205
|
+
disabled: l,
|
|
206
|
+
onChange: (c) => o.setOverride(
|
|
207
|
+
"recommended",
|
|
208
|
+
c ? !0 : void 0,
|
|
209
|
+
c ? `Recommend ${d.label}` : `Stop recommending ${d.label}`
|
|
210
|
+
)
|
|
211
|
+
}
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
function se() {
|
|
215
|
+
const o = b(), { ov: s, info: d, env: f, row: l } = o;
|
|
216
|
+
if (!S(d, l.field)) return null;
|
|
217
|
+
const i = d.label, c = F(s), u = s.confirm_change && typeof s.confirm_change == "object" ? s.confirm_change : {}, t = typeof u.pipeline_id == "string" ? u.pipeline_id : void 0, r = (n, e) => o.setOverride("confirm_change", n, e);
|
|
218
|
+
return /* @__PURE__ */ h("div", { "data-setting": "field.confirm_change", className: "space-y-3", children: [
|
|
219
|
+
/* @__PURE__ */ a(
|
|
220
|
+
_,
|
|
221
|
+
{
|
|
222
|
+
k: "field.confirm_change.on",
|
|
223
|
+
label: "Confirm changes on saved records",
|
|
224
|
+
effect: "Changing it on an existing record asks “Are you sure?” and a short reason, kept with the change in the history. New records are not asked.",
|
|
225
|
+
checked: !!c,
|
|
226
|
+
onChange: (n) => r(
|
|
227
|
+
n ? { state_keys: [] } : void 0,
|
|
228
|
+
n ? `Confirm changes to ${i}` : `Stop confirming changes to ${i}`
|
|
229
|
+
)
|
|
230
|
+
}
|
|
231
|
+
),
|
|
232
|
+
c && /* @__PURE__ */ a(
|
|
233
|
+
p,
|
|
234
|
+
{
|
|
235
|
+
k: "field.confirm_change.states",
|
|
236
|
+
label: "Only in these states",
|
|
237
|
+
effect: c.state_keys.length ? "Asked only while the record is in a ticked state." : "No state ticked: asked in every state.",
|
|
238
|
+
children: /* @__PURE__ */ a(
|
|
239
|
+
w,
|
|
240
|
+
{
|
|
241
|
+
collection: f.collection,
|
|
242
|
+
pipelineId: t,
|
|
243
|
+
stateKeys: c.state_keys,
|
|
244
|
+
onPipelineChange: (n) => r(
|
|
245
|
+
{ ...n ? { pipeline_id: n } : {}, state_keys: [] },
|
|
246
|
+
`Change the pipeline that confirms ${i}`
|
|
247
|
+
),
|
|
248
|
+
onStateKeysChange: (n) => r(
|
|
249
|
+
{ ...t ? { pipeline_id: t } : {}, state_keys: n },
|
|
250
|
+
`Change the states that confirm ${i}`
|
|
251
|
+
)
|
|
252
|
+
}
|
|
253
|
+
)
|
|
254
|
+
}
|
|
255
|
+
)
|
|
256
|
+
] });
|
|
257
|
+
}
|
|
258
|
+
function ce() {
|
|
259
|
+
const o = b(), { ov: s, info: d, row: f } = o;
|
|
260
|
+
return !S(d, f.field) || d.computedType ? null : /* @__PURE__ */ a(
|
|
261
|
+
_,
|
|
262
|
+
{
|
|
263
|
+
k: "field.repeat_last",
|
|
264
|
+
label: "Repeat last value",
|
|
265
|
+
effect: "A “Repeat last” button beside the label fills in what this person entered on their previous record here.",
|
|
266
|
+
checked: s.repeat_last === !0,
|
|
267
|
+
onChange: (l) => o.setOverride(
|
|
268
|
+
"repeat_last",
|
|
269
|
+
l ? !0 : void 0,
|
|
270
|
+
l ? `Offer to repeat the last ${d.label}` : `Stop offering to repeat ${d.label}`
|
|
271
|
+
)
|
|
272
|
+
}
|
|
273
|
+
);
|
|
274
|
+
}
|
|
275
|
+
const B = [
|
|
276
|
+
{ value: "", label: "Plain" },
|
|
277
|
+
{ value: "integer", label: "Whole" },
|
|
278
|
+
{ value: "number", label: "Decimal" },
|
|
279
|
+
{ value: "currency", label: "Money" },
|
|
280
|
+
{ value: "percent", label: "Percent" }
|
|
281
|
+
];
|
|
282
|
+
function de({
|
|
283
|
+
row: o,
|
|
284
|
+
fields: s
|
|
285
|
+
}) {
|
|
286
|
+
const d = q(), f = N(() => {
|
|
287
|
+
const e = o.overrides;
|
|
288
|
+
if (typeof e == "string")
|
|
289
|
+
try {
|
|
290
|
+
return JSON.parse(e) ?? {};
|
|
291
|
+
} catch {
|
|
292
|
+
return {};
|
|
293
|
+
}
|
|
294
|
+
return e && typeof e == "object" ? e : {};
|
|
295
|
+
}, [o.overrides]), l = T(f) ?? { expr: "", format: "", currency: null }, i = typeof f.label == "string" ? f.label : "", c = { field: o.field, group_key: o.group_key }, u = (e, m, g) => {
|
|
296
|
+
const y = { ...f, ...e };
|
|
297
|
+
for (const x of Object.keys(y)) y[x] === void 0 && delete y[x];
|
|
298
|
+
d.apply([{ op: "update_placement", at: c, patch: { overrides: y } }], {
|
|
299
|
+
label: m,
|
|
300
|
+
text: g
|
|
301
|
+
});
|
|
302
|
+
}, t = l.expr.trim() ? R(l.expr, s) : null, r = new Set(
|
|
303
|
+
d.bundle.placements.filter((e) => !e.field.startsWith("__")).map((e) => e.field)
|
|
304
|
+
), n = t != null && t.ok ? t.tokens.filter((e) => !r.has(e.split(".")[0])) : [];
|
|
305
|
+
return /* @__PURE__ */ h("div", { className: "space-y-5", children: [
|
|
306
|
+
/* @__PURE__ */ a(p, { k: "display_formula.label", label: "Label", effect: "What the form calls the value.", children: /* @__PURE__ */ a(
|
|
307
|
+
v,
|
|
308
|
+
{
|
|
309
|
+
ariaLabel: "Label",
|
|
310
|
+
value: i,
|
|
311
|
+
placeholder: "Remaining",
|
|
312
|
+
onChange: (e) => u({ label: e || void 0 }, "Rename the formula", !0)
|
|
313
|
+
}
|
|
314
|
+
) }),
|
|
315
|
+
/* @__PURE__ */ h(
|
|
316
|
+
p,
|
|
317
|
+
{
|
|
318
|
+
k: "display_formula.expr",
|
|
319
|
+
label: "Formula",
|
|
320
|
+
effect: /* @__PURE__ */ h(C, { children: [
|
|
321
|
+
"Fields in double braces, for example",
|
|
322
|
+
" ",
|
|
323
|
+
/* @__PURE__ */ a("code", { className: "font-mono text-[11.5px]", children: "{{budget}} - {{committed}}" }),
|
|
324
|
+
". Worked out on the page from what is on the form; never saved."
|
|
325
|
+
] }),
|
|
326
|
+
children: [
|
|
327
|
+
/* @__PURE__ */ a(
|
|
328
|
+
K,
|
|
329
|
+
{
|
|
330
|
+
ariaLabel: "Formula",
|
|
331
|
+
rows: 3,
|
|
332
|
+
mono: !0,
|
|
333
|
+
value: l.expr,
|
|
334
|
+
onChange: (e) => u({ display_formula: { ...l, expr: e } }, "Change the formula", !0)
|
|
335
|
+
}
|
|
336
|
+
),
|
|
337
|
+
t && !t.ok && /* @__PURE__ */ a(
|
|
338
|
+
"p",
|
|
339
|
+
{
|
|
340
|
+
role: "alert",
|
|
341
|
+
"data-formula-error": "",
|
|
342
|
+
className: "text-[12px] text-red-700 dark:text-red-300",
|
|
343
|
+
children: t.error
|
|
344
|
+
}
|
|
345
|
+
),
|
|
346
|
+
(t == null ? void 0 : t.ok) && t.unknownTokens.length > 0 && /* @__PURE__ */ h("p", { "data-formula-unknown": "", className: "text-[12px] text-amber-700 dark:text-amber-300", children: [
|
|
347
|
+
"Not fields of this collection:",
|
|
348
|
+
" ",
|
|
349
|
+
/* @__PURE__ */ a("span", { className: "font-mono", children: t.unknownTokens.join(", ") })
|
|
350
|
+
] }),
|
|
351
|
+
(t == null ? void 0 : t.ok) && !t.unknownTokens.length && n.length > 0 && /* @__PURE__ */ h("p", { "data-formula-offform": "", className: D, children: [
|
|
352
|
+
"Not on this form, so they read as empty here:",
|
|
353
|
+
" ",
|
|
354
|
+
/* @__PURE__ */ a("span", { className: "font-mono", children: n.join(", ") })
|
|
355
|
+
] })
|
|
356
|
+
]
|
|
357
|
+
}
|
|
358
|
+
),
|
|
359
|
+
/* @__PURE__ */ a(p, { k: "display_formula.format", label: "Show as", effect: "How the number is written.", children: /* @__PURE__ */ a(
|
|
360
|
+
k,
|
|
361
|
+
{
|
|
362
|
+
value: l.format,
|
|
363
|
+
options: B,
|
|
364
|
+
onChange: (e) => u({ display_formula: { ...l, format: e } }, "Change how the formula shows")
|
|
365
|
+
}
|
|
366
|
+
) }),
|
|
367
|
+
l.format === "currency" && /* @__PURE__ */ a(
|
|
368
|
+
p,
|
|
369
|
+
{
|
|
370
|
+
k: "display_formula.currency",
|
|
371
|
+
label: "Currency",
|
|
372
|
+
effect: "Three-letter code, for example USD.",
|
|
373
|
+
children: /* @__PURE__ */ a(
|
|
374
|
+
E,
|
|
375
|
+
{
|
|
376
|
+
ariaLabel: "Currency",
|
|
377
|
+
value: l.currency ?? "",
|
|
378
|
+
mono: !0,
|
|
379
|
+
placeholder: "USD",
|
|
380
|
+
onCommit: (e) => {
|
|
381
|
+
const m = e.trim().toUpperCase();
|
|
382
|
+
m && !/^[A-Z]{3}$/.test(m) || u(
|
|
383
|
+
{ display_formula: { ...l, currency: m || null } },
|
|
384
|
+
"Change the currency of the formula",
|
|
385
|
+
!0
|
|
386
|
+
);
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
)
|
|
390
|
+
}
|
|
391
|
+
)
|
|
392
|
+
] });
|
|
393
|
+
}
|
|
394
|
+
export {
|
|
395
|
+
se as ConfirmChangeSetting,
|
|
396
|
+
le as CounterSetting,
|
|
397
|
+
de as DisplayFormulaSettings,
|
|
398
|
+
ie as RecommendedToggle,
|
|
399
|
+
ce as RepeatLastToggle,
|
|
400
|
+
re as TextRulesSetting,
|
|
401
|
+
z as takesText
|
|
402
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx as n, Fragment as d, jsxs as i } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as m, Fragment as b } from "react";
|
|
3
|
+
import { crumbsOf as c, KIND_WORDS as f } from "../nav/tree.js";
|
|
4
|
+
import { useInspectorEnv as p } from "./kit.js";
|
|
5
|
+
function k({
|
|
6
|
+
kind: r,
|
|
7
|
+
target: o,
|
|
8
|
+
where: a = null
|
|
9
|
+
}) {
|
|
10
|
+
const t = p(), l = m(() => c(t.bundle, o), [t.bundle, o]);
|
|
11
|
+
return l.length === 0 ? /* @__PURE__ */ n(d, { children: a ? `${r} · ${a}` : r }) : /* @__PURE__ */ i("span", { "data-breadcrumb": "", children: [
|
|
12
|
+
r,
|
|
13
|
+
" ·",
|
|
14
|
+
" ",
|
|
15
|
+
l.map((e, s) => /* @__PURE__ */ i(b, { children: [
|
|
16
|
+
s > 0 && /* @__PURE__ */ n("span", { "aria-hidden": "true", children: " › " }),
|
|
17
|
+
t.select ? /* @__PURE__ */ n(
|
|
18
|
+
"button",
|
|
19
|
+
{
|
|
20
|
+
type: "button",
|
|
21
|
+
"data-crumb": e.target.kind === "group" ? e.target.key : void 0,
|
|
22
|
+
"data-tip": `Select the ${f[e.kind].toLowerCase()} ${e.label}`,
|
|
23
|
+
onClick: () => {
|
|
24
|
+
var u;
|
|
25
|
+
return (u = t.select) == null ? void 0 : u.call(t, e.target);
|
|
26
|
+
},
|
|
27
|
+
className: "rounded-sm text-slate-600 underline-offset-2 hover:text-slate-900 hover:underline focus-visible:outline focus-visible:outline-2 focus-visible:outline-nvr-cyan dark:text-slate-300 dark:hover:text-foreground",
|
|
28
|
+
children: e.label
|
|
29
|
+
}
|
|
30
|
+
) : e.label
|
|
31
|
+
] }, e.target.kind === "group" ? e.target.key : s))
|
|
32
|
+
] });
|
|
33
|
+
}
|
|
34
|
+
export {
|
|
35
|
+
k as Breadcrumb
|
|
36
|
+
};
|