react-dialogger 1.1.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.
Files changed (51) hide show
  1. package/README.md +303 -0
  2. package/components/CircularProgress.d.ts +8 -0
  3. package/components/CircularProgress.js +50 -0
  4. package/components/DialogActionBase.d.ts +44 -0
  5. package/components/DialogActionBase.js +222 -0
  6. package/components/DialogBase.d.ts +132 -0
  7. package/components/DialogBase.js +880 -0
  8. package/components/Futures/DialogCloseAction.d.ts +3 -0
  9. package/components/Futures/DialogCloseAction.js +54 -0
  10. package/components/Futures/DialogFullscreenAction.d.ts +3 -0
  11. package/components/Futures/DialogFullscreenAction.js +60 -0
  12. package/components/Futures/DialogHeaderActionsWrapper.d.ts +3 -0
  13. package/components/Futures/DialogHeaderActionsWrapper.js +11 -0
  14. package/components/Futures/DialogProcessing.d.ts +3 -0
  15. package/components/Futures/DialogProcessing.js +41 -0
  16. package/components/Futures/index.d.ts +4 -0
  17. package/components/Futures/index.js +11 -0
  18. package/components/RippleButton.d.ts +15 -0
  19. package/components/RippleButton.js +81 -0
  20. package/components/icons/CloseIcon.d.ts +6 -0
  21. package/components/icons/CloseIcon.js +23 -0
  22. package/components/icons/FullscreenExitIcon.d.ts +6 -0
  23. package/components/icons/FullscreenExitIcon.js +23 -0
  24. package/components/icons/FullscreenIcon.d.ts +6 -0
  25. package/components/icons/FullscreenIcon.js +23 -0
  26. package/components/icons/ResizeIcon.d.ts +6 -0
  27. package/components/icons/ResizeIcon.js +14 -0
  28. package/hooks/useDialogOptions.d.ts +3 -0
  29. package/hooks/useDialogOptions.js +82 -0
  30. package/index.d.ts +8 -0
  31. package/index.js +25 -0
  32. package/models/Dialog.d.ts +44 -0
  33. package/models/Dialog.js +142 -0
  34. package/models/DialogAction.d.ts +54 -0
  35. package/models/DialogAction.js +277 -0
  36. package/models/Resizeable.d.ts +21 -0
  37. package/models/Resizeable.js +87 -0
  38. package/package.json +20 -0
  39. package/styles/circular-progress.css +42 -0
  40. package/styles/dialog.action.css +234 -0
  41. package/styles/dialog.css +336 -0
  42. package/types/DialogActionTypes.d.ts +66 -0
  43. package/types/DialogActionTypes.js +3 -0
  44. package/types/DialogTypes.d.ts +128 -0
  45. package/types/DialogTypes.js +2 -0
  46. package/types/SizePosTypes.d.ts +5 -0
  47. package/types/SizePosTypes.js +2 -0
  48. package/types/index.d.ts +4 -0
  49. package/types/index.js +2 -0
  50. package/types/types.d.ts +58 -0
  51. package/types/types.js +2 -0
