@valbuild/core 0.138.2 → 0.139.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +37 -0
- package/dist/declarations/src/extractValModules.d.ts +14 -0
- package/dist/declarations/src/index.d.ts +1 -1
- package/dist/declarations/src/render.d.ts +36 -33
- package/dist/declarations/src/schema/array.d.ts +13 -8
- package/dist/declarations/src/schema/boolean.d.ts +1 -17
- package/dist/declarations/src/schema/code.d.ts +1 -21
- package/dist/declarations/src/schema/color.d.ts +1 -19
- package/dist/declarations/src/schema/date.d.ts +1 -17
- package/dist/declarations/src/schema/datetime.d.ts +1 -19
- package/dist/declarations/src/schema/discriminatedUnion.d.ts +1 -23
- package/dist/declarations/src/schema/enum.d.ts +1 -19
- package/dist/declarations/src/schema/file.d.ts +1 -19
- package/dist/declarations/src/schema/image.d.ts +1 -24
- package/dist/declarations/src/schema/keyOf.d.ts +14 -6
- package/dist/declarations/src/schema/literal.d.ts +1 -17
- package/dist/declarations/src/schema/locale.d.ts +1 -14
- package/dist/declarations/src/schema/number.d.ts +1 -17
- package/dist/declarations/src/schema/object.d.ts +1 -23
- package/dist/declarations/src/schema/record.d.ts +12 -6
- package/dist/declarations/src/schema/richtext.d.ts +1 -19
- package/dist/declarations/src/schema/route.d.ts +1 -17
- package/dist/declarations/src/schema/settings.d.ts +8 -12
- package/dist/declarations/src/schema/string.d.ts +1 -26
- package/dist/declarations/src/schema/view.d.ts +1 -20
- package/dist/{index-87b5aa27.cjs.prod.js → index-7d334094.cjs.prod.js} +319 -644
- package/dist/{index-8e33ef62.cjs.dev.js → index-90000f7a.cjs.dev.js} +319 -644
- package/dist/{index-36b5e0cb.esm.js → index-eb9f6480.esm.js} +319 -645
- package/dist/valbuild-core.cjs.dev.js +2 -1
- package/dist/valbuild-core.cjs.prod.js +2 -1
- package/dist/valbuild-core.esm.js +1 -1
- package/package.json +1 -1
- package/patch/dist/valbuild-core-patch.cjs.dev.js +1 -1
- package/patch/dist/valbuild-core-patch.cjs.prod.js +1 -1
- package/patch/dist/valbuild-core-patch.esm.js +2 -2
|
@@ -944,19 +944,17 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
|
|
|
944
944
|
var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
945
945
|
var isRaw = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
946
946
|
var customValidateFunctions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
|
|
947
|
-
var
|
|
948
|
-
var
|
|
949
|
-
var
|
|
950
|
-
var
|
|
951
|
-
var
|
|
952
|
-
var isMultiline = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : false;
|
|
947
|
+
var isReadonly = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
948
|
+
var isHidden = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
|
949
|
+
var description = arguments.length > 6 ? arguments[6] : undefined;
|
|
950
|
+
var previewInput = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
|
|
951
|
+
var isMultiline = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : false;
|
|
953
952
|
_classCallCheck(this, StringSchema);
|
|
954
953
|
_this = _callSuper(this, StringSchema);
|
|
955
954
|
_this.options = options;
|
|
956
955
|
_this.opt = opt;
|
|
957
956
|
_this.isRaw = isRaw;
|
|
958
957
|
_this.customValidateFunctions = customValidateFunctions;
|
|
959
|
-
_this.renderInput = renderInput;
|
|
960
958
|
_this.isReadonly = isReadonly;
|
|
961
959
|
_this.isHidden = isHidden;
|
|
962
960
|
_this.description = description;
|
|
@@ -988,7 +986,7 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
|
|
|
988
986
|
return _createClass(StringSchema, [{
|
|
989
987
|
key: "describe",
|
|
990
988
|
value: function describe(description) {
|
|
991
|
-
return new StringSchema(this.options, this.opt, this.isRaw, this.customValidateFunctions, this.
|
|
989
|
+
return new StringSchema(this.options, this.opt, this.isRaw, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined, this.previewInput, this.isMultiline);
|
|
992
990
|
}
|
|
993
991
|
|
|
994
992
|
/**
|
|
@@ -1016,7 +1014,7 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
|
|
|
1016
1014
|
value: function minLength(_minLength) {
|
|
1017
1015
|
return new StringSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
|
|
1018
1016
|
minLength: _minLength
|
|
1019
|
-
}), this.opt, this.isRaw, this.customValidateFunctions, this.
|
|
1017
|
+
}), this.opt, this.isRaw, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.previewInput, this.isMultiline);
|
|
1020
1018
|
}
|
|
1021
1019
|
|
|
1022
1020
|
/**
|
|
@@ -1044,7 +1042,7 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
|
|
|
1044
1042
|
value: function maxLength(_maxLength) {
|
|
1045
1043
|
return new StringSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
|
|
1046
1044
|
maxLength: _maxLength
|
|
1047
|
-
}), this.opt, this.isRaw, this.customValidateFunctions, this.
|
|
1045
|
+
}), this.opt, this.isRaw, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.previewInput, this.isMultiline);
|
|
1048
1046
|
}
|
|
1049
1047
|
|
|
1050
1048
|
/**
|
|
@@ -1065,7 +1063,7 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
|
|
|
1065
1063
|
return new StringSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
|
|
1066
1064
|
regexp: _regexp,
|
|
1067
1065
|
regExpMessage: message
|
|
1068
|
-
}), this.opt, this.isRaw, this.customValidateFunctions, this.
|
|
1066
|
+
}), this.opt, this.isRaw, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.previewInput, this.isMultiline);
|
|
1069
1067
|
}
|
|
1070
1068
|
|
|
1071
1069
|
/**
|
|
@@ -1091,7 +1089,7 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
|
|
|
1091
1089
|
}, {
|
|
1092
1090
|
key: "validate",
|
|
1093
1091
|
value: function validate(validationFunction) {
|
|
1094
|
-
return new StringSchema(this.options, this.opt, this.isRaw, this.customValidateFunctions.concat(validationFunction), this.
|
|
1092
|
+
return new StringSchema(this.options, this.opt, this.isRaw, this.customValidateFunctions.concat(validationFunction), this.isReadonly, this.isHidden, this.description, this.previewInput, this.isMultiline);
|
|
1095
1093
|
}
|
|
1096
1094
|
}, {
|
|
1097
1095
|
key: "executeValidate",
|
|
@@ -1164,19 +1162,19 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
|
|
|
1164
1162
|
}, {
|
|
1165
1163
|
key: "nullable",
|
|
1166
1164
|
value: function nullable() {
|
|
1167
|
-
return new StringSchema(this.options, true, this.isRaw, this.customValidateFunctions, this.
|
|
1165
|
+
return new StringSchema(this.options, true, this.isRaw, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.previewInput, this.isMultiline);
|
|
1168
1166
|
}
|
|
1169
1167
|
}, {
|
|
1170
1168
|
key: "readonly",
|
|
1171
1169
|
value: function readonly() {
|
|
1172
1170
|
var isReadonly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
1173
|
-
return new StringSchema(this.options, this.opt, this.isRaw, this.customValidateFunctions,
|
|
1171
|
+
return new StringSchema(this.options, this.opt, this.isRaw, this.customValidateFunctions, isReadonly, this.isHidden, this.description, this.previewInput, this.isMultiline);
|
|
1174
1172
|
}
|
|
1175
1173
|
}, {
|
|
1176
1174
|
key: "hidden",
|
|
1177
1175
|
value: function hidden() {
|
|
1178
1176
|
var isHidden = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
1179
|
-
return new StringSchema(this.options, this.opt, this.isRaw, this.customValidateFunctions, this.
|
|
1177
|
+
return new StringSchema(this.options, this.opt, this.isRaw, this.customValidateFunctions, this.isReadonly, isHidden, this.description, this.previewInput, this.isMultiline);
|
|
1180
1178
|
}
|
|
1181
1179
|
|
|
1182
1180
|
/**
|
|
@@ -1201,7 +1199,7 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
|
|
|
1201
1199
|
}, {
|
|
1202
1200
|
key: "raw",
|
|
1203
1201
|
value: function raw() {
|
|
1204
|
-
return new StringSchema(this.options, this.opt, true, this.customValidateFunctions, this.
|
|
1202
|
+
return new StringSchema(this.options, this.opt, true, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.previewInput, this.isMultiline);
|
|
1205
1203
|
}
|
|
1206
1204
|
}, {
|
|
1207
1205
|
key: "executeCustomValidateAt",
|
|
@@ -1213,10 +1211,9 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
|
|
|
1213
1211
|
}, {
|
|
1214
1212
|
key: "executeSerialize",
|
|
1215
1213
|
value: function executeSerialize() {
|
|
1216
|
-
var _this$
|
|
1214
|
+
var _this$options4, _this$options5, _this$options6, _this$customValidateF, _this$customValidateF2;
|
|
1217
1215
|
return {
|
|
1218
1216
|
type: "string",
|
|
1219
|
-
render: (_this$renderInput = this.renderInput) !== null && _this$renderInput !== void 0 ? _this$renderInput : undefined,
|
|
1220
1217
|
multiline: this.isMultiline ? true : undefined,
|
|
1221
1218
|
preview: this.previewInput ? true : undefined,
|
|
1222
1219
|
options: {
|
|
@@ -1253,25 +1250,7 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
|
|
|
1253
1250
|
}, {
|
|
1254
1251
|
key: "multiline",
|
|
1255
1252
|
value: function multiline() {
|
|
1256
|
-
return new StringSchema(this.options, this.opt, this.isRaw, this.customValidateFunctions, this.
|
|
1257
|
-
}
|
|
1258
|
-
|
|
1259
|
-
/**
|
|
1260
|
-
* How this field is laid out in the editor when it is the item of an array or
|
|
1261
|
-
* record: `{ as: "inline" }` renders the field itself inside each row,
|
|
1262
|
-
* instead of a preview row that navigates to it.
|
|
1263
|
-
*
|
|
1264
|
-
* Static configuration, not a callback — see `render.ts`. What a CONTAINER
|
|
1265
|
-
* shows for its items is a `preview`, which is a different thing entirely.
|
|
1266
|
-
*
|
|
1267
|
-
* @example
|
|
1268
|
-
* const schema = s.array(s.string().render({ as: "inline" }));
|
|
1269
|
-
* export default c.define("/example.val.ts", schema, ["First", "Second"]);
|
|
1270
|
-
*/
|
|
1271
|
-
}, {
|
|
1272
|
-
key: "render",
|
|
1273
|
-
value: function render(input) {
|
|
1274
|
-
return new StringSchema(this.options, this.opt, this.isRaw, this.customValidateFunctions, input, this.isReadonly, this.isHidden, this.description, this.previewInput, this.isMultiline);
|
|
1253
|
+
return new StringSchema(this.options, this.opt, this.isRaw, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.previewInput, true);
|
|
1275
1254
|
}
|
|
1276
1255
|
|
|
1277
1256
|
/**
|
|
@@ -1288,7 +1267,7 @@ var StringSchema = /*#__PURE__*/function (_Schema) {
|
|
|
1288
1267
|
}, {
|
|
1289
1268
|
key: "preview",
|
|
1290
1269
|
value: function preview(select) {
|
|
1291
|
-
return new StringSchema(this.options, this.opt, this.isRaw, this.customValidateFunctions, this.
|
|
1270
|
+
return new StringSchema(this.options, this.opt, this.isRaw, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, select, this.isMultiline);
|
|
1292
1271
|
}
|
|
1293
1272
|
}, {
|
|
1294
1273
|
key: "executePreviewItem",
|
|
@@ -1325,8 +1304,7 @@ var ObjectSchema = /*#__PURE__*/function (_Schema) {
|
|
|
1325
1304
|
var isReadonly = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
1326
1305
|
var isHidden = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
1327
1306
|
var description = arguments.length > 5 ? arguments[5] : undefined;
|
|
1328
|
-
var
|
|
1329
|
-
var previewInput = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
|
|
1307
|
+
var previewInput = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null;
|
|
1330
1308
|
_classCallCheck(this, ObjectSchema);
|
|
1331
1309
|
_this = _callSuper(this, ObjectSchema);
|
|
1332
1310
|
_this.items = items;
|
|
@@ -1335,7 +1313,6 @@ var ObjectSchema = /*#__PURE__*/function (_Schema) {
|
|
|
1335
1313
|
_this.isReadonly = isReadonly;
|
|
1336
1314
|
_this.isHidden = isHidden;
|
|
1337
1315
|
_this.description = description;
|
|
1338
|
-
_this.renderInput = renderInput;
|
|
1339
1316
|
_this.previewInput = previewInput;
|
|
1340
1317
|
return _this;
|
|
1341
1318
|
}
|
|
@@ -1366,7 +1343,7 @@ var ObjectSchema = /*#__PURE__*/function (_Schema) {
|
|
|
1366
1343
|
return _createClass(ObjectSchema, [{
|
|
1367
1344
|
key: "describe",
|
|
1368
1345
|
value: function describe(description) {
|
|
1369
|
-
return new ObjectSchema(this.items, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined, this.
|
|
1346
|
+
return new ObjectSchema(this.items, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined, this.previewInput);
|
|
1370
1347
|
}
|
|
1371
1348
|
|
|
1372
1349
|
/**
|
|
@@ -1398,7 +1375,7 @@ var ObjectSchema = /*#__PURE__*/function (_Schema) {
|
|
|
1398
1375
|
}, {
|
|
1399
1376
|
key: "validate",
|
|
1400
1377
|
value: function validate(validationFunction) {
|
|
1401
|
-
return new ObjectSchema(this.items, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.isReadonly, this.isHidden, this.description, this.
|
|
1378
|
+
return new ObjectSchema(this.items, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.isReadonly, this.isHidden, this.description, this.previewInput);
|
|
1402
1379
|
}
|
|
1403
1380
|
}, {
|
|
1404
1381
|
key: "executeValidate",
|
|
@@ -1531,19 +1508,19 @@ var ObjectSchema = /*#__PURE__*/function (_Schema) {
|
|
|
1531
1508
|
key: "nullable",
|
|
1532
1509
|
value: function nullable() {
|
|
1533
1510
|
// Explicit type args: `previewInput` would otherwise pin inference to `Src`.
|
|
1534
|
-
return new ObjectSchema(this.items, true, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.
|
|
1511
|
+
return new ObjectSchema(this.items, true, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.previewInput);
|
|
1535
1512
|
}
|
|
1536
1513
|
}, {
|
|
1537
1514
|
key: "readonly",
|
|
1538
1515
|
value: function readonly() {
|
|
1539
1516
|
var isReadonly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
1540
|
-
return new ObjectSchema(this.items, this.opt, this.customValidateFunctions, isReadonly, this.isHidden, this.description, this.
|
|
1517
|
+
return new ObjectSchema(this.items, this.opt, this.customValidateFunctions, isReadonly, this.isHidden, this.description, this.previewInput);
|
|
1541
1518
|
}
|
|
1542
1519
|
}, {
|
|
1543
1520
|
key: "hidden",
|
|
1544
1521
|
value: function hidden() {
|
|
1545
1522
|
var isHidden = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
1546
|
-
return new ObjectSchema(this.items, this.opt, this.customValidateFunctions, this.isReadonly, isHidden, this.description, this.
|
|
1523
|
+
return new ObjectSchema(this.items, this.opt, this.customValidateFunctions, this.isReadonly, isHidden, this.description, this.previewInput);
|
|
1547
1524
|
}
|
|
1548
1525
|
|
|
1549
1526
|
/** The names of this object's `s.locale()` fields, in declaration order. */
|
|
@@ -1582,29 +1559,6 @@ var ObjectSchema = /*#__PURE__*/function (_Schema) {
|
|
|
1582
1559
|
});
|
|
1583
1560
|
}
|
|
1584
1561
|
|
|
1585
|
-
/**
|
|
1586
|
-
* How this field is laid out in the editor when it is the item of an array
|
|
1587
|
-
* or record: `{ as: "inline" }` renders the field itself inside each row,
|
|
1588
|
-
* instead of a preview row that navigates to it.
|
|
1589
|
-
*
|
|
1590
|
-
* Static configuration, not a callback — see `render.ts`.
|
|
1591
|
-
*
|
|
1592
|
-
* @example
|
|
1593
|
-
* // A page builder: each row edits the object in place, instead of
|
|
1594
|
-
* // navigating to it.
|
|
1595
|
-
* const block = s
|
|
1596
|
-
* .object({ heading: s.string(), body: s.string() })
|
|
1597
|
-
* .render({ as: "inline" });
|
|
1598
|
-
* export default c.define("/example.val.ts", s.array(block), [
|
|
1599
|
-
* { heading: "Hello", body: "World" },
|
|
1600
|
-
* ]);
|
|
1601
|
-
*/
|
|
1602
|
-
}, {
|
|
1603
|
-
key: "render",
|
|
1604
|
-
value: function render(input) {
|
|
1605
|
-
return new ObjectSchema(this.items, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, input, this.previewInput);
|
|
1606
|
-
}
|
|
1607
|
-
|
|
1608
1562
|
/**
|
|
1609
1563
|
* How this VALUE is shown where a preview of it is needed — a row in a
|
|
1610
1564
|
* sortable list, a reference dropdown, a search hit. Never how the field
|
|
@@ -1621,7 +1575,7 @@ var ObjectSchema = /*#__PURE__*/function (_Schema) {
|
|
|
1621
1575
|
}, {
|
|
1622
1576
|
key: "preview",
|
|
1623
1577
|
value: function preview(select) {
|
|
1624
|
-
return new ObjectSchema(this.items, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description,
|
|
1578
|
+
return new ObjectSchema(this.items, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, select);
|
|
1625
1579
|
}
|
|
1626
1580
|
}, {
|
|
1627
1581
|
key: "executePreviewItem",
|
|
@@ -1641,10 +1595,9 @@ var ObjectSchema = /*#__PURE__*/function (_Schema) {
|
|
|
1641
1595
|
}, {
|
|
1642
1596
|
key: "executeSerialize",
|
|
1643
1597
|
value: function executeSerialize() {
|
|
1644
|
-
var _this$
|
|
1598
|
+
var _this$customValidateF;
|
|
1645
1599
|
return {
|
|
1646
1600
|
type: "object",
|
|
1647
|
-
render: (_this$renderInput = this.renderInput) !== null && _this$renderInput !== void 0 ? _this$renderInput : undefined,
|
|
1648
1601
|
preview: this.previewInput ? true : undefined,
|
|
1649
1602
|
items: Object.fromEntries(Object.entries(this.items).map(function (_ref5) {
|
|
1650
1603
|
var _ref6 = _slicedToArray(_ref5, 2),
|
|
@@ -2030,17 +1983,19 @@ var ArraySchema = /*#__PURE__*/function (_Schema) {
|
|
|
2030
1983
|
}
|
|
2031
1984
|
|
|
2032
1985
|
/**
|
|
2033
|
-
* How this
|
|
2034
|
-
*
|
|
2035
|
-
*
|
|
1986
|
+
* How this array lays out its ITEMS in the editor: `{ as: "inline" }` draws
|
|
1987
|
+
* each item's own editor inside its (sortable) row, instead of a preview row
|
|
1988
|
+
* that navigates to it. It reaches the direct items only.
|
|
2036
1989
|
*
|
|
2037
1990
|
* Static configuration, not a callback — see `render.ts`.
|
|
2038
1991
|
*
|
|
2039
1992
|
* @example
|
|
2040
|
-
* const schema = s
|
|
2041
|
-
*
|
|
2042
|
-
*
|
|
2043
|
-
*
|
|
1993
|
+
* const schema = s
|
|
1994
|
+
* .array(s.object({ title: s.string(), body: s.string() }))
|
|
1995
|
+
* .render({ as: "inline" });
|
|
1996
|
+
* export default c.define("/example.val.ts", schema, [
|
|
1997
|
+
* { title: "Hello", body: "World" },
|
|
1998
|
+
* ]);
|
|
2044
1999
|
*/
|
|
2045
2000
|
}, {
|
|
2046
2001
|
key: "render",
|
|
@@ -2063,8 +2018,7 @@ var LiteralSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2063
2018
|
var isReadonly = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
2064
2019
|
var isHidden = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
2065
2020
|
var description = arguments.length > 5 ? arguments[5] : undefined;
|
|
2066
|
-
var
|
|
2067
|
-
var previewInput = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
|
|
2021
|
+
var previewInput = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null;
|
|
2068
2022
|
_classCallCheck(this, LiteralSchema);
|
|
2069
2023
|
_this = _callSuper(this, LiteralSchema);
|
|
2070
2024
|
_this.value = value;
|
|
@@ -2073,7 +2027,6 @@ var LiteralSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2073
2027
|
_this.isReadonly = isReadonly;
|
|
2074
2028
|
_this.isHidden = isHidden;
|
|
2075
2029
|
_this.description = description;
|
|
2076
|
-
_this.renderInput = renderInput;
|
|
2077
2030
|
_this.previewInput = previewInput;
|
|
2078
2031
|
return _this;
|
|
2079
2032
|
}
|
|
@@ -2101,7 +2054,7 @@ var LiteralSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2101
2054
|
return _createClass(LiteralSchema, [{
|
|
2102
2055
|
key: "describe",
|
|
2103
2056
|
value: function describe(description) {
|
|
2104
|
-
return new LiteralSchema(this.value, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined, this.
|
|
2057
|
+
return new LiteralSchema(this.value, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined, this.previewInput);
|
|
2105
2058
|
}
|
|
2106
2059
|
|
|
2107
2060
|
/**
|
|
@@ -2127,7 +2080,7 @@ var LiteralSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2127
2080
|
}, {
|
|
2128
2081
|
key: "validate",
|
|
2129
2082
|
value: function validate(validationFunction) {
|
|
2130
|
-
return new LiteralSchema(this.value, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.isReadonly, this.isHidden, this.description, this.
|
|
2083
|
+
return new LiteralSchema(this.value, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.isReadonly, this.isHidden, this.description, this.previewInput);
|
|
2131
2084
|
}
|
|
2132
2085
|
}, {
|
|
2133
2086
|
key: "executeValidate",
|
|
@@ -2190,19 +2143,19 @@ var LiteralSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2190
2143
|
}, {
|
|
2191
2144
|
key: "nullable",
|
|
2192
2145
|
value: function nullable() {
|
|
2193
|
-
return new LiteralSchema(this.value, true, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.
|
|
2146
|
+
return new LiteralSchema(this.value, true, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.previewInput);
|
|
2194
2147
|
}
|
|
2195
2148
|
}, {
|
|
2196
2149
|
key: "readonly",
|
|
2197
2150
|
value: function readonly() {
|
|
2198
2151
|
var isReadonly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
2199
|
-
return new LiteralSchema(this.value, this.opt, this.customValidateFunctions, isReadonly, this.isHidden, this.description, this.
|
|
2152
|
+
return new LiteralSchema(this.value, this.opt, this.customValidateFunctions, isReadonly, this.isHidden, this.description, this.previewInput);
|
|
2200
2153
|
}
|
|
2201
2154
|
}, {
|
|
2202
2155
|
key: "hidden",
|
|
2203
2156
|
value: function hidden() {
|
|
2204
2157
|
var isHidden = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
2205
|
-
return new LiteralSchema(this.value, this.opt, this.customValidateFunctions, this.isReadonly, isHidden, this.description, this.
|
|
2158
|
+
return new LiteralSchema(this.value, this.opt, this.customValidateFunctions, this.isReadonly, isHidden, this.description, this.previewInput);
|
|
2206
2159
|
}
|
|
2207
2160
|
}, {
|
|
2208
2161
|
key: "executeCustomValidateAt",
|
|
@@ -2212,23 +2165,6 @@ var LiteralSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2212
2165
|
});
|
|
2213
2166
|
}
|
|
2214
2167
|
|
|
2215
|
-
/**
|
|
2216
|
-
* How this field is laid out in the editor when it is the item of an array
|
|
2217
|
-
* or record: `{ as: "inline" }` renders the field itself inside each row,
|
|
2218
|
-
* instead of a preview row that navigates to it.
|
|
2219
|
-
*
|
|
2220
|
-
* Static configuration, not a callback — see `render.ts`.
|
|
2221
|
-
*
|
|
2222
|
-
* @example
|
|
2223
|
-
* const schema = s.array(s.literal("hero").render({ as: "inline" }));
|
|
2224
|
-
* export default c.define("/example.val.ts", schema, ["hero"]);
|
|
2225
|
-
*/
|
|
2226
|
-
}, {
|
|
2227
|
-
key: "render",
|
|
2228
|
-
value: function render(input) {
|
|
2229
|
-
return new LiteralSchema(this.value, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, input, this.previewInput);
|
|
2230
|
-
}
|
|
2231
|
-
|
|
2232
2168
|
/**
|
|
2233
2169
|
* How this VALUE is shown where a preview of it is needed — a row in a
|
|
2234
2170
|
* sortable list, a reference dropdown, a search hit. Never how the field
|
|
@@ -2243,7 +2179,7 @@ var LiteralSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2243
2179
|
}, {
|
|
2244
2180
|
key: "preview",
|
|
2245
2181
|
value: function preview(select) {
|
|
2246
|
-
return new LiteralSchema(this.value, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description,
|
|
2182
|
+
return new LiteralSchema(this.value, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, select);
|
|
2247
2183
|
}
|
|
2248
2184
|
}, {
|
|
2249
2185
|
key: "executePreviewItem",
|
|
@@ -2263,10 +2199,9 @@ var LiteralSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2263
2199
|
}, {
|
|
2264
2200
|
key: "executeSerialize",
|
|
2265
2201
|
value: function executeSerialize() {
|
|
2266
|
-
var _this$
|
|
2202
|
+
var _this$customValidateF;
|
|
2267
2203
|
return {
|
|
2268
2204
|
type: "literal",
|
|
2269
|
-
render: (_this$renderInput = this.renderInput) !== null && _this$renderInput !== void 0 ? _this$renderInput : undefined,
|
|
2270
2205
|
preview: this.previewInput ? true : undefined,
|
|
2271
2206
|
value: this.value,
|
|
2272
2207
|
opt: this.opt,
|
|
@@ -2312,8 +2247,7 @@ var DiscriminatedUnionSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2312
2247
|
var isReadonly = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
2313
2248
|
var isHidden = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
|
2314
2249
|
var description = arguments.length > 6 ? arguments[6] : undefined;
|
|
2315
|
-
var
|
|
2316
|
-
var previewInput = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : null;
|
|
2250
|
+
var previewInput = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
|
|
2317
2251
|
_classCallCheck(this, DiscriminatedUnionSchema);
|
|
2318
2252
|
_this = _callSuper(this, DiscriminatedUnionSchema);
|
|
2319
2253
|
_this.key = key;
|
|
@@ -2323,7 +2257,6 @@ var DiscriminatedUnionSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2323
2257
|
_this.isReadonly = isReadonly;
|
|
2324
2258
|
_this.isHidden = isHidden;
|
|
2325
2259
|
_this.description = description;
|
|
2326
|
-
_this.renderInput = renderInput;
|
|
2327
2260
|
_this.previewInput = previewInput;
|
|
2328
2261
|
return _this;
|
|
2329
2262
|
}
|
|
@@ -2356,7 +2289,7 @@ var DiscriminatedUnionSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2356
2289
|
return _createClass(DiscriminatedUnionSchema, [{
|
|
2357
2290
|
key: "describe",
|
|
2358
2291
|
value: function describe(description) {
|
|
2359
|
-
return new DiscriminatedUnionSchema(this.key, this.items, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined, this.
|
|
2292
|
+
return new DiscriminatedUnionSchema(this.key, this.items, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined, this.previewInput);
|
|
2360
2293
|
}
|
|
2361
2294
|
|
|
2362
2295
|
/**
|
|
@@ -2389,7 +2322,7 @@ var DiscriminatedUnionSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2389
2322
|
}, {
|
|
2390
2323
|
key: "validate",
|
|
2391
2324
|
value: function validate(validationFunction) {
|
|
2392
|
-
return new DiscriminatedUnionSchema(this.key, this.items, this.opt, this.customValidateFunctions.concat(validationFunction), this.isReadonly, this.isHidden, this.description, this.
|
|
2325
|
+
return new DiscriminatedUnionSchema(this.key, this.items, this.opt, this.customValidateFunctions.concat(validationFunction), this.isReadonly, this.isHidden, this.description, this.previewInput);
|
|
2393
2326
|
}
|
|
2394
2327
|
}, {
|
|
2395
2328
|
key: "executeValidate",
|
|
@@ -2609,19 +2542,19 @@ var DiscriminatedUnionSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2609
2542
|
key: "nullable",
|
|
2610
2543
|
value: function nullable() {
|
|
2611
2544
|
// Explicit type args: `previewInput` would otherwise pin inference to `Src`.
|
|
2612
|
-
return new DiscriminatedUnionSchema(this.key, this.items, true, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.
|
|
2545
|
+
return new DiscriminatedUnionSchema(this.key, this.items, true, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.previewInput);
|
|
2613
2546
|
}
|
|
2614
2547
|
}, {
|
|
2615
2548
|
key: "readonly",
|
|
2616
2549
|
value: function readonly() {
|
|
2617
2550
|
var isReadonly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
2618
|
-
return new DiscriminatedUnionSchema(this.key, this.items, this.opt, this.customValidateFunctions, isReadonly, this.isHidden, this.description, this.
|
|
2551
|
+
return new DiscriminatedUnionSchema(this.key, this.items, this.opt, this.customValidateFunctions, isReadonly, this.isHidden, this.description, this.previewInput);
|
|
2619
2552
|
}
|
|
2620
2553
|
}, {
|
|
2621
2554
|
key: "hidden",
|
|
2622
2555
|
value: function hidden() {
|
|
2623
2556
|
var isHidden = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
2624
|
-
return new DiscriminatedUnionSchema(this.key, this.items, this.opt, this.customValidateFunctions, this.isReadonly, isHidden, this.description, this.
|
|
2557
|
+
return new DiscriminatedUnionSchema(this.key, this.items, this.opt, this.customValidateFunctions, this.isReadonly, isHidden, this.description, this.previewInput);
|
|
2625
2558
|
}
|
|
2626
2559
|
}, {
|
|
2627
2560
|
key: "localeScopeChildren",
|
|
@@ -2694,29 +2627,6 @@ var DiscriminatedUnionSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2694
2627
|
return null;
|
|
2695
2628
|
}
|
|
2696
2629
|
|
|
2697
|
-
/**
|
|
2698
|
-
* How this field is laid out in the editor when it is the item of an array
|
|
2699
|
-
* or record: `{ as: "inline" }` renders the field itself inside each row,
|
|
2700
|
-
* instead of a preview row that navigates to it.
|
|
2701
|
-
*
|
|
2702
|
-
* Static configuration, not a callback — see `render.ts`.
|
|
2703
|
-
*
|
|
2704
|
-
* @example
|
|
2705
|
-
* // A page builder: the row draws the tag selector and the matched
|
|
2706
|
-
* // variant's fields.
|
|
2707
|
-
* const hero = s.object({ type: s.literal("hero"), title: s.string() });
|
|
2708
|
-
* const text = s.object({ type: s.literal("text"), body: s.string() });
|
|
2709
|
-
* const block = s.discriminatedUnion("type", hero, text).render({ as: "inline" });
|
|
2710
|
-
* export default c.define("/example.val.ts", s.array(block), [
|
|
2711
|
-
* { type: "hero", title: "Hello" },
|
|
2712
|
-
* ]);
|
|
2713
|
-
*/
|
|
2714
|
-
}, {
|
|
2715
|
-
key: "render",
|
|
2716
|
-
value: function render(input) {
|
|
2717
|
-
return new DiscriminatedUnionSchema(this.key, this.items, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, input, this.previewInput);
|
|
2718
|
-
}
|
|
2719
|
-
|
|
2720
2630
|
/**
|
|
2721
2631
|
* How this VALUE is shown where a preview of it is needed — a row in a
|
|
2722
2632
|
* sortable list, a reference dropdown, a search hit. Never how the field
|
|
@@ -2739,7 +2649,7 @@ var DiscriminatedUnionSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2739
2649
|
}, {
|
|
2740
2650
|
key: "preview",
|
|
2741
2651
|
value: function preview(select) {
|
|
2742
|
-
return new DiscriminatedUnionSchema(this.key, this.items, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description,
|
|
2652
|
+
return new DiscriminatedUnionSchema(this.key, this.items, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, select);
|
|
2743
2653
|
}
|
|
2744
2654
|
}, {
|
|
2745
2655
|
key: "executePreviewItem",
|
|
@@ -2770,10 +2680,9 @@ var DiscriminatedUnionSchema = /*#__PURE__*/function (_Schema) {
|
|
|
2770
2680
|
}, {
|
|
2771
2681
|
key: "executeSerialize",
|
|
2772
2682
|
value: function executeSerialize() {
|
|
2773
|
-
var _this$
|
|
2683
|
+
var _this$customValidateF;
|
|
2774
2684
|
return {
|
|
2775
2685
|
type: "discriminated-union",
|
|
2776
|
-
render: (_this$renderInput = this.renderInput) !== null && _this$renderInput !== void 0 ? _this$renderInput : undefined,
|
|
2777
2686
|
preview: this.previewInput ? true : undefined,
|
|
2778
2687
|
key: this.key,
|
|
2779
2688
|
// Every item is an ObjectSchema — `executeValidate` reports a schema
|
|
@@ -3795,8 +3704,7 @@ var ImageSchema = /*#__PURE__*/function (_Schema) {
|
|
|
3795
3704
|
var isReadonly = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
|
3796
3705
|
var isHidden = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
|
|
3797
3706
|
var description = arguments.length > 7 ? arguments[7] : undefined;
|
|
3798
|
-
var
|
|
3799
|
-
var previewInput = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : null;
|
|
3707
|
+
var previewInput = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : null;
|
|
3800
3708
|
_classCallCheck(this, ImageSchema);
|
|
3801
3709
|
_this = _callSuper(this, ImageSchema);
|
|
3802
3710
|
_this.options = options;
|
|
@@ -3807,7 +3715,6 @@ var ImageSchema = /*#__PURE__*/function (_Schema) {
|
|
|
3807
3715
|
_this.isReadonly = isReadonly;
|
|
3808
3716
|
_this.isHidden = isHidden;
|
|
3809
3717
|
_this.description = description;
|
|
3810
|
-
_this.renderInput = renderInput;
|
|
3811
3718
|
_this.previewInput = previewInput;
|
|
3812
3719
|
return _this;
|
|
3813
3720
|
}
|
|
@@ -3840,7 +3747,7 @@ var ImageSchema = /*#__PURE__*/function (_Schema) {
|
|
|
3840
3747
|
return _createClass(ImageSchema, [{
|
|
3841
3748
|
key: "describe",
|
|
3842
3749
|
value: function describe(description) {
|
|
3843
|
-
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.
|
|
3750
|
+
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.previewInput);
|
|
3844
3751
|
}
|
|
3845
3752
|
|
|
3846
3753
|
/**
|
|
@@ -3870,7 +3777,7 @@ var ImageSchema = /*#__PURE__*/function (_Schema) {
|
|
|
3870
3777
|
}, {
|
|
3871
3778
|
key: "remote",
|
|
3872
3779
|
value: function remote() {
|
|
3873
|
-
return new ImageSchema(this.options, this.opt, true, this.customValidateFunctions, this.moduleMetadata, this.isReadonly, this.isHidden, this.description, this.
|
|
3780
|
+
return new ImageSchema(this.options, this.opt, true, this.customValidateFunctions, this.moduleMetadata, this.isReadonly, this.isHidden, this.description, this.previewInput);
|
|
3874
3781
|
}
|
|
3875
3782
|
|
|
3876
3783
|
/**
|
|
@@ -3905,7 +3812,7 @@ var ImageSchema = /*#__PURE__*/function (_Schema) {
|
|
|
3905
3812
|
}, {
|
|
3906
3813
|
key: "validate",
|
|
3907
3814
|
value: function validate(validationFunction) {
|
|
3908
|
-
return new ImageSchema(this.options, this.opt, this.isRemote, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.moduleMetadata, this.isReadonly, this.isHidden, this.description, this.
|
|
3815
|
+
return new ImageSchema(this.options, this.opt, this.isRemote, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.moduleMetadata, this.isReadonly, this.isHidden, this.description, this.previewInput);
|
|
3909
3816
|
}
|
|
3910
3817
|
}, {
|
|
3911
3818
|
key: "executeValidate",
|
|
@@ -4095,19 +4002,19 @@ var ImageSchema = /*#__PURE__*/function (_Schema) {
|
|
|
4095
4002
|
}, {
|
|
4096
4003
|
key: "nullable",
|
|
4097
4004
|
value: function nullable() {
|
|
4098
|
-
return new ImageSchema(this.options, true, this.isRemote, this.customValidateFunctions, this.moduleMetadata, this.isReadonly, this.isHidden, this.description, this.
|
|
4005
|
+
return new ImageSchema(this.options, true, this.isRemote, this.customValidateFunctions, this.moduleMetadata, this.isReadonly, this.isHidden, this.description, this.previewInput);
|
|
4099
4006
|
}
|
|
4100
4007
|
}, {
|
|
4101
4008
|
key: "readonly",
|
|
4102
4009
|
value: function readonly() {
|
|
4103
4010
|
var isReadonly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
4104
|
-
return new ImageSchema(this.options, this.opt, this.isRemote, this.customValidateFunctions, this.moduleMetadata, isReadonly, this.isHidden, this.description, this.
|
|
4011
|
+
return new ImageSchema(this.options, this.opt, this.isRemote, this.customValidateFunctions, this.moduleMetadata, isReadonly, this.isHidden, this.description, this.previewInput);
|
|
4105
4012
|
}
|
|
4106
4013
|
}, {
|
|
4107
4014
|
key: "hidden",
|
|
4108
4015
|
value: function hidden() {
|
|
4109
4016
|
var isHidden = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
4110
|
-
return new ImageSchema(this.options, this.opt, this.isRemote, this.customValidateFunctions, this.moduleMetadata, this.isReadonly, isHidden, this.description, this.
|
|
4017
|
+
return new ImageSchema(this.options, this.opt, this.isRemote, this.customValidateFunctions, this.moduleMetadata, this.isReadonly, isHidden, this.description, this.previewInput);
|
|
4111
4018
|
}
|
|
4112
4019
|
}, {
|
|
4113
4020
|
key: "executeCustomValidateAt",
|
|
@@ -4117,30 +4024,6 @@ var ImageSchema = /*#__PURE__*/function (_Schema) {
|
|
|
4117
4024
|
});
|
|
4118
4025
|
}
|
|
4119
4026
|
|
|
4120
|
-
/**
|
|
4121
|
-
* How this field is laid out in the editor when it is the item of an array
|
|
4122
|
-
* or record: `{ as: "inline" }` renders the field itself inside each row,
|
|
4123
|
-
* instead of a preview row that navigates to it.
|
|
4124
|
-
*
|
|
4125
|
-
* Static configuration, not a callback — see `render.ts`.
|
|
4126
|
-
*
|
|
4127
|
-
* @example
|
|
4128
|
-
* const schema = s.array(s.image().render({ as: "inline" }));
|
|
4129
|
-
* export default c.define("/example.val.ts", schema, [
|
|
4130
|
-
* {
|
|
4131
|
-
* path: "/public/val/example.png",
|
|
4132
|
-
* width: 100,
|
|
4133
|
-
* height: 100,
|
|
4134
|
-
* mimeType: "image/png",
|
|
4135
|
-
* },
|
|
4136
|
-
* ]);
|
|
4137
|
-
*/
|
|
4138
|
-
}, {
|
|
4139
|
-
key: "render",
|
|
4140
|
-
value: function render(input) {
|
|
4141
|
-
return new ImageSchema(this.options, this.opt, this.isRemote, this.customValidateFunctions, this.moduleMetadata, this.isReadonly, this.isHidden, this.description, input, this.previewInput);
|
|
4142
|
-
}
|
|
4143
|
-
|
|
4144
4027
|
/**
|
|
4145
4028
|
* How this VALUE is shown where a preview of it is needed — a row in a
|
|
4146
4029
|
* sortable list, a reference dropdown, a search hit. Never how the field
|
|
@@ -4166,7 +4049,7 @@ var ImageSchema = /*#__PURE__*/function (_Schema) {
|
|
|
4166
4049
|
}, {
|
|
4167
4050
|
key: "preview",
|
|
4168
4051
|
value: function preview(select) {
|
|
4169
|
-
return new ImageSchema(this.options, this.opt, this.isRemote, this.customValidateFunctions, this.moduleMetadata, this.isReadonly, this.isHidden, this.description,
|
|
4052
|
+
return new ImageSchema(this.options, this.opt, this.isRemote, this.customValidateFunctions, this.moduleMetadata, this.isReadonly, this.isHidden, this.description, select);
|
|
4170
4053
|
}
|
|
4171
4054
|
}, {
|
|
4172
4055
|
key: "executePreviewItem",
|
|
@@ -4186,11 +4069,10 @@ var ImageSchema = /*#__PURE__*/function (_Schema) {
|
|
|
4186
4069
|
}, {
|
|
4187
4070
|
key: "executeSerialize",
|
|
4188
4071
|
value: function executeSerialize() {
|
|
4189
|
-
var _this$
|
|
4072
|
+
var _this$customValidateF;
|
|
4190
4073
|
var modulePaths = this.moduleMetadata ? Object.keys(this.moduleMetadata) : [];
|
|
4191
4074
|
return {
|
|
4192
4075
|
type: "image",
|
|
4193
|
-
render: (_this$renderInput = this.renderInput) !== null && _this$renderInput !== void 0 ? _this$renderInput : undefined,
|
|
4194
4076
|
preview: this.previewInput ? true : undefined,
|
|
4195
4077
|
options: this.options,
|
|
4196
4078
|
opt: this.opt,
|
|
@@ -4239,8 +4121,7 @@ var RouteSchema = /*#__PURE__*/function (_Schema) {
|
|
|
4239
4121
|
var isReadonly = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
4240
4122
|
var isHidden = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
4241
4123
|
var description = arguments.length > 5 ? arguments[5] : undefined;
|
|
4242
|
-
var
|
|
4243
|
-
var previewInput = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
|
|
4124
|
+
var previewInput = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null;
|
|
4244
4125
|
_classCallCheck(this, RouteSchema);
|
|
4245
4126
|
_this = _callSuper(this, RouteSchema);
|
|
4246
4127
|
_this.options = options;
|
|
@@ -4249,7 +4130,6 @@ var RouteSchema = /*#__PURE__*/function (_Schema) {
|
|
|
4249
4130
|
_this.isReadonly = isReadonly;
|
|
4250
4131
|
_this.isHidden = isHidden;
|
|
4251
4132
|
_this.description = description;
|
|
4252
|
-
_this.renderInput = renderInput;
|
|
4253
4133
|
_this.previewInput = previewInput;
|
|
4254
4134
|
return _this;
|
|
4255
4135
|
}
|
|
@@ -4275,7 +4155,7 @@ var RouteSchema = /*#__PURE__*/function (_Schema) {
|
|
|
4275
4155
|
return _createClass(RouteSchema, [{
|
|
4276
4156
|
key: "describe",
|
|
4277
4157
|
value: function describe(description) {
|
|
4278
|
-
return new RouteSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined, this.
|
|
4158
|
+
return new RouteSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined, this.previewInput);
|
|
4279
4159
|
}
|
|
4280
4160
|
|
|
4281
4161
|
/**
|
|
@@ -4295,7 +4175,7 @@ var RouteSchema = /*#__PURE__*/function (_Schema) {
|
|
|
4295
4175
|
value: function include(pattern) {
|
|
4296
4176
|
return new RouteSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
|
|
4297
4177
|
include: pattern
|
|
4298
|
-
}), this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.
|
|
4178
|
+
}), this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.previewInput);
|
|
4299
4179
|
}
|
|
4300
4180
|
|
|
4301
4181
|
/**
|
|
@@ -4315,7 +4195,7 @@ var RouteSchema = /*#__PURE__*/function (_Schema) {
|
|
|
4315
4195
|
value: function exclude(pattern) {
|
|
4316
4196
|
return new RouteSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
|
|
4317
4197
|
exclude: pattern
|
|
4318
|
-
}), this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.
|
|
4198
|
+
}), this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.previewInput);
|
|
4319
4199
|
}
|
|
4320
4200
|
|
|
4321
4201
|
/**
|
|
@@ -4341,7 +4221,7 @@ var RouteSchema = /*#__PURE__*/function (_Schema) {
|
|
|
4341
4221
|
}, {
|
|
4342
4222
|
key: "validate",
|
|
4343
4223
|
value: function validate(validationFunction) {
|
|
4344
|
-
return new RouteSchema(this.options, this.opt, this.customValidateFunctions.concat(validationFunction), this.isReadonly, this.isHidden, this.description, this.
|
|
4224
|
+
return new RouteSchema(this.options, this.opt, this.customValidateFunctions.concat(validationFunction), this.isReadonly, this.isHidden, this.description, this.previewInput);
|
|
4345
4225
|
}
|
|
4346
4226
|
}, {
|
|
4347
4227
|
key: "executeValidate",
|
|
@@ -4396,19 +4276,19 @@ var RouteSchema = /*#__PURE__*/function (_Schema) {
|
|
|
4396
4276
|
}, {
|
|
4397
4277
|
key: "nullable",
|
|
4398
4278
|
value: function nullable() {
|
|
4399
|
-
return new RouteSchema(this.options, true, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.
|
|
4279
|
+
return new RouteSchema(this.options, true, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.previewInput);
|
|
4400
4280
|
}
|
|
4401
4281
|
}, {
|
|
4402
4282
|
key: "readonly",
|
|
4403
4283
|
value: function readonly() {
|
|
4404
4284
|
var isReadonly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
4405
|
-
return new RouteSchema(this.options, this.opt, this.customValidateFunctions, isReadonly, this.isHidden, this.description, this.
|
|
4285
|
+
return new RouteSchema(this.options, this.opt, this.customValidateFunctions, isReadonly, this.isHidden, this.description, this.previewInput);
|
|
4406
4286
|
}
|
|
4407
4287
|
}, {
|
|
4408
4288
|
key: "hidden",
|
|
4409
4289
|
value: function hidden() {
|
|
4410
4290
|
var isHidden = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
4411
|
-
return new RouteSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, isHidden, this.description, this.
|
|
4291
|
+
return new RouteSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, isHidden, this.description, this.previewInput);
|
|
4412
4292
|
}
|
|
4413
4293
|
}, {
|
|
4414
4294
|
key: "executeCustomValidateAt",
|
|
@@ -4418,23 +4298,6 @@ var RouteSchema = /*#__PURE__*/function (_Schema) {
|
|
|
4418
4298
|
});
|
|
4419
4299
|
}
|
|
4420
4300
|
|
|
4421
|
-
/**
|
|
4422
|
-
* How this field is laid out in the editor when it is the item of an array
|
|
4423
|
-
* or record: `{ as: "inline" }` renders the field itself inside each row,
|
|
4424
|
-
* instead of a preview row that navigates to it.
|
|
4425
|
-
*
|
|
4426
|
-
* Static configuration, not a callback — see `render.ts`.
|
|
4427
|
-
*
|
|
4428
|
-
* @example
|
|
4429
|
-
* const schema = s.array(s.route().render({ as: "inline" }));
|
|
4430
|
-
* export default c.define("/example.val.ts", schema, ["/a-page-slug"]);
|
|
4431
|
-
*/
|
|
4432
|
-
}, {
|
|
4433
|
-
key: "render",
|
|
4434
|
-
value: function render(input) {
|
|
4435
|
-
return new RouteSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, input, this.previewInput);
|
|
4436
|
-
}
|
|
4437
|
-
|
|
4438
4301
|
/**
|
|
4439
4302
|
* How this VALUE is shown where a preview of it is needed — a row in a
|
|
4440
4303
|
* sortable list, a reference dropdown, a search hit. Never how the field
|
|
@@ -4449,7 +4312,7 @@ var RouteSchema = /*#__PURE__*/function (_Schema) {
|
|
|
4449
4312
|
}, {
|
|
4450
4313
|
key: "preview",
|
|
4451
4314
|
value: function preview(select) {
|
|
4452
|
-
return new RouteSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description,
|
|
4315
|
+
return new RouteSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, select);
|
|
4453
4316
|
}
|
|
4454
4317
|
}, {
|
|
4455
4318
|
key: "executePreviewItem",
|
|
@@ -4469,10 +4332,9 @@ var RouteSchema = /*#__PURE__*/function (_Schema) {
|
|
|
4469
4332
|
}, {
|
|
4470
4333
|
key: "executeSerialize",
|
|
4471
4334
|
value: function executeSerialize() {
|
|
4472
|
-
var _this$
|
|
4335
|
+
var _this$options3, _this$options4, _this$customValidateF, _this$customValidateF2;
|
|
4473
4336
|
return {
|
|
4474
4337
|
type: "route",
|
|
4475
|
-
render: (_this$renderInput = this.renderInput) !== null && _this$renderInput !== void 0 ? _this$renderInput : undefined,
|
|
4476
4338
|
preview: this.previewInput ? true : undefined,
|
|
4477
4339
|
options: {
|
|
4478
4340
|
include: ((_this$options3 = this.options) === null || _this$options3 === void 0 ? void 0 : _this$options3.include) && {
|
|
@@ -4506,8 +4368,7 @@ var RichTextSchema = /*#__PURE__*/function (_Schema) {
|
|
|
4506
4368
|
var isReadonly = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
4507
4369
|
var isHidden = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
4508
4370
|
var description = arguments.length > 5 ? arguments[5] : undefined;
|
|
4509
|
-
var
|
|
4510
|
-
var previewInput = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
|
|
4371
|
+
var previewInput = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null;
|
|
4511
4372
|
_classCallCheck(this, RichTextSchema);
|
|
4512
4373
|
_this = _callSuper(this, RichTextSchema);
|
|
4513
4374
|
_this.options = options;
|
|
@@ -4516,7 +4377,6 @@ var RichTextSchema = /*#__PURE__*/function (_Schema) {
|
|
|
4516
4377
|
_this.isReadonly = isReadonly;
|
|
4517
4378
|
_this.isHidden = isHidden;
|
|
4518
4379
|
_this.description = description;
|
|
4519
|
-
_this.renderInput = renderInput;
|
|
4520
4380
|
_this.previewInput = previewInput;
|
|
4521
4381
|
return _this;
|
|
4522
4382
|
}
|
|
@@ -4544,7 +4404,7 @@ var RichTextSchema = /*#__PURE__*/function (_Schema) {
|
|
|
4544
4404
|
return _createClass(RichTextSchema, [{
|
|
4545
4405
|
key: "describe",
|
|
4546
4406
|
value: function describe(description) {
|
|
4547
|
-
return new RichTextSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined, this.
|
|
4407
|
+
return new RichTextSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined, this.previewInput);
|
|
4548
4408
|
}
|
|
4549
4409
|
|
|
4550
4410
|
/**
|
|
@@ -4564,7 +4424,7 @@ var RichTextSchema = /*#__PURE__*/function (_Schema) {
|
|
|
4564
4424
|
value: function maxLength(max) {
|
|
4565
4425
|
return new RichTextSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
|
|
4566
4426
|
maxLength: max
|
|
4567
|
-
}), this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.
|
|
4427
|
+
}), this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.previewInput);
|
|
4568
4428
|
}
|
|
4569
4429
|
|
|
4570
4430
|
/**
|
|
@@ -4584,7 +4444,7 @@ var RichTextSchema = /*#__PURE__*/function (_Schema) {
|
|
|
4584
4444
|
value: function minLength(min) {
|
|
4585
4445
|
return new RichTextSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
|
|
4586
4446
|
minLength: min
|
|
4587
|
-
}), this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.
|
|
4447
|
+
}), this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.previewInput);
|
|
4588
4448
|
}
|
|
4589
4449
|
|
|
4590
4450
|
/**
|
|
@@ -4612,7 +4472,7 @@ var RichTextSchema = /*#__PURE__*/function (_Schema) {
|
|
|
4612
4472
|
}, {
|
|
4613
4473
|
key: "validate",
|
|
4614
4474
|
value: function validate(validationFunction) {
|
|
4615
|
-
return new RichTextSchema(this.options, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.isReadonly, this.isHidden, this.description, this.
|
|
4475
|
+
return new RichTextSchema(this.options, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.isReadonly, this.isHidden, this.description, this.previewInput);
|
|
4616
4476
|
}
|
|
4617
4477
|
}, {
|
|
4618
4478
|
key: "executeValidate",
|
|
@@ -5056,19 +4916,19 @@ var RichTextSchema = /*#__PURE__*/function (_Schema) {
|
|
|
5056
4916
|
}, {
|
|
5057
4917
|
key: "nullable",
|
|
5058
4918
|
value: function nullable() {
|
|
5059
|
-
return new RichTextSchema(this.options, true, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.
|
|
4919
|
+
return new RichTextSchema(this.options, true, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.previewInput);
|
|
5060
4920
|
}
|
|
5061
4921
|
}, {
|
|
5062
4922
|
key: "readonly",
|
|
5063
4923
|
value: function readonly() {
|
|
5064
4924
|
var isReadonly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
5065
|
-
return new RichTextSchema(this.options, this.opt, this.customValidateFunctions, isReadonly, this.isHidden, this.description, this.
|
|
4925
|
+
return new RichTextSchema(this.options, this.opt, this.customValidateFunctions, isReadonly, this.isHidden, this.description, this.previewInput);
|
|
5066
4926
|
}
|
|
5067
4927
|
}, {
|
|
5068
4928
|
key: "hidden",
|
|
5069
4929
|
value: function hidden() {
|
|
5070
4930
|
var isHidden = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
5071
|
-
return new RichTextSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, isHidden, this.description, this.
|
|
4931
|
+
return new RichTextSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, isHidden, this.description, this.previewInput);
|
|
5072
4932
|
}
|
|
5073
4933
|
}, {
|
|
5074
4934
|
key: "executeCustomValidateAt",
|
|
@@ -5078,25 +4938,6 @@ var RichTextSchema = /*#__PURE__*/function (_Schema) {
|
|
|
5078
4938
|
});
|
|
5079
4939
|
}
|
|
5080
4940
|
|
|
5081
|
-
/**
|
|
5082
|
-
* How this field is laid out in the editor when it is the item of an array
|
|
5083
|
-
* or record: `{ as: "inline" }` renders the field itself inside each row,
|
|
5084
|
-
* instead of a preview row that navigates to it.
|
|
5085
|
-
*
|
|
5086
|
-
* Static configuration, not a callback — see `render.ts`.
|
|
5087
|
-
*
|
|
5088
|
-
* @example
|
|
5089
|
-
* const schema = s.array(s.richtext().render({ as: "inline" }));
|
|
5090
|
-
* export default c.define("/example.val.ts", schema, [
|
|
5091
|
-
* [{ tag: "p", children: ["Hello"] }],
|
|
5092
|
-
* ]);
|
|
5093
|
-
*/
|
|
5094
|
-
}, {
|
|
5095
|
-
key: "render",
|
|
5096
|
-
value: function render(input) {
|
|
5097
|
-
return new RichTextSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, input, this.previewInput);
|
|
5098
|
-
}
|
|
5099
|
-
|
|
5100
4941
|
/**
|
|
5101
4942
|
* How this VALUE is shown where a preview of it is needed — a row in a
|
|
5102
4943
|
* sortable list, a reference dropdown, a search hit. Never how the field
|
|
@@ -5115,7 +4956,7 @@ var RichTextSchema = /*#__PURE__*/function (_Schema) {
|
|
|
5115
4956
|
}, {
|
|
5116
4957
|
key: "preview",
|
|
5117
4958
|
value: function preview(select) {
|
|
5118
|
-
return new RichTextSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description,
|
|
4959
|
+
return new RichTextSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, select);
|
|
5119
4960
|
}
|
|
5120
4961
|
}, {
|
|
5121
4962
|
key: "executePreviewItem",
|
|
@@ -5136,7 +4977,6 @@ var RichTextSchema = /*#__PURE__*/function (_Schema) {
|
|
|
5136
4977
|
key: "executeSerialize",
|
|
5137
4978
|
value: function executeSerialize() {
|
|
5138
4979
|
var _this3 = this,
|
|
5139
|
-
_this$renderInput,
|
|
5140
4980
|
_this$customValidateF;
|
|
5141
4981
|
var serializeAnchorSchema = function serializeAnchorSchema() {
|
|
5142
4982
|
if (_this3.options.a instanceof RouteSchema) {
|
|
@@ -5166,7 +5006,6 @@ var RichTextSchema = /*#__PURE__*/function (_Schema) {
|
|
|
5166
5006
|
};
|
|
5167
5007
|
return {
|
|
5168
5008
|
type: "richtext",
|
|
5169
|
-
render: (_this$renderInput = this.renderInput) !== null && _this$renderInput !== void 0 ? _this$renderInput : undefined,
|
|
5170
5009
|
preview: this.previewInput ? true : undefined,
|
|
5171
5010
|
opt: this.opt,
|
|
5172
5011
|
options: serializedOptions,
|
|
@@ -5630,6 +5469,25 @@ function missingDeclaredKeys(declared, present) {
|
|
|
5630
5469
|
});
|
|
5631
5470
|
}
|
|
5632
5471
|
|
|
5472
|
+
/**
|
|
5473
|
+
* `.render(...)` is for records whose entries the generic record editor draws.
|
|
5474
|
+
* A router's entries are pages and a gallery's are media, and both have UIs of
|
|
5475
|
+
* their own that a render would not reach — so the combination is refused
|
|
5476
|
+
* rather than accepted and ignored. Called from both `render` and `router`,
|
|
5477
|
+
* because either can come first in the chain.
|
|
5478
|
+
*/
|
|
5479
|
+
function assertRenderable(router, mediaOptions, render) {
|
|
5480
|
+
if (render === null) {
|
|
5481
|
+
return;
|
|
5482
|
+
}
|
|
5483
|
+
if (router) {
|
|
5484
|
+
throw new Error("`.render(...)` is not supported on `s.router(...)`: a router's entries are pages, which have their own UI.");
|
|
5485
|
+
}
|
|
5486
|
+
if (mediaOptions) {
|
|
5487
|
+
throw new Error("`.render(...)` is not supported on `s.".concat(mediaOptions.type === "images" ? "imageset" : "fileset", "(...)`: media galleries have their own UI."));
|
|
5488
|
+
}
|
|
5489
|
+
}
|
|
5490
|
+
|
|
5633
5491
|
/**
|
|
5634
5492
|
* A router's scheme restriction, as a spreadable fragment.
|
|
5635
5493
|
*
|
|
@@ -6228,6 +6086,7 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
|
|
|
6228
6086
|
}, {
|
|
6229
6087
|
key: "router",
|
|
6230
6088
|
value: function router(_router) {
|
|
6089
|
+
assertRenderable(_router, this.mediaOptions, this.renderInput);
|
|
6231
6090
|
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, this.externalLabel);
|
|
6232
6091
|
}
|
|
6233
6092
|
|
|
@@ -6647,19 +6506,23 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
|
|
|
6647
6506
|
}
|
|
6648
6507
|
|
|
6649
6508
|
/**
|
|
6650
|
-
* How this
|
|
6651
|
-
*
|
|
6652
|
-
*
|
|
6509
|
+
* How this record lays out its ENTRIES in the editor: `{ as: "inline" }`
|
|
6510
|
+
* draws each entry's own editor in place, labelled by its key, instead of a
|
|
6511
|
+
* preview row that navigates to it. It reaches the direct entries only.
|
|
6512
|
+
*
|
|
6513
|
+
* Not for `s.router(...)`, `s.imageset(...)` or `s.fileset(...)`: pages and
|
|
6514
|
+
* media have UIs of their own, so this throws on them.
|
|
6653
6515
|
*
|
|
6654
6516
|
* Static configuration, not a callback — see `render.ts`.
|
|
6655
6517
|
*
|
|
6656
6518
|
* @example
|
|
6657
|
-
* const schema = s.
|
|
6658
|
-
* export default c.define("/example.val.ts", schema,
|
|
6519
|
+
* const schema = s.record(s.string()).render({ as: "inline" });
|
|
6520
|
+
* export default c.define("/example.val.ts", schema, { en: "Read more" });
|
|
6659
6521
|
*/
|
|
6660
6522
|
}, {
|
|
6661
6523
|
key: "render",
|
|
6662
6524
|
value: function render(input) {
|
|
6525
|
+
assertRenderable(this.currentRouter, this.mediaOptions, input);
|
|
6663
6526
|
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, this.externalLabel);
|
|
6664
6527
|
}
|
|
6665
6528
|
}]);
|
|
@@ -6896,8 +6759,7 @@ var LocaleSchema = /*#__PURE__*/function (_Schema) {
|
|
|
6896
6759
|
var isReadonly = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
6897
6760
|
var isHidden = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
6898
6761
|
var description = arguments.length > 4 ? arguments[4] : undefined;
|
|
6899
|
-
var
|
|
6900
|
-
var previewInput = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null;
|
|
6762
|
+
var previewInput = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : null;
|
|
6901
6763
|
_classCallCheck(this, LocaleSchema);
|
|
6902
6764
|
_this = _callSuper(this, LocaleSchema);
|
|
6903
6765
|
_this.opt = opt;
|
|
@@ -6905,7 +6767,6 @@ var LocaleSchema = /*#__PURE__*/function (_Schema) {
|
|
|
6905
6767
|
_this.isReadonly = isReadonly;
|
|
6906
6768
|
_this.isHidden = isHidden;
|
|
6907
6769
|
_this.description = description;
|
|
6908
|
-
_this.renderInput = renderInput;
|
|
6909
6770
|
_this.previewInput = previewInput;
|
|
6910
6771
|
return _this;
|
|
6911
6772
|
}
|
|
@@ -6929,7 +6790,7 @@ var LocaleSchema = /*#__PURE__*/function (_Schema) {
|
|
|
6929
6790
|
return _createClass(LocaleSchema, [{
|
|
6930
6791
|
key: "describe",
|
|
6931
6792
|
value: function describe(description) {
|
|
6932
|
-
return new LocaleSchema(this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined, this.
|
|
6793
|
+
return new LocaleSchema(this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined, this.previewInput);
|
|
6933
6794
|
}
|
|
6934
6795
|
|
|
6935
6796
|
/**
|
|
@@ -6955,7 +6816,7 @@ var LocaleSchema = /*#__PURE__*/function (_Schema) {
|
|
|
6955
6816
|
}, {
|
|
6956
6817
|
key: "validate",
|
|
6957
6818
|
value: function validate(validationFunction) {
|
|
6958
|
-
return new LocaleSchema(this.opt, this.customValidateFunctions.concat(validationFunction), this.isReadonly, this.isHidden, this.description, this.
|
|
6819
|
+
return new LocaleSchema(this.opt, this.customValidateFunctions.concat(validationFunction), this.isReadonly, this.isHidden, this.description, this.previewInput);
|
|
6959
6820
|
}
|
|
6960
6821
|
}, {
|
|
6961
6822
|
key: "executeValidate",
|
|
@@ -7013,17 +6874,17 @@ var LocaleSchema = /*#__PURE__*/function (_Schema) {
|
|
|
7013
6874
|
// Asserted whole, exactly as `RouteSchema.nullable` does: the source type
|
|
7014
6875
|
// widens by `null` while the caller's validators and preview stay typed
|
|
7015
6876
|
// against the value, and `executeValidate` returns before either sees one.
|
|
7016
|
-
return new LocaleSchema(true, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.
|
|
6877
|
+
return new LocaleSchema(true, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.previewInput);
|
|
7017
6878
|
}
|
|
7018
6879
|
}, {
|
|
7019
6880
|
key: "readonly",
|
|
7020
6881
|
value: function readonly() {
|
|
7021
|
-
return new LocaleSchema(this.opt, this.customValidateFunctions, true, this.isHidden, this.description, this.
|
|
6882
|
+
return new LocaleSchema(this.opt, this.customValidateFunctions, true, this.isHidden, this.description, this.previewInput);
|
|
7022
6883
|
}
|
|
7023
6884
|
}, {
|
|
7024
6885
|
key: "hidden",
|
|
7025
6886
|
value: function hidden() {
|
|
7026
|
-
return new LocaleSchema(this.opt, this.customValidateFunctions, this.isReadonly, true, this.description, this.
|
|
6887
|
+
return new LocaleSchema(this.opt, this.customValidateFunctions, this.isReadonly, true, this.description, this.previewInput);
|
|
7027
6888
|
}
|
|
7028
6889
|
}, {
|
|
7029
6890
|
key: "isLocaleField",
|
|
@@ -7038,20 +6899,6 @@ var LocaleSchema = /*#__PURE__*/function (_Schema) {
|
|
|
7038
6899
|
});
|
|
7039
6900
|
}
|
|
7040
6901
|
|
|
7041
|
-
/**
|
|
7042
|
-
* How this field is laid out where it is the item of an array or a record.
|
|
7043
|
-
* Static configuration, not a callback — see `render.ts`.
|
|
7044
|
-
*
|
|
7045
|
-
* @example
|
|
7046
|
-
* const schema = s.array(s.locale().render({ as: "inline" }));
|
|
7047
|
-
* export default c.define("/example.val.ts", schema, ["nb-NO", "en-US"]);
|
|
7048
|
-
*/
|
|
7049
|
-
}, {
|
|
7050
|
-
key: "render",
|
|
7051
|
-
value: function render(input) {
|
|
7052
|
-
return new LocaleSchema(this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, input, this.previewInput);
|
|
7053
|
-
}
|
|
7054
|
-
|
|
7055
6902
|
/**
|
|
7056
6903
|
* How this VALUE is shown where a preview of it is needed. Never how the field
|
|
7057
6904
|
* itself is edited (that is `render`). See `preview.ts`.
|
|
@@ -7065,7 +6912,7 @@ var LocaleSchema = /*#__PURE__*/function (_Schema) {
|
|
|
7065
6912
|
}, {
|
|
7066
6913
|
key: "preview",
|
|
7067
6914
|
value: function preview(select) {
|
|
7068
|
-
return new LocaleSchema(this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description,
|
|
6915
|
+
return new LocaleSchema(this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, select);
|
|
7069
6916
|
}
|
|
7070
6917
|
}, {
|
|
7071
6918
|
key: "executePreviewItem",
|
|
@@ -7085,10 +6932,9 @@ var LocaleSchema = /*#__PURE__*/function (_Schema) {
|
|
|
7085
6932
|
}, {
|
|
7086
6933
|
key: "executeSerialize",
|
|
7087
6934
|
value: function executeSerialize() {
|
|
7088
|
-
var _this$
|
|
6935
|
+
var _this$customValidateF;
|
|
7089
6936
|
return {
|
|
7090
6937
|
type: "locale",
|
|
7091
|
-
render: (_this$renderInput = this.renderInput) !== null && _this$renderInput !== void 0 ? _this$renderInput : undefined,
|
|
7092
6938
|
preview: this.previewInput ? true : undefined,
|
|
7093
6939
|
opt: this.opt,
|
|
7094
6940
|
customValidate: this.customValidateFunctions && ((_this$customValidateF = this.customValidateFunctions) === null || _this$customValidateF === void 0 ? void 0 : _this$customValidateF.length) > 0,
|
|
@@ -7124,8 +6970,7 @@ var BooleanSchema = /*#__PURE__*/function (_Schema) {
|
|
|
7124
6970
|
var isReadonly = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
7125
6971
|
var isHidden = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
7126
6972
|
var description = arguments.length > 4 ? arguments[4] : undefined;
|
|
7127
|
-
var
|
|
7128
|
-
var previewInput = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null;
|
|
6973
|
+
var previewInput = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : null;
|
|
7129
6974
|
_classCallCheck(this, BooleanSchema);
|
|
7130
6975
|
_this = _callSuper(this, BooleanSchema);
|
|
7131
6976
|
_this.opt = opt;
|
|
@@ -7133,7 +6978,6 @@ var BooleanSchema = /*#__PURE__*/function (_Schema) {
|
|
|
7133
6978
|
_this.isReadonly = isReadonly;
|
|
7134
6979
|
_this.isHidden = isHidden;
|
|
7135
6980
|
_this.description = description;
|
|
7136
|
-
_this.renderInput = renderInput;
|
|
7137
6981
|
_this.previewInput = previewInput;
|
|
7138
6982
|
return _this;
|
|
7139
6983
|
}
|
|
@@ -7159,7 +7003,7 @@ var BooleanSchema = /*#__PURE__*/function (_Schema) {
|
|
|
7159
7003
|
return _createClass(BooleanSchema, [{
|
|
7160
7004
|
key: "describe",
|
|
7161
7005
|
value: function describe(description) {
|
|
7162
|
-
return new BooleanSchema(this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined, this.
|
|
7006
|
+
return new BooleanSchema(this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined, this.previewInput);
|
|
7163
7007
|
}
|
|
7164
7008
|
|
|
7165
7009
|
/**
|
|
@@ -7185,7 +7029,7 @@ var BooleanSchema = /*#__PURE__*/function (_Schema) {
|
|
|
7185
7029
|
}, {
|
|
7186
7030
|
key: "validate",
|
|
7187
7031
|
value: function validate(validationFunction) {
|
|
7188
|
-
return new BooleanSchema(this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.isReadonly, this.isHidden, this.description, this.
|
|
7032
|
+
return new BooleanSchema(this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.isReadonly, this.isHidden, this.description, this.previewInput);
|
|
7189
7033
|
}
|
|
7190
7034
|
}, {
|
|
7191
7035
|
key: "executeValidate",
|
|
@@ -7236,19 +7080,19 @@ var BooleanSchema = /*#__PURE__*/function (_Schema) {
|
|
|
7236
7080
|
}, {
|
|
7237
7081
|
key: "nullable",
|
|
7238
7082
|
value: function nullable() {
|
|
7239
|
-
return new BooleanSchema(true, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.
|
|
7083
|
+
return new BooleanSchema(true, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.previewInput);
|
|
7240
7084
|
}
|
|
7241
7085
|
}, {
|
|
7242
7086
|
key: "readonly",
|
|
7243
7087
|
value: function readonly() {
|
|
7244
7088
|
var isReadonly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
7245
|
-
return new BooleanSchema(this.opt, this.customValidateFunctions, isReadonly, this.isHidden, this.description, this.
|
|
7089
|
+
return new BooleanSchema(this.opt, this.customValidateFunctions, isReadonly, this.isHidden, this.description, this.previewInput);
|
|
7246
7090
|
}
|
|
7247
7091
|
}, {
|
|
7248
7092
|
key: "hidden",
|
|
7249
7093
|
value: function hidden() {
|
|
7250
7094
|
var isHidden = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
7251
|
-
return new BooleanSchema(this.opt, this.customValidateFunctions, this.isReadonly, isHidden, this.description, this.
|
|
7095
|
+
return new BooleanSchema(this.opt, this.customValidateFunctions, this.isReadonly, isHidden, this.description, this.previewInput);
|
|
7252
7096
|
}
|
|
7253
7097
|
}, {
|
|
7254
7098
|
key: "executeCustomValidateAt",
|
|
@@ -7258,23 +7102,6 @@ var BooleanSchema = /*#__PURE__*/function (_Schema) {
|
|
|
7258
7102
|
});
|
|
7259
7103
|
}
|
|
7260
7104
|
|
|
7261
|
-
/**
|
|
7262
|
-
* How this field is laid out in the editor when it is the item of an array
|
|
7263
|
-
* or record: `{ as: "inline" }` renders the field itself inside each row,
|
|
7264
|
-
* instead of a preview row that navigates to it.
|
|
7265
|
-
*
|
|
7266
|
-
* Static configuration, not a callback — see `render.ts`.
|
|
7267
|
-
*
|
|
7268
|
-
* @example
|
|
7269
|
-
* const schema = s.array(s.boolean().render({ as: "inline" }));
|
|
7270
|
-
* export default c.define("/example.val.ts", schema, [true, false]);
|
|
7271
|
-
*/
|
|
7272
|
-
}, {
|
|
7273
|
-
key: "render",
|
|
7274
|
-
value: function render(input) {
|
|
7275
|
-
return new BooleanSchema(this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, input, this.previewInput);
|
|
7276
|
-
}
|
|
7277
|
-
|
|
7278
7105
|
/**
|
|
7279
7106
|
* How this VALUE is shown where a preview of it is needed — a row in a
|
|
7280
7107
|
* sortable list, a reference dropdown, a search hit. Never how the field
|
|
@@ -7289,7 +7116,7 @@ var BooleanSchema = /*#__PURE__*/function (_Schema) {
|
|
|
7289
7116
|
}, {
|
|
7290
7117
|
key: "preview",
|
|
7291
7118
|
value: function preview(select) {
|
|
7292
|
-
return new BooleanSchema(this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description,
|
|
7119
|
+
return new BooleanSchema(this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, select);
|
|
7293
7120
|
}
|
|
7294
7121
|
}, {
|
|
7295
7122
|
key: "executePreviewItem",
|
|
@@ -7309,10 +7136,9 @@ var BooleanSchema = /*#__PURE__*/function (_Schema) {
|
|
|
7309
7136
|
}, {
|
|
7310
7137
|
key: "executeSerialize",
|
|
7311
7138
|
value: function executeSerialize() {
|
|
7312
|
-
var _this$
|
|
7139
|
+
var _this$customValidateF;
|
|
7313
7140
|
return {
|
|
7314
7141
|
type: "boolean",
|
|
7315
|
-
render: (_this$renderInput = this.renderInput) !== null && _this$renderInput !== void 0 ? _this$renderInput : undefined,
|
|
7316
7142
|
preview: this.previewInput ? true : undefined,
|
|
7317
7143
|
opt: this.opt,
|
|
7318
7144
|
customValidate: this.customValidateFunctions && ((_this$customValidateF = this.customValidateFunctions) === null || _this$customValidateF === void 0 ? void 0 : _this$customValidateF.length) > 0,
|
|
@@ -7815,8 +7641,7 @@ var ColorSchema = /*#__PURE__*/function (_Schema) {
|
|
|
7815
7641
|
var isReadonly = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
7816
7642
|
var isHidden = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
7817
7643
|
var description = arguments.length > 5 ? arguments[5] : undefined;
|
|
7818
|
-
var
|
|
7819
|
-
var previewInput = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
|
|
7644
|
+
var previewInput = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null;
|
|
7820
7645
|
_classCallCheck(this, ColorSchema);
|
|
7821
7646
|
_this = _callSuper(this, ColorSchema);
|
|
7822
7647
|
_this.options = options;
|
|
@@ -7825,7 +7650,6 @@ var ColorSchema = /*#__PURE__*/function (_Schema) {
|
|
|
7825
7650
|
_this.isReadonly = isReadonly;
|
|
7826
7651
|
_this.isHidden = isHidden;
|
|
7827
7652
|
_this.description = description;
|
|
7828
|
-
_this.renderInput = renderInput;
|
|
7829
7653
|
_this.previewInput = previewInput;
|
|
7830
7654
|
return _this;
|
|
7831
7655
|
}
|
|
@@ -7855,7 +7679,7 @@ var ColorSchema = /*#__PURE__*/function (_Schema) {
|
|
|
7855
7679
|
return _createClass(ColorSchema, [{
|
|
7856
7680
|
key: "describe",
|
|
7857
7681
|
value: function describe(description) {
|
|
7858
|
-
return new ColorSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined, this.
|
|
7682
|
+
return new ColorSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined, this.previewInput);
|
|
7859
7683
|
}
|
|
7860
7684
|
|
|
7861
7685
|
/**
|
|
@@ -7883,7 +7707,7 @@ var ColorSchema = /*#__PURE__*/function (_Schema) {
|
|
|
7883
7707
|
}, {
|
|
7884
7708
|
key: "validate",
|
|
7885
7709
|
value: function validate(validationFunction) {
|
|
7886
|
-
return new ColorSchema(this.options, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.isReadonly, this.isHidden, this.description, this.
|
|
7710
|
+
return new ColorSchema(this.options, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.isReadonly, this.isHidden, this.description, this.previewInput);
|
|
7887
7711
|
}
|
|
7888
7712
|
}, {
|
|
7889
7713
|
key: "executeCustomValidateAt",
|
|
@@ -7980,38 +7804,19 @@ var ColorSchema = /*#__PURE__*/function (_Schema) {
|
|
|
7980
7804
|
}, {
|
|
7981
7805
|
key: "nullable",
|
|
7982
7806
|
value: function nullable() {
|
|
7983
|
-
return new ColorSchema(this.options, true, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.
|
|
7807
|
+
return new ColorSchema(this.options, true, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.previewInput);
|
|
7984
7808
|
}
|
|
7985
7809
|
}, {
|
|
7986
7810
|
key: "readonly",
|
|
7987
7811
|
value: function readonly() {
|
|
7988
7812
|
var isReadonly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
7989
|
-
return new ColorSchema(this.options, this.opt, this.customValidateFunctions, isReadonly, this.isHidden, this.description, this.
|
|
7813
|
+
return new ColorSchema(this.options, this.opt, this.customValidateFunctions, isReadonly, this.isHidden, this.description, this.previewInput);
|
|
7990
7814
|
}
|
|
7991
7815
|
}, {
|
|
7992
7816
|
key: "hidden",
|
|
7993
7817
|
value: function hidden() {
|
|
7994
7818
|
var isHidden = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
7995
|
-
return new ColorSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, isHidden, this.description, this.
|
|
7996
|
-
}
|
|
7997
|
-
|
|
7998
|
-
/**
|
|
7999
|
-
* How this field is laid out in the editor when it is the item of an array
|
|
8000
|
-
* or record: `{ as: "inline" }` renders the field itself inside each row,
|
|
8001
|
-
* instead of a preview row that navigates to it.
|
|
8002
|
-
*
|
|
8003
|
-
* Static configuration, not a callback — see `render.ts`.
|
|
8004
|
-
*
|
|
8005
|
-
* @example
|
|
8006
|
-
* const schema = s.array(s.color().render({ as: "inline" }));
|
|
8007
|
-
* export default c.define("/example.val.ts", schema, [
|
|
8008
|
-
* "hsl(217.22 91.22% 59.8%)",
|
|
8009
|
-
* ]);
|
|
8010
|
-
*/
|
|
8011
|
-
}, {
|
|
8012
|
-
key: "render",
|
|
8013
|
-
value: function render(input) {
|
|
8014
|
-
return new ColorSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, input, this.previewInput);
|
|
7819
|
+
return new ColorSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, isHidden, this.description, this.previewInput);
|
|
8015
7820
|
}
|
|
8016
7821
|
|
|
8017
7822
|
/**
|
|
@@ -8030,7 +7835,7 @@ var ColorSchema = /*#__PURE__*/function (_Schema) {
|
|
|
8030
7835
|
}, {
|
|
8031
7836
|
key: "preview",
|
|
8032
7837
|
value: function preview(select) {
|
|
8033
|
-
return new ColorSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description,
|
|
7838
|
+
return new ColorSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, select);
|
|
8034
7839
|
}
|
|
8035
7840
|
}, {
|
|
8036
7841
|
key: "executePreviewItem",
|
|
@@ -8050,10 +7855,9 @@ var ColorSchema = /*#__PURE__*/function (_Schema) {
|
|
|
8050
7855
|
}, {
|
|
8051
7856
|
key: "executeSerialize",
|
|
8052
7857
|
value: function executeSerialize() {
|
|
8053
|
-
var _this$
|
|
7858
|
+
var _this$customValidateF;
|
|
8054
7859
|
return {
|
|
8055
7860
|
type: "color",
|
|
8056
|
-
render: (_this$renderInput = this.renderInput) !== null && _this$renderInput !== void 0 ? _this$renderInput : undefined,
|
|
8057
7861
|
preview: this.previewInput ? true : undefined,
|
|
8058
7862
|
opt: this.opt,
|
|
8059
7863
|
options: this.options,
|
|
@@ -8095,8 +7899,7 @@ var EnumSchema = /*#__PURE__*/function (_Schema) {
|
|
|
8095
7899
|
var isReadonly = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
8096
7900
|
var isHidden = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
8097
7901
|
var description = arguments.length > 5 ? arguments[5] : undefined;
|
|
8098
|
-
var
|
|
8099
|
-
var previewInput = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
|
|
7902
|
+
var previewInput = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null;
|
|
8100
7903
|
_classCallCheck(this, EnumSchema);
|
|
8101
7904
|
_this = _callSuper(this, EnumSchema);
|
|
8102
7905
|
_this.values = values;
|
|
@@ -8105,7 +7908,6 @@ var EnumSchema = /*#__PURE__*/function (_Schema) {
|
|
|
8105
7908
|
_this.isReadonly = isReadonly;
|
|
8106
7909
|
_this.isHidden = isHidden;
|
|
8107
7910
|
_this.description = description;
|
|
8108
|
-
_this.renderInput = renderInput;
|
|
8109
7911
|
_this.previewInput = previewInput;
|
|
8110
7912
|
return _this;
|
|
8111
7913
|
}
|
|
@@ -8133,7 +7935,7 @@ var EnumSchema = /*#__PURE__*/function (_Schema) {
|
|
|
8133
7935
|
return _createClass(EnumSchema, [{
|
|
8134
7936
|
key: "describe",
|
|
8135
7937
|
value: function describe(description) {
|
|
8136
|
-
return new EnumSchema(this.values, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined, this.
|
|
7938
|
+
return new EnumSchema(this.values, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined, this.previewInput);
|
|
8137
7939
|
}
|
|
8138
7940
|
|
|
8139
7941
|
/**
|
|
@@ -8158,7 +7960,7 @@ var EnumSchema = /*#__PURE__*/function (_Schema) {
|
|
|
8158
7960
|
}, {
|
|
8159
7961
|
key: "validate",
|
|
8160
7962
|
value: function validate(validationFunction) {
|
|
8161
|
-
return new EnumSchema(this.values, this.opt, this.customValidateFunctions.concat(validationFunction), this.isReadonly, this.isHidden, this.description, this.
|
|
7963
|
+
return new EnumSchema(this.values, this.opt, this.customValidateFunctions.concat(validationFunction), this.isReadonly, this.isHidden, this.description, this.previewInput);
|
|
8162
7964
|
}
|
|
8163
7965
|
}, {
|
|
8164
7966
|
key: "executeValidate",
|
|
@@ -8244,19 +8046,19 @@ var EnumSchema = /*#__PURE__*/function (_Schema) {
|
|
|
8244
8046
|
key: "nullable",
|
|
8245
8047
|
value: function nullable() {
|
|
8246
8048
|
// Explicit type args: `previewInput` would otherwise pin inference to `Src`.
|
|
8247
|
-
return new EnumSchema(this.values, true, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.
|
|
8049
|
+
return new EnumSchema(this.values, true, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.previewInput);
|
|
8248
8050
|
}
|
|
8249
8051
|
}, {
|
|
8250
8052
|
key: "readonly",
|
|
8251
8053
|
value: function readonly() {
|
|
8252
8054
|
var isReadonly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
8253
|
-
return new EnumSchema(this.values, this.opt, this.customValidateFunctions, isReadonly, this.isHidden, this.description, this.
|
|
8055
|
+
return new EnumSchema(this.values, this.opt, this.customValidateFunctions, isReadonly, this.isHidden, this.description, this.previewInput);
|
|
8254
8056
|
}
|
|
8255
8057
|
}, {
|
|
8256
8058
|
key: "hidden",
|
|
8257
8059
|
value: function hidden() {
|
|
8258
8060
|
var isHidden = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
8259
|
-
return new EnumSchema(this.values, this.opt, this.customValidateFunctions, this.isReadonly, isHidden, this.description, this.
|
|
8061
|
+
return new EnumSchema(this.values, this.opt, this.customValidateFunctions, this.isReadonly, isHidden, this.description, this.previewInput);
|
|
8260
8062
|
}
|
|
8261
8063
|
}, {
|
|
8262
8064
|
key: "executeCustomValidateAt",
|
|
@@ -8266,25 +8068,6 @@ var EnumSchema = /*#__PURE__*/function (_Schema) {
|
|
|
8266
8068
|
});
|
|
8267
8069
|
}
|
|
8268
8070
|
|
|
8269
|
-
/**
|
|
8270
|
-
* How this field is laid out in the editor when it is the item of an array
|
|
8271
|
-
* or record: `{ as: "inline" }` renders the field itself inside each row,
|
|
8272
|
-
* instead of a preview row that navigates to it.
|
|
8273
|
-
*
|
|
8274
|
-
* Static configuration, not a callback — see `render.ts`.
|
|
8275
|
-
*
|
|
8276
|
-
* @example
|
|
8277
|
-
* const schema = s.array(
|
|
8278
|
-
* s.enum("draft", "published").render({ as: "inline" }),
|
|
8279
|
-
* );
|
|
8280
|
-
* export default c.define("/example.val.ts", schema, ["draft"]);
|
|
8281
|
-
*/
|
|
8282
|
-
}, {
|
|
8283
|
-
key: "render",
|
|
8284
|
-
value: function render(input) {
|
|
8285
|
-
return new EnumSchema(this.values, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, input, this.previewInput);
|
|
8286
|
-
}
|
|
8287
|
-
|
|
8288
8071
|
/**
|
|
8289
8072
|
* How this VALUE is shown where a preview of it is needed — a row in a
|
|
8290
8073
|
* sortable list, a reference dropdown, a search hit. Never how the field
|
|
@@ -8299,7 +8082,7 @@ var EnumSchema = /*#__PURE__*/function (_Schema) {
|
|
|
8299
8082
|
}, {
|
|
8300
8083
|
key: "preview",
|
|
8301
8084
|
value: function preview(select) {
|
|
8302
|
-
return new EnumSchema(this.values, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description,
|
|
8085
|
+
return new EnumSchema(this.values, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, select);
|
|
8303
8086
|
}
|
|
8304
8087
|
}, {
|
|
8305
8088
|
key: "executePreviewItem",
|
|
@@ -8319,10 +8102,9 @@ var EnumSchema = /*#__PURE__*/function (_Schema) {
|
|
|
8319
8102
|
}, {
|
|
8320
8103
|
key: "executeSerialize",
|
|
8321
8104
|
value: function executeSerialize() {
|
|
8322
|
-
var _this$
|
|
8105
|
+
var _this$customValidateF;
|
|
8323
8106
|
return {
|
|
8324
8107
|
type: "enum",
|
|
8325
|
-
render: (_this$renderInput = this.renderInput) !== null && _this$renderInput !== void 0 ? _this$renderInput : undefined,
|
|
8326
8108
|
preview: this.previewInput ? true : undefined,
|
|
8327
8109
|
values: _toConsumableArray(this.values),
|
|
8328
8110
|
opt: this.opt,
|
|
@@ -8874,7 +8656,6 @@ var ValViewSchema = /*#__PURE__*/function (_Schema) {
|
|
|
8874
8656
|
var isReadonly = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
8875
8657
|
var isHidden = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
8876
8658
|
var description = arguments.length > 4 ? arguments[4] : undefined;
|
|
8877
|
-
var renderInput = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : null;
|
|
8878
8659
|
_classCallCheck(this, ValViewSchema);
|
|
8879
8660
|
_this = _callSuper(this, ValViewSchema);
|
|
8880
8661
|
_this.moduleFilePath = moduleFilePath;
|
|
@@ -8882,7 +8663,6 @@ var ValViewSchema = /*#__PURE__*/function (_Schema) {
|
|
|
8882
8663
|
_this.isReadonly = isReadonly;
|
|
8883
8664
|
_this.isHidden = isHidden;
|
|
8884
8665
|
_this.description = description;
|
|
8885
|
-
_this.renderInput = renderInput;
|
|
8886
8666
|
return _this;
|
|
8887
8667
|
}
|
|
8888
8668
|
|
|
@@ -8908,7 +8688,7 @@ var ValViewSchema = /*#__PURE__*/function (_Schema) {
|
|
|
8908
8688
|
return _createClass(ValViewSchema, [{
|
|
8909
8689
|
key: "describe",
|
|
8910
8690
|
value: function describe(description) {
|
|
8911
|
-
return new ValViewSchema(this.moduleFilePath, this.valModule, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined
|
|
8691
|
+
return new ValViewSchema(this.moduleFilePath, this.valModule, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined);
|
|
8912
8692
|
}
|
|
8913
8693
|
|
|
8914
8694
|
/**
|
|
@@ -9003,7 +8783,7 @@ var ValViewSchema = /*#__PURE__*/function (_Schema) {
|
|
|
9003
8783
|
key: "readonly",
|
|
9004
8784
|
value: function readonly() {
|
|
9005
8785
|
var isReadonly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
9006
|
-
return new ValViewSchema(this.moduleFilePath, this.valModule, isReadonly, this.isHidden, this.description
|
|
8786
|
+
return new ValViewSchema(this.moduleFilePath, this.valModule, isReadonly, this.isHidden, this.description);
|
|
9007
8787
|
}
|
|
9008
8788
|
|
|
9009
8789
|
/**
|
|
@@ -9030,36 +8810,13 @@ var ValViewSchema = /*#__PURE__*/function (_Schema) {
|
|
|
9030
8810
|
key: "hidden",
|
|
9031
8811
|
value: function hidden() {
|
|
9032
8812
|
var isHidden = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
9033
|
-
return new ValViewSchema(this.moduleFilePath, this.valModule, this.isReadonly, isHidden, this.description
|
|
9034
|
-
}
|
|
9035
|
-
|
|
9036
|
-
/**
|
|
9037
|
-
* How this field is laid out in the editor. Static configuration, not a
|
|
9038
|
-
* callback — see `render.ts`.
|
|
9039
|
-
*
|
|
9040
|
-
* @example
|
|
9041
|
-
* import otherVal from "./other.val"; // another module
|
|
9042
|
-
* const schema = s.object({
|
|
9043
|
-
* shared: s.view(otherVal).render({ as: "inline" }),
|
|
9044
|
-
* title: s.string(),
|
|
9045
|
-
* });
|
|
9046
|
-
* export default c.define("/example.val.ts", schema, {
|
|
9047
|
-
* shared: { view: "/other.val.ts" },
|
|
9048
|
-
* title: "Hello",
|
|
9049
|
-
* });
|
|
9050
|
-
*/
|
|
9051
|
-
}, {
|
|
9052
|
-
key: "render",
|
|
9053
|
-
value: function render(input) {
|
|
9054
|
-
return new ValViewSchema(this.moduleFilePath, this.valModule, this.isReadonly, this.isHidden, this.description, input);
|
|
8813
|
+
return new ValViewSchema(this.moduleFilePath, this.valModule, this.isReadonly, isHidden, this.description);
|
|
9055
8814
|
}
|
|
9056
8815
|
}, {
|
|
9057
8816
|
key: "executeSerialize",
|
|
9058
8817
|
value: function executeSerialize() {
|
|
9059
|
-
var _this$renderInput;
|
|
9060
8818
|
return {
|
|
9061
8819
|
type: "view",
|
|
9062
|
-
render: (_this$renderInput = this.renderInput) !== null && _this$renderInput !== void 0 ? _this$renderInput : undefined,
|
|
9063
8820
|
opt: false,
|
|
9064
8821
|
moduleFilePath: this.moduleFilePath,
|
|
9065
8822
|
readonly: this.isReadonly,
|
|
@@ -9737,8 +9494,7 @@ var NumberSchema = /*#__PURE__*/function (_Schema) {
|
|
|
9737
9494
|
var isReadonly = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
9738
9495
|
var isHidden = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
9739
9496
|
var description = arguments.length > 5 ? arguments[5] : undefined;
|
|
9740
|
-
var
|
|
9741
|
-
var previewInput = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
|
|
9497
|
+
var previewInput = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null;
|
|
9742
9498
|
_classCallCheck(this, NumberSchema);
|
|
9743
9499
|
_this = _callSuper(this, NumberSchema);
|
|
9744
9500
|
_this.options = options;
|
|
@@ -9747,7 +9503,6 @@ var NumberSchema = /*#__PURE__*/function (_Schema) {
|
|
|
9747
9503
|
_this.isReadonly = isReadonly;
|
|
9748
9504
|
_this.isHidden = isHidden;
|
|
9749
9505
|
_this.description = description;
|
|
9750
|
-
_this.renderInput = renderInput;
|
|
9751
9506
|
_this.previewInput = previewInput;
|
|
9752
9507
|
return _this;
|
|
9753
9508
|
}
|
|
@@ -9773,7 +9528,7 @@ var NumberSchema = /*#__PURE__*/function (_Schema) {
|
|
|
9773
9528
|
return _createClass(NumberSchema, [{
|
|
9774
9529
|
key: "describe",
|
|
9775
9530
|
value: function describe(description) {
|
|
9776
|
-
return new NumberSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined, this.
|
|
9531
|
+
return new NumberSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined, this.previewInput);
|
|
9777
9532
|
}
|
|
9778
9533
|
|
|
9779
9534
|
/**
|
|
@@ -9799,7 +9554,7 @@ var NumberSchema = /*#__PURE__*/function (_Schema) {
|
|
|
9799
9554
|
}, {
|
|
9800
9555
|
key: "validate",
|
|
9801
9556
|
value: function validate(validationFunction) {
|
|
9802
|
-
return new NumberSchema(this.options, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.isReadonly, this.isHidden, this.description, this.
|
|
9557
|
+
return new NumberSchema(this.options, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.isReadonly, this.isHidden, this.description, this.previewInput);
|
|
9803
9558
|
}
|
|
9804
9559
|
}, {
|
|
9805
9560
|
key: "executeValidate",
|
|
@@ -9869,19 +9624,19 @@ var NumberSchema = /*#__PURE__*/function (_Schema) {
|
|
|
9869
9624
|
}, {
|
|
9870
9625
|
key: "nullable",
|
|
9871
9626
|
value: function nullable() {
|
|
9872
|
-
return new NumberSchema(this.options, true, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.
|
|
9627
|
+
return new NumberSchema(this.options, true, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.previewInput);
|
|
9873
9628
|
}
|
|
9874
9629
|
}, {
|
|
9875
9630
|
key: "readonly",
|
|
9876
9631
|
value: function readonly() {
|
|
9877
9632
|
var isReadonly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
9878
|
-
return new NumberSchema(this.options, this.opt, this.customValidateFunctions, isReadonly, this.isHidden, this.description, this.
|
|
9633
|
+
return new NumberSchema(this.options, this.opt, this.customValidateFunctions, isReadonly, this.isHidden, this.description, this.previewInput);
|
|
9879
9634
|
}
|
|
9880
9635
|
}, {
|
|
9881
9636
|
key: "hidden",
|
|
9882
9637
|
value: function hidden() {
|
|
9883
9638
|
var isHidden = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
9884
|
-
return new NumberSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, isHidden, this.description, this.
|
|
9639
|
+
return new NumberSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, isHidden, this.description, this.previewInput);
|
|
9885
9640
|
}
|
|
9886
9641
|
|
|
9887
9642
|
/**
|
|
@@ -9896,7 +9651,7 @@ var NumberSchema = /*#__PURE__*/function (_Schema) {
|
|
|
9896
9651
|
value: function max(_max) {
|
|
9897
9652
|
return new NumberSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
|
|
9898
9653
|
max: _max
|
|
9899
|
-
}), this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.
|
|
9654
|
+
}), this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.previewInput);
|
|
9900
9655
|
}
|
|
9901
9656
|
|
|
9902
9657
|
/**
|
|
@@ -9911,7 +9666,7 @@ var NumberSchema = /*#__PURE__*/function (_Schema) {
|
|
|
9911
9666
|
value: function min(_min) {
|
|
9912
9667
|
return new NumberSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
|
|
9913
9668
|
min: _min
|
|
9914
|
-
}), this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.
|
|
9669
|
+
}), this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.previewInput);
|
|
9915
9670
|
}
|
|
9916
9671
|
}, {
|
|
9917
9672
|
key: "executeCustomValidateAt",
|
|
@@ -9921,23 +9676,6 @@ var NumberSchema = /*#__PURE__*/function (_Schema) {
|
|
|
9921
9676
|
});
|
|
9922
9677
|
}
|
|
9923
9678
|
|
|
9924
|
-
/**
|
|
9925
|
-
* How this field is laid out in the editor when it is the item of an array
|
|
9926
|
-
* or record: `{ as: "inline" }` renders the field itself inside each row,
|
|
9927
|
-
* instead of a preview row that navigates to it.
|
|
9928
|
-
*
|
|
9929
|
-
* Static configuration, not a callback — see `render.ts`.
|
|
9930
|
-
*
|
|
9931
|
-
* @example
|
|
9932
|
-
* const schema = s.array(s.number().render({ as: "inline" }));
|
|
9933
|
-
* export default c.define("/example.val.ts", schema, [1, 2]);
|
|
9934
|
-
*/
|
|
9935
|
-
}, {
|
|
9936
|
-
key: "render",
|
|
9937
|
-
value: function render(input) {
|
|
9938
|
-
return new NumberSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, input, this.previewInput);
|
|
9939
|
-
}
|
|
9940
|
-
|
|
9941
9679
|
/**
|
|
9942
9680
|
* How this VALUE is shown where a preview of it is needed — a row in a
|
|
9943
9681
|
* sortable list, a reference dropdown, a search hit. Never how the field
|
|
@@ -9952,7 +9690,7 @@ var NumberSchema = /*#__PURE__*/function (_Schema) {
|
|
|
9952
9690
|
}, {
|
|
9953
9691
|
key: "preview",
|
|
9954
9692
|
value: function preview(select) {
|
|
9955
|
-
return new NumberSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description,
|
|
9693
|
+
return new NumberSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, select);
|
|
9956
9694
|
}
|
|
9957
9695
|
}, {
|
|
9958
9696
|
key: "executePreviewItem",
|
|
@@ -9972,10 +9710,9 @@ var NumberSchema = /*#__PURE__*/function (_Schema) {
|
|
|
9972
9710
|
}, {
|
|
9973
9711
|
key: "executeSerialize",
|
|
9974
9712
|
value: function executeSerialize() {
|
|
9975
|
-
var _this$
|
|
9713
|
+
var _this$customValidateF;
|
|
9976
9714
|
return {
|
|
9977
9715
|
type: "number",
|
|
9978
|
-
render: (_this$renderInput = this.renderInput) !== null && _this$renderInput !== void 0 ? _this$renderInput : undefined,
|
|
9979
9716
|
preview: this.previewInput ? true : undefined,
|
|
9980
9717
|
options: this.options,
|
|
9981
9718
|
opt: this.opt,
|
|
@@ -10298,16 +10035,21 @@ var KeyOfSchema = /*#__PURE__*/function (_Schema) {
|
|
|
10298
10035
|
}
|
|
10299
10036
|
|
|
10300
10037
|
/**
|
|
10301
|
-
* How this
|
|
10302
|
-
*
|
|
10303
|
-
*
|
|
10038
|
+
* How this reference is laid out in the editor: `{ as: "inline" }` shows the
|
|
10039
|
+
* selected entry's content below the selector, so it can be read (and
|
|
10040
|
+
* reached) without leaving the field.
|
|
10041
|
+
*
|
|
10042
|
+
* This is about the keyOf field alone. Whether a LIST of references draws
|
|
10043
|
+
* its rows inline is the list's own `.render(...)` — see `render.ts`.
|
|
10304
10044
|
*
|
|
10305
10045
|
* Static configuration, not a callback — see `render.ts`.
|
|
10306
10046
|
*
|
|
10307
10047
|
* @example
|
|
10308
10048
|
* import authorsVal from "./authors.val"; // a record module
|
|
10309
|
-
* const schema = s.
|
|
10310
|
-
*
|
|
10049
|
+
* const schema = s.object({
|
|
10050
|
+
* author: s.keyOf(authorsVal).render({ as: "inline" }),
|
|
10051
|
+
* });
|
|
10052
|
+
* export default c.define("/example.val.ts", schema, { author: "ada" });
|
|
10311
10053
|
*/
|
|
10312
10054
|
}, {
|
|
10313
10055
|
key: "render",
|
|
@@ -10421,8 +10163,7 @@ var FileSchema = /*#__PURE__*/function (_Schema) {
|
|
|
10421
10163
|
var isReadonly = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
|
10422
10164
|
var isHidden = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
|
|
10423
10165
|
var description = arguments.length > 7 ? arguments[7] : undefined;
|
|
10424
|
-
var
|
|
10425
|
-
var previewInput = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : null;
|
|
10166
|
+
var previewInput = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : null;
|
|
10426
10167
|
_classCallCheck(this, FileSchema);
|
|
10427
10168
|
_this = _callSuper(this, FileSchema);
|
|
10428
10169
|
_this.options = options;
|
|
@@ -10433,7 +10174,6 @@ var FileSchema = /*#__PURE__*/function (_Schema) {
|
|
|
10433
10174
|
_this.isReadonly = isReadonly;
|
|
10434
10175
|
_this.isHidden = isHidden;
|
|
10435
10176
|
_this.description = description;
|
|
10436
|
-
_this.renderInput = renderInput;
|
|
10437
10177
|
_this.previewInput = previewInput;
|
|
10438
10178
|
return _this;
|
|
10439
10179
|
}
|
|
@@ -10462,7 +10202,7 @@ var FileSchema = /*#__PURE__*/function (_Schema) {
|
|
|
10462
10202
|
return _createClass(FileSchema, [{
|
|
10463
10203
|
key: "describe",
|
|
10464
10204
|
value: function describe(description) {
|
|
10465
|
-
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.
|
|
10205
|
+
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.previewInput);
|
|
10466
10206
|
}
|
|
10467
10207
|
|
|
10468
10208
|
/**
|
|
@@ -10488,7 +10228,7 @@ var FileSchema = /*#__PURE__*/function (_Schema) {
|
|
|
10488
10228
|
}, {
|
|
10489
10229
|
key: "remote",
|
|
10490
10230
|
value: function remote() {
|
|
10491
|
-
return new FileSchema(this.options, this.opt, true, this.customValidateFunctions, this.moduleMetadata, this.isReadonly, this.isHidden, this.description, this.
|
|
10231
|
+
return new FileSchema(this.options, this.opt, true, this.customValidateFunctions, this.moduleMetadata, this.isReadonly, this.isHidden, this.description, this.previewInput);
|
|
10492
10232
|
}
|
|
10493
10233
|
|
|
10494
10234
|
/**
|
|
@@ -10520,7 +10260,7 @@ var FileSchema = /*#__PURE__*/function (_Schema) {
|
|
|
10520
10260
|
}, {
|
|
10521
10261
|
key: "validate",
|
|
10522
10262
|
value: function validate(validationFunction) {
|
|
10523
|
-
return new FileSchema(this.options, this.opt, this.isRemote, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.moduleMetadata, this.isReadonly, this.isHidden, this.description, this.
|
|
10263
|
+
return new FileSchema(this.options, this.opt, this.isRemote, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.moduleMetadata, this.isReadonly, this.isHidden, this.description, this.previewInput);
|
|
10524
10264
|
}
|
|
10525
10265
|
}, {
|
|
10526
10266
|
key: "executeValidate",
|
|
@@ -10695,19 +10435,19 @@ var FileSchema = /*#__PURE__*/function (_Schema) {
|
|
|
10695
10435
|
}, {
|
|
10696
10436
|
key: "nullable",
|
|
10697
10437
|
value: function nullable() {
|
|
10698
|
-
return new FileSchema(this.options, true, this.isRemote, this.customValidateFunctions, this.moduleMetadata, this.isReadonly, this.isHidden, this.description, this.
|
|
10438
|
+
return new FileSchema(this.options, true, this.isRemote, this.customValidateFunctions, this.moduleMetadata, this.isReadonly, this.isHidden, this.description, this.previewInput);
|
|
10699
10439
|
}
|
|
10700
10440
|
}, {
|
|
10701
10441
|
key: "readonly",
|
|
10702
10442
|
value: function readonly() {
|
|
10703
10443
|
var isReadonly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
10704
|
-
return new FileSchema(this.options, this.opt, this.isRemote, this.customValidateFunctions, this.moduleMetadata, isReadonly, this.isHidden, this.description, this.
|
|
10444
|
+
return new FileSchema(this.options, this.opt, this.isRemote, this.customValidateFunctions, this.moduleMetadata, isReadonly, this.isHidden, this.description, this.previewInput);
|
|
10705
10445
|
}
|
|
10706
10446
|
}, {
|
|
10707
10447
|
key: "hidden",
|
|
10708
10448
|
value: function hidden() {
|
|
10709
10449
|
var isHidden = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
10710
|
-
return new FileSchema(this.options, this.opt, this.isRemote, this.customValidateFunctions, this.moduleMetadata, this.isReadonly, isHidden, this.description, this.
|
|
10450
|
+
return new FileSchema(this.options, this.opt, this.isRemote, this.customValidateFunctions, this.moduleMetadata, this.isReadonly, isHidden, this.description, this.previewInput);
|
|
10711
10451
|
}
|
|
10712
10452
|
}, {
|
|
10713
10453
|
key: "executeCustomValidateAt",
|
|
@@ -10717,25 +10457,6 @@ var FileSchema = /*#__PURE__*/function (_Schema) {
|
|
|
10717
10457
|
});
|
|
10718
10458
|
}
|
|
10719
10459
|
|
|
10720
|
-
/**
|
|
10721
|
-
* How this field is laid out in the editor when it is the item of an array
|
|
10722
|
-
* or record: `{ as: "inline" }` renders the field itself inside each row,
|
|
10723
|
-
* instead of a preview row that navigates to it.
|
|
10724
|
-
*
|
|
10725
|
-
* Static configuration, not a callback — see `render.ts`.
|
|
10726
|
-
*
|
|
10727
|
-
* @example
|
|
10728
|
-
* const schema = s.array(s.file().render({ as: "inline" }));
|
|
10729
|
-
* export default c.define("/example.val.ts", schema, [
|
|
10730
|
-
* { path: "/public/val/example.pdf", mimeType: "application/pdf" },
|
|
10731
|
-
* ]);
|
|
10732
|
-
*/
|
|
10733
|
-
}, {
|
|
10734
|
-
key: "render",
|
|
10735
|
-
value: function render(input) {
|
|
10736
|
-
return new FileSchema(this.options, this.opt, this.isRemote, this.customValidateFunctions, this.moduleMetadata, this.isReadonly, this.isHidden, this.description, input, this.previewInput);
|
|
10737
|
-
}
|
|
10738
|
-
|
|
10739
10460
|
/**
|
|
10740
10461
|
* How this VALUE is shown where a preview of it is needed — a row in a
|
|
10741
10462
|
* sortable list, a reference dropdown, a search hit. Never how the field
|
|
@@ -10752,7 +10473,7 @@ var FileSchema = /*#__PURE__*/function (_Schema) {
|
|
|
10752
10473
|
}, {
|
|
10753
10474
|
key: "preview",
|
|
10754
10475
|
value: function preview(select) {
|
|
10755
|
-
return new FileSchema(this.options, this.opt, this.isRemote, this.customValidateFunctions, this.moduleMetadata, this.isReadonly, this.isHidden, this.description,
|
|
10476
|
+
return new FileSchema(this.options, this.opt, this.isRemote, this.customValidateFunctions, this.moduleMetadata, this.isReadonly, this.isHidden, this.description, select);
|
|
10756
10477
|
}
|
|
10757
10478
|
}, {
|
|
10758
10479
|
key: "executePreviewItem",
|
|
@@ -10772,11 +10493,10 @@ var FileSchema = /*#__PURE__*/function (_Schema) {
|
|
|
10772
10493
|
}, {
|
|
10773
10494
|
key: "executeSerialize",
|
|
10774
10495
|
value: function executeSerialize() {
|
|
10775
|
-
var _this$
|
|
10496
|
+
var _this$customValidateF;
|
|
10776
10497
|
var modulePaths = this.moduleMetadata ? Object.keys(this.moduleMetadata) : [];
|
|
10777
10498
|
return {
|
|
10778
10499
|
type: "file",
|
|
10779
|
-
render: (_this$renderInput = this.renderInput) !== null && _this$renderInput !== void 0 ? _this$renderInput : undefined,
|
|
10780
10500
|
preview: this.previewInput ? true : undefined,
|
|
10781
10501
|
options: this.options,
|
|
10782
10502
|
opt: this.opt,
|
|
@@ -10862,8 +10582,7 @@ var DateSchema = /*#__PURE__*/function (_Schema) {
|
|
|
10862
10582
|
var isReadonly = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
10863
10583
|
var isHidden = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
10864
10584
|
var description = arguments.length > 5 ? arguments[5] : undefined;
|
|
10865
|
-
var
|
|
10866
|
-
var previewInput = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
|
|
10585
|
+
var previewInput = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null;
|
|
10867
10586
|
_classCallCheck(this, DateSchema);
|
|
10868
10587
|
_this = _callSuper(this, DateSchema);
|
|
10869
10588
|
_this.options = options;
|
|
@@ -10872,7 +10591,6 @@ var DateSchema = /*#__PURE__*/function (_Schema) {
|
|
|
10872
10591
|
_this.isReadonly = isReadonly;
|
|
10873
10592
|
_this.isHidden = isHidden;
|
|
10874
10593
|
_this.description = description;
|
|
10875
|
-
_this.renderInput = renderInput;
|
|
10876
10594
|
_this.previewInput = previewInput;
|
|
10877
10595
|
return _this;
|
|
10878
10596
|
}
|
|
@@ -10898,7 +10616,7 @@ var DateSchema = /*#__PURE__*/function (_Schema) {
|
|
|
10898
10616
|
return _createClass(DateSchema, [{
|
|
10899
10617
|
key: "describe",
|
|
10900
10618
|
value: function describe(description) {
|
|
10901
|
-
return new DateSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined, this.
|
|
10619
|
+
return new DateSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined, this.previewInput);
|
|
10902
10620
|
}
|
|
10903
10621
|
|
|
10904
10622
|
/**
|
|
@@ -10924,7 +10642,7 @@ var DateSchema = /*#__PURE__*/function (_Schema) {
|
|
|
10924
10642
|
}, {
|
|
10925
10643
|
key: "validate",
|
|
10926
10644
|
value: function validate(validationFunction) {
|
|
10927
|
-
return new DateSchema(this.options, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.isReadonly, this.isHidden, this.description, this.
|
|
10645
|
+
return new DateSchema(this.options, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.isReadonly, this.isHidden, this.description, this.previewInput);
|
|
10928
10646
|
}
|
|
10929
10647
|
}, {
|
|
10930
10648
|
key: "executeValidate",
|
|
@@ -11047,7 +10765,7 @@ var DateSchema = /*#__PURE__*/function (_Schema) {
|
|
|
11047
10765
|
value: function from(_from) {
|
|
11048
10766
|
return new DateSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
|
|
11049
10767
|
from: _from
|
|
11050
|
-
}), this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.
|
|
10768
|
+
}), this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.previewInput);
|
|
11051
10769
|
}
|
|
11052
10770
|
|
|
11053
10771
|
/**
|
|
@@ -11064,24 +10782,24 @@ var DateSchema = /*#__PURE__*/function (_Schema) {
|
|
|
11064
10782
|
value: function to(_to) {
|
|
11065
10783
|
return new DateSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
|
|
11066
10784
|
to: _to
|
|
11067
|
-
}), this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.
|
|
10785
|
+
}), this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.previewInput);
|
|
11068
10786
|
}
|
|
11069
10787
|
}, {
|
|
11070
10788
|
key: "nullable",
|
|
11071
10789
|
value: function nullable() {
|
|
11072
|
-
return new DateSchema(this.options, true, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.
|
|
10790
|
+
return new DateSchema(this.options, true, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.previewInput);
|
|
11073
10791
|
}
|
|
11074
10792
|
}, {
|
|
11075
10793
|
key: "readonly",
|
|
11076
10794
|
value: function readonly() {
|
|
11077
10795
|
var isReadonly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
11078
|
-
return new DateSchema(this.options, this.opt, this.customValidateFunctions, isReadonly, this.isHidden, this.description, this.
|
|
10796
|
+
return new DateSchema(this.options, this.opt, this.customValidateFunctions, isReadonly, this.isHidden, this.description, this.previewInput);
|
|
11079
10797
|
}
|
|
11080
10798
|
}, {
|
|
11081
10799
|
key: "hidden",
|
|
11082
10800
|
value: function hidden() {
|
|
11083
10801
|
var isHidden = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
11084
|
-
return new DateSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, isHidden, this.description, this.
|
|
10802
|
+
return new DateSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, isHidden, this.description, this.previewInput);
|
|
11085
10803
|
}
|
|
11086
10804
|
}, {
|
|
11087
10805
|
key: "executeCustomValidateAt",
|
|
@@ -11091,23 +10809,6 @@ var DateSchema = /*#__PURE__*/function (_Schema) {
|
|
|
11091
10809
|
});
|
|
11092
10810
|
}
|
|
11093
10811
|
|
|
11094
|
-
/**
|
|
11095
|
-
* How this field is laid out in the editor when it is the item of an array
|
|
11096
|
-
* or record: `{ as: "inline" }` renders the field itself inside each row,
|
|
11097
|
-
* instead of a preview row that navigates to it.
|
|
11098
|
-
*
|
|
11099
|
-
* Static configuration, not a callback — see `render.ts`.
|
|
11100
|
-
*
|
|
11101
|
-
* @example
|
|
11102
|
-
* const schema = s.array(s.date().render({ as: "inline" }));
|
|
11103
|
-
* export default c.define("/example.val.ts", schema, ["2025-06-01"]);
|
|
11104
|
-
*/
|
|
11105
|
-
}, {
|
|
11106
|
-
key: "render",
|
|
11107
|
-
value: function render(input) {
|
|
11108
|
-
return new DateSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, input, this.previewInput);
|
|
11109
|
-
}
|
|
11110
|
-
|
|
11111
10812
|
/**
|
|
11112
10813
|
* How this VALUE is shown where a preview of it is needed — a row in a
|
|
11113
10814
|
* sortable list, a reference dropdown, a search hit. Never how the field
|
|
@@ -11122,7 +10823,7 @@ var DateSchema = /*#__PURE__*/function (_Schema) {
|
|
|
11122
10823
|
}, {
|
|
11123
10824
|
key: "preview",
|
|
11124
10825
|
value: function preview(select) {
|
|
11125
|
-
return new DateSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description,
|
|
10826
|
+
return new DateSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, select);
|
|
11126
10827
|
}
|
|
11127
10828
|
}, {
|
|
11128
10829
|
key: "executePreviewItem",
|
|
@@ -11142,10 +10843,9 @@ var DateSchema = /*#__PURE__*/function (_Schema) {
|
|
|
11142
10843
|
}, {
|
|
11143
10844
|
key: "executeSerialize",
|
|
11144
10845
|
value: function executeSerialize() {
|
|
11145
|
-
var _this$
|
|
10846
|
+
var _this$customValidateF;
|
|
11146
10847
|
return {
|
|
11147
10848
|
type: "date",
|
|
11148
|
-
render: (_this$renderInput = this.renderInput) !== null && _this$renderInput !== void 0 ? _this$renderInput : undefined,
|
|
11149
10849
|
preview: this.previewInput ? true : undefined,
|
|
11150
10850
|
opt: this.opt,
|
|
11151
10851
|
options: this.options,
|
|
@@ -11190,8 +10890,7 @@ var DateTimeSchema = /*#__PURE__*/function (_Schema) {
|
|
|
11190
10890
|
var isReadonly = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
11191
10891
|
var isHidden = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
11192
10892
|
var description = arguments.length > 5 ? arguments[5] : undefined;
|
|
11193
|
-
var
|
|
11194
|
-
var previewInput = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
|
|
10893
|
+
var previewInput = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null;
|
|
11195
10894
|
_classCallCheck(this, DateTimeSchema);
|
|
11196
10895
|
_this = _callSuper(this, DateTimeSchema);
|
|
11197
10896
|
_this.options = options;
|
|
@@ -11200,7 +10899,6 @@ var DateTimeSchema = /*#__PURE__*/function (_Schema) {
|
|
|
11200
10899
|
_this.isReadonly = isReadonly;
|
|
11201
10900
|
_this.isHidden = isHidden;
|
|
11202
10901
|
_this.description = description;
|
|
11203
|
-
_this.renderInput = renderInput;
|
|
11204
10902
|
_this.previewInput = previewInput;
|
|
11205
10903
|
return _this;
|
|
11206
10904
|
}
|
|
@@ -11230,7 +10928,7 @@ var DateTimeSchema = /*#__PURE__*/function (_Schema) {
|
|
|
11230
10928
|
return _createClass(DateTimeSchema, [{
|
|
11231
10929
|
key: "describe",
|
|
11232
10930
|
value: function describe(description) {
|
|
11233
|
-
return new DateTimeSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined, this.
|
|
10931
|
+
return new DateTimeSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined, this.previewInput);
|
|
11234
10932
|
}
|
|
11235
10933
|
|
|
11236
10934
|
/**
|
|
@@ -11260,7 +10958,7 @@ var DateTimeSchema = /*#__PURE__*/function (_Schema) {
|
|
|
11260
10958
|
}, {
|
|
11261
10959
|
key: "validate",
|
|
11262
10960
|
value: function validate(validationFunction) {
|
|
11263
|
-
return new DateTimeSchema(this.options, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.isReadonly, this.isHidden, this.description, this.
|
|
10961
|
+
return new DateTimeSchema(this.options, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.isReadonly, this.isHidden, this.description, this.previewInput);
|
|
11264
10962
|
}
|
|
11265
10963
|
}, {
|
|
11266
10964
|
key: "executeValidate",
|
|
@@ -11395,7 +11093,7 @@ var DateTimeSchema = /*#__PURE__*/function (_Schema) {
|
|
|
11395
11093
|
value: function from(_from) {
|
|
11396
11094
|
return new DateTimeSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
|
|
11397
11095
|
from: _from
|
|
11398
|
-
}), this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.
|
|
11096
|
+
}), this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.previewInput);
|
|
11399
11097
|
}
|
|
11400
11098
|
|
|
11401
11099
|
/**
|
|
@@ -11419,24 +11117,24 @@ var DateTimeSchema = /*#__PURE__*/function (_Schema) {
|
|
|
11419
11117
|
value: function to(_to) {
|
|
11420
11118
|
return new DateTimeSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
|
|
11421
11119
|
to: _to
|
|
11422
|
-
}), this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.
|
|
11120
|
+
}), this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.previewInput);
|
|
11423
11121
|
}
|
|
11424
11122
|
}, {
|
|
11425
11123
|
key: "nullable",
|
|
11426
11124
|
value: function nullable() {
|
|
11427
|
-
return new DateTimeSchema(this.options, true, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.
|
|
11125
|
+
return new DateTimeSchema(this.options, true, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.previewInput);
|
|
11428
11126
|
}
|
|
11429
11127
|
}, {
|
|
11430
11128
|
key: "readonly",
|
|
11431
11129
|
value: function readonly() {
|
|
11432
11130
|
var isReadonly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
11433
|
-
return new DateTimeSchema(this.options, this.opt, this.customValidateFunctions, isReadonly, this.isHidden, this.description, this.
|
|
11131
|
+
return new DateTimeSchema(this.options, this.opt, this.customValidateFunctions, isReadonly, this.isHidden, this.description, this.previewInput);
|
|
11434
11132
|
}
|
|
11435
11133
|
}, {
|
|
11436
11134
|
key: "hidden",
|
|
11437
11135
|
value: function hidden() {
|
|
11438
11136
|
var isHidden = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
11439
|
-
return new DateTimeSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, isHidden, this.description, this.
|
|
11137
|
+
return new DateTimeSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, isHidden, this.description, this.previewInput);
|
|
11440
11138
|
}
|
|
11441
11139
|
}, {
|
|
11442
11140
|
key: "executeCustomValidateAt",
|
|
@@ -11446,25 +11144,6 @@ var DateTimeSchema = /*#__PURE__*/function (_Schema) {
|
|
|
11446
11144
|
});
|
|
11447
11145
|
}
|
|
11448
11146
|
|
|
11449
|
-
/**
|
|
11450
|
-
* How this field is laid out in the editor when it is the item of an array
|
|
11451
|
-
* or record: `{ as: "inline" }` renders the field itself inside each row,
|
|
11452
|
-
* instead of a preview row that navigates to it.
|
|
11453
|
-
*
|
|
11454
|
-
* Static configuration, not a callback — see `render.ts`.
|
|
11455
|
-
*
|
|
11456
|
-
* @example
|
|
11457
|
-
* const schema = s.array(s.datetime().render({ as: "inline" }));
|
|
11458
|
-
* export default c.define("/example.val.ts", schema, [
|
|
11459
|
-
* "2025-06-01T09:00:00.000Z",
|
|
11460
|
-
* ]);
|
|
11461
|
-
*/
|
|
11462
|
-
}, {
|
|
11463
|
-
key: "render",
|
|
11464
|
-
value: function render(input) {
|
|
11465
|
-
return new DateTimeSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, input, this.previewInput);
|
|
11466
|
-
}
|
|
11467
|
-
|
|
11468
11147
|
/**
|
|
11469
11148
|
* How this VALUE is shown where a preview of it is needed — a row in a
|
|
11470
11149
|
* sortable list, a reference dropdown, a search hit. Never how the field
|
|
@@ -11481,7 +11160,7 @@ var DateTimeSchema = /*#__PURE__*/function (_Schema) {
|
|
|
11481
11160
|
}, {
|
|
11482
11161
|
key: "preview",
|
|
11483
11162
|
value: function preview(select) {
|
|
11484
|
-
return new DateTimeSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description,
|
|
11163
|
+
return new DateTimeSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, select);
|
|
11485
11164
|
}
|
|
11486
11165
|
}, {
|
|
11487
11166
|
key: "executePreviewItem",
|
|
@@ -11501,10 +11180,9 @@ var DateTimeSchema = /*#__PURE__*/function (_Schema) {
|
|
|
11501
11180
|
}, {
|
|
11502
11181
|
key: "executeSerialize",
|
|
11503
11182
|
value: function executeSerialize() {
|
|
11504
|
-
var _this$
|
|
11183
|
+
var _this$customValidateF;
|
|
11505
11184
|
return {
|
|
11506
11185
|
type: "dateTime",
|
|
11507
|
-
render: (_this$renderInput = this.renderInput) !== null && _this$renderInput !== void 0 ? _this$renderInput : undefined,
|
|
11508
11186
|
preview: this.previewInput ? true : undefined,
|
|
11509
11187
|
opt: this.opt,
|
|
11510
11188
|
options: this.options,
|
|
@@ -11542,8 +11220,7 @@ var CodeSchema = /*#__PURE__*/function (_Schema) {
|
|
|
11542
11220
|
var isReadonly = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
11543
11221
|
var isHidden = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
11544
11222
|
var description = arguments.length > 5 ? arguments[5] : undefined;
|
|
11545
|
-
var
|
|
11546
|
-
var previewInput = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
|
|
11223
|
+
var previewInput = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null;
|
|
11547
11224
|
_classCallCheck(this, CodeSchema);
|
|
11548
11225
|
_this = _callSuper(this, CodeSchema);
|
|
11549
11226
|
_this.options = options;
|
|
@@ -11552,7 +11229,6 @@ var CodeSchema = /*#__PURE__*/function (_Schema) {
|
|
|
11552
11229
|
_this.isReadonly = isReadonly;
|
|
11553
11230
|
_this.isHidden = isHidden;
|
|
11554
11231
|
_this.description = description;
|
|
11555
|
-
_this.renderInput = renderInput;
|
|
11556
11232
|
_this.previewInput = previewInput;
|
|
11557
11233
|
return _this;
|
|
11558
11234
|
}
|
|
@@ -11584,7 +11260,7 @@ var CodeSchema = /*#__PURE__*/function (_Schema) {
|
|
|
11584
11260
|
return _createClass(CodeSchema, [{
|
|
11585
11261
|
key: "describe",
|
|
11586
11262
|
value: function describe(description) {
|
|
11587
|
-
return new CodeSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined, this.
|
|
11263
|
+
return new CodeSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, description !== null && description !== void 0 ? description : undefined, this.previewInput);
|
|
11588
11264
|
}
|
|
11589
11265
|
|
|
11590
11266
|
/**
|
|
@@ -11615,7 +11291,7 @@ var CodeSchema = /*#__PURE__*/function (_Schema) {
|
|
|
11615
11291
|
}, {
|
|
11616
11292
|
key: "validate",
|
|
11617
11293
|
value: function validate(validationFunction) {
|
|
11618
|
-
return new CodeSchema(this.options, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.isReadonly, this.isHidden, this.description, this.
|
|
11294
|
+
return new CodeSchema(this.options, this.opt, [].concat(_toConsumableArray(this.customValidateFunctions), [validationFunction]), this.isReadonly, this.isHidden, this.description, this.previewInput);
|
|
11619
11295
|
}
|
|
11620
11296
|
}, {
|
|
11621
11297
|
key: "executeCustomValidateAt",
|
|
@@ -11670,40 +11346,19 @@ var CodeSchema = /*#__PURE__*/function (_Schema) {
|
|
|
11670
11346
|
}, {
|
|
11671
11347
|
key: "nullable",
|
|
11672
11348
|
value: function nullable() {
|
|
11673
|
-
return new CodeSchema(this.options, true, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.
|
|
11349
|
+
return new CodeSchema(this.options, true, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, this.previewInput);
|
|
11674
11350
|
}
|
|
11675
11351
|
}, {
|
|
11676
11352
|
key: "readonly",
|
|
11677
11353
|
value: function readonly() {
|
|
11678
11354
|
var isReadonly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
11679
|
-
return new CodeSchema(this.options, this.opt, this.customValidateFunctions, isReadonly, this.isHidden, this.description, this.
|
|
11355
|
+
return new CodeSchema(this.options, this.opt, this.customValidateFunctions, isReadonly, this.isHidden, this.description, this.previewInput);
|
|
11680
11356
|
}
|
|
11681
11357
|
}, {
|
|
11682
11358
|
key: "hidden",
|
|
11683
11359
|
value: function hidden() {
|
|
11684
11360
|
var isHidden = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
11685
|
-
return new CodeSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, isHidden, this.description, this.
|
|
11686
|
-
}
|
|
11687
|
-
|
|
11688
|
-
/**
|
|
11689
|
-
* How this field is laid out in the editor when it is the item of an array
|
|
11690
|
-
* or record: `{ as: "inline" }` renders the field itself inside each row,
|
|
11691
|
-
* instead of a preview row that navigates to it.
|
|
11692
|
-
*
|
|
11693
|
-
* Static configuration, not a callback — see `render.ts`.
|
|
11694
|
-
*
|
|
11695
|
-
* @example
|
|
11696
|
-
* const schema = s.array(
|
|
11697
|
-
* s.code({ language: "css" }).render({ as: "inline" }),
|
|
11698
|
-
* );
|
|
11699
|
-
* export default c.define("/example.val.ts", schema, [
|
|
11700
|
-
* ".hero { color: red; }",
|
|
11701
|
-
* ]);
|
|
11702
|
-
*/
|
|
11703
|
-
}, {
|
|
11704
|
-
key: "render",
|
|
11705
|
-
value: function render(input) {
|
|
11706
|
-
return new CodeSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, input, this.previewInput);
|
|
11361
|
+
return new CodeSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, isHidden, this.description, this.previewInput);
|
|
11707
11362
|
}
|
|
11708
11363
|
|
|
11709
11364
|
/**
|
|
@@ -11724,7 +11379,7 @@ var CodeSchema = /*#__PURE__*/function (_Schema) {
|
|
|
11724
11379
|
}, {
|
|
11725
11380
|
key: "preview",
|
|
11726
11381
|
value: function preview(select) {
|
|
11727
|
-
return new CodeSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description,
|
|
11382
|
+
return new CodeSchema(this.options, this.opt, this.customValidateFunctions, this.isReadonly, this.isHidden, this.description, select);
|
|
11728
11383
|
}
|
|
11729
11384
|
}, {
|
|
11730
11385
|
key: "executePreviewItem",
|
|
@@ -11744,10 +11399,9 @@ var CodeSchema = /*#__PURE__*/function (_Schema) {
|
|
|
11744
11399
|
}, {
|
|
11745
11400
|
key: "executeSerialize",
|
|
11746
11401
|
value: function executeSerialize() {
|
|
11747
|
-
var _this$
|
|
11402
|
+
var _this$customValidateF;
|
|
11748
11403
|
return {
|
|
11749
11404
|
type: "code",
|
|
11750
|
-
render: (_this$renderInput = this.renderInput) !== null && _this$renderInput !== void 0 ? _this$renderInput : undefined,
|
|
11751
11405
|
preview: this.previewInput ? true : undefined,
|
|
11752
11406
|
options: this.options,
|
|
11753
11407
|
opt: this.opt,
|
|
@@ -12703,6 +12357,43 @@ function computeSourcesSha(entries) {
|
|
|
12703
12357
|
}
|
|
12704
12358
|
return sourcesSha;
|
|
12705
12359
|
}
|
|
12360
|
+
|
|
12361
|
+
/**
|
|
12362
|
+
* The `schemaSha` fold on its own: path and serialized schema, in `val.modules`
|
|
12363
|
+
* order.
|
|
12364
|
+
*
|
|
12365
|
+
* Separate for the same reason as {@link computeSourcesSha}: the Studio folds
|
|
12366
|
+
* the schemas of the bundle it is running and compares the answer with the
|
|
12367
|
+
* `schemaSha` on `/stat`, which is how it learns that a new schema has been
|
|
12368
|
+
* deployed under it. One implementation, so that comparison is between two
|
|
12369
|
+
* runs of the same code.
|
|
12370
|
+
*/
|
|
12371
|
+
function computeSchemaSha(entries) {
|
|
12372
|
+
var schemaSha = "";
|
|
12373
|
+
var _iterator2 = _createForOfIteratorHelper(entries),
|
|
12374
|
+
_step2;
|
|
12375
|
+
try {
|
|
12376
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
12377
|
+
var _step2$value = _step2.value,
|
|
12378
|
+
path = _step2$value.path,
|
|
12379
|
+
serializedSchema = _step2$value.serializedSchema;
|
|
12380
|
+
// The PATH is part of the schema set, not just the schema: renaming a
|
|
12381
|
+
// module while leaving its schema byte-identical still changes which paths
|
|
12382
|
+
// exist, and an open client keyed its schema cache by the old path. Hashing
|
|
12383
|
+
// the schema alone left this SHA unchanged, so with no commitSha to fall
|
|
12384
|
+
// back on the client never refetched /schema.
|
|
12385
|
+
schemaSha = hash(schemaSha + JSON.stringify({
|
|
12386
|
+
path: path,
|
|
12387
|
+
schema: serializedSchema
|
|
12388
|
+
}));
|
|
12389
|
+
}
|
|
12390
|
+
} catch (err) {
|
|
12391
|
+
_iterator2.e(err);
|
|
12392
|
+
} finally {
|
|
12393
|
+
_iterator2.f();
|
|
12394
|
+
}
|
|
12395
|
+
return schemaSha;
|
|
12396
|
+
}
|
|
12706
12397
|
function computeValModuleShas(config, entries, moduleErrors) {
|
|
12707
12398
|
var configSha = hash(JSON.stringify(config));
|
|
12708
12399
|
var sourcesSha = computeSourcesSha(entries);
|
|
@@ -12715,12 +12406,12 @@ function computeValModuleShas(config, entries, moduleErrors) {
|
|
|
12715
12406
|
// `gitCommit: process.env.VERCEL_GIT_COMMIT_SHA` / `gitBranch`, which are
|
|
12716
12407
|
// server-only env vars and therefore `undefined` in the browser. Seeding with
|
|
12717
12408
|
// them made the two sides disagree on every production load.
|
|
12718
|
-
var schemaSha =
|
|
12719
|
-
var
|
|
12720
|
-
|
|
12409
|
+
var schemaSha = computeSchemaSha(entries);
|
|
12410
|
+
var _iterator3 = _createForOfIteratorHelper(entries),
|
|
12411
|
+
_step3;
|
|
12721
12412
|
try {
|
|
12722
|
-
for (
|
|
12723
|
-
var entry =
|
|
12413
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
12414
|
+
var entry = _step3.value;
|
|
12724
12415
|
var path = entry.path,
|
|
12725
12416
|
source = entry.source,
|
|
12726
12417
|
serializedSchema = entry.serializedSchema;
|
|
@@ -12730,20 +12421,11 @@ function computeValModuleShas(config, entries, moduleErrors) {
|
|
|
12730
12421
|
source: source,
|
|
12731
12422
|
modulesErrors: moduleErrors.slice(0, entry.moduleErrorsAt)
|
|
12732
12423
|
}));
|
|
12733
|
-
// The PATH is part of the schema set, not just the schema: renaming a
|
|
12734
|
-
// module while leaving its schema byte-identical still changes which paths
|
|
12735
|
-
// exist, and an open client keyed its schema cache by the old path. Hashing
|
|
12736
|
-
// the schema alone left this SHA unchanged, so with no commitSha to fall
|
|
12737
|
-
// back on the client never refetched /schema.
|
|
12738
|
-
schemaSha = hash(schemaSha + JSON.stringify({
|
|
12739
|
-
path: path,
|
|
12740
|
-
schema: serializedSchema
|
|
12741
|
-
}));
|
|
12742
12424
|
}
|
|
12743
12425
|
} catch (err) {
|
|
12744
|
-
|
|
12426
|
+
_iterator3.e(err);
|
|
12745
12427
|
} finally {
|
|
12746
|
-
|
|
12428
|
+
_iterator3.f();
|
|
12747
12429
|
}
|
|
12748
12430
|
return {
|
|
12749
12431
|
baseSha: baseSha,
|
|
@@ -12765,7 +12447,7 @@ function extractValModules(_x) {
|
|
|
12765
12447
|
}
|
|
12766
12448
|
function _extractValModules() {
|
|
12767
12449
|
_extractValModules = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(valModules) {
|
|
12768
|
-
var moduleErrors, addModuleError, sources, schemas, serializedSchemas, shaEntries, moduleIdx, module, at, value, path, schema, source, serializedSchema, pathM,
|
|
12450
|
+
var moduleErrors, addModuleError, sources, schemas, serializedSchemas, shaEntries, moduleIdx, module, at, value, path, schema, source, serializedSchema, pathM, _iterator4, _step4, error, _iterator5, _step5, _error, _t, _t2;
|
|
12769
12451
|
return _regenerator().w(function (_context) {
|
|
12770
12452
|
while (1) switch (_context.p = _context.n) {
|
|
12771
12453
|
case 0:
|
|
@@ -12912,10 +12594,10 @@ function _extractValModules() {
|
|
|
12912
12594
|
// Appended AFTER the loop on purpose: each entry's `moduleErrorsAt` is the
|
|
12913
12595
|
// error count at the time it was folded in, so the SHAs stay a function of
|
|
12914
12596
|
// the modules themselves.
|
|
12915
|
-
|
|
12597
|
+
_iterator4 = _createForOfIteratorHelper(resolveSettingsModule(serializedSchemas).errors);
|
|
12916
12598
|
try {
|
|
12917
|
-
for (
|
|
12918
|
-
error =
|
|
12599
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
12600
|
+
error = _step4.value;
|
|
12919
12601
|
moduleErrors.push(error);
|
|
12920
12602
|
}
|
|
12921
12603
|
// Same kind of rule, same reason it is here: a view cycle is a property of the
|
|
@@ -12923,20 +12605,20 @@ function _extractValModules() {
|
|
|
12923
12605
|
// catches it either — a view stores a pointer, not content, so there is no
|
|
12924
12606
|
// data cycle for a source walk to trip over.
|
|
12925
12607
|
} catch (err) {
|
|
12926
|
-
|
|
12608
|
+
_iterator4.e(err);
|
|
12927
12609
|
} finally {
|
|
12928
|
-
|
|
12610
|
+
_iterator4.f();
|
|
12929
12611
|
}
|
|
12930
|
-
|
|
12612
|
+
_iterator5 = _createForOfIteratorHelper(viewCycleErrors(serializedSchemas));
|
|
12931
12613
|
try {
|
|
12932
|
-
for (
|
|
12933
|
-
_error =
|
|
12614
|
+
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
12615
|
+
_error = _step5.value;
|
|
12934
12616
|
moduleErrors.push(_error);
|
|
12935
12617
|
}
|
|
12936
12618
|
} catch (err) {
|
|
12937
|
-
|
|
12619
|
+
_iterator5.e(err);
|
|
12938
12620
|
} finally {
|
|
12939
|
-
|
|
12621
|
+
_iterator5.f();
|
|
12940
12622
|
}
|
|
12941
12623
|
return _context.a(2, _objectSpread2(_objectSpread2({
|
|
12942
12624
|
sources: sources,
|
|
@@ -13655,29 +13337,26 @@ function deserializeSchema(serialized) {
|
|
|
13655
13337
|
return schema;
|
|
13656
13338
|
}
|
|
13657
13339
|
function deserializeSchemaImpl(serialized) {
|
|
13658
|
-
var _serialized$options, _serialized$options2, _serialized$
|
|
13340
|
+
var _serialized$options, _serialized$options2, _serialized$multiline, _serialized$render, _serialized$accept, _serialized$dir, _serialized$remote, _serialized$jsonValue, _serialized$render2, _serialized$external, _serialized$render3, _serialized$readonly, _serialized$hidden;
|
|
13659
13341
|
switch (serialized.type) {
|
|
13660
13342
|
case "string":
|
|
13661
13343
|
return new StringSchema(_objectSpread2(_objectSpread2({}, serialized.options), {}, {
|
|
13662
13344
|
regexp: ((_serialized$options = serialized.options) === null || _serialized$options === void 0 ? void 0 : _serialized$options.regexp) && new RegExp(serialized.options.regexp.source, serialized.options.regexp.flags),
|
|
13663
13345
|
regExpMessage: (_serialized$options2 = serialized.options) === null || _serialized$options2 === void 0 || (_serialized$options2 = _serialized$options2.regexp) === null || _serialized$options2 === void 0 ? void 0 : _serialized$options2.message
|
|
13664
|
-
}), serialized.opt, serialized.raw, [],
|
|
13665
|
-
// carried back: it is the schema's own configuration now, not something
|
|
13666
|
-
// recomputed from an instance.
|
|
13667
|
-
(_serialized$render = serialized.render) !== null && _serialized$render !== void 0 ? _serialized$render : null, false, false, serialized.description, null, (_serialized$multiline = serialized.multiline) !== null && _serialized$multiline !== void 0 ? _serialized$multiline : false);
|
|
13346
|
+
}), serialized.opt, serialized.raw, [], false, false, serialized.description, null, (_serialized$multiline = serialized.multiline) !== null && _serialized$multiline !== void 0 ? _serialized$multiline : false);
|
|
13668
13347
|
case "literal":
|
|
13669
|
-
return new LiteralSchema(serialized.value, serialized.opt, [], false, false, serialized.description
|
|
13348
|
+
return new LiteralSchema(serialized.value, serialized.opt, [], false, false, serialized.description);
|
|
13670
13349
|
case "boolean":
|
|
13671
|
-
return new BooleanSchema(serialized.opt, [], false, false, serialized.description
|
|
13350
|
+
return new BooleanSchema(serialized.opt, [], false, false, serialized.description);
|
|
13672
13351
|
case "number":
|
|
13673
|
-
return new NumberSchema(serialized.options, serialized.opt, [], false, false, serialized.description
|
|
13352
|
+
return new NumberSchema(serialized.options, serialized.opt, [], false, false, serialized.description);
|
|
13674
13353
|
case "object":
|
|
13675
13354
|
return new ObjectSchema(Object.fromEntries(Object.entries(serialized.items).map(function (_ref) {
|
|
13676
13355
|
var _ref2 = _slicedToArray(_ref, 2),
|
|
13677
13356
|
key = _ref2[0],
|
|
13678
13357
|
item = _ref2[1];
|
|
13679
13358
|
return [key, deserializeSchema(item)];
|
|
13680
|
-
})), serialized.opt, [], false, false, serialized.description
|
|
13359
|
+
})), serialized.opt, [], false, false, serialized.description);
|
|
13681
13360
|
case "settings":
|
|
13682
13361
|
return new SettingsSchema(Object.fromEntries(Object.entries(serialized.items).map(function (_ref3) {
|
|
13683
13362
|
var _ref4 = _slicedToArray(_ref3, 2),
|
|
@@ -13693,23 +13372,23 @@ function deserializeSchemaImpl(serialized) {
|
|
|
13693
13372
|
case "array":
|
|
13694
13373
|
return new ArraySchema(deserializeSchema(serialized.item), serialized.opt, [], false, false, serialized.description,
|
|
13695
13374
|
// The preview closure cannot survive serialization; the render can.
|
|
13696
|
-
null, (_serialized$
|
|
13375
|
+
null, (_serialized$render = serialized.render) !== null && _serialized$render !== void 0 ? _serialized$render : null);
|
|
13697
13376
|
case "discriminated-union":
|
|
13698
13377
|
return new DiscriminatedUnionSchema(serialized.key,
|
|
13699
13378
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
13700
13379
|
serialized.items.map(deserializeSchema),
|
|
13701
13380
|
// TODO: we do not really need any here - right?
|
|
13702
|
-
serialized.opt, [], false, false, serialized.description
|
|
13381
|
+
serialized.opt, [], false, false, serialized.description);
|
|
13703
13382
|
case "enum":
|
|
13704
|
-
return new EnumSchema(serialized.values, serialized.opt, [], false, false, serialized.description
|
|
13383
|
+
return new EnumSchema(serialized.values, serialized.opt, [], false, false, serialized.description);
|
|
13705
13384
|
case "richtext":
|
|
13706
13385
|
{
|
|
13707
|
-
var _serialized$options3, _serialized$options4, _serialized$options5, _serialized$options6
|
|
13386
|
+
var _serialized$options3, _serialized$options4, _serialized$options5, _serialized$options6;
|
|
13708
13387
|
var deserializedOptions = _objectSpread2(_objectSpread2({}, serialized.options || {}), {}, {
|
|
13709
13388
|
a: _typeof((_serialized$options3 = serialized.options) === null || _serialized$options3 === void 0 ? void 0 : _serialized$options3.a) === "object" ? deserializeSchema(serialized.options.a) : (_serialized$options4 = serialized.options) === null || _serialized$options4 === void 0 ? void 0 : _serialized$options4.a,
|
|
13710
13389
|
img: _typeof((_serialized$options5 = serialized.options) === null || _serialized$options5 === void 0 ? void 0 : _serialized$options5.img) === "object" ? deserializeSchema(serialized.options.img) : (_serialized$options6 = serialized.options) === null || _serialized$options6 === void 0 ? void 0 : _serialized$options6.img
|
|
13711
13390
|
});
|
|
13712
|
-
return new RichTextSchema(deserializedOptions, serialized.opt, [], false, false, serialized.description
|
|
13391
|
+
return new RichTextSchema(deserializedOptions, serialized.opt, [], false, false, serialized.description);
|
|
13713
13392
|
}
|
|
13714
13393
|
case "record":
|
|
13715
13394
|
return new RecordSchema(deserializeSchema(serialized.item), serialized.opt, [], null, serialized.key ? deserializeSchema(serialized.key) : null, serialized.mediaType ? {
|
|
@@ -13720,43 +13399,41 @@ function deserializeSchemaImpl(serialized) {
|
|
|
13720
13399
|
altSchema: serialized.alt ? deserializeSchema(serialized.alt) : undefined
|
|
13721
13400
|
} : undefined, false, false, serialized.description, (_serialized$jsonValue = serialized.jsonValues) !== null && _serialized$jsonValue !== void 0 ? _serialized$jsonValue : false,
|
|
13722
13401
|
// The preview closure cannot survive serialization; the render can.
|
|
13723
|
-
null, (_serialized$
|
|
13402
|
+
null, (_serialized$render2 = serialized.render) !== null && _serialized$render2 !== void 0 ? _serialized$render2 : null, // The external label is static data, so it survives serialization and
|
|
13724
13403
|
// must be carried back: a deserialized schema that forgot it would walk
|
|
13725
13404
|
// an external record as if its entries were local.
|
|
13726
13405
|
(_serialized$external = serialized.external) !== null && _serialized$external !== void 0 ? _serialized$external : null);
|
|
13727
13406
|
case "keyOf":
|
|
13728
|
-
return new KeyOfSchema(serialized.schema, serialized.path, serialized.opt, [], false, false, serialized.description, (_serialized$
|
|
13407
|
+
return new KeyOfSchema(serialized.schema, serialized.path, serialized.opt, [], false, false, serialized.description, (_serialized$render3 = serialized.render) !== null && _serialized$render3 !== void 0 ? _serialized$render3 : null);
|
|
13729
13408
|
case "locale":
|
|
13730
13409
|
{
|
|
13731
|
-
|
|
13732
|
-
return new LocaleSchema(serialized.opt, [], false, false, serialized.description, (_serialized$render10 = serialized.render) !== null && _serialized$render10 !== void 0 ? _serialized$render10 : null);
|
|
13410
|
+
return new LocaleSchema(serialized.opt, [], false, false, serialized.description);
|
|
13733
13411
|
}
|
|
13734
13412
|
case "route":
|
|
13735
13413
|
{
|
|
13736
|
-
var _serialized$render11;
|
|
13737
13414
|
var routeOptions = serialized.options ? {
|
|
13738
13415
|
include: serialized.options.include ? new RegExp(serialized.options.include.source, serialized.options.include.flags) : undefined,
|
|
13739
13416
|
exclude: serialized.options.exclude ? new RegExp(serialized.options.exclude.source, serialized.options.exclude.flags) : undefined
|
|
13740
13417
|
} : undefined;
|
|
13741
|
-
return new RouteSchema(routeOptions, serialized.opt, [], false, false, serialized.description
|
|
13418
|
+
return new RouteSchema(routeOptions, serialized.opt, [], false, false, serialized.description);
|
|
13742
13419
|
}
|
|
13743
13420
|
case "file":
|
|
13744
|
-
return new FileSchema(serialized.options, serialized.opt, serialized.remote, [], {}, false, false, serialized.description
|
|
13421
|
+
return new FileSchema(serialized.options, serialized.opt, serialized.remote, [], {}, false, false, serialized.description);
|
|
13745
13422
|
case "image":
|
|
13746
|
-
return new ImageSchema(serialized.options, serialized.opt, serialized.remote, [], {}, false, false, serialized.description
|
|
13423
|
+
return new ImageSchema(serialized.options, serialized.opt, serialized.remote, [], {}, false, false, serialized.description);
|
|
13747
13424
|
case "date":
|
|
13748
|
-
return new DateSchema(serialized.options, serialized.opt, [], false, false, serialized.description
|
|
13425
|
+
return new DateSchema(serialized.options, serialized.opt, [], false, false, serialized.description);
|
|
13749
13426
|
case "dateTime":
|
|
13750
|
-
return new DateTimeSchema(serialized.options, serialized.opt, [], false, false, serialized.description
|
|
13427
|
+
return new DateTimeSchema(serialized.options, serialized.opt, [], false, false, serialized.description);
|
|
13751
13428
|
case "color":
|
|
13752
|
-
return new ColorSchema(serialized.options, serialized.opt, [], false, false, serialized.description
|
|
13429
|
+
return new ColorSchema(serialized.options, serialized.opt, [], false, false, serialized.description);
|
|
13753
13430
|
case "code":
|
|
13754
|
-
return new CodeSchema(serialized.options, serialized.opt, [], false, false, serialized.description
|
|
13431
|
+
return new CodeSchema(serialized.options, serialized.opt, [], false, false, serialized.description);
|
|
13755
13432
|
case "view":
|
|
13756
13433
|
return new ValViewSchema(serialized.moduleFilePath,
|
|
13757
13434
|
// No module: this schema came off the wire. The Studio navigates to a
|
|
13758
13435
|
// view rather than resolving one, so nothing here needs it.
|
|
13759
|
-
undefined, (_serialized$readonly = serialized.readonly) !== null && _serialized$readonly !== void 0 ? _serialized$readonly : false, (_serialized$hidden = serialized.hidden) !== null && _serialized$hidden !== void 0 ? _serialized$hidden : false, serialized.description
|
|
13436
|
+
undefined, (_serialized$readonly = serialized.readonly) !== null && _serialized$readonly !== void 0 ? _serialized$readonly : false, (_serialized$hidden = serialized.hidden) !== null && _serialized$hidden !== void 0 ? _serialized$hidden : false, serialized.description);
|
|
13760
13437
|
default:
|
|
13761
13438
|
{
|
|
13762
13439
|
var exhaustiveCheck = serialized;
|
|
@@ -13797,9 +13474,19 @@ function deserializeSchemaImpl(serialized) {
|
|
|
13797
13474
|
* description still previews as `#3` until someone writes the preview.
|
|
13798
13475
|
*/
|
|
13799
13476
|
/**
|
|
13800
|
-
* A RENDER is how
|
|
13801
|
-
*
|
|
13802
|
-
* array
|
|
13477
|
+
* A RENDER is how a field is laid out in the editor, and it applies only when
|
|
13478
|
+
* you are looking at the field. It is declared by a CONTAINER about its
|
|
13479
|
+
* children, never by a child about itself: `s.array(item).render({ as: "inline" })`
|
|
13480
|
+
* and `s.record(item).render({ as: "inline" })`. The one other schema that takes
|
|
13481
|
+
* a render is `s.keyOf(...)`, where it means something of its own (see
|
|
13482
|
+
* `KeyOfSchema.render`).
|
|
13483
|
+
*
|
|
13484
|
+
* Why the container: inline is a property of the LIST — "my items are edited in
|
|
13485
|
+
* their rows" — and the item schema is the wrong place to say it. An item can be
|
|
13486
|
+
* reused in a list that wants preview rows and one that wants forms; a tagged
|
|
13487
|
+
* union had to be declared inline on every variant (or on any one of them,
|
|
13488
|
+
* which was worse); and a schema that was not an item carried a setting that
|
|
13489
|
+
* did nothing. Putting it on the container makes all three go away.
|
|
13803
13490
|
*
|
|
13804
13491
|
* It is deliberately the ONE thing a render can say. What a string looks like
|
|
13805
13492
|
* when it holds more than a line is the schema's own business — `.multiline()`
|
|
@@ -13816,7 +13503,7 @@ function deserializeSchemaImpl(serialized) {
|
|
|
13816
13503
|
*
|
|
13817
13504
|
* A render is static configuration - plain data, with no closure behind it and
|
|
13818
13505
|
* no dependency on source - which is why it lives in the SERIALIZED schema
|
|
13819
|
-
* (`
|
|
13506
|
+
* (`SerializedArraySchema.render`) and is read straight off it where the field
|
|
13820
13507
|
* is drawn. There is no render pipeline, no store and no host round-trip.
|
|
13821
13508
|
*
|
|
13822
13509
|
* That "static" is an ASSUMPTION we are taking deliberately, for simplicity,
|
|
@@ -13827,61 +13514,48 @@ function deserializeSchemaImpl(serialized) {
|
|
|
13827
13514
|
* conflating them is what this file was split up to undo.
|
|
13828
13515
|
*/
|
|
13829
13516
|
/**
|
|
13830
|
-
* `{ as: "inline" }` on
|
|
13831
|
-
*
|
|
13832
|
-
*
|
|
13833
|
-
*
|
|
13517
|
+
* `{ as: "inline" }` on an array or record: the container renders each of its
|
|
13518
|
+
* DIRECT items' own editor inside its (sortable) row, instead of a clickable
|
|
13519
|
+
* preview row that navigates to it. This is what a page-builder list is made
|
|
13520
|
+
* of: `s.array(s.discriminatedUnion("type", hero, text)).render({ as: "inline" })`.
|
|
13521
|
+
*
|
|
13522
|
+
* It reaches one level down and no further: in
|
|
13523
|
+
* `s.array(s.object({ tags: s.array(s.string()) })).render({ as: "inline" })`
|
|
13524
|
+
* the objects are inline and `tags` keeps its own default.
|
|
13834
13525
|
*
|
|
13835
|
-
*
|
|
13836
|
-
*
|
|
13526
|
+
* Not available on `s.router(...)`, `s.imageset(...)` or `s.fileset(...)`:
|
|
13527
|
+
* pages and media have UIs of their own, and `RecordSchema.render` throws there.
|
|
13837
13528
|
*
|
|
13838
|
-
*
|
|
13839
|
-
*
|
|
13840
|
-
*
|
|
13529
|
+
* On `s.keyOf(...)` the same value means something else: the selected entry's
|
|
13530
|
+
* content is shown below the selector. That is the keyOf field's own layout,
|
|
13531
|
+
* and is not read by any list.
|
|
13841
13532
|
*/
|
|
13842
13533
|
|
|
13843
13534
|
/**
|
|
13844
|
-
* What `.render(...)` takes
|
|
13845
|
-
* carries verbatim.
|
|
13535
|
+
* What `.render(...)` takes, and what the serialized schema carries verbatim.
|
|
13846
13536
|
*/
|
|
13847
13537
|
|
|
13848
13538
|
/**
|
|
13849
|
-
*
|
|
13850
|
-
* clickable preview
|
|
13539
|
+
* Does this CONTAINER edit its items inside their list rows, rather than behind
|
|
13540
|
+
* clickable preview rows that navigate to them?
|
|
13541
|
+
*
|
|
13542
|
+
* Pass the array or record — never the item. Anything else answers `false`,
|
|
13543
|
+
* `s.keyOf` included: its render is about the keyOf field, not about a list.
|
|
13851
13544
|
*
|
|
13852
13545
|
* The one answer, so that the list rows, the nav-stop rule (`getNavPath`) and
|
|
13853
13546
|
* the add buttons cannot drift apart — they are three readings of the same
|
|
13854
13547
|
* question, and a disagreement between them is a row you can edit in place but
|
|
13855
13548
|
* that "add" navigates away from.
|
|
13856
13549
|
*
|
|
13857
|
-
*
|
|
13858
|
-
*
|
|
13859
|
-
|
|
13860
|
-
|
|
13861
|
-
|
|
13862
|
-
|
|
13863
|
-
|
|
13864
|
-
* fields), which handles every variant either way: with `every`, adding one
|
|
13865
|
-
* variant and forgetting its `.render` would silently turn the whole list back
|
|
13866
|
-
* into preview rows.
|
|
13867
|
-
*
|
|
13868
|
-
* This is the ONLY place a render is allowed to be read from anywhere but the
|
|
13869
|
-
* schema it was declared on. It stays static (see the top of this file): the
|
|
13870
|
-
* answer is a function of the serialized schema alone, never of the value the
|
|
13871
|
-
* row happens to hold.
|
|
13872
|
-
*/
|
|
13873
|
-
function isInlineRender(schema) {
|
|
13874
|
-
var _schema$render;
|
|
13875
|
-
if (((_schema$render = schema.render) === null || _schema$render === void 0 ? void 0 : _schema$render.as) === "inline") {
|
|
13876
|
-
return true;
|
|
13877
|
-
}
|
|
13878
|
-
if (schema.type === "discriminated-union") {
|
|
13879
|
-
return schema.items.some(function (item) {
|
|
13880
|
-
var _item$render;
|
|
13881
|
-
return ((_item$render = item.render) === null || _item$render === void 0 ? void 0 : _item$render.as) === "inline";
|
|
13882
|
-
});
|
|
13550
|
+
* It stays static (see the top of this file): the answer is a function of the
|
|
13551
|
+
* serialized schema alone, never of the value the row happens to hold.
|
|
13552
|
+
*/
|
|
13553
|
+
function isInlineRender(container) {
|
|
13554
|
+
var _container$render;
|
|
13555
|
+
if (container.type !== "array" && container.type !== "record") {
|
|
13556
|
+
return false;
|
|
13883
13557
|
}
|
|
13884
|
-
return
|
|
13558
|
+
return ((_container$render = container.render) === null || _container$render === void 0 ? void 0 : _container$render.as) === "inline";
|
|
13885
13559
|
}
|
|
13886
13560
|
|
|
13887
13561
|
/**
|
|
@@ -14442,7 +14116,7 @@ function isPageRouter(routerId) {
|
|
|
14442
14116
|
|
|
14443
14117
|
var corePackageJson = {
|
|
14444
14118
|
name: "@valbuild/core",
|
|
14445
|
-
version: "0.
|
|
14119
|
+
version: "0.139.1",
|
|
14446
14120
|
"private": false,
|
|
14447
14121
|
description: "Val - supercharged hard-coded content",
|
|
14448
14122
|
repository: {
|
|
@@ -14649,4 +14323,4 @@ function tryJsonParse(str) {
|
|
|
14649
14323
|
}
|
|
14650
14324
|
}
|
|
14651
14325
|
|
|
14652
|
-
export {
|
|
14326
|
+
export { COLOR_FORMATS as $, ArraySchema as A, BooleanSchema as B, SETTINGS_MODULE_CONVENTION as C, DEFAULT_CONTENT_HOST as D, isRootModuleFilePath as E, FATAL_ERROR_TYPES as F, GenericSelector as G, resolveSettingsModule as H, Internal as I, localeTagError as J, localeOfValue as K, LocaleSchema as L, ModuleFilePathSep as M, NumberSchema as N, ObjectSchema as O, PatchError as P, declaredKeySetOf as Q, RecordSchema as R, Schema as S, THEME_LOGO_DIRECTORY as T, missingDeclaredKeys as U, VAL_EXTENSION as V, discriminatedUnionBranchOf as W, ColorSchema as X, CodeSchema as Y, CODE_LANGUAGES as Z, _typeof as _, _slicedToArray as a, DEFAULT_COLOR_FORMAT as a0, DateTimeSchema as a1, KeyOfSchema as a2, ValViewSchema as a3, isValViewSource as a4, RouteSchema as a5, RichTextSchema as a6, DiscriminatedUnionSchema as a7, EnumSchema as a8, LiteralSchema as a9, deserializeSchema as aa, previewScope as ab, isInlineRender as ac, parseNextJsRoutePattern as ad, parseTanStackRoutePattern as ae, tanStackSegmentsOfRoutePath as af, validateUrlAgainstPattern as ag, getSourcePathFromRoute as ah, isPageRouter as ai, describeSchemeRejection as aj, isCheckableScheme as ak, rejectScheme as al, schemeOf as am, UNSAFE_URL_SCHEMES as an, _createClass as b, _classCallCheck as c, _toConsumableArray as d, DEFAULT_APP_HOST as e, DEFAULT_STATIC_HOST as f, extractValModules as g, computeValModuleShas as h, initVal as i, computeSourcesSha as j, computeSchemaSha as k, hasRemoteFileSchema as l, modules as m, hasMediaSchema as n, DEFAULT_VAL_REMOTE_HOST as o, derefPatch as p, StringSchema as q, ImageSchema as r, splitModuleFilePathAndModulePath as s, FileSchema as t, DateSchema as u, SettingsSchema as v, ASSISTANT_SETTINGS_MAX_LENGTH as w, THEME_RADIUS_STEPS as x, THEME_RADIUS_LENGTHS as y, assistantAvailability as z };
|