d2coreui 23.0.29 → 23.0.31
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.
- package/components/grid/cell/cellControl.d.ts +8 -0
- package/components/grid/cell/cellControl.js +13 -0
- package/components/grid/cell/cellControl.js.map +1 -0
- package/components/grid/cell/dragListenerFeature.d.ts +6 -0
- package/components/grid/cell/dragListenerFeature.js +26 -0
- package/components/grid/cell/dragListenerFeature.js.map +1 -0
- package/components/grid/cell/rangeSelector.d.ts +75 -37
- package/components/grid/cell/rangeSelector.js +682 -280
- package/components/grid/cell/rangeSelector.js.map +1 -1
- package/components/grid/dataGrid.d.ts +2 -2
- package/components/grid/dataGrid.js +50 -52
- package/components/grid/dataGrid.js.map +1 -1
- package/components/grid/extendedDataGrid.js +1 -1
- package/components/grid/extendedDataGrid.js.map +1 -1
- package/components/input/autoCompleteInput.js +15 -15
- package/components/input/autoCompleteInput.js.map +1 -1
- package/components/input/maskedInput.d.ts +1 -1
- package/components/input/maskedInput.js +1 -1
- package/components/input/maskedInput.js.map +1 -1
- package/components/input/passwordInput.js +49 -35
- package/components/input/passwordInput.js.map +1 -1
- package/components/modal/modalDialog.d.ts +3 -0
- package/components/modal/modalDialog.js +13 -5
- package/components/modal/modalDialog.js.map +1 -1
- package/package.json +3 -3
- package/style/index.less +0 -4
|
@@ -1,47 +1,61 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { EyeInvisibleOutlined, EyeOutlined } from "@ant-design/icons";
|
|
3
3
|
import { Input } from "antd";
|
|
4
|
+
const IconRendererClass = class IconRend extends React.Component {
|
|
5
|
+
constructor(props) {
|
|
6
|
+
super(props);
|
|
7
|
+
this.start = 0;
|
|
8
|
+
this.end = 0;
|
|
9
|
+
}
|
|
10
|
+
fixCursorReset() {
|
|
11
|
+
const component = this.props.component;
|
|
12
|
+
this.start = component.input.selectionStart;
|
|
13
|
+
this.end = component.input.selectionEnd;
|
|
14
|
+
setTimeout(() => {
|
|
15
|
+
component.input.selectionStart = this.start;
|
|
16
|
+
component.input.selectionEnd = this.end;
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
render() {
|
|
20
|
+
const { visible, onClick } = this.props;
|
|
21
|
+
const IconClass = visible ? EyeOutlined : EyeInvisibleOutlined;
|
|
22
|
+
return (React.createElement(IconClass, { key: "password-icon", className: "ant-input-password-icon", onTouchStart: (e) => {
|
|
23
|
+
e.preventDefault();
|
|
24
|
+
if (!visible) {
|
|
25
|
+
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
26
|
+
}
|
|
27
|
+
}, onTouchEnd: () => {
|
|
28
|
+
if (visible) {
|
|
29
|
+
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
30
|
+
this.fixCursorReset();
|
|
31
|
+
}
|
|
32
|
+
}, onMouseDown: (e) => {
|
|
33
|
+
e.preventDefault();
|
|
34
|
+
if (!visible) {
|
|
35
|
+
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
36
|
+
}
|
|
37
|
+
}, onMouseUp: () => {
|
|
38
|
+
if (visible) {
|
|
39
|
+
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
40
|
+
this.fixCursorReset();
|
|
41
|
+
}
|
|
42
|
+
}, onMouseLeave: () => {
|
|
43
|
+
if (visible) {
|
|
44
|
+
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
45
|
+
this.fixCursorReset();
|
|
46
|
+
}
|
|
47
|
+
} }));
|
|
48
|
+
}
|
|
49
|
+
;
|
|
50
|
+
};
|
|
4
51
|
export default class PasswordInput extends React.Component {
|
|
5
52
|
constructor(props) {
|
|
6
53
|
super(props);
|
|
7
54
|
this.component = null;
|
|
8
55
|
this.getIcon = (visible) => {
|
|
9
|
-
|
|
10
|
-
render() {
|
|
11
|
-
const IconClass = visible ? EyeOutlined : EyeInvisibleOutlined;
|
|
12
|
-
return (React.createElement(IconClass, { key: "password-icon", className: "ant-input-password-icon", onTouchStart: (e) => {
|
|
13
|
-
var _a, _b;
|
|
14
|
-
e.preventDefault();
|
|
15
|
-
if (!visible) {
|
|
16
|
-
(_b = (_a = this.props).onClick) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
17
|
-
}
|
|
18
|
-
}, onTouchEnd: () => {
|
|
19
|
-
var _a, _b;
|
|
20
|
-
if (visible) {
|
|
21
|
-
(_b = (_a = this.props).onClick) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
22
|
-
}
|
|
23
|
-
}, onMouseDown: (e) => {
|
|
24
|
-
var _a, _b;
|
|
25
|
-
e.preventDefault();
|
|
26
|
-
if (!visible) {
|
|
27
|
-
(_b = (_a = this.props).onClick) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
28
|
-
}
|
|
29
|
-
}, onMouseUp: () => {
|
|
30
|
-
var _a, _b;
|
|
31
|
-
if (visible) {
|
|
32
|
-
(_b = (_a = this.props).onClick) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
33
|
-
}
|
|
34
|
-
}, onMouseLeave: () => {
|
|
35
|
-
var _a, _b;
|
|
36
|
-
if (visible) {
|
|
37
|
-
(_b = (_a = this.props).onClick) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
38
|
-
}
|
|
39
|
-
} }));
|
|
40
|
-
}
|
|
41
|
-
;
|
|
42
|
-
};
|
|
43
|
-
return React.createElement(IconRenderer, null);
|
|
56
|
+
return React.createElement(IconRendererClass, { visible: visible, component: this.component });
|
|
44
57
|
};
|
|
58
|
+
this.getIcon = this.getIcon.bind(this);
|
|
45
59
|
}
|
|
46
60
|
focus() {
|
|
47
61
|
var _a, _b;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"passwordInput.js","sourceRoot":"","sources":["../../../../components/input/passwordInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAC,oBAAoB,EAAE,WAAW,EAAC,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAC,KAAK,EAAC,MAA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C;IAED,KAAK;;QACD,MAAA,MAAA,IAAI,CAAC,SAAS,0CAAE,KAAK,kDAAI,CAAC;IAC9B,CAAC;IAMD,MAAM;QACF,OAAO,oBAAC,KAAK,CAAC,QAAQ,oBAAK,IAAI,CAAC,KAAK,IAAE,UAAU,EAAE,IAAI,CAAC,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,SAAS,EAAE,EAAE;gBACxG,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;YAC/B,CAAC,IAAG,CAAA;IACR,CAAC;CACJ","sourcesContent":["import React from \"react\"\r\nimport {PasswordProps} from \"antd/lib/input/Password\";\r\nimport {EyeInvisibleOutlined, EyeOutlined} from \"@ant-design/icons\";\r\nimport {Input} from \"antd\";\r\n\r\nconst IconRendererClass = class IconRend extends React.Component<any, any> {\r\n private start: number = 0;\r\n private end: number = 0;\r\n\r\n constructor(props: any) {\r\n super(props);\r\n }\r\n\r\n fixCursorReset() {\r\n const component = this.props.component;\r\n\r\n this.start = component.input.selectionStart;\r\n this.end = component.input.selectionEnd;\r\n\r\n // Fix bug when cursor was moved to start\r\n setTimeout(() => {\r\n component.input.selectionStart = this.start;\r\n component.input.selectionEnd = this.end;\r\n });\r\n }\r\n\r\n render() {\r\n const {visible, onClick} = this.props;\r\n const IconClass = visible ? EyeOutlined : EyeInvisibleOutlined;\r\n\r\n return (<IconClass\r\n key=\"password-icon\"\r\n className=\"ant-input-password-icon\"\r\n onTouchStart={(e) => {\r\n e.preventDefault();\r\n if (!visible) {\r\n onClick?.();\r\n }\r\n }}\r\n onTouchEnd={() => {\r\n if (visible) {\r\n onClick?.();\r\n this.fixCursorReset();\r\n }\r\n }}\r\n onMouseDown={(e) => {\r\n e.preventDefault();\r\n if (!visible) {\r\n onClick?.();\r\n }\r\n }}\r\n onMouseUp={() => {\r\n if (visible) {\r\n onClick?.();\r\n this.fixCursorReset();\r\n }\r\n }}\r\n onMouseLeave={() => {\r\n if (visible) {\r\n onClick?.();\r\n this.fixCursorReset();\r\n }\r\n }}\r\n />);\r\n };\r\n};\r\n\r\nexport default class PasswordInput extends React.Component<PasswordProps, unknown> {\r\n private component: any | null = null;\r\n\r\n constructor(props: Readonly<PasswordProps>) {\r\n super(props);\r\n this.getIcon = this.getIcon.bind(this);\r\n }\r\n\r\n focus() {\r\n this.component?.focus?.();\r\n }\r\n\r\n getIcon = (visible: boolean) => {\r\n return <IconRendererClass visible={visible} component={this.component} />;\r\n }\r\n\r\n render() {\r\n return <Input.Password {...this.props} iconRender={this.getIcon} visibilityToggle={true} ref={(component) => {\r\n this.component = component;\r\n }}/>\r\n }\r\n}\r\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { ModalFuncProps, ModalProps } from "antd/es/modal";
|
|
3
|
+
import { HookAPI } from "antd/es/modal/useModal";
|
|
3
4
|
export declare const enum ModalDialogMode {
|
|
4
5
|
NO_BUTTONS = "NO_BUTTONS",
|
|
5
6
|
OK_CANCEL = "OK_CANCEL",
|
|
@@ -22,7 +23,9 @@ export interface ModalDialogProps extends Omit<ModalProps, "width"> {
|
|
|
22
23
|
}): void;
|
|
23
24
|
}
|
|
24
25
|
export declare class ModalDialog extends React.Component<ModalDialogProps, {}> {
|
|
26
|
+
private static modalStatic;
|
|
25
27
|
constructor(props: Readonly<ModalDialogProps>);
|
|
28
|
+
static setModalInstance(instance: HookAPI): void;
|
|
26
29
|
static confirm(props: ModalDialogFuncProps): {
|
|
27
30
|
destroy: () => void;
|
|
28
31
|
update: (newConfig: ModalFuncProps) => void;
|
|
@@ -25,12 +25,16 @@ export class ModalDialog extends React.Component {
|
|
|
25
25
|
constructor(props) {
|
|
26
26
|
super(props);
|
|
27
27
|
}
|
|
28
|
+
static setModalInstance(instance) {
|
|
29
|
+
ModalDialog.modalStatic = instance;
|
|
30
|
+
}
|
|
28
31
|
static confirm(props) {
|
|
29
32
|
let dialogHandler;
|
|
30
33
|
const modalDialogProperties = ModalDialog.getModalFuncProperties(props, () => {
|
|
31
34
|
dialogHandler === null || dialogHandler === void 0 ? void 0 : dialogHandler.destroy();
|
|
32
35
|
});
|
|
33
|
-
|
|
36
|
+
const method = ModalDialog.modalStatic ? ModalDialog.modalStatic.confirm : Modal.confirm;
|
|
37
|
+
dialogHandler = method(modalDialogProperties);
|
|
34
38
|
return dialogHandler;
|
|
35
39
|
}
|
|
36
40
|
static error(props) {
|
|
@@ -38,7 +42,8 @@ export class ModalDialog extends React.Component {
|
|
|
38
42
|
const modalDialogProperties = ModalDialog.getModalFuncProperties(props, () => {
|
|
39
43
|
dialogHandler === null || dialogHandler === void 0 ? void 0 : dialogHandler.destroy();
|
|
40
44
|
});
|
|
41
|
-
|
|
45
|
+
const method = ModalDialog.modalStatic ? ModalDialog.modalStatic.error : Modal.error;
|
|
46
|
+
dialogHandler = method(modalDialogProperties);
|
|
42
47
|
return dialogHandler;
|
|
43
48
|
}
|
|
44
49
|
static delete(props) {
|
|
@@ -46,10 +51,11 @@ export class ModalDialog extends React.Component {
|
|
|
46
51
|
const modalDialogProperties = ModalDialog.getModalFuncProperties(props, () => {
|
|
47
52
|
dialogHandler === null || dialogHandler === void 0 ? void 0 : dialogHandler.destroy();
|
|
48
53
|
});
|
|
54
|
+
const method = ModalDialog.modalStatic ? ModalDialog.modalStatic.confirm : Modal.confirm;
|
|
49
55
|
if (props.okButtonProps) {
|
|
50
56
|
props.okButtonProps.danger = true;
|
|
51
57
|
}
|
|
52
|
-
dialogHandler =
|
|
58
|
+
dialogHandler = method(modalDialogProperties);
|
|
53
59
|
return dialogHandler;
|
|
54
60
|
}
|
|
55
61
|
static success(props) {
|
|
@@ -57,7 +63,8 @@ export class ModalDialog extends React.Component {
|
|
|
57
63
|
const modalDialogProperties = ModalDialog.getModalFuncProperties(props, () => {
|
|
58
64
|
dialogHandler === null || dialogHandler === void 0 ? void 0 : dialogHandler.destroy();
|
|
59
65
|
});
|
|
60
|
-
|
|
66
|
+
const method = ModalDialog.modalStatic ? ModalDialog.modalStatic.success : Modal.success;
|
|
67
|
+
dialogHandler = method(modalDialogProperties);
|
|
61
68
|
return dialogHandler;
|
|
62
69
|
}
|
|
63
70
|
static info(props) {
|
|
@@ -65,7 +72,8 @@ export class ModalDialog extends React.Component {
|
|
|
65
72
|
const modalDialogProperties = ModalDialog.getModalFuncProperties(props, () => {
|
|
66
73
|
dialogHandler === null || dialogHandler === void 0 ? void 0 : dialogHandler.destroy();
|
|
67
74
|
});
|
|
68
|
-
|
|
75
|
+
const method = ModalDialog.modalStatic ? ModalDialog.modalStatic.info : Modal.info;
|
|
76
|
+
dialogHandler = method(modalDialogProperties);
|
|
69
77
|
return dialogHandler;
|
|
70
78
|
}
|
|
71
79
|
render() {
|
|
@@ -1 +1 @@
|
|
|
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,WAAY,SAAQ,KAAK,CAAC,SAA+B;IAClE,YAAY,KAAiC;QACzC,KAAK,CAAC,KAAK,CAAC,CAAC;IACjB,CAAC;IAEM,MAAM,CAAC,OAAO,CAAC,KAA2B;QAC7C,IAAI,aAAmF,CAAC;QACxF,MAAM,qBAAqB,GAAG,WAAW,CAAC,sBAAsB,CAAC,KAAK,EAAE,GAAG,EAAE;YACzE,aAAa,a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AAa,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,CAAC;YAC9B,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;QAC1I,CAAC;QAED,IAAI,IAAI,oBAAkC,EAAE,CAAC;YACzC,IAAI,IAAI,CAAC,iBAAiB,IAAI,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,CAAC;gBACzD,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;YAC5D,CAAC;QACL,CAAC;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ","sourcesContent":["import React from \"react\";\r\nimport {Button, Modal} from \"antd\";\r\nimport {ModalFuncProps, ModalProps} from \"antd/es/modal\";\r\nimport i18n from \"d2core/i18n/i18n\";\r\nimport {DraggableModal} from \"d2coreui/components/modal/impl\";\r\n\r\nexport const enum ModalDialogMode {\r\n NO_BUTTONS = \"NO_BUTTONS\",\r\n OK_CANCEL = \"OK_CANCEL\",\r\n YES_NO = \"YES_NO\",\r\n YES_NO_CANCEL = \"YES_NO_CANCEL\",\r\n OK = \"OK\",\r\n}\r\n\r\nexport interface ModalDialogFuncProps extends ModalFuncProps {\r\n mode: ModalDialogMode\r\n denyText?: string\r\n onDeny?: (...args: any[]) => any;\r\n}\r\n\r\nexport interface ModalDialogProps extends Omit<ModalProps, \"width\"> {\r\n mode: ModalDialogMode\r\n initialWidth?: number,\r\n initialHeight?: number\r\n\r\n // resize dialog handler\r\n onResize?(size: { width: number, height: number }): void\r\n}\r\n\r\nexport class ModalDialog extends React.Component<ModalDialogProps, {}> {\r\n constructor(props: Readonly<ModalDialogProps>) {\r\n super(props);\r\n }\r\n\r\n public static confirm(props: ModalDialogFuncProps): { destroy: () => void; update: (newConfig: ModalFuncProps) => void } {\r\n let dialogHandler: { destroy: () => void; update: (newConfig: ModalFuncProps) => void };\r\n const modalDialogProperties = ModalDialog.getModalFuncProperties(props, () => {\r\n dialogHandler?.destroy();\r\n });\r\n dialogHandler = Modal.confirm(modalDialogProperties);\r\n return dialogHandler;\r\n }\r\n\r\n public static error(props: ModalDialogFuncProps): { destroy: () => void; update: (newConfig: ModalFuncProps) => void } {\r\n let dialogHandler: { destroy: () => void; update: (newConfig: ModalFuncProps) => void };\r\n const modalDialogProperties = ModalDialog.getModalFuncProperties(props, () => {\r\n dialogHandler?.destroy();\r\n });\r\n dialogHandler = Modal.error(modalDialogProperties);\r\n return dialogHandler;\r\n }\r\n\r\n public static delete(props: ModalDialogFuncProps): { destroy: () => void; update: (newConfig: ModalFuncProps) => void } {\r\n let dialogHandler: { destroy: () => void; update: (newConfig: ModalFuncProps) => void };\r\n const modalDialogProperties = ModalDialog.getModalFuncProperties(props, () => {\r\n dialogHandler?.destroy();\r\n });\r\n if (props.okButtonProps) {\r\n props.okButtonProps.danger = true;\r\n }\r\n dialogHandler = Modal.confirm(modalDialogProperties);\r\n return dialogHandler;\r\n }\r\n\r\n public static success(props: ModalDialogFuncProps): { destroy: () => void; update: (newConfig: ModalFuncProps) => void } {\r\n let dialogHandler: { destroy: () => void; update: (newConfig: ModalFuncProps) => void };\r\n const modalDialogProperties = ModalDialog.getModalFuncProperties(props, () => {\r\n dialogHandler?.destroy();\r\n });\r\n dialogHandler = Modal.success(modalDialogProperties);\r\n return dialogHandler;\r\n }\r\n\r\n public static info(props: ModalDialogFuncProps): { destroy: () => void; update: (newConfig: ModalFuncProps) => void } {\r\n let dialogHandler: { destroy: () => void; update: (newConfig: ModalFuncProps) => void };\r\n const modalDialogProperties = ModalDialog.getModalFuncProperties(props, () => {\r\n dialogHandler?.destroy();\r\n });\r\n dialogHandler = Modal.info(modalDialogProperties);\r\n return dialogHandler;\r\n }\r\n\r\n render() {\r\n const modalDialogProperties = ModalDialog.getModalProperties(this.props);\r\n return (\r\n <DraggableModal {...modalDialogProperties}>\r\n {this.props.children}\r\n </DraggableModal>);\r\n }\r\n\r\n private static getModalProperties(props: ModalDialogProps) {\r\n const {mode, ...rest} = props;\r\n if (mode === ModalDialogMode.NO_BUTTONS) {\r\n if (rest.footer === undefined) {\r\n rest.footer = null;\r\n }\r\n } else {\r\n switch (mode) {\r\n case ModalDialogMode.OK_CANCEL:\r\n rest.okText = props.okText ?? i18n(\"OK\");\r\n rest.cancelText = props.cancelText ?? i18n(\"Cancel\");\r\n break;\r\n case ModalDialogMode.YES_NO:\r\n rest.okText = props.okText ?? i18n(\"Yes\");\r\n rest.cancelText = props.cancelText ?? i18n(\"No\");\r\n break;\r\n case ModalDialogMode.OK:\r\n rest.okText = props.okText ?? i18n(\"OK\");\r\n rest.cancelButtonProps = undefined;\r\n break;\r\n }\r\n\r\n rest.okButtonProps = Object.assign(rest.okButtonProps !== undefined ? rest.okButtonProps : {}, {style: {marginRight: 8}});\r\n rest.cancelButtonProps = Object.assign(rest.cancelButtonProps !== undefined ? rest.cancelButtonProps : {}, {style: {float: \"right\"}});\r\n }\r\n return rest;\r\n }\r\n\r\n private static getModalFuncProperties(props: ModalDialogFuncProps, performClose: () => void) {\r\n const {mode, denyText, onDeny, ...rest} = props;\r\n switch (mode) {\r\n case ModalDialogMode.OK_CANCEL:\r\n rest.okText = rest.okText ?? i18n(\"OK\");\r\n rest.cancelText = rest.cancelText ?? i18n(\"Cancel\");\r\n break;\r\n case ModalDialogMode.YES_NO:\r\n rest.okText = rest.okText ?? i18n(\"Yes\");\r\n rest.cancelText = rest.cancelText ?? i18n(\"No\");\r\n break;\r\n case ModalDialogMode.YES_NO_CANCEL:\r\n rest.okText = rest.okText ?? i18n(\"Yes\");\r\n rest.cancelText = (<React.Fragment>\r\n <Button onClick={(e) => {\r\n e.preventDefault();\r\n e.stopPropagation();\r\n e.nativeEvent.stopImmediatePropagation();\r\n onDeny?.(e);\r\n performClose();\r\n }}>{denyText ?? i18n(\"No\")}</Button>\r\n <Button>{rest.cancelText ?? i18n(\"Cancel\")}</Button>\r\n </React.Fragment>\r\n );\r\n if (!rest.cancelButtonProps) {\r\n rest.cancelButtonProps = {};\r\n }\r\n rest.cancelButtonProps.type = \"text\";\r\n break;\r\n case ModalDialogMode.OK:\r\n rest.okText = props.okText ?? i18n(\"OK\");\r\n rest.cancelButtonProps = {style: {display: \"none\"}};\r\n }\r\n if (rest.autoFocusButton === undefined) {\r\n rest.autoFocusButton = \"ok\";\r\n }\r\n\r\n rest.okButtonProps = Object.assign(rest.okButtonProps !== undefined ? rest.okButtonProps : {}, {style: {marginRight: 8}});\r\n\r\n if (mode !== ModalDialogMode.OK) {\r\n rest.cancelButtonProps = Object.assign(rest.cancelButtonProps !== undefined ? rest.cancelButtonProps : {}, {style: {float: \"right\"}});\r\n }\r\n\r\n if (mode === ModalDialogMode.YES_NO_CANCEL) {\r\n if (rest.cancelButtonProps && rest.cancelButtonProps.style) {\r\n rest.cancelButtonProps.style.padding = 0;\r\n rest.cancelButtonProps.style.marginTop = -1;\r\n rest.cancelButtonProps.style.cursor = \"default\";\r\n rest.cancelButtonProps.style.background = \"transparent\";\r\n }\r\n }\r\n return rest;\r\n }\r\n}"]}
|
|
1
|
+
{"version":3,"file":"modalDialog.js","sour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i18n from \"d2core/i18n/i18n\";\r\nimport {DraggableModal} from \"d2coreui/components/modal/impl\";\r\nimport {HookAPI} from \"antd/es/modal/useModal\";\r\n\r\nexport const enum ModalDialogMode {\r\n NO_BUTTONS = \"NO_BUTTONS\",\r\n OK_CANCEL = \"OK_CANCEL\",\r\n YES_NO = \"YES_NO\",\r\n YES_NO_CANCEL = \"YES_NO_CANCEL\",\r\n OK = \"OK\",\r\n}\r\n\r\nexport interface ModalDialogFuncProps extends ModalFuncProps {\r\n mode: ModalDialogMode\r\n denyText?: string\r\n onDeny?: (...args: any[]) => any;\r\n}\r\n\r\nexport interface ModalDialogProps extends Omit<ModalProps, \"width\"> {\r\n mode: ModalDialogMode\r\n initialWidth?: number,\r\n initialHeight?: number\r\n\r\n // resize dialog handler\r\n onResize?(size: { width: number, height: number }): void\r\n}\r\n\r\nexport class ModalDialog extends React.Component<ModalDialogProps, {}> {\r\n private static modalStatic: HookAPI;\r\n\r\n constructor(props: Readonly<ModalDialogProps>) {\r\n super(props);\r\n }\r\n\r\n public static setModalInstance(instance: HookAPI) {\r\n ModalDialog.modalStatic = instance;\r\n }\r\n\r\n public static confirm(props: ModalDialogFuncProps): { destroy: () => void; update: (newConfig: ModalFuncProps) => void } {\r\n let dialogHandler: { destroy: () => void; update: (newConfig: ModalFuncProps) => void };\r\n const modalDialogProperties = ModalDialog.getModalFuncProperties(props, () => {\r\n dialogHandler?.destroy();\r\n });\r\n const method = ModalDialog.modalStatic ? ModalDialog.modalStatic.confirm : Modal.confirm;\r\n dialogHandler = method(modalDialogProperties);\r\n return dialogHandler;\r\n }\r\n\r\n public static error(props: ModalDialogFuncProps): { destroy: () => void; update: (newConfig: ModalFuncProps) => void } {\r\n let dialogHandler: { destroy: () => void; update: (newConfig: ModalFuncProps) => void };\r\n const modalDialogProperties = ModalDialog.getModalFuncProperties(props, () => {\r\n dialogHandler?.destroy();\r\n });\r\n const method = ModalDialog.modalStatic ? ModalDialog.modalStatic.error : Modal.error;\r\n dialogHandler = method(modalDialogProperties);\r\n return dialogHandler;\r\n }\r\n\r\n public static delete(props: ModalDialogFuncProps): { destroy: () => void; update: (newConfig: ModalFuncProps) => void } {\r\n let dialogHandler: { destroy: () => void; update: (newConfig: ModalFuncProps) => void };\r\n const modalDialogProperties = ModalDialog.getModalFuncProperties(props, () => {\r\n dialogHandler?.destroy();\r\n });\r\n const method = ModalDialog.modalStatic ? ModalDialog.modalStatic.confirm : Modal.confirm;\r\n if (props.okButtonProps) {\r\n props.okButtonProps.danger = true;\r\n }\r\n dialogHandler = method(modalDialogProperties);\r\n return dialogHandler;\r\n }\r\n\r\n public static success(props: ModalDialogFuncProps): { destroy: () => void; update: (newConfig: ModalFuncProps) => void } {\r\n let dialogHandler: { destroy: () => void; update: (newConfig: ModalFuncProps) => void };\r\n const modalDialogProperties = ModalDialog.getModalFuncProperties(props, () => {\r\n dialogHandler?.destroy();\r\n });\r\n const method = ModalDialog.modalStatic ? ModalDialog.modalStatic.success : Modal.success;\r\n dialogHandler = method(modalDialogProperties);\r\n return dialogHandler;\r\n }\r\n\r\n public static info(props: ModalDialogFuncProps): { destroy: () => void; update: (newConfig: ModalFuncProps) => void } {\r\n let dialogHandler: { destroy: () => void; update: (newConfig: ModalFuncProps) => void };\r\n const modalDialogProperties = ModalDialog.getModalFuncProperties(props, () => {\r\n dialogHandler?.destroy();\r\n });\r\n const method = ModalDialog.modalStatic ? ModalDialog.modalStatic.info : Modal.info;\r\n dialogHandler = method(modalDialogProperties);\r\n return dialogHandler;\r\n }\r\n\r\n render() {\r\n const modalDialogProperties = ModalDialog.getModalProperties(this.props);\r\n return (\r\n <DraggableModal {...modalDialogProperties}>\r\n {this.props.children}\r\n </DraggableModal>);\r\n }\r\n\r\n private static getModalProperties(props: ModalDialogProps) {\r\n const {mode, ...rest} = props;\r\n if (mode === ModalDialogMode.NO_BUTTONS) {\r\n if (rest.footer === undefined) {\r\n rest.footer = null;\r\n }\r\n } else {\r\n switch (mode) {\r\n case ModalDialogMode.OK_CANCEL:\r\n rest.okText = props.okText ?? i18n(\"OK\");\r\n rest.cancelText = props.cancelText ?? i18n(\"Cancel\");\r\n break;\r\n case ModalDialogMode.YES_NO:\r\n rest.okText = props.okText ?? i18n(\"Yes\");\r\n rest.cancelText = props.cancelText ?? i18n(\"No\");\r\n break;\r\n case ModalDialogMode.OK:\r\n rest.okText = props.okText ?? i18n(\"OK\");\r\n rest.cancelButtonProps = undefined;\r\n break;\r\n }\r\n\r\n rest.okButtonProps = Object.assign(rest.okButtonProps !== undefined ? rest.okButtonProps : {}, {style: {marginRight: 8}});\r\n rest.cancelButtonProps = Object.assign(rest.cancelButtonProps !== undefined ? rest.cancelButtonProps : {}, {style: {float: \"right\"}});\r\n }\r\n return rest;\r\n }\r\n\r\n private static getModalFuncProperties(props: ModalDialogFuncProps, performClose: () => void) {\r\n const {mode, denyText, onDeny, ...rest} = props;\r\n switch (mode) {\r\n case ModalDialogMode.OK_CANCEL:\r\n rest.okText = rest.okText ?? i18n(\"OK\");\r\n rest.cancelText = rest.cancelText ?? i18n(\"Cancel\");\r\n break;\r\n case ModalDialogMode.YES_NO:\r\n rest.okText = rest.okText ?? i18n(\"Yes\");\r\n rest.cancelText = rest.cancelText ?? i18n(\"No\");\r\n break;\r\n case ModalDialogMode.YES_NO_CANCEL:\r\n rest.okText = rest.okText ?? i18n(\"Yes\");\r\n rest.cancelText = (<React.Fragment>\r\n <Button onClick={(e) => {\r\n e.preventDefault();\r\n e.stopPropagation();\r\n e.nativeEvent.stopImmediatePropagation();\r\n onDeny?.(e);\r\n performClose();\r\n }}>{denyText ?? i18n(\"No\")}</Button>\r\n <Button>{rest.cancelText ?? i18n(\"Cancel\")}</Button>\r\n </React.Fragment>\r\n );\r\n if (!rest.cancelButtonProps) {\r\n rest.cancelButtonProps = {};\r\n }\r\n rest.cancelButtonProps.type = \"text\";\r\n break;\r\n case ModalDialogMode.OK:\r\n rest.okText = props.okText ?? i18n(\"OK\");\r\n rest.cancelButtonProps = {style: {display: \"none\"}};\r\n }\r\n if (rest.autoFocusButton === undefined) {\r\n rest.autoFocusButton = \"ok\";\r\n }\r\n\r\n rest.okButtonProps = Object.assign(rest.okButtonProps !== undefined ? rest.okButtonProps : {}, {style: {marginRight: 8}});\r\n\r\n if (mode !== ModalDialogMode.OK) {\r\n rest.cancelButtonProps = Object.assign(rest.cancelButtonProps !== undefined ? rest.cancelButtonProps : {}, {style: {float: \"right\"}});\r\n }\r\n\r\n if (mode === ModalDialogMode.YES_NO_CANCEL) {\r\n if (rest.cancelButtonProps && rest.cancelButtonProps.style) {\r\n rest.cancelButtonProps.style.padding = 0;\r\n rest.cancelButtonProps.style.marginTop = -1;\r\n rest.cancelButtonProps.style.cursor = \"default\";\r\n rest.cancelButtonProps.style.background = \"transparent\";\r\n }\r\n }\r\n return rest;\r\n }\r\n}"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "d2coreui",
|
|
3
|
-
"version": "23.0.
|
|
3
|
+
"version": "23.0.31",
|
|
4
4
|
"description": "Core UI components and utilities library.",
|
|
5
5
|
"author": "Ipesoft s.r.o.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
"@types/react-color": "3.0.12",
|
|
23
23
|
"@types/react-dom": "18.3.0",
|
|
24
24
|
"@types/react-resizable": "3.0.7",
|
|
25
|
-
"ag-grid-community": "
|
|
26
|
-
"ag-grid-react": "
|
|
25
|
+
"ag-grid-community": "34.3.1",
|
|
26
|
+
"ag-grid-react": "34.3.1",
|
|
27
27
|
"antd": "5.21.2",
|
|
28
28
|
"antd-style": "3.6.3",
|
|
29
29
|
"codemirror": "5.59.2",
|