package/README.md ADDED
@@ -0,0 +1,303 @@
1
+ # react-araci - Custom Dialog Component Documentation
2
+
3
+ This documentation explains the configuration of the Custom Dialog Component and how to customize it using initial options with the `useDialogOptions` function. `useDialogOptions` allows you to set the initial options to manage the dialog's appearance and behavior.
4
+
5
+ ## useDialogOptions Hook
6
+
7
+ `useDialogOptions` is a hook used to set the initial options of a Dialog component. This hook allows you to configure various properties of the dialog, such as the header, footer, size, style, etc.
8
+
9
+ ```Global Dialog Configuration
10
+ The useDialogOptions function is placed at the beginning of the application to define base settings for all dialogs used throughout the app. These settings act as a global configuration, ensuring consistency across all dialog components.
11
+
12
+ By defining these options globally, you ensure that all dialogs share common behaviors and styling. This approach simplifies managing the appearance and functionality of dialogs, as you only need to modify the base configuration in one place.
13
+
14
+ Custom Dialog Configurations
15
+
16
+ Although a global configuration is set by useDialogOptions, each dialog can still be individually customized as needed. You can override the default settings for specific dialogs to meet particular requirements. This flexibility allows you to customize the appearance, behavior, and actions of each dialog instance separately, while still maintaining the benefits of a unified base configuration.
17
+ ```
18
+ ## Example Usage
19
+
20
+ Below is an example of customizing a dialog using `useDialogOptions`:
21
+
22
+ #### useDialogOptions (Base)
23
+ ```js
24
+ useDialogOptions({
25
+ base: {
26
+ footer: {
27
+ style: { // Footer custom styles
28
+ backgroundColor: '#f1f1f1' // Background color for footer
29
+ }
30
+ },
31
+ header: {
32
+ style: { // Header custom styles
33
+ backgroundColor: '#333', // Background color for header
34
+ color: '#fff' // Text color for header
35
+ }
36
+ },
37
+ fullscreen: true, // Enables fullscreen mode for the dialog
38
+ notifyOnClosing: 'zoom', // Notification method on closing ('zoom' or 'snackbar')
39
+ headerControllerIcons: {
40
+ size: 20, // Icon size in header
41
+ color: 'red' // Icon color in header
42
+ },
43
+ style: { // General styles for the dialog
44
+ borderRadius: '8px', // Round corners for the dialog
45
+ boxShadow: '0px 5px 15px rgba(0, 0, 0, 0.2)' // Shadow around the dialog
46
+ },
47
+ resizeable: true, // Makes the dialog resizable by the user
48
+ draggable: true, // Allows the dialog to be dragged around the screen
49
+ closeable: true, // Allows the dialog to be closed
50
+ initialAnchor: {
51
+ vertical: 'center', // Vertical position of the dialog ('flex-start', 'center', 'flex-end')
52
+ horizontal: 'center' // Horizontal position of the dialog ('flex-start', 'center', 'flex-end')
53
+ },
54
+ size: {
55
+ width: 800, // Dialog width in pixels
56
+ height: 600 // Dialog height in pixels
57
+ },
58
+ actions: {
59
+ disabledOnDialogProcessing: true, // Disables actions when the dialog is processing
60
+ baseStyle: { // Custom styles for action buttons
61
+ padding: '5px 20px', // Padding inside action buttons
62
+ border: '2px solid #ccc', // Border for action buttons
63
+ boxShadow: '0 0 10px rgba(0, 0, 0, 0.15)' // Shadow for action buttons
64
+ }
65
+ }
66
+ }
67
+ });
68
+ ```
69
+ #### useDialogOptions (snackbar)
70
+ ```js
71
+ snackbar: {
72
+ busyMessage: 'On Process, please wait!', // Message displayed during the process
73
+ maxSnack: 4, // Maximum number of snackbars that can be displayed at once
74
+ autoHideDuration: 5000, // Time in milliseconds before the snackbar automatically disappears (5000ms = 5 seconds)
75
+ anchorOrigin: {
76
+ horizontal: "center", // Horizontal alignment of the snackbar (center, left, right)
77
+ vertical: "top" // Vertical alignment of the snackbar (top, bottom)
78
+ }
79
+ }
80
+ ```
81
+
82
+ #### useDialogOptions (Slot & Slot Props)
83
+ ```js
84
+ slot: {
85
+ header: HeaderSlot, // Slot for the header, can be a custom component or template
86
+ footer: FooterSlot // Slot for the footer, can be a custom component or template
87
+ },
88
+ slotProps: {
89
+ header: (props: IBaseHeaderProps) => {
90
+ return {
91
+ headerName: 'sampleProp' // Custom properties to be passed to the header slot component
92
+ }
93
+ },
94
+ footer: (props: IBaseFooterProps) => {
95
+ return {
96
+ footerName: 'Footer' // Custom properties to be passed to the footer slot component
97
+ }
98
+ }
99
+ }
100
+
101
+ // Header Slot Component
102
+ const HeaderSlot = (props: IHeaderProps) => {
103
+ const { headerName } = props;
104
+ return <div style={{display: 'flex', flexDirection: 'row', width: '100%', justifyContent: 'space-between'}}>
105
+ <div>
106
+ {headerName}
107
+ {/**values.name is dynamic by updated state than will trigger re-render*/}
108
+ <span style={{fontSize: '12px', fontWeight: 'bold', color: "cyan", fontStyle: "italic"}}>{props.values.name}</span>
109
+ </div>
110
+ {/**Use futures*/}
111
+ <DialogHeaderActionsWrapper>
112
+ <DialogFullscreenAction />
113
+ <DialogCloseAction />
114
+ </DialogHeaderActionsWrapper>
115
+ </div>;
116
+ }
117
+
118
+ // Footer Slot Component
119
+ const FooterSlot = (props: IFooterProps) => {
120
+
121
+ const {footerName, inProcess} = props;
122
+ return <div style={{display: 'flex', flexDirection: 'column', justifyContent: 'center', alignItems: 'center', columnGap: 2}} >
123
+ <span>Collected: Online {props.footerName}</span>
124
+ <DialogProcessing />
125
+ </div>;
126
+ }
127
+
128
+ // Explanation
129
+ // Footer & Header slot props are merged with the custom props inside slotProps.
130
+ // These custom props are then passed to the respective slot components, allowing dynamic and flexible content injection.
131
+ // The base dialog props (e.g., dialogValues, dialogOptions) are still accessible, and users can merge their own custom props as needed.
132
+
133
+ export interface BaseDialogSlotProps {
134
+ dialogValues: TValues; // The values that the dialog holds
135
+ dialogOptions: DialogOptionsType; // The options controlling the dialog's behavior
136
+ dialog?: IDialogRef; // A reference to the dialog component for external control
137
+ }
138
+
139
+
140
+ ```
141
+
142
+ #### useDialogOptions (Progress)
143
+ ```js
144
+ progress: {
145
+ size: 20,
146
+ color: 'red'
147
+ },
148
+ ```
149
+ #### useDialogOptions (Backdrop)
150
+ ```js
151
+ backdrop: {
152
+ backgroundColor: '#282828', // The background color of the backdrop (overlay) behind the dialog
153
+ opacity: 0.6, // The opacity of the backdrop (0 = fully transparent, 1 = fully opaque)
154
+ hideOnClick: false // Determines whether the backdrop will hide when clicked
155
+ }
156
+
157
+
158
+ ```
159
+
160
+
161
+ # Basic Usage of Custom Dialog Component
162
+
163
+ This example demonstrates the basic usage of the **Custom Dialog Component** with predefined actions, content, and properties. The dialog can be configured to include actions (buttons), initial values, and custom behaviors for interaction.
164
+
165
+ ## 1. Create Actions
166
+
167
+ Actions are defined for the dialog buttons (e.g., "Ok" and "Close").
168
+
169
+ - **Ok Action**: The "Ok" button has a `text` variant and `default` color.
170
+ - **Close Action**: The "Close" button has a `contained` variant and `primary` color.
171
+
172
+ ```javascript
173
+ const okAction = new DialogAction('okAction', {
174
+ label: 'Ok',
175
+ variant: 'text',
176
+ color: 'default'
177
+ });
178
+ okAction.onClick((button, dialog1) => {
179
+ // Actions when Ok button is clicked
180
+ });
181
+
182
+ const closeAction = new DialogAction('closeAction', {
183
+ label: 'Close',
184
+ variant: 'contained',
185
+ color: 'primary'
186
+ });
187
+ closeAction.onClick((button, dialog1) => {
188
+ dialog1.close(); // Closes the dialog when the Close button is clicked
189
+ });
190
+ ```
191
+
192
+ ## 2. Create Dialog
193
+ The Dialog component is initialized with optional configuration such as resize and drag capabilities.
194
+
195
+ ```javascript
196
+ const dialog = new Dialog(null, {
197
+ base: {
198
+ resizeable: true, // Dialog can be resized
199
+ draggable: true // Dialog can be dragged
200
+ }
201
+ });
202
+ ```
203
+ ## 3. Set Header and Body
204
+ You can define the dialog’s header and body content dynamically. The content is set through functions, allowing flexibility in displaying data.
205
+
206
+ ```javascript
207
+ dialog
208
+ .setHeader(dialog1 => 'Dialog header') // Set dialog header
209
+ .setBody(dialog1 => 'Dialog Body') // Set dialog body content
210
+ ```
211
+
212
+ ## 4. Add Actions
213
+ The dialog supports custom actions like the "Ok" and "Close" buttons. These actions are added to the dialog with the addActions method.
214
+
215
+ ```javascript
216
+ .addActions([
217
+ okAction, // Add Ok button action
218
+ closeAction // Add Close button action
219
+ ])
220
+ ```
221
+ ## 5. Set Initial Values
222
+ You can initialize values for the dialog, such as form fields or other settings. These values will be used throughout the dialog lifecycle.
223
+
224
+ ```javascript
225
+ .initialValues({
226
+ my_name: 'Eric', // Set initial value for name
227
+ age: 29 // Set initial value for age
228
+ })
229
+ ```
230
+ ## 6. Show the Dialog
231
+ Finally, the dialog is displayed using the show method. You can define additional logic that runs when the dialog is shown.
232
+
233
+ ```javascript
234
+ .show(dialog1 => {
235
+ // Actions when the dialog is shown
236
+ });
237
+ ```
238
+
239
+ ## Using Formik Inside Dialog Body
240
+
241
+ If **Formik** is used inside the dialog body, its `formikProps` can be linked to the dialog’s internal `formikProps`. This allows access to form properties from anywhere within the dialog.
242
+
243
+ ### Example: Binding Formik to Dialog
244
+
245
+ ```javascript
246
+ dialog.setBody(dialog1 => (
247
+ <MyComponent>
248
+ <Formik
249
+ initialValues={{
250
+ my_name: dialog1.values.my_name,
251
+ age: dialog1.values.age
252
+ }}
253
+ onSubmit={(values, formikHelpers) => {
254
+ // Form submission logic
255
+ // This event is triggered via okAction click 🚀
256
+ }}
257
+ >
258
+ {formikProps => {
259
+ dialog1.formikProps = formikProps; // Bind Formik props to dialog
260
+
261
+ return (
262
+ <form>
263
+ {/* Form content goes here */}
264
+ </form>
265
+ );
266
+ }}
267
+ </Formik>
268
+ </MyComponent>
269
+ ));
270
+
271
+ // Example: Triggering Form Submission from an Action
272
+
273
+ const okAction = new DialogAction('okAction', {
274
+ label: 'Ok',
275
+ variant: 'text',
276
+ color: 'default'
277
+ });
278
+
279
+ okAction.onClick((button, dialog1) => {
280
+ dialog1.formikProps.submitForm(); // 🚀 Trigger form submission via action button
281
+ });
282
+ ```
283
+
284
+ ## User Footer Slot
285
+
286
+
287
+
288
+ ## Summary of Basic Usage
289
+ ```php
290
+ - **Dialog Initialization**: Create a dialog instance with optional configuration for resize and drag behavior.
291
+ - **Actions**: Define action buttons (Ok, Close) with custom behavior (click handling).
292
+ - **Content**: Dynamically set the dialog header and body content.
293
+ - **⚠ Header Slot Consideration**: `setHeader` will be ignored if a **header slot** is used.
294
+ - **Initial Values**: Set initial values for the dialog’s content (e.g., form fields).
295
+ - **Show Dialog**: Display the dialog and handle any post-display logic.
296
+
297
+ This basic usage setup enables you to quickly configure and display a custom dialog with dynamic content and actions, making it highly customizable for various use cases in your application.
298
+ ```
299
+
300
+ > **⚠ Important Notice**
301
+ > This package is a continuation of the `react-araci` package.
302
+ > Due to an error, `react-araci` was removed, and it has been decided to continue under the new package name **`react-dialogger`**.
303
+
@@ -0,0 +1,8 @@
1
+ import * as React from "react";
2
+ import { IInProcess } from "../types/types";
3
+ declare const _default: ({ size, color, inProcess }: {
4
+ color?: string;
5
+ inProcess: IInProcess;
6
+ size: number;
7
+ }) => React.JSX.Element;
8
+ export default _default;
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ var desc = Object.getOwnPropertyDescriptor(m, k);
16
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
+ desc = { enumerable: true, get: function() { return m[k]; } };
18
+ }
19
+ Object.defineProperty(o, k2, desc);
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
26
+ }) : function(o, v) {
27
+ o["default"] = v;
28
+ });
29
+ var __importStar = (this && this.__importStar) || function (mod) {
30
+ if (mod && mod.__esModule) return mod;
31
+ var result = {};
32
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
33
+ __setModuleDefault(result, mod);
34
+ return result;
35
+ };
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ var React = __importStar(require("react"));
38
+ exports.default = (function (_a) {
39
+ var size = _a.size, color = _a.color, inProcess = _a.inProcess;
40
+ if (inProcess === null || inProcess === void 0 ? void 0 : inProcess.inProcess) {
41
+ return React.createElement("div", { style: { display: 'flex', flexDirection: 'row', columnGap: 10, alignItems: 'center' } },
42
+ React.createElement("span", { className: "circular-root", style: __assign({ display: 'flex', flex: 1, width: size, height: size }, color ? { color: color } : {}), role: "progressbar" },
43
+ React.createElement("svg", { className: "circular", viewBox: "22 22 44 44" },
44
+ React.createElement("circle", { className: "circular-circle", cx: "44", cy: "44", r: "20.2", fill: "none", strokeWidth: "3.6" }))),
45
+ inProcess.message
46
+ &&
47
+ React.createElement("span", { style: { fontStyle: 'normal', fontSize: 12 } }, inProcess.message));
48
+ }
49
+ return React.createElement(React.Fragment, null);
50
+ });
@@ -0,0 +1,44 @@
1
+ import { Component } from "react";
2
+ import * as React from "react";
3
+ import DialogBase from "./DialogBase";
4
+ import { ActionProps, ActionState, DialogActionType, TBVariant, TBColor, DialogActionOptionsType, TDialogStateListenerForActionCallbackType } from "../types/DialogActionTypes";
5
+ declare class DialogActionBase extends Component<ActionProps, ActionState> {
6
+ get dialogBaseComponent(): DialogBase;
7
+ protected _options: DialogActionOptionsType;
8
+ _stateListener: TDialogStateListenerForActionCallbackType;
9
+ protected _baseDialogAction?: DialogActionBase;
10
+ protected _name: string;
11
+ protected _onClick: ActionProps['onClick'];
12
+ private readonly _dialogBaseComponent;
13
+ protected _inProcess: ActionProps['inProcess'];
14
+ private readonly _buttonRef;
15
+ private readonly _rippleButtonRef;
16
+ private readonly _initialClickHandler;
17
+ constructor(props?: Readonly<ActionProps>);
18
+ get name(): string;
19
+ componentDidMount(): void;
20
+ get baseDialogAction(): DialogActionBase;
21
+ getInitialClickHandler: () => DialogActionType;
22
+ setOptions(options: DialogActionOptionsType): this;
23
+ get options(): DialogActionOptionsType;
24
+ setLabel: (label: string) => DialogActionBase;
25
+ getLabel(): string;
26
+ protected onClick(callback: DialogActionType): DialogActionBase;
27
+ setVariant: (variant: TBVariant) => DialogActionBase;
28
+ getVariant: () => TBVariant;
29
+ setColor: (color: TBColor) => DialogActionBase;
30
+ getColor: () => TBColor;
31
+ setDisabled: (disabled: boolean) => DialogActionBase;
32
+ /**
33
+ * @deprecated
34
+ * @see use isDisabled */
35
+ getDisabled: () => boolean;
36
+ isDisabled: () => boolean;
37
+ setInProcess: (inProcess: boolean) => DialogActionBase;
38
+ isInProcess: () => boolean;
39
+ remove: () => void;
40
+ click: () => void;
41
+ onClickHandler: () => DialogActionType;
42
+ render: () => React.JSX.Element;
43
+ }
44
+ export default DialogActionBase;
@@ -0,0 +1,222 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __assign = (this && this.__assign) || function () {
18
+ __assign = Object.assign || function(t) {
19
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
20
+ s = arguments[i];
21
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
22
+ t[p] = s[p];
23
+ }
24
+ return t;
25
+ };
26
+ return __assign.apply(this, arguments);
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 (mod) {
45
+ if (mod && mod.__esModule) return mod;
46
+ var result = {};
47
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
48
+ __setModuleDefault(result, mod);
49
+ return result;
50
+ };
51
+ var __importDefault = (this && this.__importDefault) || function (mod) {
52
+ return (mod && mod.__esModule) ? mod : { "default": mod };
53
+ };
54
+ Object.defineProperty(exports, "__esModule", { value: true });
55
+ var react_1 = require("react");
56
+ var React = __importStar(require("react"));
57
+ var RippleButton_1 = __importDefault(require("./RippleButton"));
58
+ var CircularProgress_1 = __importDefault(require("./CircularProgress"));
59
+ var DialogActionBase = /** @class */ (function (_super) {
60
+ __extends(DialogActionBase, _super);
61
+ function DialogActionBase(props) {
62
+ if (props === void 0) { props = {}; }
63
+ var _this = _super.call(this, props) || this; // This ensures that props is treated as readonly
64
+ _this._options = {
65
+ label: 'Button label',
66
+ variant: 'contained',
67
+ color: 'primary',
68
+ disabled: false,
69
+ prevDisabled: false
70
+ };
71
+ _this.getInitialClickHandler = function () {
72
+ return _this._initialClickHandler;
73
+ };
74
+ _this.setLabel = function (label) {
75
+ _this._options.label = label;
76
+ _this.forceUpdate();
77
+ return _this;
78
+ };
79
+ _this.setVariant = function (variant) {
80
+ _this._options.variant = variant;
81
+ _this.forceUpdate();
82
+ return _this;
83
+ };
84
+ _this.getVariant = function () {
85
+ return _this._options.variant;
86
+ };
87
+ _this.setColor = function (color) {
88
+ // this._color = color;
89
+ _this._options.color = color;
90
+ _this.forceUpdate();
91
+ return _this;
92
+ };
93
+ _this.getColor = function () {
94
+ return _this._options.color;
95
+ };
96
+ _this.setDisabled = function (disabled) {
97
+ _this._options.disabled = disabled;
98
+ _this.forceUpdate();
99
+ return _this;
100
+ };
101
+ /**
102
+ * @deprecated
103
+ * @see use isDisabled */
104
+ _this.getDisabled = function () {
105
+ return _this._options.disabled;
106
+ };
107
+ _this.isDisabled = function () {
108
+ return _this._options.disabled;
109
+ };
110
+ _this.setInProcess = function (inProcess) {
111
+ _this._inProcess = inProcess;
112
+ _this._options.disabled = inProcess;
113
+ _this.forceUpdate();
114
+ return _this;
115
+ };
116
+ _this.isInProcess = function () {
117
+ var _a;
118
+ if (((_a = _this.props.dialogBaseComponent) === null || _a === void 0 ? void 0 : _a.parent.accessFrom) === "internal") {
119
+ return _this._inProcess;
120
+ }
121
+ return _this._inProcess;
122
+ };
123
+ _this.remove = function () {
124
+ _this._buttonRef.current.remove();
125
+ };
126
+ _this.click = function () {
127
+ // @ts-ignore
128
+ _this._rippleButtonRef.current.rippleEffect(_this._buttonRef, 19, 8);
129
+ _this._buttonRef.current.click();
130
+ };
131
+ _this.onClickHandler = function () {
132
+ return _this._onClick;
133
+ };
134
+ _this.render = function () {
135
+ console.log('this._options.style.render', _this._options);
136
+ return React.createElement(RippleButton_1.default, { ref: _this._buttonRef, innerRef: _this._rippleButtonRef, variant: _this._options.variant, color: _this._options.color, disabled: _this._options.disabled, onClick: function (e) {
137
+ if (_this._options.disabled || _this.isInProcess())
138
+ return;
139
+ // @ts-ignore
140
+ _this._onClick(_this, _this._dialogBaseComponent);
141
+ }, style: _this._options.style, baseStyle: _this.props.baseStyle, fontFamily: _this.props.fontFamily }, function (buttonRef) {
142
+ if (buttonRef) {
143
+ if (!_this.isInProcess()) {
144
+ buttonRef.style.minWidth = buttonRef.getBoundingClientRect().width + 'px';
145
+ }
146
+ }
147
+ return React.createElement(React.Fragment, null,
148
+ React.createElement(CircularProgress_1.default, { size: 15, inProcess: { inProcess: _this.isInProcess() } }),
149
+ !_this.isInProcess() &&
150
+ _this._options.label);
151
+ });
152
+ };
153
+ _this._options = props.options;
154
+ // this._label = props.label;
155
+ _this._onClick = props.onClick;
156
+ // Register Click Handler by init
157
+ _this._initialClickHandler = props.onClick;
158
+ _this._dialogBaseComponent = props.dialogBaseComponent;
159
+ _this._inProcess = props.inProcess;
160
+ _this.state = {
161
+ coords: { x: -1, y: -1 },
162
+ isRippling: false
163
+ };
164
+ _this._buttonRef = React.createRef();
165
+ _this._rippleButtonRef = React.createRef();
166
+ _this._initialClickHandler = null;
167
+ _this._name = props.name;
168
+ _this._stateListener = props.stateListener;
169
+ return _this;
170
+ }
171
+ Object.defineProperty(DialogActionBase.prototype, "dialogBaseComponent", {
172
+ get: function () {
173
+ return this._dialogBaseComponent;
174
+ },
175
+ enumerable: false,
176
+ configurable: true
177
+ });
178
+ Object.defineProperty(DialogActionBase.prototype, "name", {
179
+ get: function () {
180
+ return this._name;
181
+ },
182
+ enumerable: false,
183
+ configurable: true
184
+ });
185
+ DialogActionBase.prototype.componentDidMount = function () {
186
+ if (undefined !== this.props.onLoad && typeof this.props.onLoad === "function") {
187
+ this.props.onLoad(this);
188
+ }
189
+ };
190
+ Object.defineProperty(DialogActionBase.prototype, "baseDialogAction", {
191
+ get: function () {
192
+ return this._baseDialogAction;
193
+ // return this;
194
+ },
195
+ enumerable: false,
196
+ configurable: true
197
+ });
198
+ DialogActionBase.prototype.setOptions = function (options) {
199
+ console.log(23);
200
+ console.log('setOptions-XAA', JSON.stringify(options));
201
+ this._options = __assign(__assign({}, this._options), options);
202
+ this.forceUpdate();
203
+ return this;
204
+ };
205
+ Object.defineProperty(DialogActionBase.prototype, "options", {
206
+ get: function () {
207
+ return this._options;
208
+ },
209
+ enumerable: false,
210
+ configurable: true
211
+ });
212
+ DialogActionBase.prototype.getLabel = function () {
213
+ return this._options.label;
214
+ };
215
+ DialogActionBase.prototype.onClick = function (callback) {
216
+ // @ts-ignore
217
+ this._onClick = callback; // callback( this, this._dialogBaseComponent );
218
+ return this;
219
+ };
220
+ return DialogActionBase;
221
+ }(react_1.Component));
222
+ exports.default = DialogActionBase;