@agendize/vue-tools 1.2.0 → 1.4.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.
@@ -1,11 +1,11 @@
1
- declare type Subscription<S> = (state: S) => void;
2
- export declare abstract class Bloc<S> {
3
- private internalState;
4
- private listeners;
5
- constructor(initialState: S);
6
- get state(): S;
7
- changeState(state: S): void;
8
- subscribe(listener: Subscription<S>): void;
9
- unsubscribe(listener: Subscription<S>): void;
10
- }
11
- export {};
1
+ declare type Subscription<S> = (state: S) => void;
2
+ export declare abstract class Bloc<S> {
3
+ private internalState;
4
+ private listeners;
5
+ constructor(initialState: S);
6
+ get state(): S;
7
+ changeState(state: S): void;
8
+ subscribe(listener: Subscription<S>): void;
9
+ unsubscribe(listener: Subscription<S>): void;
10
+ }
11
+ export {};
@@ -1,3 +1,3 @@
1
- import { Bloc } from "./Bloc";
2
- import { DeepReadonly, Ref } from "vue";
3
- export declare function useBlocState<S>(bloc: Bloc<S>): DeepReadonly<Ref<S>>;
1
+ import { Bloc } from "./Bloc";
2
+ import { DeepReadonly, Ref } from "vue";
3
+ export declare function useBlocState<S>(bloc: Bloc<S>): DeepReadonly<Ref<S>>;
package/dist/index.d.ts CHANGED
@@ -1,11 +1,16 @@
1
- import { useBlocState } from "./bloc/useBlocState";
2
- import { dateToString } from "./utils/date";
3
- import { onPictureUpdated, readBlobFromUrl, toBase64 } from "./utils/file";
4
- import { pad, parseToInt, formatDate, decodeHtml, personToInitials } from "./utils/format";
5
- import QRCode from "./presentation/component/qr-code/View.vue";
6
- import { createStore, useAccountStore } from "./store/accountStore";
7
- export * from './bloc/Bloc';
8
- export * from './utils/colorUtils';
9
- export { useBlocState, dateToString, QRCode, onPictureUpdated, readBlobFromUrl, pad, parseToInt, formatDate, toBase64, decodeHtml, personToInitials };
10
- export { createStore, useAccountStore };
11
- export * from './utils/constants';
1
+ import { useBlocState } from "./bloc/useBlocState";
2
+ import { dateToString } from "./utils/date";
3
+ import { onPictureUpdated, readBlobFromUrl, toBase64 } from "./utils/file";
4
+ import { pad, parseToInt, formatDate, decodeHtml, personToInitials } from "./utils/format";
5
+ import QRCode from "./presentation/component/qr-code/View.vue";
6
+ import { createStore, useAccountStore } from "./store/accountStore";
7
+ import { createApi, createLogger, useApi, useLogger } from "./store/plugins";
8
+ import { poll } from "./utils/poll";
9
+ export * from './bloc/Bloc';
10
+ export * from './utils/colorUtils';
11
+ export { useBlocState, dateToString, QRCode, onPictureUpdated, readBlobFromUrl, pad, parseToInt, formatDate, toBase64, decodeHtml, personToInitials };
12
+ export { createStore, useAccountStore };
13
+ export { createApi, createLogger, useApi, useLogger };
14
+ export { poll };
15
+ export * from './utils/constants';
16
+ export * from './utils/lazy';
@@ -1,69 +1,60 @@
1
- import { Locale } from "@agendize/az-i18n";
2
- declare const _default: import("vue").DefineComponent<{
3
- width: {
4
- type: import("vue").PropType<number>;
5
- required: true;
6
- };
7
- height: {
8
- type: import("vue").PropType<number>;
9
- required: true;
10
- };
11
- bgColor: {
12
- type: import("vue").PropType<string>;
13
- };
14
- dotsColor: {
15
- type: import("vue").PropType<string>;
16
- };
17
- value: {
18
- type: import("vue").PropType<string>;
19
- required: true;
20
- };
21
- outlineValue: {
22
- type: import("vue").PropType<string>;
23
- required: true;
24
- };
25
- locale: {
26
- type: import("vue").PropType<Locale>;
27
- required: true;
28
- };
29
- download: {
30
- type: import("vue").PropType<boolean>;
31
- } & {
32
- default: boolean;
33
- };
34
- }, () => void, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
35
- width: {
36
- type: import("vue").PropType<number>;
37
- required: true;
38
- };
39
- height: {
40
- type: import("vue").PropType<number>;
41
- required: true;
42
- };
43
- bgColor: {
44
- type: import("vue").PropType<string>;
45
- };
46
- dotsColor: {
47
- type: import("vue").PropType<string>;
48
- };
49
- value: {
50
- type: import("vue").PropType<string>;
51
- required: true;
52
- };
53
- outlineValue: {
54
- type: import("vue").PropType<string>;
55
- required: true;
56
- };
57
- locale: {
58
- type: import("vue").PropType<Locale>;
59
- required: true;
60
- };
61
- download: {
62
- type: import("vue").PropType<boolean>;
63
- } & {
64
- default: boolean;
65
- };
66
- }>>, {
67
- download: boolean;
68
- }>;
69
- export default _default;
1
+ declare const _default: import("vue").DefineComponent<{
2
+ width: {
3
+ type: import("vue").PropType<number>;
4
+ required: true;
5
+ };
6
+ height: {
7
+ type: import("vue").PropType<number>;
8
+ required: true;
9
+ };
10
+ bgColor: {
11
+ type: import("vue").PropType<string>;
12
+ };
13
+ dotsColor: {
14
+ type: import("vue").PropType<string>;
15
+ };
16
+ value: {
17
+ type: import("vue").PropType<string>;
18
+ required: true;
19
+ };
20
+ outlineValue: {
21
+ type: import("vue").PropType<string>;
22
+ required: true;
23
+ };
24
+ download: {
25
+ type: import("vue").PropType<boolean>;
26
+ } & {
27
+ default: boolean;
28
+ };
29
+ }, () => void, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
30
+ width: {
31
+ type: import("vue").PropType<number>;
32
+ required: true;
33
+ };
34
+ height: {
35
+ type: import("vue").PropType<number>;
36
+ required: true;
37
+ };
38
+ bgColor: {
39
+ type: import("vue").PropType<string>;
40
+ };
41
+ dotsColor: {
42
+ type: import("vue").PropType<string>;
43
+ };
44
+ value: {
45
+ type: import("vue").PropType<string>;
46
+ required: true;
47
+ };
48
+ outlineValue: {
49
+ type: import("vue").PropType<string>;
50
+ required: true;
51
+ };
52
+ download: {
53
+ type: import("vue").PropType<boolean>;
54
+ } & {
55
+ default: boolean;
56
+ };
57
+ }>>, {
58
+ download: boolean;
59
+ }>;
60
+ export default _default;
@@ -1,14 +1,14 @@
1
- import { AccountEntity, ApiErrors, CalendarApi } from "@agendize/js-calendar-api";
2
- import type { Ability } from "@agendize/vue-acl";
3
- import { RoleType } from "@agendize/vue-acl/src/types/acl";
4
- export declare type AccountState = {
5
- account: AccountEntity;
6
- };
7
- export declare const createStore: (calendarApi: CalendarApi, aclApi: any) => import("pinia").Pinia;
8
- export declare const useAccountStore: import("pinia").StoreDefinition<"account", AccountState, {}, {
9
- updateAccount(payload: AccountEntity): Promise<void>;
10
- fetchAccount(success?: (account: AccountEntity) => void, error?: (error: ApiErrors) => void): Promise<void>;
11
- updatePassword(currentPassword: string, newPassword: string): Promise<void>;
12
- hasAbility(ability: Ability, objectId?: string): Promise<boolean>;
13
- hasAnyRoles(roles: RoleType[]): Promise<boolean>;
14
- }>;
1
+ import { AccountEntity, ApiErrors, CalendarApi } from "@agendize/js-calendar-api";
2
+ import type { Ability } from "@agendize/vue-acl";
3
+ import { RoleType } from "@agendize/vue-acl/src/types/acl";
4
+ export declare type AccountState = {
5
+ account: AccountEntity;
6
+ };
7
+ export declare const createStore: (calendarApi: CalendarApi, aclApi: any) => import("pinia").Pinia;
8
+ export declare const useAccountStore: import("pinia").StoreDefinition<"account", AccountState, {}, {
9
+ updateAccount(payload: AccountEntity): Promise<void>;
10
+ fetchAccount(crossAccount?: boolean, success?: (account: AccountEntity) => void, error?: (error: ApiErrors) => void): Promise<void>;
11
+ updatePassword(currentPassword: string, newPassword: string): Promise<void>;
12
+ hasAbility(ability: Ability, objectId?: string): Promise<boolean>;
13
+ hasAnyRoles(roles: RoleType[]): Promise<boolean>;
14
+ }>;
@@ -0,0 +1,9 @@
1
+ import { Plugin } from 'vue';
2
+ import { Logger, CalendarApi, LoggerLevel, LoggerInterface } from '@agendize/js-calendar-api';
3
+ export declare const createApi: (calendarOptions: {
4
+ baseURL: string;
5
+ clientId: string;
6
+ }) => Plugin;
7
+ export declare const createLogger: (logger: LoggerInterface, level: LoggerLevel) => Plugin;
8
+ export declare const useApi: () => CalendarApi;
9
+ export declare const useLogger: () => Logger;
@@ -1,5 +1,5 @@
1
- export interface ColorDef {
2
- key: string;
3
- code: string;
4
- }
5
- export declare function generateShadesFromColor(color: string): ColorDef[];
1
+ export interface ColorDef {
2
+ key: string;
3
+ code: string;
4
+ }
5
+ export declare function generateShadesFromColor(color: string): ColorDef[];
@@ -1,4 +1,4 @@
1
- export declare const languages: {
2
- label: string;
3
- value: string;
4
- }[];
1
+ export declare const languages: {
2
+ label: string;
3
+ value: string;
4
+ }[];
@@ -1 +1 @@
1
- export declare function dateToString(date: Date, short?: boolean): string;
1
+ export declare function dateToString(date: Date, short?: boolean): string;
@@ -1,9 +1,9 @@
1
- import { Ref } from "vue";
2
- declare function onPictureUpdated(item: File | undefined, objectDefinition: {
3
- urlPicture: Ref<string | undefined>;
4
- pictureAsData: Ref<string | undefined>;
5
- filePicture: Ref<File | undefined>;
6
- }): void;
7
- declare const toBase64: (file: File) => Promise<string | ArrayBuffer>;
8
- declare function readBlobFromUrl(url: string, callback: (data: string) => void): void;
9
- export { toBase64, onPictureUpdated, readBlobFromUrl };
1
+ import { Ref } from "vue";
2
+ declare function onPictureUpdated(item: File | undefined, objectDefinition: {
3
+ urlPicture: Ref<string | undefined>;
4
+ pictureAsData: Ref<string | undefined>;
5
+ filePicture: Ref<File | undefined>;
6
+ }): void;
7
+ declare const toBase64: (file: File) => Promise<string | ArrayBuffer>;
8
+ declare function readBlobFromUrl(url: string, callback: (data: string) => void): void;
9
+ export { toBase64, onPictureUpdated, readBlobFromUrl };
@@ -1,10 +1,10 @@
1
- declare function parseToInt(value: string): number;
2
- declare function formatDate(date?: Date): string;
3
- declare function pad(value: any, size?: number): string;
4
- declare function decodeHtml(html: any): string;
5
- declare function personToInitials(person?: {
6
- firstName?: string;
7
- lastName?: string;
8
- name?: string;
9
- }): string;
10
- export { formatDate, pad, parseToInt, decodeHtml, personToInitials };
1
+ declare function parseToInt(value: string): number;
2
+ declare function formatDate(date?: Date): string;
3
+ declare function pad(value: any, size?: number): string;
4
+ declare function decodeHtml(html: any): string;
5
+ declare function personToInitials(person?: {
6
+ firstName?: string;
7
+ lastName?: string;
8
+ name?: string;
9
+ }): string;
10
+ export { formatDate, pad, parseToInt, decodeHtml, personToInitials };
@@ -0,0 +1,8 @@
1
+ import { AsyncComponentLoader, Component } from "vue";
2
+ export interface AsyncOptions {
3
+ loading: Component;
4
+ error: Component;
5
+ delay?: number;
6
+ timeout?: number;
7
+ }
8
+ export declare function defineAsyncComponentWithLoading(fn: AsyncComponentLoader<any>, options?: AsyncOptions): any;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Effectue l'appel à une methode à interval regulier
3
+ *
4
+ * @param fn Methode à appeler.
5
+ * @param validate Methode permettant de stopper le polling suivant le résultat retourné par la méthode de polling
6
+ * @param interval Interval en ms des appels à la méthode de polling
7
+ * @param maxAttempts Nombre maximum de tentative de polling suite à une erreur de validation
8
+ * @param mustStopPoll Permet de stopper le polling (à la différence de la méthode validate, ici le polling est stoppé avant l'appel à la méthode de polling)
9
+ */
10
+ export declare function poll<T>(fn: () => Promise<T>, validate: (T: any) => boolean, interval: number, maxAttempts?: number, mustStopPoll?: () => boolean): Promise<unknown>;