@nocode-factory/sanity-kit 2.13.1 → 2.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +7 -1
- package/dist/index.js +330 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/actions/BatchPublish.tsx +290 -0
- package/src/config/resolve.ts +1 -0
- package/src/config/types.ts +6 -0
- package/src/index.ts +6 -0
- package/src/lib/batchPublish.ts +104 -0
- package/src/version.ts +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -200,6 +200,11 @@ interface NcfKitConfig {
|
|
|
200
200
|
* (« Scheduled drafts » / Releases, nom d'outil `releases`). `false` : aucun.
|
|
201
201
|
*/
|
|
202
202
|
moreTools?: string[] | false;
|
|
203
|
+
/**
|
|
204
|
+
* « Publier » ouvre la liste de tous les brouillons du projet, cochés : on publie
|
|
205
|
+
* vingt modifications d'un coup, ou on décoche ce qui n'est pas prêt. Défaut : `true`.
|
|
206
|
+
*/
|
|
207
|
+
batchPublish?: boolean;
|
|
203
208
|
/**
|
|
204
209
|
* Étiquettes de suivi du board. Remplacent entièrement les valeurs par
|
|
205
210
|
* défaut quand elles sont fournies.
|
|
@@ -255,6 +260,7 @@ interface ResolvedKitConfig {
|
|
|
255
260
|
tools: Required<NcfToolsConfig>;
|
|
256
261
|
/** Outils rangés dans le menu « Plus » de la barre (noms d'outils). */
|
|
257
262
|
moreTools: string[];
|
|
263
|
+
batchPublish: boolean;
|
|
258
264
|
boardTags: NcfBoardTag[];
|
|
259
265
|
internalFields: NcfInternalField[];
|
|
260
266
|
documentColumns: ResolvedDocumentColumn[];
|
|
@@ -1303,7 +1309,7 @@ export declare function ActorName(props: {
|
|
|
1303
1309
|
* quelle version. Recopiée de `package.json` par `npm version` (scripts/sync-version.mjs) ; un test
|
|
1304
1310
|
* le vérifie.
|
|
1305
1311
|
*/
|
|
1306
|
-
export declare const KIT_VERSION = "2.
|
|
1312
|
+
export declare const KIT_VERSION = "2.14.0";
|
|
1307
1313
|
/**
|
|
1308
1314
|
* Données de la page proposées comme colonnes.
|
|
1309
1315
|
*
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { a as defineComponentDefaults, i as defaultsFieldName, n as componentDefaultsMainDocument, o as requiredUnlessDefault, r as componentDefaultsMainDocuments, s as requiredUnlessDefaultFor, t as DEFAULT_COMPONENT_DEFAULTS_TYPE } from "./componentDefaults-BY3hQ6aD.js";
|
|
2
|
-
import { ToolLink, defineField, definePlugin, defineType, pathToString, set, unset, useClient, useCurrentUser, useFormValue, useSchema, useUser, useWorkspace } from "sanity";
|
|
2
|
+
import { Preview, ToolLink, defineField, definePlugin, defineType, pathToString, set, unset, useClient, useCurrentUser, useFormValue, useSchema, useSyncState, useUser, useValidationStatus, useWorkspace } from "sanity";
|
|
3
3
|
import { ClockIcon } from "@sanity/icons/Clock";
|
|
4
4
|
import { ComponentIcon } from "@sanity/icons/Component";
|
|
5
5
|
import { DocumentsIcon } from "@sanity/icons/Documents";
|
|
6
6
|
import { ColorWheelIcon } from "@sanity/icons/ColorWheel";
|
|
7
|
-
import { Badge, Box, Button, Card, Container, Flex, Grid, Select, Spinner, Stack, Tab, TabList, TabPanel, Text, TextArea, TextInput } from "@sanity/ui";
|
|
7
|
+
import { Badge, Box, Button, Card, Checkbox, Container, Flex, Grid, Select, Spinner, Stack, Tab, TabList, TabPanel, Text, TextArea, TextInput } from "@sanity/ui";
|
|
8
8
|
import { createContext, forwardRef, memo, useCallback, useContext, useEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
9
9
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
10
10
|
import { IntentLink, useRouter, useRouterState } from "sanity/router";
|
|
@@ -34,6 +34,8 @@ import "@xyflow/react/dist/style.css";
|
|
|
34
34
|
import { TrashIcon } from "@sanity/icons/Trash";
|
|
35
35
|
import { RefreshIcon } from "@sanity/icons/Refresh";
|
|
36
36
|
import { RestoreIcon } from "@sanity/icons/Restore";
|
|
37
|
+
import { useToast } from "@sanity/ui/toast";
|
|
38
|
+
import { PublishIcon } from "@sanity/icons/Publish";
|
|
37
39
|
import { Tooltip } from "@sanity/ui/tooltip";
|
|
38
40
|
const DEFAULT_PAGE_BUILDER_FIELD = "sections", DEFAULT_SLUG_FIELD = "slug", DEFAULT_TITLE_FIELD = "title", DEFAULT_NOINDEX_FIELDS = ["seo.noindex", "noindex"], DEFAULT_I18N = {
|
|
39
41
|
field: "language",
|
|
@@ -153,6 +155,7 @@ function resolveConfig(input) {
|
|
|
153
155
|
...input.tools
|
|
154
156
|
},
|
|
155
157
|
moreTools: input.moreTools === !1 ? [] : input.moreTools ?? DEFAULT_TOOLBAR_MORE,
|
|
158
|
+
batchPublish: input.batchPublish !== !1,
|
|
156
159
|
boardTags: input.boardTags?.length ? input.boardTags : DEFAULT_BOARD_TAGS,
|
|
157
160
|
internalFields: input.internalFields?.length ? input.internalFields : DEFAULT_INTERNAL_FIELDS,
|
|
158
161
|
documentColumns: (input.documentColumns ?? []).map((column) => ({
|
|
@@ -1361,7 +1364,7 @@ function explainGrantError(error) {
|
|
|
1361
1364
|
* quelle version. Recopiée de `package.json` par `npm version` (scripts/sync-version.mjs) ; un test
|
|
1362
1365
|
* le vérifie.
|
|
1363
1366
|
*/
|
|
1364
|
-
const KIT_VERSION = "2.
|
|
1367
|
+
const KIT_VERSION = "2.14.0";
|
|
1365
1368
|
/**
|
|
1366
1369
|
* Signale ce Studio au service du kit, une fois par montage.
|
|
1367
1370
|
*
|
|
@@ -1688,7 +1691,7 @@ function useKitUpdate() {
|
|
|
1688
1691
|
!controller.signal.aborted && body?.version && setLatest(body.version);
|
|
1689
1692
|
}).catch(() => {}), () => controller.abort();
|
|
1690
1693
|
}, []);
|
|
1691
|
-
let available = !!(latest && !isPrerelease(latest) && compareVersions(latest, "2.
|
|
1694
|
+
let available = !!(latest && !isPrerelease(latest) && compareVersions(latest, "2.14.0") > 0);
|
|
1692
1695
|
return {
|
|
1693
1696
|
current: KIT_VERSION,
|
|
1694
1697
|
latest,
|
|
@@ -7416,6 +7419,325 @@ function DesignSystemTool() {
|
|
|
7416
7419
|
})
|
|
7417
7420
|
});
|
|
7418
7421
|
}
|
|
7422
|
+
/**
|
|
7423
|
+
* Publication groupée : logique pure (testée), sans React ni Studio.
|
|
7424
|
+
*
|
|
7425
|
+
* On modifie vingt documents, on publie tout d'un coup, ou seulement ce qu'on a
|
|
7426
|
+
* coché. La publication passe par l'API Actions de Sanity, en UNE transaction :
|
|
7427
|
+
* tout part ensemble ou rien ne part (un document qui en référence un autre encore
|
|
7428
|
+
* jamais publié peut ainsi partir avec lui).
|
|
7429
|
+
*/
|
|
7430
|
+
const DRAFTS_PREFIX = "drafts.", publishedIdOf = (id) => id.startsWith(DRAFTS_PREFIX) ? id.slice(7) : id;
|
|
7431
|
+
/**
|
|
7432
|
+
* Brouillons publiables : types du schéma (documents), hors types internes (kit,
|
|
7433
|
+
* `sanity.*`). Le document ouvert d'abord, puis du plus récent au plus ancien.
|
|
7434
|
+
*/
|
|
7435
|
+
function publishableDrafts(rows, publishedIds, options) {
|
|
7436
|
+
let published = new Set(publishedIds), current = options.currentId ? publishedIdOf(options.currentId) : null;
|
|
7437
|
+
return rows.filter((row) => row._id.startsWith(DRAFTS_PREFIX) && !row._id.slice(7).includes(".")).filter((row) => !row._type.startsWith("sanity.") && options.isDocumentType(row._type) && !options.isInternalType?.(row._type)).map((row) => ({
|
|
7438
|
+
...row,
|
|
7439
|
+
publishedId: publishedIdOf(row._id),
|
|
7440
|
+
published: published.has(publishedIdOf(row._id))
|
|
7441
|
+
})).sort((a, b) => a.publishedId === current ? -1 : b.publishedId === current ? 1 : b._updatedAt.localeCompare(a._updatedAt));
|
|
7442
|
+
}
|
|
7443
|
+
/**
|
|
7444
|
+
* Actions de publication. `ifDraftRevisionId` : on publie exactement la version
|
|
7445
|
+
* affichée ; si quelqu'un l'a modifiée entre-temps, la transaction est refusée
|
|
7446
|
+
* plutôt que de publier un contenu que personne n'a relu.
|
|
7447
|
+
*/
|
|
7448
|
+
function publishActions(selected) {
|
|
7449
|
+
return selected.map((draft) => ({
|
|
7450
|
+
actionType: "sanity.action.document.publish",
|
|
7451
|
+
draftId: draft._id,
|
|
7452
|
+
publishedId: draft.publishedId,
|
|
7453
|
+
ifDraftRevisionId: draft._rev
|
|
7454
|
+
}));
|
|
7455
|
+
}
|
|
7456
|
+
/** Libellé du bouton : « Publier 1 document », « Publier 12 documents ». */
|
|
7457
|
+
function publishLabel(count) {
|
|
7458
|
+
return count === 0 ? "Rien à publier" : `Publier ${count} document${count > 1 ? "s" : ""}`;
|
|
7459
|
+
}
|
|
7460
|
+
/** Erreur de l'API rendue lisible. */
|
|
7461
|
+
function explainPublishError(error) {
|
|
7462
|
+
let err = error, description = err?.details?.description ?? err?.details?.items?.[0]?.error?.description ?? err?.message ?? "";
|
|
7463
|
+
return /revision|mismatch|ifDraftRevisionId/i.test(description) ? "Un des documents a été modifié pendant que la fenêtre était ouverte : la liste vient d'être mise à jour, relancez la publication." : /reference/i.test(description) ? `Un document référence un contenu jamais publié qui n'est pas coché : cochez-le aussi, ou retirez la référence. (${description})` : err?.statusCode === 403 || /permission/i.test(description) ? "Vous n'avez pas le droit de publier un de ces documents." : description ? `Publication refusée : ${description}` : "Publication refusée.";
|
|
7464
|
+
}
|
|
7465
|
+
/** « à l'instant », « il y a 5 min », « il y a 3 h », « il y a 2 j ». */
|
|
7466
|
+
function sinceLabel(iso, now = Date.now()) {
|
|
7467
|
+
let minutes = Math.max(0, Math.round((now - Date.parse(iso)) / 6e4));
|
|
7468
|
+
if (minutes < 1) return "à l'instant";
|
|
7469
|
+
if (minutes < 60) return `il y a ${minutes} min`;
|
|
7470
|
+
let hours = Math.round(minutes / 60);
|
|
7471
|
+
return hours < 24 ? `il y a ${hours} h` : `il y a ${Math.round(hours / 24)} j`;
|
|
7472
|
+
}
|
|
7473
|
+
/**
|
|
7474
|
+
* Brouillons du projet, tenus à jour en direct : chaque modification, publication ou
|
|
7475
|
+
* suppression relance la requête (regroupées, une fois par demi-seconde au plus).
|
|
7476
|
+
*/
|
|
7477
|
+
function useDrafts(currentId) {
|
|
7478
|
+
let client = useKitClient(), schema = useSchema(), [rows, setRows] = useState(null);
|
|
7479
|
+
return useEffect(() => {
|
|
7480
|
+
let cancelled = !1, timer, load = async () => {
|
|
7481
|
+
let drafts = await client.fetch("*[_id in path(\"drafts.**\")]{_id, _rev, _type, _updatedAt}"), published = await client.fetch("*[_id in $ids]._id", { ids: drafts.map((d) => publishedIdOf(d._id)) });
|
|
7482
|
+
cancelled || setRows({
|
|
7483
|
+
drafts,
|
|
7484
|
+
published
|
|
7485
|
+
});
|
|
7486
|
+
};
|
|
7487
|
+
load().catch(() => {
|
|
7488
|
+
cancelled || setRows({
|
|
7489
|
+
drafts: [],
|
|
7490
|
+
published: []
|
|
7491
|
+
});
|
|
7492
|
+
});
|
|
7493
|
+
let subscription = client.listen("*[_id in path(\"drafts.**\") || _id in path(\"*\")]", {}, {
|
|
7494
|
+
visibility: "query",
|
|
7495
|
+
includeResult: !1,
|
|
7496
|
+
events: ["mutation"]
|
|
7497
|
+
}).subscribe(() => {
|
|
7498
|
+
clearTimeout(timer), timer = setTimeout(() => void load().catch(() => {}), 500);
|
|
7499
|
+
});
|
|
7500
|
+
return () => {
|
|
7501
|
+
cancelled = !0, clearTimeout(timer), subscription.unsubscribe();
|
|
7502
|
+
};
|
|
7503
|
+
}, [client]), useMemo(() => rows ? publishableDrafts(rows.drafts, rows.published, {
|
|
7504
|
+
isDocumentType: (type) => schema.get(type)?.jsonType === "object" && isDocumentSchema(schema.get(type)),
|
|
7505
|
+
isInternalType: isKitType,
|
|
7506
|
+
currentId
|
|
7507
|
+
}) : null, [
|
|
7508
|
+
rows,
|
|
7509
|
+
schema,
|
|
7510
|
+
currentId
|
|
7511
|
+
]);
|
|
7512
|
+
}
|
|
7513
|
+
function isDocumentSchema(type) {
|
|
7514
|
+
let current = type;
|
|
7515
|
+
for (; current;) {
|
|
7516
|
+
if (current.name === "document") return !0;
|
|
7517
|
+
current = current.type;
|
|
7518
|
+
}
|
|
7519
|
+
return !1;
|
|
7520
|
+
}
|
|
7521
|
+
/**
|
|
7522
|
+
* Remplace le bouton « Publier » du document : il ouvre la liste de TOUS les
|
|
7523
|
+
* brouillons du projet, cochés par défaut. On publie tout d'un coup ou on décoche
|
|
7524
|
+
* ce qui n'est pas prêt. Avec un seul brouillon (celui qu'on édite), le bouton
|
|
7525
|
+
* d'origine est gardé tel quel : pas de fenêtre pour rien.
|
|
7526
|
+
*
|
|
7527
|
+
* En perspective de release ou de variante, l'action d'origine reste aussi : la
|
|
7528
|
+
* publication groupée ne concerne que les brouillons.
|
|
7529
|
+
*/
|
|
7530
|
+
function createBatchPublishAction(original) {
|
|
7531
|
+
let BatchPublishAction = (props) => {
|
|
7532
|
+
let base = original(props), drafts = useDrafts(props.id), [open, setOpen] = useState(!1);
|
|
7533
|
+
if (!base || props.release || props.version || !drafts) return base;
|
|
7534
|
+
let current = publishedIdOf(props.id);
|
|
7535
|
+
return drafts.filter((d) => d.publishedId !== current).length === 0 ? base : {
|
|
7536
|
+
...base,
|
|
7537
|
+
label: `Publier… (${drafts.length})`,
|
|
7538
|
+
title: "Choisir les brouillons à publier, ensemble",
|
|
7539
|
+
icon: PublishIcon,
|
|
7540
|
+
disabled: !1,
|
|
7541
|
+
onHandle: () => setOpen(!0),
|
|
7542
|
+
dialog: open ? {
|
|
7543
|
+
type: "dialog",
|
|
7544
|
+
width: "medium",
|
|
7545
|
+
header: "Publier les modifications",
|
|
7546
|
+
onClose: () => setOpen(!1),
|
|
7547
|
+
content: /* @__PURE__ */ jsx(BatchPublishDialog, {
|
|
7548
|
+
drafts,
|
|
7549
|
+
currentId: current,
|
|
7550
|
+
currentType: props.type,
|
|
7551
|
+
onDone: () => setOpen(!1)
|
|
7552
|
+
})
|
|
7553
|
+
} : null
|
|
7554
|
+
};
|
|
7555
|
+
};
|
|
7556
|
+
return BatchPublishAction.action = original.action, BatchPublishAction.displayName = "NcfBatchPublishAction", BatchPublishAction;
|
|
7557
|
+
}
|
|
7558
|
+
function BatchPublishDialog(props) {
|
|
7559
|
+
let { drafts, currentId, currentType, onDone } = props, client = useKitClient(), toast = useToast(), [unchecked, setUnchecked] = useState(() => /* @__PURE__ */ new Set()), [invalid, setInvalid] = useState(() => /* @__PURE__ */ new Set()), [busy, setBusy] = useState(!1), [error, setError] = useState(null), { isSyncing } = useSyncState(currentId, currentType), report = useCallback((id, hasErrors) => {
|
|
7560
|
+
setInvalid((prev) => {
|
|
7561
|
+
if (prev.has(id) === hasErrors) return prev;
|
|
7562
|
+
let next = new Set(prev);
|
|
7563
|
+
return hasErrors ? next.add(id) : next.delete(id), next;
|
|
7564
|
+
});
|
|
7565
|
+
}, []), selectable = drafts.filter((d) => !invalid.has(d._id)), selected = selectable.filter((d) => !unchecked.has(d._id)), allChecked = selected.length === selectable.length && selectable.length > 0, toggle = (id) => setUnchecked((prev) => {
|
|
7566
|
+
let next = new Set(prev);
|
|
7567
|
+
return next.has(id) ? next.delete(id) : next.add(id), next;
|
|
7568
|
+
}), toggleAll = () => setUnchecked(allChecked ? new Set(selectable.map((d) => d._id)) : /* @__PURE__ */ new Set()), publish = async () => {
|
|
7569
|
+
setBusy(!0), setError(null);
|
|
7570
|
+
try {
|
|
7571
|
+
await client.action(publishActions(selected)), toast.push({
|
|
7572
|
+
status: "success",
|
|
7573
|
+
title: selected.length > 1 ? `${selected.length} documents publiés` : "Document publié"
|
|
7574
|
+
}), onDone();
|
|
7575
|
+
} catch (cause) {
|
|
7576
|
+
setError(explainPublishError(cause));
|
|
7577
|
+
} finally {
|
|
7578
|
+
setBusy(!1);
|
|
7579
|
+
}
|
|
7580
|
+
};
|
|
7581
|
+
return /* @__PURE__ */ jsxs(Stack, {
|
|
7582
|
+
gap: 4,
|
|
7583
|
+
padding: 4,
|
|
7584
|
+
children: [
|
|
7585
|
+
/* @__PURE__ */ jsxs(Flex, {
|
|
7586
|
+
align: "center",
|
|
7587
|
+
justify: "space-between",
|
|
7588
|
+
gap: 3,
|
|
7589
|
+
children: [/* @__PURE__ */ jsxs(Text, {
|
|
7590
|
+
size: 1,
|
|
7591
|
+
muted: !0,
|
|
7592
|
+
children: [
|
|
7593
|
+
drafts.length,
|
|
7594
|
+
" document",
|
|
7595
|
+
drafts.length > 1 ? "s" : "",
|
|
7596
|
+
" en brouillon. Décochez ce qui n'est pas prêt."
|
|
7597
|
+
]
|
|
7598
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
7599
|
+
mode: "bleed",
|
|
7600
|
+
fontSize: 1,
|
|
7601
|
+
padding: 2,
|
|
7602
|
+
text: allChecked ? "Tout décocher" : "Tout cocher",
|
|
7603
|
+
onClick: toggleAll,
|
|
7604
|
+
disabled: busy
|
|
7605
|
+
})]
|
|
7606
|
+
}),
|
|
7607
|
+
/* @__PURE__ */ jsx(Card, {
|
|
7608
|
+
radius: 2,
|
|
7609
|
+
border: !0,
|
|
7610
|
+
style: {
|
|
7611
|
+
maxHeight: "55vh",
|
|
7612
|
+
overflowY: "auto"
|
|
7613
|
+
},
|
|
7614
|
+
children: /* @__PURE__ */ jsx(Stack, { children: drafts.map((draft, index) => /* @__PURE__ */ jsx(DraftLine, {
|
|
7615
|
+
draft,
|
|
7616
|
+
current: draft.publishedId === currentId,
|
|
7617
|
+
checked: !unchecked.has(draft._id) && !invalid.has(draft._id),
|
|
7618
|
+
invalid: invalid.has(draft._id),
|
|
7619
|
+
onToggle: () => toggle(draft._id),
|
|
7620
|
+
onValidation: report,
|
|
7621
|
+
divider: index > 0,
|
|
7622
|
+
disabled: busy
|
|
7623
|
+
}, draft._id)) })
|
|
7624
|
+
}),
|
|
7625
|
+
error && /* @__PURE__ */ jsx(Card, {
|
|
7626
|
+
padding: 3,
|
|
7627
|
+
radius: 2,
|
|
7628
|
+
tone: "critical",
|
|
7629
|
+
children: /* @__PURE__ */ jsx(Text, {
|
|
7630
|
+
size: 1,
|
|
7631
|
+
children: error
|
|
7632
|
+
})
|
|
7633
|
+
}),
|
|
7634
|
+
/* @__PURE__ */ jsxs(Flex, {
|
|
7635
|
+
justify: "flex-end",
|
|
7636
|
+
align: "center",
|
|
7637
|
+
gap: 2,
|
|
7638
|
+
children: [
|
|
7639
|
+
isSyncing && /* @__PURE__ */ jsxs(Flex, {
|
|
7640
|
+
align: "center",
|
|
7641
|
+
gap: 2,
|
|
7642
|
+
children: [/* @__PURE__ */ jsx(Spinner, { muted: !0 }), /* @__PURE__ */ jsx(Text, {
|
|
7643
|
+
size: 1,
|
|
7644
|
+
muted: !0,
|
|
7645
|
+
children: "Enregistrement en cours…"
|
|
7646
|
+
})]
|
|
7647
|
+
}),
|
|
7648
|
+
/* @__PURE__ */ jsx(Button, {
|
|
7649
|
+
mode: "bleed",
|
|
7650
|
+
text: "Annuler",
|
|
7651
|
+
onClick: onDone,
|
|
7652
|
+
disabled: busy
|
|
7653
|
+
}),
|
|
7654
|
+
/* @__PURE__ */ jsx(Button, {
|
|
7655
|
+
tone: "positive",
|
|
7656
|
+
icon: busy ? Spinner : PublishIcon,
|
|
7657
|
+
text: busy ? "Publication…" : publishLabel(selected.length),
|
|
7658
|
+
disabled: busy || isSyncing || selected.length === 0,
|
|
7659
|
+
onClick: publish
|
|
7660
|
+
})
|
|
7661
|
+
]
|
|
7662
|
+
})
|
|
7663
|
+
]
|
|
7664
|
+
});
|
|
7665
|
+
}
|
|
7666
|
+
function DraftLine(props) {
|
|
7667
|
+
let { draft, current, checked, invalid, disabled, divider, onToggle, onValidation } = props, schemaType = useSchema().get(draft._type), { validation, isValidating } = useValidationStatus(draft._id, draft._type, !1), hasErrors = validation.some((marker) => marker.level === "error");
|
|
7668
|
+
return useEffect(() => {
|
|
7669
|
+
isValidating || onValidation(draft._id, hasErrors);
|
|
7670
|
+
}, [
|
|
7671
|
+
draft._id,
|
|
7672
|
+
hasErrors,
|
|
7673
|
+
isValidating,
|
|
7674
|
+
onValidation
|
|
7675
|
+
]), /* @__PURE__ */ jsx(Card, {
|
|
7676
|
+
as: "label",
|
|
7677
|
+
padding: 2,
|
|
7678
|
+
paddingX: 3,
|
|
7679
|
+
tone: invalid ? "critical" : current ? "primary" : "default",
|
|
7680
|
+
style: {
|
|
7681
|
+
cursor: invalid || disabled ? "default" : "pointer",
|
|
7682
|
+
borderTop: divider ? "1px solid var(--card-border-color)" : void 0
|
|
7683
|
+
},
|
|
7684
|
+
children: /* @__PURE__ */ jsxs(Flex, {
|
|
7685
|
+
align: "center",
|
|
7686
|
+
gap: 3,
|
|
7687
|
+
children: [
|
|
7688
|
+
/* @__PURE__ */ jsx(Checkbox, {
|
|
7689
|
+
checked,
|
|
7690
|
+
disabled: invalid || disabled,
|
|
7691
|
+
onChange: onToggle
|
|
7692
|
+
}),
|
|
7693
|
+
/* @__PURE__ */ jsx(Box, {
|
|
7694
|
+
flex: 1,
|
|
7695
|
+
style: { minWidth: 0 },
|
|
7696
|
+
children: schemaType ? /* @__PURE__ */ jsx(Preview, {
|
|
7697
|
+
schemaType,
|
|
7698
|
+
value: {
|
|
7699
|
+
_id: draft._id,
|
|
7700
|
+
_type: draft._type
|
|
7701
|
+
},
|
|
7702
|
+
layout: "default"
|
|
7703
|
+
}) : /* @__PURE__ */ jsx(Text, {
|
|
7704
|
+
size: 1,
|
|
7705
|
+
children: draft.publishedId
|
|
7706
|
+
})
|
|
7707
|
+
}),
|
|
7708
|
+
/* @__PURE__ */ jsxs(Stack, {
|
|
7709
|
+
gap: 2,
|
|
7710
|
+
style: {
|
|
7711
|
+
flex: "none",
|
|
7712
|
+
textAlign: "right"
|
|
7713
|
+
},
|
|
7714
|
+
children: [/* @__PURE__ */ jsxs(Flex, {
|
|
7715
|
+
gap: 1,
|
|
7716
|
+
justify: "flex-end",
|
|
7717
|
+
children: [current && /* @__PURE__ */ jsx(Badge, {
|
|
7718
|
+
tone: "primary",
|
|
7719
|
+
children: "Ouvert"
|
|
7720
|
+
}), invalid ? /* @__PURE__ */ jsx(Badge, {
|
|
7721
|
+
tone: "critical",
|
|
7722
|
+
children: "Erreurs à corriger"
|
|
7723
|
+
}) : /* @__PURE__ */ jsx(Badge, {
|
|
7724
|
+
tone: draft.published ? "caution" : "positive",
|
|
7725
|
+
children: draft.published ? "Modifié" : "Nouveau"
|
|
7726
|
+
})]
|
|
7727
|
+
}), /* @__PURE__ */ jsxs(Text, {
|
|
7728
|
+
size: 0,
|
|
7729
|
+
muted: !0,
|
|
7730
|
+
children: [
|
|
7731
|
+
schemaType?.title ?? draft._type,
|
|
7732
|
+
" · ",
|
|
7733
|
+
sinceLabel(draft._updatedAt)
|
|
7734
|
+
]
|
|
7735
|
+
})]
|
|
7736
|
+
})
|
|
7737
|
+
]
|
|
7738
|
+
})
|
|
7739
|
+
});
|
|
7740
|
+
}
|
|
7419
7741
|
const store = /* @__PURE__ */ new Map();
|
|
7420
7742
|
function entryFor(client, type, languageField, language) {
|
|
7421
7743
|
let { projectId, dataset } = client.config(), key = `${projectId}:${dataset}:${type}:${language ?? ""}`, entry = store.get(key);
|
|
@@ -7971,7 +8293,10 @@ const NCF_PAGES_TOOL = "ncf-pages", NCF_COMPONENTS_TOOL = "ncf-components", NCF_
|
|
|
7971
8293
|
types: kitSchemaTypes,
|
|
7972
8294
|
templates: (prev) => prev.filter((template) => !isKitType(template.schemaType))
|
|
7973
8295
|
},
|
|
7974
|
-
document: {
|
|
8296
|
+
document: {
|
|
8297
|
+
newDocumentOptions: (prev) => prev.filter((option) => option.templateId !== BOARD_LAYOUT_TYPE),
|
|
8298
|
+
actions: (prev) => config.batchPublish ? prev.map((action) => action.action === "publish" ? createBatchPublishAction(action) : action) : prev
|
|
8299
|
+
},
|
|
7975
8300
|
studio: { components: { toolMenu: createPreviewLauncher(config, issues) } },
|
|
7976
8301
|
form: { components: { input: createOverrideInput(config) } }
|
|
7977
8302
|
};
|