tsv2-library 1.0.61-alpha.55 → 1.0.61-alpha.57

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.
@@ -19,7 +19,7 @@ interface TSFormContext<T> {
19
19
  declare const useForm: <T>() => TSFormContext<T>;
20
20
  declare const useField: <T>(path: MaybeRefOrGetter<string>, rules?: MaybeRef<RuleExpression<T>>, opts?: Partial<FieldOptions<T>> | undefined) => FieldContext<T>;
21
21
  import Presets from './presets';
22
- import { handleTokenExpiration, exportToExcel, formatGoDate, formatDate, getUserLocale, formatDateReadable, formatUserName, formatVowelSoundLabel, getImageURL, isObjectEmpty, useToast, listenSidebarChanges, unListenSidebarChanges, getCurrency, formatCurrency, getHostName, getBaseURL, useI18n, getNestedProperyValue, getSeverityByAssetStatus, clearStorage, forceLogout, reLogin, getTransactionRole, getSystemRole, hasSystemRole, hasTransactionRole, checkRouteAccess, hasApprovalRole, hasManagerRole, hasAnyManagerRole, hasMonitoringReportRole, hasAnyMonitoringReportRole, hasStaffRole } from './utils';
22
+ import { handleTokenExpiration, exportToExcel, formatGoDate, formatDate, getUserLocale, formatDateReadable, formatUserName, formatVowelSoundLabel, getImageURL, downloadFile, isObjectEmpty, useToast, listenSidebarChanges, unListenSidebarChanges, getCurrency, formatCurrency, getHostName, getBaseURL, useI18n, getNestedProperyValue, getSeverityByAssetStatus, clearStorage, forceLogout, reLogin, getTransactionRole, getSystemRole, hasSystemRole, hasTransactionRole, checkRouteAccess, hasApprovalRole, hasManagerRole, hasAnyManagerRole, hasMonitoringReportRole, hasAnyMonitoringReportRole, hasStaffRole } from './utils';
23
23
  import { flattenTreeNodeChildren, parseNodeKeys, filterNodeKeys } from './components/v2/Tree/helpers';
24
24
  import useLoadingStore from './components/v2/Loading/store/loading.store';
25
25
  import Tooltip from '../node_modules/primevue/tooltip';
@@ -31,4 +31,4 @@ declare const _default: {
31
31
  install: (app: App) => void;
32
32
  };
33
33
  export default _default;
34
- export { LibConfig, TSToastService, TSi18n, VueHtmlToPaper, Tooltip, Focus, DialogDamageLog, DialogMissingLog, DialogTransferLog, TSAssetInfo, TSApproverInfo, TSBadge, TSBadgeGroup, TSBreadcrumb, TSButton, TSButtonAddByScan, TSButtonBulkAction, TSButtonCopy, TSButtonDownload, TSButtonFilter, TSButtonLogHistory, TSButtonRadio, TSButtonViewLog, TSButtonScan, TSButtonSearch, TSButtonSearchByScan, TSButtonSelectTree, TSButtonSelectUser, TSButtonSync, TSButtonToggle, TSCalendar, TSCard, TSCarousel, TSCheckbox, TSCustomColumn, TSDatePicker, TSDataTable, TSDayPicker, TSDialog, TSDialogApprovalList, TSDialogAssetNameDetail, TSDialogConfirm, TSDialogForm, TSDialogLinkedAsset, TSDialogPrintQR, TSDialogReportDamage, TSDialogReportMissing, TSDialogReportTag, TSDialogSelectTree, TSDialogSelectAsset, TSDialogSelectUser, TSDisposalReport, TSDropdown, TSFilterContainer, TSFileUpload, TSForm, TSIcon, TSImage, TSImageCompressor, TSInlineMessage, TSInputBadge, TSInputCurrency, TSInputEmail, TSInputNumber, TSInputOTP, TSInputPassword, TSInputPhoneNumber, TSInputRangeNumber, TSInputText, TSInputSearch, TSInputURL, TSLoading, TSMenu, TSMultiSelect, TSOverlayPanel, TSPaginator, TSProgressBar, TSSteps, TSTabMenu, TSTagType, TSTextarea, TSTimeline, TSToast, TSTransactionRoles, TSTree, TSTreeSearchInput, TSUserWithIcon, TSValidatorMessage, handleTokenExpiration, exportToExcel, formatGoDate, formatDate, getUserLocale, formatDateReadable, formatUserName, formatVowelSoundLabel, getImageURL, isObjectEmpty, useToast, listenSidebarChanges, unListenSidebarChanges, getCurrency, formatCurrency, getHostName, getBaseURL, useI18n, useForm, useField, getNestedProperyValue, getSeverityByAssetStatus, clearStorage, forceLogout, reLogin, getTransactionRole, getSystemRole, hasSystemRole, hasTransactionRole, checkRouteAccess, hasApprovalRole, hasManagerRole, hasAnyManagerRole, hasMonitoringReportRole, hasAnyMonitoringReportRole, hasStaffRole, flattenTreeNodeChildren, parseNodeKeys, filterNodeKeys, TreeAPI, RoutineAPI, DisposalAPI, RoutineServices, AssetsServices, AssetNameService, AssetBrandService, DisposalServices, FilterMatchMode, useLoadingStore, Presets, };
34
+ export { LibConfig, TSToastService, TSi18n, VueHtmlToPaper, Tooltip, Focus, DialogDamageLog, DialogMissingLog, DialogTransferLog, TSAssetInfo, TSApproverInfo, TSBadge, TSBadgeGroup, TSBreadcrumb, TSButton, TSButtonAddByScan, TSButtonBulkAction, TSButtonCopy, TSButtonDownload, TSButtonFilter, TSButtonLogHistory, TSButtonRadio, TSButtonViewLog, TSButtonScan, TSButtonSearch, TSButtonSearchByScan, TSButtonSelectTree, TSButtonSelectUser, TSButtonSync, TSButtonToggle, TSCalendar, TSCard, TSCarousel, TSCheckbox, TSCustomColumn, TSDatePicker, TSDataTable, TSDayPicker, TSDialog, TSDialogApprovalList, TSDialogAssetNameDetail, TSDialogConfirm, TSDialogForm, TSDialogLinkedAsset, TSDialogPrintQR, TSDialogReportDamage, TSDialogReportMissing, TSDialogReportTag, TSDialogSelectTree, TSDialogSelectAsset, TSDialogSelectUser, TSDisposalReport, TSDropdown, TSFilterContainer, TSFileUpload, TSForm, TSIcon, TSImage, TSImageCompressor, TSInlineMessage, TSInputBadge, TSInputCurrency, TSInputEmail, TSInputNumber, TSInputOTP, TSInputPassword, TSInputPhoneNumber, TSInputRangeNumber, TSInputText, TSInputSearch, TSInputURL, TSLoading, TSMenu, TSMultiSelect, TSOverlayPanel, TSPaginator, TSProgressBar, TSSteps, TSTabMenu, TSTagType, TSTextarea, TSTimeline, TSToast, TSTransactionRoles, TSTree, TSTreeSearchInput, TSUserWithIcon, TSValidatorMessage, handleTokenExpiration, exportToExcel, formatGoDate, formatDate, getUserLocale, formatDateReadable, formatUserName, formatVowelSoundLabel, getImageURL, downloadFile, isObjectEmpty, useToast, listenSidebarChanges, unListenSidebarChanges, getCurrency, formatCurrency, getHostName, getBaseURL, useI18n, useForm, useField, getNestedProperyValue, getSeverityByAssetStatus, clearStorage, forceLogout, reLogin, getTransactionRole, getSystemRole, hasSystemRole, hasTransactionRole, checkRouteAccess, hasApprovalRole, hasManagerRole, hasAnyManagerRole, hasMonitoringReportRole, hasAnyMonitoringReportRole, hasStaffRole, flattenTreeNodeChildren, parseNodeKeys, filterNodeKeys, TreeAPI, RoutineAPI, DisposalAPI, RoutineServices, AssetsServices, AssetNameService, AssetBrandService, DisposalServices, FilterMatchMode, useLoadingStore, Presets, };
@@ -106,6 +106,10 @@ export type FileUploadProps = {
106
106
  * Wether show validator message on invalid file input
107
107
  */
108
108
  showValidatorMessage?: boolean;
109
+ /**
110
+ * Wether show validator message on invalid file input
111
+ */
112
+ validatorMessage?: boolean;
109
113
  };
110
114
 
111
115
  export type FileUploadEmits = {
@@ -3,7 +3,7 @@ import handleTokenExpiration from './handleTokenExpiration.util';
3
3
  import exportToExcel from './exportToExcel.util';
4
4
  import { formatGoDate, formatDate, formatDateReadable, getUserLocale } from './date.util';
5
5
  import useToast from './toast.util';
6
- import { getImageURL } from './getImageURL.util';
6
+ import { getImageURL, downloadFile } from './getImageURL.util';
7
7
  import { getTransactionRole, getSystemRole, hasSystemRole, hasTransactionRole, checkRouteAccess, hasApprovalRole, hasManagerRole, hasAnyManagerRole, hasAnyMonitoringReportRole, hasMonitoringReportRole, hasStaffRole } from './role.util';
8
8
  import { getCurrency, formatCurrency } from './currency.util';
9
9
  import { unListenSidebarChanges, listenSidebarChanges } from './listenSidebarChanges.util';
@@ -15,4 +15,4 @@ import forceLogout from './forceLogout.util';
15
15
  import reLogin from './reLogin.util';
16
16
  declare const isObjectEmpty: (object: object) => boolean;
17
17
  declare const getNestedProperyValue: (object: object, property: string) => string | boolean | number | object;
18
- export { isObjectEmpty, getNestedProperyValue, handleTokenExpiration, getImageURL, formatUserName, formatVowelSoundLabel, exportToExcel, formatGoDate, formatDate, getUserLocale, formatDateReadable, useToast, listenSidebarChanges, unListenSidebarChanges, getCurrency, formatCurrency, getBaseURL, getHostName, useI18n, getSeverityByAssetStatus, clearStorage, forceLogout, reLogin, getTransactionRole, getSystemRole, hasSystemRole, hasTransactionRole, checkRouteAccess, hasApprovalRole, hasManagerRole, hasAnyManagerRole, hasMonitoringReportRole, hasAnyMonitoringReportRole, hasStaffRole, };
18
+ export { isObjectEmpty, getNestedProperyValue, handleTokenExpiration, getImageURL, downloadFile, formatUserName, formatVowelSoundLabel, exportToExcel, formatGoDate, formatDate, getUserLocale, formatDateReadable, useToast, listenSidebarChanges, unListenSidebarChanges, getCurrency, formatCurrency, getBaseURL, getHostName, useI18n, getSeverityByAssetStatus, clearStorage, forceLogout, reLogin, getTransactionRole, getSystemRole, hasSystemRole, hasTransactionRole, checkRouteAccess, hasApprovalRole, hasManagerRole, hasAnyManagerRole, hasMonitoringReportRole, hasAnyMonitoringReportRole, hasStaffRole, };
@@ -19623,6 +19623,31 @@ const fetchBlobFile = async (url, token) => {
19623
19623
  type: res.headers.get("Content-Type") || "image/webp"
19624
19624
  });
19625
19625
  };
