tsv2-library 0.0.1 → 0.0.2

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.
Files changed (43) hide show
  1. package/dist/components/Button/Button.vue.d.ts +14 -0
  2. package/dist/components/Button/Button.vue.d.ts.map +1 -0
  3. package/dist/components/icon/Icon.vue.d.ts +4 -0
  4. package/dist/components/icon/Icon.vue.d.ts.map +1 -0
  5. package/dist/components/index.d.ts +2 -0
  6. package/dist/components/main.d.ts +7 -0
  7. package/dist/components/v2/Badge/Badge.vue.d.ts +48 -0
  8. package/dist/components/v2/buttonbulkaction/ButtonBulkAction.vue.d.ts +69 -0
  9. package/dist/components/v2/icon/Icon.vue.d.ts +4 -4
  10. package/dist/components/v2/inputtext/InputText.vue.d.ts +71 -0
  11. package/dist/main.d.ts +3 -0
  12. package/dist/tsv2-library.cjs.js +15 -17
  13. package/dist/tsv2-library.es.js +339 -584
  14. package/dist/tsv2-library.umd.js +15 -17
  15. package/package.json +19 -44
  16. package/dist/components/v2/Button/Button.vue.d.ts +0 -4
  17. package/dist/components/v2/Button/Button.vue.d.ts.map +0 -1
  18. package/dist/components/v2/Checkbox/Checkbox.vue.d.ts +0 -4
  19. package/dist/components/v2/Checkbox/Checkbox.vue.d.ts.map +0 -1
  20. package/dist/components/v2/icon/Icon.vue.d.ts.map +0 -1
  21. package/dist/components/v2/index.d.ts +0 -8
  22. package/dist/routers/index.d.ts +0 -2
  23. package/dist/services/category.service.d.ts +0 -4
  24. package/dist/services/group.service.d.ts +0 -4
  25. package/dist/services/scanner.service.d.ts +0 -10
  26. package/dist/services/scanner_old.service.d.ts +0 -9
  27. package/dist/tsv2-library.cjs.js.map +0 -1
  28. package/dist/tsv2-library.es.js.map +0 -1
  29. package/dist/tsv2-library.umd.js.map +0 -1
  30. package/dist/types/columns.d.ts +0 -26
  31. package/dist/types/fieldValidation.type.d.ts +0 -8
  32. package/dist/types/options.d.ts +0 -9
  33. package/dist/types/table.type.d.ts +0 -28
  34. package/dist/utils/date.util.d.ts +0 -4
  35. package/dist/utils/exportToExcel.util.d.ts +0 -7
  36. package/dist/utils/index.d.ts +0 -8
  37. package/dist/utils/string.util.d.ts +0 -4
  38. package/dist/utils/textFormater.util.d.ts +0 -3
  39. package/src/utils/date.util.ts +0 -58
  40. package/src/utils/exportToExcel.util.ts +0 -32
  41. package/src/utils/index.ts +0 -45
  42. package/src/utils/string.util.ts +0 -23
  43. package/src/utils/textFormater.util.ts +0 -46
