@nestjs-dash/core 0.0.1 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +23 -23
- package/dist/actions/handlers.d.ts +1 -1
- package/dist/actions/index.d.ts +25 -25
- package/dist/actions/index.js +93 -93
- package/dist/charts/index.d.ts +6 -6
- package/dist/charts/index.js +15 -15
- package/dist/forms/index.d.ts +24 -24
- package/dist/forms/index.js +76 -76
- package/dist/forms/json-fields.d.ts +1 -1
- package/dist/forms/json-fields.js +15 -15
- package/dist/forms/validation.d.ts +2 -2
- package/dist/forms/validation.js +2 -2
- package/dist/index.d.ts +29 -29
- package/dist/index.js +51 -51
- package/dist/schemas/index.d.ts +10 -10
- package/dist/schemas/index.js +22 -22
- package/dist/tables/index.d.ts +12 -12
- package/dist/tables/index.js +15 -15
- package/dist/tables/list-query-config.d.ts +3 -3
- package/dist/tables/list-query-config.js +4 -4
- package/package.json +21 -21
package/dist/charts/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { escapeHtml } from
|
|
1
|
+
import { escapeHtml } from "@nestjs-dash/support";
|
|
2
2
|
class ChartWidgetBuilder {
|
|
3
3
|
kind;
|
|
4
|
-
slot =
|
|
5
|
-
categoryKeyValue =
|
|
4
|
+
slot = "main";
|
|
5
|
+
categoryKeyValue = "category";
|
|
6
6
|
seriesValue = [];
|
|
7
7
|
dataInput = [];
|
|
8
8
|
titleValue;
|
|
@@ -15,7 +15,7 @@ class ChartWidgetBuilder {
|
|
|
15
15
|
this.kind = kind;
|
|
16
16
|
}
|
|
17
17
|
side() {
|
|
18
|
-
this.slot =
|
|
18
|
+
this.slot = "side";
|
|
19
19
|
return this;
|
|
20
20
|
}
|
|
21
21
|
title(value) {
|
|
@@ -58,7 +58,7 @@ class ChartWidgetBuilder {
|
|
|
58
58
|
return this.accessPredicate ? await this.accessPredicate(ctx) : true;
|
|
59
59
|
}
|
|
60
60
|
async chart(ctx) {
|
|
61
|
-
const data = typeof this.dataInput ===
|
|
61
|
+
const data = typeof this.dataInput === "function" ? await this.dataInput(ctx) : this.dataInput;
|
|
62
62
|
return {
|
|
63
63
|
kind: this.kind,
|
|
64
64
|
data,
|
|
@@ -74,7 +74,7 @@ class ChartWidgetBuilder {
|
|
|
74
74
|
}
|
|
75
75
|
export class BarChart extends ChartWidgetBuilder {
|
|
76
76
|
constructor() {
|
|
77
|
-
super(
|
|
77
|
+
super("bar");
|
|
78
78
|
}
|
|
79
79
|
static make() {
|
|
80
80
|
return new BarChart();
|
|
@@ -82,7 +82,7 @@ export class BarChart extends ChartWidgetBuilder {
|
|
|
82
82
|
}
|
|
83
83
|
export class LineChart extends ChartWidgetBuilder {
|
|
84
84
|
constructor() {
|
|
85
|
-
super(
|
|
85
|
+
super("line");
|
|
86
86
|
}
|
|
87
87
|
static make() {
|
|
88
88
|
return new LineChart();
|
|
@@ -90,7 +90,7 @@ export class LineChart extends ChartWidgetBuilder {
|
|
|
90
90
|
}
|
|
91
91
|
export class PieChart extends ChartWidgetBuilder {
|
|
92
92
|
constructor() {
|
|
93
|
-
super(
|
|
93
|
+
super("pie");
|
|
94
94
|
}
|
|
95
95
|
static make() {
|
|
96
96
|
return new PieChart();
|
|
@@ -98,8 +98,8 @@ export class PieChart extends ChartWidgetBuilder {
|
|
|
98
98
|
}
|
|
99
99
|
export class StatCard {
|
|
100
100
|
labelValue;
|
|
101
|
-
slot =
|
|
102
|
-
valueInput =
|
|
101
|
+
slot = "main";
|
|
102
|
+
valueInput = "";
|
|
103
103
|
trendInput;
|
|
104
104
|
accessPredicate;
|
|
105
105
|
constructor(labelValue) {
|
|
@@ -117,7 +117,7 @@ export class StatCard {
|
|
|
117
117
|
return this;
|
|
118
118
|
}
|
|
119
119
|
side() {
|
|
120
|
-
this.slot =
|
|
120
|
+
this.slot = "side";
|
|
121
121
|
return this;
|
|
122
122
|
}
|
|
123
123
|
visibleWhen(predicate) {
|
|
@@ -128,11 +128,11 @@ export class StatCard {
|
|
|
128
128
|
return this.accessPredicate ? await this.accessPredicate(ctx) : true;
|
|
129
129
|
}
|
|
130
130
|
async render(ctx) {
|
|
131
|
-
const value = typeof this.valueInput ===
|
|
132
|
-
const trend = typeof this.trendInput ===
|
|
131
|
+
const value = typeof this.valueInput === "function" ? await this.valueInput(ctx) : this.valueInput;
|
|
132
|
+
const trend = typeof this.trendInput === "function" ? await this.trendInput(ctx) : this.trendInput;
|
|
133
133
|
const trendHtml = trend
|
|
134
|
-
? `<span style="color:${trend.direction ===
|
|
135
|
-
:
|
|
134
|
+
? `<span style="color:${trend.direction === "up" ? "var(--chart-2)" : "var(--destructive)"};font-size:0.85rem;">${trend.direction === "up" ? "▲" : "▼"} ${escapeHtml(trend.label)}</span>`
|
|
135
|
+
: "";
|
|
136
136
|
return `<div style="border:1px solid var(--border);border-radius:0.5rem;padding:1rem;">
|
|
137
137
|
<div style="font-size:0.8rem;color:var(--muted-foreground);margin-bottom:0.35rem;">${escapeHtml(this.labelValue)}</div>
|
|
138
138
|
<div style="font-size:1.75rem;font-weight:600;">${escapeHtml(String(value))}</div>
|
package/dist/forms/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ZodType } from
|
|
2
|
-
import { ComponentBuilder } from
|
|
1
|
+
import type { ZodType } from "zod";
|
|
2
|
+
import { ComponentBuilder } from "../schemas/index.js";
|
|
3
3
|
export type SelectOption = {
|
|
4
4
|
label: string;
|
|
5
5
|
value: string | number | boolean;
|
|
@@ -11,7 +11,7 @@ declare abstract class FieldBuilder extends ComponentBuilder {
|
|
|
11
11
|
disabled(value?: boolean): this;
|
|
12
12
|
helperText(value: string): this;
|
|
13
13
|
defaultValue(value: string | number | boolean | null): this;
|
|
14
|
-
icon(name: string, position?:
|
|
14
|
+
icon(name: string, position?: "start" | "end"): this;
|
|
15
15
|
prefix(value: string): this;
|
|
16
16
|
suffix(value: string): this;
|
|
17
17
|
rule(schema: ZodType): this;
|
|
@@ -23,14 +23,14 @@ declare abstract class FieldBuilder extends ComponentBuilder {
|
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
25
|
export declare class TextInput extends FieldBuilder {
|
|
26
|
-
readonly kind:
|
|
26
|
+
readonly kind: "text-input";
|
|
27
27
|
static make(name: string): TextInput;
|
|
28
28
|
email(): this;
|
|
29
29
|
password(): this;
|
|
30
30
|
placeholder(value: string): this;
|
|
31
31
|
}
|
|
32
32
|
export declare class Textarea extends FieldBuilder {
|
|
33
|
-
readonly kind:
|
|
33
|
+
readonly kind: "textarea";
|
|
34
34
|
static make(name: string): Textarea;
|
|
35
35
|
rows(value: number): this;
|
|
36
36
|
json(property?: string): this;
|
|
@@ -42,63 +42,63 @@ export interface RelationshipSelectConfig {
|
|
|
42
42
|
preload?: boolean;
|
|
43
43
|
}
|
|
44
44
|
export declare class Select extends FieldBuilder {
|
|
45
|
-
readonly kind:
|
|
45
|
+
readonly kind: "select";
|
|
46
46
|
static make(name: string): Select;
|
|
47
47
|
options(options: SelectOption[] | Record<string, string | number>): this;
|
|
48
48
|
relationship(config: RelationshipSelectConfig): this;
|
|
49
49
|
multiple(value?: boolean): this;
|
|
50
50
|
}
|
|
51
51
|
export declare class Checkbox extends FieldBuilder {
|
|
52
|
-
readonly kind:
|
|
52
|
+
readonly kind: "checkbox";
|
|
53
53
|
static make(name: string): Checkbox;
|
|
54
54
|
}
|
|
55
55
|
export declare class Toggle extends FieldBuilder {
|
|
56
|
-
readonly kind:
|
|
56
|
+
readonly kind: "toggle";
|
|
57
57
|
static make(name: string): Toggle;
|
|
58
58
|
}
|
|
59
59
|
export declare class Radio extends FieldBuilder {
|
|
60
|
-
readonly kind:
|
|
60
|
+
readonly kind: "radio";
|
|
61
61
|
static make(name: string): Radio;
|
|
62
62
|
options(options: SelectOption[] | Record<string, string | number>): this;
|
|
63
63
|
}
|
|
64
64
|
export declare class DatePicker extends FieldBuilder {
|
|
65
|
-
readonly kind:
|
|
65
|
+
readonly kind: "date-picker";
|
|
66
66
|
static make(name: string): DatePicker;
|
|
67
67
|
minDate(value: string): this;
|
|
68
68
|
maxDate(value: string): this;
|
|
69
69
|
}
|
|
70
70
|
export declare class DateTimePicker extends FieldBuilder {
|
|
71
|
-
readonly kind:
|
|
71
|
+
readonly kind: "date-time-picker";
|
|
72
72
|
static make(name: string): DateTimePicker;
|
|
73
73
|
minDate(value: string): this;
|
|
74
74
|
maxDate(value: string): this;
|
|
75
75
|
}
|
|
76
76
|
export declare class ColorPicker extends FieldBuilder {
|
|
77
|
-
readonly kind:
|
|
77
|
+
readonly kind: "color-picker";
|
|
78
78
|
static make(name: string): ColorPicker;
|
|
79
79
|
}
|
|
80
80
|
export declare class CodeEditor extends FieldBuilder {
|
|
81
|
-
readonly kind:
|
|
81
|
+
readonly kind: "code-editor";
|
|
82
82
|
static make(name: string): CodeEditor;
|
|
83
83
|
language(value: string): this;
|
|
84
84
|
rows(value: number): this;
|
|
85
85
|
}
|
|
86
86
|
export declare class TagsInput extends FieldBuilder {
|
|
87
|
-
readonly kind:
|
|
87
|
+
readonly kind: "tags-input";
|
|
88
88
|
static make(name: string): TagsInput;
|
|
89
89
|
placeholder(value: string): this;
|
|
90
90
|
maxTags(value: number): this;
|
|
91
91
|
}
|
|
92
92
|
export declare class RichEditor extends FieldBuilder {
|
|
93
|
-
readonly kind:
|
|
93
|
+
readonly kind: "rich-editor";
|
|
94
94
|
static make(name: string): RichEditor;
|
|
95
95
|
rows(value: number): this;
|
|
96
96
|
}
|
|
97
|
-
export type RichBoxTheme =
|
|
97
|
+
export type RichBoxTheme = "snow" | "bubble";
|
|
98
98
|
export type RichBoxToolbarItem = string | Record<string, unknown>;
|
|
99
99
|
export type RichBoxToolbarConfig = RichBoxToolbarItem[][] | false;
|
|
100
100
|
export declare class RichBox extends FieldBuilder {
|
|
101
|
-
readonly kind:
|
|
101
|
+
readonly kind: "rich-box";
|
|
102
102
|
static make(name: string): RichBox;
|
|
103
103
|
json(property?: string): this;
|
|
104
104
|
theme(value: RichBoxTheme): this;
|
|
@@ -109,7 +109,7 @@ export declare class RichBox extends FieldBuilder {
|
|
|
109
109
|
readOnly(value?: boolean): this;
|
|
110
110
|
modules(config: Record<string, unknown>): this;
|
|
111
111
|
}
|
|
112
|
-
export type UploadVisibility =
|
|
112
|
+
export type UploadVisibility = "public" | "private";
|
|
113
113
|
declare abstract class UploadFieldBuilder extends FieldBuilder {
|
|
114
114
|
disk(name: string): this;
|
|
115
115
|
directory(path: string): this;
|
|
@@ -119,10 +119,10 @@ declare abstract class UploadFieldBuilder extends FieldBuilder {
|
|
|
119
119
|
acceptedFileTypes(types: string[]): this;
|
|
120
120
|
maxSize(kilobytes: number): this;
|
|
121
121
|
}
|
|
122
|
-
export type ImageShape =
|
|
122
|
+
export type ImageShape = "circle" | "square";
|
|
123
123
|
export type ImageVisibility = UploadVisibility;
|
|
124
124
|
export declare class ImageUpload extends UploadFieldBuilder {
|
|
125
|
-
readonly kind:
|
|
125
|
+
readonly kind: "image-upload";
|
|
126
126
|
static make(name: string): ImageUpload;
|
|
127
127
|
collection(name: string): this;
|
|
128
128
|
shape(value: ImageShape): this;
|
|
@@ -130,17 +130,17 @@ export declare class ImageUpload extends UploadFieldBuilder {
|
|
|
130
130
|
aspectRatio(value: number): this;
|
|
131
131
|
}
|
|
132
132
|
export declare class FileUpload extends UploadFieldBuilder {
|
|
133
|
-
readonly kind:
|
|
133
|
+
readonly kind: "file-upload";
|
|
134
134
|
static make(name: string): FileUpload;
|
|
135
135
|
}
|
|
136
136
|
export declare class Repeater extends FieldBuilder {
|
|
137
|
-
readonly kind:
|
|
137
|
+
readonly kind: "repeater";
|
|
138
138
|
static make(name: string): Repeater;
|
|
139
139
|
schema(fields: Array<TextInput | Textarea | Select | Checkbox | Toggle>): this;
|
|
140
140
|
minItems(value: number): this;
|
|
141
141
|
maxItems(value: number): this;
|
|
142
142
|
addActionLabel(value: string): this;
|
|
143
143
|
}
|
|
144
|
-
export { validateFormPayload } from
|
|
145
|
-
export { collectJsonArrayFields, collectJsonTextareaFields, parseJsonArrayFields, parseJsonTextareaFields, stringifyJsonTextareaFields, } from
|
|
144
|
+
export { validateFormPayload } from "./validation.js";
|
|
145
|
+
export { collectJsonArrayFields, collectJsonTextareaFields, parseJsonArrayFields, parseJsonTextareaFields, stringifyJsonTextareaFields, } from "./json-fields.js";
|
|
146
146
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/forms/index.js
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import { ComponentBuilder } from
|
|
2
|
-
import { registerFieldValidation } from
|
|
1
|
+
import { ComponentBuilder } from "../schemas/index.js";
|
|
2
|
+
import { registerFieldValidation } from "./validation.js";
|
|
3
3
|
class FieldBuilder extends ComponentBuilder {
|
|
4
4
|
constructor(name) {
|
|
5
5
|
super();
|
|
6
|
-
this.setProp(
|
|
6
|
+
this.setProp("name", name);
|
|
7
7
|
}
|
|
8
8
|
label(value) {
|
|
9
|
-
return this.setProp(
|
|
9
|
+
return this.setProp("label", value);
|
|
10
10
|
}
|
|
11
11
|
required(value = true) {
|
|
12
|
-
return this.setProp(
|
|
12
|
+
return this.setProp("required", value);
|
|
13
13
|
}
|
|
14
14
|
disabled(value = true) {
|
|
15
|
-
return this.setProp(
|
|
15
|
+
return this.setProp("disabled", value);
|
|
16
16
|
}
|
|
17
17
|
helperText(value) {
|
|
18
|
-
return this.setProp(
|
|
18
|
+
return this.setProp("helperText", value);
|
|
19
19
|
}
|
|
20
20
|
defaultValue(value) {
|
|
21
|
-
return this.setProp(
|
|
21
|
+
return this.setProp("defaultValue", value);
|
|
22
22
|
}
|
|
23
|
-
icon(name, position =
|
|
24
|
-
return this.setProp(
|
|
23
|
+
icon(name, position = "start") {
|
|
24
|
+
return this.setProp("icon", name).setProp("iconPosition", position);
|
|
25
25
|
}
|
|
26
26
|
prefix(value) {
|
|
27
|
-
return this.setProp(
|
|
27
|
+
return this.setProp("prefix", value);
|
|
28
28
|
}
|
|
29
29
|
suffix(value) {
|
|
30
|
-
return this.setProp(
|
|
30
|
+
return this.setProp("suffix", value);
|
|
31
31
|
}
|
|
32
32
|
rule(schema) {
|
|
33
|
-
return this.setProp(
|
|
33
|
+
return this.setProp("validationKey", registerFieldValidation(schema));
|
|
34
34
|
}
|
|
35
35
|
toSchema() {
|
|
36
36
|
const schema = super.toSchema();
|
|
@@ -38,51 +38,51 @@ class FieldBuilder extends ComponentBuilder {
|
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
export class TextInput extends FieldBuilder {
|
|
41
|
-
kind =
|
|
41
|
+
kind = "text-input";
|
|
42
42
|
static make(name) {
|
|
43
43
|
return new TextInput(name);
|
|
44
44
|
}
|
|
45
45
|
email() {
|
|
46
|
-
return this.setProp(
|
|
46
|
+
return this.setProp("type", "email");
|
|
47
47
|
}
|
|
48
48
|
password() {
|
|
49
|
-
return this.setProp(
|
|
49
|
+
return this.setProp("type", "password");
|
|
50
50
|
}
|
|
51
51
|
placeholder(value) {
|
|
52
|
-
return this.setProp(
|
|
52
|
+
return this.setProp("placeholder", value);
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
export class Textarea extends FieldBuilder {
|
|
56
|
-
kind =
|
|
56
|
+
kind = "textarea";
|
|
57
57
|
static make(name) {
|
|
58
58
|
return new Textarea(name);
|
|
59
59
|
}
|
|
60
60
|
rows(value) {
|
|
61
|
-
return this.setProp(
|
|
61
|
+
return this.setProp("rows", value);
|
|
62
62
|
}
|
|
63
63
|
json(property) {
|
|
64
|
-
this.setProp(
|
|
64
|
+
this.setProp("json", true);
|
|
65
65
|
if (property != null)
|
|
66
|
-
this.setProp(
|
|
66
|
+
this.setProp("jsonProperty", property);
|
|
67
67
|
return this;
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
export class Select extends FieldBuilder {
|
|
71
|
-
kind =
|
|
71
|
+
kind = "select";
|
|
72
72
|
static make(name) {
|
|
73
73
|
return new Select(name);
|
|
74
74
|
}
|
|
75
75
|
options(options) {
|
|
76
76
|
if (Array.isArray(options)) {
|
|
77
|
-
return this.setProp(
|
|
77
|
+
return this.setProp("options", options);
|
|
78
78
|
}
|
|
79
|
-
return this.setProp(
|
|
79
|
+
return this.setProp("options", Object.entries(options).map(([value, label]) => ({
|
|
80
80
|
label: String(label),
|
|
81
81
|
value,
|
|
82
82
|
})));
|
|
83
83
|
}
|
|
84
84
|
relationship(config) {
|
|
85
|
-
return this.setProp(
|
|
85
|
+
return this.setProp("relationship", {
|
|
86
86
|
resource: config.resource,
|
|
87
87
|
titleAttribute: config.titleAttribute,
|
|
88
88
|
searchBy: config.searchBy ?? [config.titleAttribute],
|
|
@@ -90,185 +90,185 @@ export class Select extends FieldBuilder {
|
|
|
90
90
|
});
|
|
91
91
|
}
|
|
92
92
|
multiple(value = true) {
|
|
93
|
-
return this.setProp(
|
|
93
|
+
return this.setProp("multiple", value);
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
export class Checkbox extends FieldBuilder {
|
|
97
|
-
kind =
|
|
97
|
+
kind = "checkbox";
|
|
98
98
|
static make(name) {
|
|
99
99
|
return new Checkbox(name);
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
export class Toggle extends FieldBuilder {
|
|
103
|
-
kind =
|
|
103
|
+
kind = "toggle";
|
|
104
104
|
static make(name) {
|
|
105
105
|
return new Toggle(name);
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
108
|
export class Radio extends FieldBuilder {
|
|
109
|
-
kind =
|
|
109
|
+
kind = "radio";
|
|
110
110
|
static make(name) {
|
|
111
111
|
return new Radio(name);
|
|
112
112
|
}
|
|
113
113
|
options(options) {
|
|
114
114
|
if (Array.isArray(options)) {
|
|
115
|
-
return this.setProp(
|
|
115
|
+
return this.setProp("options", options);
|
|
116
116
|
}
|
|
117
|
-
return this.setProp(
|
|
117
|
+
return this.setProp("options", Object.entries(options).map(([value, label]) => ({
|
|
118
118
|
label: String(label),
|
|
119
119
|
value,
|
|
120
120
|
})));
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
export class DatePicker extends FieldBuilder {
|
|
124
|
-
kind =
|
|
124
|
+
kind = "date-picker";
|
|
125
125
|
static make(name) {
|
|
126
126
|
return new DatePicker(name);
|
|
127
127
|
}
|
|
128
128
|
minDate(value) {
|
|
129
|
-
return this.setProp(
|
|
129
|
+
return this.setProp("minDate", value);
|
|
130
130
|
}
|
|
131
131
|
maxDate(value) {
|
|
132
|
-
return this.setProp(
|
|
132
|
+
return this.setProp("maxDate", value);
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
135
|
export class DateTimePicker extends FieldBuilder {
|
|
136
|
-
kind =
|
|
136
|
+
kind = "date-time-picker";
|
|
137
137
|
static make(name) {
|
|
138
138
|
return new DateTimePicker(name);
|
|
139
139
|
}
|
|
140
140
|
minDate(value) {
|
|
141
|
-
return this.setProp(
|
|
141
|
+
return this.setProp("minDate", value);
|
|
142
142
|
}
|
|
143
143
|
maxDate(value) {
|
|
144
|
-
return this.setProp(
|
|
144
|
+
return this.setProp("maxDate", value);
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
export class ColorPicker extends FieldBuilder {
|
|
148
|
-
kind =
|
|
148
|
+
kind = "color-picker";
|
|
149
149
|
static make(name) {
|
|
150
150
|
return new ColorPicker(name);
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
153
|
export class CodeEditor extends FieldBuilder {
|
|
154
|
-
kind =
|
|
154
|
+
kind = "code-editor";
|
|
155
155
|
static make(name) {
|
|
156
156
|
return new CodeEditor(name);
|
|
157
157
|
}
|
|
158
158
|
language(value) {
|
|
159
|
-
return this.setProp(
|
|
159
|
+
return this.setProp("language", value);
|
|
160
160
|
}
|
|
161
161
|
rows(value) {
|
|
162
|
-
return this.setProp(
|
|
162
|
+
return this.setProp("rows", value);
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
165
|
export class TagsInput extends FieldBuilder {
|
|
166
|
-
kind =
|
|
166
|
+
kind = "tags-input";
|
|
167
167
|
static make(name) {
|
|
168
168
|
return new TagsInput(name);
|
|
169
169
|
}
|
|
170
170
|
placeholder(value) {
|
|
171
|
-
return this.setProp(
|
|
171
|
+
return this.setProp("placeholder", value);
|
|
172
172
|
}
|
|
173
173
|
maxTags(value) {
|
|
174
|
-
return this.setProp(
|
|
174
|
+
return this.setProp("maxTags", value);
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
177
|
export class RichEditor extends FieldBuilder {
|
|
178
|
-
kind =
|
|
178
|
+
kind = "rich-editor";
|
|
179
179
|
static make(name) {
|
|
180
180
|
return new RichEditor(name);
|
|
181
181
|
}
|
|
182
182
|
rows(value) {
|
|
183
|
-
return this.setProp(
|
|
183
|
+
return this.setProp("rows", value);
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
186
|
export class RichBox extends FieldBuilder {
|
|
187
|
-
kind =
|
|
187
|
+
kind = "rich-box";
|
|
188
188
|
static make(name) {
|
|
189
|
-
const dot = name.indexOf(
|
|
189
|
+
const dot = name.indexOf(".");
|
|
190
190
|
const instance = new RichBox(dot === -1 ? name : name.slice(0, dot));
|
|
191
191
|
if (dot !== -1)
|
|
192
192
|
instance.json(name.slice(dot + 1));
|
|
193
193
|
return instance;
|
|
194
194
|
}
|
|
195
195
|
json(property) {
|
|
196
|
-
this.setProp(
|
|
196
|
+
this.setProp("json", true);
|
|
197
197
|
if (property != null)
|
|
198
|
-
this.setProp(
|
|
198
|
+
this.setProp("jsonProperty", property);
|
|
199
199
|
return this;
|
|
200
200
|
}
|
|
201
201
|
theme(value) {
|
|
202
|
-
return this.setProp(
|
|
202
|
+
return this.setProp("theme", value);
|
|
203
203
|
}
|
|
204
204
|
height(value) {
|
|
205
|
-
return this.setProp(
|
|
205
|
+
return this.setProp("height", typeof value === "number" ? `${value}px` : value);
|
|
206
206
|
}
|
|
207
207
|
placeholder(value) {
|
|
208
|
-
return this.setProp(
|
|
208
|
+
return this.setProp("placeholder", value);
|
|
209
209
|
}
|
|
210
210
|
toolbar(config) {
|
|
211
|
-
return this.setProp(
|
|
211
|
+
return this.setProp("toolbar", config);
|
|
212
212
|
}
|
|
213
213
|
formats(list) {
|
|
214
|
-
return this.setProp(
|
|
214
|
+
return this.setProp("formats", list);
|
|
215
215
|
}
|
|
216
216
|
readOnly(value = true) {
|
|
217
|
-
return this.setProp(
|
|
217
|
+
return this.setProp("readOnly", value);
|
|
218
218
|
}
|
|
219
219
|
modules(config) {
|
|
220
|
-
return this.setProp(
|
|
220
|
+
return this.setProp("modules", config);
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
223
|
class UploadFieldBuilder extends FieldBuilder {
|
|
224
224
|
disk(name) {
|
|
225
|
-
return this.setProp(
|
|
225
|
+
return this.setProp("disk", name);
|
|
226
226
|
}
|
|
227
227
|
directory(path) {
|
|
228
|
-
return this.setProp(
|
|
228
|
+
return this.setProp("directory", path);
|
|
229
229
|
}
|
|
230
230
|
visibility(value) {
|
|
231
|
-
return this.setProp(
|
|
231
|
+
return this.setProp("visibility", value);
|
|
232
232
|
}
|
|
233
233
|
multiple(value = true) {
|
|
234
|
-
return this.setProp(
|
|
234
|
+
return this.setProp("multiple", value);
|
|
235
235
|
}
|
|
236
236
|
maxFiles(value) {
|
|
237
|
-
return this.setProp(
|
|
237
|
+
return this.setProp("maxFiles", value);
|
|
238
238
|
}
|
|
239
239
|
acceptedFileTypes(types) {
|
|
240
|
-
return this.setProp(
|
|
240
|
+
return this.setProp("acceptedFileTypes", types);
|
|
241
241
|
}
|
|
242
242
|
maxSize(kilobytes) {
|
|
243
|
-
return this.setProp(
|
|
243
|
+
return this.setProp("maxSize", kilobytes);
|
|
244
244
|
}
|
|
245
245
|
}
|
|
246
246
|
export class ImageUpload extends UploadFieldBuilder {
|
|
247
|
-
kind =
|
|
247
|
+
kind = "image-upload";
|
|
248
248
|
static make(name) {
|
|
249
249
|
return new ImageUpload(name);
|
|
250
250
|
}
|
|
251
251
|
collection(name) {
|
|
252
|
-
return this.setProp(
|
|
252
|
+
return this.setProp("collection", name);
|
|
253
253
|
}
|
|
254
254
|
shape(value) {
|
|
255
|
-
return this.setProp(
|
|
255
|
+
return this.setProp("shape", value);
|
|
256
256
|
}
|
|
257
257
|
croppable(value = true) {
|
|
258
|
-
return this.setProp(
|
|
258
|
+
return this.setProp("croppable", value);
|
|
259
259
|
}
|
|
260
260
|
aspectRatio(value) {
|
|
261
|
-
return this.setProp(
|
|
261
|
+
return this.setProp("aspectRatio", value);
|
|
262
262
|
}
|
|
263
263
|
}
|
|
264
264
|
export class FileUpload extends UploadFieldBuilder {
|
|
265
|
-
kind =
|
|
265
|
+
kind = "file-upload";
|
|
266
266
|
static make(name) {
|
|
267
267
|
return new FileUpload(name);
|
|
268
268
|
}
|
|
269
269
|
}
|
|
270
270
|
export class Repeater extends FieldBuilder {
|
|
271
|
-
kind =
|
|
271
|
+
kind = "repeater";
|
|
272
272
|
static make(name) {
|
|
273
273
|
return new Repeater(name);
|
|
274
274
|
}
|
|
@@ -277,15 +277,15 @@ export class Repeater extends FieldBuilder {
|
|
|
277
277
|
return this;
|
|
278
278
|
}
|
|
279
279
|
minItems(value) {
|
|
280
|
-
return this.setProp(
|
|
280
|
+
return this.setProp("minItems", value);
|
|
281
281
|
}
|
|
282
282
|
maxItems(value) {
|
|
283
|
-
return this.setProp(
|
|
283
|
+
return this.setProp("maxItems", value);
|
|
284
284
|
}
|
|
285
285
|
addActionLabel(value) {
|
|
286
|
-
return this.setProp(
|
|
286
|
+
return this.setProp("addActionLabel", value);
|
|
287
287
|
}
|
|
288
288
|
}
|
|
289
|
-
export { validateFormPayload } from
|
|
290
|
-
export { collectJsonArrayFields, collectJsonTextareaFields, parseJsonArrayFields, parseJsonTextareaFields, stringifyJsonTextareaFields, } from
|
|
289
|
+
export { validateFormPayload } from "./validation.js";
|
|
290
|
+
export { collectJsonArrayFields, collectJsonTextareaFields, parseJsonArrayFields, parseJsonTextareaFields, stringifyJsonTextareaFields, } from "./json-fields.js";
|
|
291
291
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type SchemaNode } from
|
|
1
|
+
import { type SchemaNode } from "@nestjs-dash/support";
|
|
2
2
|
export declare function collectJsonArrayFields(node: SchemaNode | undefined | null): SchemaNode[];
|
|
3
3
|
export declare function parseJsonArrayFields(body: Record<string, unknown>, form: SchemaNode | undefined | null): Record<string, unknown>;
|
|
4
4
|
export declare function collectJsonTextareaFields(node: SchemaNode | undefined | null): SchemaNode[];
|