mlform 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 +132 -0
- package/dist/FieldStrategy-pPekBtH-.js +2318 -0
- package/dist/ModelTypes-B9_veCKB.js +5 -0
- package/dist/ReportStrategy-DY3GC_mJ.js +23 -0
- package/dist/boolean-field-Cd3uhIPj.js +104 -0
- package/dist/category-field-D_Ms1x9u.js +73 -0
- package/dist/classifier-prediction-C5QzorTo.js +193 -0
- package/dist/custom-element-ttkHUa8w.js +13 -0
- package/dist/date-field-Cg_ja679.js +162 -0
- package/dist/error-card-BwjPChwf.js +195 -0
- package/dist/field-wrapper-DqIQl76d.js +177 -0
- package/dist/ml-layout-Dx63KKf7.js +332 -0
- package/dist/mlform/extensions.mjs +38 -0
- package/dist/mlform/strategies.mjs +292 -0
- package/dist/mlform.mjs +709 -0
- package/dist/number-field-CC2DrVEb.js +165 -0
- package/dist/property-jKFNMQpR.js +561 -0
- package/dist/range-field-Cr7LEtsJ.js +98 -0
- package/dist/regressor-prediction-C18dHlfK.js +236 -0
- package/dist/src/core/app/DescriptorItem.d.ts +6 -0
- package/dist/src/core/app/DescriptorRegistry.d.ts +13 -0
- package/dist/src/core/app/DescriptorService.d.ts +22 -0
- package/dist/src/core/app/DescriptorStrategy.d.ts +11 -0
- package/dist/src/core/app/index.d.ts +4 -0
- package/dist/src/core/domain/index.d.ts +24 -0
- package/dist/src/core/index.d.ts +3 -0
- package/dist/src/core/ui/error-card.d.ts +38 -0
- package/dist/src/core/ui/field-wrapper.d.ts +23 -0
- package/dist/src/core/ui/index.d.ts +3 -0
- package/dist/src/core/ui/ml-layout.d.ts +23 -0
- package/dist/src/extensions/app/FieldStrategy.d.ts +10 -0
- package/dist/src/extensions/app/ReportStrategy.d.ts +9 -0
- package/dist/src/extensions/app/index.d.ts +2 -0
- package/dist/src/extensions/domain/BaseField.d.ts +7 -0
- package/dist/src/extensions/domain/BaseModel.d.ts +6 -0
- package/dist/src/extensions/domain/index.d.ts +2 -0
- package/dist/src/extensions/index.d.ts +3 -0
- package/dist/src/extensions/ui/field-element.d.ts +9 -0
- package/dist/src/extensions/ui/index.d.ts +1 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/mlform/index.d.ts +1 -0
- package/dist/src/mlform/mlform.d.ts +27 -0
- package/dist/src/mlform/mlform.types.d.ts +11 -0
- package/dist/src/strategies/app/BooleanStrategy.d.ts +12 -0
- package/dist/src/strategies/app/CategoryStrategy.d.ts +13 -0
- package/dist/src/strategies/app/ClassifierStrategy.d.ts +15 -0
- package/dist/src/strategies/app/DateStrategy.d.ts +15 -0
- package/dist/src/strategies/app/NumberStrategy.d.ts +29 -0
- package/dist/src/strategies/app/RegressorStrategy.d.ts +15 -0
- package/dist/src/strategies/app/TextStrategy.d.ts +16 -0
- package/dist/src/strategies/app/index.d.ts +7 -0
- package/dist/src/strategies/domain/BooleanField.d.ts +10 -0
- package/dist/src/strategies/domain/CategoryField.d.ts +11 -0
- package/dist/src/strategies/domain/ClassifierModel.d.ts +11 -0
- package/dist/src/strategies/domain/DateField.d.ts +13 -0
- package/dist/src/strategies/domain/FieldTypes.d.ts +7 -0
- package/dist/src/strategies/domain/ModelTypes.d.ts +4 -0
- package/dist/src/strategies/domain/NumberField.d.ts +15 -0
- package/dist/src/strategies/domain/RegressorModel.d.ts +11 -0
- package/dist/src/strategies/domain/TextField.d.ts +14 -0
- package/dist/src/strategies/domain/index.d.ts +9 -0
- package/dist/src/strategies/index.d.ts +1 -0
- package/dist/src/strategies/ui/boolean-field.d.ts +13 -0
- package/dist/src/strategies/ui/category-field.d.ts +14 -0
- package/dist/src/strategies/ui/classifier-prediction.d.ts +39 -0
- package/dist/src/strategies/ui/date-field.d.ts +18 -0
- package/dist/src/strategies/ui/index.d.ts +8 -0
- package/dist/src/strategies/ui/number-field.d.ts +19 -0
- package/dist/src/strategies/ui/range-field.d.ts +17 -0
- package/dist/src/strategies/ui/regressor-prediction.d.ts +29 -0
- package/dist/src/strategies/ui/text-field.d.ts +17 -0
- package/dist/state-CLlTRyl1.js +12 -0
- package/dist/test/_fixtures/DummyField.d.ts +9 -0
- package/dist/test/setup.d.ts +1 -0
- package/dist/test/unit/DummyField.test.d.ts +1 -0
- package/dist/text-field-DwP-Fa1w.js +114 -0
- package/package.json +57 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { F as h } from "../FieldStrategy-pPekBtH-.js";
|
|
2
|
+
import { B as x, a as y, R as C } from "../ReportStrategy-DY3GC_mJ.js";
|
|
3
|
+
import { i as o, a as l } from "../property-jKFNMQpR.js";
|
|
4
|
+
import { r as d } from "../state-CLlTRyl1.js";
|
|
5
|
+
var p = Object.defineProperty, c = (s, t, a, m) => {
|
|
6
|
+
for (var e = void 0, r = s.length - 1, i; r >= 0; r--)
|
|
7
|
+
(i = s[r]) && (e = i(t, a, e) || e);
|
|
8
|
+
return e && p(t, a, e), e;
|
|
9
|
+
};
|
|
10
|
+
class n extends o {
|
|
11
|
+
static baseStyles = l`
|
|
12
|
+
* {
|
|
13
|
+
box-sizing: border-box;
|
|
14
|
+
}
|
|
15
|
+
`;
|
|
16
|
+
connectedCallback() {
|
|
17
|
+
super.connectedCallback(), this.value = void 0, this.dispatchState("empty");
|
|
18
|
+
}
|
|
19
|
+
dispatchState(t, a = "") {
|
|
20
|
+
this.dispatchEvent(
|
|
21
|
+
new CustomEvent("field-state", {
|
|
22
|
+
detail: { state: t, message: a, value: this.value },
|
|
23
|
+
bubbles: !0,
|
|
24
|
+
composed: !0
|
|
25
|
+
})
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
c([
|
|
30
|
+
d()
|
|
31
|
+
], n.prototype, "value");
|
|
32
|
+
export {
|
|
33
|
+
x as BaseFieldSchema,
|
|
34
|
+
y as BaseModelSchema,
|
|
35
|
+
n as FieldElement,
|
|
36
|
+
h as FieldStrategy,
|
|
37
|
+
C as ReportStrategy
|
|
38
|
+
};
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
import { s as i, o as a, e as o, b as E, d as r, a as u, n, i as d, f as h, t as M, F as l } from "../FieldStrategy-pPekBtH-.js";
|
|
2
|
+
import { F as s, M as p } from "../ModelTypes-B9_veCKB.js";
|
|
3
|
+
import { B as m, a as S, R as A } from "../ReportStrategy-DY3GC_mJ.js";
|
|
4
|
+
const T = i({
|
|
5
|
+
...m.shape,
|
|
6
|
+
type: o(s.BOOLEAN),
|
|
7
|
+
value: a(E())
|
|
8
|
+
}), _ = "The value must match one of the allowed options", L = (e, t) => !(t === void 0 || e.includes(t)), b = i({
|
|
9
|
+
...m.shape,
|
|
10
|
+
type: o(s.CATEGORY),
|
|
11
|
+
value: a(u()),
|
|
12
|
+
options: r(u()).min(1)
|
|
13
|
+
}).check((e) => {
|
|
14
|
+
L(e.value.options, e.value.value) && e.issues.push({
|
|
15
|
+
code: "custom",
|
|
16
|
+
path: ["value"],
|
|
17
|
+
message: _,
|
|
18
|
+
input: e.value,
|
|
19
|
+
continue: !0
|
|
20
|
+
});
|
|
21
|
+
}), y = i({
|
|
22
|
+
...S.shape,
|
|
23
|
+
type: o(p.CLASSIFIER),
|
|
24
|
+
mapping: a(r(u().min(1))),
|
|
25
|
+
probabilities: a(
|
|
26
|
+
r(r(n().min(0).max(1)).min(1)).min(1)
|
|
27
|
+
),
|
|
28
|
+
details: E().default(!1)
|
|
29
|
+
}), N = "The minimum date must be earlier than or equal to the maximum date", R = "The selected date must be later than or equal to the minimum date", O = "The selected date must be earlier than or equal to the maximum date", v = (e, t) => !(e === void 0 || t === void 0 || new Date(e) <= new Date(t)), I = i({
|
|
30
|
+
...m.shape,
|
|
31
|
+
type: o(s.DATE),
|
|
32
|
+
value: a(h()),
|
|
33
|
+
min: a(h()),
|
|
34
|
+
max: a(h()),
|
|
35
|
+
step: a(d().min(1).default(1))
|
|
36
|
+
}).check((e) => {
|
|
37
|
+
v(e.value.min, e.value.max) && e.issues.push({
|
|
38
|
+
code: "custom",
|
|
39
|
+
path: ["min"],
|
|
40
|
+
message: N,
|
|
41
|
+
input: e.value,
|
|
42
|
+
continue: !0
|
|
43
|
+
}), v(e.value.value, e.value.max) && e.issues.push({
|
|
44
|
+
code: "custom",
|
|
45
|
+
path: ["value"],
|
|
46
|
+
message: O,
|
|
47
|
+
input: e.value,
|
|
48
|
+
continue: !0
|
|
49
|
+
}), v(e.value.min, e.value.value) && e.issues.push({
|
|
50
|
+
code: "custom",
|
|
51
|
+
path: ["min"],
|
|
52
|
+
message: R,
|
|
53
|
+
input: e.value,
|
|
54
|
+
continue: !0
|
|
55
|
+
});
|
|
56
|
+
}), C = "The minimum value must be less than or equal to the maximum value", G = "The selected value must be greater than or equal to the minimum value", f = "The selected value must be less than or equal to the maximum value", c = (e, t) => !(e === void 0 || t === void 0 || e <= t), V = i({
|
|
57
|
+
...m.shape,
|
|
58
|
+
type: o(s.NUMBER),
|
|
59
|
+
min: a(n()),
|
|
60
|
+
max: a(n()),
|
|
61
|
+
step: a(n().positive().default(1)),
|
|
62
|
+
placeholder: a(u()),
|
|
63
|
+
value: a(n()),
|
|
64
|
+
unit: a(u())
|
|
65
|
+
}).check((e) => {
|
|
66
|
+
c(e.value.min, e.value.max) && e.issues.push({
|
|
67
|
+
code: "custom",
|
|
68
|
+
path: ["min"],
|
|
69
|
+
message: C,
|
|
70
|
+
input: e.value,
|
|
71
|
+
continue: !0
|
|
72
|
+
}), c(e.value.min, e.value.value) && e.issues.push({
|
|
73
|
+
code: "custom",
|
|
74
|
+
path: ["min"],
|
|
75
|
+
message: G,
|
|
76
|
+
input: e.value,
|
|
77
|
+
continue: !0
|
|
78
|
+
}), c(e.value.value, e.value.max) && e.issues.push({
|
|
79
|
+
code: "custom",
|
|
80
|
+
path: ["value"],
|
|
81
|
+
message: f,
|
|
82
|
+
input: e.value,
|
|
83
|
+
continue: !0
|
|
84
|
+
});
|
|
85
|
+
}), B = i({
|
|
86
|
+
...S.shape,
|
|
87
|
+
type: o(p.REGRESSOR),
|
|
88
|
+
values: a(r(n()).min(1)),
|
|
89
|
+
unit: a(u()),
|
|
90
|
+
interval: a(M([n(), n()]))
|
|
91
|
+
}), D = "Invalid regex pattern", F = "Minimum length must be less than or equal to maximum length", U = "Minimum length is <<minLength>> characters", X = "Maximum length of <<maxLength>> characters exceeded.", q = (e) => {
|
|
92
|
+
if (e === void 0) return !0;
|
|
93
|
+
try {
|
|
94
|
+
return new RegExp(e), !0;
|
|
95
|
+
} catch {
|
|
96
|
+
return !1;
|
|
97
|
+
}
|
|
98
|
+
}, g = (e, t) => !(e === void 0 || t === void 0 || e <= t), w = i({
|
|
99
|
+
...m.shape,
|
|
100
|
+
type: o(s.TEXT),
|
|
101
|
+
value: a(u()),
|
|
102
|
+
placeholder: a(u()),
|
|
103
|
+
minLength: a(d().min(0)),
|
|
104
|
+
maxLength: a(d().min(0)),
|
|
105
|
+
pattern: a(u())
|
|
106
|
+
}).check((e) => {
|
|
107
|
+
q(e.value.pattern) || e.issues.push({
|
|
108
|
+
code: "custom",
|
|
109
|
+
message: D,
|
|
110
|
+
input: e.value,
|
|
111
|
+
continue: !0
|
|
112
|
+
}), g(e.value.minLength, e.value.maxLength) && e.issues.push({
|
|
113
|
+
code: "custom",
|
|
114
|
+
path: ["minLength"],
|
|
115
|
+
message: F,
|
|
116
|
+
input: e.value,
|
|
117
|
+
continue: !0
|
|
118
|
+
}), g(e.value.minLength, e.value.value?.length) && e.issues.push({
|
|
119
|
+
code: "custom",
|
|
120
|
+
path: ["minLength"],
|
|
121
|
+
message: U.replace(
|
|
122
|
+
"<<minLength>>",
|
|
123
|
+
e.value.minLength?.toString() || "0"
|
|
124
|
+
),
|
|
125
|
+
input: e.value,
|
|
126
|
+
continue: !0
|
|
127
|
+
}), g(e.value.value?.length, e.value.maxLength) && e.issues.push({
|
|
128
|
+
code: "custom",
|
|
129
|
+
path: ["value"],
|
|
130
|
+
message: X.replace(
|
|
131
|
+
"<<maxLength>>",
|
|
132
|
+
e.value.maxLength?.toString() || "infinity"
|
|
133
|
+
),
|
|
134
|
+
input: e.value,
|
|
135
|
+
continue: !0
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
class j extends l {
|
|
139
|
+
constructor() {
|
|
140
|
+
super(
|
|
141
|
+
s.BOOLEAN,
|
|
142
|
+
T,
|
|
143
|
+
() => import("../boolean-field-Cd3uhIPj.js")
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
buildControl(t) {
|
|
147
|
+
return {
|
|
148
|
+
tag: "boolean-field",
|
|
149
|
+
props: {
|
|
150
|
+
defaultValue: t.value !== void 0 ? String(t.value) : void 0
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
class $ extends l {
|
|
156
|
+
constructor() {
|
|
157
|
+
super(
|
|
158
|
+
s.CATEGORY,
|
|
159
|
+
b,
|
|
160
|
+
() => import("../category-field-D_Ms1x9u.js")
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
buildControl(t) {
|
|
164
|
+
return {
|
|
165
|
+
tag: "category-field",
|
|
166
|
+
props: {
|
|
167
|
+
defaultValue: t.value ?? "",
|
|
168
|
+
optionList: t.options
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
class z extends A {
|
|
174
|
+
constructor() {
|
|
175
|
+
super(
|
|
176
|
+
p.CLASSIFIER,
|
|
177
|
+
y,
|
|
178
|
+
() => import("../classifier-prediction-C5QzorTo.js")
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
buildControl(t) {
|
|
182
|
+
return {
|
|
183
|
+
tag: "classifier-prediction",
|
|
184
|
+
props: {
|
|
185
|
+
title: t.title,
|
|
186
|
+
mapping: t.mapping,
|
|
187
|
+
probabilities: t.probabilities,
|
|
188
|
+
details: t.details.toString()
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
class H extends l {
|
|
194
|
+
constructor() {
|
|
195
|
+
super(
|
|
196
|
+
s.DATE,
|
|
197
|
+
I,
|
|
198
|
+
() => import("../date-field-Cg_ja679.js")
|
|
199
|
+
);
|
|
200
|
+
}
|
|
201
|
+
buildControl(t) {
|
|
202
|
+
return {
|
|
203
|
+
tag: "date-field",
|
|
204
|
+
props: {
|
|
205
|
+
min: t.min ? new Date(t.min).toISOString() : void 0,
|
|
206
|
+
max: t.max ? new Date(t.max).toISOString() : void 0,
|
|
207
|
+
step: t.step,
|
|
208
|
+
defaultValue: t.value ? new Date(t.value).toISOString() : void 0
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
class J extends l {
|
|
214
|
+
constructor() {
|
|
215
|
+
super(s.NUMBER, V, async () => {
|
|
216
|
+
await Promise.resolve(), import("../range-field-Cr7LEtsJ.js"), import("../number-field-CC2DrVEb.js");
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
buildControl(t) {
|
|
220
|
+
return t.min != null && t.max != null && !t.required && t.value != null ? {
|
|
221
|
+
tag: "range-field",
|
|
222
|
+
props: {
|
|
223
|
+
unit: t.unit,
|
|
224
|
+
min: t.min,
|
|
225
|
+
max: t.max,
|
|
226
|
+
step: t.step,
|
|
227
|
+
defaultValue: t.value
|
|
228
|
+
},
|
|
229
|
+
slot: "inputs"
|
|
230
|
+
} : {
|
|
231
|
+
tag: "number-field",
|
|
232
|
+
props: {
|
|
233
|
+
unit: t.unit,
|
|
234
|
+
min: t.min,
|
|
235
|
+
max: t.max,
|
|
236
|
+
step: t.step,
|
|
237
|
+
defaultValue: t.value,
|
|
238
|
+
placeholder: t.placeholder
|
|
239
|
+
}
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
class K extends A {
|
|
244
|
+
constructor() {
|
|
245
|
+
super(
|
|
246
|
+
p.REGRESSOR,
|
|
247
|
+
B,
|
|
248
|
+
() => import("../regressor-prediction-C18dHlfK.js")
|
|
249
|
+
);
|
|
250
|
+
}
|
|
251
|
+
buildControl(t) {
|
|
252
|
+
return {
|
|
253
|
+
tag: "regressor-prediction",
|
|
254
|
+
props: {
|
|
255
|
+
title: t.title,
|
|
256
|
+
values: t.values,
|
|
257
|
+
unit: t.unit,
|
|
258
|
+
interval: t.interval
|
|
259
|
+
}
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
class Q extends l {
|
|
264
|
+
constructor() {
|
|
265
|
+
super(
|
|
266
|
+
s.TEXT,
|
|
267
|
+
w,
|
|
268
|
+
() => import("../text-field-DwP-Fa1w.js")
|
|
269
|
+
);
|
|
270
|
+
}
|
|
271
|
+
buildControl(t) {
|
|
272
|
+
return {
|
|
273
|
+
tag: "text-field",
|
|
274
|
+
props: {
|
|
275
|
+
minlength: t.minLength,
|
|
276
|
+
maxlength: t.maxLength,
|
|
277
|
+
placeholder: t.placeholder,
|
|
278
|
+
defaultValue: t.value,
|
|
279
|
+
pattern: t.pattern
|
|
280
|
+
}
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
export {
|
|
285
|
+
j as BooleanStrategy,
|
|
286
|
+
$ as CategoryStrategy,
|
|
287
|
+
z as ClassifierStrategy,
|
|
288
|
+
H as DateStrategy,
|
|
289
|
+
J as NumberStrategy,
|
|
290
|
+
K as RegressorStrategy,
|
|
291
|
+
Q as TextStrategy
|
|
292
|
+
};
|