@ticatec/uniface-element 0.1.18 → 0.1.20

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.
@@ -0,0 +1,40 @@
1
+ <script lang="ts">
2
+
3
+ import Dialog from "./Dialog.svelte";
4
+ import type {ButtonAction, ButtonActions} from "../action-bar";
5
+ import type {DialogCloseConfirm, MouseClickHandler} from "..";
6
+ import i18n from "@ticatec/i18n";
7
+
8
+ export let title: string;
9
+ export let closeConfirm: DialogCloseConfirm | null = null;
10
+ export let content$style: string = '';
11
+ export let closeHandler: () => void;
12
+ export let enableConfirm: boolean = true;
13
+ export let confirmHandler: (()=>Promise<void>) | null = null;
14
+ export let confirmText: string | null = null;
15
+
16
+ let confirmAction: ButtonAction = {
17
+ label: confirmText??i18n.getText('uniface.btnConfirm', 'OK'),
18
+ type: "primary",
19
+ disabled: enableConfirm,
20
+ handler: async ()=> {
21
+ let result = await confirmHandler?.();
22
+ if (result && result==true) { //返回true自动关闭
23
+ closeHandler?.();
24
+ }
25
+
26
+ }
27
+ }
28
+
29
+ let actions: ButtonActions = [confirmAction];
30
+
31
+ $: {
32
+ confirmAction.disabled = confirmHandler==null && !enableConfirm;
33
+ actions = [...actions];
34
+ }
35
+
36
+ </script>
37
+
38
+ <Dialog {title} {content$style} {closeHandler} {actions} {closeConfirm}>
39
+ <slot></slot>
40
+ </Dialog>
@@ -0,0 +1,36 @@
1
+ import type { DialogCloseConfirm } from "..";
2
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
3
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
4
+ $$bindings?: Bindings;
5
+ } & Exports;
6
+ (internal: unknown, props: Props & {
7
+ $$events?: Events;
8
+ $$slots?: Slots;
9
+ }): Exports & {
10
+ $set?: any;
11
+ $on?: any;
12
+ };
13
+ z_$$bindings?: Bindings;
14
+ }
15
+ type $$__sveltets_2_PropsWithChildren<Props, Slots> = Props & (Slots extends {
16
+ default: any;
17
+ } ? Props extends Record<string, never> ? any : {
18
+ children?: any;
19
+ } : {});
20
+ declare const CommonDialog: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsWithChildren<{
21
+ title: string;
22
+ closeConfirm?: DialogCloseConfirm | null;
23
+ content$style?: string;
24
+ closeHandler: () => void;
25
+ enableConfirm?: boolean;
26
+ confirmHandler?: (() => Promise<void>) | null;
27
+ confirmText?: string | null;
28
+ }, {
29
+ default: {};
30
+ }>, {
31
+ [evt: string]: CustomEvent<any>;
32
+ }, {
33
+ default: {};
34
+ }, {}, string>;
35
+ type CommonDialog = InstanceType<typeof CommonDialog>;
36
+ export default CommonDialog;
@@ -2,6 +2,7 @@ import Dialog from "./Dialog.svelte";
2
2
  import DialogBoard from "./DialogBoard.svelte";
3
3
  import type IDialog from "./IDialog";
4
4
  import type { DialogCloseConfirm } from "./DialogCloseConfirm";
5
+ import CommonDialog from "./CommonDialog.svelte";
5
6
  declare global {
6
7
  interface Window {
7
8
  Dialog: IDialog;
@@ -11,3 +12,4 @@ export { type IDialog };
11
12
  export { type DialogCloseConfirm };
12
13
  export { DialogBoard };
13
14
  export default Dialog;
15
+ export { CommonDialog };
@@ -1,6 +1,8 @@
1
1
  import Dialog from "./Dialog.svelte";
2
2
  import DialogBoard from "./DialogBoard.svelte";
3
+ import CommonDialog from "./CommonDialog.svelte";
3
4
  export {};
4
5
  export {};
5
6
  export { DialogBoard };
6
7
  export default Dialog;
8
+ export { CommonDialog };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ticatec/uniface-element",
3
- "version": "0.1.18",
3
+ "version": "0.1.20",
4
4
  "description": "uniface web elements",
5
5
  "scripts": {
6
6
  "dev": "vite dev",
@@ -132,6 +132,10 @@
132
132
  "types": "./dist/dialog/index.d.ts",
133
133
  "import": "./dist/dialog/index.js"
134
134
  },
135
+ "./CommonDialog": {
136
+ "types": "./dist/dialog/CommonDialog.svelte.d.ts",
137
+ "import": "./dist/dialog/CommonDialog.svelte"
138
+ },
135
139
  "./DialogBoard": {
136
140
  "types": "./dist/dialog/DialogBoard.svelte.d.ts",
137
141
  "import": "./dist/dialog/DialogBoard.svelte"