@v1nt1248/3nclient-lib 0.2.81 → 0.2.83

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,7 +1,7 @@
1
1
  import { Component } from '../../../vue/dist/vue.esm-bundler.js';
2
- import { ExtractComponentProps, Ui3nIconField } from '../../types/index';
2
+ import { ExtractComponentProps, Ui3nIconField } from '../../types';
3
3
  export type Ui3nDialogEvent = 'open' | 'before-close' | 'close' | 'confirm' | 'cancel' | 'click-overlay';
4
- export interface Ui3nDialogProps {
4
+ export interface Ui3nDialogProps<V> {
5
5
  id?: string;
6
6
  title?: string;
7
7
  icon?: string | Ui3nIconField;
@@ -13,9 +13,9 @@ export interface Ui3nDialogProps {
13
13
  contentCssStyle?: Record<string, string>;
14
14
  confirmButton?: boolean;
15
15
  cancelButton?: boolean;
16
- onClose?: (data?: unknown) => void;
17
- onConfirm?: (data: unknown) => void;
18
- onCancel?: (data: unknown) => void;
16
+ onClose?: (data?: V) => void;
17
+ onConfirm?: (data: V) => void;
18
+ onCancel?: (data: V) => void;
19
19
  confirmButtonText?: string;
20
20
  cancelButtonText?: string;
21
21
  confirmButtonColor?: string;
@@ -25,16 +25,16 @@ export interface Ui3nDialogProps {
25
25
  closeOnClickOverlay?: boolean;
26
26
  closeOnEsc?: boolean;
27
27
  }
28
- export interface Ui3nDialogComponentProps<T extends Component> {
28
+ export interface Ui3nDialogComponentProps<T extends Component, V> {
29
29
  component: T;
30
30
  componentProps?: ExtractComponentProps<T>;
31
- dialogProps?: Ui3nDialogProps;
31
+ dialogProps?: Ui3nDialogProps<V>;
32
32
  }
33
- export interface Ui3nDialogComponentEmits {
34
- (ev: 'open', value?: unknown): void;
35
- (ev: 'before-close', value?: unknown): void;
36
- (ev: 'close', value?: unknown): void;
37
- (ev: 'confirm', value?: unknown): void;
38
- (ev: 'cancel', value?: unknown): void;
39
- (ev: 'click-overlay', value?: unknown): void;
33
+ export interface Ui3nDialogComponentEmits<V> {
34
+ (ev: 'open', value?: V): void;
35
+ (ev: 'before-close', value?: V): void;
36
+ (ev: 'close', value?: V): void;
37
+ (ev: 'confirm', value?: V): void;
38
+ (ev: 'cancel', value?: V): void;
39
+ (ev: 'click-overlay', value?: V): void;
40
40
  }
@@ -1,18 +1,18 @@
1
1
  import { Component } from '../../../vue/dist/vue.esm-bundler.js';
2
2
  import { Ui3nDialogComponentProps, Ui3nDialogComponentEmits } from './types';
3
- declare const _default: <T extends Component>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
3
+ declare const _default: <T extends Component, V>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
4
4
  props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
5
- readonly onCancel?: ((value?: unknown) => any) | undefined;
6
- readonly onClose?: ((value?: unknown) => any) | undefined;
7
- readonly onOpen?: ((value?: unknown) => any) | undefined;
8
- readonly "onBefore-close"?: ((value?: unknown) => any) | undefined;
9
- readonly onConfirm?: ((value?: unknown) => any) | undefined;
10
- readonly "onClick-overlay"?: ((value?: unknown) => any) | undefined;
11
- } & import('../../../vue/dist/vue.esm-bundler.js').VNodeProps & import('../../../vue/dist/vue.esm-bundler.js').AllowedComponentProps & import('../../../vue/dist/vue.esm-bundler.js').ComponentCustomProps, never>, "onClose" | "onCancel" | "onOpen" | "onBefore-close" | "onConfirm" | "onClick-overlay"> & Ui3nDialogComponentProps<T> & Partial<{}>> & import('../../../vue/dist/vue.esm-bundler.js').PublicProps;
5
+ readonly onCancel?: ((value?: V | undefined) => any) | undefined;
6
+ readonly onClose?: ((value?: V | undefined) => any) | undefined;
7
+ readonly onOpen?: ((value?: V | undefined) => any) | undefined;
8
+ readonly "onBefore-close"?: ((value?: V | undefined) => any) | undefined;
9
+ readonly onConfirm?: ((value?: V | undefined) => any) | undefined;
10
+ readonly "onClick-overlay"?: ((value?: V | undefined) => any) | undefined;
11
+ } & import('../../../vue/dist/vue.esm-bundler.js').VNodeProps & import('../../../vue/dist/vue.esm-bundler.js').AllowedComponentProps & import('../../../vue/dist/vue.esm-bundler.js').ComponentCustomProps, never>, "onClose" | "onCancel" | "onOpen" | "onBefore-close" | "onConfirm" | "onClick-overlay"> & Ui3nDialogComponentProps<T, V> & Partial<{}>> & import('../../../vue/dist/vue.esm-bundler.js').PublicProps;
12
12
  expose(exposed: import('../../../vue/dist/vue.esm-bundler.js').ShallowUnwrapRef<{}>): void;
13
13
  attrs: any;
14
14
  slots: {};
15
- emit: Ui3nDialogComponentEmits;
15
+ emit: Ui3nDialogComponentEmits<V>;
16
16
  }>) => import('../../../vue/dist/vue.esm-bundler.js').VNode & {
17
17
  __ctx?: Awaited<typeof __VLS_setup>;
18
18
  };
package/dist/index.d.ts CHANGED
@@ -46,7 +46,7 @@ export * from './components';
46
46
  export * from './types';
47
47
  declare module '../vue/dist/vue.esm-bundler.js' {
48
48
  interface ComponentCustomProperties {
49
- $openDialog: <T extends Component>(params: Ui3nDialogComponentProps<T>) => DialogInstance | undefined;
49
+ $openDialog: <T extends Component, V>(params: Ui3nDialogComponentProps<T, V>) => DialogInstance | undefined;
50
50
  $closeDialog: (id: string) => void;
51
51
  $closeDialogs: () => void;
52
52
  $createNotice: (params: Ui3nNotificationProps) => void;
@@ -97,7 +97,7 @@ declare module '../vue/dist/vue.esm-bundler.js' {
97
97
  }
98
98
  declare module 'pinia' {
99
99
  interface PiniaCustomProperties {
100
- $openDialog: <T extends Component>(params: Ui3nDialogComponentProps<T>) => DialogInstance | undefined;
100
+ $openDialog: <T extends Component, V>(params: Ui3nDialogComponentProps<T, V>) => DialogInstance | undefined;
101
101
  $closeDialog: (id: string) => void;
102
102
  $closeDialogs: () => void;
103
103
  $createNotice: (params: Ui3nNotificationProps) => void;
@@ -4,7 +4,7 @@ import { DialogInstance } from './types';
4
4
  export declare const dialogs: Plugin;
5
5
  declare module '@vue/runtime-core' {
6
6
  interface ComponentCustomProperties {
7
- $openDialog: <T extends Component>(params: Ui3nDialogComponentProps<T>) => DialogInstance | undefined;
7
+ $openDialog: <T extends Component, V>(params: Ui3nDialogComponentProps<T, V>) => DialogInstance | undefined;
8
8
  $closeDialog: (id: string) => void;
9
9
  $closeDialogs: () => void;
10
10
  }
@@ -3,7 +3,7 @@ import { Ui3nDialogComponentProps } from '../../components/ui3n-dialog/types';
3
3
  import { DialogInstance } from './types';
4
4
  export declare function storeDialogs(context: any): {
5
5
  $dialogs: {
6
- open: <T extends Component>(params: Ui3nDialogComponentProps<T>) => DialogInstance | undefined;
6
+ open: <T extends Component, V>(params: Ui3nDialogComponentProps<T, V>) => DialogInstance | undefined;
7
7
  close: (id: string) => void;
8
8
  closeAll: () => void;
9
9
  };
@@ -7,7 +7,7 @@ export type DialogInstance = {
7
7
  destroy: () => void;
8
8
  };
9
9
  export interface DialogsPlugin {
10
- $openDialog: <T extends Component>(params: Ui3nDialogComponentProps<T>) => DialogInstance | undefined;
10
+ $openDialog: <T extends Component, V>(params: Ui3nDialogComponentProps<T, V>) => DialogInstance | undefined;
11
11
  $closeDialog: (id: string) => void;
12
12
  $closeDialogs: () => void;
13
13
  }
@@ -6,7 +6,7 @@ import { Ui3nDialogComponentProps } from './components';
6
6
  import { VUEBUS_KEY, CbFunction, VueEventBus, VueBusPlugin } from './plugins/vue-bus/types';
7
7
  declare module '../vue/dist/vue.esm-bundler.js' {
8
8
  interface ComponentCustomProperties {
9
- $openDialog: <T extends Component>(params: Ui3nDialogComponentProps<T>) => DialogInstance | undefined;
9
+ $openDialog: <T extends Component, V>(params: Ui3nDialogComponentProps<T, V>) => DialogInstance | undefined;
10
10
  $closeDialog: (id: string) => void;
11
11
  $closeDialogs: () => void;
12
12
  $createNotice: (params: Ui3nNotificationProps) => void;
@@ -26,7 +26,7 @@ declare module 'pinia' {
26
26
  tr: (key: string, placeholders?: Record<string, string>) => string;
27
27
  };
28
28
  $dialogs: {
29
- open: <T extends Component>(params: Ui3nDialogComponentProps<T>) => DialogInstance | undefined;
29
+ open: <T extends Component, V>(params: Ui3nDialogComponentProps<T, V>) => DialogInstance | undefined;
30
30
  close: (id: string) => void;
31
31
  closeAll: () => void;
32
32
  };
@@ -4492,6 +4492,7 @@ const pF = ["id"], ZF = /* @__PURE__ */ OI({
4492
4492
  let M = jo(IR, {
4493
4493
  component: s,
4494
4494
  componentProps: F,
4495
+ // @ts-ignore
4495
4496
  dialogProps: {
4496
4497
  ...a,
4497
4498
  id: `dialog-${G}`,
@@ -3350,6 +3350,8 @@ function YE(E, C) {
3350
3350
  N.width = Q.width, N.height = Q.height, N.getContext("2d").drawImage(w, 0, 0, Q.width, Q.height);
3351
3351
  const H = N.toDataURL();
3352
3352
  typeof E != "string" && URL.revokeObjectURL(w.src), i(H);
3353
+ }, w.onerror = function() {
3354
+ i("");
3353
3355
  }, w.src = typeof E == "string" ? E : URL.createObjectURL(E);
3354
3356
  } catch (w) {
3355
3357
  s(w);
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@v1nt1248/3nclient-lib",
3
3
  "license": "AGPL-3.0-or-later",
4
4
  "author": "v1nt1248",
5
- "version": "0.2.81",
5
+ "version": "0.2.83",
6
6
  "description": "Library for 3NWeb clients",
7
7
  "type": "module",
8
8
  "files": [
@@ -1,9 +1,9 @@
1
1
  import type { Component } from 'vue';
2
- import type { ExtractComponentProps, Ui3nIconField } from '@/types/index';
2
+ import type { ExtractComponentProps, Ui3nIconField } from '@/types';
3
3
 
4
4
  export type Ui3nDialogEvent = 'open' | 'before-close' | 'close' | 'confirm' | 'cancel' | 'click-overlay';
5
5
 
6
- export interface Ui3nDialogProps {
6
+ export interface Ui3nDialogProps<V> {
7
7
  id?: string;
8
8
  title?: string;
9
9
  icon?: string | Ui3nIconField;
@@ -15,9 +15,9 @@ export interface Ui3nDialogProps {
15
15
  contentCssStyle?: Record<string, string>;
16
16
  confirmButton?: boolean;
17
17
  cancelButton?: boolean;
18
- onClose?: (data?: unknown) => void;
19
- onConfirm?: (data: unknown) => void;
20
- onCancel?: (data: unknown) => void;
18
+ onClose?: (data?: V) => void;
19
+ onConfirm?: (data: V) => void;
20
+ onCancel?: (data: V) => void;
21
21
  confirmButtonText?: string;
22
22
  cancelButtonText?: string;
23
23
  confirmButtonColor?: string;
@@ -28,17 +28,17 @@ export interface Ui3nDialogProps {
28
28
  closeOnEsc?: boolean;
29
29
  }
30
30
 
31
- export interface Ui3nDialogComponentProps<T extends Component> {
31
+ export interface Ui3nDialogComponentProps<T extends Component, V> {
32
32
  component: T;
33
33
  componentProps?: ExtractComponentProps<T>;
34
- dialogProps?: Ui3nDialogProps;
34
+ dialogProps?: Ui3nDialogProps<V>;
35
35
  }
36
36
 
37
- export interface Ui3nDialogComponentEmits {
38
- (ev: 'open', value?: unknown): void;
39
- (ev: 'before-close', value?: unknown): void;
40
- (ev: 'close', value?: unknown): void;
41
- (ev: 'confirm', value?: unknown): void;
42
- (ev: 'cancel', value?: unknown): void;
43
- (ev: 'click-overlay', value?: unknown): void;
37
+ export interface Ui3nDialogComponentEmits<V> {
38
+ (ev: 'open', value?: V): void;
39
+ (ev: 'before-close', value?: V): void;
40
+ (ev: 'close', value?: V): void;
41
+ (ev: 'confirm', value?: V): void;
42
+ (ev: 'cancel', value?: V): void;
43
+ (ev: 'click-overlay', value?: V): void;
44
44
  }
@@ -1,4 +1,4 @@
1
- <script lang="ts" setup generic="T extends Component">
1
+ <script lang="ts" setup generic="T extends Component, V">
2
2
  import { type Component, computed, nextTick, onMounted, ref } from 'vue';
3
3
  import omit from 'lodash/omit';
4
4
  import Ui3nButton from '../ui3n-button/ui3n-button.vue';
@@ -7,8 +7,8 @@
7
7
  import { ExtractComponentProps } from '@/types';
8
8
  import { determineWindowWidth } from './util';
9
9
 
10
- const props = defineProps<Ui3nDialogComponentProps<T>>();
11
- const emits = defineEmits<Ui3nDialogComponentEmits>();
10
+ const props = defineProps<Ui3nDialogComponentProps<T, V>>();
11
+ const emits = defineEmits<Ui3nDialogComponentEmits<V>>();
12
12
 
13
13
  const currentDialogProps = computed(() => ({
14
14
  title: props.dialogProps?.title || '',
@@ -33,7 +33,7 @@
33
33
  }));
34
34
 
35
35
  const show = ref(true);
36
- const data = ref<unknown>(null);
36
+ const data = ref<V | null>(null);
37
37
  const isValid = ref(true);
38
38
  const dialogOverlayElement = ref<HTMLElement | null>(null);
39
39
  const dialogElement = ref<HTMLDivElement | null>(null);
@@ -76,7 +76,7 @@
76
76
  };
77
77
  });
78
78
 
79
- function selectData(value: unknown) {
79
+ function selectData(value: V) {
80
80
  data.value = value;
81
81
  if (
82
82
  !currentDialogProps.value.confirmButton &&