asv-hlps 1.3.52 → 1.3.53

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.
@@ -0,0 +1,6 @@
1
+ export declare enum FormErrors {
2
+ REQUIRED = "This field is required",
3
+ DIGIT = "Please enter a digit",
4
+ CHECK_UNIQUE = "This name is already taken",
5
+ EMAIL = "Please enter a valid email"
6
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FormErrors = void 0;
4
+ var FormErrors;
5
+ (function (FormErrors) {
6
+ FormErrors["REQUIRED"] = "This field is required";
7
+ FormErrors["DIGIT"] = "Please enter a digit";
8
+ FormErrors["CHECK_UNIQUE"] = "This name is already taken";
9
+ FormErrors["EMAIL"] = "Please enter a valid email";
10
+ })(FormErrors || (exports.FormErrors = FormErrors = {}));
@@ -8,6 +8,19 @@ export declare const schemaNaCoSh: (url: string, tob: any, codeMaxLenth?: number
8
8
  code: undefined;
9
9
  shortname: undefined;
10
10
  }, "">;
11
+ export declare const schemaNaCoShIcon: (url: string, tob: any, codeMaxLenth?: number) => yup.ObjectSchema<{
12
+ name: string;
13
+ code: string;
14
+ shortname: string;
15
+ iconName: string;
16
+ iconPack: string;
17
+ }, yup.AnyObject, {
18
+ name: undefined;
19
+ code: undefined;
20
+ shortname: undefined;
21
+ iconName: undefined;
22
+ iconPack: undefined;
23
+ }, "">;
11
24
  export declare const schemaNaCo: (url: string, tob: any, codeMaxLenth?: number) => yup.ObjectSchema<{
12
25
  name: string;
13
26
  code: string;
@@ -15,12 +28,44 @@ export declare const schemaNaCo: (url: string, tob: any, codeMaxLenth?: number)
15
28
  name: undefined;
16
29
  code: undefined;
17
30
  }, "">;
31
+ export declare const schemaNaCoIcon: (url: string, tob: any, codeMaxLenth?: number) => yup.ObjectSchema<{
32
+ name: string;
33
+ code: string;
34
+ iconName: string;
35
+ iconPack: string;
36
+ }, yup.AnyObject, {
37
+ name: undefined;
38
+ code: undefined;
39
+ iconName: undefined;
40
+ iconPack: undefined;
41
+ }, "">;
18
42
  export declare const schemaNa: (url: string, tob: any) => yup.ObjectSchema<{
19
43
  name: string;
20
44
  }, yup.AnyObject, {
21
45
  name: undefined;
22
46
  }, "">;
23
- export declare const schemaLogin: () => yup.ObjectSchema<{
47
+ export declare const schemaNaIcon: (url: string, tob: any) => yup.ObjectSchema<{
48
+ name: string;
49
+ iconName: string;
50
+ iconPack: string;
51
+ }, yup.AnyObject, {
52
+ name: undefined;
53
+ iconName: undefined;
54
+ iconPack: undefined;
55
+ }, "">;
56
+ export declare const schemaIcon: () => yup.ObjectSchema<{
57
+ iconName: string;
58
+ iconPack: string;
59
+ }, yup.AnyObject, {
60
+ iconName: undefined;
61
+ iconPack: undefined;
62
+ }, "">;
63
+ export declare const schemaSelect: () => yup.ObjectSchema<{
64
+ selectId: number;
65
+ }, yup.AnyObject, {
66
+ selectId: undefined;
67
+ }, "">;
68
+ export declare const schemaLogin: (t: any) => yup.ObjectSchema<{
24
69
  username: string;
25
70
  password: string;
26
71
  }, yup.AnyObject, {
@@ -28,8 +73,13 @@ export declare const schemaLogin: () => yup.ObjectSchema<{
28
73
  password: undefined;
29
74
  }, "">;
30
75
  export declare const yupValideUniqName: (url: string, tob: any) => yup.StringSchema<string, yup.AnyObject, undefined, "">;
31
- export declare const yupValideUniqEmail: (url: string, tob: any, isRequired?: boolean) => yup.StringSchema<string, yup.AnyObject, undefined, "">;
32
- export declare const yupValideUniqNumber: (url: string, tob: any, isRequired?: boolean) => yup.NumberSchema<number, yup.AnyObject, undefined, "">;
76
+ export declare const yupValideUniqEmail: (url: string, tob: any) => yup.StringSchema<string, yup.AnyObject, undefined, "">;
77
+ export declare const yupValideNoRequiredUniqEmail: (url: string, tob: any) => yup.StringSchema<string, yup.AnyObject, undefined, "">;
78
+ export declare const yupNoRequiredNumber: () => yup.NumberSchema<number, yup.AnyObject, undefined, "">;
79
+ export declare const yupRequiredNumber: () => yup.NumberSchema<number, yup.AnyObject, undefined, "">;
80
+ export declare const yupNoRequiredString: () => yup.StringSchema<string, yup.AnyObject, undefined, "">;
81
+ export declare const yupRequiredString: () => yup.StringSchema<string, yup.AnyObject, undefined, "">;
82
+ export declare const yupValideUniqNumber: (url: string, tob: any) => yup.NumberSchema<number, yup.AnyObject, undefined, "">;
83
+ export declare const yupValideNoRequiredUniqNumber: (url: string, tob: any) => yup.NumberSchema<number, yup.AnyObject, undefined, "">;
33
84
  export declare const yupValideUniqCode: (url: string, max: number, tob: any) => yup.StringSchema<string, yup.AnyObject, undefined, "">;
34
- export declare const yupValidateNoRequiredNumber: () => yup.StringSchema<string, yup.AnyObject, undefined, "">;
35
85
  export declare const formatSelectOptions: (objs: any[], propLabel?: string, propValue?: string) => any[];
@@ -35,28 +35,59 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
35
35
  return (mod && mod.__esModule) ? mod : { "default": mod };
36
36
  };
37
37
  Object.defineProperty(exports, "__esModule", { value: true });
38
- exports.formatSelectOptions = exports.yupValidateNoRequiredNumber = exports.yupValideUniqCode = exports.yupValideUniqNumber = exports.yupValideUniqEmail = exports.yupValideUniqName = exports.schemaLogin = exports.schemaNa = exports.schemaNaCo = exports.schemaNaCoSh = void 0;
38
+ exports.formatSelectOptions = exports.yupValideUniqCode = exports.yupValideNoRequiredUniqNumber = exports.yupValideUniqNumber = exports.yupRequiredString = exports.yupNoRequiredString = exports.yupRequiredNumber = exports.yupNoRequiredNumber = exports.yupValideNoRequiredUniqEmail = exports.yupValideUniqEmail = exports.yupValideUniqName = exports.schemaLogin = exports.schemaSelect = exports.schemaIcon = exports.schemaNaIcon = exports.schemaNa = exports.schemaNaCoIcon = exports.schemaNaCo = exports.schemaNaCoShIcon = exports.schemaNaCoSh = void 0;
39
39
  const axios_1 = __importDefault(require("axios"));
40
40
  const yup = __importStar(require("yup"));
41
+ const FormErrors_1 = require("./FormErrors");
41
42
  const schemaNaCoSh = (url, tob, codeMaxLenth = 4) => yup.object({
42
- name: (0, exports.yupValideUniqName)(url + "/checkUniqueName", tob),
43
- code: (0, exports.yupValideUniqCode)(url + "/checkUniqueCode", codeMaxLenth, tob),
43
+ name: (0, exports.yupValideUniqName)(`${url}/checkUniqueName`, tob),
44
+ code: (0, exports.yupValideUniqCode)(`${url}/checkUniqueCode`, codeMaxLenth, tob),
44
45
  shortname: (0, exports.yupValideUniqName)(url + "/checkUniqueShortname", tob),
45
46
  });
46
47
  exports.schemaNaCoSh = schemaNaCoSh;
48
+ const schemaNaCoShIcon = (url, tob, codeMaxLenth = 4) => yup.object({
49
+ name: (0, exports.yupValideUniqName)(`${url}/checkUniqueName`, tob),
50
+ code: (0, exports.yupValideUniqCode)(`${url}/checkUniqueCode`, codeMaxLenth, tob),
51
+ shortname: (0, exports.yupValideUniqName)(url + "/checkUniqueShortname", tob),
52
+ iconName: (0, exports.yupRequiredString)(),
53
+ iconPack: yup.string().notRequired().nullable(),
54
+ });
55
+ exports.schemaNaCoShIcon = schemaNaCoShIcon;
47
56
  const schemaNaCo = (url, tob, codeMaxLenth = 4) => yup.object({
48
- name: (0, exports.yupValideUniqName)(url + "/checkUniqueName", tob),
49
- code: (0, exports.yupValideUniqCode)(url + "/checkUniqueCode", codeMaxLenth, tob),
57
+ name: (0, exports.yupValideUniqName)(`${url}/checkUniqueName`, tob),
58
+ code: (0, exports.yupValideUniqCode)(`${url}/checkUniqueCode`, codeMaxLenth, tob),
50
59
  });
51
60
  exports.schemaNaCo = schemaNaCo;
61
+ const schemaNaCoIcon = (url, tob, codeMaxLenth = 4) => yup.object({
62
+ name: (0, exports.yupValideUniqName)(`${url}/checkUniqueName`, tob),
63
+ code: (0, exports.yupValideUniqCode)(`${url}/checkUniqueCode`, codeMaxLenth, tob),
64
+ iconName: (0, exports.yupRequiredString)(),
65
+ iconPack: yup.string().notRequired().nullable(),
66
+ });
67
+ exports.schemaNaCoIcon = schemaNaCoIcon;
52
68
  const schemaNa = (url, tob) => yup.object({
53
- name: (0, exports.yupValideUniqName)(url + "/checkUniqueName", tob),
69
+ name: (0, exports.yupValideUniqName)(`${url}/checkUniqueName`, tob),
54
70
  });
55
71
  exports.schemaNa = schemaNa;
56
- const schemaLogin = () => yup.object({
72
+ const schemaNaIcon = (url, tob) => yup.object({
73
+ name: (0, exports.yupValideUniqName)(`${url}/checkUniqueName`, tob),
74
+ iconName: (0, exports.yupRequiredString)(),
75
+ iconPack: yup.string().notRequired().nullable(),
76
+ });
77
+ exports.schemaNaIcon = schemaNaIcon;
78
+ const schemaIcon = () => yup.object({
79
+ iconName: (0, exports.yupRequiredString)(),
80
+ iconPack: yup.string().notRequired().nullable(),
81
+ });
82
+ exports.schemaIcon = schemaIcon;
83
+ const schemaSelect = () => yup.object({
84
+ selectId: yup.number().required(),
85
+ });
86
+ exports.schemaSelect = schemaSelect;
87
+ const schemaLogin = (t) => yup.object({
57
88
  // email: yup.string().required(t("Please enter Email")),
58
- username: yup.string().required("Please enter Email"),
59
- password: yup.string().required("Please enter Password"),
89
+ username: yup.string().required(t("Please enter Email")),
90
+ password: yup.string().required(t("Please enter Password")),
60
91
  // checkbox: yup.bool().oneOf([true]),
61
92
  });
62
93
  exports.schemaLogin = schemaLogin;
@@ -64,7 +95,7 @@ const yupValideUniqName = (url, tob) => {
64
95
  return yup
65
96
  .string()
66
97
  .required()
67
- .test("Check_name", "This name is already taken", (value) => {
98
+ .test("Check_name", FormErrors_1.FormErrors.CHECK_UNIQUE, (value) => {
68
99
  return new Promise((resolve) => __awaiter(void 0, void 0, void 0, function* () {
69
100
  const { data: res } = yield axios_1.default.post(url, { id: tob === null || tob === void 0 ? void 0 : tob.id, name: value });
70
101
  res ? resolve(true) : resolve(false);
@@ -72,48 +103,59 @@ const yupValideUniqName = (url, tob) => {
72
103
  });
73
104
  };
74
105
  exports.yupValideUniqName = yupValideUniqName;
75
- const yupValideUniqEmail = (url, tob, isRequired = true) => {
76
- if (isRequired) {
77
- return yup
78
- .string()
79
- .required("this value is required")
80
- .email("this value must be a valid email")
81
- .test("Check_name", "This name is already taken", (value) => {
82
- return new Promise((resolve) => __awaiter(void 0, void 0, void 0, function* () {
83
- const { data: res } = yield axios_1.default.post(url, { id: tob === null || tob === void 0 ? void 0 : tob.id, name: value });
84
- res ? resolve(true) : resolve(false);
85
- }));
86
- });
87
- }
88
- return yup.string().when((val) => {
89
- // if (val !== "") {
90
- if (val) {
91
- return yup
92
- .string()
93
- .email()
94
- .test("Check_name", "This name is already taken", (value) => {
95
- return new Promise((resolve) => __awaiter(void 0, void 0, void 0, function* () {
96
- const { data: res } = yield axios_1.default.post(url, { id: tob === null || tob === void 0 ? void 0 : tob.id, name: value });
97
- res ? resolve(true) : resolve(false);
98
- }));
99
- });
100
- }
106
+ const yupValideUniqEmail = (url, tob) => {
107
+ return yup
108
+ .string()
109
+ .email(FormErrors_1.FormErrors.EMAIL)
110
+ .required(FormErrors_1.FormErrors.REQUIRED)
111
+ .test("Check_name", FormErrors_1.FormErrors.CHECK_UNIQUE, (value) => {
112
+ return new Promise((resolve) => __awaiter(void 0, void 0, void 0, function* () {
113
+ const { data: res } = yield axios_1.default.post(url, { id: tob === null || tob === void 0 ? void 0 : tob.id, name: value });
114
+ res ? resolve(true) : resolve(false);
115
+ }));
101
116
  });
102
117
  };
103
118
  exports.yupValideUniqEmail = yupValideUniqEmail;
104
- const yupValideUniqNumber = (url, tob, isRequired = true) => {
105
- if (isRequired) {
106
- return yup
107
- .number()
108
- .required()
109
- .test("Check_name", "This name is already taken", (value) => {
110
- return new Promise((resolve) => __awaiter(void 0, void 0, void 0, function* () {
111
- const { data: res } = yield axios_1.default.post(url, { id: tob === null || tob === void 0 ? void 0 : tob.id, name: value });
112
- res ? resolve(true) : resolve(false);
113
- }));
114
- });
115
- }
116
- return yup.number().test("Check_name", "This name is already taken", (value) => {
119
+ const yupValideNoRequiredUniqEmail = (url, tob) => {
120
+ return yup
121
+ .string()
122
+ .email(FormErrors_1.FormErrors.EMAIL)
123
+ .nullable()
124
+ .test("Check_name", FormErrors_1.FormErrors.CHECK_UNIQUE, (value) => {
125
+ return new Promise((resolve) => __awaiter(void 0, void 0, void 0, function* () {
126
+ const { data: res } = yield axios_1.default.post(url, { id: tob === null || tob === void 0 ? void 0 : tob.id, name: value });
127
+ res ? resolve(true) : resolve(false);
128
+ }));
129
+ });
130
+ };
131
+ exports.yupValideNoRequiredUniqEmail = yupValideNoRequiredUniqEmail;
132
+ const yupNoRequiredNumber = () => {
133
+ return yup
134
+ .number()
135
+ .typeError(FormErrors_1.FormErrors.DIGIT)
136
+ .nullable()
137
+ .transform((_, val) => (val !== "" ? Number(val) : null));
138
+ // .moreThan(0, "Floor area cannot be negative")
139
+ };
140
+ exports.yupNoRequiredNumber = yupNoRequiredNumber;
141
+ const yupRequiredNumber = () => {
142
+ return yup.number().required(FormErrors_1.FormErrors.REQUIRED).typeError(FormErrors_1.FormErrors.DIGIT);
143
+ };
144
+ exports.yupRequiredNumber = yupRequiredNumber;
145
+ const yupNoRequiredString = () => {
146
+ return yup.string().nullable().notRequired();
147
+ };
148
+ exports.yupNoRequiredString = yupNoRequiredString;
149
+ const yupRequiredString = () => {
150
+ return yup.string().required(FormErrors_1.FormErrors.REQUIRED);
151
+ };
152
+ exports.yupRequiredString = yupRequiredString;
153
+ const yupValideUniqNumber = (url, tob) => {
154
+ return yup
155
+ .number()
156
+ .required(FormErrors_1.FormErrors.REQUIRED)
157
+ .typeError(FormErrors_1.FormErrors.DIGIT)
158
+ .test("Check_name", FormErrors_1.FormErrors.CHECK_UNIQUE, (value) => {
117
159
  return new Promise((resolve) => __awaiter(void 0, void 0, void 0, function* () {
118
160
  const { data: res } = yield axios_1.default.post(url, { id: tob === null || tob === void 0 ? void 0 : tob.id, name: value });
119
161
  res ? resolve(true) : resolve(false);
@@ -121,13 +163,27 @@ const yupValideUniqNumber = (url, tob, isRequired = true) => {
121
163
  });
122
164
  };
123
165
  exports.yupValideUniqNumber = yupValideUniqNumber;
166
+ const yupValideNoRequiredUniqNumber = (url, tob) => {
167
+ return (yup
168
+ .number()
169
+ .nullable()
170
+ // .typeError(FormErrors.DIGIT)
171
+ // .transform((_, val) => (val !== "" ? Number(val) : null))
172
+ .test("Check_name", FormErrors_1.FormErrors.CHECK_UNIQUE, (value) => {
173
+ return new Promise((resolve) => __awaiter(void 0, void 0, void 0, function* () {
174
+ const { data: res } = yield axios_1.default.post(url, { id: tob === null || tob === void 0 ? void 0 : tob.id, name: value });
175
+ res ? resolve(true) : resolve(false);
176
+ }));
177
+ }));
178
+ };
179
+ exports.yupValideNoRequiredUniqNumber = yupValideNoRequiredUniqNumber;
124
180
  const yupValideUniqCode = (url, max = 4, tob) => {
125
181
  return yup
126
182
  .string()
127
183
  .required()
128
184
  .min(2)
129
185
  .max(max)
130
- .test("Check_name", "This name is already taken", (value) => {
186
+ .test("Check_name", FormErrors_1.FormErrors.CHECK_UNIQUE, (value) => {
131
187
  return new Promise((resolve) => __awaiter(void 0, void 0, void 0, function* () {
132
188
  const { data: res } = yield axios_1.default.post(url, { id: tob === null || tob === void 0 ? void 0 : tob.id, name: value });
133
189
  res ? resolve(true) : resolve(false);
@@ -135,18 +191,6 @@ const yupValideUniqCode = (url, max = 4, tob) => {
135
191
  });
136
192
  };
137
193
  exports.yupValideUniqCode = yupValideUniqCode;
138
- const yupValidateNoRequiredNumber = () => {
139
- return yup
140
- .string()
141
- .nullable()
142
- .when((val) => {
143
- if (val) {
144
- return yup.number().nullable();
145
- }
146
- })
147
- .typeError("must be number");
148
- };
149
- exports.yupValidateNoRequiredNumber = yupValidateNoRequiredNumber;
150
194
  const formatSelectOptions = (objs, propLabel = "name", propValue = "id") => {
151
195
  if (!objs.length) {
152
196
  return objs;
@@ -1,9 +1,19 @@
1
1
  export default interface PdfmakeTextProps {
2
- text: string;
2
+ text: string | number;
3
3
  fontSize?: number;
4
4
  style?: string;
5
5
  alignment?: string;
6
6
  bold?: boolean;
7
7
  margin?: [number, number, number, number];
8
8
  nLine?: string;
9
+ fontFeatures?: string[];
10
+ lineHeight?: number;
11
+ italics?: boolean;
12
+ characterSpacing?: number;
13
+ color?: string;
14
+ background?: string;
15
+ markerColor?: string;
16
+ decoration?: string | string[];
17
+ decorationStyle?: string;
18
+ decorationColor?: string;
9
19
  }
@@ -0,0 +1,6 @@
1
+ export declare enum FormErrors {
2
+ REQUIRED = "This field is required",
3
+ DIGIT = "Please enter a digit",
4
+ CHECK_UNIQUE = "This name is already taken",
5
+ EMAIL = "Please enter a valid email"
6
+ }
@@ -0,0 +1,7 @@
1
+ export var FormErrors;
2
+ (function (FormErrors) {
3
+ FormErrors["REQUIRED"] = "This field is required";
4
+ FormErrors["DIGIT"] = "Please enter a digit";
5
+ FormErrors["CHECK_UNIQUE"] = "This name is already taken";
6
+ FormErrors["EMAIL"] = "Please enter a valid email";
7
+ })(FormErrors || (FormErrors = {}));
@@ -8,6 +8,19 @@ export declare const schemaNaCoSh: (url: string, tob: any, codeMaxLenth?: number
8
8
  code: undefined;
9
9
  shortname: undefined;
10
10
  }, "">;
11
+ export declare const schemaNaCoShIcon: (url: string, tob: any, codeMaxLenth?: number) => yup.ObjectSchema<{
12
+ name: string;
13
+ code: string;
14
+ shortname: string;
15
+ iconName: string;
16
+ iconPack: string;
17
+ }, yup.AnyObject, {
18
+ name: undefined;
19
+ code: undefined;
20
+ shortname: undefined;
21
+ iconName: undefined;
22
+ iconPack: undefined;
23
+ }, "">;
11
24
  export declare const schemaNaCo: (url: string, tob: any, codeMaxLenth?: number) => yup.ObjectSchema<{
12
25
  name: string;
13
26
  code: string;
@@ -15,12 +28,44 @@ export declare const schemaNaCo: (url: string, tob: any, codeMaxLenth?: number)
15
28
  name: undefined;
16
29
  code: undefined;
17
30
  }, "">;
31
+ export declare const schemaNaCoIcon: (url: string, tob: any, codeMaxLenth?: number) => yup.ObjectSchema<{
32
+ name: string;
33
+ code: string;
34
+ iconName: string;
35
+ iconPack: string;
36
+ }, yup.AnyObject, {
37
+ name: undefined;
38
+ code: undefined;
39
+ iconName: undefined;
40
+ iconPack: undefined;
41
+ }, "">;
18
42
  export declare const schemaNa: (url: string, tob: any) => yup.ObjectSchema<{
19
43
  name: string;
20
44
  }, yup.AnyObject, {
21
45
  name: undefined;
22
46
  }, "">;
23
- export declare const schemaLogin: () => yup.ObjectSchema<{
47
+ export declare const schemaNaIcon: (url: string, tob: any) => yup.ObjectSchema<{
48
+ name: string;
49
+ iconName: string;
50
+ iconPack: string;
51
+ }, yup.AnyObject, {
52
+ name: undefined;
53
+ iconName: undefined;
54
+ iconPack: undefined;
55
+ }, "">;
56
+ export declare const schemaIcon: () => yup.ObjectSchema<{
57
+ iconName: string;
58
+ iconPack: string;
59
+ }, yup.AnyObject, {
60
+ iconName: undefined;
61
+ iconPack: undefined;
62
+ }, "">;
63
+ export declare const schemaSelect: () => yup.ObjectSchema<{
64
+ selectId: number;
65
+ }, yup.AnyObject, {
66
+ selectId: undefined;
67
+ }, "">;
68
+ export declare const schemaLogin: (t: any) => yup.ObjectSchema<{
24
69
  username: string;
25
70
  password: string;
26
71
  }, yup.AnyObject, {
@@ -28,8 +73,13 @@ export declare const schemaLogin: () => yup.ObjectSchema<{
28
73
  password: undefined;
29
74
  }, "">;
30
75
  export declare const yupValideUniqName: (url: string, tob: any) => yup.StringSchema<string, yup.AnyObject, undefined, "">;
31
- export declare const yupValideUniqEmail: (url: string, tob: any, isRequired?: boolean) => yup.StringSchema<string, yup.AnyObject, undefined, "">;
32
- export declare const yupValideUniqNumber: (url: string, tob: any, isRequired?: boolean) => yup.NumberSchema<number, yup.AnyObject, undefined, "">;
76
+ export declare const yupValideUniqEmail: (url: string, tob: any) => yup.StringSchema<string, yup.AnyObject, undefined, "">;
77
+ export declare const yupValideNoRequiredUniqEmail: (url: string, tob: any) => yup.StringSchema<string, yup.AnyObject, undefined, "">;
78
+ export declare const yupNoRequiredNumber: () => yup.NumberSchema<number, yup.AnyObject, undefined, "">;
79
+ export declare const yupRequiredNumber: () => yup.NumberSchema<number, yup.AnyObject, undefined, "">;
80
+ export declare const yupNoRequiredString: () => yup.StringSchema<string, yup.AnyObject, undefined, "">;
81
+ export declare const yupRequiredString: () => yup.StringSchema<string, yup.AnyObject, undefined, "">;
82
+ export declare const yupValideUniqNumber: (url: string, tob: any) => yup.NumberSchema<number, yup.AnyObject, undefined, "">;
83
+ export declare const yupValideNoRequiredUniqNumber: (url: string, tob: any) => yup.NumberSchema<number, yup.AnyObject, undefined, "">;
33
84
  export declare const yupValideUniqCode: (url: string, max: number, tob: any) => yup.StringSchema<string, yup.AnyObject, undefined, "">;
34
- export declare const yupValidateNoRequiredNumber: () => yup.StringSchema<string, yup.AnyObject, undefined, "">;
35
85
  export declare const formatSelectOptions: (objs: any[], propLabel?: string, propValue?: string) => any[];
@@ -9,106 +9,140 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  };
10
10
  import axios from "axios";
11
11
  import * as yup from "yup";
12
+ import { FormErrors } from "./FormErrors";
12
13
  export const schemaNaCoSh = (url, tob, codeMaxLenth = 4) => yup.object({
13
- name: yupValideUniqName(url + "/checkUniqueName", tob),
14
- code: yupValideUniqCode(url + "/checkUniqueCode", codeMaxLenth, tob),
14
+ name: yupValideUniqName(`${url}/checkUniqueName`, tob),
15
+ code: yupValideUniqCode(`${url}/checkUniqueCode`, codeMaxLenth, tob),
15
16
  shortname: yupValideUniqName(url + "/checkUniqueShortname", tob),
16
17
  });
18
+ export const schemaNaCoShIcon = (url, tob, codeMaxLenth = 4) => yup.object({
19
+ name: yupValideUniqName(`${url}/checkUniqueName`, tob),
20
+ code: yupValideUniqCode(`${url}/checkUniqueCode`, codeMaxLenth, tob),
21
+ shortname: yupValideUniqName(url + "/checkUniqueShortname", tob),
22
+ iconName: yupRequiredString(),
23
+ iconPack: yup.string().notRequired().nullable(),
24
+ });
17
25
  export const schemaNaCo = (url, tob, codeMaxLenth = 4) => yup.object({
18
- name: yupValideUniqName(url + "/checkUniqueName", tob),
19
- code: yupValideUniqCode(url + "/checkUniqueCode", codeMaxLenth, tob),
26
+ name: yupValideUniqName(`${url}/checkUniqueName`, tob),
27
+ code: yupValideUniqCode(`${url}/checkUniqueCode`, codeMaxLenth, tob),
28
+ });
29
+ export const schemaNaCoIcon = (url, tob, codeMaxLenth = 4) => yup.object({
30
+ name: yupValideUniqName(`${url}/checkUniqueName`, tob),
31
+ code: yupValideUniqCode(`${url}/checkUniqueCode`, codeMaxLenth, tob),
32
+ iconName: yupRequiredString(),
33
+ iconPack: yup.string().notRequired().nullable(),
20
34
  });
21
35
  export const schemaNa = (url, tob) => yup.object({
22
- name: yupValideUniqName(url + "/checkUniqueName", tob),
36
+ name: yupValideUniqName(`${url}/checkUniqueName`, tob),
37
+ });
38
+ export const schemaNaIcon = (url, tob) => yup.object({
39
+ name: yupValideUniqName(`${url}/checkUniqueName`, tob),
40
+ iconName: yupRequiredString(),
41
+ iconPack: yup.string().notRequired().nullable(),
42
+ });
43
+ export const schemaIcon = () => yup.object({
44
+ iconName: yupRequiredString(),
45
+ iconPack: yup.string().notRequired().nullable(),
23
46
  });
24
- export const schemaLogin = () => yup.object({
47
+ export const schemaSelect = () => yup.object({
48
+ selectId: yup.number().required(),
49
+ });
50
+ export const schemaLogin = (t) => yup.object({
25
51
  // email: yup.string().required(t("Please enter Email")),
26
- username: yup.string().required("Please enter Email"),
27
- password: yup.string().required("Please enter Password"),
52
+ username: yup.string().required(t("Please enter Email")),
53
+ password: yup.string().required(t("Please enter Password")),
28
54
  // checkbox: yup.bool().oneOf([true]),
29
55
  });
30
56
  export const yupValideUniqName = (url, tob) => {
31
57
  return yup
32
58
  .string()
33
59
  .required()
34
- .test("Check_name", "This name is already taken", (value) => {
60
+ .test("Check_name", FormErrors.CHECK_UNIQUE, (value) => {
35
61
  return new Promise((resolve) => __awaiter(void 0, void 0, void 0, function* () {
36
62
  const { data: res } = yield axios.post(url, { id: tob === null || tob === void 0 ? void 0 : tob.id, name: value });
37
63
  res ? resolve(true) : resolve(false);
38
64
  }));
39
65
  });
40
66
  };
41
- export const yupValideUniqEmail = (url, tob, isRequired = true) => {
42
- if (isRequired) {
43
- return yup
44
- .string()
45
- .required("this value is required")
46
- .email("this value must be a valid email")
47
- .test("Check_name", "This name is already taken", (value) => {
48
- return new Promise((resolve) => __awaiter(void 0, void 0, void 0, function* () {
49
- const { data: res } = yield axios.post(url, { id: tob === null || tob === void 0 ? void 0 : tob.id, name: value });
50
- res ? resolve(true) : resolve(false);
51
- }));
52
- });
53
- }
54
- return yup.string().when((val) => {
55
- // if (val !== "") {
56
- if (val) {
57
- return yup
58
- .string()
59
- .email()
60
- .test("Check_name", "This name is already taken", (value) => {
61
- return new Promise((resolve) => __awaiter(void 0, void 0, void 0, function* () {
62
- const { data: res } = yield axios.post(url, { id: tob === null || tob === void 0 ? void 0 : tob.id, name: value });
63
- res ? resolve(true) : resolve(false);
64
- }));
65
- });
66
- }
67
+ export const yupValideUniqEmail = (url, tob) => {
68
+ return yup
69
+ .string()
70
+ .email(FormErrors.EMAIL)
71
+ .required(FormErrors.REQUIRED)
72
+ .test("Check_name", FormErrors.CHECK_UNIQUE, (value) => {
73
+ return new Promise((resolve) => __awaiter(void 0, void 0, void 0, function* () {
74
+ const { data: res } = yield axios.post(url, { id: tob === null || tob === void 0 ? void 0 : tob.id, name: value });
75
+ res ? resolve(true) : resolve(false);
76
+ }));
67
77
  });
68
78
  };
69
- export const yupValideUniqNumber = (url, tob, isRequired = true) => {
70
- if (isRequired) {
71
- return yup
72
- .number()
73
- .required()
74
- .test("Check_name", "This name is already taken", (value) => {
75
- return new Promise((resolve) => __awaiter(void 0, void 0, void 0, function* () {
76
- const { data: res } = yield axios.post(url, { id: tob === null || tob === void 0 ? void 0 : tob.id, name: value });
77
- res ? resolve(true) : resolve(false);
78
- }));
79
- });
80
- }
81
- return yup.number().test("Check_name", "This name is already taken", (value) => {
79
+ export const yupValideNoRequiredUniqEmail = (url, tob) => {
80
+ return yup
81
+ .string()
82
+ .email(FormErrors.EMAIL)
83
+ .nullable()
84
+ .test("Check_name", FormErrors.CHECK_UNIQUE, (value) => {
85
+ return new Promise((resolve) => __awaiter(void 0, void 0, void 0, function* () {
86
+ const { data: res } = yield axios.post(url, { id: tob === null || tob === void 0 ? void 0 : tob.id, name: value });
87
+ res ? resolve(true) : resolve(false);
88
+ }));
89
+ });
90
+ };
91
+ export const yupNoRequiredNumber = () => {
92
+ return yup
93
+ .number()
94
+ .typeError(FormErrors.DIGIT)
95
+ .nullable()
96
+ .transform((_, val) => (val !== "" ? Number(val) : null));
97
+ // .moreThan(0, "Floor area cannot be negative")
98
+ };
99
+ export const yupRequiredNumber = () => {
100
+ return yup.number().required(FormErrors.REQUIRED).typeError(FormErrors.DIGIT);
101
+ };
102
+ export const yupNoRequiredString = () => {
103
+ return yup.string().nullable().notRequired();
104
+ };
105
+ export const yupRequiredString = () => {
106
+ return yup.string().required(FormErrors.REQUIRED);
107
+ };
108
+ export const yupValideUniqNumber = (url, tob) => {
109
+ return yup
110
+ .number()
111
+ .required(FormErrors.REQUIRED)
112
+ .typeError(FormErrors.DIGIT)
113
+ .test("Check_name", FormErrors.CHECK_UNIQUE, (value) => {
82
114
  return new Promise((resolve) => __awaiter(void 0, void 0, void 0, function* () {
83
115
  const { data: res } = yield axios.post(url, { id: tob === null || tob === void 0 ? void 0 : tob.id, name: value });
84
116
  res ? resolve(true) : resolve(false);
85
117
  }));
86
118
  });
87
119
  };
120
+ export const yupValideNoRequiredUniqNumber = (url, tob) => {
121
+ return (yup
122
+ .number()
123
+ .nullable()
124
+ // .typeError(FormErrors.DIGIT)
125
+ // .transform((_, val) => (val !== "" ? Number(val) : null))
126
+ .test("Check_name", FormErrors.CHECK_UNIQUE, (value) => {
127
+ return new Promise((resolve) => __awaiter(void 0, void 0, void 0, function* () {
128
+ const { data: res } = yield axios.post(url, { id: tob === null || tob === void 0 ? void 0 : tob.id, name: value });
129
+ res ? resolve(true) : resolve(false);
130
+ }));
131
+ }));
132
+ };
88
133
  export const yupValideUniqCode = (url, max = 4, tob) => {
89
134
  return yup
90
135
  .string()
91
136
  .required()
92
137
  .min(2)
93
138
  .max(max)
94
- .test("Check_name", "This name is already taken", (value) => {
139
+ .test("Check_name", FormErrors.CHECK_UNIQUE, (value) => {
95
140
  return new Promise((resolve) => __awaiter(void 0, void 0, void 0, function* () {
96
141
  const { data: res } = yield axios.post(url, { id: tob === null || tob === void 0 ? void 0 : tob.id, name: value });
97
142
  res ? resolve(true) : resolve(false);
98
143
  }));
99
144
  });
100
145
  };
101
- export const yupValidateNoRequiredNumber = () => {
102
- return yup
103
- .string()
104
- .nullable()
105
- .when((val) => {
106
- if (val) {
107
- return yup.number().nullable();
108
- }
109
- })
110
- .typeError("must be number");
111
- };
112
146
  export const formatSelectOptions = (objs, propLabel = "name", propValue = "id") => {
113
147
  if (!objs.length) {
114
148
  return objs;
@@ -1,9 +1,19 @@
1
1
  export default interface PdfmakeTextProps {
2
- text: string;
2
+ text: string | number;
3
3
  fontSize?: number;
4
4
  style?: string;
5
5
  alignment?: string;
6
6
  bold?: boolean;
7
7
  margin?: [number, number, number, number];
8
8
  nLine?: string;
9
+ fontFeatures?: string[];
10
+ lineHeight?: number;
11
+ italics?: boolean;
12
+ characterSpacing?: number;
13
+ color?: string;
14
+ background?: string;
15
+ markerColor?: string;
16
+ decoration?: string | string[];
17
+ decorationStyle?: string;
18
+ decorationColor?: string;
9
19
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "asv-hlps",
3
- "version": "1.3.52",
3
+ "version": "1.3.53",
4
4
  "description": "helpers",
5
5
  "main": "./lib/cjs/index.js",
6
6
  "module": "./lib/esm/index.js",