@cartesianui/js 1.0.0
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/README.md +35 -0
- package/axis.d.ts +415 -0
- package/axis.js +1125 -0
- package/axis.message.swal.min.js +1 -0
- package/axis.min.js +1 -0
- package/axis.moment.min.js +1 -0
- package/axis.notification.swal.min.js +1 -0
- package/axis.ui.freeze.min.js +1 -0
- package/freeze-ui.min.js +1 -0
- package/package.json +48 -0
- package/src/libs/freeze-ui/freeze-ui.css +56 -0
- package/src/libs/freeze-ui/freeze-ui.js +81 -0
package/README.md
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
### @cartesianui/js
|
|
2
|
+
|
|
3
|
+
##### _Serves as x-axis for CartesianUI_
|
|
4
|
+
|
|
5
|
+
This package includes below modules.
|
|
6
|
+
|
|
7
|
+
- Application paths
|
|
8
|
+
- MULTITENANCY
|
|
9
|
+
- LOCALIZATION
|
|
10
|
+
- AUTHORIZATION
|
|
11
|
+
- FEATURE SYSTEM
|
|
12
|
+
- SETTINGS
|
|
13
|
+
- REALTIME NOTIFICATIONS
|
|
14
|
+
- LOGGING
|
|
15
|
+
- NOTIFICATION
|
|
16
|
+
- MESSAGE
|
|
17
|
+
- UI
|
|
18
|
+
- SIMPLE EVENT BUS AKA Events
|
|
19
|
+
- UTILS
|
|
20
|
+
- TIMING
|
|
21
|
+
- CLOCK
|
|
22
|
+
- SECURITY
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
Build and publish steps
|
|
26
|
+
- Update package version
|
|
27
|
+
|
|
28
|
+
- Delete *.min files in root
|
|
29
|
+
- Delete axis.js
|
|
30
|
+
- Run `npm run build-and-publish`
|
|
31
|
+
|
|
32
|
+
In case of error try below commands separately
|
|
33
|
+
- Run `gulp concat`
|
|
34
|
+
- Run `gulp build`
|
|
35
|
+
- Run `npm publish`
|
package/axis.d.ts
ADDED
|
@@ -0,0 +1,415 @@
|
|
|
1
|
+
declare namespace axis {
|
|
2
|
+
let appPath: string;
|
|
3
|
+
|
|
4
|
+
let pageLoadTime: Date;
|
|
5
|
+
|
|
6
|
+
function toAbsAppPath(path: string): string;
|
|
7
|
+
|
|
8
|
+
namespace tenancy {
|
|
9
|
+
enum sides {
|
|
10
|
+
TENANT = 1,
|
|
11
|
+
HOST = 2,
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
let isEnabled: boolean;
|
|
15
|
+
|
|
16
|
+
let ignoreFeatureCheckForHostUsers: boolean;
|
|
17
|
+
|
|
18
|
+
let tenantIdCookieName: string;
|
|
19
|
+
|
|
20
|
+
function setTenantIdCookie(tenantId?: string): void;
|
|
21
|
+
|
|
22
|
+
function getTenantIdCookie(): string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
interface ISession {
|
|
26
|
+
|
|
27
|
+
readonly userId?: number;
|
|
28
|
+
|
|
29
|
+
readonly tenantId?: number;
|
|
30
|
+
|
|
31
|
+
readonly impersonatorUserId?: number;
|
|
32
|
+
|
|
33
|
+
readonly impersonatorTenantId?: number;
|
|
34
|
+
|
|
35
|
+
readonly tenancySide: tenancy.sides;
|
|
36
|
+
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
let session: ISession;
|
|
40
|
+
|
|
41
|
+
namespace localization {
|
|
42
|
+
interface ILanguageInfo {
|
|
43
|
+
name: string;
|
|
44
|
+
displayName: string;
|
|
45
|
+
icon: string;
|
|
46
|
+
isDefault: boolean;
|
|
47
|
+
isDisabled: boolean;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
interface ILocalizationSource {
|
|
51
|
+
name: string;
|
|
52
|
+
type: string;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
let languages: ILanguageInfo[];
|
|
56
|
+
|
|
57
|
+
let currentLanguage: ILanguageInfo;
|
|
58
|
+
|
|
59
|
+
let sources: ILocalizationSource[];
|
|
60
|
+
|
|
61
|
+
let defaultSourceName: string;
|
|
62
|
+
|
|
63
|
+
let values: { [key: string]: string };
|
|
64
|
+
|
|
65
|
+
let axisWeb: (key: string) => string;
|
|
66
|
+
|
|
67
|
+
function localize(key: string, sourceName: string): string;
|
|
68
|
+
|
|
69
|
+
function getSource(sourceName: string): (...key: string[]) => string;
|
|
70
|
+
|
|
71
|
+
function isCurrentCulture(name: string): boolean;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
namespace auth {
|
|
75
|
+
let allPermissions: { [name: string]: boolean };
|
|
76
|
+
|
|
77
|
+
let grantedPermissions: { [name: string]: boolean };
|
|
78
|
+
|
|
79
|
+
function isGranted(permissionName: string): boolean;
|
|
80
|
+
|
|
81
|
+
function isAnyGranted(...args: string[]): boolean;
|
|
82
|
+
|
|
83
|
+
function areAllGranted(...args: string[]): boolean;
|
|
84
|
+
|
|
85
|
+
let tokenCookieName: string;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Saves auth token.
|
|
89
|
+
* @param authToken The token to be saved.
|
|
90
|
+
* @param expireDate Optional expire date. If not specified, token will be deleted at end of the session.
|
|
91
|
+
*/
|
|
92
|
+
function setToken(authToken: string, expireDate?: Date): void;
|
|
93
|
+
|
|
94
|
+
function getToken(): string;
|
|
95
|
+
|
|
96
|
+
function clearToken(): void;
|
|
97
|
+
|
|
98
|
+
let refreshTokenCookieName: string;
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Saves refreshToken token.
|
|
102
|
+
* @param refreshToken The token to be saved.
|
|
103
|
+
* @param expireDate Optional expire date. If not specified, token will be deleted at end of the session.
|
|
104
|
+
*/
|
|
105
|
+
function setRefreshToken(refreshToken: string, expireDate?: Date): void;
|
|
106
|
+
|
|
107
|
+
function getRefreshToken(): string;
|
|
108
|
+
|
|
109
|
+
function clearRefreshToken(): void;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
namespace features {
|
|
113
|
+
interface IFeature {
|
|
114
|
+
value: string;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
let allFeatures: { [name: string]: IFeature };
|
|
118
|
+
|
|
119
|
+
function get(name: string): IFeature;
|
|
120
|
+
|
|
121
|
+
function getValue(name: string): string;
|
|
122
|
+
|
|
123
|
+
function isEnabled(name: string): boolean;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
namespace setting {
|
|
127
|
+
let values: { [name: string]: string };
|
|
128
|
+
|
|
129
|
+
function get(name: string): string;
|
|
130
|
+
|
|
131
|
+
function getBoolean(name: string): boolean;
|
|
132
|
+
|
|
133
|
+
function getInt(name: string): number;
|
|
134
|
+
|
|
135
|
+
enum settingScopes {
|
|
136
|
+
Application = 1,
|
|
137
|
+
|
|
138
|
+
Tenant = 2,
|
|
139
|
+
|
|
140
|
+
User = 4,
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
namespace nav {
|
|
145
|
+
interface IMenu {
|
|
146
|
+
name: string;
|
|
147
|
+
displayName?: string;
|
|
148
|
+
customData?: any;
|
|
149
|
+
items: IMenuItem[];
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
interface IMenuItem {
|
|
153
|
+
name: string;
|
|
154
|
+
order: number;
|
|
155
|
+
displayName?: string;
|
|
156
|
+
icon?: string;
|
|
157
|
+
url?: string;
|
|
158
|
+
customData?: any;
|
|
159
|
+
items: IMenuItem[];
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
let menus: { [name: string]: IMenu };
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
namespace notifications {
|
|
166
|
+
enum severity {
|
|
167
|
+
INFO,
|
|
168
|
+
SUCCESS,
|
|
169
|
+
WARN,
|
|
170
|
+
ERROR,
|
|
171
|
+
FATAL,
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
enum userNotificationState {
|
|
175
|
+
UNREAD,
|
|
176
|
+
READ,
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
//TODO: We can extend this interface to define built-in notification types, like ILocalizableMessageNotificationData
|
|
180
|
+
interface INotificationData {
|
|
181
|
+
type: string;
|
|
182
|
+
|
|
183
|
+
properties: any;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
interface INotification {
|
|
187
|
+
id: string;
|
|
188
|
+
notificationName: string;
|
|
189
|
+
severity: severity;
|
|
190
|
+
entityType?: any;
|
|
191
|
+
entityTypeName?: string;
|
|
192
|
+
entityId?: any;
|
|
193
|
+
data: INotificationData;
|
|
194
|
+
creationTime: Date;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
interface IUserNotification {
|
|
198
|
+
id: string;
|
|
199
|
+
userId: number;
|
|
200
|
+
state: userNotificationState;
|
|
201
|
+
notification: INotification;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
let messageFormatters: any;
|
|
205
|
+
|
|
206
|
+
function getUserNotificationStateAsString(
|
|
207
|
+
userNotificationState: userNotificationState
|
|
208
|
+
): string;
|
|
209
|
+
|
|
210
|
+
function getUiNotifyFuncBySeverity(
|
|
211
|
+
severity: severity
|
|
212
|
+
): (message: string, title?: string, options?: any) => void;
|
|
213
|
+
|
|
214
|
+
function getFormattedMessageFromUserNotification(
|
|
215
|
+
userNotification: IUserNotification
|
|
216
|
+
): string;
|
|
217
|
+
|
|
218
|
+
function showUiNotifyForUserNotification(
|
|
219
|
+
userNotification: IUserNotification,
|
|
220
|
+
options?: any
|
|
221
|
+
): void;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
namespace log {
|
|
225
|
+
enum levels {
|
|
226
|
+
DEBUG,
|
|
227
|
+
INFO,
|
|
228
|
+
WARN,
|
|
229
|
+
ERROR,
|
|
230
|
+
FATAL,
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
let level: levels;
|
|
234
|
+
|
|
235
|
+
function log(logObject?: any, logLevel?: levels): void;
|
|
236
|
+
|
|
237
|
+
function debug(logObject?: any): void;
|
|
238
|
+
|
|
239
|
+
function info(logObject?: any): void;
|
|
240
|
+
|
|
241
|
+
function warn(logObject?: any): void;
|
|
242
|
+
|
|
243
|
+
function error(logObject?: any): void;
|
|
244
|
+
|
|
245
|
+
function fatal(logObject?: any): void;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
namespace notify {
|
|
249
|
+
function info(message: string, title?: string, options?: any): void;
|
|
250
|
+
|
|
251
|
+
function success(message: string, title?: string, options?: any): void;
|
|
252
|
+
|
|
253
|
+
function warn(message: string, title?: string, options?: any): void;
|
|
254
|
+
|
|
255
|
+
function error(message: string, title?: string, options?: any): void;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
namespace message {
|
|
259
|
+
//TODO: these methods return jQuery.Promise instead of any. fix it.
|
|
260
|
+
|
|
261
|
+
function info(message: string, title?: string, options?: any): any;
|
|
262
|
+
|
|
263
|
+
function success(message: string, title?: string, options?: any): any;
|
|
264
|
+
|
|
265
|
+
function warn(message: string, title?: string, options?: any): any;
|
|
266
|
+
|
|
267
|
+
function error(message: string, title?: string, options?: any): any;
|
|
268
|
+
|
|
269
|
+
function confirm(
|
|
270
|
+
message: string,
|
|
271
|
+
title?: string,
|
|
272
|
+
callback?: (result: boolean) => void,
|
|
273
|
+
options?: any
|
|
274
|
+
): any;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
namespace ui {
|
|
278
|
+
function block(elm?: any): void;
|
|
279
|
+
|
|
280
|
+
function unblock(elm?: any): void;
|
|
281
|
+
|
|
282
|
+
function setBusy(elm?: any, text?: any, delay?: any): void;
|
|
283
|
+
|
|
284
|
+
function clearBusy(elm?: any, delay?: any): void;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
namespace event {
|
|
288
|
+
function on(eventName: string, callback: (...args: any[]) => void): void;
|
|
289
|
+
|
|
290
|
+
function off(eventName: string, callback: (...args: any[]) => void): void;
|
|
291
|
+
|
|
292
|
+
function trigger(eventName: string, ...args: any[]): void;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
interface INameValue {
|
|
296
|
+
name: string;
|
|
297
|
+
value?: any;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
namespace utils {
|
|
301
|
+
function createNamespace(root: any, ns: string): any;
|
|
302
|
+
|
|
303
|
+
function replaceAll(str: string, search: string, replacement: any): string;
|
|
304
|
+
|
|
305
|
+
function formatString(str: string, ...args: any[]): string;
|
|
306
|
+
|
|
307
|
+
function toPascalCase(str: string): string;
|
|
308
|
+
|
|
309
|
+
function toCamelCase(str: string): string;
|
|
310
|
+
|
|
311
|
+
function truncateString(str: string, maxLength: number): string;
|
|
312
|
+
|
|
313
|
+
function truncateStringWithPostfix(
|
|
314
|
+
str: string,
|
|
315
|
+
maxLength: number,
|
|
316
|
+
postfix?: string
|
|
317
|
+
): string;
|
|
318
|
+
|
|
319
|
+
function isFunction(obj: any): boolean;
|
|
320
|
+
|
|
321
|
+
function buildQueryString(
|
|
322
|
+
parameterInfos: INameValue[],
|
|
323
|
+
includeQuestionMark?: boolean
|
|
324
|
+
): string;
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* Sets a cookie value for given key.
|
|
328
|
+
* This is a simple implementation created to be used by Axis.
|
|
329
|
+
* Please use a complete cookie library if you need.
|
|
330
|
+
* @param {string} key
|
|
331
|
+
* @param {string} value
|
|
332
|
+
* @param {Date} expireDate (optional). If not specified the cookie will expire at the end of session.
|
|
333
|
+
* @param {string} path (optional)
|
|
334
|
+
*/
|
|
335
|
+
function setCookieValue(
|
|
336
|
+
key: string,
|
|
337
|
+
value: string,
|
|
338
|
+
expireDate?: Date,
|
|
339
|
+
path?: string
|
|
340
|
+
): void;
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* Gets a cookie with given key.
|
|
344
|
+
* This is a simple implementation created to be used by Axis.
|
|
345
|
+
* Please use a complete cookie library if you need.
|
|
346
|
+
* @param {string} key
|
|
347
|
+
* @returns {string} Cookie value or null
|
|
348
|
+
*/
|
|
349
|
+
function getCookieValue(key: string): string;
|
|
350
|
+
|
|
351
|
+
/**
|
|
352
|
+
* Deletes cookie for given key.
|
|
353
|
+
* This is a simple implementation created to be used by Axis.
|
|
354
|
+
* Please use a complete cookie library if you need.
|
|
355
|
+
* @param {string} key
|
|
356
|
+
* @param {string} path (optional)
|
|
357
|
+
*/
|
|
358
|
+
function deleteCookie(key: string, path?: string): void;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
namespace timing {
|
|
362
|
+
interface IClockProvider {
|
|
363
|
+
supportsMultipleTimezone: boolean;
|
|
364
|
+
|
|
365
|
+
now(): Date;
|
|
366
|
+
|
|
367
|
+
normalize(date: Date): Date;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
interface ITimeZoneInfo {
|
|
371
|
+
|
|
372
|
+
// TODO: Get rid of this, we need to replace this,
|
|
373
|
+
// as this return data from API from windows machine
|
|
374
|
+
server: {
|
|
375
|
+
timeZoneId: string;
|
|
376
|
+
baseUtcOffsetInMilliseconds: number;
|
|
377
|
+
currentUtcOffsetInMilliseconds: number;
|
|
378
|
+
isDaylightSavingTimeNow: boolean;
|
|
379
|
+
};
|
|
380
|
+
|
|
381
|
+
// We need to use below, and return IANA based timeZoneId
|
|
382
|
+
iana: {
|
|
383
|
+
timeZoneId: string;
|
|
384
|
+
};
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
const utcClockProvider: IClockProvider;
|
|
388
|
+
|
|
389
|
+
const localClockProvider: IClockProvider;
|
|
390
|
+
|
|
391
|
+
const unspecifiedClockProvider: IClockProvider;
|
|
392
|
+
|
|
393
|
+
function convertToUserTimezone(date: Date): Date;
|
|
394
|
+
|
|
395
|
+
let timeZoneInfo: ITimeZoneInfo;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
namespace clock {
|
|
399
|
+
let provider: timing.IClockProvider;
|
|
400
|
+
|
|
401
|
+
function now(): Date;
|
|
402
|
+
|
|
403
|
+
function normalize(date: Date): Date;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
namespace security {
|
|
407
|
+
namespace antiForgery {
|
|
408
|
+
let tokenCookieName: string;
|
|
409
|
+
|
|
410
|
+
let tokenHeaderName: string;
|
|
411
|
+
|
|
412
|
+
function getToken(): string;
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
}
|