@@ -1,26 +0,0 @@
1
- import { Component } from 'vue';
2
- export type TableColumn = {
3
- header: string;
4
- field: string;
5
- style?: string;
6
- sortable?: boolean;
7
- bodyStyle?: (props: any) => string;
8
- bodyTemplate?: (data: any) => string;
9
- bodyComponent?: (data: any) => {
10
- component: string | Component;
11
- props?: any;
12
- model?: any;
13
- events?: any;
14
- onChange?: any;
15
- disabled?: boolean;
16
- };
17
- headerTemplate?: () => string;
18
- headerComponent?: () => {
19
- component: string | Component;
20
- props?: any;
21
- model?: any;
22
- events?: any;
23
- onChange?: any;
24
- disabled?: boolean;
25
- };
26
- };
@@ -1,8 +0,0 @@
1
- import { FieldContext } from 'vee-validate';
2
- import { Ref } from 'vue';
3
- type FieldValue = string | string[] | number | number[] | boolean | undefined | null | object;
4
- export type FieldValidation = {
5
- value?: FieldValue;
6
- errorMessage?: Ref<string | undefined>;
7
- } | FieldContext;
8
- export {};
@@ -1,9 +0,0 @@
1
- export type MenuOption = {
2
- label: string;
3
- command: (data?: any) => any;
4
- icon?: string;
5
- items?: any[];
6
- class?: string;
7
- disabled?: boolean | any;
8
- danger?: boolean;
9
- };
@@ -1,28 +0,0 @@
1
- import { Component } from 'vue';
2
- export type TableColumn = {
3
- header: string;
4
- field: string;
5
- style?: string;
6
- sortable?: boolean;
7
- bodyStyle?: (props: any) => string;
8
- bodyTemplate?: (data: any) => string | undefined;
9
- bodyComponent?: (data: any) => {
10
- component: string | Component;
11
- props?: any;
12
- model?: any;
13
- events?: any;
14
- onChange?: any;
15
- disabled?: boolean;
16
- };
17
- };
18
- export type TableOption = {
19
- label?: string;
20
- command?: (data?: any) => any;
21
- icon?: string;
22
- items?: any[];
23
- class?: string;
24
- disabled?: boolean | any;
25
- separator?: boolean;
26
- danger?: boolean;
27
- visible?: boolean | any;
28
- };
@@ -1,4 +0,0 @@
1
- declare const DateUtils: {
2
- formatDate: (date: string, useTime?: boolean) => string;
3
- };
4
- export default DateUtils;
@@ -1,7 +0,0 @@
1
- interface IExcelOptions {
2
- headers: string[];
3
- data: object[];
4
- filename: string;
5
- }
6
- declare const exportToExcel: (options: IExcelOptions) => Promise<void>;
7
- export default exportToExcel;
@@ -1,8 +0,0 @@
1
- import { AxiosInstance } from 'axios';
2
- import { formatUserName, formatVowelSoundLabel } from './textFormater.util';
3
- import exportToExcel from './exportToExcel.util';
4
- declare const isObjectEmpty: (obj: object) => boolean;
5
- declare const addTokenExpirationHandling: (instance: AxiosInstance) => void;
6
- declare const filterSelectedTreeKeys: (keys: any) => number[];
7
- declare const getImgURL: (fileName: string) => string;
8
- export { isObjectEmpty, addTokenExpirationHandling, filterSelectedTreeKeys, getImgURL, formatUserName, formatVowelSoundLabel, exportToExcel, };
@@ -1,4 +0,0 @@
1
- declare const StringUtils: {
2
- formatUserName: (name: string) => string;
3
- };
4
- export default StringUtils;
@@ -1,3 +0,0 @@
1
- export declare const formatVowelSoundLabel: (label?: string) => string;
2
- export declare const formatUserName: (name: string) => string;
3
- export default formatUserName;
@@ -1,58 +0,0 @@
1
- const formatDate = (date: string, useTime?: boolean) => {
2
- let dateFormat: DateFormat, timeFormat, timeZone;
3
- interface DateFormat {
4
- locale: string;
5
- year: string;
6
- month: string;
7
- day: string;
8
- weekday?: string;
9
- }
10
- dateFormat = {
11
- locale: 'en-gb',
12
- year: '2-digit',
13
- month: '2-digit',
14
- day: '2-digit',
15
- };
16
-
17
- const userStr = localStorage.getItem('user');
18
-
19
- if (userStr) {
20
- const user = JSON.parse(userStr);
21
-
22
- if (user.generalSetting.dateFormat) {
23
- dateFormat = user.generalSetting.dateFormat;
24
- }
25
-
26
- if (user.generalSetting.timeFormat) {
27
- timeFormat = user.generalSetting.timeFormat;
28
- }
29
-
30
- if (user.generalSetting.timezone) {
31
- timeZone = user.generalSetting.timezone;
32
- }
33
- }
34
-
35
- let options: any = {
36
- year: dateFormat.year,
37
- month: dateFormat.month,
38
- day: dateFormat.day,
39
- weekday: dateFormat.weekday,
40
- hour12: timeFormat,
41
- timeZone: timeZone,
42
- };
43
-
44
- if (useTime) {
45
- options = {
46
- ...options,
47
- hour: '2-digit',
48
- minute: '2-digit',
49
- second: '2-digit',
50
- };
51
- }
52
-
53
- return new Date(date).toLocaleString(dateFormat.locale, options);
54
- };
55
-
56
- const DateUtils = { formatDate };
57
-
58
- export default DateUtils;
@@ -1,32 +0,0 @@
1
- import * as XLSX from 'xlsx';
2
-
3
- interface IExcelOptions {
4
- headers: string[];
5
- data: object[];
6
- filename: string;
7
- }
8
-
9
- const exportToExcel = async (options: IExcelOptions): Promise<void> => {
10
- const heading = [options.headers];
11
- const workbook = XLSX.utils.book_new();
12
- const workSheet: XLSX.WorkSheet = XLSX.utils.json_to_sheet([]);
13
- XLSX.utils.sheet_add_aoa(workSheet, heading);
14
-
15
- XLSX.utils.sheet_add_json(workSheet, options.data, {
16
- origin: 'A2',
17
- skipHeader: true,
18
- });
19
-
20
- XLSX.utils.book_append_sheet(workbook, workSheet, 'Sheet1');
21
- const timestamps = new Date()
22
- .toLocaleDateString('en-gb', {
23
- day: '2-digit',
24
- month: '2-digit',
25
- year: '2-digit',
26
- })
27
- .replaceAll('/', '');
28
-
29
- XLSX.writeFile(workbook, `${options.filename}-${timestamps}.xlsx`);
30
- };
31
-
32
- export default exportToExcel;
@@ -1,45 +0,0 @@
1
- import { AxiosError, AxiosInstance, AxiosResponse } from 'axios';
2
- import { formatUserName, formatVowelSoundLabel } from './textFormater.util';
3
- import exportToExcel from './exportToExcel.util';
4
-
5
- const isObjectEmpty = (obj: object) => {
6
- if (!obj) return true;
7
- const keys = Object.keys(obj);
8
- return !keys.length;
9
- };
10
-
11
- const addTokenExpirationHandling = (instance: AxiosInstance) => {
12
- instance.interceptors.response.use(
13
- (response: AxiosResponse) => {
14
- return response;
15
- },
16
- (error: AxiosError) => {
17
- if (error.response?.status === 401) {
18
- localStorage.removeItem('user');
19
- window.location.reload();
20
- }
21
- },
22
- );
23
- };
24
-
25
- const filterSelectedTreeKeys = (keys: any) => {
26
- const formatted = Object.entries(keys);
27
- const filtered = formatted
28
- .filter((data: any) => data[1].checked && !data[1].partialChecked)
29
- .map((data) => parseInt(data[0]));
30
- return filtered;
31
- };
32
-
33
- const getImgURL = (fileName: string) => {
34
- return `https://assets.tagsamurai.com/img/${fileName}`;
35
- };
36
-
37
- export {
38
- isObjectEmpty,
39
- addTokenExpirationHandling,
40
- filterSelectedTreeKeys,
41
- getImgURL,
42
- formatUserName,
43
- formatVowelSoundLabel,
44
- exportToExcel,
45
- };
@@ -1,23 +0,0 @@
1
- const formatUserName = (name: string) => {
2
- if (name.length > 8) {
3
- const splitted = name.split(' ');
4
- if (splitted.length > 1) {
5
- let firstWord;
6
- const lastWord = splitted[splitted.length - 1];
7
- const firstToRestWord = splitted.slice(0, -1).join(' ');
8
- if (firstToRestWord.length > 8) {
9
- firstWord = `${firstToRestWord.slice(0, 8)}..`;
10
- } else {
11
- firstWord = firstToRestWord;
12
- }
13
- return `${firstWord} ${lastWord.slice(0, 1)}`;
14
- }
15
- const word = splitted[0];
16
- return word.length > 8 ? `${word.slice(0, 8)}..` : word;
17
- }
18
- return name;
19
- };
20
-
21
- const StringUtils = { formatUserName };
22
-
23
- export default StringUtils;
@@ -1,46 +0,0 @@
1
- export const formatVowelSoundLabel = (label?: string): string => {
2
- if (!label) return '';
3
-
4
- const vowelSound = ['a', 'e', 'i', 'o', 'h'];
5
- const vocalSound = ['a', 'e', 'i', 'o', 'u'];
6
- const word = label.toLowerCase();
7
- const firstLetter = word[0];
8
- const isStartWithVowel = vowelSound.includes(firstLetter);
9
-
10
- if (firstLetter === 'h') {
11
- const silent = ['hour', 'honest', 'heir', 'honor'];
12
- const includeSilent = silent.some((phrase) => word.includes(phrase));
13
-
14
- if (!vocalSound.includes(word.slice(2, 3)) && !includeSilent)
15
- return `a ${label}`;
16
- return `an ${label}`;
17
- }
18
-
19
- return isStartWithVowel ||
20
- (firstLetter === 'u' && !vowelSound.includes(word.slice(2, 3)))
21
- ? `an ${label}`
22
- : `a ${label}`;
23
- };
24
-
25
- export const formatUserName = (name: string): string => {
26
- if (name.length <= 8) return name;
27
-
28
- const splitted = name.split(' ');
29
-
30
- if (splitted.length === 1) {
31
- return `${splitted[0].slice(0, 8)}..`;
32
- }
33
-
34
- const firstToRestWord = splitted.slice(0, -1).join(' ');
35
-
36
- const firstWord =
37
- firstToRestWord.length > 8
38
- ? `${firstToRestWord.slice(0, 8)}..`
39
- : firstToRestWord;
40
-
41
- const lastWord = splitted[splitted.length - 1];
42
-
43
- return `${firstWord} ${lastWord.slice(0, 1)}`;
44
- };
45
-
46
- export default formatUserName;