forked from ProcessMaker/processmaker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdata-formats.js
More file actions
49 lines (40 loc) · 1.15 KB
/
data-formats.js
File metadata and controls
49 lines (40 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import { DataTypeProperty, Currencies } from "@processmaker/screen-builder";
const formats = DataTypeProperty.config.options;
const masks = Currencies;
export default class {
static formats() {
if (!formats.find((format) => format.value == "boolean")) {
formats.push({ value: "boolean", content: "Boolean" });
}
if (!formats.find((format) => format.value == "array")) {
formats.push({ value: "array", content: "Array" });
formats.push({ value: "file", content: "File" });
}
return formats;
}
static format(value) {
let format = { value: "string", content: "Text" };
if (value) {
const found = this.formats().find((option) => option.value == value);
if (found) {
format = found;
}
}
return format;
}
static masks() {
return masks;
}
static mask(value) {
let mask = null;
if (value) {
if (typeof value === "object" && value.code) {
mask = this.masks().find((option) => option.code == value.code);
}
if (typeof value === "string") {
mask = this.masks().find((option) => option.code == value);
}
}
return mask;
}
}