@winchsa/ui 0.1.61 → 0.1.63
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/dist/components/forms/AppLabel.vue +1 -0
- package/dist/components/forms/AttachmentCropperInput.vue +6 -1
- package/dist/components/forms/AttachmentInput.vue +6 -1
- package/dist/components/forms/ManualDate.vue +1 -0
- package/dist/components/forms/TimePicker.vue +1 -0
- package/dist/components/table/DataTable.d.vue.ts +1 -1
- package/dist/components/table/DataTable.vue.d.ts +1 -1
- package/dist/utils/formatters.d.ts +1 -1
- package/dist/utils/formatters.js +13 -16
- package/dist/utils/formatters.mjs +10 -16
- package/package.json +67 -67
- package/dist/.DS_Store +0 -0
|
@@ -38,6 +38,7 @@ const LangLabel = computed(() => props.label ? t(props.label) : "");
|
|
|
38
38
|
<VMessages
|
|
39
39
|
v-if="isValid.value === false || errorMessages?.length !== 0"
|
|
40
40
|
class="text-start"
|
|
41
|
+
color="error"
|
|
41
42
|
:messages="[validationErrors.value, errorMessages]"
|
|
42
43
|
:active="isValid.value === false || errorMessages?.length !== 0"
|
|
43
44
|
/>
|
|
@@ -183,7 +183,12 @@ watch(zoomLevel, async (newZoom) => {
|
|
|
183
183
|
:accept="validTypes?.join(',')"
|
|
184
184
|
@change="onImageChanged($event)"
|
|
185
185
|
>
|
|
186
|
-
<VMessages
|
|
186
|
+
<VMessages
|
|
187
|
+
class="mt-1 d-block"
|
|
188
|
+
color="error"
|
|
189
|
+
:messages="validationErrors.value"
|
|
190
|
+
:active="isValid.value === false"
|
|
191
|
+
/>
|
|
187
192
|
</div>
|
|
188
193
|
</VValidation>
|
|
189
194
|
|
|
@@ -109,7 +109,12 @@ const removeImageCopy = (id) => {
|
|
|
109
109
|
@change="onImageChanged($event, validate)"
|
|
110
110
|
>
|
|
111
111
|
|
|
112
|
-
<VMessages
|
|
112
|
+
<VMessages
|
|
113
|
+
class="mt-1 d-block"
|
|
114
|
+
color="error"
|
|
115
|
+
:messages="validationErrors.value"
|
|
116
|
+
:active="isValid.value === false"
|
|
117
|
+
/>
|
|
113
118
|
</div>
|
|
114
119
|
</VValidation>
|
|
115
120
|
</div>
|
|
@@ -62,9 +62,9 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
|
62
62
|
}>, {
|
|
63
63
|
modelValue: string[];
|
|
64
64
|
returnObject: boolean;
|
|
65
|
-
url: string;
|
|
66
65
|
headers: Header[];
|
|
67
66
|
formFilters: FormFilter[];
|
|
67
|
+
url: string;
|
|
68
68
|
queryParams: Record<string, string>;
|
|
69
69
|
enableButtons: boolean;
|
|
70
70
|
enableButtonsFilter: boolean;
|
|
@@ -62,9 +62,9 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
|
62
62
|
}>, {
|
|
63
63
|
modelValue: string[];
|
|
64
64
|
returnObject: boolean;
|
|
65
|
-
url: string;
|
|
66
65
|
headers: Header[];
|
|
67
66
|
formFilters: FormFilter[];
|
|
67
|
+
url: string;
|
|
68
68
|
queryParams: Record<string, string>;
|
|
69
69
|
enableButtons: boolean;
|
|
70
70
|
enableButtonsFilter: boolean;
|
|
@@ -8,5 +8,5 @@ export declare const extractDate: (dateString: string | Date | null, format?: st
|
|
|
8
8
|
month: string;
|
|
9
9
|
year: string;
|
|
10
10
|
} | null;
|
|
11
|
-
export declare const formatNumber: (number
|
|
11
|
+
export declare const formatNumber: (number?: number | string | null, withCurrency?: boolean) => string;
|
|
12
12
|
export declare const formatNumberColor: (number: number | string | undefined) => string;
|
package/dist/utils/formatters.js
CHANGED
|
@@ -47,27 +47,24 @@ const extractDate = (dateString, format = "DD/MM/YYYY", hasTime = true) => {
|
|
|
47
47
|
};
|
|
48
48
|
};
|
|
49
49
|
exports.extractDate = extractDate;
|
|
50
|
+
const RIYAL_SYMBOL = String.fromCharCode(59392);
|
|
51
|
+
const NO_BREAK_SPACE = String.fromCharCode(160);
|
|
52
|
+
const LEFT_TO_RIGHT_ISOLATE = String.fromCharCode(8294);
|
|
53
|
+
const POP_DIRECTIONAL_ISOLATE = String.fromCharCode(8297);
|
|
50
54
|
const formatNumber = (number, withCurrency = false) => {
|
|
51
|
-
const
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
const needsTwoDecimalPlaces = number % 1 !== 0;
|
|
60
|
-
const options = {
|
|
61
|
-
minimumFractionDigits: needsTwoDecimalPlaces ? 2 : 0,
|
|
62
|
-
maximumFractionDigits: needsTwoDecimalPlaces ? 2 : 0
|
|
63
|
-
};
|
|
64
|
-
const formatted = Math.abs(number).toLocaleString("en-US", options);
|
|
65
|
-
return locale !== "ar" ? `${currency} ${number < 0 ? `${formatted}-` : formatted}` : `${number < 0 ? `-${formatted}` : formatted} ${currency}`;
|
|
55
|
+
const value = Number(number || 0);
|
|
56
|
+
const absolute = Math.abs(value).toLocaleString("en-US", {
|
|
57
|
+
minimumFractionDigits: 2,
|
|
58
|
+
maximumFractionDigits: 2
|
|
59
|
+
}).replace(/\.00$/, "");
|
|
60
|
+
const formatted = value < 0 && absolute !== "0" ? `-${absolute}` : absolute;
|
|
61
|
+
const amount = withCurrency ? `${RIYAL_SYMBOL}${NO_BREAK_SPACE}${formatted}` : formatted;
|
|
62
|
+
return `${LEFT_TO_RIGHT_ISOLATE}${amount}${POP_DIRECTIONAL_ISOLATE}`;
|
|
66
63
|
};
|
|
67
64
|
exports.formatNumber = formatNumber;
|
|
68
65
|
const formatNumberColor = number => {
|
|
69
66
|
const parsedNumber = typeof number === "string" ? parseFloat(number) : number;
|
|
70
|
-
if (parsedNumber === void 0 || parsedNumber === null || parsedNumber
|
|
67
|
+
if (parsedNumber === void 0 || parsedNumber === null || isNaN(parsedNumber) || Math.abs(parsedNumber) < 0.01) {
|
|
71
68
|
return "";
|
|
72
69
|
}
|
|
73
70
|
return parsedNumber > 0 ? "success" : "red";
|
|
@@ -29,26 +29,20 @@ export const extractDate = (dateString, format = "DD/MM/YYYY", hasTime = true) =
|
|
|
29
29
|
const [, day, month, year] = match;
|
|
30
30
|
return { day, month, year };
|
|
31
31
|
};
|
|
32
|
+
const RIYAL_SYMBOL = String.fromCharCode(59392);
|
|
33
|
+
const NO_BREAK_SPACE = String.fromCharCode(160);
|
|
34
|
+
const LEFT_TO_RIGHT_ISOLATE = String.fromCharCode(8294);
|
|
35
|
+
const POP_DIRECTIONAL_ISOLATE = String.fromCharCode(8297);
|
|
32
36
|
export const formatNumber = (number, withCurrency = false) => {
|
|
33
|
-
const
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
if (typeof number === "string") {
|
|
39
|
-
number = parseFloat(number);
|
|
40
|
-
}
|
|
41
|
-
const needsTwoDecimalPlaces = number % 1 !== 0;
|
|
42
|
-
const options = {
|
|
43
|
-
minimumFractionDigits: needsTwoDecimalPlaces ? 2 : 0,
|
|
44
|
-
maximumFractionDigits: needsTwoDecimalPlaces ? 2 : 0
|
|
45
|
-
};
|
|
46
|
-
const formatted = Math.abs(number).toLocaleString("en-US", options);
|
|
47
|
-
return locale !== "ar" ? `${currency} ${number < 0 ? `${formatted}-` : formatted}` : `${number < 0 ? `-${formatted}` : formatted} ${currency}`;
|
|
37
|
+
const value = Number(number || 0);
|
|
38
|
+
const absolute = Math.abs(value).toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 }).replace(/\.00$/, "");
|
|
39
|
+
const formatted = value < 0 && absolute !== "0" ? `-${absolute}` : absolute;
|
|
40
|
+
const amount = withCurrency ? `${RIYAL_SYMBOL}${NO_BREAK_SPACE}${formatted}` : formatted;
|
|
41
|
+
return `${LEFT_TO_RIGHT_ISOLATE}${amount}${POP_DIRECTIONAL_ISOLATE}`;
|
|
48
42
|
};
|
|
49
43
|
export const formatNumberColor = (number) => {
|
|
50
44
|
const parsedNumber = typeof number === "string" ? parseFloat(number) : number;
|
|
51
|
-
if (parsedNumber === void 0 || parsedNumber === null || parsedNumber
|
|
45
|
+
if (parsedNumber === void 0 || parsedNumber === null || isNaN(parsedNumber) || Math.abs(parsedNumber) < 0.01) {
|
|
52
46
|
return "";
|
|
53
47
|
}
|
|
54
48
|
return parsedNumber > 0 ? "success" : "red";
|
package/package.json
CHANGED
|
@@ -1,70 +1,70 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
},
|
|
9
|
-
"files": [
|
|
10
|
-
"dist/*"
|
|
11
|
-
],
|
|
12
|
-
"exports": {
|
|
13
|
-
".": {
|
|
14
|
-
"require": "./dist/index.js",
|
|
15
|
-
"import": "./dist/index.mjs",
|
|
16
|
-
"types": "./dist/index.d.ts"
|
|
2
|
+
"name": "@winchsa/ui",
|
|
3
|
+
"version": "0.1.63",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"private": false,
|
|
6
|
+
"publishConfig": {
|
|
7
|
+
"access": "public"
|
|
17
8
|
},
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
9
|
+
"files": [
|
|
10
|
+
"dist/*"
|
|
11
|
+
],
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"require": "./dist/index.js",
|
|
15
|
+
"import": "./dist/index.mjs",
|
|
16
|
+
"types": "./dist/index.d.ts"
|
|
17
|
+
},
|
|
18
|
+
"./utils": {
|
|
19
|
+
"require": "./dist/utils/index.js",
|
|
20
|
+
"import": "./dist/utils/index.mjs",
|
|
21
|
+
"types": "./dist/utils/index.d.ts"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"main": "./dist/index.js",
|
|
25
|
+
"module": "./dist/index.mjs",
|
|
26
|
+
"scripts": {
|
|
27
|
+
"dev": "vite",
|
|
28
|
+
"build": "unbuild",
|
|
29
|
+
"lint": "eslint \"**/*.{ts,vue,mjs}\"",
|
|
30
|
+
"lint:fix": "eslint \"**/*.{ts,vue,mjs}\" --fix",
|
|
31
|
+
"bump": "pnpm run build && pnpm version patch"
|
|
32
|
+
},
|
|
33
|
+
"peerDependencies": {
|
|
34
|
+
"@intlify/unplugin-vue-i18n": "^4.0.0",
|
|
35
|
+
"@tanstack/vue-query": "^5.74.5",
|
|
36
|
+
"@vueuse/core": "11.3.0",
|
|
37
|
+
"@vueuse/router": "^13.1.0",
|
|
38
|
+
"ofetch": "^1.4.1",
|
|
39
|
+
"vue": "^3.5.13",
|
|
40
|
+
"vue-i18n": "9.14.5",
|
|
41
|
+
"vue-router": "4.4.5",
|
|
42
|
+
"vue-sonner": "^1.3.0",
|
|
43
|
+
"vue3-perfect-scrollbar": "2.0.0",
|
|
44
|
+
"vuetify": "3.10.11"
|
|
45
|
+
},
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"@vuepic/vue-datepicker": "^11.0.0",
|
|
48
|
+
"cropperjs": "^1.6.2",
|
|
49
|
+
"print-js": "^1.6.0",
|
|
50
|
+
"v-calendar": "^3.1.2",
|
|
51
|
+
"vue-multiselect": "^3.1.0"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@tanstack/eslint-plugin-query": "^5.73.3",
|
|
55
|
+
"@typescript-eslint/eslint-plugin": "^7.18.0",
|
|
56
|
+
"@types/node": "^22.12.0",
|
|
57
|
+
"@vitejs/plugin-vue": "^6.0.1",
|
|
58
|
+
"eslint": "^8.57.1",
|
|
59
|
+
"eslint-import-resolver-typescript": "^4.3.3",
|
|
60
|
+
"eslint-plugin-import": "^2.31.0",
|
|
61
|
+
"eslint-plugin-vue": "^9.32.0",
|
|
62
|
+
"sass": "1.92.1",
|
|
63
|
+
"typescript": "^5.9.3",
|
|
64
|
+
"unbuild": "^3.0.0",
|
|
65
|
+
"vite": "^5.4.21",
|
|
66
|
+
"vite-plugin-vuetify": "^2.1.2",
|
|
67
|
+
"vue-sfc-transformer": "^0.1.16",
|
|
68
|
+
"vue-tsc": "^3.1.1"
|
|
22
69
|
}
|
|
23
|
-
|
|
24
|
-
"main": "./dist/index.js",
|
|
25
|
-
"module": "./dist/index.mjs",
|
|
26
|
-
"peerDependencies": {
|
|
27
|
-
"@intlify/unplugin-vue-i18n": "^4.0.0",
|
|
28
|
-
"@tanstack/vue-query": "^5.74.5",
|
|
29
|
-
"@vueuse/core": "11.3.0",
|
|
30
|
-
"@vueuse/router": "^13.1.0",
|
|
31
|
-
"ofetch": "^1.4.1",
|
|
32
|
-
"vue": "^3.5.13",
|
|
33
|
-
"vue-i18n": "9.14.5",
|
|
34
|
-
"vue-router": "4.4.5",
|
|
35
|
-
"vue-sonner": "^1.3.0",
|
|
36
|
-
"vue3-perfect-scrollbar": "2.0.0",
|
|
37
|
-
"vuetify": "3.10.11"
|
|
38
|
-
},
|
|
39
|
-
"dependencies": {
|
|
40
|
-
"@vuepic/vue-datepicker": "^11.0.0",
|
|
41
|
-
"cropperjs": "^1.6.2",
|
|
42
|
-
"print-js": "^1.6.0",
|
|
43
|
-
"v-calendar": "^3.1.2",
|
|
44
|
-
"vue-multiselect": "^3.1.0"
|
|
45
|
-
},
|
|
46
|
-
"devDependencies": {
|
|
47
|
-
"@tanstack/eslint-plugin-query": "^5.73.3",
|
|
48
|
-
"@typescript-eslint/eslint-plugin": "^7.18.0",
|
|
49
|
-
"@types/node": "^22.12.0",
|
|
50
|
-
"@vitejs/plugin-vue": "^6.0.1",
|
|
51
|
-
"eslint": "^8.57.1",
|
|
52
|
-
"eslint-import-resolver-typescript": "^4.3.3",
|
|
53
|
-
"eslint-plugin-import": "^2.31.0",
|
|
54
|
-
"eslint-plugin-vue": "^9.32.0",
|
|
55
|
-
"sass": "1.92.1",
|
|
56
|
-
"typescript": "^5.9.3",
|
|
57
|
-
"unbuild": "^3.0.0",
|
|
58
|
-
"vite": "^5.4.21",
|
|
59
|
-
"vite-plugin-vuetify": "^2.1.2",
|
|
60
|
-
"vue-sfc-transformer": "^0.1.16",
|
|
61
|
-
"vue-tsc": "^3.1.1"
|
|
62
|
-
},
|
|
63
|
-
"scripts": {
|
|
64
|
-
"dev": "vite",
|
|
65
|
-
"build": "unbuild",
|
|
66
|
-
"lint": "eslint \"**/*.{ts,vue,mjs}\"",
|
|
67
|
-
"lint:fix": "eslint \"**/*.{ts,vue,mjs}\" --fix",
|
|
68
|
-
"bump": "pnpm run build && pnpm version patch"
|
|
69
|
-
}
|
|
70
|
-
}
|
|
70
|
+
}
|
package/dist/.DS_Store
DELETED
|
Binary file
|