@pdg/react-form 1.1.8 → 1.1.9

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,5 +1,9 @@
1
1
  import React from 'react';
2
2
  import { PFormTextEditorProps as Props, PFormTextEditorCommands } from './PFormTextEditor.types';
3
3
  import './PFormTextEditor.scss';
4
+ type PFormTextEditorType = typeof PFormTextEditor & {
5
+ apiKey: string;
6
+ };
4
7
  declare const PFormTextEditor: React.ForwardRefExoticComponent<Props & React.RefAttributes<PFormTextEditorCommands>>;
5
- export default PFormTextEditor;
8
+ declare const _default: PFormTextEditorType;
9
+ export default _default;
@@ -7,4 +7,6 @@ export interface PFormTextEditorProps extends PCommonSxProps, Omit<PFormValueIte
7
7
  menubar?: boolean;
8
8
  height?: number;
9
9
  onImageUpload?: (blob: Blob, success: (url: string) => void, failure: (err: string) => void, progress?: (percent: number) => void) => void;
10
+ onOpenWindow?: () => void;
11
+ onCloseWindow?: () => void;
10
12
  }
package/dist/index.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- import React,{createContext,useContext,useRef,useCallback,useMemo,useEffect,useState,useId,useLayoutEffect}from'react';import classNames from'classnames';import {Box,styled,useTheme,InputLabel,Grid,Collapse,FormHelperText,InputAdornment,IconButton,TextField,Chip,Autocomplete,Icon,CircularProgress,MenuItem,Checkbox,FormControl,Input,OutlinedInput,FilledInput,FormControlLabel,Typography,RadioGroup,Radio,ToggleButton,ToggleButtonGroup,Rating,Skeleton,darken,Button,Tooltip,tooltipClasses,ClickAwayListener,Dialog,DialogTitle,DialogContent,DialogActions,Switch,Paper,Menu}from'@mui/material';import {empty,ifUndefined,notEmpty,equal}from'@pdg/compare';import dayjs from'dayjs';import {useAutoUpdateLayoutRef,useForwardLayoutRef,useAutoUpdateState,useAutoUpdateRefState,useForceUpdate,useAutoUpdateRef,useFirstSkipEffect}from'@pdg/react-hook';import {PButton,PIcon,PIconText}from'@pdg/react-component';import {useResizeDetector}from'react-resize-detector';import {formatTelNo,formatBusinessNo,formatPersonalNo}from'@pdg/formatting';import {NumericFormat}from'react-number-format';import {CheckBoxOutlineBlank,CheckBox,RadioButtonChecked,RadioButtonUnchecked}from'@mui/icons-material';import {Editor}from'@tinymce/tinymce-react';import {PickersDay,StaticDatePicker,LocalizationProvider,DesktopDatePicker,StaticDateTimePicker,DesktopDateTimePicker}from'@mui/x-date-pickers';import SimpleBar from'simplebar-react';function insertStyle(css) {
1
+ import React,{createContext,useContext,useRef,useCallback,useMemo,useEffect,useState,useId,useLayoutEffect}from'react';import classNames from'classnames';import {Box,styled,useTheme,InputLabel,Grid,Collapse,FormHelperText,InputAdornment,IconButton,TextField,Chip,Autocomplete,Icon,CircularProgress,MenuItem,Checkbox,FormControl,Input,OutlinedInput,FilledInput,FormControlLabel,Typography,RadioGroup,Radio,ToggleButton,ToggleButtonGroup,Rating,Skeleton,darken,Button,Tooltip,tooltipClasses,ClickAwayListener,Dialog,DialogTitle,DialogContent,DialogActions,Switch,Paper,Menu}from'@mui/material';import {empty,ifUndefined,notEmpty,equal,ifEmpty}from'@pdg/compare';import dayjs from'dayjs';import {useAutoUpdateLayoutRef,useForwardLayoutRef,useAutoUpdateState,useAutoUpdateRefState,useForceUpdate,useAutoUpdateRef,useFirstSkipEffect}from'@pdg/react-hook';import {PButton,PIcon,PIconText}from'@pdg/react-component';import {useResizeDetector}from'react-resize-detector';import {formatTelNo,formatBusinessNo,formatPersonalNo}from'@pdg/formatting';import {NumericFormat}from'react-number-format';import {CheckBoxOutlineBlank,CheckBox,RadioButtonChecked,RadioButtonUnchecked}from'@mui/icons-material';import {Editor}from'@tinymce/tinymce-react';import {PickersDay,StaticDatePicker,LocalizationProvider,DesktopDatePicker,StaticDateTimePicker,DesktopDateTimePicker}from'@mui/x-date-pickers';import SimpleBar from'simplebar-react';function insertStyle(css) {
2
2
  if (!css || typeof window === 'undefined')
3
3
  return;
4
4
  const style = document.createElement('style');
@@ -3677,7 +3677,7 @@ PFormRating.displayName = 'PFormRating';var getFinalValue$8 = function (value) {
3677
3677
  * ******************************************************************************************************************/
3678
3678
  var initVariant = _a.variant, initSize = _a.size, initColor = _a.color, initFocused = _a.focused,
3679
3679
  // ---------------------------------------------------------------------------------------------------------------
3680
- apiKey = _a.apiKey, toolbar = _a.toolbar,
3680
+ apiKey = _a.apiKey, toolbar = _a.toolbar, onOpenWindow = _a.onOpenWindow, onCloseWindow = _a.onCloseWindow,
3681
3681
  //----------------------------------------------------------------------------------------------------------------
3682
3682
  _b = _a.menubar,
3683
3683
  //----------------------------------------------------------------------------------------------------------------
@@ -3833,7 +3833,7 @@ PFormRating.displayName = 'PFormRating';var getFinalValue$8 = function (value) {
3833
3833
  * ******************************************************************************************************************/
3834
3834
  return (React.createElement(PFormItemBase, { variant: variant, size: size, color: color, focused: focused, className: classNames(className, 'PFormValueItem', 'PFormTextEditor', !initialized && 'initializing'), labelIcon: labelIcon, label: label, error: error, required: required, fullWidth: true, helperText: error ? errorHelperText : helperText, helperTextProps: { style: { marginLeft: 5 } }, style: { width: '100%' }, hidden: hidden, controlHeight: height, control: React.createElement(React.Fragment, null,
3835
3835
  !initialized ? React.createElement(Skeleton, { variant: 'rectangular', width: '100%', height: height }) : null,
3836
- React.createElement(Editor, { apiKey: apiKey, value: value, disabled: readOnly || disabled, init: {
3836
+ React.createElement(Editor, { apiKey: ifEmpty(apiKey, PFormTextEditor.apiKey), value: value, disabled: readOnly || disabled, init: {
3837
3837
  height: height,
3838
3838
  menubar: menubar,
3839
3839
  language: 'ko_KR',
@@ -3864,10 +3864,17 @@ PFormRating.displayName = 'PFormRating';var getFinalValue$8 = function (value) {
3864
3864
  images_upload_handler: handleImageUpload,
3865
3865
  }, onInit: function (evt, editor) {
3866
3866
  editorRef.current = editor;
3867
+ editor.on('OpenWindow', function () {
3868
+ onOpenWindow === null || onOpenWindow === void 0 ? void 0 : onOpenWindow();
3869
+ });
3870
+ editor.on('CloseWindow', function () {
3871
+ onCloseWindow === null || onCloseWindow === void 0 ? void 0 : onCloseWindow();
3872
+ });
3867
3873
  setTimeout(function () { return setInitialized(true); }, 10);
3868
3874
  }, onEditorChange: handleEditorChange, onKeyDown: handleKeyDown, onFocus: function () { return setFocused(initFocused || true); }, onBlur: function () { return setFocused(initFocused || false); } })) }));
3869
3875
  });
3870
- PFormTextEditor.displayName = 'PFormTextEditor';var PFormAutocomplete = ToForwardRefExoticComponent(AutoTypeForwardRef(function (_a, ref) {
3876
+ PFormTextEditor.displayName = 'PFormTextEditor';
3877
+ PFormTextEditor.apiKey = '';var PFormAutocomplete = ToForwardRefExoticComponent(AutoTypeForwardRef(function (_a, ref) {
3871
3878
  /********************************************************************************************************************
3872
3879
  * type
3873
3880
  * ******************************************************************************************************************/
package/dist/index.js CHANGED
@@ -3677,7 +3677,7 @@ PFormRating.displayName = 'PFormRating';var getFinalValue$8 = function (value) {
3677
3677
  * ******************************************************************************************************************/
3678
3678
  var initVariant = _a.variant, initSize = _a.size, initColor = _a.color, initFocused = _a.focused,
3679
3679
  // ---------------------------------------------------------------------------------------------------------------
3680
- apiKey = _a.apiKey, toolbar = _a.toolbar,
3680
+ apiKey = _a.apiKey, toolbar = _a.toolbar, onOpenWindow = _a.onOpenWindow, onCloseWindow = _a.onCloseWindow,
3681
3681
  //----------------------------------------------------------------------------------------------------------------
3682
3682
  _b = _a.menubar,
3683
3683
  //----------------------------------------------------------------------------------------------------------------
@@ -3833,7 +3833,7 @@ PFormRating.displayName = 'PFormRating';var getFinalValue$8 = function (value) {
3833
3833
  * ******************************************************************************************************************/
3834
3834
  return (React.createElement(PFormItemBase, { variant: variant, size: size, color: color, focused: focused, className: classNames(className, 'PFormValueItem', 'PFormTextEditor', !initialized && 'initializing'), labelIcon: labelIcon, label: label, error: error, required: required, fullWidth: true, helperText: error ? errorHelperText : helperText, helperTextProps: { style: { marginLeft: 5 } }, style: { width: '100%' }, hidden: hidden, controlHeight: height, control: React.createElement(React.Fragment, null,
3835
3835
  !initialized ? React.createElement(material.Skeleton, { variant: 'rectangular', width: '100%', height: height }) : null,
3836
- React.createElement(tinymceReact.Editor, { apiKey: apiKey, value: value, disabled: readOnly || disabled, init: {
3836
+ React.createElement(tinymceReact.Editor, { apiKey: compare.ifEmpty(apiKey, PFormTextEditor.apiKey), value: value, disabled: readOnly || disabled, init: {
3837
3837
  height: height,
3838
3838
  menubar: menubar,
3839
3839
  language: 'ko_KR',
@@ -3864,10 +3864,17 @@ PFormRating.displayName = 'PFormRating';var getFinalValue$8 = function (value) {
3864
3864
  images_upload_handler: handleImageUpload,
3865
3865
  }, onInit: function (evt, editor) {
3866
3866
  editorRef.current = editor;
3867
+ editor.on('OpenWindow', function () {
3868
+ onOpenWindow === null || onOpenWindow === void 0 ? void 0 : onOpenWindow();
3869
+ });
3870
+ editor.on('CloseWindow', function () {
3871
+ onCloseWindow === null || onCloseWindow === void 0 ? void 0 : onCloseWindow();
3872
+ });
3867
3873
  setTimeout(function () { return setInitialized(true); }, 10);
3868
3874
  }, onEditorChange: handleEditorChange, onKeyDown: handleKeyDown, onFocus: function () { return setFocused(initFocused || true); }, onBlur: function () { return setFocused(initFocused || false); } })) }));
3869
3875
  });
3870
- PFormTextEditor.displayName = 'PFormTextEditor';var PFormAutocomplete = ToForwardRefExoticComponent(AutoTypeForwardRef(function (_a, ref) {
3876
+ PFormTextEditor.displayName = 'PFormTextEditor';
3877
+ PFormTextEditor.apiKey = '';var PFormAutocomplete = ToForwardRefExoticComponent(AutoTypeForwardRef(function (_a, ref) {
3871
3878
  /********************************************************************************************************************
3872
3879
  * type
3873
3880
  * ******************************************************************************************************************/
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pdg/react-form",
3
3
  "title": "React Form",
4
- "version": "1.1.8",
4
+ "version": "1.1.9",
5
5
  "description": "React Form",
6
6
  "type": "module",
7
7
  "types": "dist/index.d.ts",