19626
+ const downloadFile = async (fileUrl, fileName, immediateRevoke = true) => {
19627
+ const token = getAuthToken();
19628
+ const blob2 = await fetchBlobFile(fileUrl, token);
19629
+ let objectUrl = "";
19630
+ const isViewable = /^(image|application\/pdf)/i.test(blob2.type);
19631
+ if (isViewable) {
19632
+ const file = new File([blob2], fileName, {
19633
+ type: blob2.type
19634
+ });
19635
+ objectUrl = URL.createObjectURL(file);
19636
+ window.open(objectUrl, "_blank");
19637
+ } else {
19638
+ objectUrl = URL.createObjectURL(blob2);
19639
+ const a = document.createElement("a");
19640
+ a.href = objectUrl;
19641
+ a.download = fileName;
19642
+ document.body.appendChild(a);
19643
+ a.click();
19644
+ a.remove();
19645
+ }
19646
+ if (immediateRevoke) {
19647
+ URL.revokeObjectURL(objectUrl);
19648
+ }
19649
+ return objectUrl;
19650
+ };
19626
19651
  const createBlobURL = async (rawFileUrl) => {
19627
19652
  try {
19628
19653
  const token = getAuthToken();
@@ -68210,7 +68235,8 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
68210
68235
  fieldName: { default: "fileUpload" },
68211
68236
  mandatory: { type: Boolean },
68212
68237
  useErrorToast: { type: Boolean, default: true },
68213
- showValidatorMessage: { type: Boolean, default: false }
68238
+ showValidatorMessage: { type: Boolean, default: false },
68239
+ validatorMessage: { type: Boolean }
68214
68240
  }, {
68215
68241
  "modelValue": {},
68216
68242
  "modelModifiers": {}
@@ -68242,7 +68268,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
68242
68268
  });
68243
68269
  const setValidatorMessage = (value) => {
68244
68270
  if (props.mandatory && !value && !currentFile.value)
68245
- return `${props.label} must not be empty`;
68271
+ return props.validatorMessage ?? `${props.label} must not be empty`;
68246
68272
  return true;
68247
68273
  };
68248
68274
  const selectHandler = (event2) => {
@@ -73986,6 +74012,7 @@ export {
73986
74012
  checkRouteAccess,
73987
74013
  clearStorage,
73988
74014
  buildEntry as default,
74015
+ downloadFile,
73989
74016
  exportToExcel,
73990
74017
  filterNodeKeys,
73991
74018
  flattenTreeNodeChildren,