wini-web-components 2.3.2 → 2.3.3

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,23 +1,12 @@
1
1
  import React from 'react';
2
2
  import { ComponentStatus } from '../../index';
3
- import { WithTranslation } from 'react-i18next';
4
3
  export declare enum DialogAlignment {
5
4
  start = "start",
6
5
  center = "center",
7
6
  end = "end"
8
7
  }
9
- interface DialogState {
10
- readonly open?: boolean;
11
- title: string;
12
- status: ComponentStatus;
13
- content: string;
14
- onSubmit: Function;
15
- submitTitle?: string;
16
- cancelTitle?: string;
17
- alignment?: DialogAlignment;
18
- }
19
- export declare const showDialog: ({ ref, title, status, content, onSubmit, submitTitle, cancelTitle, alignment }: {
20
- ref: React.MutableRefObject<TDialog>;
8
+ export declare const Dialog: () => React.JSX.Element;
9
+ export declare const showDialog: (props: {
21
10
  title?: string;
22
11
  status?: ComponentStatus;
23
12
  content?: string;
@@ -26,11 +15,3 @@ export declare const showDialog: ({ ref, title, status, content, onSubmit, submi
26
15
  cancelTitle?: string;
27
16
  alignment?: DialogAlignment;
28
17
  }) => void;
29
- declare class TDialog extends React.Component<WithTranslation, DialogState> {
30
- constructor(props: WithTranslation);
31
- showDialogNoti(data: DialogState): void;
32
- closeDialog(): void;
33
- render(): React.JSX.Element;
34
- }
35
- export declare const Dialog: React.ComponentType<Omit<import("react-i18next/helpers").$Subtract<WithTranslation<undefined, undefined>, import("react-i18next").WithTranslationProps>, keyof WithTranslation<Ns, undefined>> & import("react-i18next").WithTranslationProps>;
36
- export {};
@@ -25,12 +25,45 @@ var __assign = (this && this.__assign) || function () {
25
25
  };
26
26
  return __assign.apply(this, arguments);
27
27
  };
28
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
29
+ if (k2 === undefined) k2 = k;
30
+ var desc = Object.getOwnPropertyDescriptor(m, k);
31
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
32
+ desc = { enumerable: true, get: function() { return m[k]; } };
33
+ }
34
+ Object.defineProperty(o, k2, desc);
35
+ }) : (function(o, m, k, k2) {
36
+ if (k2 === undefined) k2 = k;
37
+ o[k2] = m[k];
38
+ }));
39
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
40
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
41
+ }) : function(o, v) {
42
+ o["default"] = v;
43
+ });
44
+ var __importStar = (this && this.__importStar) || (function () {
45
+ var ownKeys = function(o) {
46
+ ownKeys = Object.getOwnPropertyNames || function (o) {
47
+ var ar = [];
48
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
49
+ return ar;
50
+ };
51
+ return ownKeys(o);
52
+ };
53
+ return function (mod) {
54
+ if (mod && mod.__esModule) return mod;
55
+ var result = {};
56
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
57
+ __setModuleDefault(result, mod);
58
+ return result;
59
+ };
60
+ })();
28
61
  var __importDefault = (this && this.__importDefault) || function (mod) {
29
62
  return (mod && mod.__esModule) ? mod : { "default": mod };
30
63
  };
31
64
  Object.defineProperty(exports, "__esModule", { value: true });
32
- exports.Dialog = exports.showDialog = exports.DialogAlignment = void 0;
33
- var react_1 = __importDefault(require("react"));
65
+ exports.showDialog = exports.Dialog = exports.DialogAlignment = void 0;
66
+ var react_1 = __importStar(require("react"));
34
67
  var react_dom_1 = __importDefault(require("react-dom"));
35
68
  var dialog_module_css_1 = __importDefault(require("./dialog.module.css"));
36
69
  var index_1 = require("../../index");
@@ -41,19 +74,6 @@ var DialogAlignment;
41
74
  DialogAlignment["center"] = "center";
42
75
  DialogAlignment["end"] = "end";
43
76
  })(DialogAlignment || (exports.DialogAlignment = DialogAlignment = {}));
44
- var showDialog = function (_a) {
45
- var ref = _a.ref, title = _a.title, status = _a.status, content = _a.content, onSubmit = _a.onSubmit, submitTitle = _a.submitTitle, cancelTitle = _a.cancelTitle, alignment = _a.alignment;
46
- ref.current.showDialogNoti({
47
- title: title !== null && title !== void 0 ? title : '',
48
- status: status !== null && status !== void 0 ? status : index_1.ComponentStatus.INFOR,
49
- content: content !== null && content !== void 0 ? content : '',
50
- onSubmit: onSubmit !== null && onSubmit !== void 0 ? onSubmit : (function () { }),
51
- submitTitle: submitTitle,
52
- cancelTitle: cancelTitle,
53
- alignment: alignment
54
- });
55
- };
56
- exports.showDialog = showDialog;
57
77
  var TDialog = /** @class */ (function (_super) {
58
78
  __extends(TDialog, _super);
59
79
  function TDialog(props) {
@@ -96,4 +116,23 @@ var TDialog = /** @class */ (function (_super) {
96
116
  };
97
117
  return TDialog;
98
118
  }(react_1.default.Component));
99
- exports.Dialog = (0, react_i18next_1.withTranslation)()(TDialog);
119
+ var dialogRef = (0, react_1.createRef)();
120
+ var Dialog = function () {
121
+ var _a = (0, react_i18next_1.useTranslation)(), t = _a.t, i18n = _a.i18n;
122
+ return react_1.default.createElement(TDialog, { ref: dialogRef, t: t, i18n: i18n, tReady: true });
123
+ };
124
+ exports.Dialog = Dialog;
125
+ var showDialog = function (props) {
126
+ var _a, _b, _c, _d;
127
+ if (dialogRef.current)
128
+ dialogRef.current.showDialogNoti({
129
+ title: (_a = props.title) !== null && _a !== void 0 ? _a : '',
130
+ status: (_b = props.status) !== null && _b !== void 0 ? _b : index_1.ComponentStatus.INFOR,
131
+ content: (_c = props.content) !== null && _c !== void 0 ? _c : '',
132
+ onSubmit: (_d = props.onSubmit) !== null && _d !== void 0 ? _d : (function () { }),
133
+ submitTitle: props.submitTitle,
134
+ cancelTitle: props.cancelTitle,
135
+ alignment: props.alignment
136
+ });
137
+ };
138
+ exports.showDialog = showDialog;