tsv2-library 1.0.61-alpha.124 → 1.0.61-alpha.126

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.
@@ -20,6 +20,7 @@ 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
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, formatLogResponseData, googleMapLoader, getTransactionRole, getSystemRole, hasSystemRole, hasTransactionRole, checkRouteAccess, hasApprovalRole, hasManagerRole, hasAnyManagerRole, hasMonitoringReportRole, hasAnyMonitoringReportRole, hasStaffRole, hasAccessToAssetDetail } from './utils';
23
+ import { default as eventBus } from './event-bus';
23
24
  import { flattenTreeNodeChildren, parseNodeKeys, filterNodeKeys } from './components/v2/Tree/helpers';
24
25
  import useLoadingStore from './components/v2/Loading/store/loading.store';
25
26
  import Tooltip from '../node_modules/primevue/tooltip';
@@ -31,4 +32,4 @@ declare const _default: {
31
32
  install: (app: App) => void;
32
33
  };
33
34
  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, TSDialogCoordinate, TSDialogForm, TSDialogLinkedAsset, TSDialogPrintQR, TSDialogReportDamage, TSDialogReportMissing, TSDialogReportTag, TSDialogSelectTree, TSDialogSelectAsset, TSDialogSelectUser, TSDisposalReport, TSDropdown, TSFilterContainer, TSFileUpload, TSForm, TSIcon, TSImage, TSImageCompressor, TSInlineMessage, TSInputBadge, TSInputCurrency, TSInputCurrencyReference, TSInputCoordinate, 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, formatLogResponseData, googleMapLoader, getTransactionRole, getSystemRole, hasSystemRole, hasTransactionRole, checkRouteAccess, hasApprovalRole, hasManagerRole, hasAnyManagerRole, hasMonitoringReportRole, hasAnyMonitoringReportRole, hasStaffRole, hasAccessToAssetDetail, flattenTreeNodeChildren, parseNodeKeys, filterNodeKeys, TreeAPI, RoutineAPI, DisposalAPI, RoutineServices, AssetsServices, AssetNameService, AssetBrandService, DisposalServices, FilterMatchMode, useLoadingStore, Presets, };
35
+ 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, TSDialogCoordinate, TSDialogForm, TSDialogLinkedAsset, TSDialogPrintQR, TSDialogReportDamage, TSDialogReportMissing, TSDialogReportTag, TSDialogSelectTree, TSDialogSelectAsset, TSDialogSelectUser, TSDisposalReport, TSDropdown, TSFilterContainer, TSFileUpload, TSForm, TSIcon, TSImage, TSImageCompressor, TSInlineMessage, TSInputBadge, TSInputCurrency, TSInputCurrencyReference, TSInputCoordinate, 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, formatLogResponseData, googleMapLoader, getTransactionRole, getSystemRole, hasSystemRole, hasTransactionRole, checkRouteAccess, hasApprovalRole, hasManagerRole, hasAnyManagerRole, hasMonitoringReportRole, hasAnyMonitoringReportRole, hasStaffRole, hasAccessToAssetDetail, flattenTreeNodeChildren, parseNodeKeys, filterNodeKeys, TreeAPI, RoutineAPI, DisposalAPI, RoutineServices, AssetsServices, AssetNameService, AssetBrandService, DisposalServices, FilterMatchMode, useLoadingStore, eventBus, Presets, };
@@ -0,0 +1,8 @@
1
+ import { Emitter, EventType } from './mitt';
2
+ export type TableEvent = {
3
+ tableName?: string;
4
+ };
5
+ export type Events<CustomEvents extends Record<string, EventType>> = CustomEvents;
6
+ declare const eventBus: Emitter<Record<string, EventType>>;
7
+ export declare const extendEventBus: <T extends Record<string, EventType>>() => Emitter<T>;
8
+ export default eventBus;
@@ -0,0 +1,26 @@
1
+ export type EventType = string | symbol;
2
+ export type Handler<T = unknown> = (event: T) => void;
3
+ export type WildcardHandler<T = Record<string, unknown>> = (type: keyof T, event: T[keyof T]) => void;
4
+ export type EventHandlerList<T = unknown> = Array<Handler<T>>;
5
+ export type WildCardEventHandlerList<T = Record<string, unknown>> = Array<WildcardHandler<T>>;
6
+ export type EventHandlerMap<Events extends Record<EventType, unknown>> = Map<keyof Events | '*', EventHandlerList<Events[keyof Events]> | WildCardEventHandlerList<Events>>;
7
+ export interface Emitter<Events extends Record<EventType, unknown>> {
8
+ all: EventHandlerMap<Events>;
9
+ on<Key extends keyof Events>(type: Key, handler: Handler<Events[Key]>): void;
10
+ on(type: '*', handler: WildcardHandler<Events>): void;
11
+ off<Key extends keyof Events>(type: Key, handler?: Handler<Events[Key]>): void;
12
+ off(type: '*', handler: WildcardHandler<Events>): void;
13
+ emit<Key extends keyof Events>(type: Key, event: Events[Key]): void;
14
+ emit<Key extends keyof Events>(type: undefined extends Events[Key] ? Key : never): void;
15
+ }
16
+ /**
17
+ * Mitt: Tiny (~200b) functional event emitter / pubsub.
18
+ * @name mitt
19
+ * @returns {Mitt}
20
+ */
21
+ export default function mitt<Events extends Record<EventType, unknown>>(all?: EventHandlerMap<Events>): Emitter<Events>;
22
+ declare global {
23
+ interface Window {
24
+ eventBus: Emitter<any>;
25
+ }
26
+ }
@@ -26082,6 +26082,74 @@ const Presets = {
26082
26082
  terminal,
26083
26083
  image: ImagePreset
26084
26084
  };
