@panneau/actions 5.0.0-alpha.5 → 5.0.0-alpha.50
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/README.md +6 -6
- package/dist/ActionRunner.css +1 -1
- package/dist/ActionRunner.module.js.map +1 -1
- package/dist/ActionRunnerProvider.d.ts +8 -2
- package/dist/ActionRunnerProvider.d.ts.map +1 -1
- package/dist/ActionRunnerProvider.js +449 -197
- package/dist/ActionRunnerProvider.js.map +1 -1
- package/dist/ActionRuns.d.ts.map +1 -1
- package/dist/ActionRuns.js +53 -39
- package/dist/ActionRuns.js.map +1 -1
- package/dist/ParametersDialog.d.ts +4 -1
- package/dist/ParametersDialog.d.ts.map +1 -1
- package/dist/ParametersDialog.js +152 -74
- package/dist/ParametersDialog.js.map +1 -1
- package/dist/ResultsDialog.d.ts.map +1 -1
- package/dist/ResultsDialog.js +1 -2
- package/dist/ResultsDialog.js.map +1 -1
- package/dist/context.d.ts +6 -1
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js.map +1 -1
- package/dist/describe.d.ts +35 -4
- package/dist/describe.d.ts.map +1 -1
- package/dist/describe.js +89 -7
- package/dist/describe.js.map +1 -1
- package/dist/index.d.ts +9 -9
- package/dist/preview.d.ts +1 -1
- package/dist/preview.js.map +1 -1
- package/dist/request.d.ts +1 -1
- package/dist/request.js.map +1 -1
- package/dist/types.d.ts +6 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/useActionRunner.d.ts +2 -2
- package/dist/useActionRunner.js.map +1 -1
- package/package.json +10 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionRunnerProvider.js","names":["resource","target","entry","run","resolve","current","id","candidate","values","result"],"sources":["../src/ActionRunnerProvider.tsx"],"sourcesContent":["import { type ReactNode, useEffect, useEffectEvent, useRef, useState } from 'react';\n\nimport { usePlugins } from '@panneau/core';\nimport type { ActionResult, ActionRun, RouteReference } from '@panneau/protocol';\nimport { usePanneauIntl, useToast } from '@panneau/ui';\n\nimport { ParametersDialog } from './ParametersDialog';\nimport { ResultsDialog } from './ResultsDialog';\nimport { ActionRunnerContext, type ActionRunnerContextValue } from './context';\nimport { describeResult } from './describe';\nimport { messages } from './messages';\nimport { buildActionRequest, getLinkTarget, isFinished } from './request';\nimport type {\n ActionAdapter,\n ActionDownload,\n ActionOutcome,\n ActionResultContext,\n ActionTarget,\n ClientActionHandler,\n FollowedRun,\n} from './types';\n\nexport interface ActionRunnerProviderProps {\n /** Runs the actions: a `DataAdapter`, or any object with its action methods. */\n adapter: ActionAdapter;\n children?: ReactNode;\n /**\n * Called with every result: of an action that finished at once, and of a queued run when it\n * finishes. Refresh what it changed here. With `@panneau/data/query`:\n * `invalidateActionResult(client, resource, result, target.selection)`.\n */\n onResult?: (result: ActionResult, context: ActionResultContext) => unknown;\n /**\n * Goes to the `redirect` of a result, or to the URL or route of a `link` action. Defaults to\n * `window.location.assign()` for URLs; routes need it.\n */\n onNavigate?: (to: string | RouteReference) => void;\n /** Opens the `download` of a result. Defaults to a link to its URL, clicked. */\n onDownload?: (download: ActionDownload) => void;\n /** Handlers of `client` actions by their `component`, over those of the plugins. */\n clientActions?: Readonly<Record<string, ClientActionHandler>>;\n /** Milliseconds between two checks of a queued run. Defaults to 2000. */\n pollInterval?: number;\n /** Locales of localized parameters. Defaults to the definition's. */\n locales?: readonly string[];\n}\n\ninterface Pending {\n resource: string;\n target: ActionTarget;\n resolve: (outcome: ActionOutcome | false) => void;\n}\n\ninterface ClientPending extends Pending {\n Handler: ClientActionHandler;\n}\n\nfunction navigateTo(to: string | RouteReference) {\n if (typeof to === 'string') {\n window.location.assign(to);\n } else {\n console.warn(\n `[panneau] An action goes to the route \"${to.route}\": give ActionRunnerProvider an onNavigate.`,\n );\n }\n}\n\nfunction openDownload(download: ActionDownload) {\n const link = document.createElement('a');\n link.href = download.url;\n if (download.filename !== undefined) {\n link.download = download.filename;\n }\n link.rel = 'noopener';\n link.hidden = true;\n document.body.append(link);\n link.click();\n link.remove();\n}\n\n/**\n * Runs the actions that lists and forms hand over ([decision 0023]): it asks for their parameters\n * in a dialog, runs them through the adapter, shows their result (a toast, and the items that\n * didn't succeed), follows queued runs until they end, refreshes through `onResult`, follows\n * redirects and opens downloads. Put it inside `PanneauRoot`, and above the router of an app, so\n * that runs are followed from page to page. `useActionRunner(resource)` runs an action.\n */\nexport function ActionRunnerProvider({\n adapter,\n children,\n onResult,\n onNavigate = navigateTo,\n onDownload = openDownload,\n clientActions,\n pollInterval = 2000,\n locales,\n}: ActionRunnerProviderProps) {\n const intl = usePanneauIntl();\n const toasts = useToast();\n const plugins = usePlugins();\n const [parameters, setParameters] = useState<Pending | null>(null);\n const [client, setClient] = useState<ClientPending | null>(null);\n const [details, setDetails] = useState<{ label: string; result: ActionResult } | null>(null);\n const [runs, setRuns] = useState<readonly FollowedRun[]>([]);\n // Runs whose end was already shown, so that a late poll doesn't show it twice.\n const notified = useRef(new Set<string>());\n\n const finish = async (resource: string, target: ActionTarget, result: ActionResult) => {\n await onResult?.(result, { resource, target });\n const content = describeResult(result, target.action.label, intl);\n const hasDetails = (result.results ?? []).length > 0;\n const download = result.download ?? null;\n if (download !== null) {\n onDownload(download);\n }\n toasts.show({\n ...content,\n ...(hasDetails\n ? {\n action: {\n label: intl.formatMessage(messages.details),\n onAction: () => setDetails({ label: target.action.label, result }),\n },\n }\n : download !== null\n ? {\n action: {\n label: intl.formatMessage(messages.download),\n onAction: () => onDownload(download),\n },\n }\n : {}),\n });\n const redirect = result.redirect ?? null;\n if (redirect !== null) {\n onNavigate(redirect);\n }\n };\n\n const follow = (resource: string, target: ActionTarget, run: ActionRun) => {\n setRuns((current) => [\n ...current.filter((entry) => entry.run.id !== run.id),\n { run, resource, target },\n ]);\n toasts.show({\n title: intl.formatMessage(messages.queued, { action: target.action.label }),\n description: intl.formatMessage(messages.queuedDescription),\n tone: 'info',\n });\n };\n\n const ended = async (entry: FollowedRun) => {\n const { run, resource, target } = entry;\n if (notified.current.has(run.id)) {\n return;\n }\n notified.current.add(run.id);\n if (run.result !== undefined) {\n await finish(resource, target, run.result);\n } else if (run.status === 'cancelled') {\n toasts.show({\n title: intl.formatMessage(messages.cancelled, { action: target.action.label }),\n });\n } else if (run.status === 'failed') {\n toasts.show({\n title: intl.formatMessage(messages.failed, { action: target.action.label }),\n tone: 'danger',\n });\n } else {\n toasts.show({\n title: intl.formatMessage(messages.done, { action: target.action.label }),\n tone: 'success',\n });\n }\n };\n\n const execute = async (\n resource: string,\n target: ActionTarget,\n values: Record<string, unknown> = {},\n ): Promise<ActionOutcome> => {\n const response = await adapter.runAction(\n resource,\n target.action.id,\n buildActionRequest(target, values),\n );\n if (response.run !== undefined) {\n follow(resource, target, response.run);\n return { status: 'queued', run: response.run };\n }\n await finish(resource, target, response.result);\n return { status: 'done', result: response.result };\n };\n\n const run = (resource: string, target: ActionTarget): Promise<ActionOutcome | false> => {\n const { action } = target;\n if (action.kind === 'link') {\n const to = getLinkTarget(target);\n if (to === null) {\n return Promise.reject(new Error(`The action \"${action.id}\" has no URL or route.`));\n }\n onNavigate(to);\n return Promise.resolve({ status: 'navigated', to });\n }\n if (action.kind === 'client') {\n const name = action.component ?? '';\n const Handler =\n (clientActions !== undefined && Object.hasOwn(clientActions, name)\n ? clientActions[name]\n : undefined) ?? (plugins.actions.get(name) as ClientActionHandler | undefined);\n if (Handler === undefined) {\n return Promise.reject(\n new Error(`No handler for the client action \"${action.id}\" (${name}).`),\n );\n }\n return new Promise((resolve) => setClient({ resource, target, resolve, Handler }));\n }\n if ((action.fields ?? []).length > 0) {\n return new Promise((resolve) => setParameters({ resource, target, resolve }));\n }\n return execute(resource, target);\n };\n\n const cancelRun = async (id: string) => {\n if (adapter.cancelActionRun === undefined) {\n throw new Error('The adapter cannot cancel runs.');\n }\n await adapter.cancelActionRun(id);\n const updated = await adapter.getActionRun(id);\n setRuns((current) =>\n current.map((entry) => (entry.run.id === id ? { ...entry, run: updated } : entry)),\n );\n const entry = runs.find((candidate) => candidate.run.id === id);\n if (entry !== undefined && isFinished(updated.status)) {\n await ended({ ...entry, run: updated });\n }\n };\n\n const dismissRun = (id: string) =>\n setRuns((current) => current.filter((entry) => entry.run.id !== id));\n\n const onRunEnded = useEffectEvent((entry: FollowedRun) => ended(entry));\n\n // Checks the unfinished runs, one interval after the last change of the runs.\n useEffect(() => {\n const active = runs.filter((entry) => !isFinished(entry.run.status));\n if (active.length === 0) {\n return undefined;\n }\n let stopped = false;\n const timer = setTimeout(() => {\n void Promise.all(\n active.map(async (entry) => {\n try {\n const next = await adapter.getActionRun(entry.run.id);\n if (stopped) {\n return;\n }\n setRuns((current) =>\n current.map((candidate) =>\n candidate.run.id === next.id\n ? { ...candidate, run: next }\n : candidate,\n ),\n );\n if (isFinished(next.status)) {\n await onRunEnded({ ...entry, run: next });\n }\n } catch {\n // Checked again at the next interval.\n if (!stopped) {\n setRuns((current) => [...current]);\n }\n }\n }),\n );\n }, pollInterval);\n return () => {\n stopped = true;\n clearTimeout(timer);\n };\n }, [runs, adapter, pollInterval]);\n\n const value: ActionRunnerContextValue = { adapter, run, runs, cancelRun, dismissRun };\n\n const ClientHandler = client?.Handler;\n return (\n <ActionRunnerContext value={value}>\n {children}\n {parameters !== null ? (\n <ParametersDialog\n action={parameters.target.action}\n count={parameters.target.count}\n locales={locales}\n onSubmit={(values) => execute(parameters.resource, parameters.target, values)}\n onDone={(outcome) => {\n setParameters(null);\n parameters.resolve(outcome);\n }}\n onCancel={() => {\n setParameters(null);\n parameters.resolve(false);\n }}\n />\n ) : null}\n {client !== null && ClientHandler !== undefined ? (\n <ClientHandler\n action={client.target.action}\n resource={client.resource}\n target={client.target}\n onDone={(result) => {\n setClient(null);\n if (result === undefined) {\n client.resolve({ status: 'done', result: {} });\n return;\n }\n void finish(client.resource, client.target, result).then(() =>\n client.resolve({ status: 'done', result }),\n );\n }}\n onCancel={() => {\n setClient(null);\n client.resolve(false);\n }}\n />\n ) : null}\n {details !== null ? (\n <ResultsDialog\n label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Ref","useState","resolveEntry","usePanneau","getActionLabel","ActionResult","ActionRun","RouteReference","usePanneauIntl","useToast","ParametersDialog","ResultsDialog","ActionRunnerContext","ActionRunnerContextValue","describeResult","describeSubject","getChangedItems","getItemTitle","isInUse","messages","buildActionRequest","getLinkTarget","getResultCounts","isFinished","ActionAdapter","ActionDownload","ActionOutcome","ActionResultContext","ActionTarget","ClientActionHandler","FollowedRun","ActionRunnerProviderProps","adapter","children","onResult","result","context","onNavigate","to","onShowItems","resource","ids","onDownload","download","clientActions","Readonly","Record","pollInterval","locales","Pending","target","resolve","outcome","ClientPending","Handler","navigateTo","window","location","assign","console","warn","route","openDownload","link","document","createElement","href","url","filename","undefined","rel","hidden","body","append","click","remove","ActionRunnerProvider","t0","$","_c","t1","t2","t3","intl","toasts","definition","plugins","parameters","setParameters","client","setClient","details","setDetails","t4","Symbol","for","runs","setRuns","t5","Set","notified","watchers","t6","resources","t7","count","find","candidate","id","subjectOf","resource_0","target_0","item","itemTitle","candidate_0","locale","itemTitleOf","toastKey","_temp","finish","follow","resource_2","target_2","t8","queued","t9","counts","itemTitle_0","content","action","succeeded","entries","results","hasDetails","length","redirect","saysMore","message","current","undo","changed","show","label","formatMessage","onAction","runUndo","showChanged","key","resource_3","target_3","undo_0","declared","candidate_1","actions","undoTarget","kind","scope","selection","items","runAction","values","params","then","response","run","subject","title","undoneFor","undone","catch","error","undoFailed","Error","description","tone","resource_4","target_4","filter","entry","entry_0","run_0","resource_5","target_5","has","add","action_0","subject_0","key_0","status","cancelledFor","cancelled","failedFor","failed","doneFor","done","ended","resource_6","target_6","t10","response_0","execute","resource_7","target_7","action_1","Promise","reject","name","component","overrides","fields","resolve_0","run_1","t11","cancelActionRun","updated","getActionRun","current_0","map","entry_1","entry_2","candidate_2","cancelRun","t12","id_0","current_1","entry_3","dismissRun","t13","entry_4","onRunEnded","t14","active","_temp2","stopped","timer","setTimeout","all","entry_6","next","current_3","candidate_3","_temp3","clearTimeout","t15","t16","watchRuns","t17","value","ClientHandler","t18","values_0","t19","result_0","t20","t21","current_2","entry_5","resource_1","target_1","_c"],"sources":["../src/ActionRunnerProvider.tsx"],"sourcesContent":["import { type ReactNode, useEffect, useEffectEvent, useRef, useState } from 'react';\n\nimport { resolveEntry, usePanneau } from '@panneau/core';\nimport { getActionLabel } from '@panneau/intl';\nimport type { ActionResult, ActionRun, RouteReference } from '@panneau/protocol';\nimport { usePanneauIntl, useToast } from '@panneau/ui';\n\nimport { ParametersDialog } from './ParametersDialog';\nimport { ResultsDialog } from './ResultsDialog';\nimport { ActionRunnerContext, type ActionRunnerContextValue } from './context';\nimport {\n describeResult,\n describeSubject,\n getChangedItems,\n getItemTitle,\n isInUse,\n} from './describe';\nimport { messages } from './messages';\nimport { buildActionRequest, getLinkTarget, getResultCounts, isFinished } from './request';\nimport type {\n ActionAdapter,\n ActionDownload,\n ActionOutcome,\n ActionResultContext,\n ActionTarget,\n ClientActionHandler,\n FollowedRun,\n} from './types';\n\nexport interface ActionRunnerProviderProps {\n /** Runs the actions: a `DataAdapter`, or any object with its action methods. */\n adapter: ActionAdapter;\n children?: ReactNode;\n /**\n * Called with every result: of an action that finished at once, and of a queued run when it\n * finishes. Refresh what it changed here. With `@panneau/data/query`:\n * `invalidateActionResult(client, resource, result, target.selection)`.\n */\n onResult?: (result: ActionResult, context: ActionResultContext) => unknown;\n /**\n * Goes to the `redirect` of a result, or to the URL or route of a `link` action. Defaults to\n * `window.location.assign()` for URLs; routes need it.\n */\n onNavigate?: (to: string | RouteReference) => void;\n /**\n * Opens the list of a resource filtered on the items a run changed (`filter[ids]`, decision\n * 0069). With it, the toast of a run offers \"Show\" when it has nothing more to say: no \"Undo\",\n * \"Details\" or \"Download\". Without it, there is no \"Show\".\n */\n onShowItems?: (resource: string, ids: readonly string[]) => void;\n /** Opens the `download` of a result. Defaults to a link to its URL, clicked. */\n onDownload?: (download: ActionDownload) => void;\n /** Handlers of `client` actions by their `component`, over those of the plugins. */\n clientActions?: Readonly<Record<string, ClientActionHandler>>;\n /** Milliseconds between two checks of a queued run. Defaults to 2000. */\n pollInterval?: number;\n /** Locales of localized parameters. Defaults to the definition's. */\n locales?: readonly string[];\n}\n\ninterface Pending {\n resource: string;\n target: ActionTarget;\n resolve: (outcome: ActionOutcome | false) => void;\n}\n\ninterface ClientPending extends Pending {\n Handler: ClientActionHandler;\n}\n\nfunction navigateTo(to: string | RouteReference) {\n if (typeof to === 'string') {\n window.location.assign(to);\n } else {\n console.warn(\n `[panneau] An action goes to the route \"${to.route}\": give ActionRunnerProvider an onNavigate.`,\n );\n }\n}\n\nfunction openDownload(download: ActionDownload) {\n const link = document.createElement('a');\n link.href = download.url;\n if (download.filename !== undefined) {\n link.download = download.filename;\n }\n link.rel = 'noopener';\n link.hidden = true;\n document.body.append(link);\n link.click();\n link.remove();\n}\n\n/**\n * Runs the actions that lists and forms hand over ([decision 0023]): it asks for their parameters\n * in a dialog, runs them through the adapter, shows their result (a toast, and the items that\n * didn't succeed), follows queued runs until they end, refreshes through `onResult`, follows\n * redirects and opens downloads. Put it inside `PanneauRoot`, and above the router of an app, so\n * that runs are followed from page to page. `useActionRunner(resource)` runs an action.\n */\nexport function ActionRunnerProvider({\n adapter,\n children,\n onResult,\n onNavigate = navigateTo,\n onDownload = openDownload,\n onShowItems,\n clientActions,\n pollInterval = 2000,\n locales,\n}: ActionRunnerProviderProps) {\n const intl = usePanneauIntl();\n const toasts = useToast();\n const { definition, plugins } = usePanneau();\n const [parameters, setParameters] = useState<Pending | null>(null);\n const [client, setClient] = useState<ClientPending | null>(null);\n const [details, setDetails] = useState<{ label: string; result: ActionResult } | null>(null);\n const [runs, setRuns] = useState<readonly FollowedRun[]>([]);\n // Runs whose end was already shown, so that a late poll doesn't show it twice.\n const notified = useRef(new Set<string>());\n // How many lists of runs are on screen (the popover of the runs): their user sees a run end.\n const watchers = useRef(0);\n\n /** What the action applied to, by the item's title or the count of items. */\n const subjectOf = (resource: string, target: ActionTarget, count: number | null = null) =>\n describeSubject(\n target,\n definition?.resources.find((candidate) => candidate.id === resource),\n intl,\n count,\n );\n\n /** The title of the item of an `item` action, to name it. */\n const itemTitleOf = (resource: string, target: ActionTarget) => {\n if (target.item === undefined) {\n return null;\n }\n const itemTitle = definition?.resources.find(\n (candidate) => candidate.id === resource,\n )?.itemTitle;\n return getItemTitle(target.item, itemTitle, intl.locale);\n };\n\n /** One toast per action and target: running it again replaces it. */\n const toastKey = (resource: string, target: ActionTarget) =>\n `panneau-action:${resource}:${target.action.id}:${target.item?.id ?? 'selection'}`;\n\n const finish = async (\n resource: string,\n target: ActionTarget,\n result: ActionResult,\n { queued = false }: { queued?: boolean } = {},\n ) => {\n await onResult?.(result, { resource, target });\n const counts = getResultCounts(result);\n const itemTitle = itemTitleOf(resource, target);\n const content = describeResult(\n result,\n getActionLabel(target.action, intl),\n intl,\n subjectOf(resource, target, counts.succeeded),\n itemTitle,\n );\n const entries = result.results ?? [];\n // The toast already names an item that is in use: its details would only repeat it.\n const hasDetails =\n entries.length > 0 &&\n !(\n entries.length === 1 &&\n entries[0] !== undefined &&\n isInUse(entries[0]) &&\n itemTitle !== null\n );\n const download = result.download ?? null;\n if (download !== null) {\n onDownload(download);\n }\n const redirect = result.redirect ?? null;\n // A queued run that ends in the open list of runs is seen there, unless its result says\n // more than its status: a message, items that didn't succeed, a download.\n const saysMore = (result.message ?? '') !== '' || hasDetails || download !== null;\n if (queued && watchers.current > 0 && !saysMore) {\n if (redirect !== null) {\n onNavigate(redirect);\n }\n return;\n }\n // \"Undo\" lives in the toast only (decision 0063): a queued run, which finished later, isn't\n // undone.\n const undo = !queued ? (result.undo ?? null) : null;\n // \"Show\" comes after what says more, and not when the run goes somewhere else.\n const changed =\n onShowItems !== undefined && redirect === null ? getChangedItems(target, result) : null;\n toasts.show(\n {\n ...content,\n ...(undo !== null\n ? {\n action: {\n label: intl.formatMessage(messages.undo),\n onAction: () => void runUndo(resource, target, undo),\n },\n }\n : hasDetails\n ? {\n action: {\n label: intl.formatMessage(messages.details),\n onAction: () =>\n setDetails({\n label: getActionLabel(target.action, intl),\n result,\n }),\n },\n }\n : download !== null\n ? {\n action: {\n label: intl.formatMessage(messages.download),\n onAction: () => onDownload(download),\n },\n }\n : changed !== null\n ? {\n action: {\n label: intl.formatMessage(messages.showChanged),\n onAction: () => onShowItems?.(resource, changed),\n },\n }\n : {}),\n },\n { key: toastKey(resource, target) },\n );\n if (redirect !== null) {\n onNavigate(redirect);\n }\n };\n\n /**\n * Runs the undo of a result: an action of the same resource, on the items it lists, as any\n * action. A short toast then says it was undone, in place of the first one.\n */\n const runUndo = async (\n resource: string,\n target: ActionTarget,\n undo: NonNullable<ActionResult['undo']>,\n ) => {\n const label = getActionLabel(target.action, intl);\n const key = { key: toastKey(resource, target) };\n const declared = definition?.resources\n .find((candidate) => candidate.id === resource)\n ?.actions?.find((action) => action.id === undo.action);\n const undoTarget: ActionTarget = {\n action: declared ?? { id: undo.action, kind: 'server', scope: ['selection'] },\n scope: 'selection',\n selection: { ids: undo.items },\n count: undo.items.length,\n };\n await adapter\n .runAction(resource, undo.action, {\n selection: { ids: undo.items },\n values: undo.params ?? {},\n })\n .then(async (response) => {\n if (response.run !== undefined) {\n follow(resource, undoTarget, response.run);\n return;\n }\n await onResult?.(response.result, { resource, target: undoTarget });\n const subject = subjectOf(resource, target, undo.items.length);\n toasts.show(\n {\n title:\n subject !== null\n ? intl.formatMessage(messages.undoneFor, {\n action: label,\n subject,\n })\n : intl.formatMessage(messages.undone, { action: label }),\n },\n key,\n );\n })\n .catch((error: unknown) => {\n toasts.show(\n {\n title: intl.formatMessage(messages.undoFailed, { action: label }),\n ...(error instanceof Error && error.message !== ''\n ? { description: error.message }\n : {}),\n tone: 'danger',\n },\n key,\n );\n });\n };\n\n // No toast when a run starts: the runs button of the shell shows it, and its popover follows\n // it. The toast comes when the run ends.\n const follow = (resource: string, target: ActionTarget, run: ActionRun) => {\n setRuns((current) => [\n ...current.filter((entry) => entry.run.id !== run.id),\n { run, resource, target },\n ]);\n };\n\n const ended = async (entry: FollowedRun) => {\n const { run, resource, target } = entry;\n if (notified.current.has(run.id)) {\n return;\n }\n notified.current.add(run.id);\n if (run.result !== undefined) {\n await finish(resource, target, run.result, { queued: true });\n return;\n }\n const action = getActionLabel(target.action, intl);\n const subject = subjectOf(resource, target);\n const key = { key: toastKey(resource, target) };\n if (run.status === 'cancelled') {\n toasts.show(\n {\n title:\n subject !== null\n ? intl.formatMessage(messages.cancelledFor, { action, subject })\n : intl.formatMessage(messages.cancelled, { action }),\n },\n key,\n );\n } else if (run.status === 'failed') {\n toasts.show(\n {\n title:\n subject !== null\n ? intl.formatMessage(messages.failedFor, { action, subject })\n : intl.formatMessage(messages.failed, { action }),\n tone: 'danger',\n },\n key,\n );\n } else if (watchers.current === 0) {\n toasts.show(\n {\n title:\n subject !== null\n ? intl.formatMessage(messages.doneFor, { action, subject })\n : intl.formatMessage(messages.done, { action }),\n tone: 'success',\n },\n key,\n );\n }\n };\n\n const execute = async (\n resource: string,\n target: ActionTarget,\n values: Record<string, unknown> = {},\n ): Promise<ActionOutcome> => {\n const response = await adapter.runAction(\n resource,\n target.action.id,\n buildActionRequest(target, values),\n );\n if (response.run !== undefined) {\n follow(resource, target, response.run);\n return { status: 'queued', run: response.run };\n }\n await finish(resource, target, response.result);\n return { status: 'done', result: response.result };\n };\n\n const run = (resource: string, target: ActionTarget): Promise<ActionOutcome | false> => {\n const { action } = target;\n if (action.kind === 'link') {\n const to = getLinkTarget(target);\n if (to === null) {\n return Promise.reject(new Error(`The action \"${action.id}\" has no URL or route.`));\n }\n onNavigate(to);\n return Promise.resolve({ status: 'navigated', to });\n }\n if (action.kind === 'client') {\n const name = action.component ?? '';\n const Handler = resolveEntry(plugins, 'actions', name, { overrides: clientActions });\n if (Handler === undefined) {\n return Promise.reject(\n new Error(`No handler for the client action \"${action.id}\" (${name}).`),\n );\n }\n return new Promise((resolve) => setClient({ resource, target, resolve, Handler }));\n }\n if ((action.fields ?? []).length > 0) {\n return new Promise((resolve) => setParameters({ resource, target, resolve }));\n }\n return execute(resource, target);\n };\n\n const cancelRun = async (id: string) => {\n if (adapter.cancelActionRun === undefined) {\n throw new Error('The adapter cannot cancel runs.');\n }\n await adapter.cancelActionRun(id);\n const updated = await adapter.getActionRun(id);\n setRuns((current) =>\n current.map((entry) => (entry.run.id === id ? { ...entry, run: updated } : entry)),\n );\n const entry = runs.find((candidate) => candidate.run.id === id);\n if (entry !== undefined && isFinished(updated.status)) {\n await ended({ ...entry, run: updated });\n }\n };\n\n const dismissRun = (id: string) =>\n setRuns((current) => current.filter((entry) => entry.run.id !== id));\n\n const onRunEnded = useEffectEvent((entry: FollowedRun) => ended(entry));\n\n // Checks the unfinished runs, one interval after the last change of the runs.\n useEffect(() => {\n const active = runs.filter((entry) => !isFinished(entry.run.status));\n if (active.length === 0) {\n return undefined;\n }\n let stopped = false;\n const timer = setTimeout(() => {\n void Promise.all(\n active.map(async (entry) => {\n try {\n const next = await adapter.getActionRun(entry.run.id);\n if (stopped) {\n return;\n }\n setRuns((current) =>\n current.map((candidate) =>\n candidate.run.id === next.id\n ? { ...candidate, run: next }\n : candidate,\n ),\n );\n if (isFinished(next.status)) {\n await onRunEnded({ ...entry, run: next });\n }\n } catch {\n // Checked again at the next interval.\n if (!stopped) {\n setRuns((current) => [...current]);\n }\n }\n }),\n );\n }, pollInterval);\n return () => {\n stopped = true;\n clearTimeout(timer);\n };\n }, [runs, adapter, pollInterval]);\n\n const watchRuns = () => {\n watchers.current += 1;\n return () => {\n watchers.current -= 1;\n };\n };\n\n const value: ActionRunnerContextValue = {\n adapter,\n run,\n runs,\n cancelRun,\n dismissRun,\n watchRuns,\n };\n\n const ClientHandler = client?.Handler;\n return (\n <ActionRunnerContext value={value}>\n {children}\n {parameters !== null ? (\n <ParametersDialog\n action={parameters.target.action}\n count={parameters.target.count}\n locales={locales}\n onSubmit={(values) => execute(parameters.resource, parameters.target, values)}\n onDone={(outcome) => {\n setParameters(null);\n parameters.resolve(outcome);\n }}\n onCancel={() => {\n setParameters(null);\n parameters.resolve(false);\n }}\n />\n ) : null}\n {client !== null && ClientHandler !== undefined ? (\n <ClientHandler\n action={client.target.action}\n resource={client.resource}\n target={client.target}\n onDone={(result) => {\n setClient(null);\n if (result === undefined) {\n client.resolve({ status: 'done', result: {} });\n return;\n }\n void finish(client.resource, client.target, result).then(() =>\n client.resolve({ status: 'done', result }),\n );\n }}\n onCancel={() => {\n setClient(null);\n client.resolve(false);\n }}\n />\n ) : null}\n {details !== null ? (\n <ResultsDialog\n label={details.label}\n result={details.result}\n onClose={() => setDetails(null)}\n />\n ) : null}\n </ActionRunnerContext>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAsEA,SAAS0D,WAAWjB,IAA6B;CAC7C,IAAI,OAAOA,OAAO,UACdkB,OAAOC,SAASC,OAAOpB,EAAE;MAEzBqB,QAAQC,KACJ,0CAA0CtB,GAAGuB,MAAK,4CACtD;AAER;AAEA,SAASC,aAAanB,UAA0B;CAC5C,MAAMoB,OAAOC,SAASC,cAAc,GAAG;CACvCF,KAAKG,OAAOvB,SAASwB;CACrB,IAAIxB,SAASyB,aAAaC,KAAAA,GACtBN,KAAKpB,WAAWA,SAASyB;CAE7BL,KAAKO,MAAM;CACXP,KAAKQ,SAAS;CACdP,SAASQ,KAAKC,OAAOV,IAAI;CACzBA,KAAKW,MAAM;CACXX,KAAKY,OAAO;AAChB;;;;;;;;AASA,SAAOC,qBAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAA8B,MAAA,EAAA/C,SAAAC,UAAAC,UAAAG,YAAA2C,IAAAtC,YAAAuC,IAAA1C,aAAAK,eAAAG,cAAAmC,IAAAlC,YAAA6B;CAIjC,MAAAxC,aAAA2C,OAAAX,KAAAA,IAAAd,aAAAyB;CACA,MAAAtC,aAAAuC,OAAAZ,KAAAA,IAAAP,eAAAmB;CAGA,MAAAlC,eAAAmC,OAAAb,KAAAA,IAAA,MAAAa;CAGA,MAAAC,OAAa3E,eAAe;CAC5B,MA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ACN,QAAAnD,QAAOxD;GACN,eAAMyD,WAAW,IAAI;EAAC,CAAA,IAJtC;EAMOd,EAAA,MAAAa;EAAAb,EAAA,MAAA+K;CAAA,OAAAA,MAAA/K,EAAA;CAAA,IAAAgL;CAAA,IAAAhL,EAAA,QAAA7C,YAAA6C,EAAA,QAAA2K,OAAA3K,EAAA,QAAA6K,OAAA7K,EAAA,QAAA+K,OAAA/K,EAAA,QAAAyK,OAAA;EA7CZO,MAAA,qBAAC,qBAAD;GAA4BP;GAA5B,UAAA;IACKtN;IACAwN;IAgBAE;IAqBAE;GAvCe;;EA8CE/K,EAAA,MAAA7C;EAAA6C,EAAA,MAAA2K;EAAA3K,EAAA,MAAA6K;EAAA7K,EAAA,MAAA+K;EAAA/K,EAAA,MAAAyK;EAAAzK,EAAA,MAAAgL;CAAA,OAAAA,MAAAhL,EAAA;CAAA,OA9CtBgL;AA8CsB;AAravB,SAAAb,OAAAc,WAAA;CAAA,OAyV0C,CAAA,GAAIrH,SAAO;AAAC;AAzVtD,SAAA8F,OAAAwB,SAAA;CAAA,OA+TuC,CAACzO,WAAW2J,QAAKd,IAAIwB,MAAO;AAAC;AA/TpE,SAAAtE,MAAA2I,YAAAC,UAAA;CAAA,OA6CC,kBAAkB1N,WAAQ,GAAIU,SAAM+E,OAAOrB,GAAG,GAAI1D,SAAM8D,MAASJ,MAAf;AAAgC"}
|
package/dist/ActionRuns.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionRuns.d.ts","sourceRoot":"","sources":["../src/ActionRuns.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ActionRuns.d.ts","sourceRoot":"","sources":["../src/ActionRuns.tsx"],"names":[],"mappings":"AAsBA,MAAM,WAAW,eAAe;IAC5B,sEAAsE;IACtE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,EAAE,eAAe,sCAgFjF"}
|
package/dist/ActionRuns.js
CHANGED
|
@@ -2,9 +2,10 @@ import ActionRunner_module_default from "./ActionRunner.module.js";
|
|
|
2
2
|
import { messages } from "./messages.js";
|
|
3
3
|
import { isFinished } from "./request.js";
|
|
4
4
|
import { ActionRunnerContext } from "./context.js";
|
|
5
|
-
import { use } from "react";
|
|
6
|
-
import { Button, IconButton, usePanneauIntl } from "@panneau/ui";
|
|
7
5
|
import { c } from "react/compiler-runtime";
|
|
6
|
+
import { use, useEffect } from "react";
|
|
7
|
+
import { getActionLabel } from "@panneau/intl";
|
|
8
|
+
import { Button, IconButton, usePanneauIntl } from "@panneau/ui";
|
|
8
9
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
9
10
|
import { X } from "lucide-react";
|
|
10
11
|
import { ProgressBar } from "react-aria-components";
|
|
@@ -23,31 +24,44 @@ var STATUS_MESSAGES = {
|
|
|
23
24
|
* that have. For a notification area. Renders nothing without runs.
|
|
24
25
|
*/
|
|
25
26
|
function ActionRuns(t0) {
|
|
26
|
-
const $ = c(
|
|
27
|
+
const $ = c(16);
|
|
27
28
|
const { "aria-label": ariaLabel, className } = t0;
|
|
28
29
|
const intl = usePanneauIntl();
|
|
29
30
|
const context = use(ActionRunnerContext);
|
|
30
|
-
if (context === null || context.runs.length === 0) return null;
|
|
31
|
-
const canCancel = context.adapter.cancelActionRun !== void 0;
|
|
32
31
|
let t1;
|
|
33
|
-
if ($[0] !== ariaLabel || $[1] !== intl) {
|
|
34
|
-
t1 = ariaLabel ?? intl.formatMessage(messages.runs);
|
|
35
|
-
$[0] = ariaLabel;
|
|
36
|
-
$[1] = intl;
|
|
37
|
-
$[2] = t1;
|
|
38
|
-
} else t1 = $[2];
|
|
39
32
|
let t2;
|
|
40
|
-
if ($[
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
$[
|
|
44
|
-
|
|
45
|
-
|
|
33
|
+
if ($[0] !== context) {
|
|
34
|
+
t1 = () => context?.watchRuns();
|
|
35
|
+
t2 = [context];
|
|
36
|
+
$[0] = context;
|
|
37
|
+
$[1] = t1;
|
|
38
|
+
$[2] = t2;
|
|
39
|
+
} else {
|
|
40
|
+
t1 = $[1];
|
|
41
|
+
t2 = $[2];
|
|
42
|
+
}
|
|
43
|
+
useEffect(t1, t2);
|
|
44
|
+
if (context === null || context.runs.length === 0) return null;
|
|
45
|
+
const canCancel = context.adapter.cancelActionRun !== void 0;
|
|
46
|
+
let t3;
|
|
47
|
+
if ($[3] !== ariaLabel || $[4] !== intl) {
|
|
48
|
+
t3 = ariaLabel ?? intl.formatMessage(messages.runs);
|
|
49
|
+
$[3] = ariaLabel;
|
|
50
|
+
$[4] = intl;
|
|
51
|
+
$[5] = t3;
|
|
52
|
+
} else t3 = $[5];
|
|
46
53
|
let t4;
|
|
47
|
-
if ($[
|
|
48
|
-
t4 =
|
|
49
|
-
|
|
50
|
-
|
|
54
|
+
if ($[6] !== className) {
|
|
55
|
+
t4 = [ActionRunner_module_default.runs, className].filter(Boolean);
|
|
56
|
+
$[6] = className;
|
|
57
|
+
$[7] = t4;
|
|
58
|
+
} else t4 = $[7];
|
|
59
|
+
const t5 = t4.join(" ");
|
|
60
|
+
let t6;
|
|
61
|
+
if ($[8] !== canCancel || $[9] !== context || $[10] !== intl) {
|
|
62
|
+
t6 = context.runs.map((t7) => {
|
|
63
|
+
const { run, target } = t7;
|
|
64
|
+
const label = getActionLabel(target.action, intl);
|
|
51
65
|
const finished = isFinished(run.status);
|
|
52
66
|
const status = intl.formatMessage(STATUS_MESSAGES[run.status]);
|
|
53
67
|
return /* @__PURE__ */ jsxs("li", {
|
|
@@ -64,7 +78,7 @@ function ActionRuns(t0) {
|
|
|
64
78
|
onPress: () => context.dismissRun(run.id)
|
|
65
79
|
}) : canCancel ? /* @__PURE__ */ jsx(Button, {
|
|
66
80
|
size: "sm",
|
|
67
|
-
|
|
81
|
+
appearance: "ghost",
|
|
68
82
|
"aria-label": intl.formatMessage(messages.cancelRun, { action: label }),
|
|
69
83
|
onPress: () => {
|
|
70
84
|
context.cancelRun(run.id).catch(_temp);
|
|
@@ -89,24 +103,24 @@ function ActionRuns(t0) {
|
|
|
89
103
|
]
|
|
90
104
|
}, run.id);
|
|
91
105
|
});
|
|
92
|
-
$[
|
|
93
|
-
$[
|
|
94
|
-
$[
|
|
95
|
-
$[
|
|
96
|
-
} else
|
|
97
|
-
let
|
|
98
|
-
if ($[
|
|
99
|
-
|
|
100
|
-
"aria-label":
|
|
101
|
-
className:
|
|
102
|
-
children:
|
|
106
|
+
$[8] = canCancel;
|
|
107
|
+
$[9] = context;
|
|
108
|
+
$[10] = intl;
|
|
109
|
+
$[11] = t6;
|
|
110
|
+
} else t6 = $[11];
|
|
111
|
+
let t7;
|
|
112
|
+
if ($[12] !== t3 || $[13] !== t5 || $[14] !== t6) {
|
|
113
|
+
t7 = /* @__PURE__ */ jsx("ul", {
|
|
114
|
+
"aria-label": t3,
|
|
115
|
+
className: t5,
|
|
116
|
+
children: t6
|
|
103
117
|
});
|
|
104
|
-
$[
|
|
105
|
-
$[
|
|
106
|
-
$[
|
|
107
|
-
$[
|
|
108
|
-
} else
|
|
109
|
-
return
|
|
118
|
+
$[12] = t3;
|
|
119
|
+
$[13] = t5;
|
|
120
|
+
$[14] = t6;
|
|
121
|
+
$[15] = t7;
|
|
122
|
+
} else t7 = $[15];
|
|
123
|
+
return t7;
|
|
110
124
|
}
|
|
111
125
|
function _temp2(t0) {
|
|
112
126
|
const { percentage, valueText } = t0;
|
package/dist/ActionRuns.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionRuns.js","names":["label","
|
|
1
|
+
{"version":3,"file":"ActionRuns.js","names":["X","use","useEffect","ProgressBar","getActionLabel","ActionRun","Button","IconButton","usePanneauIntl","styles","ActionRunnerContext","messages","isFinished","STATUS_MESSAGES","queued","runQueued","running","runRunning","succeeded","runSucceeded","partial","runPartial","failed","runFailed","cancelled","runCancelled","Record","ActionRunsProps","className","ActionRuns","t0","$","_c","ariaLabel","intl","context","t1","t2","watchRuns","runs","length","canCancel","adapter","cancelActionRun","undefined","t3","formatMessage","t4","filter","Boolean","t5","join","t6","map","t7","run","target","label","action","finished","status","id","runLabel","dismissRun","cancelRun","catch","_temp","cancel","runStatus","progress","total","_temp2","percentage","valueText","track","fill","width","_c","styles","_Fragment"],"sources":["../src/ActionRuns.tsx"],"sourcesContent":["import { X } from 'lucide-react';\nimport { use, useEffect } from 'react';\nimport { ProgressBar } from 'react-aria-components';\n\nimport { getActionLabel } from '@panneau/intl';\nimport type { ActionRun } from '@panneau/protocol';\nimport { Button, IconButton, usePanneauIntl } from '@panneau/ui';\n\nimport styles from './ActionRunner.module.css';\nimport { ActionRunnerContext } from './context';\nimport { messages } from './messages';\nimport { isFinished } from './request';\n\nconst STATUS_MESSAGES = {\n queued: messages.runQueued,\n running: messages.runRunning,\n succeeded: messages.runSucceeded,\n partial: messages.runPartial,\n failed: messages.runFailed,\n cancelled: messages.runCancelled,\n} satisfies Record<ActionRun['status'], unknown>;\n\nexport interface ActionRunsProps {\n /** Accessible name of the list. Defaults to \"Actions in progress\". */\n 'aria-label'?: string;\n className?: string;\n}\n\n/**\n * The queued runs that the closest `ActionRunnerProvider` follows: their status and progress, a\n * button to cancel those that haven't finished (when the adapter can), and one to dismiss those\n * that have. For a notification area. Renders nothing without runs.\n */\nexport function ActionRuns({ 'aria-label': ariaLabel, className }: ActionRunsProps) {\n const intl = usePanneauIntl();\n const context = use(ActionRunnerContext);\n // Its user sees the runs that end here: the runner shows no toast for them.\n useEffect(() => context?.watchRuns(), [context]);\n if (context === null || context.runs.length === 0) {\n return null;\n }\n const canCancel = context.adapter.cancelActionRun !== undefined;\n return (\n <ul\n aria-label={ariaLabel ?? intl.formatMessage(messages.runs)}\n className={[styles.runs, className].filter(Boolean).join(' ')}\n >\n {context.runs.map(({ run, target }) => {\n const label = getActionLabel(target.action, intl);\n const finished = isFinished(run.status);\n const status = intl.formatMessage(STATUS_MESSAGES[run.status]);\n return (\n <li key={run.id} className={styles.run}>\n <span className={styles.runLabel}>{label}</span>\n {finished ? (\n <IconButton\n icon={X}\n size=\"sm\"\n label={intl.formatMessage(messages.dismissRun, { action: label })}\n onPress={() => context.dismissRun(run.id)}\n />\n ) : canCancel ? (\n <Button\n size=\"sm\"\n appearance=\"ghost\"\n aria-label={intl.formatMessage(messages.cancelRun, {\n action: label,\n })}\n onPress={() => {\n context.cancelRun(run.id).catch(() => undefined);\n }}\n >\n {intl.formatMessage(messages.cancel)}\n </Button>\n ) : (\n <span />\n )}\n {finished ? (\n <span className={styles.runStatus}>{status}</span>\n ) : (\n <ProgressBar\n aria-label={label}\n className={styles.progress}\n value={run.progress}\n maxValue={run.total ?? undefined}\n isIndeterminate={run.total === null || run.total === 0}\n valueLabel={\n run.total !== null && run.total > 0\n ? intl.formatMessage(messages.progress, {\n progress: run.progress,\n total: run.total,\n })\n : status\n }\n >\n {({ percentage, valueText }) => (\n <>\n <span className={styles.runStatus}>{valueText}</span>\n <span className={styles.track}>\n <span\n className={styles.fill}\n style={{ width: `${percentage ?? 100}%` }}\n />\n </span>\n </>\n )}\n </ProgressBar>\n )}\n </li>\n );\n })}\n </ul>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAaA,IAAMa,kBAAkB;CACpBC,QAAQH,SAASI;CACjBC,SAASL,SAASM;CAClBC,WAAWP,SAASQ;CACpBC,SAAST,SAASU;CAClBC,QAAQX,SAASY;CACjBC,WAAWb,SAASc;AACxB;;;;;;AAaA,SAAOI,WAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAoB,MAAA,EAAA,cAAAC,WAAAL,cAAAE;CACvB,MAAAI,OAAa1B,eAAe;CAC5B,MAAA2B,UAAgBlC,IAAIS,mBAAmB;CAAE,IAAA0B;CAAA,IAAAC;CAAA,IAAAN,EAAA,OAAAI,SAAA;EAE/BC,WAAMD,SAA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AAAqB;EAAArB,EAAA,MAAAuB;CAAA,OAAAA,KAAAvB,EAAA;CAAA,OApELuB;AAoEK;AA9EN,SAAAiB,OAAAzC,IAAA;CA8D2B,MAAA,EAAA0C,YAAAC,cAAA3C;CAAyB,OACvB,qBAAAiD,UAAA,EAAA,UAAA,CACI,oBAAA,QAAA;EAAiB,WAAAtE,4BAAM2D;EAAaK,UAAAA;CAAiB,CAAA,GACrD,oBAAA,QAAA;EAAiB,WAAAhE,4BAAMiE;EACnB,UAAA,oBAAA,QAAA;GACe,WAAAjE,4BAAMkE;GACV,OAAA,EAAAC,OAAS,GAAGJ,cAAA,IAAiB,GAAI;EAAC,CAAA;CAE1C,CAAA,CAAA,EAAA,CAAA;AACR;AAvEhC,SAAAN,QAAA,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Action } from '@panneau/protocol';
|
|
2
|
-
import type { ActionOutcome } from './types';
|
|
2
|
+
import type { ActionOutcome } from './types.js';
|
|
3
3
|
export interface ParametersDialogProps {
|
|
4
4
|
action: Action;
|
|
5
5
|
/** How many items the action applies to, for the confirm label. */
|
|
@@ -14,6 +14,9 @@ export interface ParametersDialogProps {
|
|
|
14
14
|
* The parameters of an action (`fields`, in its `layout`), in a dialog, with the client validation
|
|
15
15
|
* of forms. The action runs when the form is submitted; errors of the action endpoint (`422`, keyed
|
|
16
16
|
* by paths inside `values`) show on the fields, and other errors in the form.
|
|
17
|
+
*
|
|
18
|
+
* Closing the dialog with changed values (Escape, a click outside, Cancel) asks first, as leaving
|
|
19
|
+
* a form page does.
|
|
17
20
|
*/
|
|
18
21
|
export declare function ParametersDialog({ action, locales, onSubmit, onDone, onCancel, }: ParametersDialogProps): import("react").JSX.Element;
|
|
19
22
|
//# sourceMappingURL=ParametersDialog.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ParametersDialog.d.ts","sourceRoot":"","sources":["../src/ParametersDialog.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ParametersDialog.d.ts","sourceRoot":"","sources":["../src/ParametersDialog.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAKhD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C,MAAM,WAAW,qBAAqB;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,mEAAmE;IACnE,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;IACxC,uFAAuF;IACvF,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC;IACtE,MAAM,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,IAAI,CAAC;IACzC,QAAQ,EAAE,MAAM,IAAI,CAAC;CACxB;AAmCD;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,EAC7B,MAAM,EACN,OAAO,EACP,QAAQ,EACR,MAAM,EACN,QAAQ,GACX,EAAE,qBAAqB,+BAgCvB"}
|
package/dist/ParametersDialog.js
CHANGED
|
@@ -1,116 +1,194 @@
|
|
|
1
1
|
import ActionRunner_module_default from "./ActionRunner.module.js";
|
|
2
2
|
import { messages } from "./messages.js";
|
|
3
|
-
import { Button, Dialog, usePanneauIntl } from "@panneau/ui";
|
|
4
3
|
import { c } from "react/compiler-runtime";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { useEffect, useRef } from "react";
|
|
5
|
+
import { useFormSelector } from "@panneau/core";
|
|
6
|
+
import { getActionLabel } from "@panneau/intl";
|
|
7
|
+
import { Button, Dialog, usePanneauIntl } from "@panneau/ui";
|
|
8
|
+
import { Form, useFormContext, useLeaveConfirmation } from "@panneau/forms";
|
|
9
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
10
|
//#region src/ParametersDialog.tsx
|
|
8
11
|
/**
|
|
12
|
+
* Cancel, inside the form: with changed values, it asks first, as leaving a form page does. The
|
|
13
|
+
* dialog asks it to close (Escape, a click outside) through `closeRef`.
|
|
14
|
+
*/
|
|
15
|
+
function CancelButton(t0) {
|
|
16
|
+
const $ = c(14);
|
|
17
|
+
const { closeRef, onCancel } = t0;
|
|
18
|
+
const intl = usePanneauIntl();
|
|
19
|
+
const form = useFormContext();
|
|
20
|
+
const dirty = useFormSelector(form, _temp);
|
|
21
|
+
const leave = useLeaveConfirmation(dirty);
|
|
22
|
+
let t1;
|
|
23
|
+
if ($[0] !== leave || $[1] !== onCancel) {
|
|
24
|
+
t1 = () => {
|
|
25
|
+
leave.confirmLeave().then((confirmed) => {
|
|
26
|
+
if (confirmed) onCancel();
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
$[0] = leave;
|
|
30
|
+
$[1] = onCancel;
|
|
31
|
+
$[2] = t1;
|
|
32
|
+
} else t1 = $[2];
|
|
33
|
+
const request = t1;
|
|
34
|
+
let t2;
|
|
35
|
+
if ($[3] !== closeRef || $[4] !== request) {
|
|
36
|
+
t2 = () => {
|
|
37
|
+
closeRef.current = request;
|
|
38
|
+
};
|
|
39
|
+
$[3] = closeRef;
|
|
40
|
+
$[4] = request;
|
|
41
|
+
$[5] = t2;
|
|
42
|
+
} else t2 = $[5];
|
|
43
|
+
useEffect(t2);
|
|
44
|
+
let t3;
|
|
45
|
+
if ($[6] !== intl) {
|
|
46
|
+
t3 = intl.formatMessage(messages.cancel);
|
|
47
|
+
$[6] = intl;
|
|
48
|
+
$[7] = t3;
|
|
49
|
+
} else t3 = $[7];
|
|
50
|
+
let t4;
|
|
51
|
+
if ($[8] !== request || $[9] !== t3) {
|
|
52
|
+
t4 = /* @__PURE__ */ jsx(Button, {
|
|
53
|
+
onPress: request,
|
|
54
|
+
children: t3
|
|
55
|
+
});
|
|
56
|
+
$[8] = request;
|
|
57
|
+
$[9] = t3;
|
|
58
|
+
$[10] = t4;
|
|
59
|
+
} else t4 = $[10];
|
|
60
|
+
let t5;
|
|
61
|
+
if ($[11] !== leave.dialog || $[12] !== t4) {
|
|
62
|
+
t5 = /* @__PURE__ */ jsxs(Fragment, { children: [t4, leave.dialog] });
|
|
63
|
+
$[11] = leave.dialog;
|
|
64
|
+
$[12] = t4;
|
|
65
|
+
$[13] = t5;
|
|
66
|
+
} else t5 = $[13];
|
|
67
|
+
return t5;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
9
70
|
* The parameters of an action (`fields`, in its `layout`), in a dialog, with the client validation
|
|
10
71
|
* of forms. The action runs when the form is submitted; errors of the action endpoint (`422`, keyed
|
|
11
72
|
* by paths inside `values`) show on the fields, and other errors in the form.
|
|
73
|
+
*
|
|
74
|
+
* Closing the dialog with changed values (Escape, a click outside, Cancel) asks first, as leaving
|
|
75
|
+
* a form page does.
|
|
12
76
|
*/
|
|
77
|
+
function _temp(state) {
|
|
78
|
+
return state.dirty;
|
|
79
|
+
}
|
|
13
80
|
function ParametersDialog(t0) {
|
|
14
|
-
const $ = c(
|
|
81
|
+
const $ = c(36);
|
|
15
82
|
const { action, locales, onSubmit, onDone, onCancel } = t0;
|
|
16
83
|
const intl = usePanneauIntl();
|
|
17
|
-
const
|
|
84
|
+
const close = useRef(null);
|
|
18
85
|
let t1;
|
|
19
|
-
if ($[0] !==
|
|
20
|
-
t1 = (
|
|
21
|
-
|
|
86
|
+
if ($[0] !== action || $[1] !== intl) {
|
|
87
|
+
t1 = typeof action.confirm === "object" && action.confirm.confirmLabel !== void 0 ? action.confirm.confirmLabel : getActionLabel(action, intl);
|
|
88
|
+
$[0] = action;
|
|
89
|
+
$[1] = intl;
|
|
90
|
+
$[2] = t1;
|
|
91
|
+
} else t1 = $[2];
|
|
92
|
+
const confirmLabel = t1;
|
|
93
|
+
let t2;
|
|
94
|
+
if ($[3] !== onCancel) {
|
|
95
|
+
t2 = (open) => {
|
|
96
|
+
if (!open) (close.current ?? onCancel)();
|
|
22
97
|
};
|
|
23
|
-
$[
|
|
24
|
-
$[
|
|
25
|
-
} else
|
|
26
|
-
const t2 = action.label;
|
|
98
|
+
$[3] = onCancel;
|
|
99
|
+
$[4] = t2;
|
|
100
|
+
} else t2 = $[4];
|
|
27
101
|
let t3;
|
|
28
|
-
if ($[
|
|
29
|
-
t3 = action
|
|
30
|
-
$[
|
|
31
|
-
$[
|
|
32
|
-
|
|
102
|
+
if ($[5] !== action || $[6] !== intl) {
|
|
103
|
+
t3 = getActionLabel(action, intl);
|
|
104
|
+
$[5] = action;
|
|
105
|
+
$[6] = intl;
|
|
106
|
+
$[7] = t3;
|
|
107
|
+
} else t3 = $[7];
|
|
33
108
|
let t4;
|
|
34
|
-
if ($[
|
|
35
|
-
t4 = action.
|
|
36
|
-
$[
|
|
37
|
-
$[
|
|
38
|
-
} else t4 = $[
|
|
109
|
+
if ($[8] !== action.fields) {
|
|
110
|
+
t4 = action.fields ?? [];
|
|
111
|
+
$[8] = action.fields;
|
|
112
|
+
$[9] = t4;
|
|
113
|
+
} else t4 = $[9];
|
|
39
114
|
let t5;
|
|
40
|
-
if ($[
|
|
41
|
-
t5 =
|
|
42
|
-
$[
|
|
43
|
-
$[
|
|
44
|
-
} else t5 = $[
|
|
45
|
-
|
|
115
|
+
if ($[10] !== action.layout) {
|
|
116
|
+
t5 = action.layout ?? [];
|
|
117
|
+
$[10] = action.layout;
|
|
118
|
+
$[11] = t5;
|
|
119
|
+
} else t5 = $[11];
|
|
120
|
+
let t6;
|
|
121
|
+
if ($[12] !== locales) {
|
|
122
|
+
t6 = locales !== void 0 ? { locales } : {};
|
|
123
|
+
$[12] = locales;
|
|
124
|
+
$[13] = t6;
|
|
125
|
+
} else t6 = $[13];
|
|
46
126
|
let t7;
|
|
47
|
-
if ($[
|
|
48
|
-
t7 = intl
|
|
49
|
-
$[
|
|
50
|
-
$[
|
|
51
|
-
|
|
127
|
+
if ($[14] !== action || $[15] !== intl) {
|
|
128
|
+
t7 = getActionLabel(action, intl);
|
|
129
|
+
$[14] = action;
|
|
130
|
+
$[15] = intl;
|
|
131
|
+
$[16] = t7;
|
|
132
|
+
} else t7 = $[16];
|
|
52
133
|
let t8;
|
|
53
|
-
if ($[
|
|
54
|
-
t8 = /* @__PURE__ */ jsx(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
children: t7
|
|
134
|
+
if ($[17] !== onCancel) {
|
|
135
|
+
t8 = /* @__PURE__ */ jsx(CancelButton, {
|
|
136
|
+
closeRef: close,
|
|
137
|
+
onCancel
|
|
58
138
|
});
|
|
59
|
-
$[
|
|
60
|
-
$[
|
|
61
|
-
|
|
62
|
-
} else t8 = $[12];
|
|
139
|
+
$[17] = onCancel;
|
|
140
|
+
$[18] = t8;
|
|
141
|
+
} else t8 = $[18];
|
|
63
142
|
let t9;
|
|
64
|
-
if ($[
|
|
143
|
+
if ($[19] !== onSubmit) {
|
|
65
144
|
t9 = (values) => onSubmit(values);
|
|
66
|
-
$[
|
|
67
|
-
$[
|
|
68
|
-
} else t9 = $[
|
|
145
|
+
$[19] = onSubmit;
|
|
146
|
+
$[20] = t9;
|
|
147
|
+
} else t9 = $[20];
|
|
69
148
|
let t10;
|
|
70
|
-
if ($[
|
|
149
|
+
if ($[21] !== onDone) {
|
|
71
150
|
t10 = (outcome) => onDone(outcome);
|
|
72
|
-
$[
|
|
73
|
-
$[
|
|
74
|
-
} else t10 = $[
|
|
151
|
+
$[21] = onDone;
|
|
152
|
+
$[22] = t10;
|
|
153
|
+
} else t10 = $[22];
|
|
75
154
|
let t11;
|
|
76
|
-
if ($[
|
|
155
|
+
if ($[23] !== confirmLabel || $[24] !== t10 || $[25] !== t4 || $[26] !== t5 || $[27] !== t6 || $[28] !== t7 || $[29] !== t8 || $[30] !== t9) {
|
|
77
156
|
t11 = /* @__PURE__ */ jsx(Form, {
|
|
78
|
-
fields:
|
|
79
|
-
layout:
|
|
80
|
-
...
|
|
81
|
-
"aria-label":
|
|
157
|
+
fields: t4,
|
|
158
|
+
layout: t5,
|
|
159
|
+
...t6,
|
|
160
|
+
"aria-label": t7,
|
|
82
161
|
submitLabel: confirmLabel,
|
|
83
162
|
actions: t8,
|
|
84
163
|
onSubmit: t9,
|
|
85
164
|
onSubmitted: t10,
|
|
86
|
-
guardUnsavedChanges: false,
|
|
87
165
|
showSavedToast: false,
|
|
88
166
|
className: ActionRunner_module_default.parameters
|
|
89
167
|
});
|
|
90
|
-
$[
|
|
91
|
-
$[
|
|
92
|
-
$[
|
|
93
|
-
$[
|
|
94
|
-
$[
|
|
95
|
-
$[
|
|
96
|
-
$[
|
|
97
|
-
$[
|
|
98
|
-
$[
|
|
99
|
-
} else t11 = $[
|
|
168
|
+
$[23] = confirmLabel;
|
|
169
|
+
$[24] = t10;
|
|
170
|
+
$[25] = t4;
|
|
171
|
+
$[26] = t5;
|
|
172
|
+
$[27] = t6;
|
|
173
|
+
$[28] = t7;
|
|
174
|
+
$[29] = t8;
|
|
175
|
+
$[30] = t9;
|
|
176
|
+
$[31] = t11;
|
|
177
|
+
} else t11 = $[31];
|
|
100
178
|
let t12;
|
|
101
|
-
if ($[
|
|
179
|
+
if ($[32] !== t11 || $[33] !== t2 || $[34] !== t3) {
|
|
102
180
|
t12 = /* @__PURE__ */ jsx(Dialog, {
|
|
103
181
|
isOpen: true,
|
|
104
|
-
onOpenChange:
|
|
105
|
-
title:
|
|
182
|
+
onOpenChange: t2,
|
|
183
|
+
title: t3,
|
|
106
184
|
size: "md",
|
|
107
185
|
children: t11
|
|
108
186
|
});
|
|
109
|
-
$[
|
|
110
|
-
$[
|
|
111
|
-
$[
|
|
112
|
-
$[
|
|
113
|
-
} else t12 = $[
|
|
187
|
+
$[32] = t11;
|
|
188
|
+
$[33] = t2;
|
|
189
|
+
$[34] = t3;
|
|
190
|
+
$[35] = t12;
|
|
191
|
+
} else t12 = $[35];
|
|
114
192
|
return t12;
|
|
115
193
|
}
|
|
116
194
|
//#endregion
|