robbyson-frontend-library 1.0.58 → 1.0.60

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.
Files changed (42) hide show
  1. package/dist/components/line-chart /line-chart.interface.js +1 -0
  2. package/dist/components/pages/base-app-page.component.js +10 -8
  3. package/dist/components/pie-chart /pie-chart.interface.js +1 -0
  4. package/dist/components/simple-table/simple-table.interface.js +1 -0
  5. package/dist/components/staked-chart/staked-chart.interface.js +1 -0
  6. package/dist/components/vertical-bar-chart/vertical-bar-chart.interface.js +1 -0
  7. package/dist/utils/index.js +1 -0
  8. package/dist/utils/robbyson-navigate.js +13 -1
  9. package/dist/utils/string.utils.js +17 -0
  10. package/index.d.ts +6 -0
  11. package/package.json +3 -2
  12. package/src/components/basic-button/basic-button.interface.ts +1 -0
  13. package/src/components/checkbox/checkbox.interface.ts +1 -0
  14. package/src/components/date-picker/date-picker.interface.ts +1 -0
  15. package/src/components/line-chart /index.d.ts +1 -0
  16. package/src/components/line-chart /line-chart.interface.ts +16 -0
  17. package/src/components/line-chart /line-chart.types.d.ts +9 -0
  18. package/src/components/pages/base-app-page.component.tsx +9 -8
  19. package/src/components/pie-chart /index.d.ts +1 -0
  20. package/src/components/pie-chart /pie-chart.interface.ts +15 -0
  21. package/src/components/pie-chart /pie-chart.types.d.ts +9 -0
  22. package/src/components/primary-tag/primary-tag.interface.ts +2 -0
  23. package/src/components/result-chart/result-chart.interface.ts +2 -0
  24. package/src/components/simple-table/index.d.ts +1 -0
  25. package/src/components/simple-table/simple-table.interface.ts +6 -0
  26. package/src/components/simple-table/simple-table.types.d.ts +9 -0
  27. package/src/components/sort/sort.interface.ts +6 -4
  28. package/src/components/staked-chart/index.d.ts +1 -0
  29. package/src/components/staked-chart/staked-chart.interface.ts +19 -0
  30. package/src/components/staked-chart/staked-chart.types.d.ts +9 -0
  31. package/src/components/table/table.interface.ts +1 -0
  32. package/src/components/tag-expand/tag-expand.interface.ts +1 -0
  33. package/src/components/time-picker/time-picker.interface.ts +1 -0
  34. package/src/components/toggle-icon-button/toggle-icon-button.interface.ts +1 -0
  35. package/src/components/vertical-bar-chart/index.d.ts +1 -0
  36. package/src/components/vertical-bar-chart/vertical-bar-chart.interface.ts +19 -0
  37. package/src/components/vertical-bar-chart/vertical-bar-chart.types.d.ts +9 -0
  38. package/src/models/notification.model.ts +32 -1
  39. package/src/models/user-session.model.ts +1 -0
  40. package/src/utils/index.ts +1 -0
  41. package/src/utils/robbyson-navigate.ts +15 -2
  42. package/src/utils/string.utils.ts +17 -0
