@valbuild/core 0.105.1 → 0.109.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.
Files changed (32) hide show
  1. package/dist/declarations/src/index.d.ts +5 -4
  2. package/dist/declarations/src/initSchema.d.ts +20 -20
  3. package/dist/declarations/src/module.d.ts +10 -0
  4. package/dist/declarations/src/preview.d.ts +40 -2
  5. package/dist/declarations/src/render.d.ts +38 -9
  6. package/dist/declarations/src/schema/array.d.ts +24 -12
  7. package/dist/declarations/src/schema/boolean.d.ts +25 -2
  8. package/dist/declarations/src/schema/color.d.ts +25 -2
  9. package/dist/declarations/src/schema/date.d.ts +25 -2
  10. package/dist/declarations/src/schema/datetime.d.ts +25 -2
  11. package/dist/declarations/src/schema/file.d.ts +25 -2
  12. package/dist/declarations/src/schema/image.d.ts +25 -2
  13. package/dist/declarations/src/schema/index.d.ts +19 -1
  14. package/dist/declarations/src/schema/keyOf.d.ts +25 -2
  15. package/dist/declarations/src/schema/literal.d.ts +25 -2
  16. package/dist/declarations/src/schema/number.d.ts +25 -2
  17. package/dist/declarations/src/schema/object.d.ts +25 -2
  18. package/dist/declarations/src/schema/record.d.ts +25 -13
  19. package/dist/declarations/src/schema/richtext.d.ts +25 -2
  20. package/dist/declarations/src/schema/route.d.ts +25 -2
  21. package/dist/declarations/src/schema/string.d.ts +13 -2
  22. package/dist/declarations/src/schema/union.d.ts +32 -2
  23. package/dist/{index-4013c9f8.cjs.prod.js → index-77914667.cjs.prod.js} +1011 -192
  24. package/dist/{index-baa3109b.cjs.dev.js → index-bce560db.cjs.dev.js} +1011 -192
  25. package/dist/{index-005f51a5.esm.js → index-db33b67c.esm.js} +1011 -192
  26. package/dist/valbuild-core.cjs.dev.js +1 -1
  27. package/dist/valbuild-core.cjs.prod.js +1 -1
  28. package/dist/valbuild-core.esm.js +1 -1
  29. package/package.json +2 -2
  30. package/patch/dist/valbuild-core-patch.cjs.dev.js +1 -1
  31. package/patch/dist/valbuild-core-patch.cjs.prod.js +1 -1
  32. package/patch/dist/valbuild-core-patch.esm.js +2 -2