26085
+ function mitt(all) {
26086
+ var _a;
26087
+ all = all || ((_a = window.eventBus) == null ? void 0 : _a.all) || /* @__PURE__ */ new Map();
26088
+ const bus = {
26089
+ /**
26090
+ * A Map of event names to registered handler functions.
26091
+ */
26092
+ all,
26093
+ /**
26094
+ * Register an event handler for the given type.
26095
+ * @param {string|symbol} type Type of event to listen for, or `'*'` for all events
26096
+ * @param {Function} handler Function to call in response to given event
26097
+ * @memberOf mitt
26098
+ */
26099
+ on(type, handler9) {
26100
+ const handlers = all == null ? void 0 : all.get(type);
26101
+ if (handlers) {
26102
+ handlers.push(handler9);
26103
+ } else {
26104
+ all == null ? void 0 : all.set(type, [handler9]);
26105
+ }
26106
+ },
26107
+ /**
26108
+ * Remove an event handler for the given type.
26109
+ * If `handler` is omitted, all handlers of the given type are removed.
26110
+ * @param {string|symbol} type Type of event to unregister `handler` from (`'*'` to remove a wildcard handler)
26111
+ * @param {Function} [handler] Handler function to remove
26112
+ * @memberOf mitt
26113
+ */
26114
+ off(type, handler9) {
26115
+ const handlers = all == null ? void 0 : all.get(type);
26116
+ if (handlers) {
26117
+ if (handler9) {
26118
+ handlers.splice(handlers.indexOf(handler9) >>> 0, 1);
26119
+ } else {
26120
+ all == null ? void 0 : all.set(type, []);
26121
+ }
26122
+ }
26123
+ },
26124
+ /**
26125
+ * Invoke all handlers for the given type.
26126
+ * If present, `'*'` handlers are invoked after type-matched handlers.
26127
+ *
26128
+ * Note: Manually firing '*' handlers is not supported.
26129
+ *
26130
+ * @param {string|symbol} type The event type to invoke
26131
+ * @param {Any} [evt] Any value (object is recommended and powerful), passed to each handler
26132
+ * @memberOf mitt
26133
+ */
26134
+ emit(type, evt) {
26135
+ let handlers = all == null ? void 0 : all.get(type);
26136
+ if (handlers) {
26137
+ handlers.slice().map((handler9) => {
26138
+ handler9(evt);
26139
+ });
26140
+ }
26141
+ handlers = all == null ? void 0 : all.get("*");
26142
+ if (handlers) {
26143
+ handlers.slice().map((handler9) => {
26144
+ handler9(type, evt);
26145
+ });
26146
+ }
26147
+ }
26148
+ };
26149
+ window.eventBus ?? (window.eventBus = bus);
26150
+ return window.eventBus;
26151
+ }
26152
+ const eventBus = mitt();
26085
26153
  const flattenTreeNodeChildren = (nodes) => {
26086
26154
  if (!nodes)
26087
26155
  return [];
@@ -77914,6 +77982,7 @@ export {
77914
77982
  clearStorage,
77915
77983
  buildEntry as default,
77916
77984
  downloadFile,
77985
+ eventBus,
77917
77986
  exportToExcel,
77918
77987
  filterNodeKeys,
77919
77988
  flattenTreeNodeChildren,