@@ -33,7 +33,7 @@ var BaseAppPage = /** @class */ (function (_super) {
33
33
  var _this = _super.call(this, props) || this;
34
34
  _this.headerLocale = "Header Locale";
35
35
  _this._baseAppPageTitleRef = React.createRef();
36
- _this._baseAppPaseTitle = "";
36
+ _this._baseAppPageTitle = "";
37
37
  _this._profileHistoryService = IoC.GetInstance("ProfileService");
38
38
  _this.translate = _this.translate.bind(_this);
39
39
  _this.redirect = _this.redirect.bind(_this);
@@ -44,9 +44,9 @@ var BaseAppPage = /** @class */ (function (_super) {
44
44
  return _this;
45
45
  }
46
46
  BaseAppPage.prototype.redirect = function () {
47
- var state = RobbysonNavigate === null || RobbysonNavigate === void 0 ? void 0 : RobbysonNavigate.getHistoryState();
48
- if (state === null || state === void 0 ? void 0 : state.pathname) {
49
- var actualPathname = RobbysonNavigate.getPathname();
47
+ var actualPathname = RobbysonNavigate.getPathname();
48
+ var history = RobbysonNavigate.getLocationHistory();
49
+ if (history) {
50
50
  var restrictedRoutes = [
51
51
  "/terms-of-use",
52
52
  "/humor",
@@ -55,7 +55,9 @@ var BaseAppPage = /** @class */ (function (_super) {
55
55
  "/quiz",
56
56
  ];
57
57
  var isOperacaoPage = actualPathname.endsWith("/operacao/");
58
- var isRestrictedRoute = restrictedRoutes === null || restrictedRoutes === void 0 ? void 0 : restrictedRoutes.some(function (route) { var _a; return (_a = state === null || state === void 0 ? void 0 : state.pathname) === null || _a === void 0 ? void 0 : _a.includes(route); });
58
+ var isRestrictedRoute = restrictedRoutes === null || restrictedRoutes === void 0 ? void 0 : restrictedRoutes.some(function (route) {
59
+ return history === null || history === void 0 ? void 0 : history.includes(route);
60
+ });
59
61
  if (isOperacaoPage && isRestrictedRoute) {
60
62
  return;
61
63
  }
@@ -80,7 +82,7 @@ var BaseAppPage = /** @class */ (function (_super) {
80
82
  };
81
83
  BaseAppPage.prototype.focusOnTitle = function (title) {
82
84
  if (title) {
83
- this._baseAppPaseTitle = title;
85
+ this._baseAppPageTitle = title;
84
86
  }
85
87
  var route = RobbysonNavigate.getRouteId();
86
88
  var history = this._profileHistoryService.getSessionHistory();
@@ -99,8 +101,8 @@ var BaseAppPage = /** @class */ (function (_super) {
99
101
  React.createElement("div", null,
100
102
  React.createElement(GenericButton, { onClick: function () { return _this.redirect(); }, "aria-label": "Voltar para a tela anterior" },
101
103
  React.createElement(LeftArrowLarge, { src: this._themeService.getIconAssetUrl("left-arrow-large"), isOperacaoPage: isOperacaoPage })),
102
- React.createElement(Title, { tabIndex: 0, ref: this._baseAppPageTitleRef, "aria-label": this._baseAppPaseTitle
103
- ? this._baseAppPaseTitle
104
+ React.createElement(Title, { tabIndex: 0, ref: this._baseAppPageTitleRef, "aria-label": this._baseAppPageTitle
105
+ ? this._baseAppPageTitle
104
106
  : this.translate(this.headerLocale) }, this.translate(this.headerLocale))),
105
107
  !this._avoidContextMenu && (React.createElement(ContextMenu, { className: "body-2-book" }, this.contextMenu()))),
106
108
  React.createElement(Content, { contentMarginTop: this._contentMarginTop, usePageHeader: this._usePageHeader, avoidContextMenu: this._avoidContextMenu }, this.renderPage())));
@@ -9,3 +9,4 @@ export * from "./layout.utils";
9
9
  export * from "./date.utils";
10
10
  export * from "./resize-image";
11
11
  export * from "./timer.utils";
12
+ export * from "./string.utils";
@@ -20,9 +20,13 @@ var RobbysonNavigate = /** @class */ (function () {
20
20
  RobbysonNavigate._globalStore.GetGlobalState();
21
21
  var history = RobbysonNavigate._globalState.Global.RootApp.history;
22
22
  var routeState = __assign(__assign({}, state), { pathname: history.location.pathname });
23
+ this.setLocationHistory(history.location.pathname);
23
24
  // TODO: Usar a LIB PATH para concatenar a URL
24
25
  history.push("/operacao".concat(url), routeState);
25
26
  };
27
+ RobbysonNavigate.openInNewTab = function (url) {
28
+ window.open(url, '_blank');
29
+ };
26
30
  RobbysonNavigate.go = function (delta) {
27
31
  RobbysonNavigate._globalStore = GlobalStore.Get();
28
32
  RobbysonNavigate._globalState =
@@ -42,7 +46,9 @@ var RobbysonNavigate = /** @class */ (function () {
42
46
  RobbysonNavigate._globalState =
43
47
  RobbysonNavigate._globalStore.GetGlobalState();
44
48
  var history = RobbysonNavigate._globalState.Global.RootApp.history;
45
- history.replace(replace, state);
49
+ var routeState = __assign(__assign({}, state), { pathname: history.location.pathname });
50
+ this.setLocationHistory(history.location.pathname);
51
+ history.replace(replace, routeState);
46
52
  };
47
53
  RobbysonNavigate.getHistory = function () {
48
54
  RobbysonNavigate._globalStore = GlobalStore.Get();
@@ -82,6 +88,12 @@ var RobbysonNavigate = /** @class */ (function () {
82
88
  sort: false,
83
89
  });
84
90
  };
91
+ RobbysonNavigate.setLocationHistory = function (location) {
92
+ localStorage.setItem("location-history", location);
93
+ };
94
+ RobbysonNavigate.getLocationHistory = function () {
95
+ return localStorage.getItem("location-history");
96
+ };
85
97
  RobbysonNavigate.setQueryParams = function (key, value) {
86
98
  var queryString = new URLSearchParams(RobbysonNavigate.getQueryParams());
87
99
  if (Array.isArray(key) && Array.isArray(value)) {
@@ -0,0 +1,17 @@
1
+ import { ToWords } from "to-words";
2
+ var StringUtils = /** @class */ (function () {
3
+ function StringUtils() {
4
+ }
5
+ StringUtils.numberToWords = function (n) {
6
+ var numberToConvert = Number(n);
7
+ if (isNaN(numberToConvert)) {
8
+ return n;
9
+ }
10
+ return this._toWords.convert(numberToConvert);
11
+ };
12
+ StringUtils._toWords = new ToWords({
13
+ localeCode: "pt-BR",
14
+ });
15
+ return StringUtils;
16
+ }());
17
+ export { StringUtils };
package/index.d.ts CHANGED
@@ -85,4 +85,10 @@ export * from "./src/components/full-balance-page";
85
85
  export * from "./src/components/guard-module";
86
86
  export * from "./src/components/guard-permission";
87
87
  export * from "./src/components/favorite-button";
88
+ export * from "./src/components/vertical-bar-chart";
89
+ export * from "./src/components/simple-table";
90
+ export * from "./src/components/staked-chart";
91
+ export * from "./src/components/line-chart";
92
+ export * from "./src/components/pie-chart";
93
+ export * from "./src/components/radar-chart";
88
94
  export * from "./src/components/tab-result";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "robbyson-frontend-library",
3
- "version": "1.0.58",
3
+ "version": "1.0.60",
4
4
  "description": "Robbyson frontend Library",
5
5
  "main": "./dist/index.js",
6
6
  "license": "MIT",
@@ -46,6 +46,7 @@
46
46
  "redux-micro-frontend": "^1.3.0",
47
47
  "redux-persist": "^6.0.0",
48
48
  "robbyson-library-v2": "^0.3.2",
49
- "socket.io-client": "^4.7.4"
49
+ "socket.io-client": "^4.7.4",
50
+ "to-words": "^4.1.0"
50
51
  }
51
52
  }
@@ -13,4 +13,5 @@ export interface IBasicButtonProps<T>
13
13
  shape?: "round" | "square";
14
14
  isModalButton?: boolean;
15
15
  ariaLabel?: string;
16
+ forwardRef?(ref: HTMLButtonElement | null): void;
16
17
  }
@@ -8,4 +8,5 @@ export interface ICheckboxProps<T> extends React.InputHTMLAttributes<T>, IBaseCo
8
8
  hasError?: boolean;
9
9
  id: string;
10
10
  preventPropagation?: boolean
11
+ ariaLabel?: string;
11
12
  }
@@ -9,6 +9,7 @@ export interface IDatePickerProps extends IBaseComponentProp {
9
9
  };
10
10
  minDate?: Date | null;
11
11
  maxDate?: Date;
12
+ ariaLabel?: string;
12
13
  }
13
14
 
14
15
  export interface IDatePickerState {
@@ -0,0 +1 @@
1
+ export * from './line-chart.interface';
@@ -0,0 +1,16 @@
1
+ import { IBaseComponentProp } from "../base-component.prop.interface";
2
+
3
+ export interface ILineChartProps<T> extends IBaseComponentProp {
4
+ data: {
5
+ labels: string[];
6
+ datasets: T[];
7
+ };
8
+ datasets: {
9
+ label: string;
10
+ backgroundColor: string;
11
+ borderColor: string;
12
+ borderWidth: number;
13
+ data: number[];
14
+ }[];
15
+
16
+ }
@@ -0,0 +1,9 @@
1
+ ///<reference types="react" />
2
+ ///<reference types="robbyson-frontend-library" />
3
+
4
+ declare module "styleguide/LineChart" {
5
+ import { ILineChartProps } from "robbyson-frontend-library";
6
+ const LineChart: React.ComponentType<ILineChartProps>;
7
+
8
+ export default LineChart;
9
+ }
@@ -25,7 +25,7 @@ export abstract class BaseAppPage<T, T1> extends React.Component<T, T1> {
25
25
  protected _usePageHeader?: boolean;
26
26
  protected _avoidContextMenu?: boolean;
27
27
  private _baseAppPageTitleRef = React.createRef<HTMLHeadingElement>();
28
- private _baseAppPaseTitle = "";
28
+ private _baseAppPageTitle = "";
29
29
  private _profileHistoryService =
30
30
  IoC.GetInstance<IProfileService>("ProfileService");
31
31
 
@@ -40,9 +40,9 @@ export abstract class BaseAppPage<T, T1> extends React.Component<T, T1> {
40
40
  IoC.GetInstance<IProfileService>("ProfileService");
41
41
  }
42
42
  private redirect(): void {
43
- const state = RobbysonNavigate?.getHistoryState() as any;
44
- if (state?.pathname) {
45
- const actualPathname = RobbysonNavigate.getPathname();
43
+ const actualPathname = RobbysonNavigate.getPathname();
44
+ const history = RobbysonNavigate.getLocationHistory();
45
+ if (history) {
46
46
  const restrictedRoutes = [
47
47
  "/terms-of-use",
48
48
  "/humor",
@@ -50,9 +50,10 @@ export abstract class BaseAppPage<T, T1> extends React.Component<T, T1> {
50
50
  "/login",
51
51
  "/quiz",
52
52
  ];
53
+
53
54
  const isOperacaoPage = actualPathname.endsWith("/operacao/");
54
55
  const isRestrictedRoute = restrictedRoutes?.some((route) =>
55
- state?.pathname?.includes(route)
56
+ history?.includes(route)
56
57
  );
57
58
 
58
59
  if (isOperacaoPage && isRestrictedRoute) {
@@ -74,7 +75,7 @@ export abstract class BaseAppPage<T, T1> extends React.Component<T, T1> {
74
75
 
75
76
  protected focusOnTitle(title?: string): void {
76
77
  if (title) {
77
- this._baseAppPaseTitle = title;
78
+ this._baseAppPageTitle = title;
78
79
  }
79
80
 
80
81
  const route = RobbysonNavigate.getRouteId();
@@ -118,8 +119,8 @@ export abstract class BaseAppPage<T, T1> extends React.Component<T, T1> {
118
119
  tabIndex={0}
119
120
  ref={this._baseAppPageTitleRef}
120
121
  aria-label={
121
- this._baseAppPaseTitle
122
- ? this._baseAppPaseTitle
122
+ this._baseAppPageTitle
123
+ ? this._baseAppPageTitle
123
124
  : this.translate(this.headerLocale)
124
125
  }
125
126
  >
@@ -0,0 +1 @@
1
+ export * from './pie-chart.interface';
@@ -0,0 +1,15 @@
1
+ import { IBaseComponentProp } from "../base-component.prop.interface";
2
+
3
+ export interface IPieChartProps<T> extends IBaseComponentProp {
4
+ data: {
5
+ labels: string[];
6
+ datasets: T[];
7
+ };
8
+ datasets: {
9
+ label: string;
10
+ backgroundColor: string;
11
+ borderColor: string;
12
+ borderWidth: number;
13
+ data: number[];
14
+ }[];
15
+ }
@@ -0,0 +1,9 @@
1
+ ///<reference types="react" />
2
+ ///<reference types="robbyson-frontend-library" />
3
+
4
+ declare module "styleguide/PieChart" {
5
+ import { IPieChartProps } from "robbyson-frontend-library";
6
+ const PieChart: React.ComponentType<IPieChartProps>;
7
+
8
+ export default PieChart;
9
+ }
@@ -3,6 +3,7 @@ import { IBaseComponentProp } from "../base-component.prop.interface";
3
3
 
4
4
  export interface IPrimaryTagState {
5
5
  show: boolean;
6
+ removeTagbuttonLabel?: string;
6
7
  }
7
8
  export interface IPrimaryTagProps<T>
8
9
  extends IBaseComponentProp,
@@ -18,4 +19,5 @@ export interface IPrimaryTagProps<T>
18
19
  iconColor?: string;
19
20
  customIcon?: React.ReactNode;
20
21
  textClassName?: string;
22
+ tagRemoveButtonLabel?: string;
21
23
  }
@@ -20,10 +20,12 @@ export interface IResultChartProps extends IBaseComponentProp {
20
20
  isInitialPosition?: boolean;
21
21
  tabIndex?: number;
22
22
  node_id?: string;
23
+ dailyAriaLabel?: string;
23
24
  }
24
25
 
25
26
  export interface IResultChartState {
26
27
  active: boolean;
28
+ isLoadingDays?: boolean;
27
29
  }
28
30
 
29
31
  type ChartDataResults = {
@@ -0,0 +1 @@
1
+ export * from "./simple-table.interface";
@@ -0,0 +1,6 @@
1
+ import React from "react";
2
+ import { IBaseComponentProp } from "../base-component.prop.interface";
3
+
4
+ export interface ISimpleTableProps<T> extends IBaseComponentProp {
5
+ message?: T;
6
+ }
@@ -0,0 +1,9 @@
1
+ ///<reference types="react" />
2
+ ///<reference types="robbyson-frontend-library" />
3
+
4
+ declare module 'styleguide/SimpleTable' {
5
+ import { ISimpleTableProps } from "robbyson-frontend-library";
6
+ const SimpleTable: React.ComponentType<ISimpleTableProps>;
7
+
8
+ export default SimpleTable;
9
+ }
@@ -3,10 +3,7 @@ import { IBaseComponentProp } from "../base-component.prop.interface";
3
3
 
4
4
  export interface ISortProps extends IBaseComponentProp {
5
5
  titleLocaleHandle?: string;
6
- options: Array<{
7
- nameLocaleHandle: string;
8
- value: string | number;
9
- }>;
6
+ options: ISortOptions[];
10
7
  defaultOption?: string | number;
11
8
  selectedKeys?: string[];
12
9
  icon: IconHandle;
@@ -26,3 +23,8 @@ export interface ISortState {
26
23
  showSort: boolean;
27
24
  sortValue?: string | number;
28
25
  }
26
+
27
+ export interface ISortOptions {
28
+ nameLocaleHandle: string;
29
+ value: string | number;
30
+ }
@@ -0,0 +1 @@
1
+ export * from './staked-chart.interface';
@@ -0,0 +1,19 @@
1
+ import { IBaseComponentProp } from "../base-component.prop.interface";
2
+
3
+ export interface StakedChartProps<T> extends IBaseComponentProp {
4
+ data: {
5
+ labels: string[];
6
+ datasets: T[];
7
+ };
8
+ datasets: {
9
+ label: string;
10
+ backgroundColor: string;
11
+ borderColor: string;
12
+ borderWidth: number;
13
+ data: number[];
14
+ }[];
15
+ }
16
+
17
+
18
+ export interface StakedChartState {
19
+ }
@@ -0,0 +1,9 @@
1
+ ///<reference types="react" />
2
+ ///<reference types="robbyson-frontend-library" />
3
+
4
+ declare module "styleguide/StakedChart" {
5
+ import { IStakedChartProps } from "robbyson-frontend-library";
6
+ const StakedChart: React.ComponentType<IStakedChartProps>;
7
+
8
+ export default StakedChart;
9
+ }
@@ -6,6 +6,7 @@ interface Title {
6
6
  titleLocaleHandle: string | React.ReactNode;
7
7
  color: string;
8
8
  numberOfColumn: number;
9
+ tabIndex?: number;
9
10
  }
10
11
 
11
12
  interface Header {
@@ -7,4 +7,5 @@ export interface ITagExpandProps<T> extends IBaseComponentProp {
7
7
  text?: string;
8
8
  textLocaleHandle?: string;
9
9
  bg?: string
10
+ ariaLabel?: string
10
11
  }
@@ -8,6 +8,7 @@ export interface ITimePickerProps extends IBaseComponentProp {
8
8
  onClickTime(hour: string, minutes: string): void;
9
9
  timerPickerValue: string;
10
10
  inputProps?: Omit<ITextFieldProps, "value" | "dataTestId">;
11
+ ariaLabel?: string;
11
12
  }
12
13
 
13
14
  export interface ITimePickerState {
@@ -13,4 +13,5 @@ export interface IToggleIconButtonProps<T>
13
13
  disabledIconHandle?: IconHandle;
14
14
  fatherControl?: boolean;
15
15
  ariaLabel?: string;
16
+ forwardRef?: (ref: HTMLButtonElement | null) => void;
16
17
  }
@@ -0,0 +1 @@
1
+ export * from './vertical-bar-chart.interface';
@@ -0,0 +1,19 @@
1
+ import { IBaseComponentProp } from "../base-component.prop.interface";
2
+
3
+ export interface VerticalBarChartProps<T> extends IBaseComponentProp {
4
+ data: {
5
+ labels: string[];
6
+ datasets: T[];
7
+ };
8
+ datasets: {
9
+ label: string;
10
+ backgroundColor: string;
11
+ borderColor: string;
12
+ borderWidth: number;
13
+ data: number[];
14
+ }[];
15
+ }
16
+
17
+
18
+ export interface VerticalBarChartState {
19
+ }
@@ -0,0 +1,9 @@
1
+ ///<reference types="react" />
2
+ ///<reference types="robbyson-frontend-library" />
3
+
4
+ declare module "styleguide/VerticalBarChart" {
5
+ import { IVerticalBarChartProps } from "robbyson-frontend-library";
6
+ const VerticalBarChart: React.ComponentType<IVerticalBarChartProps>;
7
+
8
+ export default VerticalBarChart;
9
+ }
@@ -42,9 +42,40 @@ export class NotificationModel extends BaseRepositoryModel {
42
42
  tags: [{ _id: false; text: string }];
43
43
  context: [{ _id: false; flag: string; url: string }];
44
44
  targetSystems: [number];
45
- payloadTemplate: {};
45
+ payloadTemplate: Template[];
46
46
  previewContent?: Blob | MediaSource;
47
47
  imageContent?: Blob | MediaSource;
48
48
  pdfUrl?: string;
49
49
  videoContent?: Blob | MediaSource;
50
50
  }
51
+ export type Template = {
52
+ type: 'text' | 'button' | 'table' | 'image' | 'video' | 'user' | 'list' | 'link' | 'chart' | 'open_chat' | '';
53
+ createdAt: string;
54
+ title: string;
55
+ footer: string;
56
+ voiceDescription: string;
57
+ payload: {
58
+ header: [{
59
+ value: string;
60
+ requestPayload: any;
61
+ color?: string;
62
+ style?: string;
63
+ tag?: string;
64
+ tooltip?: string;
65
+ }];
66
+ content: [{
67
+ subtype?: any;
68
+ value: any;
69
+ requestPayload: any;
70
+ color?: {
71
+ background: string;
72
+ text: string;
73
+ };
74
+ style?: string;
75
+ tag?: string;
76
+ tooltip?: string;
77
+ child?: any[];
78
+ // customization?: Partial<TemplateCustomization>;
79
+ }]
80
+ },
81
+ }
@@ -65,6 +65,7 @@ export class UserSessionModel extends BaseRepositoryModel {
65
65
  // @TODO: this field is not completed filled as ClienteRobbyson and both needs to be the same, fix it at service-authentication
66
66
  _id: number;
67
67
  active: boolean;
68
+ authRoute: string;
68
69
  closingDay: number;
69
70
  coins_indicator_id: number;
70
71
  enableEAD: boolean;
@@ -9,3 +9,4 @@ export * from "./layout.utils";
9
9
  export * from "./date.utils";
10
10
  export * from "./resize-image";
11
11
  export * from "./timer.utils";
12
+ export * from "./string.utils";
@@ -14,9 +14,15 @@ export class RobbysonNavigate {
14
14
 
15
15
  const { history } = RobbysonNavigate._globalState.Global.RootApp;
16
16
  const routeState = { ...state, pathname: history.location.pathname };
17
+ this.setLocationHistory( history.location.pathname)
17
18
  // TODO: Usar a LIB PATH para concatenar a URL
18
19
  history.push(`/operacao${url}`, routeState);
19
20
  }
21
+
22
+ static openInNewTab(url: string) {
23
+ window.open(url, '_blank')
24
+ }
25
+
20
26
  static go(delta: number) {
21
27
  RobbysonNavigate._globalStore = GlobalStore.Get();
22
28
  RobbysonNavigate._globalState =
@@ -42,8 +48,10 @@ export class RobbysonNavigate {
42
48
  RobbysonNavigate._globalStore.GetGlobalState();
43
49
 
44
50
  const { history } = RobbysonNavigate._globalState.Global.RootApp;
51
+ const routeState = { ...state, pathname: history.location.pathname };
52
+ this.setLocationHistory( history.location.pathname)
45
53
 
46
- history.replace(replace, state);
54
+ history.replace(replace, routeState);
47
55
  }
48
56
 
49
57
  static getHistory(): BrowserHistory {
@@ -98,7 +106,12 @@ export class RobbysonNavigate {
98
106
  sort: false,
99
107
  }) as T;
100
108
  }
101
-
109
+ static setLocationHistory(location: string){
110
+ localStorage.setItem("location-history", location)
111
+ }
112
+ static getLocationHistory(): string | null {
113
+ return localStorage.getItem("location-history")
114
+ }
102
115
  static setQueryParams(
103
116
  key: string | string[],
104
117
  value: string | number | (string | number)[]
@@ -0,0 +1,17 @@
1
+ import { ToWords } from "to-words";
2
+
3
+ export class StringUtils {
4
+ private static _toWords = new ToWords({
5
+ localeCode: "pt-BR",
6
+ });
7
+
8
+ public static numberToWords(n: number): string | number {
9
+ const numberToConvert = Number(n);
10
+
11
+ if (isNaN(numberToConvert)) {
12
+ return n;
13
+ }
14
+
15
+ return this._toWords.convert(numberToConvert);
16
+ }
17
+ }