@@ -215,8 +215,32 @@ var Schema = /*#__PURE__*/function () {
215
215
  * For example, if you have an object schema, you must assert each key / value pair manually.
216
216
  */
217
217
  }, {
218
- key: "appendValidationError",
218
+ key: "executePreviewItem",
219
219
  value:
220
+ /**
221
+ * This value AS A PREVIEW — what a container's row, a reference dropdown or
222
+ * a search hit shows for it. Runs the schema's own `preview` closure;
223
+ * `null` when none is declared (the consumer falls back to a generic
224
+ * preview). A union dispatches to the matching member's closure.
225
+ *
226
+ * Containers call this on their ITEM schema per item — that is how
227
+ * `executePreview` reifies an {@link ArrayPreview} / {@link RecordPreview}
228
+ * from item-level declarations.
229
+ */
230
+ function executePreviewItem(src) {
231
+ return null;
232
+ }
233
+ /**
234
+ * Could {@link executePreviewItem} ever answer? A container reifies a rows
235
+ * preview only when its item schema says yes — asked here rather than by
236
+ * running the closure, so an EMPTY list still previews as an empty list
237
+ * instead of not at all.
238
+ */
239
+ }, {
240
+ key: "declaresItemPreview",
241
+ value: function declaresItemPreview() {
242
+ return false;
243
+ }
220
244
  // remote(): Src extends RemoteCompatibleSource
221
245
  // ? Schema<RemoteSource<Src>>
222
246
  // : never {
@@ -225,7 +249,9 @@ var Schema = /*#__PURE__*/function () {
225
249
  // }
226
250
 
227
251
  /** MUTATES! since internal and perf sensitive */
228
- function appendValidationError(current, path, message, value, schemaError) {
252
+ }, {
253
+ key: "appendValidationError",
254
+ value: function appendValidationError(current, path, message, value, schemaError) {
229
255
  if (current) {
230
256
  if (current[path]) {
231
257
  current[path].push({
@@ -422,6 +448,7 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
422
448
  var isReadonly = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
423
449
  var isHidden = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
424
450
  var description = arguments.length > 7 ? arguments[7] : undefined;
451
+ var previewInput = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : null;
425
452
  _classCallCheck(this, StringSchema);
426
453
  _this = _callSuper(this, StringSchema);
427
454
  _this.options = options;
@@ -432,13 +459,14 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
432
459
  _this.isReadonly = isReadonly;
433
460
  _this.isHidden = isHidden;
434
461
  _this.description = description;
462
+ _this.previewInput = previewInput;
435
463
  return _this;
436
464
  }
437
465
  _inherits(StringSchema, _Schema);
438
466
  return _createClass(StringSchema, [{
439
467
  key: "describe",
440
468
  value: function describe(description) {
441
- return new StringSchema(this.options, this.opt, this.isRaw, this.customValidateFunctions, this.renderInput, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined);
469
+ return new StringSchema(this.options, this.opt, this.isRaw, this.customValidateFunctions, this.renderInput, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined, this.previewInput);
442
470
  }
443
471
 
444
472
  /**
@@ -454,7 +482,7 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
454
482
  value: function minLength(_minLength) {
455
483
  return new StringSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
456
484
  minLength: _minLength
457
- }), this.opt, this.isRaw, this.customValidateFunctions, this.renderInput, this.isReadonly, this.isHidden, this.description);
485
+ }), this.opt, this.isRaw, this.customValidateFunctions, this.renderInput, this.isReadonly, this.isHidden, this.description, this.previewInput);
458
486
  }
459
487
 
460
488
  /**
@@ -470,7 +498,7 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
470
498
  value: function maxLength(_maxLength) {
471
499
  return new StringSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
472
500
  maxLength: _maxLength
473
- }), this.opt, this.isRaw, this.customValidateFunctions, this.renderInput, this.isReadonly, this.isHidden, this.description);
501
+ }), this.opt, this.isRaw, this.customValidateFunctions, this.renderInput, this.isReadonly, this.isHidden, this.description, this.previewInput);
474
502
  }
475
503
  }, {
476
504
  key: "regexp",
@@ -478,12 +506,12 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
478
506
  return new StringSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
479
507
  regexp: _regexp,
480
508
  regExpMessage: message
481
- }), this.opt, this.isRaw, this.customValidateFunctions, this.renderInput, this.isReadonly, this.isHidden, this.description);
509
+ }), this.opt, this.isRaw, this.customValidateFunctions, this.renderInput, this.isReadonly, this.isHidden, this.description, this.previewInput);
482
510
  }
483
511
  }, {
484
512
  key: "validate",
485
513
  value: function validate(validationFunction) {
486
- return new StringSchema(this.options, this.opt, this.isRaw, this.customValidateFunctions.concat(validationFunction), this.renderInput, this.isReadonly, this.isHidden, this.description);
514
+ return new StringSchema(this.options, this.opt, this.isRaw, this.customValidateFunctions.concat(validationFunction), this.renderInput, this.isReadonly, this.isHidden, this.description, this.previewInput);
487
515
  }
488
516
  }, {
489
517
  key: "executeValidate",
@@ -556,22 +584,22 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
556
584
  }, {
557
585
  key: "nullable",
558
586
  value: function nullable() {
559
- return new StringSchema(this.options, true, this.isRaw, this.customValidateFunctions, this.renderInput, this.isReadonly, this.isHidden, this.description);
587
+ return new StringSchema(this.options, true, this.isRaw, this.customValidateFunctions, this.renderInput, this.isReadonly, this.isHidden, this.description, this.previewInput);
560
588
  }
561
589
  }, {
562
590
  key: "readonly",
563
591
  value: function readonly() {
564
- return new StringSchema(this.options, this.opt, this.isRaw, this.customValidateFunctions, this.renderInput, true, this.isHidden, this.description);
592
+ return new StringSchema(this.options, this.opt, this.isRaw, this.customValidateFunctions, this.renderInput, true, this.isHidden, this.description, this.previewInput);
565
593
  }
566
594
  }, {
567
595
  key: "hidden",
568
596
  value: function hidden() {
569
- return new StringSchema(this.options, this.opt, this.isRaw, this.customValidateFunctions, this.renderInput, this.isReadonly, true, this.description);
597
+ return new StringSchema(this.options, this.opt, this.isRaw, this.customValidateFunctions, this.renderInput, this.isReadonly, true, this.description, this.previewInput);
570
598
  }
571
599
  }, {
572
600
  key: "raw",
573
601
  value: function raw() {
574
- return new StringSchema(this.options, this.opt, true, this.customValidateFunctions, this.renderInput, this.isReadonly, this.isHidden, this.description);
602
+ return new StringSchema(this.options, this.opt, true, this.customValidateFunctions, this.renderInput, this.isReadonly, this.isHidden, this.description, this.previewInput);
575
603
  }
576
604
  }, {
577
605
  key: "executeCustomValidateAt",
@@ -587,6 +615,7 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
587
615
  return {
588
616
  type: "string",
589
617
  render: (_this$renderInput = this.renderInput) !== null && _this$renderInput !== void 0 ? _this$renderInput : undefined,
618
+ preview: this.previewInput ? true : undefined,
590
619
  options: {
591
620
  maxLength: (_this$options4 = this.options) === null || _this$options4 === void 0 ? void 0 : _this$options4.maxLength,
592
621
  minLength: (_this$options5 = this.options) === null || _this$options5 === void 0 ? void 0 : _this$options5.minLength,
@@ -616,7 +645,33 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
616
645
  }, {
617
646
  key: "render",
618
647
  value: function render(input) {
619
- return new StringSchema(this.options, this.opt, this.isRaw, this.customValidateFunctions, input, this.isReadonly, this.isHidden, this.description);
648
+ return new StringSchema(this.options, this.opt, this.isRaw, this.customValidateFunctions, input, this.isReadonly, this.isHidden, this.description, this.previewInput);
649
+ }
650
+
651
+ /**
652
+ * How this VALUE is shown where a preview of it is needed — a row in a
653
+ * sortable list, a reference dropdown, a search hit. Never how the field
654
+ * itself is edited (that is `render`). See `preview.ts`.
655
+ */
656
+ }, {
657
+ key: "preview",
658
+ value: function preview(select) {
659
+ return new StringSchema(this.options, this.opt, this.isRaw, this.customValidateFunctions, this.renderInput, this.isReadonly, this.isHidden, this.description, select);
660
+ }
661
+ }, {
662
+ key: "executePreviewItem",
663
+ value: function executePreviewItem(src) {
664
+ if (this.previewInput === null) {
665
+ return null;
666
+ }
667
+ return this.previewInput({
668
+ val: src
669
+ });
670
+ }
671
+ }, {
672
+ key: "declaresItemPreview",
673
+ value: function declaresItemPreview() {
674
+ return this.previewInput !== null;
620
675
  }
621
676
 
622
677
  /**
@@ -643,6 +698,8 @@ var ObjectSchema = /*#__PURE__*/function (_Schema) {
643
698
  var isReadonly = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
644
699
  var isHidden = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
645
700
  var description = arguments.length > 5 ? arguments[5] : undefined;
701
+ var renderInput = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null;
702
+ var previewInput = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
646
703
  _classCallCheck(this, ObjectSchema);
647
704
  _this = _callSuper(this, ObjectSchema);
648
705
  _this.items = items;
@@ -651,18 +708,20 @@ var ObjectSchema = /*#__PURE__*/function (_Schema) {
651
708
  _this.isReadonly = isReadonly;
652
709
  _this.isHidden = isHidden;
653
710
  _this.description = description;
711
+ _this.renderInput = renderInput;
712
+ _this.previewInput = previewInput;
654
713
  return _this;
655
714
  }
656
715
  _inherits(ObjectSchema, _Schema);
657
716
  return _createClass(ObjectSchema, [{
658
717
  key: "describe",
659
718
  value: function describe(description) {
660
- return new ObjectSchema(this.items, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined);
719
+ return new ObjectSchema(this.items, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined, this.renderInput, this.previewInput);
661
720
  }
662
721
  }, {
663
722
  key: "validate",
664
723
  value: function validate(validationFunction) {
665
- return new ObjectSchema(this.items, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.isReadonly, this.isHidden, this.description);
724
+ return new ObjectSchema(this.items, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.isReadonly, this.isHidden, this.description, this.renderInput, this.previewInput);
666
725
  }
667
726
  }, {
668
727
  key: "executeValidate",
@@ -782,17 +841,18 @@ var ObjectSchema = /*#__PURE__*/function (_Schema) {
782
841
  }, {
783
842
  key: "nullable",
784
843
  value: function nullable() {
785
- return new ObjectSchema(this.items, true, [], this.isReadonly, this.isHidden, this.description);
844
+ // Explicit type args: `previewInput` would otherwise pin inference to `Src`.
845
+ return new ObjectSchema(this.items, true, [], this.isReadonly, this.isHidden, this.description, this.renderInput, this.previewInput);
786
846
  }
787
847
  }, {
788
848
  key: "readonly",
789
849
  value: function readonly() {
790
- return new ObjectSchema(this.items, this.opt, this.customValidateFunctions, true, this.isHidden, this.description);
850
+ return new ObjectSchema(this.items, this.opt, this.customValidateFunctions, true, this.isHidden, this.description, this.renderInput, this.previewInput);
791
851
  }
792
852
  }, {
793
853
  key: "hidden",
794
854
  value: function hidden() {
795
- return new ObjectSchema(this.items, this.opt, this.customValidateFunctions, this.isReadonly, true, this.description);
855
+ return new ObjectSchema(this.items, this.opt, this.customValidateFunctions, this.isReadonly, true, this.description, this.renderInput, this.previewInput);
796
856
  }
797
857
  }, {
798
858
  key: "executeCustomValidateAt",
@@ -801,12 +861,53 @@ var ObjectSchema = /*#__PURE__*/function (_Schema) {
801
861
  path: path
802
862
  });
803
863
  }
864
+
865
+ /**
866
+ * How this field is laid out in the editor when it is the item of an array
867
+ * or record: `{ as: "inline" }` renders the field itself inside each row,
868
+ * instead of a preview row that navigates to it.
869
+ *
870
+ * Static configuration, not a callback — see `render.ts`.
871
+ */
872
+ }, {
873
+ key: "render",
874
+ value: function render(input) {
875
+ return new ObjectSchema(this.items, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, input, this.previewInput);
876
+ }
877
+
878
+ /**
879
+ * How this VALUE is shown where a preview of it is needed — a row in a
880
+ * sortable list, a reference dropdown, a search hit. Never how the field
881
+ * itself is edited (that is `render`). See `preview.ts`.
882
+ */
883
+ }, {
884
+ key: "preview",
885
+ value: function preview(select) {
886
+ return new ObjectSchema(this.items, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.renderInput, select);
887
+ }
888
+ }, {
889
+ key: "executePreviewItem",
890
+ value: function executePreviewItem(src) {
891
+ if (this.previewInput === null) {
892
+ return null;
893
+ }
894
+ return this.previewInput({
895
+ val: src
896
+ });
897
+ }
898
+ }, {
899
+ key: "declaresItemPreview",
900
+ value: function declaresItemPreview() {
901
+ return this.previewInput !== null;
902
+ }
804
903
  }, {
805
904
  key: "executeSerialize",
806
905
  value: function executeSerialize() {
807
- var _this$customValidateF;
906
+ var _this$renderInput, _this$customValidateF;
808
907
  return {
809
908
  type: "object",
909
+ render: (_this$renderInput = this.renderInput) !== null && _this$renderInput !== void 0 ? _this$renderInput : undefined,
910
+ preview: this.previewInput ? true : undefined,
810
911
  items: Object.fromEntries(Object.entries(this.items).map(function (_ref5) {
811
912
  var _ref6 = _slicedToArray(_ref5, 2),
812
913
  key = _ref6[0],
@@ -867,6 +968,7 @@ var ArraySchema = /*#__PURE__*/function (_Schema) {
867
968
  var isHidden = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
868
969
  var description = arguments.length > 5 ? arguments[5] : undefined;
869
970
  var previewInput = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null;
971
+ var renderInput = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
870
972
  _classCallCheck(this, ArraySchema);
871
973
  _this = _callSuper(this, ArraySchema);
872
974
  _this.item = item;
@@ -876,18 +978,19 @@ var ArraySchema = /*#__PURE__*/function (_Schema) {
876
978
  _this.isHidden = isHidden;
877
979
  _this.description = description;
878
980
  _this.previewInput = previewInput;
981
+ _this.renderInput = renderInput;
879
982
  return _this;
880
983
  }
881
984
  _inherits(ArraySchema, _Schema);
882
985
  return _createClass(ArraySchema, [{
883
986
  key: "describe",
884
987
  value: function describe(description) {
885
- return new ArraySchema(this.item, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined, this.previewInput);
988
+ return new ArraySchema(this.item, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined, this.previewInput, this.renderInput);
886
989
  }
887
990
  }, {
888
991
  key: "validate",
889
992
  value: function validate(validationFunction) {
890
- return new ArraySchema(this.item, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.isReadonly, this.isHidden, this.description, this.previewInput);
993
+ return new ArraySchema(this.item, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.isReadonly, this.isHidden, this.description, this.previewInput, this.renderInput);
891
994
  }
892
995
  }, {
893
996
  key: "executeValidate",
@@ -954,17 +1057,18 @@ var ArraySchema = /*#__PURE__*/function (_Schema) {
954
1057
  }, {
955
1058
  key: "nullable",
956
1059
  value: function nullable() {
957
- return new ArraySchema(this.item, true, [], this.isReadonly, this.isHidden, this.description, this.previewInput);
1060
+ // Explicit type args: `previewInput` would otherwise pin inference to `Src`.
1061
+ return new ArraySchema(this.item, true, [], this.isReadonly, this.isHidden, this.description, this.previewInput, this.renderInput);
958
1062
  }
959
1063
  }, {
960
1064
  key: "readonly",
961
1065
  value: function readonly() {
962
- return new ArraySchema(this.item, this.opt, this.customValidateFunctions, true, this.isHidden, this.description, this.previewInput);
1066
+ return new ArraySchema(this.item, this.opt, this.customValidateFunctions, true, this.isHidden, this.description, this.previewInput, this.renderInput);
963
1067
  }
964
1068
  }, {
965
1069
  key: "hidden",
966
1070
  value: function hidden() {
967
- return new ArraySchema(this.item, this.opt, this.customValidateFunctions, this.isReadonly, true, this.description, this.previewInput);
1071
+ return new ArraySchema(this.item, this.opt, this.customValidateFunctions, this.isReadonly, true, this.description, this.previewInput, this.renderInput);
968
1072
  }
969
1073
  }, {
970
1074
  key: "executeCustomValidateAt",
@@ -976,9 +1080,10 @@ var ArraySchema = /*#__PURE__*/function (_Schema) {
976
1080
  }, {
977
1081
  key: "executeSerialize",
978
1082
  value: function executeSerialize() {
979
- var _this$customValidateF;
1083
+ var _this$renderInput, _this$customValidateF;
980
1084
  return {
981
1085
  type: "array",
1086
+ render: (_this$renderInput = this.renderInput) !== null && _this$renderInput !== void 0 ? _this$renderInput : undefined,
982
1087
  item: this.item["executeSerialize"](),
983
1088
  opt: this.opt,
984
1089
  preview: this.previewInput ? true : undefined,
@@ -1011,8 +1116,10 @@ var ArraySchema = /*#__PURE__*/function (_Schema) {
1011
1116
  res[_key] = itemResult[_key];
1012
1117
  }
1013
1118
  }
1014
- if (this.previewInput) {
1015
- var select = this.previewInput;
1119
+ // The rows preview comes from the ITEM schema's own `preview` — the
1120
+ // container just runs it per row. Asked as a fact rather than by running
1121
+ // the closure, so an empty list still previews as an empty list.
1122
+ if (this.item["declaresItemPreview"]()) {
1016
1123
  // The whole list when the LIST is what is being shown; only the wanted
1017
1124
  // rows when it is not. The user's closure is the real expense — a list
1018
1125
  // view asks for the container and gets every row, a single field asks for
@@ -1023,26 +1130,30 @@ var ArraySchema = /*#__PURE__*/function (_Schema) {
1023
1130
  var window = scope !== undefined && !scope.wants(sourcePath) ? scope : null;
1024
1131
  var items = [];
1025
1132
  for (var index = 0; index < src.length; index++) {
1133
+ var _itemSrc = src[index];
1134
+ if (_itemSrc === null || _itemSrc === undefined) {
1135
+ continue;
1136
+ }
1026
1137
  if (window !== null && !window.wantsUnder(unsafeCreateSourcePath(sourcePath, index))) {
1027
1138
  continue;
1028
1139
  }
1029
- // Per ITEM, not per list, matching what `record` already does: the
1030
- // closure is user code, and one row whose data trips it up must not take
1031
- // out the whole list. Before scoping, one throwing row produced an error
1032
- // at the container and no items at all.
1140
+ // Per ITEM, not per list: the closure is user code, and one row whose
1141
+ // data trips it up must not take out the whole list. Before scoping,
1142
+ // one throwing row produced an error at the container and no items at
1143
+ // all.
1033
1144
  try {
1034
1145
  // NB NB: display is actually defined by the user
1035
- var _select = select({
1036
- val: src[index]
1037
- }),
1038
- title = _select.title,
1039
- subtitle = _select.subtitle,
1040
- image = _select.image;
1041
- items.push([index, {
1042
- title: title,
1043
- subtitle: subtitle,
1044
- image: image
1045
- }]);
1146
+ var _item = this.item["executePreviewItem"](_itemSrc);
1147
+ if (_item !== null) {
1148
+ var title = _item.title,
1149
+ subtitle = _item.subtitle,
1150
+ image = _item.image;
1151
+ items.push([index, {
1152
+ title: title,
1153
+ subtitle: subtitle,
1154
+ image: image
1155
+ }]);
1156
+ }
1046
1157
  } catch (e) {
1047
1158
  res[unsafeCreateSourcePath(sourcePath, index)] = {
1048
1159
  status: "error",
@@ -1060,18 +1171,45 @@ var ArraySchema = /*#__PURE__*/function (_Schema) {
1060
1171
  }
1061
1172
  return res;
1062
1173
  }
1174
+ }, {
1175
+ key: "executePreviewItem",
1176
+ value: function executePreviewItem(src) {
1177
+ if (this.previewInput === null) {
1178
+ return null;
1179
+ }
1180
+ return this.previewInput({
1181
+ val: src
1182
+ });
1183
+ }
1184
+ }, {
1185
+ key: "declaresItemPreview",
1186
+ value: function declaresItemPreview() {
1187
+ return this.previewInput !== null;
1188
+ }
1063
1189
 
1064
1190
  /**
1065
- * What the editor shows for each ITEM of this array: a title, and optionally a
1066
- * subtitle and an image.
1067
- *
1068
- * `select` is your own code over the item's source, so it is run on demand for
1069
- * the rows that are actually being looked at — see `PreviewScope`.
1191
+ * How this ARRAY ITSELF is shown where a preview of it is needed — when it
1192
+ * is the item of another container, in search, in references. What its rows
1193
+ * show is the ITEM schema's `preview`, not this. Never how the field is
1194
+ * edited (that is `render`). See `preview.ts`.
1070
1195
  */
1071
1196
  }, {
1072
1197
  key: "preview",
1073
1198
  value: function preview(select) {
1074
- return new ArraySchema(this.item, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, select);
1199
+ return new ArraySchema(this.item, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, select, this.renderInput);
1200
+ }
1201
+
1202
+ /**
1203
+ * How this field is laid out in the editor when it is the item of an array
1204
+ * or record: `{ as: "inline" }` renders the field itself inside each row,
1205
+ * instead of a preview row that navigates to it.
1206
+ *
1207
+ * Static configuration, not a callback — see `render.ts`.
1208
+ */
1209
+ }, {
1210
+ key: "render",
1211
+ value: function render(input) {
1212
+ return new ArraySchema(this.item, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.previewInput, input);
1075
1213
  }
1076
1214
  }]);
1077
1215
  }(Schema);
@@ -1087,6 +1225,8 @@ var LiteralSchema = /*#__PURE__*/function (_Schema) {
1087
1225
  var isReadonly = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
1088
1226
  var isHidden = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
1089
1227
  var description = arguments.length > 5 ? arguments[5] : undefined;
1228
+ var renderInput = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null;
1229
+ var previewInput = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
1090
1230
  _classCallCheck(this, LiteralSchema);
1091
1231
  _this = _callSuper(this, LiteralSchema);
1092
1232
  _this.value = value;
@@ -1095,18 +1235,20 @@ var LiteralSchema = /*#__PURE__*/function (_Schema) {
1095
1235
  _this.isReadonly = isReadonly;
1096
1236
  _this.isHidden = isHidden;
1097
1237
  _this.description = description;
1238
+ _this.renderInput = renderInput;
1239
+ _this.previewInput = previewInput;
1098
1240
  return _this;
1099
1241
  }
1100
1242
  _inherits(LiteralSchema, _Schema);
1101
1243
  return _createClass(LiteralSchema, [{
1102
1244
  key: "describe",
1103
1245
  value: function describe(description) {
1104
- return new LiteralSchema(this.value, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined);
1246
+ return new LiteralSchema(this.value, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined, this.renderInput, this.previewInput);
1105
1247
  }
1106
1248
  }, {
1107
1249
  key: "validate",
1108
1250
  value: function validate(validationFunction) {
1109
- return new LiteralSchema(this.value, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.isReadonly, this.isHidden, this.description);
1251
+ return new LiteralSchema(this.value, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.isReadonly, this.isHidden, this.description, this.renderInput, this.previewInput);
1110
1252
  }
1111
1253
  }, {
1112
1254
  key: "executeValidate",
@@ -1169,17 +1311,17 @@ var LiteralSchema = /*#__PURE__*/function (_Schema) {
1169
1311
  }, {
1170
1312
  key: "nullable",
1171
1313
  value: function nullable() {
1172
- return new LiteralSchema(this.value, true, [], this.isReadonly, this.isHidden, this.description);
1314
+ return new LiteralSchema(this.value, true, [], this.isReadonly, this.isHidden, this.description, this.renderInput, this.previewInput);
1173
1315
  }
1174
1316
  }, {
1175
1317
  key: "readonly",
1176
1318
  value: function readonly() {
1177
- return new LiteralSchema(this.value, this.opt, this.customValidateFunctions, true, this.isHidden, this.description);
1319
+ return new LiteralSchema(this.value, this.opt, this.customValidateFunctions, true, this.isHidden, this.description, this.renderInput, this.previewInput);
1178
1320
  }
1179
1321
  }, {
1180
1322
  key: "hidden",
1181
1323
  value: function hidden() {
1182
- return new LiteralSchema(this.value, this.opt, this.customValidateFunctions, this.isReadonly, true, this.description);
1324
+ return new LiteralSchema(this.value, this.opt, this.customValidateFunctions, this.isReadonly, true, this.description, this.renderInput, this.previewInput);
1183
1325
  }
1184
1326
  }, {
1185
1327
  key: "executeCustomValidateAt",
@@ -1188,12 +1330,53 @@ var LiteralSchema = /*#__PURE__*/function (_Schema) {
1188
1330
  path: path
1189
1331
  });
1190
1332
  }
1333
+
1334
+ /**
1335
+ * How this field is laid out in the editor when it is the item of an array
1336
+ * or record: `{ as: "inline" }` renders the field itself inside each row,
1337
+ * instead of a preview row that navigates to it.
1338
+ *
1339
+ * Static configuration, not a callback — see `render.ts`.
1340
+ */
1341
+ }, {
1342
+ key: "render",
1343
+ value: function render(input) {
1344
+ return new LiteralSchema(this.value, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, input, this.previewInput);
1345
+ }
1346
+
1347
+ /**
1348
+ * How this VALUE is shown where a preview of it is needed — a row in a
1349
+ * sortable list, a reference dropdown, a search hit. Never how the field
1350
+ * itself is edited (that is `render`). See `preview.ts`.
1351
+ */
1352
+ }, {
1353
+ key: "preview",
1354
+ value: function preview(select) {
1355
+ return new LiteralSchema(this.value, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.renderInput, select);
1356
+ }
1357
+ }, {
1358
+ key: "executePreviewItem",
1359
+ value: function executePreviewItem(src) {
1360
+ if (this.previewInput === null) {
1361
+ return null;
1362
+ }
1363
+ return this.previewInput({
1364
+ val: src
1365
+ });
1366
+ }
1367
+ }, {
1368
+ key: "declaresItemPreview",
1369
+ value: function declaresItemPreview() {
1370
+ return this.previewInput !== null;
1371
+ }
1191
1372
  }, {
1192
1373
  key: "executeSerialize",
1193
1374
  value: function executeSerialize() {
1194
- var _this$customValidateF;
1375
+ var _this$renderInput, _this$customValidateF;
1195
1376
  return {
1196
1377
  type: "literal",
1378
+ render: (_this$renderInput = this.renderInput) !== null && _this$renderInput !== void 0 ? _this$renderInput : undefined,
1379
+ preview: this.previewInput ? true : undefined,
1197
1380
  value: this.value,
1198
1381
  opt: this.opt,
1199
1382
  customValidate: this.customValidateFunctions && ((_this$customValidateF = this.customValidateFunctions) === null || _this$customValidateF === void 0 ? void 0 : _this$customValidateF.length) > 0,
@@ -1221,6 +1404,8 @@ var UnionSchema = /*#__PURE__*/function (_Schema) {
1221
1404
  var isReadonly = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
1222
1405
  var isHidden = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
1223
1406
  var description = arguments.length > 6 ? arguments[6] : undefined;
1407
+ var renderInput = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
1408
+ var previewInput = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : null;
1224
1409
  _classCallCheck(this, UnionSchema);
1225
1410
  _this = _callSuper(this, UnionSchema);
1226
1411
  _this.key = key;
@@ -1230,18 +1415,20 @@ var UnionSchema = /*#__PURE__*/function (_Schema) {
1230
1415
  _this.isReadonly = isReadonly;
1231
1416
  _this.isHidden = isHidden;
1232
1417
  _this.description = description;
1418
+ _this.renderInput = renderInput;
1419
+ _this.previewInput = previewInput;
1233
1420
  return _this;
1234
1421
  }
1235
1422
  _inherits(UnionSchema, _Schema);
1236
1423
  return _createClass(UnionSchema, [{
1237
1424
  key: "describe",
1238
1425
  value: function describe(description) {
1239
- return new UnionSchema(this.key, this.items, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined);
1426
+ return new UnionSchema(this.key, this.items, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined, this.renderInput, this.previewInput);
1240
1427
  }
1241
1428
  }, {
1242
1429
  key: "validate",
1243
1430
  value: function validate(validationFunction) {
1244
- return new UnionSchema(this.key, this.items, this.opt, this.customValidateFunctions.concat(validationFunction), this.isReadonly, this.isHidden, this.description);
1431
+ return new UnionSchema(this.key, this.items, this.opt, this.customValidateFunctions.concat(validationFunction), this.isReadonly, this.isHidden, this.description, this.renderInput, this.previewInput);
1245
1432
  }
1246
1433
  }, {
1247
1434
  key: "executeValidate",
@@ -1534,17 +1721,18 @@ var UnionSchema = /*#__PURE__*/function (_Schema) {
1534
1721
  }, {
1535
1722
  key: "nullable",
1536
1723
  value: function nullable() {
1537
- return new UnionSchema(this.key, this.items, true, [], this.isReadonly, this.isHidden, this.description);
1724
+ // Explicit type args: `previewInput` would otherwise pin inference to `Src`.
1725
+ return new UnionSchema(this.key, this.items, true, [], this.isReadonly, this.isHidden, this.description, this.renderInput, this.previewInput);
1538
1726
  }
1539
1727
  }, {
1540
1728
  key: "readonly",
1541
1729
  value: function readonly() {
1542
- return new UnionSchema(this.key, this.items, this.opt, this.customValidateFunctions, true, this.isHidden, this.description);
1730
+ return new UnionSchema(this.key, this.items, this.opt, this.customValidateFunctions, true, this.isHidden, this.description, this.renderInput, this.previewInput);
1543
1731
  }
1544
1732
  }, {
1545
1733
  key: "hidden",
1546
1734
  value: function hidden() {
1547
- return new UnionSchema(this.key, this.items, this.opt, this.customValidateFunctions, this.isReadonly, true, this.description);
1735
+ return new UnionSchema(this.key, this.items, this.opt, this.customValidateFunctions, this.isReadonly, true, this.description, this.renderInput, this.previewInput);
1548
1736
  }
1549
1737
  }, {
1550
1738
  key: "executeCustomValidateAt",
@@ -1604,14 +1792,69 @@ var UnionSchema = /*#__PURE__*/function (_Schema) {
1604
1792
  }
1605
1793
  return null;
1606
1794
  }
1795
+
1796
+ /**
1797
+ * How this field is laid out in the editor when it is the item of an array
1798
+ * or record: `{ as: "inline" }` renders the field itself inside each row,
1799
+ * instead of a preview row that navigates to it.
1800
+ *
1801
+ * Static configuration, not a callback — see `render.ts`.
1802
+ */
1803
+ }, {
1804
+ key: "render",
1805
+ value: function render(input) {
1806
+ return new UnionSchema(this.key, this.items, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, input, this.previewInput);
1807
+ }
1808
+
1809
+ /**
1810
+ * How this VALUE is shown where a preview of it is needed — a row in a
1811
+ * sortable list, a reference dropdown, a search hit. Never how the field
1812
+ * itself is edited (that is `render`). See `preview.ts`.
1813
+ *
1814
+ * Without one of its own, a tagged union previews as the VARIANT the value
1815
+ * takes — declare `preview` on the member objects and the union dispatches.
1816
+ */
1817
+ }, {
1818
+ key: "preview",
1819
+ value: function preview(select) {
1820
+ return new UnionSchema(this.key, this.items, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.renderInput, select);
1821
+ }
1822
+ }, {
1823
+ key: "executePreviewItem",
1824
+ value: function executePreviewItem(src) {
1825
+ if (this.previewInput !== null) {
1826
+ return this.previewInput({
1827
+ val: src
1828
+ });
1829
+ }
1830
+ // Only the union knows which variant the value takes; the variant's own
1831
+ // `preview` is what it previews as.
1832
+ var matched = this.matchedVariant(src);
1833
+ if (matched) {
1834
+ return matched["executePreviewItem"](src);
1835
+ }
1836
+ return null;
1837
+ }
1838
+ }, {
1839
+ key: "declaresItemPreview",
1840
+ value: function declaresItemPreview() {
1841
+ if (this.previewInput !== null) {
1842
+ return true;
1843
+ }
1844
+ return Array.isArray(this.items) && this.items.some(function (item) {
1845
+ return item["declaresItemPreview"]();
1846
+ });
1847
+ }
1607
1848
  }, {
1608
1849
  key: "executeSerialize",
1609
1850
  value: function executeSerialize() {
1610
- var _this$customValidateF2;
1851
+ var _this$renderInput2, _this$customValidateF2;
1611
1852
  if (typeof this.key === "string") {
1612
- var _this$customValidateF;
1853
+ var _this$renderInput, _this$customValidateF;
1613
1854
  return {
1614
1855
  type: "union",
1856
+ render: (_this$renderInput = this.renderInput) !== null && _this$renderInput !== void 0 ? _this$renderInput : undefined,
1857
+ preview: this.previewInput ? true : undefined,
1615
1858
  key: this.key,
1616
1859
  items: this.items.map(function (o) {
1617
1860
  return o["executeSerialize"]();
@@ -1625,6 +1868,8 @@ var UnionSchema = /*#__PURE__*/function (_Schema) {
1625
1868
  }
1626
1869
  return {
1627
1870
  type: "union",
1871
+ render: (_this$renderInput2 = this.renderInput) !== null && _this$renderInput2 !== void 0 ? _this$renderInput2 : undefined,
1872
+ preview: this.previewInput ? true : undefined,
1628
1873
  key: this.key["executeSerialize"](),
1629
1874
  items: this.items.map(function (o) {
1630
1875
  return o["executeSerialize"]();
@@ -1861,6 +2106,8 @@ var ImageSchema = /*#__PURE__*/function (_Schema) {
1861
2106
  var isReadonly = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
1862
2107
  var isHidden = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
1863
2108
  var description = arguments.length > 7 ? arguments[7] : undefined;
2109
+ var renderInput = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : null;
2110
+ var previewInput = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : null;
1864
2111
  _classCallCheck(this, ImageSchema);
1865
2112
  _this = _callSuper(this, ImageSchema);
1866
2113
  _this.options = options;
@@ -1871,23 +2118,25 @@ var ImageSchema = /*#__PURE__*/function (_Schema) {
1871
2118
  _this.isReadonly = isReadonly;
1872
2119
  _this.isHidden = isHidden;
1873
2120
  _this.description = description;
2121
+ _this.renderInput = renderInput;
2122
+ _this.previewInput = previewInput;
1874
2123
  return _this;
1875
2124
  }
1876
2125
  _inherits(ImageSchema, _Schema);
1877
2126
  return _createClass(ImageSchema, [{
1878
2127
  key: "describe",
1879
2128
  value: function describe(description) {
1880
- return new ImageSchema(this.options, this.opt, this.isRemote, this.customValidateFunctions, this.moduleMetadata, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined);
2129
+ return new ImageSchema(this.options, this.opt, this.isRemote, this.customValidateFunctions, this.moduleMetadata, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined, this.renderInput, this.previewInput);
1881
2130
  }
1882
2131
  }, {
1883
2132
  key: "remote",
1884
2133
  value: function remote() {
1885
- return new ImageSchema(this.options, this.opt, true, this.customValidateFunctions, this.moduleMetadata, this.isReadonly, this.isHidden, this.description);
2134
+ return new ImageSchema(this.options, this.opt, true, this.customValidateFunctions, this.moduleMetadata, this.isReadonly, this.isHidden, this.description, this.renderInput, this.previewInput);
1886
2135
  }
1887
2136
  }, {
1888
2137
  key: "validate",
1889
2138
  value: function validate(validationFunction) {
1890
- return new ImageSchema(this.options, this.opt, this.isRemote, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.moduleMetadata, this.isReadonly, this.isHidden, this.description);
2139
+ return new ImageSchema(this.options, this.opt, this.isRemote, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.moduleMetadata, this.isReadonly, this.isHidden, this.description, this.renderInput, this.previewInput);
1891
2140
  }
1892
2141
  }, {
1893
2142
  key: "executeValidate",
@@ -2086,17 +2335,17 @@ var ImageSchema = /*#__PURE__*/function (_Schema) {
2086
2335
  }, {
2087
2336
  key: "nullable",
2088
2337
  value: function nullable() {
2089
- return new ImageSchema(this.options, true, this.isRemote, this.customValidateFunctions, this.moduleMetadata, this.isReadonly, this.isHidden, this.description);
2338
+ return new ImageSchema(this.options, true, this.isRemote, this.customValidateFunctions, this.moduleMetadata, this.isReadonly, this.isHidden, this.description, this.renderInput, this.previewInput);
2090
2339
  }
2091
2340
  }, {
2092
2341
  key: "readonly",
2093
2342
  value: function readonly() {
2094
- return new ImageSchema(this.options, this.opt, this.isRemote, this.customValidateFunctions, this.moduleMetadata, true, this.isHidden, this.description);
2343
+ return new ImageSchema(this.options, this.opt, this.isRemote, this.customValidateFunctions, this.moduleMetadata, true, this.isHidden, this.description, this.renderInput, this.previewInput);
2095
2344
  }
2096
2345
  }, {
2097
2346
  key: "hidden",
2098
2347
  value: function hidden() {
2099
- return new ImageSchema(this.options, this.opt, this.isRemote, this.customValidateFunctions, this.moduleMetadata, this.isReadonly, true, this.description);
2348
+ return new ImageSchema(this.options, this.opt, this.isRemote, this.customValidateFunctions, this.moduleMetadata, this.isReadonly, true, this.description, this.renderInput, this.previewInput);
2100
2349
  }
2101
2350
  }, {
2102
2351
  key: "executeCustomValidateAt",
@@ -2105,13 +2354,54 @@ var ImageSchema = /*#__PURE__*/function (_Schema) {
2105
2354
  path: path
2106
2355
  });
2107
2356
  }
2357
+
2358
+ /**
2359
+ * How this field is laid out in the editor when it is the item of an array
2360
+ * or record: `{ as: "inline" }` renders the field itself inside each row,
2361
+ * instead of a preview row that navigates to it.
2362
+ *
2363
+ * Static configuration, not a callback — see `render.ts`.
2364
+ */
2365
+ }, {
2366
+ key: "render",
2367
+ value: function render(input) {
2368
+ return new ImageSchema(this.options, this.opt, this.isRemote, this.customValidateFunctions, this.moduleMetadata, this.isReadonly, this.isHidden, this.description, input, this.previewInput);
2369
+ }
2370
+
2371
+ /**
2372
+ * How this VALUE is shown where a preview of it is needed — a row in a
2373
+ * sortable list, a reference dropdown, a search hit. Never how the field
2374
+ * itself is edited (that is `render`). See `preview.ts`.
2375
+ */
2376
+ }, {
2377
+ key: "preview",
2378
+ value: function preview(select) {
2379
+ return new ImageSchema(this.options, this.opt, this.isRemote, this.customValidateFunctions, this.moduleMetadata, this.isReadonly, this.isHidden, this.description, this.renderInput, select);
2380
+ }
2381
+ }, {
2382
+ key: "executePreviewItem",
2383
+ value: function executePreviewItem(src) {
2384
+ if (this.previewInput === null) {
2385
+ return null;
2386
+ }
2387
+ return this.previewInput({
2388
+ val: src
2389
+ });
2390
+ }
2391
+ }, {
2392
+ key: "declaresItemPreview",
2393
+ value: function declaresItemPreview() {
2394
+ return this.previewInput !== null;
2395
+ }
2108
2396
  }, {
2109
2397
  key: "executeSerialize",
2110
2398
  value: function executeSerialize() {
2111
- var _this$customValidateF;
2399
+ var _this$renderInput, _this$customValidateF;
2112
2400
  var modulePaths = this.moduleMetadata ? Object.keys(this.moduleMetadata) : [];
2113
2401
  return {
2114
2402
  type: "image",
2403
+ render: (_this$renderInput = this.renderInput) !== null && _this$renderInput !== void 0 ? _this$renderInput : undefined,
2404
+ preview: this.previewInput ? true : undefined,
2115
2405
  options: this.options,
2116
2406
  opt: this.opt,
2117
2407
  remote: this.isRemote,
@@ -2162,6 +2452,8 @@ var RouteSchema = /*#__PURE__*/function (_Schema) {
2162
2452
  var isReadonly = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
2163
2453
  var isHidden = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
2164
2454
  var description = arguments.length > 5 ? arguments[5] : undefined;
2455
+ var renderInput = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null;
2456
+ var previewInput = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
2165
2457
  _classCallCheck(this, RouteSchema);
2166
2458
  _this = _callSuper(this, RouteSchema);
2167
2459
  _this.options = options;
@@ -2170,13 +2462,15 @@ var RouteSchema = /*#__PURE__*/function (_Schema) {
2170
2462
  _this.isReadonly = isReadonly;
2171
2463
  _this.isHidden = isHidden;
2172
2464
  _this.description = description;
2465
+ _this.renderInput = renderInput;
2466
+ _this.previewInput = previewInput;
2173
2467
  return _this;
2174
2468
  }
2175
2469
  _inherits(RouteSchema, _Schema);
2176
2470
  return _createClass(RouteSchema, [{
2177
2471
  key: "describe",
2178
2472
  value: function describe(description) {
2179
- return new RouteSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined);
2473
+ return new RouteSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined, this.renderInput, this.previewInput);
2180
2474
  }
2181
2475
 
2182
2476
  /**
@@ -2196,7 +2490,7 @@ var RouteSchema = /*#__PURE__*/function (_Schema) {
2196
2490
  value: function include(pattern) {
2197
2491
  return new RouteSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
2198
2492
  include: pattern
2199
- }), this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description);
2493
+ }), this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.renderInput, this.previewInput);
2200
2494
  }
2201
2495
 
2202
2496
  /**
@@ -2216,12 +2510,12 @@ var RouteSchema = /*#__PURE__*/function (_Schema) {
2216
2510
  value: function exclude(pattern) {
2217
2511
  return new RouteSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
2218
2512
  exclude: pattern
2219
- }), this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description);
2513
+ }), this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.renderInput, this.previewInput);
2220
2514
  }
2221
2515
  }, {
2222
2516
  key: "validate",
2223
2517
  value: function validate(validationFunction) {
2224
- return new RouteSchema(this.options, this.opt, this.customValidateFunctions.concat(validationFunction), this.isReadonly, this.isHidden, this.description);
2518
+ return new RouteSchema(this.options, this.opt, this.customValidateFunctions.concat(validationFunction), this.isReadonly, this.isHidden, this.description, this.renderInput, this.previewInput);
2225
2519
  }
2226
2520
  }, {
2227
2521
  key: "executeValidate",
@@ -2276,17 +2570,17 @@ var RouteSchema = /*#__PURE__*/function (_Schema) {
2276
2570
  }, {
2277
2571
  key: "nullable",
2278
2572
  value: function nullable() {
2279
- return new RouteSchema(this.options, true, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description);
2573
+ return new RouteSchema(this.options, true, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.renderInput, this.previewInput);
2280
2574
  }
2281
2575
  }, {
2282
2576
  key: "readonly",
2283
2577
  value: function readonly() {
2284
- return new RouteSchema(this.options, this.opt, this.customValidateFunctions, true, this.isHidden, this.description);
2578
+ return new RouteSchema(this.options, this.opt, this.customValidateFunctions, true, this.isHidden, this.description, this.renderInput, this.previewInput);
2285
2579
  }
2286
2580
  }, {
2287
2581
  key: "hidden",
2288
2582
  value: function hidden() {
2289
- return new RouteSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, true, this.description);
2583
+ return new RouteSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, true, this.description, this.renderInput, this.previewInput);
2290
2584
  }
2291
2585
  }, {
2292
2586
  key: "executeCustomValidateAt",
@@ -2295,12 +2589,53 @@ var RouteSchema = /*#__PURE__*/function (_Schema) {
2295
2589
  path: path
2296
2590
  });
2297
2591
  }
2592
+
2593
+ /**
2594
+ * How this field is laid out in the editor when it is the item of an array
2595
+ * or record: `{ as: "inline" }` renders the field itself inside each row,
2596
+ * instead of a preview row that navigates to it.
2597
+ *
2598
+ * Static configuration, not a callback — see `render.ts`.
2599
+ */
2600
+ }, {
2601
+ key: "render",
2602
+ value: function render(input) {
2603
+ return new RouteSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, input, this.previewInput);
2604
+ }
2605
+
2606
+ /**
2607
+ * How this VALUE is shown where a preview of it is needed — a row in a
2608
+ * sortable list, a reference dropdown, a search hit. Never how the field
2609
+ * itself is edited (that is `render`). See `preview.ts`.
2610
+ */
2611
+ }, {
2612
+ key: "preview",
2613
+ value: function preview(select) {
2614
+ return new RouteSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.renderInput, select);
2615
+ }
2616
+ }, {
2617
+ key: "executePreviewItem",
2618
+ value: function executePreviewItem(src) {
2619
+ if (this.previewInput === null) {
2620
+ return null;
2621
+ }
2622
+ return this.previewInput({
2623
+ val: src
2624
+ });
2625
+ }
2626
+ }, {
2627
+ key: "declaresItemPreview",
2628
+ value: function declaresItemPreview() {
2629
+ return this.previewInput !== null;
2630
+ }
2298
2631
  }, {
2299
2632
  key: "executeSerialize",
2300
2633
  value: function executeSerialize() {
2301
- var _this$options3, _this$options4, _this$customValidateF, _this$customValidateF2;
2634
+ var _this$renderInput, _this$options3, _this$options4, _this$customValidateF, _this$customValidateF2;
2302
2635
  return {
2303
2636
  type: "route",
2637
+ render: (_this$renderInput = this.renderInput) !== null && _this$renderInput !== void 0 ? _this$renderInput : undefined,
2638
+ preview: this.previewInput ? true : undefined,
2304
2639
  options: {
2305
2640
  include: ((_this$options3 = this.options) === null || _this$options3 === void 0 ? void 0 : _this$options3.include) && {
2306
2641
  source: this.options.include.source,
@@ -2338,6 +2673,8 @@ var RichTextSchema = /*#__PURE__*/function (_Schema) {
2338
2673
  var isReadonly = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
2339
2674
  var isHidden = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
2340
2675
  var description = arguments.length > 5 ? arguments[5] : undefined;
2676
+ var renderInput = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null;
2677
+ var previewInput = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
2341
2678
  _classCallCheck(this, RichTextSchema);
2342
2679
  _this = _callSuper(this, RichTextSchema);
2343
2680
  _this.options = options;
@@ -2346,32 +2683,34 @@ var RichTextSchema = /*#__PURE__*/function (_Schema) {
2346
2683
  _this.isReadonly = isReadonly;
2347
2684
  _this.isHidden = isHidden;
2348
2685
  _this.description = description;
2686
+ _this.renderInput = renderInput;
2687
+ _this.previewInput = previewInput;
2349
2688
  return _this;
2350
2689
  }
2351
2690
  _inherits(RichTextSchema, _Schema);
2352
2691
  return _createClass(RichTextSchema, [{
2353
2692
  key: "describe",
2354
2693
  value: function describe(description) {
2355
- return new RichTextSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined);
2694
+ return new RichTextSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined, this.renderInput, this.previewInput);
2356
2695
  }
2357
2696
  }, {
2358
2697
  key: "maxLength",
2359
2698
  value: function maxLength(max) {
2360
2699
  return new RichTextSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
2361
2700
  maxLength: max
2362
- }), this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description);
2701
+ }), this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.renderInput, this.previewInput);
2363
2702
  }
2364
2703
  }, {
2365
2704
  key: "minLength",
2366
2705
  value: function minLength(min) {
2367
2706
  return new RichTextSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
2368
2707
  minLength: min
2369
- }), this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description);
2708
+ }), this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.renderInput, this.previewInput);
2370
2709
  }
2371
2710
  }, {
2372
2711
  key: "validate",
2373
2712
  value: function validate(validationFunction) {
2374
- return new RichTextSchema(this.options, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.isReadonly, this.isHidden, this.description);
2713
+ return new RichTextSchema(this.options, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.isReadonly, this.isHidden, this.description, this.renderInput, this.previewInput);
2375
2714
  }
2376
2715
  }, {
2377
2716
  key: "executeValidate",
@@ -2821,17 +3160,17 @@ var RichTextSchema = /*#__PURE__*/function (_Schema) {
2821
3160
  }, {
2822
3161
  key: "nullable",
2823
3162
  value: function nullable() {
2824
- return new RichTextSchema(this.options, true, [], this.isReadonly, this.isHidden, this.description);
3163
+ return new RichTextSchema(this.options, true, [], this.isReadonly, this.isHidden, this.description, this.renderInput, this.previewInput);
2825
3164
  }
2826
3165
  }, {
2827
3166
  key: "readonly",
2828
3167
  value: function readonly() {
2829
- return new RichTextSchema(this.options, this.opt, this.customValidateFunctions, true, this.isHidden, this.description);
3168
+ return new RichTextSchema(this.options, this.opt, this.customValidateFunctions, true, this.isHidden, this.description, this.renderInput, this.previewInput);
2830
3169
  }
2831
3170
  }, {
2832
3171
  key: "hidden",
2833
3172
  value: function hidden() {
2834
- return new RichTextSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, true, this.description);
3173
+ return new RichTextSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, true, this.description, this.renderInput, this.previewInput);
2835
3174
  }
2836
3175
  }, {
2837
3176
  key: "executeCustomValidateAt",
@@ -2840,10 +3179,50 @@ var RichTextSchema = /*#__PURE__*/function (_Schema) {
2840
3179
  path: path
2841
3180
  });
2842
3181
  }
3182
+
3183
+ /**
3184
+ * How this field is laid out in the editor when it is the item of an array
3185
+ * or record: `{ as: "inline" }` renders the field itself inside each row,
3186
+ * instead of a preview row that navigates to it.
3187
+ *
3188
+ * Static configuration, not a callback — see `render.ts`.
3189
+ */
3190
+ }, {
3191
+ key: "render",
3192
+ value: function render(input) {
3193
+ return new RichTextSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, input, this.previewInput);
3194
+ }
3195
+
3196
+ /**
3197
+ * How this VALUE is shown where a preview of it is needed — a row in a
3198
+ * sortable list, a reference dropdown, a search hit. Never how the field
3199
+ * itself is edited (that is `render`). See `preview.ts`.
3200
+ */
3201
+ }, {
3202
+ key: "preview",
3203
+ value: function preview(select) {
3204
+ return new RichTextSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.renderInput, select);
3205
+ }
3206
+ }, {
3207
+ key: "executePreviewItem",
3208
+ value: function executePreviewItem(src) {
3209
+ if (this.previewInput === null) {
3210
+ return null;
3211
+ }
3212
+ return this.previewInput({
3213
+ val: src
3214
+ });
3215
+ }
3216
+ }, {
3217
+ key: "declaresItemPreview",
3218
+ value: function declaresItemPreview() {
3219
+ return this.previewInput !== null;
3220
+ }
2843
3221
  }, {
2844
3222
  key: "executeSerialize",
2845
3223
  value: function executeSerialize() {
2846
3224
  var _this3 = this,
3225
+ _this$renderInput,
2847
3226
  _this$customValidateF;
2848
3227
  var serializeAnchorSchema = function serializeAnchorSchema() {
2849
3228
  var _this3$options$inline, _this3$options$inline3;
@@ -2870,6 +3249,8 @@ var RichTextSchema = /*#__PURE__*/function (_Schema) {
2870
3249
  };
2871
3250
  return {
2872
3251
  type: "richtext",
3252
+ render: (_this$renderInput = this.renderInput) !== null && _this$renderInput !== void 0 ? _this$renderInput : undefined,
3253
+ preview: this.previewInput ? true : undefined,
2873
3254
  opt: this.opt,
2874
3255
  options: serializedOptions,
2875
3256
  customValidate: this.customValidateFunctions && ((_this$customValidateF = this.customValidateFunctions) === null || _this$customValidateF === void 0 ? void 0 : _this$customValidateF.length) > 0,
@@ -3214,6 +3595,7 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
3214
3595
  var description = arguments.length > 8 ? arguments[8] : undefined;
3215
3596
  var isJsonValues = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : false;
3216
3597
  var previewInput = arguments.length > 10 && arguments[10] !== undefined ? arguments[10] : null;
3598
+ var renderInput = arguments.length > 11 && arguments[11] !== undefined ? arguments[11] : null;
3217
3599
  _classCallCheck(this, RecordSchema);
3218
3600
  _this = _callSuper(this, RecordSchema);
3219
3601
  _this.item = item;
@@ -3227,18 +3609,19 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
3227
3609
  _this.description = description;
3228
3610
  _this.isJsonValues = isJsonValues;
3229
3611
  _this.previewInput = previewInput;
3612
+ _this.renderInput = renderInput;
3230
3613
  return _this;
3231
3614
  }
3232
3615
  _inherits(RecordSchema, _Schema);
3233
3616
  return _createClass(RecordSchema, [{
3234
3617
  key: "describe",
3235
3618
  value: function describe(description) {
3236
- return new RecordSchema(this.item, this.opt, this.customValidateFunctions, this.currentRouter, this.keySchema, this.mediaOptions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined, this.isJsonValues, this.previewInput);
3619
+ return new RecordSchema(this.item, this.opt, this.customValidateFunctions, this.currentRouter, this.keySchema, this.mediaOptions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined, this.isJsonValues, this.previewInput, this.renderInput);
3237
3620
  }
3238
3621
  }, {
3239
3622
  key: "validate",
3240
3623
  value: function validate(validationFunction) {
3241
- return new RecordSchema(this.item, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.currentRouter, this.keySchema, this.mediaOptions, this.isReadonly, this.isHidden, this.description, this.isJsonValues, this.previewInput);
3624
+ return new RecordSchema(this.item, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.currentRouter, this.keySchema, this.mediaOptions, this.isReadonly, this.isHidden, this.description, this.isJsonValues, this.previewInput, this.renderInput);
3242
3625
  }
3243
3626
  }, {
3244
3627
  key: "executeValidate",
@@ -3321,8 +3704,8 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
3321
3704
  if (_this2.keySchema) {
3322
3705
  var keyPath = createValPathOfItem(path, key);
3323
3706
  if (!keyPath) {
3324
- throw new Error("Internal error: could not create path at ".concat(!path && typeof path === "string" ? "<empty string>" : path, " for key validation")) // Should! never happen
3325
- ;
3707
+ throw new Error("Internal error: could not create path at ".concat(!path && typeof path === "string" ? "<empty string>" : path, " for key validation") // Should! never happen
3708
+ );
3326
3709
  }
3327
3710
  var keyError = _this2.keySchema["executeValidate"](keyPath, key);
3328
3711
  if (keyError) {
@@ -3597,29 +3980,29 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
3597
3980
  }, {
3598
3981
  key: "nullable",
3599
3982
  value: function nullable() {
3600
- return new RecordSchema(this.item, true, this.customValidateFunctions, this.currentRouter, this.keySchema, this.mediaOptions, this.isReadonly, this.isHidden, this.description, this.isJsonValues, this.previewInput);
3983
+ return new RecordSchema(this.item, true, this.customValidateFunctions, this.currentRouter, this.keySchema, this.mediaOptions, this.isReadonly, this.isHidden, this.description, this.isJsonValues, this.previewInput, this.renderInput);
3601
3984
  }
3602
3985
  }, {
3603
3986
  key: "readonly",
3604
3987
  value: function readonly() {
3605
- return new RecordSchema(this.item, this.opt, this.customValidateFunctions, this.currentRouter, this.keySchema, this.mediaOptions, true, this.isHidden, this.description, this.isJsonValues, this.previewInput);
3988
+ return new RecordSchema(this.item, this.opt, this.customValidateFunctions, this.currentRouter, this.keySchema, this.mediaOptions, true, this.isHidden, this.description, this.isJsonValues, this.previewInput, this.renderInput);
3606
3989
  }
3607
3990
  }, {
3608
3991
  key: "hidden",
3609
3992
  value: function hidden() {
3610
- return new RecordSchema(this.item, this.opt, this.customValidateFunctions, this.currentRouter, this.keySchema, this.mediaOptions, this.isReadonly, true, this.description, this.isJsonValues, this.previewInput);
3993
+ return new RecordSchema(this.item, this.opt, this.customValidateFunctions, this.currentRouter, this.keySchema, this.mediaOptions, this.isReadonly, true, this.description, this.isJsonValues, this.previewInput, this.renderInput);
3611
3994
  }
3612
3995
  }, {
3613
3996
  key: "router",
3614
3997
  value: function router(_router) {
3615
- return new RecordSchema(this.item, this.opt, this.customValidateFunctions, _router, this.keySchema, this.mediaOptions, this.isReadonly, this.isHidden, this.description, this.isJsonValues, this.previewInput);
3998
+ return new RecordSchema(this.item, this.opt, this.customValidateFunctions, _router, this.keySchema, this.mediaOptions, this.isReadonly, this.isHidden, this.description, this.isJsonValues, this.previewInput, this.renderInput);
3616
3999
  }
3617
4000
  }, {
3618
4001
  key: "remote",
3619
4002
  value: function remote() {
3620
4003
  return new RecordSchema(this.item, this.opt, this.customValidateFunctions, this.currentRouter, this.keySchema, this.mediaOptions ? _objectSpread2(_objectSpread2({}, this.mediaOptions), {}, {
3621
4004
  remote: true
3622
- }) : undefined, this.isReadonly, this.isHidden, this.description, this.isJsonValues, this.previewInput);
4005
+ }) : undefined, this.isReadonly, this.isHidden, this.description, this.isJsonValues, this.previewInput, this.renderInput);
3623
4006
  }
3624
4007
 
3625
4008
  /**
@@ -3649,9 +4032,19 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
3649
4032
  // `.validate(...)` in their source file that never ran anywhere.
3650
4033
  throw new Error(".jsonValues() must come BEFORE .validate(): a validator added first is typed against the un-lazy source shape and cannot be carried over. Write s.record(...).jsonValues().validate(...) instead.");
3651
4034
  }
4035
+ if (this.previewInput !== null) {
4036
+ // Same reasoning as the validator guard above: the record's own preview
4037
+ // closure is typed against the un-lazy source shape.
4038
+ throw new Error(".jsonValues() must come BEFORE .preview(): a preview added first is typed against the un-lazy source shape and cannot be carried over. Write s.record(...).jsonValues().preview(...) instead.");
4039
+ }
4040
+ // Explicit type args instead of a cast on the result: `previewInput` would
4041
+ // otherwise pin inference to `Src`, and the two record source shapes no
4042
+ // longer overlap enough for the old assertion.
3652
4043
  return new RecordSchema(this.item, this.opt,
3653
4044
  // Empty by construction: the guard above rejects any that were registered.
3654
- [], this.currentRouter, this.keySchema, this.mediaOptions, this.isReadonly, this.isHidden, this.description, true, this.previewInput);
4045
+ [], this.currentRouter, this.keySchema, this.mediaOptions, this.isReadonly, this.isHidden, this.description, true,
4046
+ // Null by construction: the guard above rejects any that was declared.
4047
+ null, this.renderInput);
3655
4048
  }
3656
4049
  }, {
3657
4050
  key: "getRouterValidations",
@@ -3683,8 +4076,8 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
3683
4076
  }
3684
4077
  var subPath = createValPathOfItem(path, validation.error.urlPath);
3685
4078
  if (!subPath) {
3686
- throw new Error("Internal error: could not create path at ".concat(!path && typeof path === "string" ? "<empty string>" : path, " for router validation")) // Should! never happen
3687
- ;
4079
+ throw new Error("Internal error: could not create path at ".concat(!path && typeof path === "string" ? "<empty string>" : path, " for router validation") // Should! never happen
4080
+ );
3688
4081
  }
3689
4082
  return [subPath, [{
3690
4083
  message: validation.error.message,
@@ -3705,9 +4098,10 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
3705
4098
  }, {
3706
4099
  key: "executeSerialize",
3707
4100
  value: function executeSerialize() {
3708
- var _this$keySchema, _this$currentRouter, _this$customValidateF;
4101
+ var _this$renderInput, _this$keySchema, _this$currentRouter, _this$customValidateF;
3709
4102
  var result = {
3710
4103
  type: "record",
4104
+ render: (_this$renderInput = this.renderInput) !== null && _this$renderInput !== void 0 ? _this$renderInput : undefined,
3711
4105
  item: this.item["executeSerialize"](),
3712
4106
  key: (_this$keySchema = this.keySchema) === null || _this$keySchema === void 0 ? void 0 : _this$keySchema["executeSerialize"](),
3713
4107
  opt: this.opt,
@@ -3771,8 +4165,10 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
3771
4165
  res[_key2] = itemResult[_key2];
3772
4166
  }
3773
4167
  }
3774
- if (this.previewInput) {
3775
- var prepare = this.previewInput;
4168
+ // The entries preview comes from the ITEM schema's own `preview` — the
4169
+ // container just runs it per entry. Asked as a fact rather than by running
4170
+ // the closure, so an empty record still previews as an empty record.
4171
+ if (this.item["declaresItemPreview"]()) {
3776
4172
  // See the same block in `array`: the whole record when the record is what
3777
4173
  // is being shown, only the wanted entries when it is not.
3778
4174
  var window = scope !== undefined && !scope.wants(sourcePath) ? scope : null;
@@ -3784,6 +4180,9 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
3784
4180
  if (isJson(val)) {
3785
4181
  continue; // as above: nothing to select from an un-loaded entry
3786
4182
  }
4183
+ if (val === null || val === undefined) {
4184
+ continue;
4185
+ }
3787
4186
  if (window !== null && !window.wantsUnder(unsafeCreateSourcePath(sourcePath, _key3))) {
3788
4187
  continue;
3789
4188
  }
@@ -3791,18 +4190,17 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
3791
4190
  // data trips it up must not take out the whole list.
3792
4191
  try {
3793
4192
  // NB NB: display is actually defined by the user
3794
- var _prepare = prepare({
3795
- key: _key3,
3796
- val: val
3797
- }),
3798
- title = _prepare.title,
3799
- subtitle = _prepare.subtitle,
3800
- image = _prepare.image;
3801
- items.push([_key3, {
3802
- title: title,
3803
- subtitle: subtitle,
3804
- image: image
3805
- }]);
4193
+ var _item = this.item["executePreviewItem"](val);
4194
+ if (_item !== null) {
4195
+ var title = _item.title,
4196
+ subtitle = _item.subtitle,
4197
+ image = _item.image;
4198
+ items.push([_key3, {
4199
+ title: title,
4200
+ subtitle: subtitle,
4201
+ image: image
4202
+ }]);
4203
+ }
3806
4204
  } catch (e) {
3807
4205
  res[unsafeCreateSourcePath(sourcePath, _key3)] = {
3808
4206
  status: "error",
@@ -3820,19 +4218,45 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
3820
4218
  }
3821
4219
  return res;
3822
4220
  }
4221
+ }, {
4222
+ key: "executePreviewItem",
4223
+ value: function executePreviewItem(src) {
4224
+ if (this.previewInput === null) {
4225
+ return null;
4226
+ }
4227
+ return this.previewInput({
4228
+ val: src
4229
+ });
4230
+ }
4231
+ }, {
4232
+ key: "declaresItemPreview",
4233
+ value: function declaresItemPreview() {
4234
+ return this.previewInput !== null;
4235
+ }
3823
4236
 
3824
4237
  /**
3825
- * What the editor shows for each ENTRY of this record: a title, and optionally
3826
- * a subtitle and an image.
3827
- *
3828
- * `select` is your own code over the entry's key and source, so it is run on
3829
- * demand for the entries that are actually being looked at — see
3830
- * `PreviewScope`.
4238
+ * How this RECORD ITSELF is shown where a preview of it is needed — when it
4239
+ * is the item of another container, in search, in references. What its
4240
+ * entries show is the ITEM schema's `preview`, not this. Never how the field
4241
+ * is edited (that is `render`). See `preview.ts`.
3831
4242
  */
3832
4243
  }, {
3833
4244
  key: "preview",
3834
4245
  value: function preview(select) {
3835
- return new RecordSchema(this.item, this.opt, this.customValidateFunctions, this.currentRouter, this.keySchema, this.mediaOptions, this.isReadonly, this.isHidden, this.description, this.isJsonValues, select);
4246
+ return new RecordSchema(this.item, this.opt, this.customValidateFunctions, this.currentRouter, this.keySchema, this.mediaOptions, this.isReadonly, this.isHidden, this.description, this.isJsonValues, select, this.renderInput);
4247
+ }
4248
+
4249
+ /**
4250
+ * How this field is laid out in the editor when it is the item of an array
4251
+ * or record: `{ as: "inline" }` renders the field itself inside each row,
4252
+ * instead of a preview row that navigates to it.
4253
+ *
4254
+ * Static configuration, not a callback — see `render.ts`.
4255
+ */
4256
+ }, {
4257
+ key: "render",
4258
+ value: function render(input) {
4259
+ return new RecordSchema(this.item, this.opt, this.customValidateFunctions, this.currentRouter, this.keySchema, this.mediaOptions, this.isReadonly, this.isHidden, this.description, this.isJsonValues, this.previewInput, input);
3836
4260
  }
3837
4261
  }]);
3838
4262
  }(Schema);
@@ -3860,6 +4284,19 @@ schema, source) {
3860
4284
  function getSource(valModule) {
3861
4285
  return valModule[GetSource];
3862
4286
  }
4287
+
4288
+ /**
4289
+ * Whether `value` is a Val module, i.e. something {@link define} produced.
4290
+ *
4291
+ * Checks for the three symbols `define` writes, rather than a class identity:
4292
+ * a module may have been created by a different copy of `@valbuild/core` (the
4293
+ * editor SPA and the host bundle each ship their own, and the CLI evaluates
4294
+ * user modules inside a `node:vm` context). The symbols are created with
4295
+ * `Symbol.for`, so they are shared across all of those; a constructor is not.
4296
+ */
4297
+ function isValModule(value) {
4298
+ return _typeof(value) === "object" && value !== null && GetSource in value && GetSchema in value && Path in value;
4299
+ }
3863
4300
  function splitModuleFilePathAndModulePath(path) {
3864
4301
  var pathOfSep = path.indexOf(ModuleFilePathSep);
3865
4302
  if (pathOfSep === -1) {
@@ -4388,6 +4825,8 @@ var NumberSchema = /*#__PURE__*/function (_Schema) {
4388
4825
  var isReadonly = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
4389
4826
  var isHidden = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
4390
4827
  var description = arguments.length > 5 ? arguments[5] : undefined;
4828
+ var renderInput = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null;
4829
+ var previewInput = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
4391
4830
  _classCallCheck(this, NumberSchema);
4392
4831
  _this = _callSuper(this, NumberSchema);
4393
4832
  _this.options = options;
@@ -4396,18 +4835,20 @@ var NumberSchema = /*#__PURE__*/function (_Schema) {
4396
4835
  _this.isReadonly = isReadonly;
4397
4836
  _this.isHidden = isHidden;
4398
4837
  _this.description = description;
4838
+ _this.renderInput = renderInput;
4839
+ _this.previewInput = previewInput;
4399
4840
  return _this;
4400
4841
  }
4401
4842
  _inherits(NumberSchema, _Schema);
4402
4843
  return _createClass(NumberSchema, [{
4403
4844
  key: "describe",
4404
4845
  value: function describe(description) {
4405
- return new NumberSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined);
4846
+ return new NumberSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined, this.renderInput, this.previewInput);
4406
4847
  }
4407
4848
  }, {
4408
4849
  key: "validate",
4409
4850
  value: function validate(validationFunction) {
4410
- return new NumberSchema(this.options, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.isReadonly, this.isHidden, this.description);
4851
+ return new NumberSchema(this.options, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.isReadonly, this.isHidden, this.description, this.renderInput, this.previewInput);
4411
4852
  }
4412
4853
  }, {
4413
4854
  key: "executeValidate",
@@ -4477,31 +4918,31 @@ var NumberSchema = /*#__PURE__*/function (_Schema) {
4477
4918
  }, {
4478
4919
  key: "nullable",
4479
4920
  value: function nullable() {
4480
- return new NumberSchema(this.options, true, [], this.isReadonly, this.isHidden, this.description);
4921
+ return new NumberSchema(this.options, true, [], this.isReadonly, this.isHidden, this.description, this.renderInput, this.previewInput);
4481
4922
  }
4482
4923
  }, {
4483
4924
  key: "readonly",
4484
4925
  value: function readonly() {
4485
- return new NumberSchema(this.options, this.opt, this.customValidateFunctions, true, this.isHidden, this.description);
4926
+ return new NumberSchema(this.options, this.opt, this.customValidateFunctions, true, this.isHidden, this.description, this.renderInput, this.previewInput);
4486
4927
  }
4487
4928
  }, {
4488
4929
  key: "hidden",
4489
4930
  value: function hidden() {
4490
- return new NumberSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, true, this.description);
4931
+ return new NumberSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, true, this.description, this.renderInput, this.previewInput);
4491
4932
  }
4492
4933
  }, {
4493
4934
  key: "max",
4494
4935
  value: function max(_max) {
4495
4936
  return new NumberSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
4496
4937
  max: _max
4497
- }), this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description);
4938
+ }), this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.renderInput, this.previewInput);
4498
4939
  }
4499
4940
  }, {
4500
4941
  key: "min",
4501
4942
  value: function min(_min) {
4502
4943
  return new NumberSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
4503
4944
  min: _min
4504
- }), this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description);
4945
+ }), this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.renderInput, this.previewInput);
4505
4946
  }
4506
4947
  }, {
4507
4948
  key: "executeCustomValidateAt",
@@ -4510,12 +4951,53 @@ var NumberSchema = /*#__PURE__*/function (_Schema) {
4510
4951
  path: path
4511
4952
  });
4512
4953
  }
4954
+
4955
+ /**
4956
+ * How this field is laid out in the editor when it is the item of an array
4957
+ * or record: `{ as: "inline" }` renders the field itself inside each row,
4958
+ * instead of a preview row that navigates to it.
4959
+ *
4960
+ * Static configuration, not a callback — see `render.ts`.
4961
+ */
4962
+ }, {
4963
+ key: "render",
4964
+ value: function render(input) {
4965
+ return new NumberSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, input, this.previewInput);
4966
+ }
4967
+
4968
+ /**
4969
+ * How this VALUE is shown where a preview of it is needed — a row in a
4970
+ * sortable list, a reference dropdown, a search hit. Never how the field
4971
+ * itself is edited (that is `render`). See `preview.ts`.
4972
+ */
4973
+ }, {
4974
+ key: "preview",
4975
+ value: function preview(select) {
4976
+ return new NumberSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.renderInput, select);
4977
+ }
4978
+ }, {
4979
+ key: "executePreviewItem",
4980
+ value: function executePreviewItem(src) {
4981
+ if (this.previewInput === null) {
4982
+ return null;
4983
+ }
4984
+ return this.previewInput({
4985
+ val: src
4986
+ });
4987
+ }
4988
+ }, {
4989
+ key: "declaresItemPreview",
4990
+ value: function declaresItemPreview() {
4991
+ return this.previewInput !== null;
4992
+ }
4513
4993
  }, {
4514
4994
  key: "executeSerialize",
4515
4995
  value: function executeSerialize() {
4516
- var _this$customValidateF;
4996
+ var _this$renderInput, _this$customValidateF;
4517
4997
  return {
4518
4998
  type: "number",
4999
+ render: (_this$renderInput = this.renderInput) !== null && _this$renderInput !== void 0 ? _this$renderInput : undefined,
5000
+ preview: this.previewInput ? true : undefined,
4519
5001
  options: this.options,
4520
5002
  opt: this.opt,
4521
5003
  customValidate: this.customValidateFunctions && ((_this$customValidateF = this.customValidateFunctions) === null || _this$customValidateF === void 0 ? void 0 : _this$customValidateF.length) > 0,
@@ -4543,6 +5025,8 @@ var BooleanSchema = /*#__PURE__*/function (_Schema) {
4543
5025
  var isReadonly = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
4544
5026
  var isHidden = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
4545
5027
  var description = arguments.length > 4 ? arguments[4] : undefined;
5028
+ var renderInput = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : null;
5029
+ var previewInput = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null;
4546
5030
  _classCallCheck(this, BooleanSchema);
4547
5031
  _this = _callSuper(this, BooleanSchema);
4548
5032
  _this.opt = opt;
@@ -4550,18 +5034,20 @@ var BooleanSchema = /*#__PURE__*/function (_Schema) {
4550
5034
  _this.isReadonly = isReadonly;
4551
5035
  _this.isHidden = isHidden;
4552
5036
  _this.description = description;
5037
+ _this.renderInput = renderInput;
5038
+ _this.previewInput = previewInput;
4553
5039
  return _this;
4554
5040
  }
4555
5041
  _inherits(BooleanSchema, _Schema);
4556
5042
  return _createClass(BooleanSchema, [{
4557
5043
  key: "describe",
4558
5044
  value: function describe(description) {
4559
- return new BooleanSchema(this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined);
5045
+ return new BooleanSchema(this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined, this.renderInput, this.previewInput);
4560
5046
  }
4561
5047
  }, {
4562
5048
  key: "validate",
4563
5049
  value: function validate(validationFunction) {
4564
- return new BooleanSchema(this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.isReadonly, this.isHidden, this.description);
5050
+ return new BooleanSchema(this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.isReadonly, this.isHidden, this.description, this.renderInput, this.previewInput);
4565
5051
  }
4566
5052
  }, {
4567
5053
  key: "executeValidate",
@@ -4612,17 +5098,17 @@ var BooleanSchema = /*#__PURE__*/function (_Schema) {
4612
5098
  }, {
4613
5099
  key: "nullable",
4614
5100
  value: function nullable() {
4615
- return new BooleanSchema(true, [], this.isReadonly, this.isHidden, this.description);
5101
+ return new BooleanSchema(true, [], this.isReadonly, this.isHidden, this.description, this.renderInput, this.previewInput);
4616
5102
  }
4617
5103
  }, {
4618
5104
  key: "readonly",
4619
5105
  value: function readonly() {
4620
- return new BooleanSchema(this.opt, this.customValidateFunctions, true, this.isHidden, this.description);
5106
+ return new BooleanSchema(this.opt, this.customValidateFunctions, true, this.isHidden, this.description, this.renderInput, this.previewInput);
4621
5107
  }
4622
5108
  }, {
4623
5109
  key: "hidden",
4624
5110
  value: function hidden() {
4625
- return new BooleanSchema(this.opt, this.customValidateFunctions, this.isReadonly, true, this.description);
5111
+ return new BooleanSchema(this.opt, this.customValidateFunctions, this.isReadonly, true, this.description, this.renderInput, this.previewInput);
4626
5112
  }
4627
5113
  }, {
4628
5114
  key: "executeCustomValidateAt",
@@ -4631,12 +5117,53 @@ var BooleanSchema = /*#__PURE__*/function (_Schema) {
4631
5117
  path: path
4632
5118
  });
4633
5119
  }
5120
+
5121
+ /**
5122
+ * How this field is laid out in the editor when it is the item of an array
5123
+ * or record: `{ as: "inline" }` renders the field itself inside each row,
5124
+ * instead of a preview row that navigates to it.
5125
+ *
5126
+ * Static configuration, not a callback — see `render.ts`.
5127
+ */
5128
+ }, {
5129
+ key: "render",
5130
+ value: function render(input) {
5131
+ return new BooleanSchema(this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, input, this.previewInput);
5132
+ }
5133
+
5134
+ /**
5135
+ * How this VALUE is shown where a preview of it is needed — a row in a
5136
+ * sortable list, a reference dropdown, a search hit. Never how the field
5137
+ * itself is edited (that is `render`). See `preview.ts`.
5138
+ */
5139
+ }, {
5140
+ key: "preview",
5141
+ value: function preview(select) {
5142
+ return new BooleanSchema(this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.renderInput, select);
5143
+ }
5144
+ }, {
5145
+ key: "executePreviewItem",
5146
+ value: function executePreviewItem(src) {
5147
+ if (this.previewInput === null) {
5148
+ return null;
5149
+ }
5150
+ return this.previewInput({
5151
+ val: src
5152
+ });
5153
+ }
5154
+ }, {
5155
+ key: "declaresItemPreview",
5156
+ value: function declaresItemPreview() {
5157
+ return this.previewInput !== null;
5158
+ }
4634
5159
  }, {
4635
5160
  key: "executeSerialize",
4636
5161
  value: function executeSerialize() {
4637
- var _this$customValidateF;
5162
+ var _this$renderInput, _this$customValidateF;
4638
5163
  return {
4639
5164
  type: "boolean",
5165
+ render: (_this$renderInput = this.renderInput) !== null && _this$renderInput !== void 0 ? _this$renderInput : undefined,
5166
+ preview: this.previewInput ? true : undefined,
4640
5167
  opt: this.opt,
4641
5168
  customValidate: this.customValidateFunctions && ((_this$customValidateF = this.customValidateFunctions) === null || _this$customValidateF === void 0 ? void 0 : _this$customValidateF.length) > 0,
4642
5169
  readonly: this.isReadonly,
@@ -4663,6 +5190,8 @@ var KeyOfSchema = /*#__PURE__*/function (_Schema) {
4663
5190
  var isReadonly = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
4664
5191
  var isHidden = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
4665
5192
  var description = arguments.length > 6 ? arguments[6] : undefined;
5193
+ var renderInput = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
5194
+ var previewInput = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : null;
4666
5195
  _classCallCheck(this, KeyOfSchema);
4667
5196
  _this = _callSuper(this, KeyOfSchema);
4668
5197
  _this.schema = schema;
@@ -4672,18 +5201,20 @@ var KeyOfSchema = /*#__PURE__*/function (_Schema) {
4672
5201
  _this.isReadonly = isReadonly;
4673
5202
  _this.isHidden = isHidden;
4674
5203
  _this.description = description;
5204
+ _this.renderInput = renderInput;
5205
+ _this.previewInput = previewInput;
4675
5206
  return _this;
4676
5207
  }
4677
5208
  _inherits(KeyOfSchema, _Schema);
4678
5209
  return _createClass(KeyOfSchema, [{
4679
5210
  key: "describe",
4680
5211
  value: function describe(description) {
4681
- return new KeyOfSchema(this.schema, this.sourcePath, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined);
5212
+ return new KeyOfSchema(this.schema, this.sourcePath, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined, this.renderInput, this.previewInput);
4682
5213
  }
4683
5214
  }, {
4684
5215
  key: "validate",
4685
5216
  value: function validate(validationFunction) {
4686
- return new KeyOfSchema(this.schema, this.sourcePath, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.isReadonly, this.isHidden, this.description);
5217
+ return new KeyOfSchema(this.schema, this.sourcePath, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.isReadonly, this.isHidden, this.description, this.renderInput, this.previewInput);
4687
5218
  }
4688
5219
  }, {
4689
5220
  key: "executeValidate",
@@ -4813,17 +5344,17 @@ var KeyOfSchema = /*#__PURE__*/function (_Schema) {
4813
5344
  }, {
4814
5345
  key: "nullable",
4815
5346
  value: function nullable() {
4816
- return new KeyOfSchema(this.schema, this.sourcePath, true, [], this.isReadonly, this.isHidden, this.description);
5347
+ return new KeyOfSchema(this.schema, this.sourcePath, true, [], this.isReadonly, this.isHidden, this.description, this.renderInput, this.previewInput);
4817
5348
  }
4818
5349
  }, {
4819
5350
  key: "readonly",
4820
5351
  value: function readonly() {
4821
- return new KeyOfSchema(this.schema, this.sourcePath, this.opt, this.customValidateFunctions, true, this.isHidden, this.description);
5352
+ return new KeyOfSchema(this.schema, this.sourcePath, this.opt, this.customValidateFunctions, true, this.isHidden, this.description, this.renderInput, this.previewInput);
4822
5353
  }
4823
5354
  }, {
4824
5355
  key: "hidden",
4825
5356
  value: function hidden() {
4826
- return new KeyOfSchema(this.schema, this.sourcePath, this.opt, this.customValidateFunctions, this.isReadonly, true, this.description);
5357
+ return new KeyOfSchema(this.schema, this.sourcePath, this.opt, this.customValidateFunctions, this.isReadonly, true, this.description, this.renderInput, this.previewInput);
4827
5358
  }
4828
5359
  }, {
4829
5360
  key: "executeCustomValidateAt",
@@ -4832,10 +5363,49 @@ var KeyOfSchema = /*#__PURE__*/function (_Schema) {
4832
5363
  path: path
4833
5364
  });
4834
5365
  }
5366
+
5367
+ /**
5368
+ * How this field is laid out in the editor when it is the item of an array
5369
+ * or record: `{ as: "inline" }` renders the field itself inside each row,
5370
+ * instead of a preview row that navigates to it.
5371
+ *
5372
+ * Static configuration, not a callback — see `render.ts`.
5373
+ */
5374
+ }, {
5375
+ key: "render",
5376
+ value: function render(input) {
5377
+ return new KeyOfSchema(this.schema, this.sourcePath, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, input, this.previewInput);
5378
+ }
5379
+
5380
+ /**
5381
+ * How this VALUE is shown where a preview of it is needed — a row in a
5382
+ * sortable list, a reference dropdown, a search hit. Never how the field
5383
+ * itself is edited (that is `render`). See `preview.ts`.
5384
+ */
5385
+ }, {
5386
+ key: "preview",
5387
+ value: function preview(select) {
5388
+ return new KeyOfSchema(this.schema, this.sourcePath, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.renderInput, select);
5389
+ }
5390
+ }, {
5391
+ key: "executePreviewItem",
5392
+ value: function executePreviewItem(src) {
5393
+ if (this.previewInput === null) {
5394
+ return null;
5395
+ }
5396
+ return this.previewInput({
5397
+ val: src
5398
+ });
5399
+ }
5400
+ }, {
5401
+ key: "declaresItemPreview",
5402
+ value: function declaresItemPreview() {
5403
+ return this.previewInput !== null;
5404
+ }
4835
5405
  }, {
4836
5406
  key: "executeSerialize",
4837
5407
  value: function executeSerialize() {
4838
- var _this$customValidateF;
5408
+ var _this$renderInput, _this$customValidateF;
4839
5409
  var path = this.sourcePath;
4840
5410
  if (!path) {
4841
5411
  throw new Error("Cannot serialize keyOf schema with empty selector. TIP: keyOf must be used with a Val Module of record schema.");
@@ -4858,6 +5428,8 @@ var KeyOfSchema = /*#__PURE__*/function (_Schema) {
4858
5428
  }
4859
5429
  return {
4860
5430
  type: "keyOf",
5431
+ render: (_this$renderInput = this.renderInput) !== null && _this$renderInput !== void 0 ? _this$renderInput : undefined,
5432
+ preview: this.previewInput ? true : undefined,
4861
5433
  path: path,
4862
5434
  schema: serializedSchema,
4863
5435
  opt: this.opt,
@@ -4909,6 +5481,8 @@ var FileSchema = /*#__PURE__*/function (_Schema) {
4909
5481
  var isReadonly = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
4910
5482
  var isHidden = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
4911
5483
  var description = arguments.length > 7 ? arguments[7] : undefined;
5484
+ var renderInput = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : null;
5485
+ var previewInput = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : null;
4912
5486
  _classCallCheck(this, FileSchema);
4913
5487
  _this = _callSuper(this, FileSchema);
4914
5488
  _this.options = options;
@@ -4919,23 +5493,25 @@ var FileSchema = /*#__PURE__*/function (_Schema) {
4919
5493
  _this.isReadonly = isReadonly;
4920
5494
  _this.isHidden = isHidden;
4921
5495
  _this.description = description;
5496
+ _this.renderInput = renderInput;
5497
+ _this.previewInput = previewInput;
4922
5498
  return _this;
4923
5499
  }
4924
5500
  _inherits(FileSchema, _Schema);
4925
5501
  return _createClass(FileSchema, [{
4926
5502
  key: "describe",
4927
5503
  value: function describe(description) {
4928
- return new FileSchema(this.options, this.opt, this.isRemote, this.customValidateFunctions, this.moduleMetadata, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined);
5504
+ return new FileSchema(this.options, this.opt, this.isRemote, this.customValidateFunctions, this.moduleMetadata, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined, this.renderInput, this.previewInput);
4929
5505
  }
4930
5506
  }, {
4931
5507
  key: "remote",
4932
5508
  value: function remote() {
4933
- return new FileSchema(this.options, this.opt, true, this.customValidateFunctions, this.moduleMetadata, this.isReadonly, this.isHidden, this.description);
5509
+ return new FileSchema(this.options, this.opt, true, this.customValidateFunctions, this.moduleMetadata, this.isReadonly, this.isHidden, this.description, this.renderInput, this.previewInput);
4934
5510
  }
4935
5511
  }, {
4936
5512
  key: "validate",
4937
5513
  value: function validate(validationFunction) {
4938
- return new FileSchema(this.options, this.opt, this.isRemote, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.moduleMetadata, this.isReadonly, this.isHidden, this.description);
5514
+ return new FileSchema(this.options, this.opt, this.isRemote, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.moduleMetadata, this.isReadonly, this.isHidden, this.description, this.renderInput, this.previewInput);
4939
5515
  }
4940
5516
  }, {
4941
5517
  key: "executeValidate",
@@ -5116,17 +5692,17 @@ var FileSchema = /*#__PURE__*/function (_Schema) {
5116
5692
  }, {
5117
5693
  key: "nullable",
5118
5694
  value: function nullable() {
5119
- return new FileSchema(this.options, true, this.isRemote, this.customValidateFunctions, this.moduleMetadata, this.isReadonly, this.isHidden, this.description);
5695
+ return new FileSchema(this.options, true, this.isRemote, this.customValidateFunctions, this.moduleMetadata, this.isReadonly, this.isHidden, this.description, this.renderInput, this.previewInput);
5120
5696
  }
5121
5697
  }, {
5122
5698
  key: "readonly",
5123
5699
  value: function readonly() {
5124
- return new FileSchema(this.options, this.opt, this.isRemote, this.customValidateFunctions, this.moduleMetadata, true, this.isHidden, this.description);
5700
+ return new FileSchema(this.options, this.opt, this.isRemote, this.customValidateFunctions, this.moduleMetadata, true, this.isHidden, this.description, this.renderInput, this.previewInput);
5125
5701
  }
5126
5702
  }, {
5127
5703
  key: "hidden",
5128
5704
  value: function hidden() {
5129
- return new FileSchema(this.options, this.opt, this.isRemote, this.customValidateFunctions, this.moduleMetadata, this.isReadonly, true, this.description);
5705
+ return new FileSchema(this.options, this.opt, this.isRemote, this.customValidateFunctions, this.moduleMetadata, this.isReadonly, true, this.description, this.renderInput, this.previewInput);
5130
5706
  }
5131
5707
  }, {
5132
5708
  key: "executeCustomValidateAt",
@@ -5135,13 +5711,54 @@ var FileSchema = /*#__PURE__*/function (_Schema) {
5135
5711
  path: path
5136
5712
  });
5137
5713
  }
5714
+
5715
+ /**
5716
+ * How this field is laid out in the editor when it is the item of an array
5717
+ * or record: `{ as: "inline" }` renders the field itself inside each row,
5718
+ * instead of a preview row that navigates to it.
5719
+ *
5720
+ * Static configuration, not a callback — see `render.ts`.
5721
+ */
5722
+ }, {
5723
+ key: "render",
5724
+ value: function render(input) {
5725
+ return new FileSchema(this.options, this.opt, this.isRemote, this.customValidateFunctions, this.moduleMetadata, this.isReadonly, this.isHidden, this.description, input, this.previewInput);
5726
+ }
5727
+
5728
+ /**
5729
+ * How this VALUE is shown where a preview of it is needed — a row in a
5730
+ * sortable list, a reference dropdown, a search hit. Never how the field
5731
+ * itself is edited (that is `render`). See `preview.ts`.
5732
+ */
5733
+ }, {
5734
+ key: "preview",
5735
+ value: function preview(select) {
5736
+ return new FileSchema(this.options, this.opt, this.isRemote, this.customValidateFunctions, this.moduleMetadata, this.isReadonly, this.isHidden, this.description, this.renderInput, select);
5737
+ }
5738
+ }, {
5739
+ key: "executePreviewItem",
5740
+ value: function executePreviewItem(src) {
5741
+ if (this.previewInput === null) {
5742
+ return null;
5743
+ }
5744
+ return this.previewInput({
5745
+ val: src
5746
+ });
5747
+ }
5748
+ }, {
5749
+ key: "declaresItemPreview",
5750
+ value: function declaresItemPreview() {
5751
+ return this.previewInput !== null;
5752
+ }
5138
5753
  }, {
5139
5754
  key: "executeSerialize",
5140
5755
  value: function executeSerialize() {
5141
- var _this$customValidateF;
5756
+ var _this$renderInput, _this$customValidateF;
5142
5757
  var modulePaths = this.moduleMetadata ? Object.keys(this.moduleMetadata) : [];
5143
5758
  return {
5144
5759
  type: "file",
5760
+ render: (_this$renderInput = this.renderInput) !== null && _this$renderInput !== void 0 ? _this$renderInput : undefined,
5761
+ preview: this.previewInput ? true : undefined,
5145
5762
  options: this.options,
5146
5763
  opt: this.opt,
5147
5764
  remote: this.isRemote,
@@ -5230,6 +5847,8 @@ var DateSchema = /*#__PURE__*/function (_Schema) {
5230
5847
  var isReadonly = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
5231
5848
  var isHidden = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
5232
5849
  var description = arguments.length > 5 ? arguments[5] : undefined;
5850
+ var renderInput = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null;
5851
+ var previewInput = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
5233
5852
  _classCallCheck(this, DateSchema);
5234
5853
  _this = _callSuper(this, DateSchema);
5235
5854
  _this.options = options;
@@ -5238,18 +5857,20 @@ var DateSchema = /*#__PURE__*/function (_Schema) {
5238
5857
  _this.isReadonly = isReadonly;
5239
5858
  _this.isHidden = isHidden;
5240
5859
  _this.description = description;
5860
+ _this.renderInput = renderInput;
5861
+ _this.previewInput = previewInput;
5241
5862
  return _this;
5242
5863
  }
5243
5864
  _inherits(DateSchema, _Schema);
5244
5865
  return _createClass(DateSchema, [{
5245
5866
  key: "describe",
5246
5867
  value: function describe(description) {
5247
- return new DateSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined);
5868
+ return new DateSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined, this.renderInput, this.previewInput);
5248
5869
  }
5249
5870
  }, {
5250
5871
  key: "validate",
5251
5872
  value: function validate(validationFunction) {
5252
- return new DateSchema(this.options, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.isReadonly, this.isHidden, this.description);
5873
+ return new DateSchema(this.options, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.isReadonly, this.isHidden, this.description, this.renderInput, this.previewInput);
5253
5874
  }
5254
5875
  }, {
5255
5876
  key: "executeValidate",
@@ -5338,29 +5959,29 @@ var DateSchema = /*#__PURE__*/function (_Schema) {
5338
5959
  value: function from(_from) {
5339
5960
  return new DateSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
5340
5961
  from: _from
5341
- }), this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description);
5962
+ }), this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.renderInput, this.previewInput);
5342
5963
  }
5343
5964
  }, {
5344
5965
  key: "to",
5345
5966
  value: function to(_to) {
5346
5967
  return new DateSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
5347
5968
  to: _to
5348
- }), this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description);
5969
+ }), this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.renderInput, this.previewInput);
5349
5970
  }
5350
5971
  }, {
5351
5972
  key: "nullable",
5352
5973
  value: function nullable() {
5353
- return new DateSchema(this.options, true, [], this.isReadonly, this.isHidden, this.description);
5974
+ return new DateSchema(this.options, true, [], this.isReadonly, this.isHidden, this.description, this.renderInput, this.previewInput);
5354
5975
  }
5355
5976
  }, {
5356
5977
  key: "readonly",
5357
5978
  value: function readonly() {
5358
- return new DateSchema(this.options, this.opt, this.customValidateFunctions, true, this.isHidden, this.description);
5979
+ return new DateSchema(this.options, this.opt, this.customValidateFunctions, true, this.isHidden, this.description, this.renderInput, this.previewInput);
5359
5980
  }
5360
5981
  }, {
5361
5982
  key: "hidden",
5362
5983
  value: function hidden() {
5363
- return new DateSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, true, this.description);
5984
+ return new DateSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, true, this.description, this.renderInput, this.previewInput);
5364
5985
  }
5365
5986
  }, {
5366
5987
  key: "executeCustomValidateAt",
@@ -5369,12 +5990,53 @@ var DateSchema = /*#__PURE__*/function (_Schema) {
5369
5990
  path: path
5370
5991
  });
5371
5992
  }
5993
+
5994
+ /**
5995
+ * How this field is laid out in the editor when it is the item of an array
5996
+ * or record: `{ as: "inline" }` renders the field itself inside each row,
5997
+ * instead of a preview row that navigates to it.
5998
+ *
5999
+ * Static configuration, not a callback — see `render.ts`.
6000
+ */
6001
+ }, {
6002
+ key: "render",
6003
+ value: function render(input) {
6004
+ return new DateSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, input, this.previewInput);
6005
+ }
6006
+
6007
+ /**
6008
+ * How this VALUE is shown where a preview of it is needed — a row in a
6009
+ * sortable list, a reference dropdown, a search hit. Never how the field
6010
+ * itself is edited (that is `render`). See `preview.ts`.
6011
+ */
6012
+ }, {
6013
+ key: "preview",
6014
+ value: function preview(select) {
6015
+ return new DateSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.renderInput, select);
6016
+ }
6017
+ }, {
6018
+ key: "executePreviewItem",
6019
+ value: function executePreviewItem(src) {
6020
+ if (this.previewInput === null) {
6021
+ return null;
6022
+ }
6023
+ return this.previewInput({
6024
+ val: src
6025
+ });
6026
+ }
6027
+ }, {
6028
+ key: "declaresItemPreview",
6029
+ value: function declaresItemPreview() {
6030
+ return this.previewInput !== null;
6031
+ }
5372
6032
  }, {
5373
6033
  key: "executeSerialize",
5374
6034
  value: function executeSerialize() {
5375
- var _this$customValidateF;
6035
+ var _this$renderInput, _this$customValidateF;
5376
6036
  return {
5377
6037
  type: "date",
6038
+ render: (_this$renderInput = this.renderInput) !== null && _this$renderInput !== void 0 ? _this$renderInput : undefined,
6039
+ preview: this.previewInput ? true : undefined,
5378
6040
  opt: this.opt,
5379
6041
  options: this.options,
5380
6042
  customValidate: this.customValidateFunctions && ((_this$customValidateF = this.customValidateFunctions) === null || _this$customValidateF === void 0 ? void 0 : _this$customValidateF.length) > 0,
@@ -5402,6 +6064,8 @@ var DateTimeSchema = /*#__PURE__*/function (_Schema) {
5402
6064
  var isReadonly = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
5403
6065
  var isHidden = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
5404
6066
  var description = arguments.length > 5 ? arguments[5] : undefined;
6067
+ var renderInput = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null;
6068
+ var previewInput = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
5405
6069
  _classCallCheck(this, DateTimeSchema);
5406
6070
  _this = _callSuper(this, DateTimeSchema);
5407
6071
  _this.options = options;
@@ -5410,18 +6074,20 @@ var DateTimeSchema = /*#__PURE__*/function (_Schema) {
5410
6074
  _this.isReadonly = isReadonly;
5411
6075
  _this.isHidden = isHidden;
5412
6076
  _this.description = description;
6077
+ _this.renderInput = renderInput;
6078
+ _this.previewInput = previewInput;
5413
6079
  return _this;
5414
6080
  }
5415
6081
  _inherits(DateTimeSchema, _Schema);
5416
6082
  return _createClass(DateTimeSchema, [{
5417
6083
  key: "describe",
5418
6084
  value: function describe(description) {
5419
- return new DateTimeSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined);
6085
+ return new DateTimeSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined, this.renderInput, this.previewInput);
5420
6086
  }
5421
6087
  }, {
5422
6088
  key: "validate",
5423
6089
  value: function validate(validationFunction) {
5424
- return new DateTimeSchema(this.options, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.isReadonly, this.isHidden, this.description);
6090
+ return new DateTimeSchema(this.options, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.isReadonly, this.isHidden, this.description, this.renderInput, this.previewInput);
5425
6091
  }
5426
6092
  }, {
5427
6093
  key: "executeValidate",
@@ -5542,29 +6208,29 @@ var DateTimeSchema = /*#__PURE__*/function (_Schema) {
5542
6208
  value: function from(_from) {
5543
6209
  return new DateTimeSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
5544
6210
  from: _from
5545
- }), this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description);
6211
+ }), this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.renderInput, this.previewInput);
5546
6212
  }
5547
6213
  }, {
5548
6214
  key: "to",
5549
6215
  value: function to(_to) {
5550
6216
  return new DateTimeSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
5551
6217
  to: _to
5552
- }), this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description);
6218
+ }), this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.renderInput, this.previewInput);
5553
6219
  }
5554
6220
  }, {
5555
6221
  key: "nullable",
5556
6222
  value: function nullable() {
5557
- return new DateTimeSchema(this.options, true, [], this.isReadonly, this.isHidden, this.description);
6223
+ return new DateTimeSchema(this.options, true, [], this.isReadonly, this.isHidden, this.description, this.renderInput, this.previewInput);
5558
6224
  }
5559
6225
  }, {
5560
6226
  key: "readonly",
5561
6227
  value: function readonly() {
5562
- return new DateTimeSchema(this.options, this.opt, this.customValidateFunctions, true, this.isHidden, this.description);
6228
+ return new DateTimeSchema(this.options, this.opt, this.customValidateFunctions, true, this.isHidden, this.description, this.renderInput, this.previewInput);
5563
6229
  }
5564
6230
  }, {
5565
6231
  key: "hidden",
5566
6232
  value: function hidden() {
5567
- return new DateTimeSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, true, this.description);
6233
+ return new DateTimeSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, true, this.description, this.renderInput, this.previewInput);
5568
6234
  }
5569
6235
  }, {
5570
6236
  key: "executeCustomValidateAt",
@@ -5573,12 +6239,53 @@ var DateTimeSchema = /*#__PURE__*/function (_Schema) {
5573
6239
  path: path
5574
6240
  });
5575
6241
  }
6242
+
6243
+ /**
6244
+ * How this field is laid out in the editor when it is the item of an array
6245
+ * or record: `{ as: "inline" }` renders the field itself inside each row,
6246
+ * instead of a preview row that navigates to it.
6247
+ *
6248
+ * Static configuration, not a callback — see `render.ts`.
6249
+ */
6250
+ }, {
6251
+ key: "render",
6252
+ value: function render(input) {
6253
+ return new DateTimeSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, input, this.previewInput);
6254
+ }
6255
+
6256
+ /**
6257
+ * How this VALUE is shown where a preview of it is needed — a row in a
6258
+ * sortable list, a reference dropdown, a search hit. Never how the field
6259
+ * itself is edited (that is `render`). See `preview.ts`.
6260
+ */
6261
+ }, {
6262
+ key: "preview",
6263
+ value: function preview(select) {
6264
+ return new DateTimeSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.renderInput, select);
6265
+ }
6266
+ }, {
6267
+ key: "executePreviewItem",
6268
+ value: function executePreviewItem(src) {
6269
+ if (this.previewInput === null) {
6270
+ return null;
6271
+ }
6272
+ return this.previewInput({
6273
+ val: src
6274
+ });
6275
+ }
6276
+ }, {
6277
+ key: "declaresItemPreview",
6278
+ value: function declaresItemPreview() {
6279
+ return this.previewInput !== null;
6280
+ }
5576
6281
  }, {
5577
6282
  key: "executeSerialize",
5578
6283
  value: function executeSerialize() {
5579
- var _this$customValidateF;
6284
+ var _this$renderInput, _this$customValidateF;
5580
6285
  return {
5581
6286
  type: "dateTime",
6287
+ render: (_this$renderInput = this.renderInput) !== null && _this$renderInput !== void 0 ? _this$renderInput : undefined,
6288
+ preview: this.previewInput ? true : undefined,
5582
6289
  opt: this.opt,
5583
6290
  options: this.options,
5584
6291
  customValidate: this.customValidateFunctions && ((_this$customValidateF = this.customValidateFunctions) === null || _this$customValidateF === void 0 ? void 0 : _this$customValidateF.length) > 0,
@@ -6086,6 +6793,8 @@ var ColorSchema = /*#__PURE__*/function (_Schema) {
6086
6793
  var isReadonly = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
6087
6794
  var isHidden = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
6088
6795
  var description = arguments.length > 5 ? arguments[5] : undefined;
6796
+ var renderInput = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null;
6797
+ var previewInput = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
6089
6798
  _classCallCheck(this, ColorSchema);
6090
6799
  _this = _callSuper(this, ColorSchema);
6091
6800
  _this.options = options;
@@ -6094,18 +6803,20 @@ var ColorSchema = /*#__PURE__*/function (_Schema) {
6094
6803
  _this.isReadonly = isReadonly;
6095
6804
  _this.isHidden = isHidden;
6096
6805
  _this.description = description;
6806
+ _this.renderInput = renderInput;
6807
+ _this.previewInput = previewInput;
6097
6808
  return _this;
6098
6809
  }
6099
6810
  _inherits(ColorSchema, _Schema);
6100
6811
  return _createClass(ColorSchema, [{
6101
6812
  key: "describe",
6102
6813
  value: function describe(description) {
6103
- return new ColorSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined);
6814
+ return new ColorSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined, this.renderInput, this.previewInput);
6104
6815
  }
6105
6816
  }, {
6106
6817
  key: "validate",
6107
6818
  value: function validate(validationFunction) {
6108
- return new ColorSchema(this.options, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.isReadonly, this.isHidden, this.description);
6819
+ return new ColorSchema(this.options, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.isReadonly, this.isHidden, this.description, this.renderInput, this.previewInput);
6109
6820
  }
6110
6821
  }, {
6111
6822
  key: "executeCustomValidateAt",
@@ -6202,24 +6913,65 @@ var ColorSchema = /*#__PURE__*/function (_Schema) {
6202
6913
  }, {
6203
6914
  key: "nullable",
6204
6915
  value: function nullable() {
6205
- return new ColorSchema(this.options, true, [], this.isReadonly, this.isHidden, this.description);
6916
+ return new ColorSchema(this.options, true, [], this.isReadonly, this.isHidden, this.description, this.renderInput, this.previewInput);
6206
6917
  }
6207
6918
  }, {
6208
6919
  key: "readonly",
6209
6920
  value: function readonly() {
6210
- return new ColorSchema(this.options, this.opt, this.customValidateFunctions, true, this.isHidden, this.description);
6921
+ return new ColorSchema(this.options, this.opt, this.customValidateFunctions, true, this.isHidden, this.description, this.renderInput, this.previewInput);
6211
6922
  }
6212
6923
  }, {
6213
6924
  key: "hidden",
6214
6925
  value: function hidden() {
6215
- return new ColorSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, true, this.description);
6926
+ return new ColorSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, true, this.description, this.renderInput, this.previewInput);
6927
+ }
6928
+
6929
+ /**
6930
+ * How this field is laid out in the editor when it is the item of an array
6931
+ * or record: `{ as: "inline" }` renders the field itself inside each row,
6932
+ * instead of a preview row that navigates to it.
6933
+ *
6934
+ * Static configuration, not a callback — see `render.ts`.
6935
+ */
6936
+ }, {
6937
+ key: "render",
6938
+ value: function render(input) {
6939
+ return new ColorSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, input, this.previewInput);
6940
+ }
6941
+
6942
+ /**
6943
+ * How this VALUE is shown where a preview of it is needed — a row in a
6944
+ * sortable list, a reference dropdown, a search hit. Never how the field
6945
+ * itself is edited (that is `render`). See `preview.ts`.
6946
+ */
6947
+ }, {
6948
+ key: "preview",
6949
+ value: function preview(select) {
6950
+ return new ColorSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.renderInput, select);
6951
+ }
6952
+ }, {
6953
+ key: "executePreviewItem",
6954
+ value: function executePreviewItem(src) {
6955
+ if (this.previewInput === null) {
6956
+ return null;
6957
+ }
6958
+ return this.previewInput({
6959
+ val: src
6960
+ });
6961
+ }
6962
+ }, {
6963
+ key: "declaresItemPreview",
6964
+ value: function declaresItemPreview() {
6965
+ return this.previewInput !== null;
6216
6966
  }
6217
6967
  }, {
6218
6968
  key: "executeSerialize",
6219
6969
  value: function executeSerialize() {
6220
- var _this$customValidateF;
6970
+ var _this$renderInput, _this$customValidateF;
6221
6971
  return {
6222
6972
  type: "color",
6973
+ render: (_this$renderInput = this.renderInput) !== null && _this$renderInput !== void 0 ? _this$renderInput : undefined,
6974
+ preview: this.previewInput ? true : undefined,
6223
6975
  opt: this.opt,
6224
6976
  options: this.options,
6225
6977
  customValidate: this.customValidateFunctions && ((_this$customValidateF = this.customValidateFunctions) === null || _this$customValidateF === void 0 ? void 0 : _this$customValidateF.length) > 0,
@@ -8072,7 +8824,7 @@ function deserializeSchema(serialized) {
8072
8824
  return schema;
8073
8825
  }
8074
8826
  function deserializeSchemaImpl(serialized) {
8075
- var _serialized$options, _serialized$options2, _serialized$render, _serialized$accept, _serialized$directory, _serialized$remote, _serialized$jsonValue;
8827
+ var _serialized$options, _serialized$options2, _serialized$render, _serialized$render2, _serialized$render3, _serialized$render4, _serialized$render5, _serialized$render6, _serialized$render7, _serialized$accept, _serialized$directory, _serialized$remote, _serialized$jsonValue, _serialized$render9, _serialized$render0, _serialized$render10, _serialized$render11, _serialized$render12, _serialized$render13, _serialized$render14;
8076
8828
  switch (serialized.type) {
8077
8829
  case "string":
8078
8830
  return new StringSchema(_objectSpread2(_objectSpread2({}, serialized.options), {}, {
@@ -8083,20 +8835,22 @@ function deserializeSchemaImpl(serialized) {
8083
8835
  // recomputed from an instance.
8084
8836
  (_serialized$render = serialized.render) !== null && _serialized$render !== void 0 ? _serialized$render : null, false, false, serialized.description);
8085
8837
  case "literal":
8086
- return new LiteralSchema(serialized.value, serialized.opt, [], false, false, serialized.description);
8838
+ return new LiteralSchema(serialized.value, serialized.opt, [], false, false, serialized.description, (_serialized$render2 = serialized.render) !== null && _serialized$render2 !== void 0 ? _serialized$render2 : null);
8087
8839
  case "boolean":
8088
- return new BooleanSchema(serialized.opt, [], false, false, serialized.description);
8840
+ return new BooleanSchema(serialized.opt, [], false, false, serialized.description, (_serialized$render3 = serialized.render) !== null && _serialized$render3 !== void 0 ? _serialized$render3 : null);
8089
8841
  case "number":
8090
- return new NumberSchema(serialized.options, serialized.opt, [], false, false, serialized.description);
8842
+ return new NumberSchema(serialized.options, serialized.opt, [], false, false, serialized.description, (_serialized$render4 = serialized.render) !== null && _serialized$render4 !== void 0 ? _serialized$render4 : null);
8091
8843
  case "object":
8092
8844
  return new ObjectSchema(Object.fromEntries(Object.entries(serialized.items).map(function (_ref) {
8093
8845
  var _ref2 = _slicedToArray(_ref, 2),
8094
8846
  key = _ref2[0],
8095
8847
  item = _ref2[1];
8096
8848
  return [key, deserializeSchema(item)];
8097
- })), serialized.opt, [], false, false, serialized.description);
8849
+ })), serialized.opt, [], false, false, serialized.description, (_serialized$render5 = serialized.render) !== null && _serialized$render5 !== void 0 ? _serialized$render5 : null);
8098
8850
  case "array":
8099
- return new ArraySchema(deserializeSchema(serialized.item), serialized.opt, [], false, false, serialized.description);
8851
+ return new ArraySchema(deserializeSchema(serialized.item), serialized.opt, [], false, false, serialized.description,
8852
+ // The preview closure cannot survive serialization; the render can.
8853
+ null, (_serialized$render6 = serialized.render) !== null && _serialized$render6 !== void 0 ? _serialized$render6 : null);
8100
8854
  case "union":
8101
8855
  return new UnionSchema(typeof serialized.key === "string" ? serialized.key :
8102
8856
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -8105,17 +8859,17 @@ function deserializeSchemaImpl(serialized) {
8105
8859
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
8106
8860
  serialized.items.map(deserializeSchema),
8107
8861
  // TODO: we do not really need any here - right?
8108
- serialized.opt, [], false, false, serialized.description);
8862
+ serialized.opt, [], false, false, serialized.description, (_serialized$render7 = serialized.render) !== null && _serialized$render7 !== void 0 ? _serialized$render7 : null);
8109
8863
  case "richtext":
8110
8864
  {
8111
- var _serialized$options3, _serialized$options4, _serialized$options5, _serialized$options6, _serialized$options7, _serialized$options8, _serialized$options9;
8865
+ var _serialized$options3, _serialized$options4, _serialized$options5, _serialized$options6, _serialized$options7, _serialized$options8, _serialized$options9, _serialized$render8;
8112
8866
  var deserializedOptions = _objectSpread2(_objectSpread2({}, serialized.options || {}), {}, {
8113
8867
  inline: _typeof((_serialized$options3 = serialized.options) === null || _serialized$options3 === void 0 || (_serialized$options3 = _serialized$options3.inline) === null || _serialized$options3 === void 0 ? void 0 : _serialized$options3.img) === "object" || _typeof((_serialized$options4 = serialized.options) === null || _serialized$options4 === void 0 || (_serialized$options4 = _serialized$options4.inline) === null || _serialized$options4 === void 0 ? void 0 : _serialized$options4.a) === "object" ? {
8114
8868
  a: _typeof((_serialized$options5 = serialized.options) === null || _serialized$options5 === void 0 || (_serialized$options5 = _serialized$options5.inline) === null || _serialized$options5 === void 0 ? void 0 : _serialized$options5.a) === "object" ? deserializeSchema(serialized.options.inline.a) : (_serialized$options6 = serialized.options) === null || _serialized$options6 === void 0 || (_serialized$options6 = _serialized$options6.inline) === null || _serialized$options6 === void 0 ? void 0 : _serialized$options6.a,
8115
8869
  img: _typeof((_serialized$options7 = serialized.options) === null || _serialized$options7 === void 0 || (_serialized$options7 = _serialized$options7.inline) === null || _serialized$options7 === void 0 ? void 0 : _serialized$options7.img) === "object" ? deserializeSchema(serialized.options.inline.img) : (_serialized$options8 = serialized.options) === null || _serialized$options8 === void 0 || (_serialized$options8 = _serialized$options8.inline) === null || _serialized$options8 === void 0 ? void 0 : _serialized$options8.img
8116
8870
  } : (_serialized$options9 = serialized.options) === null || _serialized$options9 === void 0 ? void 0 : _serialized$options9.inline
8117
8871
  });
8118
- return new RichTextSchema(deserializedOptions, serialized.opt, [], false, false, serialized.description);
8872
+ return new RichTextSchema(deserializedOptions, serialized.opt, [], false, false, serialized.description, (_serialized$render8 = serialized.render) !== null && _serialized$render8 !== void 0 ? _serialized$render8 : null);
8119
8873
  }
8120
8874
  case "record":
8121
8875
  return new RecordSchema(deserializeSchema(serialized.item), serialized.opt, [], null, serialized.key ? deserializeSchema(serialized.key) : null, serialized.mediaType ? {
@@ -8124,27 +8878,30 @@ function deserializeSchemaImpl(serialized) {
8124
8878
  directory: (_serialized$directory = serialized.directory) !== null && _serialized$directory !== void 0 ? _serialized$directory : "/public/val",
8125
8879
  remote: (_serialized$remote = serialized.remote) !== null && _serialized$remote !== void 0 ? _serialized$remote : false,
8126
8880
  altSchema: serialized.alt ? deserializeSchema(serialized.alt) : undefined
8127
- } : undefined, false, false, serialized.description, (_serialized$jsonValue = serialized.jsonValues) !== null && _serialized$jsonValue !== void 0 ? _serialized$jsonValue : false);
8881
+ } : undefined, false, false, serialized.description, (_serialized$jsonValue = serialized.jsonValues) !== null && _serialized$jsonValue !== void 0 ? _serialized$jsonValue : false,
8882
+ // The preview closure cannot survive serialization; the render can.
8883
+ null, (_serialized$render9 = serialized.render) !== null && _serialized$render9 !== void 0 ? _serialized$render9 : null);
8128
8884
  case "keyOf":
8129
- return new KeyOfSchema(serialized.schema, serialized.path, serialized.opt, [], false, false, serialized.description);
8885
+ return new KeyOfSchema(serialized.schema, serialized.path, serialized.opt, [], false, false, serialized.description, (_serialized$render0 = serialized.render) !== null && _serialized$render0 !== void 0 ? _serialized$render0 : null);
8130
8886
  case "route":
8131
8887
  {
8888
+ var _serialized$render1;
8132
8889
  var routeOptions = serialized.options ? {
8133
8890
  include: serialized.options.include ? new RegExp(serialized.options.include.source, serialized.options.include.flags) : undefined,
8134
8891
  exclude: serialized.options.exclude ? new RegExp(serialized.options.exclude.source, serialized.options.exclude.flags) : undefined
8135
8892
  } : undefined;
8136
- return new RouteSchema(routeOptions, serialized.opt, [], false, false, serialized.description);
8893
+ return new RouteSchema(routeOptions, serialized.opt, [], false, false, serialized.description, (_serialized$render1 = serialized.render) !== null && _serialized$render1 !== void 0 ? _serialized$render1 : null);
8137
8894
  }
8138
8895
  case "file":
8139
- return new FileSchema(serialized.options, serialized.opt, serialized.remote, [], {}, false, false, serialized.description);
8896
+ return new FileSchema(serialized.options, serialized.opt, serialized.remote, [], {}, false, false, serialized.description, (_serialized$render10 = serialized.render) !== null && _serialized$render10 !== void 0 ? _serialized$render10 : null);
8140
8897
  case "image":
8141
- return new ImageSchema(serialized.options, serialized.opt, serialized.remote, [], {}, false, false, serialized.description);
8898
+ return new ImageSchema(serialized.options, serialized.opt, serialized.remote, [], {}, false, false, serialized.description, (_serialized$render11 = serialized.render) !== null && _serialized$render11 !== void 0 ? _serialized$render11 : null);
8142
8899
  case "date":
8143
- return new DateSchema(serialized.options, serialized.opt, [], false, false, serialized.description);
8900
+ return new DateSchema(serialized.options, serialized.opt, [], false, false, serialized.description, (_serialized$render12 = serialized.render) !== null && _serialized$render12 !== void 0 ? _serialized$render12 : null);
8144
8901
  case "dateTime":
8145
- return new DateTimeSchema(serialized.options, serialized.opt, [], false, false, serialized.description);
8902
+ return new DateTimeSchema(serialized.options, serialized.opt, [], false, false, serialized.description, (_serialized$render13 = serialized.render) !== null && _serialized$render13 !== void 0 ? _serialized$render13 : null);
8146
8903
  case "color":
8147
- return new ColorSchema(serialized.options, serialized.opt, [], false, false, serialized.description);
8904
+ return new ColorSchema(serialized.options, serialized.opt, [], false, false, serialized.description, (_serialized$render14 = serialized.render) !== null && _serialized$render14 !== void 0 ? _serialized$render14 : null);
8148
8905
  default:
8149
8906
  {
8150
8907
  var exhaustiveCheck = serialized;
@@ -8159,8 +8916,29 @@ function deserializeSchemaImpl(serialized) {
8159
8916
  }
8160
8917
 
8161
8918
  /**
8162
- * What a container shows for ONE of its items: the user's `preview` callback
8163
- * returns this, and the Studio draws a row from it.
8919
+ * A PREVIEW is how a VALUE is shown wherever a preview of it is needed — a row
8920
+ * in a sortable list, a key in a reference dropdown, a search hit, a
8921
+ * reference — which is everywhere the value is NAVIGABLE to rather than open.
8922
+ * It is never how the field itself is edited: that is a RENDER (`render.ts`),
8923
+ * which applies only when you are looking at the field. The two do not
8924
+ * intersect — a schema can carry both, and each is read in its own places.
8925
+ *
8926
+ * A preview is declared on the schema of the VALUE being previewed:
8927
+ *
8928
+ * ```ts
8929
+ * const author = s.object({ name: s.string() })
8930
+ * .preview(({ val }) => ({ title: val.name }));
8931
+ * const authors = s.array(author);
8932
+ * ```
8933
+ *
8934
+ * The container reifies its rows by running each ITEM's preview closure — see
8935
+ * {@link ArrayPreview} / {@link RecordPreview}. (Previews used to be declared
8936
+ * on the container instead; a `.preview` on an array/record now previews the
8937
+ * array/record itself as a value, for when IT is the item of something.)
8938
+ */
8939
+ /**
8940
+ * What a preview shows for one value: the user's `preview` callback returns
8941
+ * this, and the Studio draws a row from it.
8164
8942
  *
8165
8943
  * NB: {@link ArrayPreview} / {@link RecordPreview} name the DATA a container
8166
8944
  * previews with. The Studio also has React components called `ArrayPreview` /
@@ -8170,6 +8948,19 @@ function deserializeSchemaImpl(serialized) {
8170
8948
  * at the import rather than renaming that convention.
8171
8949
  */
8172
8950
 
8951
+ /**
8952
+ * What `.preview(...)` takes, on every schema: the value's own source in, a
8953
+ * {@link PreviewItem} out. `NonNullable` because a container skips null items
8954
+ * rather than previewing them.
8955
+ *
8956
+ * Declared through method syntax deliberately (the same bivariance shape
8957
+ * React's event handler types use): `nullable()` copies a schema's closure
8958
+ * into the `Src | null` variant of the same class, and with a plain function
8959
+ * type the checker cannot see that `NonNullable<Src | null>` IS
8960
+ * `NonNullable<Src>` while `Src` is still a type parameter — every schema's
8961
+ * `nullable()` would need a cast instead.
8962
+ */
8963
+
8173
8964
  /**
8174
8965
  * Main preview type.
8175
8966
  *
@@ -8262,11 +9053,21 @@ function previewScope(paths) {
8262
9053
  // TODO: improve this so that we do not get RawString and string, only string. Are there other things?
8263
9054
 
8264
9055
  /**
8265
- * A RENDER is how one field is laid out in the editor: `s.string().render({ as:
8266
- * "textarea" })`, `.render({ as: "code", language })`.
9056
+ * A RENDER is how the FIELD ITSELF is laid out in the editor, and it applies
9057
+ * only when you are looking at the field: `s.string().render({ as: "textarea"
9058
+ * })`, `.render({ as: "code", language })`, `.render({ as: "inline" })` on an
9059
+ * array/record item.
9060
+ *
9061
+ * A PREVIEW (`preview.ts`) is the other thing: how the VALUE is shown wherever
9062
+ * a preview of it is needed — a list row, a reference dropdown, a search hit —
9063
+ * that is, wherever the value is navigable to rather than open. The two never
9064
+ * intersect: a schema can carry both, a `render` is read where the field is
9065
+ * edited and a `preview` where the value is previewed. A second `.render(...)`
9066
+ * on the same schema REPLACES the first (last one wins), exactly like a second
9067
+ * `.preview(...)` replaces the first — they do not merge.
8267
9068
  *
8268
- * It is static configuration - plain data, with no closure behind it and no
8269
- * dependency on source - which is why it lives in the SERIALIZED schema
9069
+ * A render is static configuration - plain data, with no closure behind it and
9070
+ * no dependency on source - which is why it lives in the SERIALIZED schema
8270
9071
  * (`SerializedStringSchema.render`) and is read straight off it where the field
8271
9072
  * is drawn. There is no render pipeline, no store and no host round-trip.
8272
9073
  *
@@ -8276,9 +9077,6 @@ function previewScope(paths) {
8276
9077
  * the shape it needs back is `executePreview`'s, and the honest move is to give
8277
9078
  * `render` its own execute/store pair again. It is NOT to re-merge the two:
8278
9079
  * conflating them is what this file was split up to undo.
8279
- *
8280
- * The dynamic, source-dependent, demand-scoped thing - what a container shows
8281
- * for its items - is a PREVIEW. See `preview.ts`.
8282
9080
  */
8283
9081
  /**
8284
9082
  * The list is the declaration and {@link CodeLanguage} is derived from it, so
@@ -8287,9 +9085,29 @@ function previewScope(paths) {
8287
9085
  */
8288
9086
  var CODE_LANGUAGES = ["typescript", "javascript", "javascriptreact", "typescriptreact", "json", "java", "html", "css", "xml", "markdown", "sql", "python", "rust", "php", "go", "cpp", "sass", "vue", "angular"];
8289
9087
 
9088
+ /**
9089
+ * `{ as: "inline" }` on a field that is the ITEM of an array or record: the
9090
+ * container renders the field itself inside each (sortable) row, instead of a
9091
+ * clickable preview row that navigates to it. This is what a page-builder list
9092
+ * is made of: `s.array(s.object({...}).render({ as: "inline" }))`.
9093
+ *
9094
+ * On a field that is not directly under an array or record it is inert — an
9095
+ * object's fields are already laid out in place.
9096
+ *
9097
+ * Like every render it is static configuration (see the top of this file): it
9098
+ * travels whole in the serialized schema and the editor reads it straight off
9099
+ * the item schema it already has.
9100
+ */
9101
+
9102
+ /**
9103
+ * What `.render(...)` takes on every field except `s.string()`, and what the
9104
+ * serialized schema carries verbatim.
9105
+ */
9106
+
8290
9107
  /**
8291
9108
  * What `s.string().render(...)` takes, and what the serialized schema carries
8292
- * verbatim.
9109
+ * verbatim. A string has editor layouts of its own (textarea, code) in
9110
+ * addition to the container-facing `inline`.
8293
9111
  */
8294
9112
 
8295
9113
  var externalPageRouter = {
@@ -8563,6 +9381,7 @@ var Internal = {
8563
9381
  getSchema: getSchema,
8564
9382
  getValPath: getValPath,
8565
9383
  getSource: getSource,
9384
+ isValModule: isValModule,
8566
9385
  resolvePath: resolvePath,
8567
9386
  safeResolvePath: safeResolvePath,
8568
9387
  splitModuleFilePathAndModulePath: splitModuleFilePathAndModulePath,