asv-hlps 1.2.94 → 1.2.95
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/lib/cjs/utils.d.ts +1 -1
- package/lib/cjs/utils.js +22 -1
- package/lib/esm/utils.d.ts +1 -1
- package/lib/esm/utils.js +22 -1
- package/package.json +1 -1
package/lib/cjs/utils.d.ts
CHANGED
|
@@ -58,7 +58,7 @@ export declare const formatNgbDate: (date: any) => {
|
|
|
58
58
|
};
|
|
59
59
|
export declare const genRandomColour: () => string;
|
|
60
60
|
export declare const getColorAccordingToDate: (inputDate: Date, period1?: number, period2?: number, period3?: number, ifClass?: boolean) => "red" | "DarkOrange" | "turquoise" | "blue" | "green" | "#f46a6a" | "#f1b44c" | "#cce5ff" | "#34c38f" | "#339900";
|
|
61
|
-
export declare const getPeriodDateColor: (inputDate: string, period?: number
|
|
61
|
+
export declare const getPeriodDateColor: (inputDate: string, period?: number, colors?: [string, string, string, string, ...string[]]) => string;
|
|
62
62
|
export declare const arrayMultiChecked: (objet: any[], event: boolean, item: any) => any[];
|
|
63
63
|
export declare const inputChecked: (event: any, item: any, checks: any[], isChecked?: boolean) => any[];
|
|
64
64
|
export declare const unCheckedAll: (checks?: any[]) => void;
|
package/lib/cjs/utils.js
CHANGED
|
@@ -336,7 +336,7 @@ const getColorAccordingToDate = (inputDate, period1 = 3, period2 = 6, period3 =
|
|
|
336
336
|
return "#339900";
|
|
337
337
|
};
|
|
338
338
|
exports.getColorAccordingToDate = getColorAccordingToDate;
|
|
339
|
-
const getPeriodDateColor = (inputDate, period = 30) => {
|
|
339
|
+
const getPeriodDateColor = (inputDate, period = 30, colors) => {
|
|
340
340
|
const month0 = 0;
|
|
341
341
|
const month3 = period * 3;
|
|
342
342
|
const month6 = period * 6;
|
|
@@ -345,6 +345,27 @@ const getPeriodDateColor = (inputDate, period = 30) => {
|
|
|
345
345
|
const today = (0, dayjs_1.default)(new Date());
|
|
346
346
|
const expDate = new Date(inputDate);
|
|
347
347
|
const diff = (0, dayjs_1.default)(expDate).diff(today, "day");
|
|
348
|
+
if (colors.length >= 4) {
|
|
349
|
+
if (diff <= month0) {
|
|
350
|
+
// return "dark";
|
|
351
|
+
return colors.length >= 6 ? colors[4] : "danger";
|
|
352
|
+
}
|
|
353
|
+
if (diff <= month3) {
|
|
354
|
+
return colors[0];
|
|
355
|
+
}
|
|
356
|
+
if (diff <= month6) {
|
|
357
|
+
return colors[1];
|
|
358
|
+
}
|
|
359
|
+
if (diff <= month9) {
|
|
360
|
+
return colors[2];
|
|
361
|
+
}
|
|
362
|
+
if (diff <= month12) {
|
|
363
|
+
return colors[3];
|
|
364
|
+
}
|
|
365
|
+
if (diff > month12) {
|
|
366
|
+
return colors.length >= 5 ? colors[4] : "info";
|
|
367
|
+
}
|
|
368
|
+
}
|
|
348
369
|
if (diff <= month0) {
|
|
349
370
|
// return "dark";
|
|
350
371
|
return "danger";
|
package/lib/esm/utils.d.ts
CHANGED
|
@@ -58,7 +58,7 @@ export declare const formatNgbDate: (date: any) => {
|
|
|
58
58
|
};
|
|
59
59
|
export declare const genRandomColour: () => string;
|
|
60
60
|
export declare const getColorAccordingToDate: (inputDate: Date, period1?: number, period2?: number, period3?: number, ifClass?: boolean) => "red" | "DarkOrange" | "turquoise" | "blue" | "green" | "#f46a6a" | "#f1b44c" | "#cce5ff" | "#34c38f" | "#339900";
|
|
61
|
-
export declare const getPeriodDateColor: (inputDate: string, period?: number
|
|
61
|
+
export declare const getPeriodDateColor: (inputDate: string, period?: number, colors?: [string, string, string, string, ...string[]]) => string;
|
|
62
62
|
export declare const arrayMultiChecked: (objet: any[], event: boolean, item: any) => any[];
|
|
63
63
|
export declare const inputChecked: (event: any, item: any, checks: any[], isChecked?: boolean) => any[];
|
|
64
64
|
export declare const unCheckedAll: (checks?: any[]) => void;
|
package/lib/esm/utils.js
CHANGED
|
@@ -284,7 +284,7 @@ export const getColorAccordingToDate = (inputDate, period1 = 3, period2 = 6, per
|
|
|
284
284
|
}
|
|
285
285
|
return "#339900";
|
|
286
286
|
};
|
|
287
|
-
export const getPeriodDateColor = (inputDate, period = 30) => {
|
|
287
|
+
export const getPeriodDateColor = (inputDate, period = 30, colors) => {
|
|
288
288
|
const month0 = 0;
|
|
289
289
|
const month3 = period * 3;
|
|
290
290
|
const month6 = period * 6;
|
|
@@ -293,6 +293,27 @@ export const getPeriodDateColor = (inputDate, period = 30) => {
|
|
|
293
293
|
const today = dayjs(new Date());
|
|
294
294
|
const expDate = new Date(inputDate);
|
|
295
295
|
const diff = dayjs(expDate).diff(today, "day");
|
|
296
|
+
if (colors.length >= 4) {
|
|
297
|
+
if (diff <= month0) {
|
|
298
|
+
// return "dark";
|
|
299
|
+
return colors.length >= 6 ? colors[4] : "danger";
|
|
300
|
+
}
|
|
301
|
+
if (diff <= month3) {
|
|
302
|
+
return colors[0];
|
|
303
|
+
}
|
|
304
|
+
if (diff <= month6) {
|
|
305
|
+
return colors[1];
|
|
306
|
+
}
|
|
307
|
+
if (diff <= month9) {
|
|
308
|
+
return colors[2];
|
|
309
|
+
}
|
|
310
|
+
if (diff <= month12) {
|
|
311
|
+
return colors[3];
|
|
312
|
+
}
|
|
313
|
+
if (diff > month12) {
|
|
314
|
+
return colors.length >= 5 ? colors[4] : "info";
|
|
315
|
+
}
|
|
316
|
+
}
|
|
296
317
|
if (diff <= month0) {
|
|
297
318
|
// return "dark";
|
|
298
319
|
return "danger";
|