cloudmr-ux 0.0.3 → 1.0.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 (67) hide show
  1. package/README.md +24 -16
  2. package/dist/index.975ef6c8.js +75418 -0
  3. package/dist/index.975ef6c8.js.map +1 -0
  4. package/dist/index.css +140 -14
  5. package/dist/index.d.ts +58 -0
  6. package/dist/index.db9ed22c.css +171 -0
  7. package/dist/index.db9ed22c.css.map +1 -0
  8. package/dist/index.html +13 -0
  9. package/dist/index.js +170 -141
  10. package/dist/index.mjs +157 -0
  11. package/package.json +39 -99
  12. package/dist/index.js.map +0 -1
  13. package/dist/index.modern.js +0 -147
  14. package/dist/index.modern.js.map +0 -1
  15. package/src/.eslintrc +0 -5
  16. package/src/common/components/Cmr-components/avatar/Avatar.scss +0 -0
  17. package/src/common/components/Cmr-components/avatar/Avatar.tsx +0 -25
  18. package/src/common/components/Cmr-components/button/Button.scss +0 -0
  19. package/src/common/components/Cmr-components/button/Button.tsx +0 -14
  20. package/src/common/components/Cmr-components/checkbox/Checkbox.scss +0 -11
  21. package/src/common/components/Cmr-components/checkbox/Checkbox.tsx +0 -29
  22. package/src/common/components/Cmr-components/collapse/Collapse.scss +0 -3
  23. package/src/common/components/Cmr-components/collapse/Collapse.tsx +0 -75
  24. package/src/common/components/Cmr-components/dialogue/Confirmation.tsx +0 -48
  25. package/src/common/components/Cmr-components/dialogue/DeletionDialog.tsx +0 -61
  26. package/src/common/components/Cmr-components/dialogue/EditConfirmation.tsx +0 -72
  27. package/src/common/components/Cmr-components/double-slider/DualSlider.tsx +0 -198
  28. package/src/common/components/Cmr-components/double-slider/InvertibleDualSlider.tsx +0 -224
  29. package/src/common/components/Cmr-components/dropdown/Dropdown.scss +0 -36
  30. package/src/common/components/Cmr-components/dropdown/Dropdown.tsx +0 -83
  31. package/src/common/components/Cmr-components/gui-slider/ControlledSlider.tsx +0 -139
  32. package/src/common/components/Cmr-components/gui-slider/Slider.tsx +0 -170
  33. package/src/common/components/Cmr-components/header/Header.scss +0 -20
  34. package/src/common/components/Cmr-components/header/Header.tsx +0 -101
  35. package/src/common/components/Cmr-components/input/Input.scss +0 -0
  36. package/src/common/components/Cmr-components/input/Input.tsx +0 -39
  37. package/src/common/components/Cmr-components/input-number/InputNumber.scss +0 -0
  38. package/src/common/components/Cmr-components/input-number/InputNumber.tsx +0 -29
  39. package/src/common/components/Cmr-components/label/Label.scss +0 -13
  40. package/src/common/components/Cmr-components/label/Label.tsx +0 -20
  41. package/src/common/components/Cmr-components/option/Option.scss +0 -0
  42. package/src/common/components/Cmr-components/option/Option.tsx +0 -24
  43. package/src/common/components/Cmr-components/panel/Panel.scss +0 -0
  44. package/src/common/components/Cmr-components/panel/Panel.tsx +0 -54
  45. package/src/common/components/Cmr-components/progress/Progress.scss +0 -0
  46. package/src/common/components/Cmr-components/progress/Progress.tsx +0 -38
  47. package/src/common/components/Cmr-components/radio/Radio.scss +0 -0
  48. package/src/common/components/Cmr-components/radio/Radio.tsx +0 -23
  49. package/src/common/components/Cmr-components/radio-group/RadioGroup.scss +0 -0
  50. package/src/common/components/Cmr-components/radio-group/RadioGroup.tsx +0 -32
  51. package/src/common/components/Cmr-components/rename/edit.tsx +0 -94
  52. package/src/common/components/Cmr-components/select/Select.scss +0 -3
  53. package/src/common/components/Cmr-components/select/Select.tsx +0 -33
  54. package/src/common/components/Cmr-components/select-upload/SelectUpload.scss +0 -0
  55. package/src/common/components/Cmr-components/select-upload/SelectUpload.tsx +0 -133
  56. package/src/common/components/Cmr-components/slider/Slider.scss +0 -0
  57. package/src/common/components/Cmr-components/slider/Slider.tsx +0 -66
  58. package/src/common/components/Cmr-components/spin/Spin.scss +0 -0
  59. package/src/common/components/Cmr-components/spin/Spin.tsx +0 -31
  60. package/src/common/components/Cmr-components/tooltip/Tooltip.scss +0 -0
  61. package/src/common/components/Cmr-components/tooltip/Tooltip.tsx +0 -50
  62. package/src/common/components/Cmr-components/upload/Upload.scss +0 -5
  63. package/src/common/components/Cmr-components/upload/Upload.tsx +0 -188
  64. package/src/common/components/Cmr-components/upload/UploadWindow.tsx +0 -355
  65. package/src/index.js +0 -8
  66. package/src/index.test.js +0 -7
  67. package/src/styles.module.css +0 -9
