asv-hlps 1.2.93 → 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 +41 -12
- package/lib/esm/utils.d.ts +1 -1
- package/lib/esm/utils.js +41 -12
- 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:
|
|
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,26 +336,55 @@ const getColorAccordingToDate = (inputDate, period1 = 3, period2 = 6, period3 =
|
|
|
336
336
|
return "#339900";
|
|
337
337
|
};
|
|
338
338
|
exports.getColorAccordingToDate = getColorAccordingToDate;
|
|
339
|
-
const getPeriodDateColor = (inputDate,
|
|
340
|
-
const
|
|
341
|
-
const
|
|
342
|
-
const
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
339
|
+
const getPeriodDateColor = (inputDate, period = 30, colors) => {
|
|
340
|
+
const month0 = 0;
|
|
341
|
+
const month3 = period * 3;
|
|
342
|
+
const month6 = period * 6;
|
|
343
|
+
const month9 = period * 9;
|
|
344
|
+
const month12 = period * 12;
|
|
345
|
+
const today = (0, dayjs_1.default)(new Date());
|
|
346
|
+
const expDate = new Date(inputDate);
|
|
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
|
+
}
|
|
369
|
+
if (diff <= month0) {
|
|
370
|
+
// return "dark";
|
|
347
371
|
return "danger";
|
|
348
372
|
}
|
|
349
|
-
|
|
373
|
+
if (diff <= month3) {
|
|
374
|
+
return "danger";
|
|
375
|
+
}
|
|
376
|
+
if (diff <= month6) {
|
|
350
377
|
return "warning";
|
|
351
378
|
}
|
|
352
|
-
|
|
379
|
+
if (diff <= month9) {
|
|
353
380
|
return "purple";
|
|
354
381
|
}
|
|
355
|
-
|
|
382
|
+
if (diff <= month12) {
|
|
356
383
|
return "success";
|
|
357
384
|
}
|
|
358
|
-
|
|
385
|
+
if (diff > month12) {
|
|
386
|
+
return "info";
|
|
387
|
+
}
|
|
359
388
|
};
|
|
360
389
|
exports.getPeriodDateColor = getPeriodDateColor;
|
|
361
390
|
const arrayMultiChecked = (objet, event, item) => {
|
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:
|
|
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,26 +284,55 @@ export const getColorAccordingToDate = (inputDate, period1 = 3, period2 = 6, per
|
|
|
284
284
|
}
|
|
285
285
|
return "#339900";
|
|
286
286
|
};
|
|
287
|
-
export const getPeriodDateColor = (inputDate,
|
|
288
|
-
const
|
|
289
|
-
const
|
|
290
|
-
const
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
287
|
+
export const getPeriodDateColor = (inputDate, period = 30, colors) => {
|
|
288
|
+
const month0 = 0;
|
|
289
|
+
const month3 = period * 3;
|
|
290
|
+
const month6 = period * 6;
|
|
291
|
+
const month9 = period * 9;
|
|
292
|
+
const month12 = period * 12;
|
|
293
|
+
const today = dayjs(new Date());
|
|
294
|
+
const expDate = new Date(inputDate);
|
|
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
|
+
}
|
|
317
|
+
if (diff <= month0) {
|
|
318
|
+
// return "dark";
|
|
295
319
|
return "danger";
|
|
296
320
|
}
|
|
297
|
-
|
|
321
|
+
if (diff <= month3) {
|
|
322
|
+
return "danger";
|
|
323
|
+
}
|
|
324
|
+
if (diff <= month6) {
|
|
298
325
|
return "warning";
|
|
299
326
|
}
|
|
300
|
-
|
|
327
|
+
if (diff <= month9) {
|
|
301
328
|
return "purple";
|
|
302
329
|
}
|
|
303
|
-
|
|
330
|
+
if (diff <= month12) {
|
|
304
331
|
return "success";
|
|
305
332
|
}
|
|
306
|
-
|
|
333
|
+
if (diff > month12) {
|
|
334
|
+
return "info";
|
|
335
|
+
}
|
|
307
336
|
};
|
|
308
337
|
export const arrayMultiChecked = (objet, event, item) => {
|
|
309
338
|
const findItem = objet.find((x) => x.id === item.id);
|