@bison-lab/payload-core 3.36.0 → 3.42.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/README.md +32 -35
- package/dist/admin.d.mts +3 -3
- package/dist/admin.d.mts.map +1 -1
- package/dist/admin.mjs +117 -105
- package/dist/admin.mjs.map +1 -1
- package/dist/identity-DOGDpCgK.mjs.map +1 -1
- package/dist/index.d.mts +22 -18
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +140 -151
- package/dist/index.mjs.map +1 -1
- package/dist/looks-BbL309kO.mjs.map +1 -1
- package/dist/{preview-B2u9AkFF.d.mts → preview-DtBDy2kv.d.mts} +7 -6
- package/dist/{preview-B2u9AkFF.d.mts.map → preview-DtBDy2kv.d.mts.map} +1 -1
- package/dist/theme.d.mts +1 -1
- package/package.json +6 -6
package/dist/index.mjs
CHANGED
|
@@ -350,17 +350,14 @@ const PACKAGE_FEATURE_SLUGS = [
|
|
|
350
350
|
"content",
|
|
351
351
|
"publish",
|
|
352
352
|
"media",
|
|
353
|
-
"theme-colors",
|
|
354
|
-
"theme-typography",
|
|
355
|
-
"theme-appearance",
|
|
356
|
-
"theme-identity",
|
|
357
|
-
"brand-assets",
|
|
358
353
|
"users",
|
|
359
354
|
"roles"
|
|
360
355
|
];
|
|
361
356
|
/**
|
|
362
357
|
* Package catalogue. Features itself is not a row — that screen is
|
|
363
|
-
* Developer-only in code.
|
|
358
|
+
* Developer-only in code. Theme is not a row either: every site has the
|
|
359
|
+
* Theme Global, and who may edit it is the Roles grant `theme`. Empty
|
|
360
|
+
* Global falls back to these defaults.
|
|
364
361
|
*/
|
|
365
362
|
const PACKAGE_FEATURES = [
|
|
366
363
|
{
|
|
@@ -381,36 +378,6 @@ const PACKAGE_FEATURES = [
|
|
|
381
378
|
group: "media",
|
|
382
379
|
defaultReleased: true
|
|
383
380
|
},
|
|
384
|
-
{
|
|
385
|
-
slug: "theme-colors",
|
|
386
|
-
label: "Colors",
|
|
387
|
-
group: "theme",
|
|
388
|
-
defaultReleased: true
|
|
389
|
-
},
|
|
390
|
-
{
|
|
391
|
-
slug: "theme-typography",
|
|
392
|
-
label: "Typography",
|
|
393
|
-
group: "theme",
|
|
394
|
-
defaultReleased: true
|
|
395
|
-
},
|
|
396
|
-
{
|
|
397
|
-
slug: "theme-appearance",
|
|
398
|
-
label: "Appearance",
|
|
399
|
-
group: "theme",
|
|
400
|
-
defaultReleased: true
|
|
401
|
-
},
|
|
402
|
-
{
|
|
403
|
-
slug: "theme-identity",
|
|
404
|
-
label: "Identity",
|
|
405
|
-
group: "theme",
|
|
406
|
-
defaultReleased: true
|
|
407
|
-
},
|
|
408
|
-
{
|
|
409
|
-
slug: "brand-assets",
|
|
410
|
-
label: "Brand assets",
|
|
411
|
-
group: "theme",
|
|
412
|
-
defaultReleased: true
|
|
413
|
-
},
|
|
414
381
|
{
|
|
415
382
|
slug: "users",
|
|
416
383
|
label: "Users",
|
|
@@ -438,8 +405,100 @@ function isLockedFeature(_slug, _locked) {
|
|
|
438
405
|
return false;
|
|
439
406
|
}
|
|
440
407
|
//#endregion
|
|
408
|
+
//#region src/roles/types.ts
|
|
409
|
+
/**
|
|
410
|
+
* The Roles Global a site's generated types will describe. Optional and
|
|
411
|
+
* nullable, no index signature: a generated Global is assignable to this,
|
|
412
|
+
* never the reverse.
|
|
413
|
+
*/
|
|
414
|
+
const ROLES = [
|
|
415
|
+
"developer",
|
|
416
|
+
"admin",
|
|
417
|
+
"designer",
|
|
418
|
+
"author"
|
|
419
|
+
];
|
|
420
|
+
const ROLE_LABELS = {
|
|
421
|
+
developer: "Developer",
|
|
422
|
+
admin: "Admin",
|
|
423
|
+
designer: "Designer",
|
|
424
|
+
author: "Author"
|
|
425
|
+
};
|
|
426
|
+
/** Capability aliases over feature grants. Brand is the Theme grant. */
|
|
427
|
+
const CAPABILITIES = [
|
|
428
|
+
"content",
|
|
429
|
+
"brand",
|
|
430
|
+
"publish",
|
|
431
|
+
"users"
|
|
432
|
+
];
|
|
433
|
+
/** One Roles grant. Opens the Theme document and brand-assets. Not a Features row. */
|
|
434
|
+
const THEME_FEATURE_SLUGS = ["theme"];
|
|
435
|
+
/**
|
|
436
|
+
* Grants stored before Theme was one row. Reading any of them is the
|
|
437
|
+
* Theme grant, so a Designer who already had Colors keeps Theme.
|
|
438
|
+
*/
|
|
439
|
+
const LEGACY_THEME_FEATURE_SLUGS = [
|
|
440
|
+
"theme-colors",
|
|
441
|
+
"theme-typography",
|
|
442
|
+
"theme-appearance",
|
|
443
|
+
"theme-identity",
|
|
444
|
+
"brand-assets"
|
|
445
|
+
];
|
|
446
|
+
const CAPABILITY_FEATURES = {
|
|
447
|
+
content: ["content"],
|
|
448
|
+
publish: ["publish"],
|
|
449
|
+
users: ["users"],
|
|
450
|
+
brand: THEME_FEATURE_SLUGS
|
|
451
|
+
};
|
|
452
|
+
const DEFAULT_ROLE_GRANTS = {
|
|
453
|
+
developer: [],
|
|
454
|
+
admin: [
|
|
455
|
+
"content",
|
|
456
|
+
"publish",
|
|
457
|
+
"media",
|
|
458
|
+
"users",
|
|
459
|
+
"roles"
|
|
460
|
+
],
|
|
461
|
+
designer: [
|
|
462
|
+
"content",
|
|
463
|
+
"media",
|
|
464
|
+
...THEME_FEATURE_SLUGS,
|
|
465
|
+
"users",
|
|
466
|
+
"roles"
|
|
467
|
+
],
|
|
468
|
+
author: ["content", "media"]
|
|
469
|
+
};
|
|
470
|
+
function isRole(value) {
|
|
471
|
+
return typeof value === "string" && ROLES.includes(value);
|
|
472
|
+
}
|
|
473
|
+
/** Lowercase slug from a letters-and-spaces name: `designer`, `the-designer`. */
|
|
474
|
+
function isRoleSlug(value) {
|
|
475
|
+
return typeof value === "string" && /^[a-z]+(-[a-z]+)*$/.test(value);
|
|
476
|
+
}
|
|
477
|
+
/** Display name: letters and single spaces only. `The Greatest Designer`. */
|
|
478
|
+
function isRoleName(value) {
|
|
479
|
+
return typeof value === "string" && /^[A-Za-z]+(?: [A-Za-z]+)*$/.test(value.trim());
|
|
480
|
+
}
|
|
481
|
+
/** Strip digits and punctuation as the name is typed. Trailing space stays. */
|
|
482
|
+
function sanitizeRoleNameInput(value) {
|
|
483
|
+
return value.replace(/[^A-Za-z ]/g, "").replace(/ {2,}/g, " ");
|
|
484
|
+
}
|
|
485
|
+
/** Name → stored key. `The Greatest Designer` → `the-greatest-designer`. */
|
|
486
|
+
function slugifyRoleName(value) {
|
|
487
|
+
if (typeof value !== "string") return "";
|
|
488
|
+
return value.trim().toLowerCase().replace(/[^a-z]+/g, "-").replace(/^-|-$/g, "");
|
|
489
|
+
}
|
|
490
|
+
function roleLabel(role, label) {
|
|
491
|
+
const trimmed = typeof label === "string" ? label.trim() : "";
|
|
492
|
+
if (trimmed) return trimmed;
|
|
493
|
+
return isRole(role) ? ROLE_LABELS[role] : role;
|
|
494
|
+
}
|
|
495
|
+
function defaultGrantsForRole(role, extraGrants) {
|
|
496
|
+
if (isRole(role)) return [...DEFAULT_ROLE_GRANTS[role]];
|
|
497
|
+
return extraGrants ? [...extraGrants] : [];
|
|
498
|
+
}
|
|
499
|
+
//#endregion
|
|
441
500
|
//#region src/features/matrix.ts
|
|
442
|
-
const MISSING_PACKAGE_FEATURES_MESSAGE = "Features must include Content, Publish, Media,
|
|
501
|
+
const MISSING_PACKAGE_FEATURES_MESSAGE = "Features must include Content, Publish, Media, Users, and Roles.";
|
|
443
502
|
function featureCatalogue(extras = []) {
|
|
444
503
|
return [...PACKAGE_FEATURES.map((feature) => ({ ...feature })), ...extras.map((extra) => ({
|
|
445
504
|
slug: extra.slug,
|
|
@@ -510,13 +569,15 @@ function validateFeaturesMatrix(value, extras = []) {
|
|
|
510
569
|
const parsed = parseFeaturesMatrix(value);
|
|
511
570
|
if (!parsed.ok) return parsed.message;
|
|
512
571
|
const allowed = new Set(featureCatalogue(extras).map((feature) => feature.slug));
|
|
513
|
-
|
|
572
|
+
const legacy = new Set(LEGACY_THEME_FEATURE_SLUGS);
|
|
573
|
+
if (parsed.rows.some((row) => !allowed.has(row.slug) && !legacy.has(row.slug))) return MISSING_PACKAGE_FEATURES_MESSAGE;
|
|
514
574
|
return true;
|
|
515
575
|
}
|
|
516
576
|
function featureGroupLabel(group) {
|
|
517
577
|
return isFeatureGroupId(group) ? FEATURE_GROUP_LABELS[group] : group;
|
|
518
578
|
}
|
|
519
579
|
function packageFeatureLabel(slug, extras = []) {
|
|
580
|
+
if (slug === "theme") return "Theme";
|
|
520
581
|
const pack = PACKAGE_FEATURES.find((feature) => feature.slug === slug);
|
|
521
582
|
if (pack) return pack.label;
|
|
522
583
|
return extras.find((feature) => feature.slug === slug)?.label ?? slug;
|
|
@@ -525,99 +586,13 @@ function isGroupOnlySlug(slug) {
|
|
|
525
586
|
return isFeatureGroupId(slug) && !PACKAGE_FEATURES.some((feature) => feature.slug === slug);
|
|
526
587
|
}
|
|
527
588
|
//#endregion
|
|
528
|
-
//#region src/roles/types.ts
|
|
529
|
-
/**
|
|
530
|
-
* The Roles Global a site's generated types will describe. Optional and
|
|
531
|
-
* nullable, no index signature: a generated Global is assignable to this,
|
|
532
|
-
* never the reverse.
|
|
533
|
-
*/
|
|
534
|
-
const ROLES = [
|
|
535
|
-
"developer",
|
|
536
|
-
"admin",
|
|
537
|
-
"designer",
|
|
538
|
-
"author"
|
|
539
|
-
];
|
|
540
|
-
const ROLE_LABELS = {
|
|
541
|
-
developer: "Developer",
|
|
542
|
-
admin: "Admin",
|
|
543
|
-
designer: "Designer",
|
|
544
|
-
author: "Author"
|
|
545
|
-
};
|
|
546
|
-
/** Capability aliases over feature grants. Brand is any Theme-group leaf. */
|
|
547
|
-
const CAPABILITIES = [
|
|
548
|
-
"content",
|
|
549
|
-
"brand",
|
|
550
|
-
"publish",
|
|
551
|
-
"users"
|
|
552
|
-
];
|
|
553
|
-
const THEME_FEATURE_SLUGS = [
|
|
554
|
-
"theme-colors",
|
|
555
|
-
"theme-typography",
|
|
556
|
-
"theme-appearance",
|
|
557
|
-
"theme-identity",
|
|
558
|
-
"brand-assets"
|
|
559
|
-
];
|
|
560
|
-
const CAPABILITY_FEATURES = {
|
|
561
|
-
content: ["content"],
|
|
562
|
-
publish: ["publish"],
|
|
563
|
-
users: ["users"],
|
|
564
|
-
brand: THEME_FEATURE_SLUGS
|
|
565
|
-
};
|
|
566
|
-
const DEFAULT_ROLE_GRANTS = {
|
|
567
|
-
developer: [],
|
|
568
|
-
admin: [
|
|
569
|
-
"content",
|
|
570
|
-
"publish",
|
|
571
|
-
"media",
|
|
572
|
-
"users",
|
|
573
|
-
"roles"
|
|
574
|
-
],
|
|
575
|
-
designer: [
|
|
576
|
-
"content",
|
|
577
|
-
"media",
|
|
578
|
-
...THEME_FEATURE_SLUGS,
|
|
579
|
-
"users",
|
|
580
|
-
"roles"
|
|
581
|
-
],
|
|
582
|
-
author: ["content", "media"]
|
|
583
|
-
};
|
|
584
|
-
function isRole(value) {
|
|
585
|
-
return typeof value === "string" && ROLES.includes(value);
|
|
586
|
-
}
|
|
587
|
-
/** Lowercase slug from a letters-and-spaces name: `designer`, `the-designer`. */
|
|
588
|
-
function isRoleSlug(value) {
|
|
589
|
-
return typeof value === "string" && /^[a-z]+(-[a-z]+)*$/.test(value);
|
|
590
|
-
}
|
|
591
|
-
/** Display name: letters and single spaces only. `The Greatest Designer`. */
|
|
592
|
-
function isRoleName(value) {
|
|
593
|
-
return typeof value === "string" && /^[A-Za-z]+(?: [A-Za-z]+)*$/.test(value.trim());
|
|
594
|
-
}
|
|
595
|
-
/** Strip digits and punctuation as the name is typed. Trailing space stays. */
|
|
596
|
-
function sanitizeRoleNameInput(value) {
|
|
597
|
-
return value.replace(/[^A-Za-z ]/g, "").replace(/ {2,}/g, " ");
|
|
598
|
-
}
|
|
599
|
-
/** Name → stored key. `The Greatest Designer` → `the-greatest-designer`. */
|
|
600
|
-
function slugifyRoleName(value) {
|
|
601
|
-
if (typeof value !== "string") return "";
|
|
602
|
-
return value.trim().toLowerCase().replace(/[^a-z]+/g, "-").replace(/^-|-$/g, "");
|
|
603
|
-
}
|
|
604
|
-
function roleLabel(role, label) {
|
|
605
|
-
const trimmed = typeof label === "string" ? label.trim() : "";
|
|
606
|
-
if (trimmed) return trimmed;
|
|
607
|
-
return isRole(role) ? ROLE_LABELS[role] : role;
|
|
608
|
-
}
|
|
609
|
-
function defaultGrantsForRole(role, extraGrants) {
|
|
610
|
-
if (isRole(role)) return [...DEFAULT_ROLE_GRANTS[role]];
|
|
611
|
-
return extraGrants ? [...extraGrants] : [];
|
|
612
|
-
}
|
|
613
|
-
//#endregion
|
|
614
589
|
//#region src/roles/matrix.ts
|
|
615
590
|
const ROLES_SLUG = "roles";
|
|
616
591
|
const ROLES_GLOBAL_DESCRIPTION = "Who may do what. Drag to change rank.";
|
|
617
|
-
const ROLES_FIELD_DESCRIPTION = "Drag to change rank. Ticks are features released on Features. Developer has the whole catalogue.";
|
|
592
|
+
const ROLES_FIELD_DESCRIPTION = "Drag to change rank. Ticks are features released on Features, plus Theme. Developer has the whole catalogue.";
|
|
618
593
|
/**
|
|
619
|
-
* Default rank and grants. Developer is implicit (empty grants).
|
|
620
|
-
*
|
|
594
|
+
* Default rank and grants. Developer is implicit (empty grants). The
|
|
595
|
+
* Theme grant defaults to Designer.
|
|
621
596
|
*/
|
|
622
597
|
const DEFAULT_ROLE_MATRIX = ROLES.map((role) => ({
|
|
623
598
|
role,
|
|
@@ -629,20 +604,35 @@ const MISSING_SEED_ROLES_MESSAGE = "Roles must include Developer.";
|
|
|
629
604
|
const DUPLICATE_ROLE_SLUG_MESSAGE = "Each role needs a unique slug.";
|
|
630
605
|
const DUPLICATE_ROLE_NAME_MESSAGE = "Each role needs a unique name.";
|
|
631
606
|
const INVALID_ROLE_NAME_MESSAGE = "Use letters and spaces only.";
|
|
607
|
+
const LEGACY_THEME_GRANTS = new Set(LEGACY_THEME_FEATURE_SLUGS);
|
|
632
608
|
function uniqueSlugs(values) {
|
|
633
609
|
const slugs = [];
|
|
634
610
|
for (const value of values) if (typeof value === "string" && isFeatureSlug(value) && !slugs.includes(value)) slugs.push(value);
|
|
635
611
|
return slugs;
|
|
636
612
|
}
|
|
613
|
+
/** One Theme grant. A stored Colors or brand-assets tick is that grant. */
|
|
614
|
+
function collapseThemeGrant(slugs) {
|
|
615
|
+
let theme = false;
|
|
616
|
+
const next = [];
|
|
617
|
+
for (const slug of slugs) {
|
|
618
|
+
if (slug === "theme" || LEGACY_THEME_GRANTS.has(slug)) {
|
|
619
|
+
theme = true;
|
|
620
|
+
continue;
|
|
621
|
+
}
|
|
622
|
+
next.push(slug);
|
|
623
|
+
}
|
|
624
|
+
if (theme) next.push("theme");
|
|
625
|
+
return next;
|
|
626
|
+
}
|
|
637
627
|
/** Read stored grants, or rebuild them from the old capability ticks. */
|
|
638
628
|
function grantsFromStoredRole(item) {
|
|
639
|
-
if ("grants" in item && Array.isArray(item.grants)) return uniqueSlugs(item.grants);
|
|
629
|
+
if ("grants" in item && Array.isArray(item.grants)) return collapseThemeGrant(uniqueSlugs(item.grants));
|
|
640
630
|
const grants = [];
|
|
641
631
|
if ("content" in item && item.content) grants.push("content", "media");
|
|
642
632
|
if ("publish" in item && item.publish) grants.push("publish");
|
|
643
633
|
if ("users" in item && item.users) grants.push("users", "roles");
|
|
644
|
-
if ("brand" in item && item.brand) grants.push(
|
|
645
|
-
return uniqueSlugs(grants);
|
|
634
|
+
if ("brand" in item && item.brand) grants.push("theme");
|
|
635
|
+
return collapseThemeGrant(uniqueSlugs(grants));
|
|
646
636
|
}
|
|
647
637
|
function seedRoleRows(extras = []) {
|
|
648
638
|
return [...DEFAULT_ROLE_MATRIX.map((row) => ({
|
|
@@ -914,11 +904,13 @@ function grantedOnReleased(user, slug, row, matrix) {
|
|
|
914
904
|
/**
|
|
915
905
|
* True when the feature is released and a held role is granted it.
|
|
916
906
|
* Developer is always allowed. An empty Global falls back to catalogue
|
|
917
|
-
* defaults. A group slug (`pages
|
|
907
|
+
* defaults. A group slug (`pages`) is true when any child is.
|
|
908
|
+
* `theme` is the Roles grant: Features cannot release or withhold it.
|
|
918
909
|
*/
|
|
919
910
|
function hasFeature(user, slug, features = null, matrix = DEFAULT_ROLE_MATRIX) {
|
|
920
911
|
if (isDeveloper(user)) return true;
|
|
921
912
|
if (!user) return false;
|
|
913
|
+
if (slug === "theme" || LEGACY_THEME_FEATURE_SLUGS.includes(slug)) return hasGrant(user, "theme", matrix);
|
|
922
914
|
const rows = features && features.length > 0 ? features : defaultFeaturesFieldValue();
|
|
923
915
|
const leaf = rows.find((entry) => entry.slug === slug);
|
|
924
916
|
if (leaf) return grantedOnReleased(user, slug, leaf, matrix);
|
|
@@ -993,13 +985,11 @@ function hideUnlessFeature(slug) {
|
|
|
993
985
|
}
|
|
994
986
|
//#endregion
|
|
995
987
|
//#region src/theme/global.ts
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
const update = options.access?.update;
|
|
999
|
-
if (!read || !update) throw new Error("createTheme requires access.read and access.update. Pass canManageBrand from this package as update.");
|
|
988
|
+
const publicThemeRead = () => true;
|
|
989
|
+
function resolveAccess$1(options) {
|
|
1000
990
|
return {
|
|
1001
|
-
read,
|
|
1002
|
-
update
|
|
991
|
+
read: options.access?.read ?? publicThemeRead,
|
|
992
|
+
update: options.access?.update ?? canUseFeature("theme")
|
|
1003
993
|
};
|
|
1004
994
|
}
|
|
1005
995
|
function requireDestructive(options) {
|
|
@@ -1299,7 +1289,7 @@ function identityFields(collection) {
|
|
|
1299
1289
|
* Locking is off. No draft mode, no preview pane.
|
|
1300
1290
|
*/
|
|
1301
1291
|
function createTheme(options) {
|
|
1302
|
-
const access =
|
|
1292
|
+
const access = resolveAccess$1(options);
|
|
1303
1293
|
const destructive = requireDestructive(options);
|
|
1304
1294
|
const { seed, fonts = catalog, fontsBaseUrl = "/fonts", contrastTarget = 7, logo, identity, onPublish, colorUsages } = options;
|
|
1305
1295
|
const adminCustom = {
|
|
@@ -1396,13 +1386,11 @@ const BRAND_ASSETS_MIME_TYPES = [
|
|
|
1396
1386
|
"image/x-icon",
|
|
1397
1387
|
"image/vnd.microsoft.icon"
|
|
1398
1388
|
];
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
const update = options.access?.update;
|
|
1402
|
-
if (!read || !update) throw new Error("createBrandAssets requires access.read and access.update. Pass canManageBrand from this package as update.");
|
|
1389
|
+
const publicBrandRead = () => true;
|
|
1390
|
+
function resolveAccess(options) {
|
|
1403
1391
|
return {
|
|
1404
|
-
read,
|
|
1405
|
-
update
|
|
1392
|
+
read: options.access?.read ?? publicBrandRead,
|
|
1393
|
+
update: options.access?.update ?? canUseFeature("theme")
|
|
1406
1394
|
};
|
|
1407
1395
|
}
|
|
1408
1396
|
/**
|
|
@@ -1410,8 +1398,8 @@ function requireAccess$1(options) {
|
|
|
1410
1398
|
* manager writes it. Theme's `logo` / `logoMark` point here when the site
|
|
1411
1399
|
* passes this slug as `logo.collection`.
|
|
1412
1400
|
*/
|
|
1413
|
-
function createBrandAssets(options) {
|
|
1414
|
-
const access =
|
|
1401
|
+
function createBrandAssets(options = {}) {
|
|
1402
|
+
const access = resolveAccess(options);
|
|
1415
1403
|
return {
|
|
1416
1404
|
slug: options.slug ?? "brand-assets",
|
|
1417
1405
|
labels: {
|
|
@@ -1421,7 +1409,7 @@ function createBrandAssets(options) {
|
|
|
1421
1409
|
admin: {
|
|
1422
1410
|
group: "Settings",
|
|
1423
1411
|
useAsTitle: "label",
|
|
1424
|
-
hidden: hideUnlessFeature("
|
|
1412
|
+
hidden: hideUnlessFeature("theme"),
|
|
1425
1413
|
description: "Logo, favicon, and mobile-menu mark. SVG preferred; PNG and ICO allowed."
|
|
1426
1414
|
},
|
|
1427
1415
|
upload: {
|
|
@@ -1604,6 +1592,7 @@ function createRoles({ extras = [] } = {}) {
|
|
|
1604
1592
|
type: "json",
|
|
1605
1593
|
label: "Grants",
|
|
1606
1594
|
defaultValue: [],
|
|
1595
|
+
hooks: { beforeChange: [({ value }) => Array.isArray(value) ? grantsFromStoredRole({ grants: value }) : value] },
|
|
1607
1596
|
admin: { components: { Field: ROLES_GRANTS_FIELD } }
|
|
1608
1597
|
}
|
|
1609
1598
|
]
|
|
@@ -1662,10 +1651,10 @@ function createFeatures({ extras = [] } = {}) {
|
|
|
1662
1651
|
required: true,
|
|
1663
1652
|
defaultValue: defaultFeaturesFieldValue(extras),
|
|
1664
1653
|
validate: (value) => validateFeaturesMatrix(value, extras),
|
|
1665
|
-
hooks: {
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
}
|
|
1654
|
+
hooks: {
|
|
1655
|
+
beforeValidate: [({ value }) => Array.isArray(value) ? stampFeatureCatalogue(value, extras) : value],
|
|
1656
|
+
beforeChange: [({ value }) => Array.isArray(value) ? stampFeatureCatalogue(value, extras) : value]
|
|
1657
|
+
},
|
|
1669
1658
|
admin: {
|
|
1670
1659
|
components: { Field: FEATURES_MATRIX_FIELD },
|
|
1671
1660
|
description: "Release a feature so it can be assigned on Roles. Off keeps it Developer-only.",
|