@@ -1,147 +0,0 @@
1
- import React, { cloneElement } from 'react';
2
- import { Button, FormControlLabel, Checkbox } from '@mui/material';
3
- import { Input } from 'antd';
4
- import 'antd/lib/config-provider/SizeContext';
5
- import 'antd/lib/_util/type';
6
- import 'antd/es/checkbox';
7
- import 'antd/es/collapse/CollapsePanel';
8
- import 'antd/es/collapse/Collapse';
9
-
10
- function _extends() {
11
- return _extends = Object.assign ? Object.assign.bind() : function (n) {
12
- for (var e = 1; e < arguments.length; e++) {
13
- var t = arguments[e];
14
- for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
15
- }
16
- return n;
17
- }, _extends.apply(null, arguments);
18
- }
19
-
20
- const CmrButton = props => {
21
- const {
22
- children,
23
- onClick,
24
- ...rest
25
- } = props;
26
- return /*#__PURE__*/React.createElement(Button, _extends({
27
- onClick: onClick
28
- }, rest, {
29
- style: {
30
- ...props.style,
31
- textTransform: 'none'
32
- }
33
- }), children);
34
- };
35
-
36
- const CmrInput = props => {
37
- const {
38
- defaultValue,
39
- id,
40
- maxLength,
41
- size,
42
- value,
43
- type,
44
- prefix,
45
- bordered,
46
- onChange,
47
- onPressEnter,
48
- ...rest
49
- } = props;
50
- return /*#__PURE__*/React.createElement(Input, _extends({
51
- defaultValue: defaultValue,
52
- id: id,
53
- maxLength: maxLength,
54
- size: size,
55
- value: value,
56
- type: type,
57
- prefix: prefix,
58
- bordered: bordered,
59
- onChange: onChange,
60
- onPressEnter: onPressEnter
61
- }, rest));
62
- };
63
-
64
- const CmrCheckbox = props => {
65
- const {
66
- defaultChecked,
67
- onChange,
68
- children,
69
- ...rest
70
- } = props;
71
- return /*#__PURE__*/React.createElement(FormControlLabel, {
72
- disabled: props.disabled,
73
- style: props.style,
74
- className: props.className,
75
- control: /*#__PURE__*/React.createElement(Checkbox, {
76
- style: props.style,
77
- checked: props.checked,
78
- defaultChecked: defaultChecked,
79
- onChange: onChange
80
- }),
81
- label: /*#__PURE__*/React.createElement("span", {
82
- className: "cmr-label",
83
- style: {
84
- paddingRight: 0,
85
- color: 'var(--bs-card-color)'
86
- }
87
- }, props.children),
88
- labelPlacement: "start"
89
- });
90
- };
91
-
92
- const CmrCollapse = props => {
93
- let {
94
- activeKey,
95
- defaultActiveKey,
96
- onChange,
97
- children
98
- } = props;
99
- defaultActiveKey = defaultActiveKey ? defaultActiveKey : [];
100
- let [activeKeys, setActiveKeys] = React.useState(defaultActiveKey);
101
- if (activeKey != undefined && activeKey != activeKeys) {
102
- console.log(activeKey);
103
- if (activeKey instanceof Array) setActiveKeys(activeKey);else setActiveKeys([activeKey]);
104
- }
105
- return /*#__PURE__*/React.createElement("div", {
106
- className: "cmr-collapse"
107
- }, /*#__PURE__*/React.createElement("div", null, children && Array.isArray(children) ? children.map((child, index) => {
108
- let props = {
109
- expanded: activeKeys.indexOf(index) >= 0,
110
- panelKey: index,
111
- onToggle: key => {
112
- let i = activeKeys.indexOf(key);
113
- if (i < 0) {
114
- let newKeys = [...activeKeys];
115
- newKeys.push(index);
116
- setActiveKeys(newKeys);
117
- if (onChange != undefined) onChange(newKeys);
118
- } else {
119
- let newKeys = [...activeKeys];
120
- newKeys.splice(i, 1);
121
- setActiveKeys(newKeys);
122
- if (onChange != undefined) onChange(newKeys);
123
- }
124
- }
125
- };
126
- return cloneElement(child, props);
127
- }) : children ? cloneElement(children, {
128
- expanded: activeKeys.indexOf(0) >= 0,
129
- panelKey: 0,
130
- onToggle: key => {
131
- let i = activeKeys.indexOf(key);
132
- if (i < 0) {
133
- let newKeys = [...activeKeys];
134
- newKeys.push(0);
135
- setActiveKeys(newKeys);
136
- } else {
137
- let newKeys = [...activeKeys];
138
- newKeys.splice(i, 1);
139
- setActiveKeys(newKeys);
140
- }
141
- if (onChange != undefined) onChange([0]);
142
- }
143
- }) : undefined));
144
- };
145
-
146
- export { CmrButton, CmrCheckbox, CmrCollapse, CmrInput };
147
- //# sourceMappingURL=index.modern.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.modern.js","sources":["../src/common/components/Cmr-components/button/Button.tsx","../src/common/components/Cmr-components/input/Input.tsx","../src/common/components/Cmr-components/checkbox/Checkbox.tsx","../src/common/components/Cmr-components/collapse/Collapse.tsx"],"sourcesContent":["import React from 'react';\nimport '../button/Button.scss';\nimport { Button, ButtonProps } from '@mui/material';\n\nexport const CmrButton = (props: ButtonProps) => {\n const { children, onClick, ...rest } = props;\n\n return (\n <Button onClick={onClick} {...rest} style={{...props.style, textTransform:'none'}}>\n {children}\n </Button>\n );\n};\n\n","import React from 'react';\nimport './Input.scss';\nimport { Input } from 'antd';\nimport { SizeType } from 'antd/lib/config-provider/SizeContext';\nimport { LiteralUnion } from 'antd/lib/_util/type';\n\ninterface CmrInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'prefix' | 'type'> {\n defaultValue?: string;\n id?: string;\n maxLength?: number;\n size?: SizeType;\n value?: string;\n type?: any;\n prefix?: React.ReactNode;\n bordered?: boolean;\n onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;\n onPressEnter?: (e: React.KeyboardEvent<HTMLInputElement>) => void;\n}\n\nexport const CmrInput = (props: CmrInputProps) => {\n const { defaultValue, id, maxLength, size, value, type, prefix, bordered, onChange, onPressEnter, ...rest } = props;\n\n return (\n <Input\n defaultValue={defaultValue}\n id={id}\n maxLength={maxLength}\n size={size}\n value={value}\n type={type}\n prefix={prefix}\n bordered={bordered}\n onChange={onChange}\n onPressEnter={onPressEnter}\n {...rest}\n />\n );\n};\n\n","import React, {ChangeEvent} from 'react';\nimport { Checkbox } from '@mui/material';\nimport './Checkbox.scss';\nimport { CheckboxChangeEvent } from 'antd/es/checkbox';\nimport { FormControlLabel } from '@mui/material';\n\ninterface CmrCheckboxProps extends React.HTMLAttributes<HTMLDivElement>{\n autoFocus?: boolean;\n checked?: boolean;\n defaultChecked?: boolean;\n disabled?: boolean;\n indeterminate?: boolean;\n onChange?: (event: ChangeEvent<HTMLInputElement>) => void;\n children?: any;\n style?: any;\n}\n\nexport const CmrCheckbox = (props: CmrCheckboxProps) => {\n const { defaultChecked, onChange, children, ...rest } = props;\n\n return (\n <FormControlLabel disabled={props.disabled} style={props.style} className={props.className} control={<Checkbox style={props.style} checked={props.checked} defaultChecked={defaultChecked} onChange={onChange}/>}\n label={<span className='cmr-label' style={{paddingRight:0, color:'var(--bs-card-color)'}}>\n {props.children}\n </span>}\n labelPlacement=\"start\"/>\n );\n};\n\n","import React, {cloneElement} from 'react';\nimport { Collapse } from 'antd';\nimport { CollapsibleType } from 'antd/es/collapse/CollapsePanel';\nimport { ExpandIconPosition } from 'antd/es/collapse/Collapse';\nimport './Collapse.scss';\n\ninterface CmrCollapseProps {\n accordion?: boolean;\n activeKey?: Array<string | number>|number;\n bordered?: boolean;\n collapsible?: CollapsibleType;\n defaultActiveKey?: Array<string | number>;\n destroyInactivePanel?: boolean;\n expandIconPosition?: ExpandIconPosition;\n ghost?: boolean;\n onChange?: (key:Array<string | number>|number) => void;\n children?: JSX.Element[]|JSX.Element;\n}\n\nexport const CmrCollapse = (props: CmrCollapseProps) => {\n let {activeKey, defaultActiveKey, onChange, children}=props;\n defaultActiveKey = (defaultActiveKey)?defaultActiveKey:[];\n let [activeKeys, setActiveKeys] = React.useState(defaultActiveKey);\n if(activeKey!=undefined&&activeKey!=activeKeys){\n console.log(activeKey);\n if(activeKey instanceof Array)\n setActiveKeys(activeKey);\n else setActiveKeys([activeKey]);\n }\n return (\n <div className=\"cmr-collapse\">\n <div>\n {(children&&Array.isArray(children))?children.map((child,index)=>{\n let props = {expanded:activeKeys.indexOf(index)>=0,\n panelKey: index,\n onToggle: (key:number)=>{\n let i = activeKeys.indexOf(key);\n if(i<0) {\n let newKeys = [...activeKeys];\n newKeys.push(index);\n setActiveKeys(newKeys);\n if(onChange!=undefined)\n onChange(newKeys);\n }\n else {\n let newKeys = [...activeKeys];\n newKeys.splice(i,1);\n setActiveKeys(newKeys);\n if(onChange!=undefined)\n onChange(newKeys);\n }\n }};\n return cloneElement(child, props)\n }):((children?cloneElement(children,{expanded:activeKeys.indexOf(0)>=0,\n panelKey: 0,\n onToggle: (key:number)=>{\n let i = activeKeys.indexOf(key);\n if(i<0) {\n let newKeys = [...activeKeys];\n newKeys.push(0);\n setActiveKeys(newKeys);\n }\n else {\n let newKeys = [...activeKeys];\n newKeys.splice(i,1);\n setActiveKeys(newKeys);\n }\n if(onChange!=undefined)\n onChange([0]);\n }}):undefined))}\n </div>\n </div>\n );\n};\n\n"],"names":["CmrButton","props","children","onClick","rest","React","createElement","Button","_extends","style","textTransform","CmrInput","defaultValue","id","maxLength","size","value","type","prefix","bordered","onChange","onPressEnter","Input","CmrCheckbox","defaultChecked","FormControlLabel","disabled","className","control","Checkbox","checked","label","paddingRight","color","labelPlacement","CmrCollapse","activeKey","defaultActiveKey","activeKeys","setActiveKeys","useState","undefined","console","log","Array","isArray","map","child","index","expanded","indexOf","panelKey","onToggle","key","i","newKeys","push","splice","cloneElement"],"mappings":";;;;;;;;;;;;;;;;;;;MAIaA,SAAS,GAAIC,KAAkB,IAAK;EAC7C,MAAM;IAAEC,QAAQ;IAAEC,OAAO;IAAE,GAAGC;GAAM,GAAGH,KAAK;EAE5C,oBACII,KAAA,CAAAC,aAAA,CAACC,MAAM,EAAAC,QAAA;IAACL,OAAO,EAAEA;KAAaC,IAAI;IAAEK,KAAK,EAAE;MAAC,GAAGR,KAAK,CAACQ,KAAK;MAAEC,aAAa,EAAC;;MACrER,QACG,CAAC;AAEjB;;MCOaS,QAAQ,GAAIV,KAAoB,IAAK;EAC9C,MAAM;IAAEW,YAAY;IAAEC,EAAE;IAAEC,SAAS;IAAEC,IAAI;IAAEC,KAAK;IAAEC,IAAI;IAAEC,MAAM;IAAEC,QAAQ;IAAEC,QAAQ;IA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,CAACmC,OAAO,CAAC;;;KAE3B;IACd,OAAOG,YAAY,CAACX,KAAK,EAAE9C,KAAK,CAAC;GACpC,CAAC,GAAGC,QAAQ,GAACwD,YAAY,CAACxD,QAAQ,EAAC;IAAC+C,QAAQ,EAACX,UAAU,CAACY,OAAO,CAAC,CAAC,CAAC,IAAE,CAAC;IAClEC,QAAQ,EAAE,CAAC;IACXC,QAAQ,EAAGC,GAAU,IAAG;MACpB,IAAIC,CAAC,GAAGhB,UAAU,CAACY,OAAO,CAACG,GAAG,CAAC;MAC/B,IAAGC,CAAC,GAAC,CAAC,EAAE;QACJ,IAAIC,OAAO,GAAG,CAAC,GAAGjB,UAAU,CAAC;QAC7BiB,OAAO,CAACC,IAAI,CAAC,CAAC,CAAC;QACfjB,aAAa,CAACgB,OAAO,CAAC;OACzB,MACI;QACD,IAAIA,OAAO,GAAG,CAAC,GAAGjB,UAAU,CAAC;QAC7BiB,OAAO,CAACE,MAAM,CAACH,CAAC,EAAC,CAAC,CAAC;QACnBf,aAAa,CAACgB,OAAO,CAAC;;MAE1B,IAAGnC,QAAQ,IAAEqB,SAAS,EAClBrB,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;;GACnB,CAAC,GAACqB,SACP,CACJ,CAAC;AAEd,CAAC;;;;"}
package/src/.eslintrc DELETED
@@ -1,5 +0,0 @@
1
- {
2
- "env": {
3
- "jest": true
4
- }
5
- }
@@ -1,25 +0,0 @@
1
- import React from 'react';
2
- import './Avatar.scss';
3
- import { Avatar } from 'antd';
4
- //@ts-ignore
5
- import { AvatarSize } from 'antd/lib/avatar/SizeContext';
6
-
7
- interface CmrAvatarProps {
8
- icon?: React.ReactNode;
9
- shape?: 'circle' | 'square';
10
- size?: AvatarSize;
11
- gap?: number;
12
- src?: React.ReactNode;
13
- children?: React.ReactNode;
14
- }
15
-
16
- export const CmrAvatar = (props: CmrAvatarProps) => {
17
- const { icon, shape, size, gap, src, children, ...rest } = props;
18
-
19
- return (
20
- <Avatar icon={icon} shape={shape} size={size} gap={gap} src={src} {...rest}>
21
- {children}
22
- </Avatar>
23
- );
24
- };
25
-
@@ -1,14 +0,0 @@
1
- import React from 'react';
2
- import '../button/Button.scss';
3
- import { Button, ButtonProps } from '@mui/material';
4
-
5
- export const CmrButton = (props: ButtonProps) => {
6
- const { children, onClick, ...rest } = props;
7
-
8
- return (
9
- <Button onClick={onClick} {...rest} style={{...props.style, textTransform:'none'}}>
10
- {children}
11
- </Button>
12
- );
13
- };
14
-
@@ -1,11 +0,0 @@
1
- .cmr-checkbox {
2
- margin-bottom: 4px;
3
- &__text {
4
- font-style: normal;
5
- font-weight: 500;
6
- font-size: 16px;
7
- line-height: 15px;
8
- text-align: justify;
9
- color: #707683;
10
- }
11
- }
@@ -1,29 +0,0 @@
1
- import React, {ChangeEvent} from 'react';
2
- import { Checkbox } from '@mui/material';
3
- import './Checkbox.scss';
4
- import { CheckboxChangeEvent } from 'antd/es/checkbox';
5
- import { FormControlLabel } from '@mui/material';
6
-
7
- interface CmrCheckboxProps extends React.HTMLAttributes<HTMLDivElement>{
8
- autoFocus?: boolean;
9
- checked?: boolean;
10
- defaultChecked?: boolean;
11
- disabled?: boolean;
12
- indeterminate?: boolean;
13
- onChange?: (event: ChangeEvent<HTMLInputElement>) => void;
14
- children?: any;
15
- style?: any;
16
- }
17
-
18
- export const CmrCheckbox = (props: CmrCheckboxProps) => {
19
- const { defaultChecked, onChange, children, ...rest } = props;
20
-
21
- return (
22
- <FormControlLabel disabled={props.disabled} style={props.style} className={props.className} control={<Checkbox style={props.style} checked={props.checked} defaultChecked={defaultChecked} onChange={onChange}/>}
23
- label={<span className='cmr-label' style={{paddingRight:0, color:'var(--bs-card-color)'}}>
24
- {props.children}
25
- </span>}
26
- labelPlacement="start"/>
27
- );
28
- };
29
-
@@ -1,3 +0,0 @@
1
- .collapse-bar {
2
- margin-bottom: 4px;
3
- }
@@ -1,75 +0,0 @@
1
- import React, {cloneElement} from 'react';
2
- import { Collapse } from 'antd';
3
- import { CollapsibleType } from 'antd/es/collapse/CollapsePanel';
4
- import { ExpandIconPosition } from 'antd/es/collapse/Collapse';
5
- import './Collapse.scss';
6
-
7
- interface CmrCollapseProps {
8
- accordion?: boolean;
9
- activeKey?: Array<string | number>|number;
10
- bordered?: boolean;
11
- collapsible?: CollapsibleType;
12
- defaultActiveKey?: Array<string | number>;
13
- destroyInactivePanel?: boolean;
14
- expandIconPosition?: ExpandIconPosition;
15
- ghost?: boolean;
16
- onChange?: (key:Array<string | number>|number) => void;
17
- children?: JSX.Element[]|JSX.Element;
18
- }
19
-
20
- export const CmrCollapse = (props: CmrCollapseProps) => {
21
- let {activeKey, defaultActiveKey, onChange, children}=props;
22
- defaultActiveKey = (defaultActiveKey)?defaultActiveKey:[];
23
- let [activeKeys, setActiveKeys] = React.useState(defaultActiveKey);
24
- if(activeKey!=undefined&&activeKey!=activeKeys){
25
- console.log(activeKey);
26
- if(activeKey instanceof Array)
27
- setActiveKeys(activeKey);
28
- else setActiveKeys([activeKey]);
29
- }
30
- return (
31
- <div className="cmr-collapse">
32
- <div>
33
- {(children&&Array.isArray(children))?children.map((child,index)=>{
34
- let props = {expanded:activeKeys.indexOf(index)>=0,
35
- panelKey: index,
36
- onToggle: (key:number)=>{
37
- let i = activeKeys.indexOf(key);
38
- if(i<0) {
39
- let newKeys = [...activeKeys];
40
- newKeys.push(index);
41
- setActiveKeys(newKeys);
42
- if(onChange!=undefined)
43
- onChange(newKeys);
44
- }
45
- else {
46
- let newKeys = [...activeKeys];
47
- newKeys.splice(i,1);
48
- setActiveKeys(newKeys);
49
- if(onChange!=undefined)
50
- onChange(newKeys);
51
- }
52
- }};
53
- return cloneElement(child, props)
54
- }):((children?cloneElement(children,{expanded:activeKeys.indexOf(0)>=0,
55
- panelKey: 0,
56
- onToggle: (key:number)=>{
57
- let i = activeKeys.indexOf(key);
58
- if(i<0) {
59
- let newKeys = [...activeKeys];
60
- newKeys.push(0);
61
- setActiveKeys(newKeys);
62
- }
63
- else {
64
- let newKeys = [...activeKeys];
65
- newKeys.splice(i,1);
66
- setActiveKeys(newKeys);
67
- }
68
- if(onChange!=undefined)
69
- onChange([0]);
70
- }}):undefined))}
71
- </div>
72
- </div>
73
- );
74
- };
75
-
@@ -1,48 +0,0 @@
1
- import * as React from 'react';
2
- import TextField from '@mui/material/TextField';
3
- import Dialog from '@mui/material/Dialog';
4
- import DialogActions from '@mui/material/DialogActions';
5
- import DialogContent from '@mui/material/DialogContent';
6
- import DialogContentText from '@mui/material/DialogContentText';
7
- import DialogTitle from '@mui/material/DialogTitle';
8
- import CmrButton from '../button/Button';
9
- import {StyledComponentProps} from "@mui/material";
10
-
11
- export default function Confirmation({ name,message,cancelText='Cancel',
12
- color, open, setOpen, confirmCallback=()=>{},confirmText='Confirm', cancellable=false, cancelCallback=()=>{}, width}: { name: string | undefined; cancelText?:string; message:string|undefined;
13
- color?: "inherit" | "primary" | "secondary" | "success" | "error" | "info" | "warning" | undefined, open:boolean, setOpen:(open:boolean)=>void, confirmCallback?:()=>void,
14
- cancellable?:boolean, cancelCallback?:()=>void, width?:number, confirmText?:string}) {
15
- const [text, setText] = React.useState('');
16
-
17
- const handleClose = () => {
18
- setOpen(false);
19
- };
20
-
21
- const handleConfirm=()=>{
22
- confirmCallback();
23
- handleClose();
24
- }
25
-
26
- const handleCancel=()=>{
27
- cancelCallback();
28
- handleClose();
29
- }
30
-
31
-
32
- return (
33
- <Dialog open={open} onClose={handleClose}>
34
- <DialogTitle>{name?name:'Confirmation'}</DialogTitle>
35
- <DialogContent sx={{width:width}}>
36
- <DialogContentText alignContent={'center'}>
37
- {message}
38
- </DialogContentText>
39
- <DialogActions className={'mt-4'}>
40
- {cancellable&&
41
- <CmrButton variant={"outlined"} color={'inherit'} sx={{color:'#333'}} onClick={handleCancel}>{cancelText}</CmrButton>
42
- }
43
- <CmrButton variant={"contained"} color={color} onClick={handleConfirm}>{confirmText}</CmrButton>
44
- </DialogActions>
45
- </DialogContent>
46
- </Dialog>
47
- );
48
- }
@@ -1,61 +0,0 @@
1
- import * as React from 'react';
2
- import Button from '@mui/material/Button';
3
- import TextField from '@mui/material/TextField';
4
- import Dialog from '@mui/material/Dialog';
5
- import DialogActions from '@mui/material/DialogActions';
6
- import DialogContent from '@mui/material/DialogContent';
7
- import DialogContentText from '@mui/material/DialogContentText';
8
- import DialogTitle from '@mui/material/DialogTitle';
9
-
10
- export default function DeletionDialog(props: { name: string | undefined; deletionCallback: () => void; }) {
11
- const [open, setOpen] = React.useState(true);
12
- const [text, setText] = React.useState('');
13
-
14
- const handleClickOpen = () => {
15
- setOpen(true);
16
- };
17
-
18
- const handleClose = () => {
19
- setOpen(false);
20
- };
21
-
22
- const handleConfirm = () => {
23
- if(text===props.name){
24
- props.deletionCallback();
25
- setOpen(false);
26
- }
27
- };
28
-
29
- const handleTextFieldChange=(e: { target: { value: React.SetStateAction<string>; }; })=>{
30
- setText( e.target.value);
31
- }
32
-
33
- return (
34
- <div>
35
- <Dialog open={open} onClose={handleClose}>
36
- <DialogTitle>Confirmation</DialogTitle>
37
- <DialogContent>
38
- <DialogContentText>
39
- To delete the files, please type your full name below and confirm.
40
- </DialogContentText>
41
-
42
- <TextField
43
- autoFocus
44
- margin="dense"
45
- id="name"
46
- type="email"
47
- placeholder = {props.name}
48
- fullWidth
49
- inputProps={{style: {fontSize: "16pt"}}}
50
- variant="standard"
51
- onChange={handleTextFieldChange}
52
- />
53
- </DialogContent>
54
- <DialogActions>
55
- <button className='btn btn-secondary' onClick={handleClose}>Cancel</button>
56
- <button className='btn btn-danger' onClick={handleConfirm}>Confirm</button>
57
- </DialogActions>
58
- </Dialog>
59
- </div>
60
- );
61
- }
@@ -1,72 +0,0 @@
1
- import * as React from 'react';
2
- import TextField from '@mui/material/TextField';
3
- import Dialog from '@mui/material/Dialog';
4
- import DialogActions from '@mui/material/DialogActions';
5
- import DialogContent from '@mui/material/DialogContent';
6
- import DialogContentText from '@mui/material/DialogContentText';
7
- import DialogTitle from '@mui/material/DialogTitle';
8
- import CmrButton from '../button/Button';
9
- import { InputAdornment } from '@mui/material';
10
- import {useEffect} from "react";
11
-
12
- export interface EditConfirmationProps{
13
- name?: string; // Equivalent to string | undefined
14
- defaultText?: string;
15
- message?: string;
16
- color?: "inherit" | "primary" | "secondary" | "success" | "error" | "info" | "warning";
17
- open: boolean;
18
- setOpen: (open: boolean) => void;
19
- confirmCallback?: (text: string) => void;
20
- cancellable?: boolean;
21
- cancelCallback?: (edit: string) => void;
22
- suffix?:string;
23
- }
24
-
25
- export default function EditConfirmation({ name,message, defaultText='',
26
- color, open, setOpen, confirmCallback=()=>{}, cancellable=false, cancelCallback=()=>{},suffix=''}:EditConfirmationProps) {
27
- const [text, setText] = React.useState(defaultText);
28
- useEffect(() => {
29
- if(open)
30
- setText(defaultText);
31
- }, [open]);
32
- const handleClose = () => {
33
- setOpen(false);
34
- };
35
-
36
- const handleConfirm=()=>{
37
- confirmCallback(text+suffix);
38
- handleClose();
39
- }
40
-
41
- const handleCancel=()=>{
42
- cancelCallback(text+suffix);
43
- handleClose();
44
- }
45
-
46
-
47
- return (
48
- <Dialog maxWidth="xs" fullWidth={true} open={open} onClose={handleCancel}>
49
- <DialogTitle>{name?name:'Confirmation'}</DialogTitle>
50
- <DialogContent>
51
- <DialogContentText alignContent={'center'}>
52
- {message}
53
- </DialogContentText>
54
- <DialogActions>
55
- <TextField fullWidth variant='standard'
56
- InputProps={{
57
- endAdornment: (
58
- <InputAdornment position="end" sx={{ whiteSpace: 'nowrap' }}>{suffix}</InputAdornment>
59
- ),
60
- }}
61
- defaultValue={text} onChange={(e)=>setText(e.target.value)}/>
62
- </DialogActions>
63
- <DialogActions>
64
- {cancellable&&
65
- <CmrButton variant={"outlined"} color={'inherit'} sx={{color:'#333'}} onClick={handleCancel}>Cancel</CmrButton>
66
- }
67
- <CmrButton variant={"contained"} color={color} onClick={handleConfirm}>Confirm</CmrButton>
68
- </DialogActions>
69
- </DialogContent>
70
- </Dialog>
71
- );
72
- }