@winchsa/ui 0.1.31 → 0.1.33
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/package.json +1 -1
- package/dist/components/Breadcrumbs.d.vue.ts +0 -7
- package/dist/components/Breadcrumbs.vue +0 -46
- package/dist/components/Breadcrumbs.vue.d.ts +0 -7
- package/dist/components/CustomizerSection.d.vue.ts +0 -17
- package/dist/components/CustomizerSection.vue +0 -19
- package/dist/components/CustomizerSection.vue.d.ts +0 -17
- package/dist/components/DialogCloseBtn.d.vue.ts +0 -7
- package/dist/components/DialogCloseBtn.vue +0 -20
- package/dist/components/DialogCloseBtn.vue.d.ts +0 -7
- package/dist/components/Drawer.d.vue.ts +0 -28
- package/dist/components/Drawer.vue +0 -60
- package/dist/components/Drawer.vue.d.ts +0 -28
- package/dist/components/IconBtn.d.vue.ts +0 -18
- package/dist/components/IconBtn.vue +0 -24
- package/dist/components/IconBtn.vue.d.ts +0 -18
- package/dist/components/LoadingBar.d.vue.ts +0 -6
- package/dist/components/LoadingBar.vue +0 -31
- package/dist/components/LoadingBar.vue.d.ts +0 -6
- package/dist/components/LoadingDialog.d.vue.ts +0 -12
- package/dist/components/LoadingDialog.vue +0 -41
- package/dist/components/LoadingDialog.vue.d.ts +0 -12
- package/dist/components/LoadingItem.d.vue.ts +0 -25
- package/dist/components/LoadingItem.vue +0 -66
- package/dist/components/LoadingItem.vue.d.ts +0 -25
- package/dist/components/Modal.d.vue.ts +0 -50
- package/dist/components/Modal.vue +0 -155
- package/dist/components/Modal.vue.d.ts +0 -50
- package/dist/components/MoreBtn.d.vue.ts +0 -17
- package/dist/components/MoreBtn.vue +0 -28
- package/dist/components/MoreBtn.vue.d.ts +0 -17
- package/dist/components/ScrollToTop.d.vue.ts +0 -3
- package/dist/components/ScrollToTop.vue +0 -39
- package/dist/components/ScrollToTop.vue.d.ts +0 -3
- package/dist/components/SiteTitle.d.vue.ts +0 -3
- package/dist/components/SiteTitle.vue +0 -14
- package/dist/components/SiteTitle.vue.d.ts +0 -3
- package/dist/components/Toaster.d.vue.ts +0 -6
- package/dist/components/Toaster.vue +0 -19
- package/dist/components/Toaster.vue.d.ts +0 -6
- package/dist/components/cards/AppCard.d.vue.ts +0 -18
- package/dist/components/cards/AppCard.vue +0 -45
- package/dist/components/cards/AppCard.vue.d.ts +0 -18
- package/dist/components/cards/AppCardActions.d.vue.ts +0 -33
- package/dist/components/cards/AppCardActions.vue +0 -126
- package/dist/components/cards/AppCardActions.vue.d.ts +0 -33
- package/dist/components/cards/CardStatisticsHorizontal.d.vue.ts +0 -9
- package/dist/components/cards/CardStatisticsHorizontal.vue +0 -29
- package/dist/components/cards/CardStatisticsHorizontal.vue.d.ts +0 -9
- package/dist/components/cards/CheckboxesCard.d.vue.ts +0 -18
- package/dist/components/cards/CheckboxesCard.vue +0 -108
- package/dist/components/cards/CheckboxesCard.vue.d.ts +0 -18
- package/dist/components/cards/HeaderCard.d.vue.ts +0 -9
- package/dist/components/cards/HeaderCard.vue +0 -31
- package/dist/components/cards/HeaderCard.vue.d.ts +0 -9
- package/dist/components/cards/ImageCard.d.vue.ts +0 -33
- package/dist/components/cards/ImageCard.vue +0 -73
- package/dist/components/cards/ImageCard.vue.d.ts +0 -33
- package/dist/components/cards/InputCard.d.vue.ts +0 -21
- package/dist/components/cards/InputCard.vue +0 -60
- package/dist/components/cards/InputCard.vue.d.ts +0 -21
- package/dist/components/cards/StaticCard.d.vue.ts +0 -21
- package/dist/components/cards/StaticCard.vue +0 -37
- package/dist/components/cards/StaticCard.vue.d.ts +0 -21
- package/dist/components/forms/Accordion.d.vue.ts +0 -19
- package/dist/components/forms/Accordion.vue +0 -43
- package/dist/components/forms/Accordion.vue.d.ts +0 -19
- package/dist/components/forms/AppBarSearch.d.vue.ts +0 -43
- package/dist/components/forms/AppBarSearch.vue +0 -345
- package/dist/components/forms/AppBarSearch.vue.d.ts +0 -43
- package/dist/components/forms/AppCombobox.d.vue.ts +0 -13
- package/dist/components/forms/AppCombobox.vue +0 -67
- package/dist/components/forms/AppCombobox.vue.d.ts +0 -13
- package/dist/components/forms/AppDrawerHeaderSection.d.vue.ts +0 -20
- package/dist/components/forms/AppDrawerHeaderSection.vue +0 -21
- package/dist/components/forms/AppDrawerHeaderSection.vue.d.ts +0 -20
- package/dist/components/forms/AppLabel.d.vue.ts +0 -24
- package/dist/components/forms/AppLabel.vue +0 -47
- package/dist/components/forms/AppLabel.vue.d.ts +0 -24
- package/dist/components/forms/AppLink.d.vue.ts +0 -19
- package/dist/components/forms/AppLink.vue +0 -50
- package/dist/components/forms/AppLink.vue.d.ts +0 -19
- package/dist/components/forms/AppNumberField.d.vue.ts +0 -20
- package/dist/components/forms/AppNumberField.vue +0 -85
- package/dist/components/forms/AppNumberField.vue.d.ts +0 -20
- package/dist/components/forms/AppOtpInput.d.vue.ts +0 -13
- package/dist/components/forms/AppOtpInput.vue +0 -84
- package/dist/components/forms/AppOtpInput.vue.d.ts +0 -13
- package/dist/components/forms/AppSearchHeader.d.vue.ts +0 -8
- package/dist/components/forms/AppSearchHeader.vue +0 -72
- package/dist/components/forms/AppSearchHeader.vue.d.ts +0 -8
- package/dist/components/forms/AppSelect.d.vue.ts +0 -17
- package/dist/components/forms/AppSelect.vue +0 -98
- package/dist/components/forms/AppSelect.vue.d.ts +0 -17
- package/dist/components/forms/AppStepper.d.vue.ts +0 -21
- package/dist/components/forms/AppStepper.vue +0 -232
- package/dist/components/forms/AppStepper.vue.d.ts +0 -21
- package/dist/components/forms/AppSwitch.d.vue.ts +0 -16
- package/dist/components/forms/AppSwitch.vue +0 -59
- package/dist/components/forms/AppSwitch.vue.d.ts +0 -16
- package/dist/components/forms/AppTextField.d.vue.ts +0 -13
- package/dist/components/forms/AppTextField.vue +0 -66
- package/dist/components/forms/AppTextField.vue.d.ts +0 -13
- package/dist/components/forms/AppTextarea.d.vue.ts +0 -13
- package/dist/components/forms/AppTextarea.vue +0 -69
- package/dist/components/forms/AppTextarea.vue.d.ts +0 -13
- package/dist/components/forms/AttachmentCropperInput.d.vue.ts +0 -18
- package/dist/components/forms/AttachmentCropperInput.vue +0 -227
- package/dist/components/forms/AttachmentCropperInput.vue.d.ts +0 -18
- package/dist/components/forms/AttachmentInput.d.vue.ts +0 -16
- package/dist/components/forms/AttachmentInput.vue +0 -116
- package/dist/components/forms/AttachmentInput.vue.d.ts +0 -16
- package/dist/components/forms/AutocompleteInput.d.vue.ts +0 -84
- package/dist/components/forms/AutocompleteInput.vue +0 -760
- package/dist/components/forms/AutocompleteInput.vue.d.ts +0 -84
- package/dist/components/forms/BankSelect.d.vue.ts +0 -21
- package/dist/components/forms/BankSelect.vue +0 -43
- package/dist/components/forms/BankSelect.vue.d.ts +0 -21
- package/dist/components/forms/BaseButton.d.vue.ts +0 -20
- package/dist/components/forms/BaseButton.vue +0 -42
- package/dist/components/forms/BaseButton.vue.d.ts +0 -20
- package/dist/components/forms/CounterInput.d.vue.ts +0 -13
- package/dist/components/forms/CounterInput.vue +0 -71
- package/dist/components/forms/CounterInput.vue.d.ts +0 -13
- package/dist/components/forms/CustomCheckboxes.d.vue.ts +0 -25
- package/dist/components/forms/CustomCheckboxes.vue +0 -69
- package/dist/components/forms/CustomCheckboxes.vue.d.ts +0 -25
- package/dist/components/forms/CustomCheckboxesWithIcon.d.vue.ts +0 -25
- package/dist/components/forms/CustomCheckboxesWithIcon.vue +0 -80
- package/dist/components/forms/CustomCheckboxesWithIcon.vue.d.ts +0 -25
- package/dist/components/forms/CustomCheckboxesWithImage.d.vue.ts +0 -16
- package/dist/components/forms/CustomCheckboxesWithImage.vue +0 -67
- package/dist/components/forms/CustomCheckboxesWithImage.vue.d.ts +0 -16
- package/dist/components/forms/CustomRadios.d.vue.ts +0 -25
- package/dist/components/forms/CustomRadios.vue +0 -69
- package/dist/components/forms/CustomRadios.vue.d.ts +0 -25
- package/dist/components/forms/CustomRadiosWithIcon.d.vue.ts +0 -28
- package/dist/components/forms/CustomRadiosWithIcon.vue +0 -98
- package/dist/components/forms/CustomRadiosWithIcon.vue.d.ts +0 -28
- package/dist/components/forms/CustomRadiosWithImage.d.vue.ts +0 -35
- package/dist/components/forms/CustomRadiosWithImage.vue +0 -69
- package/dist/components/forms/CustomRadiosWithImage.vue.d.ts +0 -35
- package/dist/components/forms/DatePicker.d.vue.ts +0 -29
- package/dist/components/forms/DatePicker.vue +0 -400
- package/dist/components/forms/DatePicker.vue.d.ts +0 -29
- package/dist/components/forms/DatePickerRange.d.vue.ts +0 -24
- package/dist/components/forms/DatePickerRange.vue +0 -127
- package/dist/components/forms/DatePickerRange.vue.d.ts +0 -24
- package/dist/components/forms/DraggedUploadFile.d.vue.ts +0 -11
- package/dist/components/forms/DraggedUploadFile.vue +0 -120
- package/dist/components/forms/DraggedUploadFile.vue.d.ts +0 -11
- package/dist/components/forms/ImageCardInput.d.vue.ts +0 -35
- package/dist/components/forms/ImageCardInput.vue +0 -234
- package/dist/components/forms/ImageCardInput.vue.d.ts +0 -35
- package/dist/components/forms/InputValidationWrapper.d.vue.ts +0 -26
- package/dist/components/forms/InputValidationWrapper.vue +0 -24
- package/dist/components/forms/InputValidationWrapper.vue.d.ts +0 -26
- package/dist/components/forms/LicensePlateInput.d.vue.ts +0 -21
- package/dist/components/forms/LicensePlateInput.vue +0 -175
- package/dist/components/forms/LicensePlateInput.vue.d.ts +0 -21
- package/dist/components/forms/ManualDate.d.vue.ts +0 -20
- package/dist/components/forms/ManualDate.vue +0 -264
- package/dist/components/forms/ManualDate.vue.d.ts +0 -20
- package/dist/components/forms/MobileInput.d.vue.ts +0 -25
- package/dist/components/forms/MobileInput.vue +0 -118
- package/dist/components/forms/MobileInput.vue.d.ts +0 -25
- package/dist/components/forms/PasswordInput.d.vue.ts +0 -11
- package/dist/components/forms/PasswordInput.vue +0 -29
- package/dist/components/forms/PasswordInput.vue.d.ts +0 -11
- package/dist/components/forms/RangeInput.d.vue.ts +0 -10
- package/dist/components/forms/RangeInput.vue +0 -48
- package/dist/components/forms/RangeInput.vue.d.ts +0 -10
- package/dist/components/forms/Tabs.d.vue.ts +0 -23
- package/dist/components/forms/Tabs.vue +0 -35
- package/dist/components/forms/Tabs.vue.d.ts +0 -23
- package/dist/components/forms/TimePicker.d.vue.ts +0 -18
- package/dist/components/forms/TimePicker.vue +0 -370
- package/dist/components/forms/TimePicker.vue.d.ts +0 -18
- package/dist/components/table/DataTable.d.vue.ts +0 -70
- package/dist/components/table/DataTable.vue +0 -361
- package/dist/components/table/DataTable.vue.d.ts +0 -70
- package/dist/components/table/EditableDataTable.d.vue.ts +0 -21
- package/dist/components/table/EditableDataTable.vue +0 -330
- package/dist/components/table/EditableDataTable.vue.d.ts +0 -21
- package/dist/components/table/EditableDataTableRow.d.vue.ts +0 -20
- package/dist/components/table/EditableDataTableRow.vue +0 -253
- package/dist/components/table/EditableDataTableRow.vue.d.ts +0 -20
- package/dist/components/table/FilterGenerator.d.vue.ts +0 -13
- package/dist/components/table/FilterGenerator.vue +0 -231
- package/dist/components/table/FilterGenerator.vue.d.ts +0 -13
- package/dist/components/table/StaticTable.d.vue.ts +0 -34
- package/dist/components/table/StaticTable.vue +0 -152
- package/dist/components/table/StaticTable.vue.d.ts +0 -34
- package/dist/components/table/TablePagination.d.vue.ts +0 -15
- package/dist/components/table/TablePagination.vue +0 -73
- package/dist/components/table/TablePagination.vue.d.ts +0 -15
- package/dist/composables/useIsMobile.d.ts +0 -1
- package/dist/composables/useIsMobile.js +0 -10
- package/dist/composables/useIsMobile.mjs +0 -4
- package/dist/composables/useTableFilters.d.ts +0 -23
- package/dist/composables/useTableFilters.js +0 -197
- package/dist/composables/useTableFilters.mjs +0 -184
- package/dist/images/avatar.png +0 -0
- package/dist/images/sa.svg +0 -1
- package/dist/index.d.ts +0 -65
- package/dist/index.js +0 -454
- package/dist/index.mjs +0 -130
- package/dist/lang/ar.json +0 -54
- package/dist/lang/en.json +0 -54
- package/dist/styles/assets/scss/variables/_template.scss +0 -1
- package/dist/styles/assets/scss/variables/_vuetify.scss +0 -1
- package/dist/styles/core/base/_components.scss +0 -164
- package/dist/styles/core/base/_dark.scss +0 -16
- package/dist/styles/core/base/_default-layout-w-vertical-nav.scss +0 -106
- package/dist/styles/core/base/_default-layout.scss +0 -16
- package/dist/styles/core/base/_index.scss +0 -47
- package/dist/styles/core/base/_layouts.scss +0 -63
- package/dist/styles/core/base/_misc.scss +0 -20
- package/dist/styles/core/base/_mixins.scss +0 -84
- package/dist/styles/core/base/_route-transitions.scss +0 -70
- package/dist/styles/core/base/_utilities.scss +0 -418
- package/dist/styles/core/base/_utils.scss +0 -100
- package/dist/styles/core/base/_variables.scss +0 -190
- package/dist/styles/core/base/_vertical-nav.scss +0 -264
- package/dist/styles/core/base/libs/_perfect-scrollbar.scss +0 -35
- package/dist/styles/core/base/libs/vuetify/_index.scss +0 -1
- package/dist/styles/core/base/libs/vuetify/_overrides.scss +0 -380
- package/dist/styles/core/base/libs/vuetify/_variables.scss +0 -48
- package/dist/styles/core/base/placeholders/_default-layout-vertical-nav.scss +0 -48
- package/dist/styles/core/base/placeholders/_default-layout.scss +0 -3
- package/dist/styles/core/base/placeholders/_index.scss +0 -5
- package/dist/styles/core/base/placeholders/_misc.scss +0 -7
- package/dist/styles/core/base/placeholders/_nav.scss +0 -26
- package/dist/styles/core/base/placeholders/_vertical-nav.scss +0 -84
- package/dist/styles/core/base/skins/_bordered.scss +0 -60
- package/dist/styles/core/base/skins/_index.scss +0 -1
- package/dist/styles/core/template/_components.scss +0 -1035
- package/dist/styles/core/template/_default-layout-w-vertical-nav.scss +0 -20
- package/dist/styles/core/template/_utilities.scss +0 -20
- package/dist/styles/core/template/_variables.scss +0 -67
- package/dist/styles/core/template/_vertical-nav.scss +0 -41
- package/dist/styles/core/template/index.css +0 -18779
- package/dist/styles/core/template/index.scss +0 -15
- package/dist/styles/core/template/libs/vuetify/_variables.scss +0 -464
- package/dist/styles/core/template/libs/vuetify/index.css +0 -739
- package/dist/styles/core/template/libs/vuetify/index.scss +0 -1
- package/dist/styles/core/template/pages/misc.css +0 -16
- package/dist/styles/core/template/pages/misc.scss +0 -20
- package/dist/styles/core/template/placeholders/_default-layout-vertical-nav.scss +0 -9
- package/dist/styles/core/template/placeholders/_index.scss +0 -3
- package/dist/styles/core/template/placeholders/_nav.scss +0 -15
- package/dist/styles/core/template/placeholders/_vertical-nav.scss +0 -18
- package/dist/styles/core/template/skins/_bordered.scss +0 -36
- package/dist/styles/core/template/skins/_index.scss +0 -1
- package/dist/styles/layouts/_classes.scss +0 -3
- package/dist/styles/layouts/_dashboard-layout.scss +0 -43
- package/dist/styles/layouts/_global.scss +0 -10
- package/dist/styles/layouts/_mixins.scss +0 -28
- package/dist/styles/layouts/_placeholders.scss +0 -53
- package/dist/styles/layouts/_rtl.scss +0 -7
- package/dist/styles/layouts/_variables.scss +0 -22
- package/dist/styles/layouts/index.css +0 -14
- package/dist/styles/layouts/index.scss +0 -2
- package/dist/types.d.ts +0 -218
- package/dist/utils/apiUrl.d.ts +0 -1
- package/dist/utils/apiUrl.js +0 -15
- package/dist/utils/apiUrl.mjs +0 -8
- package/dist/utils/client.d.ts +0 -9
- package/dist/utils/client.js +0 -53
- package/dist/utils/client.mjs +0 -39
- package/dist/utils/files.d.ts +0 -2
- package/dist/utils/files.js +0 -35
- package/dist/utils/files.mjs +0 -22
- package/dist/utils/formValidation.d.ts +0 -7
- package/dist/utils/formValidation.js +0 -20
- package/dist/utils/formValidation.mjs +0 -13
- package/dist/utils/formatters.d.ts +0 -12
- package/dist/utils/formatters.js +0 -84
- package/dist/utils/formatters.mjs +0 -56
- package/dist/utils/hijriDate.d.ts +0 -58
- package/dist/utils/hijriDate.js +0 -168
- package/dist/utils/hijriDate.mjs +0 -1951
- package/dist/utils/i18n.d.ts +0 -8
- package/dist/utils/i18n.js +0 -36
- package/dist/utils/i18n.mjs +0 -27
- package/dist/utils/index.d.ts +0 -10
- package/dist/utils/index.js +0 -115
- package/dist/utils/index.mjs +0 -10
- package/dist/utils/queryParams.d.ts +0 -4
- package/dist/utils/queryParams.js +0 -26
- package/dist/utils/queryParams.mjs +0 -18
- package/dist/utils/ruleValidator.d.ts +0 -41
- package/dist/utils/ruleValidator.js +0 -210
- package/dist/utils/ruleValidator.mjs +0 -195
- package/dist/utils/toaster.d.ts +0 -12
- package/dist/utils/toaster.js +0 -68
- package/dist/utils/toaster.mjs +0 -58
- package/dist/utils/utils.d.ts +0 -9
- package/dist/utils/utils.js +0 -84
- package/dist/utils/utils.mjs +0 -67
package/dist/utils/files.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.saveFile = exports.printPdf = void 0;
|
|
7
|
-
var _printJs = _interopRequireDefault(require("print-js"));
|
|
8
|
-
var _client = require("./client");
|
|
9
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
-
const printPdf = async url => {
|
|
11
|
-
const {
|
|
12
|
-
data
|
|
13
|
-
} = await _client.client.get(`/pdf/base64?url=${url}`, {
|
|
14
|
-
ignoreUrlPrefix: true
|
|
15
|
-
});
|
|
16
|
-
if (data) {
|
|
17
|
-
await (0, _printJs.default)({
|
|
18
|
-
printable: data,
|
|
19
|
-
type: "pdf",
|
|
20
|
-
base64: true
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
exports.printPdf = printPdf;
|
|
25
|
-
const saveFile = (blob, fileName) => {
|
|
26
|
-
const urlFile = window.URL.createObjectURL(blob);
|
|
27
|
-
const a = document.createElement("a");
|
|
28
|
-
a.style.display = "none";
|
|
29
|
-
a.href = urlFile;
|
|
30
|
-
a.download = fileName ?? `${Date.now()}`;
|
|
31
|
-
document.body.appendChild(a);
|
|
32
|
-
a.click();
|
|
33
|
-
window.URL.revokeObjectURL(urlFile);
|
|
34
|
-
};
|
|
35
|
-
exports.saveFile = saveFile;
|
package/dist/utils/files.mjs
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import printJS from "print-js";
|
|
2
|
-
import { client } from "./client.mjs";
|
|
3
|
-
export const printPdf = async (url) => {
|
|
4
|
-
const { data } = await client.get(`/pdf/base64?url=${url}`, { ignoreUrlPrefix: true });
|
|
5
|
-
if (data) {
|
|
6
|
-
await printJS({
|
|
7
|
-
printable: data,
|
|
8
|
-
type: "pdf",
|
|
9
|
-
base64: true
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
export const saveFile = (blob, fileName) => {
|
|
14
|
-
const urlFile = window.URL.createObjectURL(blob);
|
|
15
|
-
const a = document.createElement("a");
|
|
16
|
-
a.style.display = "none";
|
|
17
|
-
a.href = urlFile;
|
|
18
|
-
a.download = fileName ?? `${Date.now()}`;
|
|
19
|
-
document.body.appendChild(a);
|
|
20
|
-
a.click();
|
|
21
|
-
window.URL.revokeObjectURL(urlFile);
|
|
22
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { ErrorResponseFiled } from '../types';
|
|
2
|
-
export declare function formValidator(errors: ErrorResponseFiled[] | undefined, key: string): {
|
|
3
|
-
getError: () => ErrorResponseFiled | undefined;
|
|
4
|
-
getMessage: () => string;
|
|
5
|
-
hasError: () => boolean;
|
|
6
|
-
};
|
|
7
|
-
export declare function getErrorMessage(errors: ErrorResponseFiled[] | undefined, key: string): string;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.formValidator = formValidator;
|
|
7
|
-
exports.getErrorMessage = getErrorMessage;
|
|
8
|
-
function formValidator(errors = [], key) {
|
|
9
|
-
const getError = () => errors?.find(e => e.field == key);
|
|
10
|
-
const getMessage = () => getError()?.message || "";
|
|
11
|
-
const hasError = () => Boolean(getError()?.field);
|
|
12
|
-
return {
|
|
13
|
-
getError,
|
|
14
|
-
getMessage,
|
|
15
|
-
hasError
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
function getErrorMessage(errors = [], key) {
|
|
19
|
-
return errors?.find(e => e.field == key)?.message || "";
|
|
20
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export function formValidator(errors = [], key) {
|
|
2
|
-
const getError = () => errors?.find((e) => e.field == key);
|
|
3
|
-
const getMessage = () => getError()?.message || "";
|
|
4
|
-
const hasError = () => Boolean(getError()?.field);
|
|
5
|
-
return {
|
|
6
|
-
getError,
|
|
7
|
-
getMessage,
|
|
8
|
-
hasError
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
export function getErrorMessage(errors = [], key) {
|
|
12
|
-
return errors?.find((e) => e.field == key)?.message || "";
|
|
13
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export declare const formatDate: (date: string) => string;
|
|
2
|
-
export declare const formatDateWithoutTime: (date: string | Date, format?: string) => string;
|
|
3
|
-
export declare const formatTime: (date: string) => string;
|
|
4
|
-
export declare const formatDateWithTime: (date: string) => string;
|
|
5
|
-
export declare const formatDateWithDay: (date: string) => string;
|
|
6
|
-
export declare const extractDate: (dateString: string | Date | null, format?: string, hasTime?: boolean) => {
|
|
7
|
-
day: string;
|
|
8
|
-
month: string;
|
|
9
|
-
year: string;
|
|
10
|
-
} | null;
|
|
11
|
-
export declare const formatNumber: (number: number | undefined | string, withCurrency?: boolean) => string;
|
|
12
|
-
export declare const formatNumberColor: (number: number | string | undefined) => string;
|
package/dist/utils/formatters.js
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.formatTime = exports.formatNumberColor = exports.formatNumber = exports.formatDateWithoutTime = exports.formatDateWithTime = exports.formatDateWithDay = exports.formatDate = exports.extractDate = void 0;
|
|
7
|
-
var _core = require("@vueuse/core");
|
|
8
|
-
var _vueI18n = require("vue-i18n");
|
|
9
|
-
const formatDate = date => {
|
|
10
|
-
return (0, _core.useDateFormat)(date, "DD/MM/YYYY \n hh:mm A").value;
|
|
11
|
-
};
|
|
12
|
-
exports.formatDate = formatDate;
|
|
13
|
-
const formatDateWithoutTime = (date, format = "DD/MM/YYYY") => {
|
|
14
|
-
return (0, _core.useDateFormat)(date, format).value;
|
|
15
|
-
};
|
|
16
|
-
exports.formatDateWithoutTime = formatDateWithoutTime;
|
|
17
|
-
const formatTime = date => {
|
|
18
|
-
return (0, _core.useDateFormat)(date, "hh:mm A").value;
|
|
19
|
-
};
|
|
20
|
-
exports.formatTime = formatTime;
|
|
21
|
-
const formatDateWithTime = date => {
|
|
22
|
-
return (0, _core.useDateFormat)(date, "DD/MM/YYYY - hh:mm A").value;
|
|
23
|
-
};
|
|
24
|
-
exports.formatDateWithTime = formatDateWithTime;
|
|
25
|
-
const formatDateWithDay = date => {
|
|
26
|
-
const {
|
|
27
|
-
locale
|
|
28
|
-
} = (0, _vueI18n.useI18n)({
|
|
29
|
-
useScope: "global"
|
|
30
|
-
});
|
|
31
|
-
return (0, _core.useDateFormat)(date, "HH:mm A dddd - DD/MM/YYYY", {
|
|
32
|
-
locales: locale?.value === "ar" ? "ar-SA" : "en-US"
|
|
33
|
-
}).value;
|
|
34
|
-
};
|
|
35
|
-
exports.formatDateWithDay = formatDateWithDay;
|
|
36
|
-
const extractDate = (dateString, format = "DD/MM/YYYY", hasTime = true) => {
|
|
37
|
-
if (!dateString) {
|
|
38
|
-
return null;
|
|
39
|
-
}
|
|
40
|
-
const dateStr = hasTime ? dateString : typeof dateString === "string" ? dateString.split(" ")[0] : dateString;
|
|
41
|
-
const dateFormat = hasTime ? format : format.split(" ")[0];
|
|
42
|
-
const regex = dateFormat.replace(/[\\-]/g, "[/\\-]").replace("YYYY", "(\\d{4})").replace("MM", "(\\d{2})").replace("DD", "(\\d{2})");
|
|
43
|
-
const match = dateStr.toString().match(new RegExp(`^${regex}$`, "i"));
|
|
44
|
-
if (!match) {
|
|
45
|
-
return null;
|
|
46
|
-
}
|
|
47
|
-
const [, day, month, year] = match;
|
|
48
|
-
return {
|
|
49
|
-
day,
|
|
50
|
-
month,
|
|
51
|
-
year
|
|
52
|
-
};
|
|
53
|
-
};
|
|
54
|
-
exports.extractDate = extractDate;
|
|
55
|
-
const formatNumber = (number, withCurrency = false) => {
|
|
56
|
-
const {
|
|
57
|
-
locale
|
|
58
|
-
} = (0, _vueI18n.useI18n)({
|
|
59
|
-
useScope: "global"
|
|
60
|
-
});
|
|
61
|
-
const currency = withCurrency ? String.fromCharCode(59392) : "";
|
|
62
|
-
if (number === void 0 || number === null || number === "" || number === 0) {
|
|
63
|
-
return locale?.value !== "ar" ? `${currency} 0` : `0 ${currency}`;
|
|
64
|
-
}
|
|
65
|
-
if (typeof number === "string") {
|
|
66
|
-
number = parseFloat(number);
|
|
67
|
-
}
|
|
68
|
-
const needsTwoDecimalPlaces = number % 1 !== 0;
|
|
69
|
-
const options = {
|
|
70
|
-
minimumFractionDigits: needsTwoDecimalPlaces ? 2 : 0,
|
|
71
|
-
maximumFractionDigits: needsTwoDecimalPlaces ? 2 : 0
|
|
72
|
-
};
|
|
73
|
-
const formatted = Math.abs(number).toLocaleString("en-US", options);
|
|
74
|
-
return locale?.value !== "ar" ? `${currency} ${number < 0 ? `${formatted}-` : formatted}` : `${number < 0 ? `-${formatted}` : formatted} ${currency}`;
|
|
75
|
-
};
|
|
76
|
-
exports.formatNumber = formatNumber;
|
|
77
|
-
const formatNumberColor = number => {
|
|
78
|
-
const parsedNumber = typeof number === "string" ? parseFloat(number) : number;
|
|
79
|
-
if (parsedNumber === void 0 || parsedNumber === null || parsedNumber === 0 || isNaN(parsedNumber)) {
|
|
80
|
-
return "";
|
|
81
|
-
}
|
|
82
|
-
return parsedNumber > 0 ? "success" : "red";
|
|
83
|
-
};
|
|
84
|
-
exports.formatNumberColor = formatNumberColor;
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { useDateFormat } from "@vueuse/core";
|
|
2
|
-
import { useI18n } from "vue-i18n";
|
|
3
|
-
export const formatDate = (date) => {
|
|
4
|
-
return useDateFormat(date, "DD/MM/YYYY \n hh:mm A").value;
|
|
5
|
-
};
|
|
6
|
-
export const formatDateWithoutTime = (date, format = "DD/MM/YYYY") => {
|
|
7
|
-
return useDateFormat(date, format).value;
|
|
8
|
-
};
|
|
9
|
-
export const formatTime = (date) => {
|
|
10
|
-
return useDateFormat(date, "hh:mm A").value;
|
|
11
|
-
};
|
|
12
|
-
export const formatDateWithTime = (date) => {
|
|
13
|
-
return useDateFormat(date, "DD/MM/YYYY - hh:mm A").value;
|
|
14
|
-
};
|
|
15
|
-
export const formatDateWithDay = (date) => {
|
|
16
|
-
const { locale } = useI18n({ useScope: "global" });
|
|
17
|
-
return useDateFormat(date, "HH:mm A dddd - DD/MM/YYYY", { locales: locale?.value === "ar" ? "ar-SA" : "en-US" }).value;
|
|
18
|
-
};
|
|
19
|
-
export const extractDate = (dateString, format = "DD/MM/YYYY", hasTime = true) => {
|
|
20
|
-
if (!dateString) {
|
|
21
|
-
return null;
|
|
22
|
-
}
|
|
23
|
-
const dateStr = hasTime ? dateString : typeof dateString === "string" ? dateString.split(" ")[0] : dateString;
|
|
24
|
-
const dateFormat = hasTime ? format : format.split(" ")[0];
|
|
25
|
-
const regex = dateFormat.replace(/[\\-]/g, "[/\\-]").replace("YYYY", "(\\d{4})").replace("MM", "(\\d{2})").replace("DD", "(\\d{2})");
|
|
26
|
-
const match = dateStr.toString().match(new RegExp(`^${regex}$`, "i"));
|
|
27
|
-
if (!match) {
|
|
28
|
-
return null;
|
|
29
|
-
}
|
|
30
|
-
const [, day, month, year] = match;
|
|
31
|
-
return { day, month, year };
|
|
32
|
-
};
|
|
33
|
-
export const formatNumber = (number, withCurrency = false) => {
|
|
34
|
-
const { locale } = useI18n({ useScope: "global" });
|
|
35
|
-
const currency = withCurrency ? String.fromCharCode(59392) : "";
|
|
36
|
-
if (number === void 0 || number === null || number === "" || number === 0) {
|
|
37
|
-
return locale?.value !== "ar" ? `${currency} 0` : `0 ${currency}`;
|
|
38
|
-
}
|
|
39
|
-
if (typeof number === "string") {
|
|
40
|
-
number = parseFloat(number);
|
|
41
|
-
}
|
|
42
|
-
const needsTwoDecimalPlaces = number % 1 !== 0;
|
|
43
|
-
const options = {
|
|
44
|
-
minimumFractionDigits: needsTwoDecimalPlaces ? 2 : 0,
|
|
45
|
-
maximumFractionDigits: needsTwoDecimalPlaces ? 2 : 0
|
|
46
|
-
};
|
|
47
|
-
const formatted = Math.abs(number).toLocaleString("en-US", options);
|
|
48
|
-
return locale?.value !== "ar" ? `${currency} ${number < 0 ? `${formatted}-` : formatted}` : `${number < 0 ? `-${formatted}` : formatted} ${currency}`;
|
|
49
|
-
};
|
|
50
|
-
export const formatNumberColor = (number) => {
|
|
51
|
-
const parsedNumber = typeof number === "string" ? parseFloat(number) : number;
|
|
52
|
-
if (parsedNumber === void 0 || parsedNumber === null || parsedNumber === 0 || isNaN(parsedNumber)) {
|
|
53
|
-
return "";
|
|
54
|
-
}
|
|
55
|
-
return parsedNumber > 0 ? "success" : "red";
|
|
56
|
-
};
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
interface HDate {
|
|
2
|
-
year: number;
|
|
3
|
-
month: number;
|
|
4
|
-
day: number;
|
|
5
|
-
toString(): string;
|
|
6
|
-
toFormat(format: string): string;
|
|
7
|
-
format(year: number, month: number, day: number, format: string): string;
|
|
8
|
-
}
|
|
9
|
-
interface LanguageConfig {
|
|
10
|
-
notation: string;
|
|
11
|
-
zero: string;
|
|
12
|
-
one: string;
|
|
13
|
-
two: string;
|
|
14
|
-
three: string;
|
|
15
|
-
four: string;
|
|
16
|
-
five: string;
|
|
17
|
-
six: string;
|
|
18
|
-
seven: string;
|
|
19
|
-
eight: string;
|
|
20
|
-
nine: string;
|
|
21
|
-
monthNames: string[];
|
|
22
|
-
monthShortNames: string[];
|
|
23
|
-
formatLocale: (hDate: string) => string;
|
|
24
|
-
}
|
|
25
|
-
interface HijriJSConfig {
|
|
26
|
-
currentLanguage: string;
|
|
27
|
-
today(): HDate;
|
|
28
|
-
toGregorian(dateString: string, splitter?: string): Date | undefined;
|
|
29
|
-
toHijri(dateString: string, splitter?: string): HDate | undefined;
|
|
30
|
-
hijriToGregorian(year: number | string, month: number | string, day: number | string): Date | string;
|
|
31
|
-
gregorianToHijri(pYear: number | string, pMonth: number | string, pDay: number | string): HDate;
|
|
32
|
-
julianToGregorian(julianDate: number): Date;
|
|
33
|
-
HDate: new (year: number, month: number, day: number) => HDate;
|
|
34
|
-
vlidateHijri(year: number, month: number, day: number): boolean;
|
|
35
|
-
validateGregorian(year: number, month: number, day: number): boolean;
|
|
36
|
-
lang: Record<string, LanguageConfig>;
|
|
37
|
-
ummalqura_dat: number[];
|
|
38
|
-
}
|
|
39
|
-
declare const ummalqura_dat: number[];
|
|
40
|
-
declare const lang: Record<string, LanguageConfig>;
|
|
41
|
-
declare class HDateClass implements HDate {
|
|
42
|
-
year: number;
|
|
43
|
-
month: number;
|
|
44
|
-
day: number;
|
|
45
|
-
constructor(year: number, month: number, day: number);
|
|
46
|
-
toString(): string;
|
|
47
|
-
toFormat(format: string): string;
|
|
48
|
-
format(year: number, month: number, day: number, format: string): string;
|
|
49
|
-
}
|
|
50
|
-
declare function vlidateHijri(year: number, month: number, day: number): boolean;
|
|
51
|
-
declare function validateGregorian(year: number, month: number, day: number): boolean;
|
|
52
|
-
declare function julianToGregorian(julianDate: number): Date;
|
|
53
|
-
declare function hijriToGregorian(year: number | string, month: number | string, day: number | string): Date | string;
|
|
54
|
-
declare function gregorianToHijri(pYear: number | string, pMonth: number | string, pDay: number | string): HDate;
|
|
55
|
-
declare const HijriJS: HijriJSConfig;
|
|
56
|
-
export default HijriJS;
|
|
57
|
-
export { HijriJS, HDateClass, gregorianToHijri, hijriToGregorian, julianToGregorian, vlidateHijri, validateGregorian, lang, ummalqura_dat };
|
|
58
|
-
export type { HDate, LanguageConfig, HijriJSConfig };
|
package/dist/utils/hijriDate.js
DELETED
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
module.exports = exports.HijriJS = exports.HDateClass = void 0;
|
|
7
|
-
exports.gregorianToHijri = gregorianToHijri;
|
|
8
|
-
exports.hijriToGregorian = hijriToGregorian;
|
|
9
|
-
exports.julianToGregorian = julianToGregorian;
|
|
10
|
-
exports.ummalqura_dat = exports.lang = void 0;
|
|
11
|
-
exports.validateGregorian = validateGregorian;
|
|
12
|
-
exports.vlidateHijri = vlidateHijri;
|
|
13
|
-
const ummalqura_dat = exports.ummalqura_dat = [28607, 28636, 28665, 28695, 28724, 28754, 28783, 28813, 28843, 28872, 28901, 28931, 28960, 28990, 29019, 29049, 29078, 29108, 29137, 29167, 29196, 29226, 29255, 29285, 29315, 29345, 29375, 29404, 29434, 29463, 29492, 29522, 29551, 29580, 29610, 29640, 29669, 29699, 29729, 29759, 29788, 29818, 29847, 29876, 29906, 29935, 29964, 29994, 30023, 30053, 30082, 30112, 30141, 30171, 30200, 30230, 30259, 30289, 30318, 30348, 30378, 30408, 30437, 30467, 30496, 30526, 30555, 30585, 30614, 30644, 30673, 30703, 30732, 30762, 30791, 30821, 30850, 30880, 30909, 30939, 30968, 30998, 31027, 31057, 31086, 31116, 31145, 31175, 31204, 31234, 31263, 31293, 31322, 31352, 31381, 31411, 31441, 31471, 31500, 31530, 31559, 31589, 31618, 31648, 31676, 31706, 31736, 31766, 31795, 31825, 31854, 31884, 31913, 31943, 31972, 32002, 32031, 32061, 32090, 32120, 32150, 32180, 32209, 32239, 32268, 32298, 32327, 32357, 32386, 32416, 32445, 32475, 32504, 32534, 32563, 32593, 32622, 32652, 32681, 32711, 32740, 32770, 32799, 32829, 32858, 32888, 32917, 32947, 32976, 33006, 33035, 33065, 33094, 33124, 33153, 33183, 33213, 33243, 33272, 33302, 33331, 33361, 33390, 33420, 33450, 33479, 33509, 33539, 33568, 33598, 33627, 33657, 33686, 33716, 33745, 33775, 33804, 33834, 33863, 33893, 33922, 33952, 33981, 34011, 34040, 34069, 34099, 34128, 34158, 34187, 34217, 34247, 34277, 34306, 34336, 34365, 34395, 34424, 34454, 34483, 34512, 34542, 34571, 34601, 34631, 34660, 34690, 34719, 34749, 34778, 34808, 34837, 34867, 34896, 34926, 34955, 34985, 35015, 35044, 35074, 35103, 35133, 35162, 35192, 35222, 35251, 35280, 35310, 35340, 35370, 35399, 35429, 35458, 35488, 35517, 35547, 35576, 35605, 35635, 35665, 35694, 35723, 35753, 35782, 35811, 35841, 35871, 35901, 35930, 35960, 35989, 36019, 36048, 36078, 36107, 36136, 36166, 36195, 36225, 36254, 36284, 36314, 36343, 36373, 36403, 36433, 36462, 36492, 36521, 36551, 36580, 36610, 36639, 36669, 36698, 36728, 36757, 36786, 36816, 36845, 36875, 36904, 36934, 36963, 36993, 37022, 37052, 37081, 37111, 37141, 37170, 37200, 37229, 37259, 37288, 37318, 37347, 37377, 37406, 37436, 37465, 37495, 37524, 37554, 37584, 37613, 37643, 37672, 37701, 37731, 37760, 37790, 37819, 37849, 37878, 37908, 37938, 37967, 37997, 38027, 38056, 38085, 38115, 38144, 38174, 38203, 38233, 38262, 38292, 38322, 38351, 38381, 38410, 38440, 38469, 38499, 38528, 38558, 38587, 38617, 38646, 38676, 38705, 38735, 38764, 38794, 38823, 38853, 38882, 38912, 38941, 38971, 39001, 39030, 39059, 39089, 39118, 39148, 39178, 39208, 39237, 39267, 39297, 39326, 39355, 39385, 39414, 39444, 39473, 39503, 39532, 39562, 39592, 39621, 39650, 39680, 39709, 39739, 39768, 39798, 39827, 39857, 39886, 39916, 39946, 39975, 40005, 40035, 40064, 40094, 40123, 40153, 40182, 40212, 40241, 40271, 40300, 40330, 40359, 40389, 40418, 40448, 40477, 40507, 40536, 40566, 40595, 40625, 40655, 40685, 40714, 40744, 40773, 40803, 40832, 40862, 40892, 40921, 40951, 40980, 41009, 41039, 41068, 41098, 41127, 41157, 41186, 41216, 41245, 41275, 41304, 41334, 41364, 41393, 41422, 41452, 41481, 41511, 41540, 41570, 41599, 41629, 41658, 41688, 41718, 41748, 41777, 41807, 41836, 41865, 41894, 41924, 41953, 41983, 42012, 42042, 42072, 42102, 42131, 42161, 42190, 42220, 42249, 42279, 42308, 42337, 42367, 42397, 42426, 42456, 42485, 42515, 42545, 42574, 42604, 42633, 42662, 42692, 42721, 42751, 42780, 42810, 42839, 42869, 42899, 42929, 42958, 42988, 43017, 43046, 43076, 43105, 43135, 43164, 43194, 43223, 43253, 43283, 43312, 43342, 43371, 43401, 43430, 43460, 43489, 43519, 43548, 43578, 43607, 43637, 43666, 43696, 43726, 43755, 43785, 43814, 43844, 43873, 43903, 43932, 43962, 43991, 44021, 44050, 44080, 44109, 44139, 44169, 44198, 44228, 44258, 44287, 44317, 44346, 44375, 44405, 44434, 44464, 44493, 44523, 44553, 44582, 44612, 44641, 44671, 44700, 44730, 44759, 44788, 44818, 44847, 44877, 44906, 44936, 44966, 44996, 45025, 45055, 45084, 45114, 45143, 45172, 45202, 45231, 45261, 45290, 45320, 45350, 45380, 45409, 45439, 45468, 45498, 45527, 45556, 45586, 45615, 45644, 45674, 45704, 45733, 45763, 45793, 45823, 45852, 45882, 45911, 45940, 45970, 45999, 46028, 46058, 46088, 46117, 46147, 46177, 46206, 46236, 46265, 46295, 46324, 46354, 46383, 46413, 46442, 46472, 46501, 46531, 46560, 46590, 46620, 46649, 46679, 46708, 46738, 46767, 46797, 46826, 46856, 46885, 46915, 46944, 46974, 47003, 47033, 47063, 47092, 47122, 47151, 47181, 47210, 47240, 47269, 47298, 47328, 47357, 47387, 47417, 47446, 47476, 47506, 47535, 47565, 47594, 47624, 47653, 47682, 47712, 47741, 47771, 47800, 47830, 47860, 47890, 47919, 47949, 47978, 48008, 48037, 48066, 48096, 48125, 48155, 48184, 48214, 48244, 48273, 48303, 48333, 48362, 48392, 48421, 48450, 48480, 48509, 48538, 48568, 48598, 48627, 48657, 48687, 48717, 48746, 48776, 48805, 48834, 48864, 48893, 48922, 48952, 48982, 49011, 49041, 49071, 49100, 49130, 49160, 49189, 49218, 49248, 49277, 49306, 49336, 49365, 49395, 49425, 49455, 49484, 49514, 49543, 49573, 49602, 49632, 49661, 49690, 49720, 49749, 49779, 49809, 49838, 49868, 49898, 49927, 49957, 49986, 50016, 50045, 50075, 50104, 50133, 50163, 50192, 50222, 50252, 50281, 50311, 50340, 50370, 50400, 50429, 50459, 50488, 50518, 50547, 50576, 50606, 50635, 50665, 50694, 50724, 50754, 50784, 50813, 50843, 50872, 50902, 50931, 50960, 50990, 51019, 51049, 51078, 51108, 51138, 51167, 51197, 51227, 51256, 51286, 51315, 51345, 51374, 51403, 51433, 51462, 51492, 51522, 51552, 51582, 51611, 51641, 51670, 51699, 51729, 51758, 51787, 51816, 51846, 51876, 51906, 51936, 51965, 51995, 52025, 52054, 52083, 52113, 52142, 52171, 52200, 52230, 52260, 52290, 52319, 52349, 52379, 52408, 52438, 52467, 52497, 52526, 52555, 52585, 52614, 52644, 52673, 52703, 52733, 52762, 52792, 52822, 52851, 52881, 52910, 52939, 52969, 52998, 53028, 53057, 53087, 53116, 53146, 53176, 53205, 53235, 53264, 53294, 53324, 53353, 53383, 53412, 53441, 53471, 53500, 53530, 53559, 53589, 53619, 53648, 53678, 53708, 53737, 53767, 53796, 53825, 53855, 53884, 53913, 53943, 53973, 54003, 54032, 54062, 54092, 54121, 54151, 54180, 54209, 54239, 54268, 54297, 54327, 54357, 54387, 54416, 54446, 54476, 54505, 54535, 54564, 54593, 54623, 54652, 54681, 54711, 54741, 54770, 54800, 54830, 54859, 54889, 54919, 54948, 54977, 55007, 55036, 55066, 55095, 55125, 55154, 55184, 55213, 55243, 55273, 55302, 55332, 55361, 55391, 55420, 55450, 55479, 55508, 55538, 55567, 55597, 55627, 55657, 55686, 55716, 55745, 55775, 55804, 55834, 55863, 55892, 55922, 55951, 55981, 56011, 56040, 56070, 56100, 56129, 56159, 56188, 56218, 56247, 56276, 56306, 56335, 56365, 56394, 56424, 56454, 56483, 56513, 56543, 56572, 56601, 56631, 56660, 56690, 56719, 56749, 56778, 56808, 56837, 56867, 56897, 56926, 56956, 56985, 57015, 57044, 57074, 57103, 57133, 57162, 57192, 57221, 57251, 57280, 57310, 57340, 57369, 57399, 57429, 57458, 57487, 57517, 57546, 57576, 57605, 57634, 57664, 57694, 57723, 57753, 57783, 57813, 57842, 57871, 57901, 57930, 57959, 57989, 58018, 58048, 58077, 58107, 58137, 58167, 58196, 58226, 58255, 58285, 58314, 58343, 58373, 58402, 58432, 58461, 58491, 58521, 58551, 58580, 58610, 58639, 58669, 58698, 58727, 58757, 58786, 58816, 58845, 58875, 58905, 58934, 58964, 58994, 59023, 59053, 59082, 59111, 59141, 59170, 59200, 59229, 59259, 59288, 59318, 59348, 59377, 59407, 59436, 59466, 59495, 59525, 59554, 59584, 59613, 59643, 59672, 59702, 59731, 59761, 59791, 59820, 59850, 59879, 59909, 59939, 59968, 59997, 60027, 60056, 60086, 60115, 60145, 60174, 60204, 60234, 60264, 60293, 60323, 60352, 60381, 60411, 60440, 60469, 60499, 60528, 60558, 60588, 60618, 60648, 60677, 60707, 60736, 60765, 60795, 60824, 60853, 60883, 60912, 60942, 60972, 61002, 61031, 61061, 61090, 61120, 61149, 61179, 61208, 61237, 61267, 61296, 61326, 61356, 61385, 61415, 61445, 61474, 61504, 61533, 61563, 61592, 61621, 61651, 61680, 61710, 61739, 61769, 61799, 61828, 61858, 61888, 61917, 61947, 61976, 62006, 62035, 62064, 62094, 62123, 62153, 62182, 62212, 62242, 62271, 62301, 62331, 62360, 62390, 62419, 62448, 62478, 62507, 62537, 62566, 62596, 62625, 62655, 62685, 62715, 62744, 62774, 62803, 62832, 62862, 62891, 62921, 62950, 62980, 63009, 63039, 63069, 63099, 63128, 63157, 63187, 63216, 63246, 63275, 63305, 63334, 63363, 63393, 63423, 63453, 63482, 63512, 63541, 63571, 63600, 63630, 63659, 63689, 63718, 63747, 63777, 63807, 63836, 63866, 63895, 63925, 63955, 63984, 64014, 64043, 64073, 64102, 64131, 64161, 64190, 64220, 64249, 64279, 64309, 64339, 64368, 64398, 64427, 64457, 64486, 64515, 64545, 64574, 64603, 64633, 64663, 64692, 64722, 64752, 64782, 64811, 64841, 64870, 64899, 64929, 64958, 64987, 65017, 65047, 65076, 65106, 65136, 65166, 65195, 65225, 65254, 65283, 65313, 65342, 65371, 65401, 65431, 65460, 65490, 65520, 65549, 65579, 65608, 65638, 65667, 65697, 65726, 65755, 65785, 65815, 65844, 65874, 65903, 65933, 65963, 65992, 66022, 66051, 66081, 66110, 66140, 66169, 66199, 66228, 66258, 66287, 66317, 66346, 66376, 66405, 66435, 66465, 66494, 66524, 66553, 66583, 66612, 66641, 66671, 66700, 66730, 66760, 66789, 66819, 66849, 66878, 66908, 66937, 66967, 66996, 67025, 67055, 67084, 67114, 67143, 67173, 67203, 67233, 67262, 67292, 67321, 67351, 67380, 67409, 67439, 67468, 67497, 67527, 67557, 67587, 67617, 67646, 67676, 67705, 67735, 67764, 67793, 67823, 67852, 67882, 67911, 67941, 67971, 68e3, 68030, 68060, 68089, 68119, 68148, 68177, 68207, 68236, 68266, 68295, 68325, 68354, 68384, 68414, 68443, 68473, 68502, 68532, 68561, 68591, 68620, 68650, 68679, 68708, 68738, 68768, 68797, 68827, 68857, 68886, 68916, 68946, 68975, 69004, 69034, 69063, 69092, 69122, 69152, 69181, 69211, 69240, 69270, 69300, 69330, 69359, 69388, 69418, 69447, 69476, 69506, 69535, 69565, 69595, 69624, 69654, 69684, 69713, 69743, 69772, 69802, 69831, 69861, 69890, 69919, 69949, 69978, 70008, 70038, 70067, 70097, 70126, 70156, 70186, 70215, 70245, 70274, 70303, 70333, 70362, 70392, 70421, 70451, 70481, 70510, 70540, 70570, 70599, 70629, 70658, 70687, 70717, 70746, 70776, 70805, 70835, 70864, 70894, 70924, 70954, 70983, 71013, 71042, 71071, 71101, 71130, 71159, 71189, 71218, 71248, 71278, 71308, 71337, 71367, 71397, 71426, 71455, 71485, 71514, 71543, 71573, 71602, 71632, 71662, 71691, 71721, 71751, 71781, 71810, 71839, 71869, 71898, 71927, 71957, 71986, 72016, 72046, 72075, 72105, 72135, 72164, 72194, 72223, 72253, 72282, 72311, 72341, 72370, 72400, 72429, 72459, 72489, 72518, 72548, 72577, 72607, 72637, 72666, 72695, 72725, 72754, 72784, 72813, 72843, 72872, 72902, 72931, 72961, 72991, 73020, 73050, 73080, 73109, 73139, 73168, 73197, 73227, 73256, 73286, 73315, 73345, 73375, 73404, 73434, 73464, 73493, 73523, 73552, 73581, 73611, 73640, 73669, 73699, 73729, 73758, 73788, 73818, 73848, 73877, 73907, 73936, 73965, 73995, 74024, 74053, 74083, 74113, 74142, 74172, 74202, 74231, 74261, 74291, 74320, 74349, 74379, 74408, 74437, 74467, 74497, 74526, 74556, 74586, 74615, 74645, 74675, 74704, 74733, 74763, 74792, 74822, 74851, 74881, 74910, 74940, 74969, 74999, 75029, 75058, 75088, 75117, 75147, 75176, 75206, 75235, 75264, 75294, 75323, 75353, 75383, 75412, 75442, 75472, 75501, 75531, 75560, 75590, 75619, 75648, 75678, 75707, 75737, 75766, 75796, 75826, 75856, 75885, 75915, 75944, 75974, 76003, 76032, 76062, 76091, 76121, 76150, 76180, 76210, 76239, 76269, 76299, 76328, 76358, 76387, 76416, 76446, 76475, 76505, 76534, 76564, 76593, 76623, 76653, 76682, 76712, 76741, 76771, 76801, 76830, 76859, 76889, 76918, 76948, 76977, 77007, 77036, 77066, 77096, 77125, 77155, 77185, 77214, 77243, 77273, 77302, 77332, 77361, 77390, 77420, 77450, 77479, 77509, 77539, 77569, 77598, 77627, 77657, 77686, 77715, 77745, 77774, 77804, 77833, 77863, 77893, 77923, 77952, 77982, 78011, 78041, 78070, 78099, 78129, 78158, 78188, 78217, 78247, 78277, 78307, 78336, 78366, 78395, 78425, 78454, 78483, 78513, 78542, 78572, 78601, 78631, 78661, 78690, 78720, 78750, 78779, 78808, 78838, 78867, 78897, 78926, 78956, 78985, 79015, 79044, 79074, 79104, 79133, 79163, 79192, 79222, 79251, 79281, 79310, 79340, 79369, 79399, 79428, 79458, 79487, 79517, 79546, 79576, 79606, 79635, 79665, 79695, 79724, 79753, 79783, 79812, 79841, 79871, 79900, 79930, 79960, 79990];
|
|
14
|
-
const lang = exports.lang = {
|
|
15
|
-
"en": {
|
|
16
|
-
notation: "H",
|
|
17
|
-
// ex. 01/01/1434H
|
|
18
|
-
zero: "0",
|
|
19
|
-
one: "1",
|
|
20
|
-
two: "2",
|
|
21
|
-
three: "3",
|
|
22
|
-
four: "4",
|
|
23
|
-
five: "5",
|
|
24
|
-
six: "6",
|
|
25
|
-
seven: "7",
|
|
26
|
-
eight: "8",
|
|
27
|
-
nine: "9",
|
|
28
|
-
monthNames: ["Muharram", "Safar", "Rabi' al-awwal", "Rabi' al-thani", "Jumada al-awwal", "Jumada al-thani", "Rajab", "Sha'aban", "Ramadan", "Shawwal", "Dhu al-Qi'dah", "Dhu al-Hijjah"],
|
|
29
|
-
monthShortNames: ["Muh", "Saf", "Rab1", "Rab2", "Jum1", "Jum2", "Raj", "Sha'", "Ram", "Shaw", "DhuQ", "DhuH"],
|
|
30
|
-
formatLocale: function (hDate) {
|
|
31
|
-
return hDate;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
class HDateClass {
|
|
36
|
-
year;
|
|
37
|
-
month;
|
|
38
|
-
day;
|
|
39
|
-
constructor(year, month, day) {
|
|
40
|
-
this.year = year;
|
|
41
|
-
this.month = month;
|
|
42
|
-
this.day = day;
|
|
43
|
-
}
|
|
44
|
-
toString() {
|
|
45
|
-
return this.format(this.year, this.month, this.day, "dd/mm/yyyyN");
|
|
46
|
-
}
|
|
47
|
-
toFormat(format) {
|
|
48
|
-
return this.format(this.year, this.month, this.day, format);
|
|
49
|
-
}
|
|
50
|
-
format(year, month, day, format) {
|
|
51
|
-
if (vlidateHijri(year, month, day)) {
|
|
52
|
-
let newFormat = format;
|
|
53
|
-
if (newFormat.indexOf("dd") !== -1) newFormat = newFormat.replace("dd", day < 10 ? "0" + day : day.toString());else newFormat = newFormat.replace("d", day.toString());
|
|
54
|
-
if (newFormat.indexOf("mm") !== -1) newFormat = newFormat.replace("mm", month < 10 ? "0" + month : month.toString());else newFormat = newFormat.replace("m", month.toString());
|
|
55
|
-
if (newFormat.indexOf("yyyy") !== -1) newFormat = newFormat.replace("yyyy", year.toString());else newFormat = newFormat.replace("yy", year.toString().substr(year.toString().length - 2, 2));
|
|
56
|
-
newFormat = newFormat.replace("N", lang[currentLanguage].notation);
|
|
57
|
-
return lang[currentLanguage].formatLocale(newFormat);
|
|
58
|
-
}
|
|
59
|
-
return "";
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
exports.HDateClass = HDateClass;
|
|
63
|
-
const currentLanguage = "en";
|
|
64
|
-
function vlidateHijri(year, month, day) {
|
|
65
|
-
if (month < 1 || month > 12) return false;
|
|
66
|
-
if (day < 1 || day > 30) return false;
|
|
67
|
-
return true;
|
|
68
|
-
}
|
|
69
|
-
function validateGregorian(year, month, day) {
|
|
70
|
-
if (month < 1 || month > 12) return false;
|
|
71
|
-
if (day < 1 || day > 31) return false;
|
|
72
|
-
return true;
|
|
73
|
-
}
|
|
74
|
-
function julianToGregorian(julianDate) {
|
|
75
|
-
const z = Math.floor(julianDate + 0.5);
|
|
76
|
-
let a = Math.floor((z - 186721625e-2) / 36524.25);
|
|
77
|
-
a = z + 1 + a - Math.floor(a / 4);
|
|
78
|
-
const b = a + 1524;
|
|
79
|
-
const c = Math.floor((b - 122.1) / 365.25);
|
|
80
|
-
const d = Math.floor(365.25 * c);
|
|
81
|
-
const e = Math.floor((b - d) / 30.6001);
|
|
82
|
-
const day = b - d - Math.floor(e * 30.6001);
|
|
83
|
-
const month = e - (e > 13.5 ? 13 : 1);
|
|
84
|
-
let year = c - (month > 2.5 ? 4716 : 4715);
|
|
85
|
-
if (year <= 0) {
|
|
86
|
-
year--;
|
|
87
|
-
}
|
|
88
|
-
return /* @__PURE__ */new Date(year + "/" + (month + 1) + "/" + day);
|
|
89
|
-
}
|
|
90
|
-
function hijriToGregorian(year, month, day) {
|
|
91
|
-
const yearNum = parseInt(year.toString());
|
|
92
|
-
const monthNum = parseInt(month.toString());
|
|
93
|
-
const dayNum = parseInt(day.toString());
|
|
94
|
-
if (isNaN(yearNum) || isNaN(monthNum) || isNaN(dayNum)) return "Error Input";
|
|
95
|
-
const iy = yearNum;
|
|
96
|
-
const im = monthNum;
|
|
97
|
-
const id = dayNum;
|
|
98
|
-
const ii = iy - 1;
|
|
99
|
-
const iln = ii * 12 + 1 + (im - 1);
|
|
100
|
-
const i = iln - 16260;
|
|
101
|
-
const mcjdn = id + ummalqura_dat[i - 1] - 1;
|
|
102
|
-
const cjdn = mcjdn + 24e5;
|
|
103
|
-
return julianToGregorian(cjdn);
|
|
104
|
-
}
|
|
105
|
-
function gregorianToHijri(pYear, pMonth, pDay) {
|
|
106
|
-
const day = parseInt(pDay.toString());
|
|
107
|
-
const month = parseInt(pMonth.toString()) - 1;
|
|
108
|
-
const year = parseInt(pYear.toString());
|
|
109
|
-
let m = month + 1;
|
|
110
|
-
let y = year;
|
|
111
|
-
if (m < 3) {
|
|
112
|
-
y -= 1;
|
|
113
|
-
m += 12;
|
|
114
|
-
}
|
|
115
|
-
let a = Math.floor(y / 100);
|
|
116
|
-
let jgc = a - Math.floor(a / 4) - 2;
|
|
117
|
-
const cjdn = Math.floor(365.25 * (y + 4716)) + Math.floor(30.6001 * (m + 1)) + day - jgc - 1524;
|
|
118
|
-
a = Math.floor((cjdn - 186721625e-2) / 36524.25);
|
|
119
|
-
jgc = a - Math.floor(a / 4) + 1;
|
|
120
|
-
const b = cjdn + jgc + 1524;
|
|
121
|
-
const c = Math.floor((b - 122.1) / 365.25);
|
|
122
|
-
const d = Math.floor(365.25 * c);
|
|
123
|
-
let monthResult = Math.floor((b - d) / 30.6001);
|
|
124
|
-
const dayResult = b - d - Math.floor(30.6001 * monthResult);
|
|
125
|
-
if (monthResult > 13) {
|
|
126
|
-
monthResult -= 12;
|
|
127
|
-
}
|
|
128
|
-
monthResult -= 1;
|
|
129
|
-
const yearResult = c - 4716;
|
|
130
|
-
const mcjdn = cjdn - 24e5;
|
|
131
|
-
let i = 0;
|
|
132
|
-
for (i = 0; i < ummalqura_dat.length; i++) {
|
|
133
|
-
if (ummalqura_dat[i] > mcjdn) break;
|
|
134
|
-
}
|
|
135
|
-
const iln = i + 16260;
|
|
136
|
-
const ii = Math.floor((iln - 1) / 12);
|
|
137
|
-
const iy = ii + 1;
|
|
138
|
-
const im = iln - 12 * ii;
|
|
139
|
-
const id = mcjdn - ummalqura_dat[i - 1] + 1;
|
|
140
|
-
const ml = ummalqura_dat[i] - ummalqura_dat[i - 1];
|
|
141
|
-
return new HDateClass(iy, im, id);
|
|
142
|
-
}
|
|
143
|
-
const HijriJS = exports.HijriJS = {
|
|
144
|
-
currentLanguage,
|
|
145
|
-
today() {
|
|
146
|
-
const today = /* @__PURE__ */new Date();
|
|
147
|
-
return gregorianToHijri(today.getFullYear(), today.getMonth() + 1, today.getDate());
|
|
148
|
-
},
|
|
149
|
-
toGregorian(dateString, splitter = "/") {
|
|
150
|
-
const arrDate = dateString.split(splitter);
|
|
151
|
-
if (arrDate.length >= 3) return hijriToGregorian(arrDate[2], arrDate[1], arrDate[0]);
|
|
152
|
-
return void 0;
|
|
153
|
-
},
|
|
154
|
-
toHijri(dateString, splitter = "/") {
|
|
155
|
-
const arrDate = dateString.split(splitter);
|
|
156
|
-
if (arrDate.length >= 3) return gregorianToHijri(arrDate[2], arrDate[1], arrDate[0]);
|
|
157
|
-
return void 0;
|
|
158
|
-
},
|
|
159
|
-
hijriToGregorian,
|
|
160
|
-
gregorianToHijri,
|
|
161
|
-
julianToGregorian,
|
|
162
|
-
HDate: HDateClass,
|
|
163
|
-
vlidateHijri,
|
|
164
|
-
validateGregorian,
|
|
165
|
-
lang,
|
|
166
|
-
ummalqura_dat
|
|
167
|
-
};
|
|
168
|
-
module.exports = HijriJS;
|