tsv2-library 1.0.61-alpha.65 → 1.0.61-alpha.66
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, 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';
|
|
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, isValidJSONString, buildBodyParams, 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, 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, };
|
|
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, isValidJSONString, buildBodyParams, 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, };
|
|
@@ -13,6 +13,8 @@ import { getSeverityByAssetStatus } from './getSeverityByAssetStatus.util';
|
|
|
13
13
|
import clearStorage from './clearStorage.util';
|
|
14
14
|
import forceLogout from './forceLogout.util';
|
|
15
15
|
import reLogin from './reLogin.util';
|
|
16
|
+
import { isValidJSONString } from './json.util';
|
|
17
|
+
import { buildBodyParams } from './request.util';
|
|
16
18
|
declare const isObjectEmpty: (object: object) => boolean;
|
|
17
19
|
declare const getNestedProperyValue: (object: object, property: string) => string | boolean | number | object;
|
|
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, };
|
|
20
|
+
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, isValidJSONString, buildBodyParams, getTransactionRole, getSystemRole, hasSystemRole, hasTransactionRole, checkRouteAccess, hasApprovalRole, hasManagerRole, hasAnyManagerRole, hasMonitoringReportRole, hasAnyMonitoringReportRole, hasStaffRole, };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if a given value is a valid JSON string that represents an object or array.
|
|
3
|
+
*
|
|
4
|
+
* @param value - The value to be checked
|
|
5
|
+
* @returns `true` if the value is a non-empty string that can be parsed into a valid JSON object or array,
|
|
6
|
+
* `false` otherwise
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* isValidJSONString('{"name": "John"}') // returns true
|
|
11
|
+
* isValidJSONString('[1, 2, 3]') // returns true
|
|
12
|
+
* isValidJSONString('123') // returns false (not an object/array)
|
|
13
|
+
* isValidJSONString('invalid json') // returns false
|
|
14
|
+
* isValidJSONString(null) // returns false
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export declare const isValidJSONString: (value: unknown) => boolean;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Builds and transforms body parameters by parsing JSON strings if valid.
|
|
3
|
+
* @param params - Optional record of key-value pairs where values can be of any type
|
|
4
|
+
* @returns A new record with the same keys but JSON strings parsed into objects
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* // With JSON string value
|
|
9
|
+
* buildBodyParams({ data: '{"foo": "bar"}' })
|
|
10
|
+
* // Returns: { data: { foo: "bar" } }
|
|
11
|
+
*
|
|
12
|
+
* // With non-JSON value
|
|
13
|
+
* buildBodyParams({ data: "plain string" })
|
|
14
|
+
* // Returns: { data: "plain string" }
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export declare const buildBodyParams: (params?: Record<string, unknown>) => Record<string, unknown>;
|
package/dist/tsv2-library.es.js
CHANGED
|
@@ -25834,6 +25834,30 @@ const reLogin = async () => {
|
|
|
25834
25834
|
return error;
|
|
25835
25835
|
}
|
|
25836
25836
|
};
|
|
25837
|
+
const isValidJSONString = (value) => {
|
|
25838
|
+
if (typeof value !== "string")
|
|
25839
|
+
return false;
|
|
25840
|
+
const s = value.trim();
|
|
25841
|
+
if (!s)
|
|
25842
|
+
return false;
|
|
25843
|
+
try {
|
|
25844
|
+
const parsed = JSON.parse(s);
|
|
25845
|
+
return typeof parsed === "object" && parsed !== null;
|
|
25846
|
+
} catch {
|
|
25847
|
+
return false;
|
|
25848
|
+
}
|
|
25849
|
+
};
|
|
25850
|
+
const buildBodyParams = (params) => {
|
|
25851
|
+
if (!params) {
|
|
25852
|
+
return {};
|
|
25853
|
+
}
|
|
25854
|
+
const result = {};
|
|
25855
|
+
Object.keys(params).forEach((key) => {
|
|
25856
|
+
const val = params[key];
|
|
25857
|
+
result[key] = isValidJSONString(val) ? JSON.parse(val.trim()) : val;
|
|
25858
|
+
});
|
|
25859
|
+
return result;
|
|
25860
|
+
};
|
|
25837
25861
|
const isObjectEmpty = (object) => {
|
|
25838
25862
|
if (!object)
|
|
25839
25863
|
return true;
|
|
@@ -52077,7 +52101,6 @@ const _sfc_main$U = /* @__PURE__ */ defineComponent({
|
|
|
52077
52101
|
selectedData.value = [];
|
|
52078
52102
|
currentPageDataSelected.value = [];
|
|
52079
52103
|
}
|
|
52080
|
-
console.log("✨ ~ queryParams:", queryParams.value);
|
|
52081
52104
|
loadingTable.value = true;
|
|
52082
52105
|
const { data: data30, totalRecords: total = 0 } = await ((_a = props.fetchFunction) == null ? void 0 : _a.call(props, scanParams ?? queryParams.value)) ?? {};
|
|
52083
52106
|
dispatchUpdateTotalRecordsEvent(total);
|
|
@@ -74035,6 +74058,7 @@ export {
|
|
|
74035
74058
|
Tooltip,
|
|
74036
74059
|
API$a as TreeAPI,
|
|
74037
74060
|
VueHtmlToPaper,
|
|
74061
|
+
buildBodyParams,
|
|
74038
74062
|
checkRouteAccess,
|
|
74039
74063
|
clearStorage,
|
|
74040
74064
|
buildEntry as default,
|
|
@@ -74068,6 +74092,7 @@ export {
|
|
|
74068
74092
|
hasSystemRole,
|
|
74069
74093
|
hasTransactionRole,
|
|
74070
74094
|
isObjectEmpty,
|
|
74095
|
+
isValidJSONString,
|
|
74071
74096
|
listenSidebarChanges,
|
|
74072
74097
|
parseNodeKeys,
|
|
74073
74098
|
reLogin,
|