tsv2-library 1.0.61-alpha.64 → 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;
|
|
@@ -51985,7 +52009,7 @@ const _sfc_main$U = /* @__PURE__ */ defineComponent({
|
|
|
51985
52009
|
var _a;
|
|
51986
52010
|
return {
|
|
51987
52011
|
...props.defaultQueryParams,
|
|
51988
|
-
search: (_a = props.search) == null ? void 0 : _a.trim(),
|
|
52012
|
+
search: props.search ? String((_a = props.search) == null ? void 0 : _a.trim()) : void 0,
|
|
51989
52013
|
page: props.usePaginator ? tablePage.value : void 0,
|
|
51990
52014
|
limit: props.usePaginator ? tableRows.value : void 0,
|
|
51991
52015
|
sortOrder: sortOrder2.value,
|
|
@@ -74034,6 +74058,7 @@ export {
|
|
|
74034
74058
|
Tooltip,
|
|
74035
74059
|
API$a as TreeAPI,
|
|
74036
74060
|
VueHtmlToPaper,
|
|
74061
|
+
buildBodyParams,
|
|
74037
74062
|
checkRouteAccess,
|
|
74038
74063
|
clearStorage,
|
|
74039
74064
|
buildEntry as default,
|
|
@@ -74067,6 +74092,7 @@ export {
|
|
|
74067
74092
|
hasSystemRole,
|
|
74068
74093
|
hasTransactionRole,
|
|
74069
74094
|
isObjectEmpty,
|
|
74095
|
+
isValidJSONString,
|
|
74070
74096
|
listenSidebarChanges,
|
|
74071
74097
|
parseNodeKeys,
|
|
74072
74098
|
reLogin,
|