inviton-powerduck 0.0.6 → 0.0.7

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.
@@ -3,13 +3,25 @@ import { IPowerduckSystemResources } from './powerduck-system-resources';
3
3
  import jquery from "jquery";
4
4
  import moment from "moment";
5
5
  import select2 from "select2";
6
+ import { Language } from '../common/enums/language';
7
+ import { LanguageUtils } from '../common/utils/language-utils';
8
+
9
+ export interface PoweduckInitFrameworkArgs {
10
+ supportedLanguages?: Language[]
11
+ }
6
12
 
7
13
  export default class PowerduckInitializer {
8
- static initPlugins() {
14
+ static initFramework(args?: PoweduckInitFrameworkArgs) {
9
15
  window["jQuery"] = jquery;
10
16
  window["$"] = window["jQuery"];
11
17
  window["moment"] = moment;
12
18
  window["select2"] = select2();
19
+
20
+ if (args != null) {
21
+ if (args.supportedLanguages?.length as number > 0) {
22
+ LanguageUtils.supportedLanguages = args.supportedLanguages as Language[];
23
+ }
24
+ }
13
25
  }
14
26
 
15
27
  static initState<TResoures extends IPowerduckSystemResources>(resources: TResoures, args?: PowerduckStateInitArgs) {
@@ -5,6 +5,8 @@ import { arraySort } from "./array-sort";
5
5
  import { PortalUtils } from "./utils";
6
6
 
7
7
  export namespace LanguageUtils {
8
+ export let supportedLanguages = [Language.Slovak, Language.English];
9
+
8
10
  export interface LanguageListItem {
9
11
  text: string;
10
12
  value: string;
@@ -63,6 +65,12 @@ export namespace LanguageUtils {
63
65
  return newOption;
64
66
  };
65
67
 
68
+ for (let i = 0; i <= 7; i++) {
69
+ if (supportedLanguages.indexOf(i) > -1) {
70
+ retVal.push(getLanguage(i));
71
+ }
72
+ }
73
+
66
74
  try {
67
75
  retVal.sort(function (a, b) {
68
76
  return a.text.localeCompare(b.text);
@@ -196,6 +204,6 @@ export namespace LanguageUtils {
196
204
  }
197
205
 
198
206
  export function negateString(str: string): string {
199
- return PowerduckState.getResourceValue('negationBase') + str.toLowerCase();
207
+ return PowerduckState.getResourceValue('negationBase') + str.toLowerCase();
200
208
  }
201
209
  }
@@ -1,5 +1,6 @@
1
- import { ImageResponse, OnUploadImageResponse } from "../../api/data-contracts/image";
2
- import { AppState } from "../../app/app-state";
1
+
2
+ import PowerduckState from "../../app/powerduck-state";
3
+ import { ImageResponse, OnUploadImageResponse } from "../../data/image";
3
4
  import { AppHttpProvider } from "../api-http";
4
5
  import { BrowserImageCompression } from "./broswer-image-compression";
5
6
  import StringUtils from "./string-utils";
@@ -21,7 +22,7 @@ export class UploadImageHelper {
21
22
  body: formData,
22
23
  headers: {
23
24
  Authorization: "Bearer " + AppHttpProvider.bearerToken,
24
- "Accept-Language": AppState.currentLanguageCode,
25
+ "Accept-Language": PowerduckState.getCurrentLanguageCode(),
25
26
  },
26
27
  });
27
28
 
@@ -1,8 +1,8 @@
1
- import { IAppRoute } from "../../common/static-wrappers/interfaces/router-interface";
1
+ 
2
2
 
3
3
  export interface NavigationBeforeLeaveArgs {
4
- to?: IAppRoute;
5
- from?: IAppRoute;
4
+ to?: any; //IAppRoute
5
+ from?: any;
6
6
  instance: any;
7
7
  allowsAsync: boolean;
8
8
  next: (result?: boolean) => void;
@@ -29,7 +29,6 @@ import { isNullOrEmpty } from "../../common/utils/is-null-or-empty";
29
29
  import { latinize } from "../../common/utils/latinize-string";
30
30
  import { capitalize } from "../../common/utils/capitalize-string";
31
31
  import { arraySort } from "../../common/utils/array-sort";
32
- import './../../common/image-declarations';
33
32
  import loadingGif from './img/loading_16_16.gif';
34
33
  import PowerduckState from "../../app/powerduck-state";
35
34
 
@@ -10,7 +10,6 @@ import ModalBody from "../modal/modal-body";
10
10
  import HtmlLiteral from "../html-literal/html-literal";
11
11
  import "./css/image-cropping-modal.css";
12
12
  import { isNullOrEmpty } from "../../common/utils/is-null-or-empty";
13
- import './../../common/image-declarations';
14
13
  import textureImg from "./img/transparent_texture.png";
15
14
  import PowerduckState from "../../app/powerduck-state";
16
15
 
@@ -13,7 +13,6 @@ import { LanguageUtils } from "../../common/utils/language-utils";
13
13
  import { ILocalizedString, LocalizedStringHelper } from "../../common/utils/localized-string";
14
14
  import { Language } from "../../common/enums/language";
15
15
  import { isNullOrEmpty } from "../../common/utils/is-null-or-empty";
16
- import './../../common/image-declarations';
17
16
  import globalIcon from './img/global.png';
18
17
  import PowerduckState from "../../app/powerduck-state";
19
18
 
@@ -16,7 +16,6 @@ import { LanguageUtils } from "../../common/utils/language-utils";
16
16
  import { ILocalizedString, LocalizedStringHelper } from "../../common/utils/localized-string";
17
17
  import { Language } from "../../common/enums/language";
18
18
  import { isNullOrEmpty } from "../../common/utils/is-null-or-empty";
19
- import './../../common/image-declarations';
20
19
  import globalIcon from './img/global.png';
21
20
  import PowerduckState from "../../app/powerduck-state";
22
21
 
@@ -18,7 +18,6 @@ import "../input/css/wysiwig.css";
18
18
  import { FileManagerDialog, FileManagerModalFileType } from "../modal/ts/file-manager-dialog";
19
19
  import { DropdownButtonItemArgs } from "../dropdown-button/dropdown-button-item";
20
20
  import EsModuleImportHelper from "../../common/utils/esmodule-import-helper";
21
- import './../../common/image-declarations';
22
21
  import svgIcons from './img/trumbowyg-icons.svg';
23
22
  import PowerduckState from "../../app/powerduck-state";
24
23
 
@@ -6,7 +6,6 @@ import 'leaflet/dist/leaflet.css';
6
6
  import './css/open-street-map.css';
7
7
  import * as LCluster from "leaflet.markercluster";
8
8
  import { isNullOrEmpty } from "../../common/utils/is-null-or-empty";
9
- import './../../common/image-declarations';
10
9
  import iconUrl from './img/marker-icon.png';
11
10
 
12
11
  interface OpenStreetMapClusterOptions {
package/data/image.ts ADDED
@@ -0,0 +1,11 @@
1
+ export class ImageResponse {
2
+ file: {
3
+ id: number;
4
+ path: string;
5
+ };
6
+ }
7
+
8
+ export class OnUploadImageResponse {
9
+ file: File;
10
+ imagePath: string;
11
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "inviton-powerduck",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "build": " vite build && vue-tsc --declaration --emitDeclarationOnly",
@@ -1,24 +0,0 @@
1
- declare module '*.svg' {
2
- const content: string;
3
- export default content;
4
- }
5
-
6
- declare module '*.gif' {
7
- const content: string;
8
- export default content;
9
- }
10
-
11
- declare module '*.png' {
12
- const content: string;
13
- export default content;
14
- }
15
-
16
- declare module '*.jpg' {
17
- const content: string;
18
- export default content;
19
- }
20
-
21
- declare module '*.jpeg' {
22
- const content: string;
23
- export default content;
24
- }