@ghentcdh/create-crouton 0.0.1-alpha.78 → 0.0.1-alpha.79
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +325 -86
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2751,7 +2751,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2751
2751
|
const negativeNumberArg = (arg) => {
|
|
2752
2752
|
if (!/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(arg)) return false;
|
|
2753
2753
|
return !this._getCommandAndAncestors().some(
|
|
2754
|
-
(cmd) => cmd.options.map((
|
|
2754
|
+
(cmd) => cmd.options.map((opt2) => opt2.short).some((short) => /^-\d$/.test(short))
|
|
2755
2755
|
);
|
|
2756
2756
|
};
|
|
2757
2757
|
let activeVariadicOption = null;
|
|
@@ -8645,9 +8645,9 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
|
|
|
8645
8645
|
return payload;
|
|
8646
8646
|
}
|
|
8647
8647
|
const value = input2?.[def.discriminator];
|
|
8648
|
-
const
|
|
8649
|
-
if (
|
|
8650
|
-
return
|
|
8648
|
+
const opt2 = disc.value.get(value);
|
|
8649
|
+
if (opt2 && (value !== void 0 || ctx.direction !== "backward")) {
|
|
8650
|
+
return opt2._zod.run(payload, ctx);
|
|
8651
8651
|
}
|
|
8652
8652
|
if (def.unionFallback || ctx.direction === "backward") {
|
|
8653
8653
|
return _super(payload, ctx);
|
|
@@ -18891,9 +18891,9 @@ function generateUnionCheck(doc, ctx, schema, accessor) {
|
|
|
18891
18891
|
if (options.length === 1) {
|
|
18892
18892
|
return generateCheck(doc, ctx, options[0], accessor);
|
|
18893
18893
|
}
|
|
18894
|
-
const allLiterals = options.every((
|
|
18894
|
+
const allLiterals = options.every((opt2) => opt2._zod.def.type === "literal" && !opt2._zod.def.checks?.length);
|
|
18895
18895
|
if (allLiterals) {
|
|
18896
|
-
const values = new Set(options.flatMap((
|
|
18896
|
+
const values = new Set(options.flatMap((opt2) => opt2._zod.def.values));
|
|
18897
18897
|
const valuesConst = addConstant(ctx, values);
|
|
18898
18898
|
doc.write(`if (!${valuesConst}.has(${accessor})) return INVALID;`);
|
|
18899
18899
|
return accessor;
|
|
@@ -18901,14 +18901,14 @@ function generateUnionCheck(doc, ctx, schema, accessor) {
|
|
|
18901
18901
|
const outputVar = newVar(ctx);
|
|
18902
18902
|
doc.write(`let ${outputVar};`);
|
|
18903
18903
|
for (let i2 = 0; i2 < options.length; i2++) {
|
|
18904
|
-
const
|
|
18904
|
+
const opt2 = options[i2];
|
|
18905
18905
|
if (i2 === 0) {
|
|
18906
18906
|
doc.write(`${outputVar} = (() => {`);
|
|
18907
18907
|
} else {
|
|
18908
18908
|
doc.write(`if (${outputVar} === INVALID) ${outputVar} = (() => {`);
|
|
18909
18909
|
}
|
|
18910
18910
|
doc.indented((d) => {
|
|
18911
|
-
const branchOutput = generateCheck(d, ctx,
|
|
18911
|
+
const branchOutput = generateCheck(d, ctx, opt2, accessor);
|
|
18912
18912
|
d.write(`return ${branchOutput};`);
|
|
18913
18913
|
});
|
|
18914
18914
|
doc.write(`})();`);
|
|
@@ -24280,9 +24280,9 @@ function visit(schema, fnOrHandlers) {
|
|
|
24280
24280
|
const oldOptions = def.options;
|
|
24281
24281
|
let changed = false;
|
|
24282
24282
|
const newOptions = [];
|
|
24283
|
-
for (const
|
|
24284
|
-
const mapped = run(
|
|
24285
|
-
if (mapped !==
|
|
24283
|
+
for (const opt2 of oldOptions) {
|
|
24284
|
+
const mapped = run(opt2);
|
|
24285
|
+
if (mapped !== opt2)
|
|
24286
24286
|
changed = true;
|
|
24287
24287
|
newOptions.push(mapped);
|
|
24288
24288
|
}
|
|
@@ -24525,7 +24525,7 @@ var LayoutControlSchema = external_exports.union([
|
|
|
24525
24525
|
external_exports.object({
|
|
24526
24526
|
id: external_exports.string(),
|
|
24527
24527
|
colspan: external_exports.number().int().min(1).max(12).optional(),
|
|
24528
|
-
rowspan: external_exports.number().int().min(1).optional(),
|
|
24528
|
+
rowspan: external_exports.number().int().min(1).max(6).optional(),
|
|
24529
24529
|
width: external_exports.string().optional(),
|
|
24530
24530
|
label: external_exports.string().optional(),
|
|
24531
24531
|
hideLabel: external_exports.boolean().optional(),
|
|
@@ -24540,7 +24540,7 @@ var LayoutNodeSchema = external_exports.lazy(
|
|
|
24540
24540
|
title: external_exports.string().optional(),
|
|
24541
24541
|
titleKey: external_exports.string().optional(),
|
|
24542
24542
|
colspan: external_exports.number().int().min(1).max(12).optional(),
|
|
24543
|
-
rowspan: external_exports.number().int().min(1).optional(),
|
|
24543
|
+
rowspan: external_exports.number().int().min(1).max(6).optional(),
|
|
24544
24544
|
label: external_exports.string().optional(),
|
|
24545
24545
|
controls: external_exports.array(LayoutControlSchema).optional(),
|
|
24546
24546
|
items: external_exports.array(LayoutNodeSchema).optional()
|
|
@@ -24552,127 +24552,346 @@ var LayoutSchema = external_exports.object({
|
|
|
24552
24552
|
table: LayoutNodeSchema.optional()
|
|
24553
24553
|
});
|
|
24554
24554
|
|
|
24555
|
+
// ../crouton-core/src/lib/resource/field-input/option-meta.ts
|
|
24556
|
+
var opt = (schema, meta3) => schema.meta(meta3);
|
|
24557
|
+
|
|
24555
24558
|
// ../crouton-core/src/lib/resource/field-input/base.options.ts
|
|
24556
24559
|
var BaseOptionsSchema = external_exports.object({
|
|
24557
|
-
label: external_exports.string().optional()
|
|
24558
|
-
|
|
24559
|
-
|
|
24560
|
-
|
|
24561
|
-
|
|
24562
|
-
|
|
24563
|
-
|
|
24564
|
-
|
|
24565
|
-
|
|
24560
|
+
label: opt(external_exports.string().optional(), {
|
|
24561
|
+
description: "Override the field label",
|
|
24562
|
+
examples: ["My label"]
|
|
24563
|
+
}),
|
|
24564
|
+
hideLabel: opt(external_exports.boolean().optional(), {
|
|
24565
|
+
description: "Hide the field label"
|
|
24566
|
+
}),
|
|
24567
|
+
placeholder: opt(external_exports.string().optional(), {
|
|
24568
|
+
description: "Placeholder text shown inside the input when empty",
|
|
24569
|
+
examples: ["Search..."]
|
|
24570
|
+
}),
|
|
24571
|
+
readonly: opt(external_exports.boolean().optional(), {
|
|
24572
|
+
description: "Render the field in read-only mode"
|
|
24573
|
+
}),
|
|
24574
|
+
colspan: opt(external_exports.number().optional(), {
|
|
24575
|
+
description: "Grid column span (1\u201312)",
|
|
24576
|
+
examples: [6, 12]
|
|
24577
|
+
}),
|
|
24578
|
+
width: opt(external_exports.string().optional(), {
|
|
24579
|
+
description: "Named width (xs, sm, md, lg, xl, full) or any CSS value",
|
|
24580
|
+
examples: ["md", "240px"]
|
|
24581
|
+
}),
|
|
24582
|
+
styles: opt(external_exports.record(external_exports.string(), external_exports.unknown()).optional(), {
|
|
24583
|
+
description: "Inline CSS style object applied to the field wrapper",
|
|
24584
|
+
examples: [{ color: "red" }]
|
|
24585
|
+
}),
|
|
24586
|
+
customRender: opt(external_exports.string().optional(), {
|
|
24587
|
+
description: "Name of a globally registered Vue component to render instead of the default input",
|
|
24588
|
+
examples: ["MyCustomInput"]
|
|
24589
|
+
})
|
|
24590
|
+
}).catchall(external_exports.unknown()).meta({ title: "Base options", description: "Accepted by every field input type" });
|
|
24566
24591
|
|
|
24567
24592
|
// ../crouton-core/src/lib/resource/field-input/types/array.options.ts
|
|
24568
24593
|
var ArrayOptionsSchema = BaseOptionsSchema.extend({
|
|
24569
|
-
layout: external_exports.enum(["row", "column"]).optional(),
|
|
24570
|
-
|
|
24571
|
-
|
|
24572
|
-
})
|
|
24594
|
+
layout: opt(external_exports.enum(["row", "column"]).optional(), {
|
|
24595
|
+
description: "Direction in which array items are stacked",
|
|
24596
|
+
examples: ["row", "column"]
|
|
24597
|
+
}),
|
|
24598
|
+
elementLabelProp: opt(external_exports.string().optional(), {
|
|
24599
|
+
description: "Property of each array item used as its label in the UI",
|
|
24600
|
+
examples: ["name", "title"]
|
|
24601
|
+
}),
|
|
24602
|
+
hideActions: opt(external_exports.boolean().optional(), {
|
|
24603
|
+
description: "Hide the add/remove action buttons"
|
|
24604
|
+
})
|
|
24605
|
+
}).meta({ title: "Array options", description: "Options for the detail/array layout control" });
|
|
24573
24606
|
|
|
24574
24607
|
// ../crouton-core/src/lib/resource/field-input/types/autocomplete.options.ts
|
|
24575
24608
|
var AutocompleteBaseSchema = BaseOptionsSchema.extend({
|
|
24576
|
-
labelKey: external_exports.string().optional(),
|
|
24577
|
-
|
|
24578
|
-
|
|
24579
|
-
|
|
24580
|
-
|
|
24609
|
+
labelKey: opt(external_exports.string().optional(), {
|
|
24610
|
+
description: "Object key used as the display label in the dropdown",
|
|
24611
|
+
examples: ["label", "name"]
|
|
24612
|
+
}),
|
|
24613
|
+
valueKey: opt(external_exports.string().optional(), {
|
|
24614
|
+
description: "Object key used as the stored value",
|
|
24615
|
+
examples: ["value", "id"]
|
|
24616
|
+
}),
|
|
24617
|
+
freeText: opt(external_exports.boolean().optional(), {
|
|
24618
|
+
description: "Allow the user to type a value not in the options list"
|
|
24619
|
+
}),
|
|
24620
|
+
enableCreate: opt(external_exports.boolean().optional(), {
|
|
24621
|
+
description: 'Show a "create" action when no matching option is found'
|
|
24622
|
+
}),
|
|
24623
|
+
storeValue: opt(external_exports.boolean().optional(), {
|
|
24624
|
+
description: "Store option[valueKey] instead of the whole option object"
|
|
24625
|
+
})
|
|
24626
|
+
}).meta({
|
|
24627
|
+
title: "Common autocomplete options",
|
|
24628
|
+
description: "Shared options available on all autocomplete variants"
|
|
24581
24629
|
});
|
|
24582
24630
|
var AutocompleteInlineOptionsSchema = AutocompleteBaseSchema.extend({
|
|
24583
|
-
options: external_exports.array(external_exports.unknown()),
|
|
24584
|
-
|
|
24585
|
-
}
|
|
24631
|
+
options: opt(external_exports.array(external_exports.unknown()), {
|
|
24632
|
+
description: "Inline array of option items",
|
|
24633
|
+
examples: [[{ label: "Active", value: "active" }]]
|
|
24634
|
+
}),
|
|
24635
|
+
values: opt(external_exports.array(external_exports.unknown()).optional(), {
|
|
24636
|
+
description: "Alias for options (deprecated \u2014 prefer options)",
|
|
24637
|
+
deprecated: true
|
|
24638
|
+
})
|
|
24639
|
+
}).meta({ title: "Inline autocomplete", description: "Options provided as an inline array" });
|
|
24586
24640
|
var AutocompleteRemoteOptionsSchema = AutocompleteBaseSchema.extend({
|
|
24587
|
-
uri: external_exports.string()
|
|
24588
|
-
|
|
24589
|
-
|
|
24590
|
-
})
|
|
24641
|
+
uri: opt(external_exports.string(), {
|
|
24642
|
+
description: "Remote endpoint URL that returns option items",
|
|
24643
|
+
examples: ["/api/authors"]
|
|
24644
|
+
}),
|
|
24645
|
+
dataField: opt(external_exports.string().optional(), {
|
|
24646
|
+
description: "Field in the API response containing the data array",
|
|
24647
|
+
examples: ["data", "results"]
|
|
24648
|
+
}),
|
|
24649
|
+
skipAuth: opt(external_exports.boolean().optional(), {
|
|
24650
|
+
description: "Send the request without authentication headers"
|
|
24651
|
+
})
|
|
24652
|
+
}).meta({ title: "Remote autocomplete", description: "Options fetched from a remote endpoint" });
|
|
24591
24653
|
var AutocompleteResourceOptionsSchema = AutocompleteBaseSchema.extend({
|
|
24592
|
-
resource: external_exports.string()
|
|
24593
|
-
|
|
24594
|
-
|
|
24654
|
+
resource: opt(external_exports.string(), {
|
|
24655
|
+
description: "Relative path to a resource.json used to populate the options",
|
|
24656
|
+
examples: ["./author.resource.json"]
|
|
24657
|
+
}),
|
|
24658
|
+
skipAuth: opt(external_exports.boolean().optional(), {
|
|
24659
|
+
description: "Send the request without authentication headers"
|
|
24660
|
+
}),
|
|
24661
|
+
dataField: opt(external_exports.string().optional(), {
|
|
24662
|
+
description: "Field in the API response containing the data array",
|
|
24663
|
+
examples: ["data", "results"]
|
|
24664
|
+
})
|
|
24665
|
+
}).meta({
|
|
24666
|
+
title: "Resource autocomplete",
|
|
24667
|
+
description: "Options populated from a crouton resource"
|
|
24595
24668
|
});
|
|
24596
24669
|
var AutocompleteOptionsSchema = external_exports.union([
|
|
24597
24670
|
AutocompleteInlineOptionsSchema,
|
|
24598
24671
|
AutocompleteRemoteOptionsSchema,
|
|
24599
24672
|
AutocompleteResourceOptionsSchema,
|
|
24600
24673
|
AutocompleteBaseSchema
|
|
24601
|
-
]).
|
|
24674
|
+
]).meta({
|
|
24675
|
+
title: "Autocomplete options",
|
|
24676
|
+
description: "Autocomplete options: inline array, remote URI, or resource reference"
|
|
24677
|
+
});
|
|
24602
24678
|
|
|
24603
24679
|
// ../crouton-core/src/lib/resource/field-input/types/boolean.options.ts
|
|
24604
|
-
var BooleanOptionsSchema = BaseOptionsSchema.extend({})
|
|
24680
|
+
var BooleanOptionsSchema = BaseOptionsSchema.extend({}).meta({
|
|
24681
|
+
title: "Boolean options",
|
|
24682
|
+
description: "Checkbox input. All common options apply; no type-specific options."
|
|
24683
|
+
});
|
|
24605
24684
|
|
|
24606
24685
|
// ../crouton-core/src/lib/resource/field-input/types/custom.options.ts
|
|
24607
24686
|
var CustomOptionsSchema = BaseOptionsSchema.extend({
|
|
24608
|
-
customRender: external_exports.string().optional()
|
|
24609
|
-
|
|
24687
|
+
customRender: opt(external_exports.string().optional(), {
|
|
24688
|
+
description: "Name of the globally registered Vue component to render (overrides the base option)",
|
|
24689
|
+
examples: ["MyWidget"]
|
|
24690
|
+
})
|
|
24691
|
+
}).catchall(external_exports.unknown()).meta({
|
|
24692
|
+
title: "Custom options",
|
|
24693
|
+
description: "Options for app-registered custom renderer components"
|
|
24694
|
+
});
|
|
24610
24695
|
|
|
24611
24696
|
// ../crouton-core/src/lib/resource/field-input/types/date-range.options.ts
|
|
24612
24697
|
var DateRangeOptionsSchema = BaseOptionsSchema.extend({
|
|
24613
|
-
fromLabel: external_exports.string().optional()
|
|
24614
|
-
|
|
24615
|
-
|
|
24616
|
-
|
|
24698
|
+
fromLabel: opt(external_exports.string().optional(), {
|
|
24699
|
+
description: "Label above the start date input",
|
|
24700
|
+
default: "From",
|
|
24701
|
+
examples: ["From", "Start date"]
|
|
24702
|
+
}),
|
|
24703
|
+
toLabel: opt(external_exports.string().optional(), {
|
|
24704
|
+
description: "Label above the end date input",
|
|
24705
|
+
default: "To",
|
|
24706
|
+
examples: ["To", "End date"]
|
|
24707
|
+
}),
|
|
24708
|
+
fromField: opt(external_exports.string().optional(), {
|
|
24709
|
+
description: "JSON object key for the start date",
|
|
24710
|
+
default: "from",
|
|
24711
|
+
examples: ["from", "startDate"]
|
|
24712
|
+
}),
|
|
24713
|
+
toField: opt(external_exports.string().optional(), {
|
|
24714
|
+
description: "JSON object key for the end date",
|
|
24715
|
+
default: "to",
|
|
24716
|
+
examples: ["to", "endDate"]
|
|
24717
|
+
})
|
|
24718
|
+
}).meta({
|
|
24719
|
+
title: "Date-range options",
|
|
24720
|
+
description: "Options for the from/to date range picker"
|
|
24617
24721
|
});
|
|
24618
24722
|
|
|
24619
24723
|
// ../crouton-core/src/lib/resource/field-input/types/date.options.ts
|
|
24620
24724
|
var DateOptionsSchema = BaseOptionsSchema.extend({
|
|
24621
|
-
withTime: external_exports.boolean().optional()
|
|
24622
|
-
|
|
24623
|
-
|
|
24624
|
-
|
|
24625
|
-
|
|
24626
|
-
|
|
24725
|
+
withTime: opt(external_exports.boolean().optional(), {
|
|
24726
|
+
description: "Force time input on/off, overrides format detection"
|
|
24727
|
+
}),
|
|
24728
|
+
min: opt(external_exports.string().optional(), {
|
|
24729
|
+
description: "Earliest selectable date (ISO 8601 or yyyy-MM-dd)",
|
|
24730
|
+
examples: ["2020-01-01"]
|
|
24731
|
+
}),
|
|
24732
|
+
max: opt(external_exports.string().optional(), {
|
|
24733
|
+
description: "Latest selectable date (ISO 8601 or yyyy-MM-dd)",
|
|
24734
|
+
examples: ["2099-12-31"]
|
|
24735
|
+
}),
|
|
24736
|
+
locale: opt(external_exports.string().optional().default("en-GB"), {
|
|
24737
|
+
description: "BCP-47 locale for month heading and weekday labels",
|
|
24738
|
+
examples: ["en-GB", "nl-BE"],
|
|
24739
|
+
default: "en-GB"
|
|
24740
|
+
}),
|
|
24741
|
+
firstDayOfWeek: opt(external_exports.number().optional().default(1), {
|
|
24742
|
+
description: "First day of the week: 0 = Sunday, 1 = Monday",
|
|
24743
|
+
examples: [0, 1],
|
|
24744
|
+
default: 1
|
|
24745
|
+
})
|
|
24746
|
+
}).meta({ title: "Date options", description: "Options for the date picker (and dateTime alias)" });
|
|
24627
24747
|
|
|
24628
24748
|
// ../crouton-core/src/lib/resource/field-input/types/markdown.options.ts
|
|
24629
24749
|
var MarkdownOptionsSchema = BaseOptionsSchema.extend({
|
|
24630
|
-
minHeight: external_exports.string().optional()
|
|
24631
|
-
|
|
24750
|
+
minHeight: opt(external_exports.string().optional(), {
|
|
24751
|
+
description: "Minimum editor height",
|
|
24752
|
+
examples: ["200px", "400px"]
|
|
24753
|
+
})
|
|
24754
|
+
}).meta({ title: "Markdown options", description: "Options for the Markdown rich-text editor" });
|
|
24632
24755
|
|
|
24633
24756
|
// ../crouton-core/src/lib/resource/field-input/types/number.options.ts
|
|
24634
|
-
var NumberOptionsSchema = BaseOptionsSchema.extend({})
|
|
24757
|
+
var NumberOptionsSchema = BaseOptionsSchema.extend({}).meta({
|
|
24758
|
+
title: "Number options",
|
|
24759
|
+
description: "Numeric input (also used for Integer alias). All common options apply; no type-specific options."
|
|
24760
|
+
});
|
|
24635
24761
|
|
|
24636
24762
|
// ../crouton-core/src/lib/resource/field-input/types/relation.options.ts
|
|
24637
24763
|
var RelationOptionsSchema = BaseOptionsSchema.extend({
|
|
24638
|
-
colspan: external_exports.number().optional().default(12),
|
|
24639
|
-
|
|
24640
|
-
|
|
24641
|
-
|
|
24642
|
-
|
|
24643
|
-
|
|
24644
|
-
|
|
24764
|
+
colspan: opt(external_exports.number().optional().default(12), {
|
|
24765
|
+
description: "Grid column span (1\u201312); defaults to 12 for relation controls",
|
|
24766
|
+
default: 12,
|
|
24767
|
+
examples: [12, 6]
|
|
24768
|
+
}),
|
|
24769
|
+
sort: opt(external_exports.string().optional(), {
|
|
24770
|
+
description: "Field to sort related records by",
|
|
24771
|
+
examples: ["name", "createdAt"]
|
|
24772
|
+
}),
|
|
24773
|
+
sortDir: opt(external_exports.enum(["asc", "desc"]).optional(), {
|
|
24774
|
+
description: "Sort direction",
|
|
24775
|
+
default: "asc",
|
|
24776
|
+
examples: ["asc", "desc"]
|
|
24777
|
+
}),
|
|
24778
|
+
direction: opt(external_exports.string().optional(), {
|
|
24779
|
+
description: "CSS flex direction for the button layout",
|
|
24780
|
+
examples: ["row", "column"]
|
|
24781
|
+
}),
|
|
24782
|
+
displayKey: opt(external_exports.string().optional(), {
|
|
24783
|
+
description: "Key used as the display label for related records",
|
|
24784
|
+
examples: ["name", "title"]
|
|
24785
|
+
}),
|
|
24786
|
+
resource: opt(external_exports.string().optional(), {
|
|
24787
|
+
description: "Path to the related resource.json",
|
|
24788
|
+
examples: ["./author.resource.json"]
|
|
24789
|
+
})
|
|
24790
|
+
}).catchall(external_exports.unknown()).meta({
|
|
24791
|
+
title: "Relation options",
|
|
24792
|
+
description: "Options for the sub-resource relation control"
|
|
24793
|
+
});
|
|
24645
24794
|
|
|
24646
24795
|
// ../crouton-core/src/lib/resource/field-input/types/select.options.ts
|
|
24647
24796
|
var SelectOptionsSchema = BaseOptionsSchema.extend({
|
|
24648
|
-
options: external_exports.array(external_exports.unknown()).optional(),
|
|
24649
|
-
|
|
24650
|
-
|
|
24651
|
-
|
|
24652
|
-
|
|
24653
|
-
|
|
24654
|
-
|
|
24655
|
-
|
|
24656
|
-
|
|
24797
|
+
options: opt(external_exports.array(external_exports.unknown()).optional(), {
|
|
24798
|
+
description: "Inline array of option items",
|
|
24799
|
+
examples: [[{ label: "Active", value: "active" }]]
|
|
24800
|
+
}),
|
|
24801
|
+
values: opt(external_exports.array(external_exports.unknown()).optional(), {
|
|
24802
|
+
description: "Alias for options (deprecated \u2014 prefer options)",
|
|
24803
|
+
deprecated: true
|
|
24804
|
+
}),
|
|
24805
|
+
resource: opt(external_exports.string().optional(), {
|
|
24806
|
+
description: "Relative path to a resource.json used to populate the options",
|
|
24807
|
+
examples: ["./status.resource.json"]
|
|
24808
|
+
}),
|
|
24809
|
+
labelKey: opt(external_exports.string().optional(), {
|
|
24810
|
+
description: "Object key used as the display label",
|
|
24811
|
+
examples: ["label", "name"]
|
|
24812
|
+
}),
|
|
24813
|
+
valueKey: opt(external_exports.string().optional(), {
|
|
24814
|
+
description: "Object key used as the stored value",
|
|
24815
|
+
examples: ["value", "id"]
|
|
24816
|
+
}),
|
|
24817
|
+
uri: opt(external_exports.string().optional(), {
|
|
24818
|
+
description: "Remote endpoint URL for fetching options",
|
|
24819
|
+
examples: ["/api/statuses"]
|
|
24820
|
+
}),
|
|
24821
|
+
dataField: opt(external_exports.string().optional(), {
|
|
24822
|
+
description: "Field in the API response containing the data array",
|
|
24823
|
+
examples: ["data", "results"]
|
|
24824
|
+
}),
|
|
24825
|
+
clearable: opt(external_exports.boolean().optional(), {
|
|
24826
|
+
description: "Show a clear button to remove the selected value"
|
|
24827
|
+
}),
|
|
24828
|
+
storeValue: opt(external_exports.boolean().optional(), {
|
|
24829
|
+
description: "Store option[valueKey] instead of the whole option object"
|
|
24830
|
+
})
|
|
24831
|
+
}).meta({
|
|
24832
|
+
title: "Select options",
|
|
24833
|
+
description: "Options for the select dropdown and multi-select (mutliSelect alias)"
|
|
24657
24834
|
});
|
|
24658
24835
|
|
|
24659
24836
|
// ../crouton-core/src/lib/resource/field-input/types/string.options.ts
|
|
24660
|
-
var
|
|
24837
|
+
var NormalizedUniqueSchema = external_exports.object({
|
|
24838
|
+
enabled: external_exports.boolean(),
|
|
24839
|
+
scope: external_exports.array(external_exports.string()).optional(),
|
|
24840
|
+
caseInsensitive: external_exports.boolean().optional(),
|
|
24841
|
+
message: external_exports.string().optional()
|
|
24842
|
+
});
|
|
24843
|
+
var StringOptionsSchema = BaseOptionsSchema.extend({
|
|
24844
|
+
/** Async uniqueness validation: present when the column declares `unique`. */
|
|
24845
|
+
unique: NormalizedUniqueSchema.optional().meta({
|
|
24846
|
+
description: "Async uniqueness validation: present when the column declares `unique`."
|
|
24847
|
+
})
|
|
24848
|
+
}).meta({
|
|
24849
|
+
title: "String options",
|
|
24850
|
+
description: "Plain text input. All common options apply; no type-specific options."
|
|
24851
|
+
});
|
|
24661
24852
|
|
|
24662
24853
|
// ../crouton-core/src/lib/resource/field-input/types/textarea.options.ts
|
|
24663
|
-
var TextareaOptionsSchema = BaseOptionsSchema.extend({})
|
|
24854
|
+
var TextareaOptionsSchema = BaseOptionsSchema.extend({}).meta({
|
|
24855
|
+
title: "Textarea options",
|
|
24856
|
+
description: "Multi-line text input. All common options apply; no type-specific options."
|
|
24857
|
+
});
|
|
24664
24858
|
|
|
24665
24859
|
// ../crouton-core/src/lib/resource/field-input/types/toggle.options.ts
|
|
24666
24860
|
var ToggleOptionsSchema = BaseOptionsSchema.extend({
|
|
24667
|
-
options: external_exports.array(external_exports.unknown()).optional(),
|
|
24668
|
-
|
|
24669
|
-
|
|
24670
|
-
|
|
24671
|
-
|
|
24672
|
-
|
|
24673
|
-
|
|
24674
|
-
|
|
24675
|
-
|
|
24861
|
+
options: opt(external_exports.array(external_exports.unknown()).optional(), {
|
|
24862
|
+
description: "Array of option items rendered as toggle buttons",
|
|
24863
|
+
examples: [[{ label: "Yes", value: true }, { label: "No", value: false }]]
|
|
24864
|
+
}),
|
|
24865
|
+
values: opt(external_exports.array(external_exports.unknown()).optional(), {
|
|
24866
|
+
description: "Alias for options (deprecated \u2014 prefer options)",
|
|
24867
|
+
deprecated: true
|
|
24868
|
+
}),
|
|
24869
|
+
labelKey: opt(external_exports.string().optional(), {
|
|
24870
|
+
description: "Object key used as the button label",
|
|
24871
|
+
examples: ["label"]
|
|
24872
|
+
}),
|
|
24873
|
+
valueKey: opt(external_exports.string().optional(), {
|
|
24874
|
+
description: "Object key used as the stored value",
|
|
24875
|
+
examples: ["value"]
|
|
24876
|
+
}),
|
|
24877
|
+
storeValue: opt(external_exports.boolean().optional(), {
|
|
24878
|
+
description: "Store option[valueKey] instead of the whole option object"
|
|
24879
|
+
}),
|
|
24880
|
+
clearable: opt(external_exports.boolean().optional().default(true), {
|
|
24881
|
+
description: "Clicking the active button again clears the value",
|
|
24882
|
+
default: true
|
|
24883
|
+
}),
|
|
24884
|
+
color: opt(external_exports.string().optional().default("primary"), {
|
|
24885
|
+
description: "Color token applied to the active button",
|
|
24886
|
+
examples: ["primary", "secondary"],
|
|
24887
|
+
default: "primary"
|
|
24888
|
+
}),
|
|
24889
|
+
size: opt(external_exports.string().optional().default("sm"), {
|
|
24890
|
+
description: "Size token for the buttons",
|
|
24891
|
+
examples: ["sm", "md", "lg"],
|
|
24892
|
+
default: "sm"
|
|
24893
|
+
})
|
|
24894
|
+
}).meta({ title: "Toggle options", description: "Options for the toggle button-group control" });
|
|
24676
24895
|
|
|
24677
24896
|
// ../crouton-core/src/lib/resource/field-input/registry.ts
|
|
24678
24897
|
var fieldInputRegistry = /* @__PURE__ */ new Map([
|
|
@@ -24871,6 +25090,15 @@ var NESTED_SHORTHANDS = {
|
|
|
24871
25090
|
};
|
|
24872
25091
|
|
|
24873
25092
|
// ../crouton-core/src/lib/resource/Column.ts
|
|
25093
|
+
var UniqueConfigSchema = external_exports.object({
|
|
25094
|
+
/** Other column ids the uniqueness is scoped by (composite unique). */
|
|
25095
|
+
scope: external_exports.array(external_exports.string()).optional(),
|
|
25096
|
+
/** Compare case-insensitively (maps to Prisma `mode: 'insensitive'`). */
|
|
25097
|
+
caseInsensitive: external_exports.boolean().optional(),
|
|
25098
|
+
/** Message shown on the field when the value is already taken. */
|
|
25099
|
+
message: external_exports.string().optional()
|
|
25100
|
+
});
|
|
25101
|
+
var UniqueSchema = external_exports.union([external_exports.boolean(), UniqueConfigSchema]);
|
|
24874
25102
|
var WhenConditionSchema = external_exports.object({
|
|
24875
25103
|
field: external_exports.string(),
|
|
24876
25104
|
// required
|
|
@@ -24924,6 +25152,17 @@ var JsonColumnSchema = external_exports.object({
|
|
|
24924
25152
|
// default: false — exactly one column should set this
|
|
24925
25153
|
showInLookup: external_exports.boolean().default(false),
|
|
24926
25154
|
// default: false
|
|
25155
|
+
/**
|
|
25156
|
+
* Enforce that this column's value is unique across the resource. `true` is
|
|
25157
|
+
* simple single-column uniqueness; the object form allows a composite
|
|
25158
|
+
* `scope`, case-insensitive comparison, and a custom `message`.
|
|
25159
|
+
*
|
|
25160
|
+
* Requires a matching DB unique constraint (`@unique` in Prisma) to be
|
|
25161
|
+
* actually enforceable - the flag alone does not create one. The form uses it
|
|
25162
|
+
* to validate as-you-type against a lightweight check endpoint; the API maps
|
|
25163
|
+
* a Prisma unique violation back to this field on write.
|
|
25164
|
+
*/
|
|
25165
|
+
unique: UniqueSchema.optional(),
|
|
24927
25166
|
/**
|
|
24928
25167
|
* Data type of the column, as a shorthand name (`"string"`, `"integer"`, …)
|
|
24929
25168
|
* or a full JSON Schema fragment:
|
|
@@ -25903,7 +26142,7 @@ var runCreate = async (name, opts) => {
|
|
|
25903
26142
|
const tokens = {
|
|
25904
26143
|
name,
|
|
25905
26144
|
Name: toTitle(name),
|
|
25906
|
-
version: true ? "0.0.1-alpha.
|
|
26145
|
+
version: true ? "0.0.1-alpha.79" : "latest",
|
|
25907
26146
|
year: String((/* @__PURE__ */ new Date()).getFullYear()),
|
|
25908
26147
|
pmRun: pm === "npm" ? "npm run" : pm,
|
|
25909
26148
|
urlEnv: "DATABASE_URL",
|