d2coreui 21.0.18 → 21.0.19

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.
@@ -74,14 +74,14 @@ export default class NumberCellEditor extends React.Component {
74
74
  render() {
75
75
  return (React.createElement(InputNumber, { ref: (component) => {
76
76
  this.inputComponent = component;
77
- }, size: "small", autoFocus: true, decimalSeparator: this.props.decimalSeparator, precision: this.props.precision, min: this.props.min, max: this.props.max, placeholder: this.state.value === null ? "NULL" : "", value: this.state.value !== undefined && this.state.value !== null ? this.state.value : undefined, onChange: (value) => {
77
+ }, size: "small", autoFocus: true, decimalSeparator: this.props.decimalSeparator, precision: this.props.precision, min: this.props.min, max: this.props.max, placeholder: this.state.value === null ? "NULL" : "", value: this.state.value !== null ? this.state.value : undefined, onChange: value => {
78
78
  if (KeyboardUtils.isKeyPressed(Key.Alt)) {
79
79
  return;
80
80
  }
81
81
  if (typeof value === "number") {
82
82
  this.setState({ value: value });
83
83
  }
84
- else if (value === undefined || value === "") {
84
+ else if (value === null || value === "") {
85
85
  this.setState({ value: null });
86
86
  }
87
87
  }, onKeyDown: (e) => {
@@ -1 +1 @@
1
- {"version":3,"file":"numberCellEditor.js","sourceRoot":"","sources":["../../../../../components/grid/cell/numberCellEditor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,WAAW,EAAC,MAAM,MAAM,CAAC;AAEjC,OAAO,EAAC,GAAG,EAAC,MAAM,aAAa,CAAC;AAChC,OAAO,aAAa,MAAM,4CAA4C,CAAC;AACvE,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAElD,MAAM,aAAa,GAAG,CAAC,CAAC;AACxB,MAAM,UAAU,GAAG,EAAE,CAAC;AACtB,MAAM,MAAM,GAAG,GAAG,CAAC;AAenB,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,KAAK,CAAC,SAA6D;IAI7G,YAAY,KAA2C;Q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AC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EACpD,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,KAAK,SAAS,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,EACjG,QAAQ,EAAE,CAAC,KAAkC,EAAE,EAAE;gBAC7C,IAAI,aAAa,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;oBAErC,OAAO;iBACV;gBACD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;oBAC3B,IAAI,CAAC,QAAQ,CAAC,EAAC,KAAK,EAAE,KAAK,EAAC,CAAC,CAAC;iBACjC;qBAAM,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,EAAE,EAAE;oBAC5C,IAAI,CAAC,QAAQ,CAAC,EAAC,KAAK,EAAE,IAAI,EAAC,CAAC,CAAC;iBAChC;YACL,CAAC,EACD,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE;gBACb,IAAI,eAAe,CAAC,oBAAoB,CAAC,CAAC,CAAC,EAAE;oBAEzC,CAAC,CAAC,cAAc,EAAE,CAAC;oBACnB,CAAC,CAAC,WAAW,CAAC,wBAAwB,EAAE,CAAC;oBACzC,CAAC,CAAC,WAAW,CAAC,cAAc,EAAE,CAAC;iBAClC;YACL,CAAC,EACD,KAAK,EAAE,EAAC,KAAK,EAAE,MAAM,EAAC,GACxB,CACL,CAAC;IACN,CAAC;CACJ","sourcesContent":["import React from 'react';\nimport {InputNumber} from \"antd\";\nimport {ICellEditor, ICellEditorParams} from \"ag-grid-community\";\nimport {Key} from \"ts-key-enum\";\nimport KeyboardUtils from \"d2coreui/components/keyboard/keyboardUtils\";\nimport {CellEditorUtils} from \"./cellEditorUtils\";\n\nconst KEY_BACKSPACE = 8;\nconst KEY_DELETE = 46;\nconst KEY_F2 = 113;\n\ninterface NumberCellEditorProperties extends ICellEditorParams {\n decimalSeparator?: string\n precision?: number\n min?: number\n max?: number\n}\n\ninterface NumericCellEditorState {\n value: number | null\n highlightAllOnFocus: boolean\n cancelEdit: boolean\n}\n\nexport default class NumberCellEditor extends React.Component<NumberCellEditorProperties, NumericCellEditorState> implements ICellEditor {\n private inputComponent: HTMLInputElement | null = null;\n private focusOpId: number | null = null;\n\n constructor(props: Readonly<NumberCellEditorProperties>) {\n super(props);\n this.state = this.getInitialState(props);\n }\n\n getInitialState(props: Readonly<NumberCellEditorProperties>): NumericCellEditorState {\n let value: number | null;\n let highlightAllOnFocus = true;\n\n if (props.keyPress === KEY_BACKSPACE || props.keyPress === KEY_DELETE) {\n // if backspace or delete pressed, we clear the cell\n value = null;\n } else if (props.charPress) {\n // if a letter was pressed, we start with the letter\n const parsedValue = Number.parseInt(props.charPress);\n value = isNaN(parsedValue) ? props.value : parsedValue;\n highlightAllOnFocus = false;\n } else {\n // otherwise we start with the current value\n value = props.value;\n if (props.keyPress === KEY_F2) {\n highlightAllOnFocus = false;\n }\n }\n return {\n value: value,\n highlightAllOnFocus,\n cancelEdit: false\n } as NumericCellEditorState;\n }\n\n componentWillUnmount() {\n if (this.focusOpId) {\n clearTimeout(this.focusOpId);\n }\n }\n\n afterGuiAttached() {\n this.focusOpId = window.setTimeout(() => {\n this.inputComponent?.focus();\n if (this.state.highlightAllOnFocus) {\n this.inputComponent?.select();\n this.setState({\n highlightAllOnFocus: false,\n });\n } else {\n // when we started editing, we want the carot at the end, not the start.\n // this comes into play in two scenarios: a) when user hits F2 and b)\n // when user hits a printable character, then on IE (and only IE) the carot\n // was placed after the first character, thus 'apply' would end up as 'pplea'\n const length = this.inputComponent?.value ? this.inputComponent?.value.length : 0;\n if (length > 0) {\n this.inputComponent?.setSelectionRange(length, length);\n }\n }\n }, 200);\n }\n\n getValue() {\n return this.state.value;\n }\n\n isPopup(): boolean {\n return true;\n }\n\n isCancelBeforeStart(): boolean {\n return !!this.props.charPress && '1234567890'.indexOf(this.props.charPress) < 0;\n }\n\n isCancelAfterEnd() {\n return false;\n }\n\n render() {\n return (\n <InputNumber\n ref={(component) => {\n this.inputComponent = component;\n }}\n size=\"small\"\n autoFocus\n decimalSeparator={this.props.decimalSeparator}\n precision={this.props.precision}\n min={this.props.min}\n max={this.props.max}\n placeholder={this.state.value === null ? \"NULL\" : \"\"}\n value={this.state.value !== undefined && this.state.value !== null ? this.state.value : undefined}\n onChange={(value: number | string | undefined) => {\n if (KeyboardUtils.isKeyPressed(Key.Alt)) {\n // ignore navigational keystrokes ALT+cursor arrow\n return;\n }\n if (typeof value === \"number\") {\n this.setState({value: value});\n } else if (value === undefined || value === \"\") {\n this.setState({value: null});\n }\n }}\n onKeyDown={(e) => {\n if (CellEditorUtils.shouldIgnoreKeyEvent(e)) {\n // this.props.onKeyDown(e.nativeEvent);\n e.preventDefault();\n e.nativeEvent.stopImmediatePropagation();\n e.nativeEvent.preventDefault();\n }\n }}\n style={{width: '100%'}}\n />\n );\n }\n}"]}
1
+ {"version":3,"file":"numberCellEditor.js","sourceRoot":"","sources":["../../../../../components/grid/cell/numberCellEditor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,WAAW,EAAC,MAAM,MAAM,CAAC;AAEjC,OAAO,EAAC,GAAG,EAAC,MAAM,aAAa,CAAC;AAChC,OAAO,aAAa,MAAM,4CAA4C,CAAC;AACvE,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAElD,MAAM,aAAa,GAAG,CAAC,CAAC;AACxB,MAAM,UAAU,GAAG,EAAE,CAAC;AACtB,MAAM,MAAM,GAAG,GAAG,CAAC;AAenB,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,KAAK,CAAC,SAA6D;IAI7G,YAAY,KAA2C;QACnD,KAAK,CAAC,KAAK,CAAC,CAAC;QAJT,mBAAc,GAA4B,IAAI,CAAC;QAC/C,cAAS,GAAkB,IAAI,C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AAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,EAC/D,QAAQ,EAAE,KAAK,CAAC,EAAE;gBACd,IAAI,aAAa,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;oBAErC,OAAO;iBACV;gBACD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;oBAC3B,IAAI,CAAC,QAAQ,CAAC,EAAC,KAAK,EAAE,KAAK,EAAC,CAAC,CAAC;iBACjC;qBAAM,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,EAAE,EAAE;oBACvC,IAAI,CAAC,QAAQ,CAAC,EAAC,KAAK,EAAE,IAAI,EAAC,CAAC,CAAC;iBAChC;YACL,CAAC,EACD,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE;gBACb,IAAI,eAAe,CAAC,oBAAoB,CAAC,CAAC,CAAC,EAAE;oBAEzC,CAAC,CAAC,cAAc,EAAE,CAAC;oBACnB,CAAC,CAAC,WAAW,CAAC,wBAAwB,EAAE,CAAC;oBACzC,CAAC,CAAC,WAAW,CAAC,cAAc,EAAE,CAAC;iBAClC;YACL,CAAC,EACD,KAAK,EAAE,EAAC,KAAK,EAAE,MAAM,EAAC,GACxB,CACL,CAAC;IACN,CAAC;CACJ","sourcesContent":["import React from 'react';\nimport {InputNumber} from \"antd\";\nimport {ICellEditor, ICellEditorParams} from \"ag-grid-community\";\nimport {Key} from \"ts-key-enum\";\nimport KeyboardUtils from \"d2coreui/components/keyboard/keyboardUtils\";\nimport {CellEditorUtils} from \"./cellEditorUtils\";\n\nconst KEY_BACKSPACE = 8;\nconst KEY_DELETE = 46;\nconst KEY_F2 = 113;\n\ninterface NumberCellEditorProperties extends ICellEditorParams {\n decimalSeparator?: string\n precision?: number\n min?: number\n max?: number\n}\n\ninterface NumericCellEditorState {\n value: number | null\n highlightAllOnFocus: boolean\n cancelEdit: boolean\n}\n\nexport default class NumberCellEditor extends React.Component<NumberCellEditorProperties, NumericCellEditorState> implements ICellEditor {\n private inputComponent: HTMLInputElement | null = null;\n private focusOpId: number | null = null;\n\n constructor(props: Readonly<NumberCellEditorProperties>) {\n super(props);\n this.state = this.getInitialState(props);\n }\n\n getInitialState(props: Readonly<NumberCellEditorProperties>): NumericCellEditorState {\n let value: number | null;\n let highlightAllOnFocus = true;\n\n if (props.keyPress === KEY_BACKSPACE || props.keyPress === KEY_DELETE) {\n // if backspace or delete pressed, we clear the cell\n value = null;\n } else if (props.charPress) {\n // if a letter was pressed, we start with the letter\n const parsedValue = Number.parseInt(props.charPress);\n value = isNaN(parsedValue) ? props.value : parsedValue;\n highlightAllOnFocus = false;\n } else {\n // otherwise we start with the current value\n value = props.value;\n if (props.keyPress === KEY_F2) {\n highlightAllOnFocus = false;\n }\n }\n return {\n value: value,\n highlightAllOnFocus,\n cancelEdit: false\n } as NumericCellEditorState;\n }\n\n componentWillUnmount() {\n if (this.focusOpId) {\n clearTimeout(this.focusOpId);\n }\n }\n\n afterGuiAttached() {\n this.focusOpId = window.setTimeout(() => {\n this.inputComponent?.focus();\n if (this.state.highlightAllOnFocus) {\n this.inputComponent?.select();\n this.setState({\n highlightAllOnFocus: false,\n });\n } else {\n // when we started editing, we want the carot at the end, not the start.\n // this comes into play in two scenarios: a) when user hits F2 and b)\n // when user hits a printable character, then on IE (and only IE) the carot\n // was placed after the first character, thus 'apply' would end up as 'pplea'\n const length = this.inputComponent?.value ? this.inputComponent?.value.length : 0;\n if (length > 0) {\n this.inputComponent?.setSelectionRange(length, length);\n }\n }\n }, 200);\n }\n\n getValue() {\n return this.state.value;\n }\n\n isPopup(): boolean {\n return true;\n }\n\n isCancelBeforeStart(): boolean {\n return !!this.props.charPress && '1234567890'.indexOf(this.props.charPress) < 0;\n }\n\n isCancelAfterEnd() {\n return false;\n }\n\n render() {\n return (\n <InputNumber\n ref={(component) => {\n this.inputComponent = component;\n }}\n size=\"small\"\n autoFocus\n decimalSeparator={this.props.decimalSeparator}\n precision={this.props.precision}\n min={this.props.min}\n max={this.props.max}\n placeholder={this.state.value === null ? \"NULL\" : \"\"}\n value={this.state.value !== null ? this.state.value : undefined}\n onChange={value => {\n if (KeyboardUtils.isKeyPressed(Key.Alt)) {\n // ignore navigational keystrokes ALT+cursor arrow\n return;\n }\n if (typeof value === \"number\") {\n this.setState({value: value});\n } else if (value === null || value === \"\") {\n this.setState({value: null});\n }\n }}\n onKeyDown={(e) => {\n if (CellEditorUtils.shouldIgnoreKeyEvent(e)) {\n // this.props.onKeyDown(e.nativeEvent);\n e.preventDefault();\n e.nativeEvent.stopImmediatePropagation();\n e.nativeEvent.preventDefault();\n }\n }}\n style={{width: '100%'}}\n />\n );\n }\n}"]}
@@ -39,6 +39,10 @@ export declare class ModalDialog extends React.Component<ModalDialogProps, {}> {
39
39
  destroy: () => void;
40
40
  update: (newConfig: ModalFuncProps) => void;
41
41
  };
42
+ static info(props: ModalDialogFuncProps): {
43
+ destroy: () => void;
44
+ update: (newConfig: ModalFuncProps) => void;
45
+ };
42
46
  render(): JSX.Element;
43
47
  private static getModalProperties;
44
48
  private static getModalFuncProperties;
@@ -60,6 +60,14 @@ export class ModalDialog extends React.Component {
60
60
  dialogHandler = Modal.success(modalDialogProperties);
61
61
  return dialogHandler;
62
62
  }
63
+ static info(props) {
64
+ let dialogHandler;
65
+ const modalDialogProperties = ModalDialog.getModalFuncProperties(props, () => {
66
+ dialogHandler === null || dialogHandler === void 0 ? void 0 : dialogHandler.destroy();
67
+ });
68
+ dialogHandler = Modal.info(modalDialogProperties);
69
+ return dialogHandler;
70
+ }
63
71
  render() {
64
72
  const modalDialogProperties = ModalDialog.getModalProperties(this.props);
65
73
  return (React.createElement(DraggableModal, Object.assign({}, modalDialogProperties), this.props.children));
@@ -1 +1 @@
1
- {"version":3,"file":"modalDialog.js","sourceRoot":"","sources":["../../../../components/modal/modalDialog.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;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AAC,iBAAiB,GAAG,EAAC,KAAK,EAAE,EAAC,OAAO,EAAE,MAAM,EAAC,EAAC,CAAC;SAC3D;QACD,IAAI,IAAI,CAAC,eAAe,KAAK,SAAS,EAAE;YACpC,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;SAC/B;QAED,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,EAAE,EAAC,KAAK,EAAE,EAAC,WAAW,EAAE,CAAC,EAAC,EAAC,CAAC,CAAC;QAE1H,IAAI,IAAI,SAAuB,EAAE;YAC7B,IAAI,CAAC,iBAAiB,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,iBAAiB,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,EAAE,EAAC,KAAK,EAAE,EAAC,KAAK,EAAE,OAAO,EAAC,EAAC,CAAC,CAAC;SACzI;QAED,IAAI,IAAI,oBAAkC,EAAE;YACxC,IAAI,IAAI,CAAC,iBAAiB,IAAI,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE;gBACxD,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,OAAO,GAAG,CAAC,CAAC;gBACzC,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC;gBAC5C,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC;gBAChD,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,UAAU,GAAG,aAAa,CAAC;aAC3D;SACJ;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ","sourcesContent":["import React from \"react\";\nimport {Button, Modal} from \"antd\";\nimport {ModalFuncProps, ModalProps} from \"antd/es/Modal\";\nimport i18n from \"d2core/i18n/i18n\";\nimport {DraggableModal} from \"d2coreui/components/modal/impl\";\n\nexport const enum ModalDialogMode {\n NO_BUTTONS = \"NO_BUTTONS\",\n OK_CANCEL = \"OK_CANCEL\",\n YES_NO = \"YES_NO\",\n YES_NO_CANCEL = \"YES_NO_CANCEL\",\n OK = \"OK\",\n}\n\nexport interface ModalDialogFuncProps extends ModalFuncProps {\n mode: ModalDialogMode\n denyText?: string\n onDeny?: (...args: any[]) => any;\n}\n\nexport interface ModalDialogProps extends Omit<ModalProps, \"width\"> {\n mode: ModalDialogMode\n initialWidth?: number,\n initialHeight?: number\n\n // resize dialog handler\n onResize?(size: { width: number, height: number }): void\n}\n\nexport class ModalDialog extends React.Component<ModalDialogProps, {}> {\n constructor(props: Readonly<ModalDialogProps>) {\n super(props);\n }\n\n public static confirm(props: ModalDialogFuncProps): { destroy: () => void; update: (newConfig: ModalFuncProps) => void } {\n let dialogHandler: { destroy: () => void; update: (newConfig: ModalFuncProps) => void };\n const modalDialogProperties = ModalDialog.getModalFuncProperties(props, () => {\n dialogHandler?.destroy();\n });\n dialogHandler = Modal.confirm(modalDialogProperties);\n return dialogHandler;\n }\n\n public static error(props: ModalDialogFuncProps): { destroy: () => void; update: (newConfig: ModalFuncProps) => void } {\n let dialogHandler: { destroy: () => void; update: (newConfig: ModalFuncProps) => void };\n const modalDialogProperties = ModalDialog.getModalFuncProperties(props, () => {\n dialogHandler?.destroy();\n });\n dialogHandler = Modal.error(modalDialogProperties);\n return dialogHandler;\n }\n\n public static delete(props: ModalDialogFuncProps): { destroy: () => void; update: (newConfig: ModalFuncProps) => void } {\n let dialogHandler: { destroy: () => void; update: (newConfig: ModalFuncProps) => void };\n const modalDialogProperties = ModalDialog.getModalFuncProperties(props, () => {\n dialogHandler?.destroy();\n });\n if (props.okButtonProps) {\n props.okButtonProps.danger = true;\n }\n dialogHandler = Modal.confirm(modalDialogProperties);\n return dialogHandler;\n }\n\n public static success(props: ModalDialogFuncProps): { destroy: () => void; update: (newConfig: ModalFuncProps) => void } {\n let dialogHandler: { destroy: () => void; update: (newConfig: ModalFuncProps) => void };\n const modalDialogProperties = ModalDialog.getModalFuncProperties(props, () => {\n dialogHandler?.destroy();\n });\n dialogHandler = Modal.success(modalDialogProperties);\n return dialogHandler;\n }\n\n render() {\n const modalDialogProperties = ModalDialog.getModalProperties(this.props);\n return (\n <DraggableModal {...modalDialogProperties}>\n {this.props.children}\n </DraggableModal>);\n }\n\n private static getModalProperties(props: ModalDialogProps) {\n const {mode, ...rest} = props;\n if (mode === ModalDialogMode.NO_BUTTONS) {\n if (rest.footer === undefined) {\n rest.footer = null;\n }\n } else {\n switch (mode) {\n case ModalDialogMode.OK_CANCEL:\n rest.okText = props.okText ?? i18n(\"OK\");\n rest.cancelText = props.cancelText ?? i18n(\"Cancel\");\n break;\n case ModalDialogMode.YES_NO:\n rest.okText = props.okText ?? i18n(\"Yes\");\n rest.cancelText = props.cancelText ?? i18n(\"No\");\n break;\n case ModalDialogMode.OK:\n rest.okText = props.okText ?? i18n(\"OK\");\n rest.cancelButtonProps = undefined;\n break;\n }\n\n rest.okButtonProps = Object.assign(rest.okButtonProps !== undefined ? rest.okButtonProps : {}, {style: {marginRight: 8}});\n rest.cancelButtonProps = Object.assign(rest.cancelButtonProps !== undefined ? rest.cancelButtonProps : {}, {style: {float: \"right\"}});\n }\n return rest;\n }\n\n private static getModalFuncProperties(props: ModalDialogFuncProps, performClose: () => void) {\n const {mode, denyText, onDeny, ...rest} = props;\n switch (mode) {\n case ModalDialogMode.OK_CANCEL:\n rest.okText = rest.okText ?? i18n(\"OK\");\n rest.cancelText = rest.cancelText ?? i18n(\"Cancel\");\n break;\n case ModalDialogMode.YES_NO:\n rest.okText = rest.okText ?? i18n(\"Yes\");\n rest.cancelText = rest.cancelText ?? i18n(\"No\");\n break;\n case ModalDialogMode.YES_NO_CANCEL:\n rest.okText = rest.okText ?? i18n(\"Yes\");\n rest.cancelText = (<React.Fragment>\n <Button onClick={(e) => {\n e.preventDefault();\n e.stopPropagation();\n e.nativeEvent.stopImmediatePropagation();\n onDeny?.(e);\n performClose();\n }}>{denyText ?? i18n(\"No\")}</Button>\n <Button>{rest.cancelText ?? i18n(\"Cancel\")}</Button>\n </React.Fragment>\n );\n if (!rest.cancelButtonProps) {\n rest.cancelButtonProps = {};\n }\n rest.cancelButtonProps.type = \"text\";\n break;\n case ModalDialogMode.OK:\n rest.okText = props.okText ?? i18n(\"OK\");\n rest.cancelButtonProps = {style: {display: \"none\"}};\n }\n if (rest.autoFocusButton === undefined) {\n rest.autoFocusButton = \"ok\";\n }\n\n rest.okButtonProps = Object.assign(rest.okButtonProps !== undefined ? rest.okButtonProps : {}, {style: {marginRight: 8}});\n\n if (mode !== ModalDialogMode.OK) {\n rest.cancelButtonProps = Object.assign(rest.cancelButtonProps !== undefined ? rest.cancelButtonProps : {}, {style: {float: \"right\"}});\n }\n\n if (mode === ModalDialogMode.YES_NO_CANCEL) {\n if (rest.cancelButtonProps && rest.cancelButtonProps.style) {\n rest.cancelButtonProps.style.padding = 0;\n rest.cancelButtonProps.style.marginTop = -1;\n rest.cancelButtonProps.style.cursor = \"default\";\n rest.cancelButtonProps.style.background = \"transparent\";\n }\n }\n return rest;\n }\n}"]}
1
+ {"version":3,"file":"modalDialog.js","sourceRoot":"","sources":["../../../../components/modal/modalDialog.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,MAAM,EAAE,KAAK,EAAC,MAAM,MAAM,CAAC;AAEnC,OAAO,IAAI,MAAM,kBAAkB,CAAC;AACpC,OAAO,EAAC,cAAc,EAAC,MAAM,gCAAgC,CAAC;AAE9D,MAAM,CAAN,IAAkB,eAMjB;AAND,WAAkB,eAAe;IAC7B,4CAAyB,CAAA;IACzB,0CAAuB,CAAA;IACvB,oCAAiB,CAAA;IACjB,kDAA+B,CAAA;IAC/B,4BAAS,CAAA;AACb,CAAC,EANiB,eAAe,KAAf,eAAe,QAMhC;AAiBD,MAAM,OAAO,W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AAO,EAAE,MAAM,EAAC,EAAC,CAAC;SAC3D;QACD,IAAI,IAAI,CAAC,eAAe,KAAK,SAAS,EAAE;YACpC,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;SAC/B;QAED,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,EAAE,EAAC,KAAK,EAAE,EAAC,WAAW,EAAE,CAAC,EAAC,EAAC,CAAC,CAAC;QAE1H,IAAI,IAAI,SAAuB,EAAE;YAC7B,IAAI,CAAC,iBAAiB,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,iBAAiB,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,EAAE,EAAC,KAAK,EAAE,EAAC,KAAK,EAAE,OAAO,EAAC,EAAC,CAAC,CAAC;SACzI;QAED,IAAI,IAAI,oBAAkC,EAAE;YACxC,IAAI,IAAI,CAAC,iBAAiB,IAAI,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE;gBACxD,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,OAAO,GAAG,CAAC,CAAC;gBACzC,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC;gBAC5C,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC;gBAChD,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,UAAU,GAAG,aAAa,CAAC;aAC3D;SACJ;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ","sourcesContent":["import React from \"react\";\nimport {Button, Modal} from \"antd\";\nimport {ModalFuncProps, ModalProps} from \"antd/es/Modal\";\nimport i18n from \"d2core/i18n/i18n\";\nimport {DraggableModal} from \"d2coreui/components/modal/impl\";\n\nexport const enum ModalDialogMode {\n NO_BUTTONS = \"NO_BUTTONS\",\n OK_CANCEL = \"OK_CANCEL\",\n YES_NO = \"YES_NO\",\n YES_NO_CANCEL = \"YES_NO_CANCEL\",\n OK = \"OK\",\n}\n\nexport interface ModalDialogFuncProps extends ModalFuncProps {\n mode: ModalDialogMode\n denyText?: string\n onDeny?: (...args: any[]) => any;\n}\n\nexport interface ModalDialogProps extends Omit<ModalProps, \"width\"> {\n mode: ModalDialogMode\n initialWidth?: number,\n initialHeight?: number\n\n // resize dialog handler\n onResize?(size: { width: number, height: number }): void\n}\n\nexport class ModalDialog extends React.Component<ModalDialogProps, {}> {\n constructor(props: Readonly<ModalDialogProps>) {\n super(props);\n }\n\n public static confirm(props: ModalDialogFuncProps): { destroy: () => void; update: (newConfig: ModalFuncProps) => void } {\n let dialogHandler: { destroy: () => void; update: (newConfig: ModalFuncProps) => void };\n const modalDialogProperties = ModalDialog.getModalFuncProperties(props, () => {\n dialogHandler?.destroy();\n });\n dialogHandler = Modal.confirm(modalDialogProperties);\n return dialogHandler;\n }\n\n public static error(props: ModalDialogFuncProps): { destroy: () => void; update: (newConfig: ModalFuncProps) => void } {\n let dialogHandler: { destroy: () => void; update: (newConfig: ModalFuncProps) => void };\n const modalDialogProperties = ModalDialog.getModalFuncProperties(props, () => {\n dialogHandler?.destroy();\n });\n dialogHandler = Modal.error(modalDialogProperties);\n return dialogHandler;\n }\n\n public static delete(props: ModalDialogFuncProps): { destroy: () => void; update: (newConfig: ModalFuncProps) => void } {\n let dialogHandler: { destroy: () => void; update: (newConfig: ModalFuncProps) => void };\n const modalDialogProperties = ModalDialog.getModalFuncProperties(props, () => {\n dialogHandler?.destroy();\n });\n if (props.okButtonProps) {\n props.okButtonProps.danger = true;\n }\n dialogHandler = Modal.confirm(modalDialogProperties);\n return dialogHandler;\n }\n\n public static success(props: ModalDialogFuncProps): { destroy: () => void; update: (newConfig: ModalFuncProps) => void } {\n let dialogHandler: { destroy: () => void; update: (newConfig: ModalFuncProps) => void };\n const modalDialogProperties = ModalDialog.getModalFuncProperties(props, () => {\n dialogHandler?.destroy();\n });\n dialogHandler = Modal.success(modalDialogProperties);\n return dialogHandler;\n }\n\n public static info(props: ModalDialogFuncProps): { destroy: () => void; update: (newConfig: ModalFuncProps) => void } {\n let dialogHandler: { destroy: () => void; update: (newConfig: ModalFuncProps) => void };\n const modalDialogProperties = ModalDialog.getModalFuncProperties(props, () => {\n dialogHandler?.destroy();\n });\n dialogHandler = Modal.info(modalDialogProperties);\n return dialogHandler;\n }\n\n render() {\n const modalDialogProperties = ModalDialog.getModalProperties(this.props);\n return (\n <DraggableModal {...modalDialogProperties}>\n {this.props.children}\n </DraggableModal>);\n }\n\n private static getModalProperties(props: ModalDialogProps) {\n const {mode, ...rest} = props;\n if (mode === ModalDialogMode.NO_BUTTONS) {\n if (rest.footer === undefined) {\n rest.footer = null;\n }\n } else {\n switch (mode) {\n case ModalDialogMode.OK_CANCEL:\n rest.okText = props.okText ?? i18n(\"OK\");\n rest.cancelText = props.cancelText ?? i18n(\"Cancel\");\n break;\n case ModalDialogMode.YES_NO:\n rest.okText = props.okText ?? i18n(\"Yes\");\n rest.cancelText = props.cancelText ?? i18n(\"No\");\n break;\n case ModalDialogMode.OK:\n rest.okText = props.okText ?? i18n(\"OK\");\n rest.cancelButtonProps = undefined;\n break;\n }\n\n rest.okButtonProps = Object.assign(rest.okButtonProps !== undefined ? rest.okButtonProps : {}, {style: {marginRight: 8}});\n rest.cancelButtonProps = Object.assign(rest.cancelButtonProps !== undefined ? rest.cancelButtonProps : {}, {style: {float: \"right\"}});\n }\n return rest;\n }\n\n private static getModalFuncProperties(props: ModalDialogFuncProps, performClose: () => void) {\n const {mode, denyText, onDeny, ...rest} = props;\n switch (mode) {\n case ModalDialogMode.OK_CANCEL:\n rest.okText = rest.okText ?? i18n(\"OK\");\n rest.cancelText = rest.cancelText ?? i18n(\"Cancel\");\n break;\n case ModalDialogMode.YES_NO:\n rest.okText = rest.okText ?? i18n(\"Yes\");\n rest.cancelText = rest.cancelText ?? i18n(\"No\");\n break;\n case ModalDialogMode.YES_NO_CANCEL:\n rest.okText = rest.okText ?? i18n(\"Yes\");\n rest.cancelText = (<React.Fragment>\n <Button onClick={(e) => {\n e.preventDefault();\n e.stopPropagation();\n e.nativeEvent.stopImmediatePropagation();\n onDeny?.(e);\n performClose();\n }}>{denyText ?? i18n(\"No\")}</Button>\n <Button>{rest.cancelText ?? i18n(\"Cancel\")}</Button>\n </React.Fragment>\n );\n if (!rest.cancelButtonProps) {\n rest.cancelButtonProps = {};\n }\n rest.cancelButtonProps.type = \"text\";\n break;\n case ModalDialogMode.OK:\n rest.okText = props.okText ?? i18n(\"OK\");\n rest.cancelButtonProps = {style: {display: \"none\"}};\n }\n if (rest.autoFocusButton === undefined) {\n rest.autoFocusButton = \"ok\";\n }\n\n rest.okButtonProps = Object.assign(rest.okButtonProps !== undefined ? rest.okButtonProps : {}, {style: {marginRight: 8}});\n\n if (mode !== ModalDialogMode.OK) {\n rest.cancelButtonProps = Object.assign(rest.cancelButtonProps !== undefined ? rest.cancelButtonProps : {}, {style: {float: \"right\"}});\n }\n\n if (mode === ModalDialogMode.YES_NO_CANCEL) {\n if (rest.cancelButtonProps && rest.cancelButtonProps.style) {\n rest.cancelButtonProps.style.padding = 0;\n rest.cancelButtonProps.style.marginTop = -1;\n rest.cancelButtonProps.style.cursor = \"default\";\n rest.cancelButtonProps.style.background = \"transparent\";\n }\n }\n return rest;\n }\n}"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "d2coreui",
3
- "version": "21.0.18",
3
+ "version": "21.0.19",
4
4
  "description": "Core UI components and utilities library.",
5
5
  "author": "Ipesoft s.r.o.",
6
6
  "license": "MIT",