ag-common 0.0.577 → 0.0.579

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.
@@ -4,4 +4,4 @@ import type { IConfirmDialog } from './types';
4
4
  * @param param0
5
5
  * @returns
6
6
  */
7
- export declare const ConfirmDialog: ({ bottomText, topText, }: IConfirmDialog) => Promise<boolean>;
7
+ export declare const ConfirmDialog: ({ bottomText, topText, style, }: IConfirmDialog) => Promise<boolean>;
@@ -22,7 +22,7 @@ const Modal_1 = require("./Modal");
22
22
  * @param param0
23
23
  * @returns
24
24
  */
25
- const ConfirmDialog = ({ bottomText, topText, }) => __awaiter(void 0, void 0, void 0, function* () {
25
+ const ConfirmDialog = ({ bottomText, topText, style, }) => __awaiter(void 0, void 0, void 0, function* () {
26
26
  return new Promise((res) => {
27
27
  const idName = 'ag-confirm-dialog';
28
28
  if (document.body.querySelectorAll('#' + idName).length !== 0) {
@@ -42,7 +42,7 @@ const ConfirmDialog = ({ bottomText, topText, }) => __awaiter(void 0, void 0, vo
42
42
  wrapper.remove();
43
43
  }
44
44
  };
45
- root.render(react_1.default.createElement(Modal_1.ConfirmModal, { bottomText: bottomText, topText: topText, onSubmit: onSubmit }));
45
+ root.render(react_1.default.createElement(Modal_1.ConfirmModal, { bottomText: bottomText, topText: topText, onSubmit: onSubmit, style: style }));
46
46
  });
47
47
  });
48
48
  exports.ConfirmDialog = ConfirmDialog;
@@ -1,3 +1,3 @@
1
1
  import React from 'react';
2
2
  import type { IConfirmModal } from './types';
3
- export declare const ConfirmModal: ({ onSubmit, bottomText, topText, okText, cancelText, }: IConfirmModal) => React.JSX.Element;
3
+ export declare const ConfirmModal: ({ onSubmit, bottomText, topText, okText, cancelText, style, }: IConfirmModal) => React.JSX.Element;
@@ -16,10 +16,11 @@ const Base = styled_1.default.div `
16
16
  max-width: 30rem;
17
17
  height: 50vh;
18
18
  max-height: 15rem;
19
- padding: 1rem;
20
19
  `;
21
20
  const Content = (0, styled_1.default)(FlexColumn_1.FlexColumn) `
22
- height: 100%;
21
+ padding: 1rem;
22
+ height: calc(100% - 2rem);
23
+ width: calc(100% - 2rem);
23
24
  `;
24
25
  const TopText = styled_1.default.div `
25
26
  font-weight: bold;
@@ -39,10 +40,10 @@ const Bottom = (0, styled_1.default)(FlexRow_1.FlexRow) `
39
40
  margin-right: 1rem;
40
41
  }
41
42
  `;
42
- const ConfirmModal = ({ onSubmit, bottomText, topText, okText = 'OK', cancelText = 'Cancel', }) => {
43
+ const ConfirmModal = ({ onSubmit, bottomText, topText, okText = 'OK', cancelText = 'Cancel', style, }) => {
43
44
  return (react_1.default.createElement(Modal_1.Modal, { position: "center", topPosition: "center", open: true, setOpen: () => onSubmit(false), showCloseButton: false, closeOnClickOutside: false },
44
45
  react_1.default.createElement(Base, null,
45
- react_1.default.createElement(Content, null,
46
+ react_1.default.createElement(Content, { style: style },
46
47
  topText && react_1.default.createElement(TopText, null, topText),
47
48
  react_1.default.createElement(BottomText, null, bottomText),
48
49
  react_1.default.createElement(Bottom, { noGrow: true },
@@ -1,7 +1,9 @@
1
+ import type { CSSProperties } from 'react';
1
2
  export interface IConfirmDialog {
2
3
  /** default (undefined) */
3
4
  topText?: string;
4
5
  bottomText: string;
6
+ style?: CSSProperties;
5
7
  }
6
8
  export interface IConfirmModal {
7
9
  onSubmit: (v: boolean) => void;
@@ -12,4 +14,5 @@ export interface IConfirmModal {
12
14
  okText?: string;
13
15
  /** default Cancel */
14
16
  cancelText?: string;
17
+ style?: CSSProperties;
15
18
  }
@@ -1,7 +1,2 @@
1
- export interface IPromptDialog {
2
- topText?: string;
3
- bottomText: string;
4
- defaultValue?: string;
5
- placeholder?: string;
6
- }
1
+ import type { IPromptDialog } from './types';
7
2
  export declare const PromptDialog: (p: IPromptDialog) => Promise<string | undefined>;
@@ -1,16 +1,3 @@
1
1
  import React from 'react';
2
- import type { Root } from 'react-dom/client';
3
- export interface IPromptModal {
4
- defaultValue?: string;
5
- placeholder?: string;
6
- res: (v: string | undefined) => void;
7
- root?: Root;
8
- wrapper?: HTMLDivElement;
9
- topText?: string;
10
- bottomText: string;
11
- /** default 'OK' */
12
- okText?: string;
13
- /** default "cancel" */
14
- cancelText?: string;
15
- }
16
- export declare const PromptModal: ({ root, wrapper, res, bottomText, topText, okText, cancelText, defaultValue, placeholder, }: IPromptModal) => React.JSX.Element;
2
+ import type { IPromptModal } from './types';
3
+ export declare const PromptModal: ({ root, wrapper, res, bottomText, topText, okText, cancelText, defaultValue, placeholder, style, }: IPromptModal) => React.JSX.Element;
@@ -40,10 +40,11 @@ const Base = styled_1.default.div `
40
40
  max-width: 30rem;
41
41
  height: 50vh;
42
42
  max-height: 15rem;
43
- padding: 1rem;
44
43
  `;
45
44
  const Content = (0, styled_1.default)(FlexColumn_1.FlexColumn) `
46
- height: 100%;
45
+ padding: 1rem;
46
+ height: calc(100% - 2rem);
47
+ width: calc(100% - 2rem);
47
48
  `;
48
49
  const TopText = styled_1.default.div `
49
50
  font-weight: bold;
@@ -63,7 +64,7 @@ const Bottom = (0, styled_1.default)(FlexRow_1.FlexRow) `
63
64
  margin-right: 1rem;
64
65
  }
65
66
  `;
66
- const PromptModal = ({ root, wrapper, res, bottomText, topText, okText = 'OK', cancelText = 'Cancel', defaultValue, placeholder, }) => {
67
+ const PromptModal = ({ root, wrapper, res, bottomText, topText, okText = 'OK', cancelText = 'Cancel', defaultValue, placeholder, style, }) => {
67
68
  const [text, setText] = (0, react_1.useState)(defaultValue || '');
68
69
  const ret = (v) => {
69
70
  try {
@@ -76,7 +77,7 @@ const PromptModal = ({ root, wrapper, res, bottomText, topText, okText = 'OK', c
76
77
  };
77
78
  return (react_1.default.createElement(Modal_1.Modal, { position: "center", topPosition: "center", open: true, setOpen: () => ret(undefined), showCloseButton: false, closeOnClickOutside: false },
78
79
  react_1.default.createElement(Base, null,
79
- react_1.default.createElement(Content, null,
80
+ react_1.default.createElement(Content, { style: style },
80
81
  topText && react_1.default.createElement(TopText, null, topText),
81
82
  react_1.default.createElement(BottomText, null, bottomText),
82
83
  react_1.default.createElement(TextEdit_1.TextEdit, { defaultValue: text, onSubmit: (c, enter) => {
@@ -1,2 +1,3 @@
1
1
  export * from './Dialog';
2
2
  export * from './Modal';
3
+ export * from './types';
@@ -16,3 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./Dialog"), exports);
18
18
  __exportStar(require("./Modal"), exports);
19
+ __exportStar(require("./types"), exports);
@@ -0,0 +1,23 @@
1
+ import type { CSSProperties } from 'react';
2
+ import type { Root } from 'react-dom/client';
3
+ export interface IPromptModal {
4
+ defaultValue?: string;
5
+ placeholder?: string;
6
+ res: (v: string | undefined) => void;
7
+ root?: Root;
8
+ wrapper?: HTMLDivElement;
9
+ topText?: string;
10
+ bottomText: string;
11
+ /** default 'OK' */
12
+ okText?: string;
13
+ /** default "cancel" */
14
+ cancelText?: string;
15
+ style?: CSSProperties;
16
+ }
17
+ export interface IPromptDialog {
18
+ topText?: string;
19
+ bottomText: string;
20
+ defaultValue?: string;
21
+ placeholder?: string;
22
+ style?: CSSProperties;
23
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -20,7 +20,7 @@ const stream_1 = require("../../../common/helpers/stream");
20
20
  */
21
21
  const apiResponseToAxiosResponse = (p) => __awaiter(void 0, void 0, void 0, function* () {
22
22
  try {
23
- var r = yield p();
23
+ const r = yield p();
24
24
  const r1 = {
25
25
  status: r.raw.status,
26
26
  statusText: r.raw.statusText,
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.0.577",
2
+ "version": "0.0.579",
3
3
  "name": "ag-common",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
@@ -55,10 +55,10 @@
55
55
  "@types/jest": "29.5.11",
56
56
  "@types/jsonwebtoken": "9.0.5",
57
57
  "@types/node": "20.10.5",
58
- "@types/react": "18.2.45",
58
+ "@types/react": "18.2.46",
59
59
  "@types/react-dom": "18.2.18",
60
60
  "cross-env": "7.0.3",
61
- "eslint-config-e7npm": "0.0.69",
61
+ "eslint-config-e7npm": "0.0.70",
62
62
  "jest": "29.7.0",
63
63
  "rimraf": "5.0.5",
64
64
  "storybook": "7.6.6",