bt-core-app 1.4.34 → 1.4.35

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/dist/index.d.ts CHANGED
@@ -13,11 +13,14 @@ import { Store } from 'pinia';
13
13
  import { StoreDefinition } from 'pinia';
14
14
  import { ThemeInstance } from 'vuetify';
15
15
 
16
+ export declare interface ActionOptions extends PathOptions, DoActionOptions {
17
+ }
18
+
16
19
  /**adds and sorts the weekday string */
17
20
  export declare function addWeekday(weekdays?: string, day?: string): string | undefined;
18
21
 
19
- export declare interface ApiActionOptions extends PathOptions, DoActionOptions {
20
- api: BTApi;
22
+ declare interface ApiActionOptions extends PathOptions, DoActionOptions {
23
+ api?: BTApi;
21
24
  }
22
25
 
23
26
  export declare function appendUrl(originalVal?: string, additionalVal?: string): string;
@@ -75,8 +78,6 @@ export declare type BladeMode = 'new' | 'view' | 'edit';
75
78
  export declare type BladeVariant = 'page' | 'blade' | 'freestyle' | 'inline' | 'pane';
76
79
 
77
80
  export declare interface BTActions {
78
- apiGet: (doOptions: ApiActionOptions) => Promise<any>;
79
- apiPost: (doOptions: ApiActionOptions) => Promise<any>;
80
81
  actionLoadingMsg: ShallowRef<string | undefined>;
81
82
  actionErrorMsg: ShallowRef<string | undefined>;
82
83
  clearErrors: () => void;
@@ -95,27 +96,40 @@ export declare interface BTApi {
95
96
  buildQuery: (params: any) => string;
96
97
  buildUrl: (path: PathOptions) => string;
97
98
  deleteItem: (pathOptions: PathOptions) => Promise<string | undefined>;
98
- get: <T>(pathOptions: PathOptions) => Promise<T>;
99
- getAll: <T>(pathOptions: PathOptions) => Promise<T>;
99
+ get: <T>(pathOptions: PathOptions) => Promise<T | undefined>;
100
+ getAll: <T>(pathOptions: PathOptions) => Promise<T | undefined>;
100
101
  post: <T>(pathOptions: PathOptions) => Promise<T | undefined>;
101
102
  patch: <T>(pathOptions: PathOptions) => Promise<T | undefined>;
102
103
  }
103
104
 
105
+ export declare interface BTApiActions {
106
+ apiGet: (doOptions: ApiActionOptions) => Promise<any>;
107
+ apiPost: (doOptions: ApiActionOptions) => Promise<any>;
108
+ actionLoadingMsg: ShallowRef<string | undefined>;
109
+ actionErrorMsg: ShallowRef<string | undefined>;
110
+ clearErrors: () => void;
111
+ doAction: (action: any, options?: DoActionOptions) => Promise<any>;
112
+ isLoading: ComputedRef<boolean>;
113
+ logError: (err?: string | Error) => void;
114
+ }
115
+
104
116
  export declare interface BTAuth {
105
- authState: string;
117
+ authState: Ref<string>;
118
+ /**Global Admin, everything.edit, *.edit */
106
119
  canEdit: (navName?: string) => boolean;
107
120
  canEditPermit: (permit: string) => boolean;
121
+ /**Global Admin, everything.view, *.view */
108
122
  canView: (navName?: string) => boolean;
109
123
  canViewPermit: (permit: string) => boolean;
110
124
  credentials: RemovableRef<any>;
111
125
  doShow: (subcodes?: string[], permissions?: string[], action?: 'view' | 'edit') => boolean;
112
126
  doShowByNav: (navName?: string | AuthItem, includeChildren?: boolean) => boolean;
113
127
  getAuthorizeUrl: (redirectPath?: string) => string;
114
- getTimeZone: () => string;
115
128
  getToken: (code?: string, state?: string) => Promise<void>;
116
129
  isLoggedIn: ComputedRef<boolean>;
117
130
  login: (redirectPath?: string) => void;
118
131
  logout: (navNameRedirect?: string) => void;
132
+ resetAuthState: () => void;
119
133
  setAuth: (jwtToken?: string) => void;
120
134
  timeZone: ComputedRef<string>;
121
135
  tryLogin: () => boolean | undefined;
@@ -132,8 +146,11 @@ export declare interface BTCosmetics {
132
146
  }
133
147
 
134
148
  export declare interface BTDates {
149
+ /**returns start of day */
135
150
  getToday: () => string;
151
+ /**returns start of tomorrow */
136
152
  getTomorrow: () => string;
153
+ /**returns current datetime in tz format */
137
154
  tzDate: (val?: string, fromFormat?: string) => DateTime;
138
155
  tzString: (val?: string, format?: string, fromFormat?: string) => string;
139
156
  utcDate: (val?: string, fromFormat?: string) => DateTime;
@@ -144,6 +161,12 @@ export declare interface BTDemo {
144
161
  endDemo: () => void;
145
162
  isDemoing: Ref<boolean>;
146
163
  startDemo: () => void;
164
+ data: DemoApiGroup[];
165
+ deleteItem: (pathOptions: PathOptions) => Promise<string | undefined>;
166
+ get: (pathOptions: PathOptions) => Promise<any>;
167
+ getAll: (pathOptions: PathOptions) => Promise<any>;
168
+ post: (pathOptions: PathOptions) => Promise<any>;
169
+ patch: (pathOptions: PathOptions) => Promise<any>;
147
170
  }
148
171
 
149
172
  export declare interface BTDocumentMeta {
@@ -165,7 +188,7 @@ export declare interface BTNavigation {
165
188
  findDisplay: (navName?: string | NavigationItem) => string | undefined;
166
189
  findIcon: (navName?: string | NavigationItem) => string | undefined;
167
190
  findItem: (navName?: string | NavigationItem) => NavigationItem | null;
168
- findStoreName: (navName?: string | NavigationItem) => string;
191
+ findStoreName: (navName?: string | NavigationItem) => string | undefined;
169
192
  findPath: (navName?: string | NavigationItem) => string | undefined;
170
193
  findSingleDisplay: (navName?: string | NavigationItem) => string | undefined;
171
194
  updateNavigationProperties: (navName?: string | NavigationItem) => void;
@@ -278,9 +301,14 @@ export declare function createDates(options: CreateDatesOptions): BTDates;
278
301
 
279
302
  export declare interface CreateDatesOptions {
280
303
  getTimeZone: () => string;
304
+ getUTC?: () => DateTime;
281
305
  }
282
306
 
283
- export declare function createDemo(): BTDemo;
307
+ export declare function createDemo(options?: CreateDemoOptions): BTDemo;
308
+
309
+ declare interface CreateDemoOptions {
310
+ apis?: DemoApiGroup[];
311
+ }
284
312
 
285
313
  export declare function createFilters(options: UseFiltersOptions): BTFilters;
286
314
 
@@ -367,6 +395,16 @@ export declare interface DeleteOptions extends PathOptions, DoActionOptions {
367
395
  store?: BTStoreDefinition;
368
396
  }
369
397
 
398
+ declare interface DemoApiGroup {
399
+ nav?: string | string[];
400
+ path?: string;
401
+ data?: any[];
402
+ getAllAction?: (list: any[], params: any) => any[];
403
+ getAction?: (list: any[], id?: string) => any;
404
+ patchAction?: (list: any[], item: any) => any;
405
+ postAction?: (list: any[], item: any) => any;
406
+ }
407
+
370
408
  export declare function distinct(list: any): any;
371
409
 
372
410
  declare interface DoActionOptions {
@@ -378,6 +416,13 @@ declare interface DoActionOptions {
378
416
  throwError?: boolean;
379
417
  }
380
418
 
419
+ export declare interface ExportToCSVOptions {
420
+ items: any[];
421
+ headers?: TableColumn[];
422
+ fileName?: string;
423
+ format: 'array' | 'file';
424
+ }
425
+
381
426
  export declare function extensionExists(elementId?: string): boolean;
382
427
 
383
428
  export declare interface ExternalNavigation {
@@ -903,6 +948,8 @@ export declare interface UseActionsOptions extends DoActionOptions {
903
948
  store?: BTStoreDefinition;
904
949
  throwError?: boolean;
905
950
  url?: string;
951
+ /**for basic functionality when no store is provided */
952
+ items?: any[];
906
953
  }
907
954
 
908
955
  export declare function useActionsTracker(useOptions?: DoActionOptions): {
@@ -917,6 +964,16 @@ export declare function useActionsTracker(useOptions?: DoActionOptions): {
917
964
 
918
965
  export declare function useApi(): BTApi;
919
966
 
967
+ export declare function useApiActions(options: UseApiActionsOptions): BTApiActions;
968
+
969
+ export declare interface UseApiActionsOptions extends DoActionOptions {
970
+ nav?: string;
971
+ proxyID?: string;
972
+ throwError?: boolean;
973
+ url?: string;
974
+ api: BTApi;
975
+ }
976
+
920
977
  export declare interface UseApiOptions {
921
978
  auth?: BTAuth;
922
979
  /**overrides the default */
@@ -933,6 +990,8 @@ export declare interface UseApiOptions {
933
990
  defaultReturnText?: boolean;
934
991
  /**defaults to true. Will throw an error on fail */
935
992
  defaultThrowError?: boolean;
993
+ /**demo for providing any demo data */
994
+ demo?: BTDemo;
936
995
  /**defaults to a function that returns '' */
937
996
  findPath?: FindPath;
938
997
  /**if true and logged in then will set an authorization header with 'bearer [token]' */
@@ -1216,7 +1275,7 @@ declare interface UseSessionStoreOptions {
1216
1275
  /**overrides the default */
1217
1276
  buildUrl?: (path: PathOptions) => string;
1218
1277
  /**the name of this store */
1219
- storeName?: string;
1278
+ storeName: string;
1220
1279
  }
1221
1280
 
1222
1281
  export declare function useStore(options: CreateStoreOptions): BTStore;
@@ -1264,7 +1323,7 @@ declare interface UseWholeLastUpdateStoreOptions {
1264
1323
  /**ideally required. For setting unique local storage keys */
1265
1324
  auth?: BTAuth;
1266
1325
  storageMode?: 'session' | 'local-cache';
1267
- storeName?: string;
1326
+ storeName: string;
1268
1327
  }
1269
1328
 
1270
1329
  export declare function validEmail(email?: string): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bt-core-app",
3
- "version": "1.4.34",
3
+ "version": "1.4.35",
4
4
  "description": "Core app tools for some basic features like navigation, authentication, server apis, and cosmetics",
5
5
  "homepage": "https://github.com/BlitzItTech/bt-core",
6
6
  "bugs": {