@daoyi/nmtl-ui 2.0.1-beta.2 → 2.0.1-beta.20
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/README.md +45 -45
- package/lib/components/Autocomplete.js +1 -1
- package/lib/components/Avatar.js +1 -1
- package/lib/components/BackTop.js +1 -1
- package/lib/components/BarChart.js +1 -1
- package/lib/components/Breadcrumbs.js +1 -1
- package/lib/components/Button.js +1 -1
- package/lib/components/Carousel.js +1 -1
- package/lib/components/Checkbox.js +1 -1
- package/lib/components/CollapseContent.js +1 -1
- package/lib/components/ContactModal.js +2 -2
- package/lib/components/Drawer.js +1 -1
- package/lib/components/Dropdown.js +1 -1
- package/lib/components/Empty-a053f253.js +1 -0
- package/lib/components/ExportButton.js +1 -1
- package/lib/components/ExtraTools.js +4 -4
- package/lib/components/Footer.js +1 -1
- package/lib/components/Header.js +1 -1
- package/lib/components/Image.js +1 -1
- package/lib/components/Input.js +1 -1
- package/lib/components/InputMethod.js +3 -3
- package/lib/components/KeywordSearch-aa4a8e40.js +1 -0
- package/lib/components/KeywordSearch.js +1 -1
- package/lib/components/Keywords.js +1 -1
- package/lib/components/Loading.js +1 -1
- package/lib/components/MUITheme.js +1 -1
- package/lib/components/Modal.js +1 -1
- package/lib/components/MoreButton.js +1 -1
- package/lib/components/Radio.js +1 -1
- package/lib/components/SNA.js +3 -3
- package/lib/components/Select-86fee0d1.js +1 -0
- package/lib/components/Select.js +1 -1
- package/lib/components/Spin.js +1 -1
- package/lib/components/Table.js +1 -1
- package/lib/components/Tooltip.js +1 -1
- package/lib/components/_rollupPluginBabelHelpers-1fef267c.js +1 -0
- package/lib/components/_rollupPluginBabelHelpers-b6a1ebe2.js +1 -0
- package/lib/components/createSvgIcon-65652f3a.js +1 -0
- package/lib/components/createSvgIcon-a33739d1.js +1 -0
- package/lib/components/createTheme-d68e3c02.js +1 -0
- package/lib/components/{dataExport-9fccd4f0.js → dataExport-d55d6fa3.js} +0 -0
- package/lib/components/{transform-95ae0119.js → transform-011f0fe5.js} +1 -1
- package/lib/utils/{_rollupPluginBabelHelpers-928a52ce.js → _rollupPluginBabelHelpers-8dd26e1a.js} +0 -0
- package/lib/utils/exportXlsx.js +1 -1
- package/lib/utils/historyAppendSearch.js +1 -1
- package/lib/utils/snaPreProcess.js +1 -1
- package/package.json +129 -128
- package/lib/components/Backdrop-72e1ae70.js +0 -1
- package/lib/components/Button-909fd795.js +0 -1
- package/lib/components/ButtonBase-b2d7ff99.js +0 -1
- package/lib/components/CircularProgress-8b4a629d.js +0 -1
- package/lib/components/CircularProgress-f928a026.js +0 -1
- package/lib/components/DialogActions-ffc76a34.js +0 -1
- package/lib/components/Empty-a9f1dbfd.js +0 -1
- package/lib/components/Fade-6400ee20.js +0 -1
- package/lib/components/FormControlContext-90b149a2.js +0 -1
- package/lib/components/FormControlLabel-26ff903e.js +0 -1
- package/lib/components/Grow-bf0f6211.js +0 -1
- package/lib/components/IconButton-82d770dc.js +0 -1
- package/lib/components/IconButton-9b900afc.js +0 -1
- package/lib/components/KeywordSearch-f641b236.js +0 -1
- package/lib/components/ListItemText-63c3a97b.js +0 -1
- package/lib/components/Menu-5cc92368.js +0 -1
- package/lib/components/Menu-7e9736fc.js +0 -1
- package/lib/components/MenuItem-0367c9ce.js +0 -1
- package/lib/components/MenuItem-25b6ed17.js +0 -1
- package/lib/components/Modal-7b447805.js +0 -1
- package/lib/components/OutlinedInput-17068df6.js +0 -1
- package/lib/components/Paper-88b3ede6.js +0 -1
- package/lib/components/Portal-411c252b.js +0 -1
- package/lib/components/Select-cf2c941e.js +0 -1
- package/lib/components/Select-df46622f.js +0 -1
- package/lib/components/Tooltip-a5a75db1.js +0 -25
- package/lib/components/TransitionGroupContext-981f4b66.js +0 -1
- package/lib/components/Typography-87aacce0.js +0 -1
- package/lib/components/Typography-f8ad7404.js +0 -1
- package/lib/components/_rollupPluginBabelHelpers-ec4e2a53.js +0 -1
- package/lib/components/capitalize-358ae1fd.js +0 -1
- package/lib/components/capitalize-9fd0e7c5.js +0 -1
- package/lib/components/createChainedFunction-8d6683d4.js +0 -1
- package/lib/components/createSvgIcon-a290aa2f.js +0 -1
- package/lib/components/createSvgIcon-c88736d9.js +0 -1
- package/lib/components/createSvgIcon-cbc342ae.js +0 -1
- package/lib/components/createSvgIcon-d8a3f29d.js +0 -1
- package/lib/components/debounce-65582d84.js +0 -1
- package/lib/components/isMuiElement-64ad493a.js +0 -1
- package/lib/components/ownerWindow-ba2c31bc.js +0 -1
- package/lib/components/unstable_useId-45c5b1e4.js +0 -1
- package/lib/components/useControlled-875277b4.js +0 -1
- package/lib/components/useControlled-b5d6fb94.js +0 -1
- package/lib/components/useEventCallback-b9ab5dc9.js +0 -1
- package/lib/components/useForkRef-4ff8cc89.js +0 -1
- package/lib/components/useFormControl-607a2e33.js +0 -1
- package/lib/components/useIsFocusVisible-217260c3.js +0 -1
- package/lib/components/useTheme-3893447a.js +0 -1
- package/lib/components/utils-ef5b71aa.js +0 -1
- package/lib/components/withStyles-cdd15534.js +0 -1
package/README.md
CHANGED
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
# react-storybook-jsx-starter
|
|
2
|
-
|
|
3
|
-
This project based
|
|
4
|
-
|
|
5
|
-
This project is bootstrapped with the following
|
|
6
|
-
- [Create React App](https://github.com/facebook/create-react-app)
|
|
7
|
-
- [Storybook/react v.6.3.5](https://storybook.js.org/)
|
|
8
|
-
- [Rollup v.2.54.0](https://rollupjs.org/guide/en/)
|
|
9
|
-
- [Airbnb esint config v.18.0.0](https://www.npmjs.com/package/eslint-config-airbnb)
|
|
10
|
-
|
|
11
|
-
## Getting Started
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
## Available Scripts
|
|
15
|
-
|
|
16
|
-
In the project directory, you can run:
|
|
17
|
-
|
|
18
|
-
### `yarn start` and `yarn storybook`
|
|
19
|
-
|
|
20
|
-
Runs storybook.<br>
|
|
21
|
-
Open [http://localhost:6006](http://localhost:6006) to view it in the browser.
|
|
22
|
-
The page will reload if you make component edits.
|
|
23
|
-
|
|
24
|
-
### `yarn create`
|
|
25
|
-
|
|
26
|
-
Help you create component or util. It will automatic generate `folder`, `JSX`, `.store.jsx`.
|
|
27
|
-
|
|
28
|
-
### `yarn lint`
|
|
29
|
-
|
|
30
|
-
Runs airbnb linting config.<br>
|
|
31
|
-
Please refer to `.eslintrc` for more details in rules that are excluded/added from the initial Airbnb configuration, which can be found [here](https://www.npmjs.com/package/eslint-config-airbnb)
|
|
32
|
-
Notice: If developer using visual code IDE, download `eslint` and `prettier` extensions to help you develop.
|
|
33
|
-
|
|
34
|
-
### `yarn build`
|
|
35
|
-
|
|
36
|
-
Builds the component library using rollup.<br>
|
|
37
|
-
This runs a set of defined configurations under `rollup.config.js` file.<br>
|
|
38
|
-
Index.js & index.ts will automatic generated by `rollup.index.js` file.
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
### `yarn build-storybook`
|
|
42
|
-
|
|
43
|
-
Builds static files for storybook site. This is so it can be deployed as the docs source for the component library.
|
|
44
|
-
|
|
45
|
-
|
|
1
|
+
# react-storybook-jsx-starter
|
|
2
|
+
|
|
3
|
+
This project based
|
|
4
|
+
|
|
5
|
+
This project is bootstrapped with the following
|
|
6
|
+
- [Create React App](https://github.com/facebook/create-react-app)
|
|
7
|
+
- [Storybook/react v.6.3.5](https://storybook.js.org/)
|
|
8
|
+
- [Rollup v.2.54.0](https://rollupjs.org/guide/en/)
|
|
9
|
+
- [Airbnb esint config v.18.0.0](https://www.npmjs.com/package/eslint-config-airbnb)
|
|
10
|
+
|
|
11
|
+
## Getting Started
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## Available Scripts
|
|
15
|
+
|
|
16
|
+
In the project directory, you can run:
|
|
17
|
+
|
|
18
|
+
### `yarn start` and `yarn storybook`
|
|
19
|
+
|
|
20
|
+
Runs storybook.<br>
|
|
21
|
+
Open [http://localhost:6006](http://localhost:6006) to view it in the browser.
|
|
22
|
+
The page will reload if you make component edits.
|
|
23
|
+
|
|
24
|
+
### `yarn create`
|
|
25
|
+
|
|
26
|
+
Help you create component or util. It will automatic generate `folder`, `JSX`, `.store.jsx`.
|
|
27
|
+
|
|
28
|
+
### `yarn lint`
|
|
29
|
+
|
|
30
|
+
Runs airbnb linting config.<br>
|
|
31
|
+
Please refer to `.eslintrc` for more details in rules that are excluded/added from the initial Airbnb configuration, which can be found [here](https://www.npmjs.com/package/eslint-config-airbnb)
|
|
32
|
+
Notice: If developer using visual code IDE, download `eslint` and `prettier` extensions to help you develop.
|
|
33
|
+
|
|
34
|
+
### `yarn build`
|
|
35
|
+
|
|
36
|
+
Builds the component library using rollup.<br>
|
|
37
|
+
This runs a set of defined configurations under `rollup.config.js` file.<br>
|
|
38
|
+
Index.js & index.ts will automatic generated by `rollup.index.js` file.
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
### `yarn build-storybook`
|
|
42
|
+
|
|
43
|
+
Builds static files for storybook site. This is so it can be deployed as the docs source for the component library.
|
|
44
|
+
|
|
45
|
+
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e,a as r,b as a}from"./_rollupPluginBabelHelpers-ec4e2a53.js";import*as o from"react";import t,{useCallback as l,useState as n,useRef as i,useEffect as c}from"react";import s from"prop-types";import{c as d}from"./index-b2745105.js";import{d as u}from"./debounce-c993109b.js";import{Autocomplete as p}from"@material-ui/lab";import{c as m}from"./createSvgIcon-c88736d9.js";import{w as f,a as b,_ as g,c as h,b as y,d as v,e as x}from"./capitalize-9fd0e7c5.js";import{u as C}from"./useForkRef-4ff8cc89.js";import{B as k}from"./ButtonBase-b2d7ff99.js";import{F as I,M as w,I as S,a as E}from"./Select-df46622f.js";import{f as T,O as j}from"./OutlinedInput-17068df6.js";import{u as R}from"./useFormControl-607a2e33.js";import{C as N}from"./CircularProgress-f928a026.js";import $ from"./Empty.js";import{s as F}from"./style-inject.es-1f59c1d0.js";import"@material-ui/styles";import"react-dom";import"./useEventCallback-b9ab5dc9.js";import"./useIsFocusVisible-217260c3.js";import"./TransitionGroupContext-981f4b66.js";import"./isMuiElement-64ad493a.js";import"./FormControlContext-90b149a2.js";import"react-is";import"./ownerWindow-ba2c31bc.js";import"./Menu-5cc92368.js";import"./useTheme-3893447a.js";import"./debounce-65582d84.js";import"./createChainedFunction-8d6683d4.js";import"./Modal-7b447805.js";import"./Portal-411c252b.js";import"./Paper-88b3ede6.js";import"./Grow-bf0f6211.js";import"./utils-ef5b71aa.js";import"./useControlled-b5d6fb94.js";var P=o.forwardRef((function(e,r){var a=e.children,t=e.classes,l=e.className;e.color;var n=e.component,i=void 0===n?"label":n;e.disabled,e.error,e.filled,e.focused,e.required;var c=g(e,["children","classes","className","color","component","disabled","error","filled","focused","required"]),s=R(),d=T({props:e,muiFormControl:s,states:["color","required","focused","disabled","error","filled"]});return o.createElement(i,b({className:h(t.root,t["color".concat(y(d.color||"primary"))],l,d.disabled&&t.disabled,d.error&&t.error,d.filled&&t.filled,d.focused&&t.focused,d.required&&t.required),ref:r},c),a,d.required&&o.createElement("span",{"aria-hidden":!0,className:h(t.asterisk,d.error&&t.error)}," ","*"))})),A=f((function(e){return{root:b({color:e.palette.text.secondary},e.typography.body1,{lineHeight:1,padding:0,"&$focused":{color:e.palette.primary.main},"&$disabled":{color:e.palette.text.disabled},"&$error":{color:e.palette.error.main}}),colorSecondary:{"&$focused":{color:e.palette.secondary.main}},focused:{},disabled:{},error:{},filled:{},required:{},asterisk:{"&$error":{color:e.palette.error.main}}}}),{name:"MuiFormLabel"})(P),L=o.forwardRef((function(e,r){var a=e.classes,t=e.className,l=e.disableAnimation,n=void 0!==l&&l;e.margin;var i=e.shrink;e.variant;var c=g(e,["classes","className","disableAnimation","margin","shrink","variant"]),s=R(),d=i;void 0===d&&s&&(d=s.filled||s.focused||s.adornedStart);var u=T({props:e,muiFormControl:s,states:["margin","variant"]});return o.createElement(A,b({"data-shrink":d,className:h(a.root,t,s&&a.formControl,!n&&a.animated,d&&a.shrink,"dense"===u.margin&&a.marginDense,{filled:a.filled,outlined:a.outlined}[u.variant]),classes:{focused:a.focused,disabled:a.disabled,error:a.error,required:a.required,asterisk:a.asterisk},ref:r},c))})),V=f((function(e){return{root:{display:"block",transformOrigin:"top left"},focused:{},disabled:{},error:{},required:{},asterisk:{},formControl:{position:"absolute",left:0,top:0,transform:"translate(0, 24px) scale(1)"},marginDense:{transform:"translate(0, 21px) scale(1)"},shrink:{transform:"translate(0, 1.5px) scale(0.75)",transformOrigin:"top left"},animated:{transition:e.transitions.create(["color","transform"],{duration:e.transitions.duration.shorter,easing:e.transitions.easing.easeOut})},filled:{zIndex:1,pointerEvents:"none",transform:"translate(12px, 20px) scale(1)","&$marginDense":{transform:"translate(12px, 17px) scale(1)"},"&$shrink":{transform:"translate(12px, 10px) scale(0.75)","&$marginDense":{transform:"translate(12px, 7px) scale(0.75)"}}},outlined:{zIndex:1,pointerEvents:"none",transform:"translate(14px, 20px) scale(1)","&$marginDense":{transform:"translate(14px, 12px) scale(1)"},"&$shrink":{transform:"translate(14px, -6px) scale(0.75)"}}}}),{name:"MuiInputLabel"})(L),O=o.forwardRef((function(e,r){var a=e.children,t=e.classes,l=e.className,n=e.component,i=void 0===n?"p":n;e.disabled,e.error,e.filled,e.focused,e.margin,e.required,e.variant;var c=g(e,["children","classes","className","component","disabled","error","filled","focused","margin","required","variant"]),s=R(),d=T({props:e,muiFormControl:s,states:["variant","margin","disabled","error","filled","focused","required"]});return o.createElement(i,b({className:h(t.root,("filled"===d.variant||"outlined"===d.variant)&&t.contained,l,d.disabled&&t.disabled,d.error&&t.error,d.filled&&t.filled,d.focused&&t.focused,d.required&&t.required,"dense"===d.margin&&t.marginDense),ref:r},c)," "===a?o.createElement("span",{dangerouslySetInnerHTML:{__html:"​"}}):a)})),D=f((function(e){return{root:b({color:e.palette.text.secondary},e.typography.caption,{textAlign:"left",marginTop:3,margin:0,"&$disabled":{color:e.palette.text.disabled},"&$error":{color:e.palette.error.main}}),error:{},disabled:{},marginDense:{marginTop:4},contained:{marginLeft:14,marginRight:14},focused:{},filled:{},required:{}}}),{name:"MuiFormHelperText"})(O),M={standard:S,filled:E,outlined:j},q=o.forwardRef((function(e,r){var a=e.autoComplete,t=e.autoFocus,l=void 0!==t&&t,n=e.children,i=e.classes,c=e.className,s=e.color,d=void 0===s?"primary":s,u=e.defaultValue,p=e.disabled,m=void 0!==p&&p,f=e.error,y=void 0!==f&&f,v=e.FormHelperTextProps,x=e.fullWidth,C=void 0!==x&&x,k=e.helperText,S=e.hiddenLabel,E=e.id,T=e.InputLabelProps,j=e.inputProps,R=e.InputProps,N=e.inputRef,$=e.label,F=e.multiline,P=void 0!==F&&F,A=e.name,L=e.onBlur,O=e.onChange,q=e.onFocus,z=e.placeholder,_=e.required,B=void 0!==_&&_,H=e.rows,K=e.rowsMax,W=e.maxRows,U=e.minRows,G=e.select,J=void 0!==G&&G,Q=e.SelectProps,X=e.type,Y=e.value,Z=e.variant,ee=void 0===Z?"standard":Z,re=g(e,["autoComplete","autoFocus","children","classes","className","color","defaultValue","disabled","error","FormHelperTextProps","fullWidth","helperText","hiddenLabel","id","InputLabelProps","inputProps","InputProps","inputRef","label","multiline","name","onBlur","onChange","onFocus","placeholder","required","rows","rowsMax","maxRows","minRows","select","SelectProps","type","value","variant"]),ae={};if("outlined"===ee&&(T&&void 0!==T.shrink&&(ae.notched=T.shrink),$)){var oe,te=null!==(oe=null==T?void 0:T.required)&&void 0!==oe?oe:B;ae.label=o.createElement(o.Fragment,null,$,te&&" *")}J&&(Q&&Q.native||(ae.id=void 0),ae["aria-describedby"]=void 0);var le=k&&E?"".concat(E,"-helper-text"):void 0,ne=$&&E?"".concat(E,"-label"):void 0,ie=M[ee],ce=o.createElement(ie,b({"aria-describedby":le,autoComplete:a,autoFocus:l,defaultValue:u,fullWidth:C,multiline:P,name:A,rows:H,rowsMax:K,maxRows:W,minRows:U,type:X,value:Y,id:E,inputRef:N,onBlur:L,onChange:O,onFocus:q,placeholder:z,inputProps:j},ae,R));return o.createElement(I,b({className:h(i.root,c),disabled:m,error:y,fullWidth:C,hiddenLabel:S,ref:r,required:B,color:d,variant:ee},re),$&&o.createElement(V,b({htmlFor:E,id:ne},T),$),J?o.createElement(w,b({"aria-describedby":le,id:E,labelId:ne,value:Y,input:ce},Q),n):ce,k&&o.createElement(D,b({id:le},v),k))})),z=f({root:{}},{name:"MuiTextField"})(q),_=m(o.createElement("path",{d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm5 13.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12 17 15.59z"}));function B(e){return"Backspace"===e.key||"Delete"===e.key}var H=o.forwardRef((function(e,r){var a=e.avatar,t=e.classes,l=e.className,n=e.clickable,i=e.color,c=void 0===i?"default":i,s=e.component,d=e.deleteIcon,u=e.disabled,p=void 0!==u&&u,m=e.icon,f=e.label,v=e.onClick,x=e.onDelete,I=e.onKeyDown,w=e.onKeyUp,S=e.size,E=void 0===S?"medium":S,T=e.variant,j=void 0===T?"default":T,R=g(e,["avatar","classes","className","clickable","color","component","deleteIcon","disabled","icon","label","onClick","onDelete","onKeyDown","onKeyUp","size","variant"]),N=o.useRef(null),$=C(N,r),F=function(e){e.stopPropagation(),x&&x(e)},P=!(!1===n||!v)||n,A="small"===E,L=s||(P?k:"div"),V=L===k?{component:"div"}:{},O=null;if(x){var D=h("default"!==c&&("default"===j?t["deleteIconColor".concat(y(c))]:t["deleteIconOutlinedColor".concat(y(c))]),A&&t.deleteIconSmall);O=d&&o.isValidElement(d)?o.cloneElement(d,{className:h(d.props.className,t.deleteIcon,D),onClick:F}):o.createElement(_,{className:h(t.deleteIcon,D),onClick:F})}var M=null;a&&o.isValidElement(a)&&(M=o.cloneElement(a,{className:h(t.avatar,a.props.className,A&&t.avatarSmall,"default"!==c&&t["avatarColor".concat(y(c))])}));var q=null;return m&&o.isValidElement(m)&&(q=o.cloneElement(m,{className:h(t.icon,m.props.className,A&&t.iconSmall,"default"!==c&&t["iconColor".concat(y(c))])})),o.createElement(L,b({role:P||x?"button":void 0,className:h(t.root,l,"default"!==c&&[t["color".concat(y(c))],P&&t["clickableColor".concat(y(c))],x&&t["deletableColor".concat(y(c))]],"default"!==j&&[t.outlined,{primary:t.outlinedPrimary,secondary:t.outlinedSecondary}[c]],p&&t.disabled,A&&t.sizeSmall,P&&t.clickable,x&&t.deletable),"aria-disabled":!!p||void 0,tabIndex:P||x?0:void 0,onClick:v,onKeyDown:function(e){e.currentTarget===e.target&&B(e)&&e.preventDefault(),I&&I(e)},onKeyUp:function(e){e.currentTarget===e.target&&(x&&B(e)?x(e):"Escape"===e.key&&N.current&&N.current.blur()),w&&w(e)},ref:$},V,R),M||q,o.createElement("span",{className:h(t.label,A&&t.labelSmall)},f),O)})),K=f((function(e){var r="light"===e.palette.type?e.palette.grey[300]:e.palette.grey[700],a=v(e.palette.text.primary,.26);return{root:{fontFamily:e.typography.fontFamily,fontSize:e.typography.pxToRem(13),display:"inline-flex",alignItems:"center",justifyContent:"center",height:32,color:e.palette.getContrastText(r),backgroundColor:r,borderRadius:16,whiteSpace:"nowrap",transition:e.transitions.create(["background-color","box-shadow"]),cursor:"default",outline:0,textDecoration:"none",border:"none",padding:0,verticalAlign:"middle",boxSizing:"border-box","&$disabled":{opacity:.5,pointerEvents:"none"},"& $avatar":{marginLeft:5,marginRight:-6,width:24,height:24,color:"light"===e.palette.type?e.palette.grey[700]:e.palette.grey[300],fontSize:e.typography.pxToRem(12)},"& $avatarColorPrimary":{color:e.palette.primary.contrastText,backgroundColor:e.palette.primary.dark},"& $avatarColorSecondary":{color:e.palette.secondary.contrastText,backgroundColor:e.palette.secondary.dark},"& $avatarSmall":{marginLeft:4,marginRight:-4,width:18,height:18,fontSize:e.typography.pxToRem(10)}},sizeSmall:{height:24},colorPrimary:{backgroundColor:e.palette.primary.main,color:e.palette.primary.contrastText},colorSecondary:{backgroundColor:e.palette.secondary.main,color:e.palette.secondary.contrastText},disabled:{},clickable:{userSelect:"none",WebkitTapHighlightColor:"transparent",cursor:"pointer","&:hover, &:focus":{backgroundColor:x(r,.08)},"&:active":{boxShadow:e.shadows[1]}},clickableColorPrimary:{"&:hover, &:focus":{backgroundColor:x(e.palette.primary.main,.08)}},clickableColorSecondary:{"&:hover, &:focus":{backgroundColor:x(e.palette.secondary.main,.08)}},deletable:{"&:focus":{backgroundColor:x(r,.08)}},deletableColorPrimary:{"&:focus":{backgroundColor:x(e.palette.primary.main,.2)}},deletableColorSecondary:{"&:focus":{backgroundColor:x(e.palette.secondary.main,.2)}},outlined:{backgroundColor:"transparent",border:"1px solid ".concat("light"===e.palette.type?"rgba(0, 0, 0, 0.23)":"rgba(255, 255, 255, 0.23)"),"$clickable&:hover, $clickable&:focus, $deletable&:focus":{backgroundColor:v(e.palette.text.primary,e.palette.action.hoverOpacity)},"& $avatar":{marginLeft:4},"& $avatarSmall":{marginLeft:2},"& $icon":{marginLeft:4},"& $iconSmall":{marginLeft:2},"& $deleteIcon":{marginRight:5},"& $deleteIconSmall":{marginRight:3}},outlinedPrimary:{color:e.palette.primary.main,border:"1px solid ".concat(e.palette.primary.main),"$clickable&:hover, $clickable&:focus, $deletable&:focus":{backgroundColor:v(e.palette.primary.main,e.palette.action.hoverOpacity)}},outlinedSecondary:{color:e.palette.secondary.main,border:"1px solid ".concat(e.palette.secondary.main),"$clickable&:hover, $clickable&:focus, $deletable&:focus":{backgroundColor:v(e.palette.secondary.main,e.palette.action.hoverOpacity)}},avatar:{},avatarSmall:{},avatarColorPrimary:{},avatarColorSecondary:{},icon:{color:"light"===e.palette.type?e.palette.grey[700]:e.palette.grey[300],marginLeft:5,marginRight:-6},iconSmall:{width:18,height:18,marginLeft:4,marginRight:-4},iconColorPrimary:{color:"inherit"},iconColorSecondary:{color:"inherit"},label:{overflow:"hidden",textOverflow:"ellipsis",paddingLeft:12,paddingRight:12,whiteSpace:"nowrap"},labelSmall:{paddingLeft:8,paddingRight:8},deleteIcon:{WebkitTapHighlightColor:"transparent",color:a,height:22,width:22,cursor:"pointer",margin:"0 5px 0 -6px","&:hover":{color:v(a,.4)}},deleteIconSmall:{height:16,width:16,marginRight:4,marginLeft:-4},deleteIconColorPrimary:{color:v(e.palette.primary.contrastText,.7),"&:hover, &:active":{color:e.palette.primary.contrastText}},deleteIconColorSecondary:{color:v(e.palette.secondary.contrastText,.7),"&:hover, &:active":{color:e.palette.secondary.contrastText}},deleteIconOutlinedColorPrimary:{color:v(e.palette.primary.main,.7),"&:hover, &:active":{color:e.palette.primary.main}},deleteIconOutlinedColorSecondary:{color:v(e.palette.secondary.main,.7),"&:hover, &:active":{color:e.palette.secondary.main}}}}),{name:"MuiChip"})(H),W=m(o.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})),U=m(o.createElement("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"}));F(".autocomplete .MuiAutocomplete-inputRoot[class*='MuiOutlinedInput-root'] {\n padding: 0px 8px; }\n\n.autocomplete .MuiChip-deleteIcon {\n width: 16px;\n height: 16px; }\n\n.autocomplete__icon {\n font-size: 1.25rem;\n margin-right: 8px; }\n\n.autocomplete--showSearchIcon .MuiAutocomplete-inputRoot[class*='MuiOutlinedInput-root'] {\n display: flex;\n flex-wrap: nowrap;\n padding: 4px 8px; }\n");var G=function(o){var s=o.options,m=o.defaultValue,f=o.renderAfterDefaultValueChange,b=o.filterable,g=o.loading,h=o.labelInValue,y=o.disabled,v=o.className,x=o.multiple,C=o.freeTyping,k=o.placeholder,I=o.searchIcon,w=o.renderInput,S=o.renderTags,E=o.onChange,T=o.onSearch,j=o.onFocus,R=o.onBlur,F=o.onEnter,P=n(!0),A=r(P,2),L=A[0],V=A[1],O=n(),D=r(O,2),M=D[0],q=D[1],_=n(),B=r(_,2),H=B[0],G=B[1],J=n(),Q=r(J,2),X=Q[0],Y=Q[1],Z=n(),ee=r(Z,2),re=ee[0],ae=ee[1],oe=(r=>{let{options:a,placeholder:o,loading:n,searchIcon:i,labelInValue:c}=r;const s=l((e=>"object"==typeof e?e.value:e),[]),d=l((e=>{const r=(Array.isArray(a)?a:[]).find((r=>s(r)===s(e)));return r?"object"==typeof r?r.label:r:"object"==typeof e?e.label:e}),[a]),u=l((e=>{if(Array.isArray(a)){if(Array.isArray(e))return e.map((e=>a.find((r=>{let{value:a}=r;return e===a||e.value===a}))||e));const r=a.find((r=>{let{value:a}=r;return e===a}));return c?e:r||{label:e,value:e}}return e}),[a,c]),p=l(((r,a)=>r.map(((r,o)=>t.createElement(K,e({label:d(r),deleteIcon:t.createElement(W,null)},a({index:o})))))),[a]),m=l((r=>t.createElement(z,e({},r,{variant:"outlined",placeholder:o,InputProps:{...r.InputProps,endAdornment:t.createElement(t.Fragment,null,n&&t.createElement(N,{className:"autocomplete__icon",color:"inherit",size:20}),i&&t.createElement(U,{className:"autocomplete__icon"}),r.InputProps.endAdornment)}}))),[n,i]);return{getValue:s,getValueFromOptions:u,defaultTag:p,defaultRenderInput:m}})(a({},{options:s,placeholder:k,loading:g,searchIcon:I,labelInValue:h})),te=oe.getValue,le=oe.getValueFromOptions,ne=oe.defaultTag,ie=oe.defaultRenderInput,ce=i(u((function(e){return T(e)}),500)).current;return c((function(){ae("string"==typeof m&&x?{label:M,value:M}:le(m))}),[JSON.stringify(m)]),c((function(){f&&V(!1)}),[re]),c((function(){L||V(!0)}),[L]),c((function(){H&&(q(H),ce(H))}),[H]),t.createElement("div",{className:d("autocomplete",{"autocomplete--showSearchIcon":I},v)},L&&t.createElement(p,{className:"autocomplete__component",options:Array.isArray(s)&&(C&&M?[{label:M,value:M}].concat(s):s)||[],defaultValue:re,disabled:y,multiple:x,filterOptions:function(e,r){var a=r.inputValue,o=void 0===a?"":a;return(Array.isArray(e)?e:[]).filter((function(e){var r=(e||{}).label;return!b||(void 0===r?"":r).toLowerCase().indexOf(o.toLowerCase())>-1}))},onChange:function(e,r){Array.isArray(r)?E(r.map((function(e){return h?e:te(e)}))):r&&E(h?r:te(r))},onInputChange:function(e,r,a){r&&"string"==typeof r&&"input"===a&&G(r)},onKeyDown:function(e){switch(e.key){case"ArrowDown":case"ArrowUp":Y(!0);break;case"Enter":if(!X){var r=C&&!x;F(e,r?{label:M,value:M}:void 0),r&&ae({label:M,value:M})}break;default:Y(!1)}},getOptionLabel:function(e){return e&&e.label||""},getOptionDisabled:function(e){return e.disabled},renderInput:function(e){return w&&w(e)||ie(e)},renderTags:function(e,r){return S&&S(e,r)||ne(e,r)},popupIcon:null,noOptionsText:t.createElement($,null),onFocus:j,onBlur:R}))};G.defaultProps={className:void 0,defaultValue:void 0,renderAfterDefaultValueChange:!1,options:void 0,freeTyping:!1,loading:!1,disabled:!1,labelInValue:!0,searchIcon:!0,multiple:!1,placeholder:"Search...",filterable:!1,renderInput:void 0,renderTags:void 0,onChange:function(){},onSearch:function(){},onFocus:function(){},onBlur:function(){},onEnter:function(){}},G.propTypes={className:s.string,defaultValue:s.any,renderAfterDefaultValueChange:s.bool,options:s.arrayOf(s.any),freeTyping:s.bool,loading:s.bool,disabled:s.bool,labelInValue:s.bool,searchIcon:s.bool,multiple:s.bool,placeholder:s.string,filterable:s.bool,renderInput:s.func,renderTags:s.func,onChange:s.func,onSearch:s.func,onFocus:s.func,onBlur:s.func,onEnter:s.func};export{G as default};
|
|
1
|
+
import{_ as e,a as n,b as o}from"./_rollupPluginBabelHelpers-b6a1ebe2.js";import t,{useCallback as r,useState as a,useRef as l,useEffect as u}from"react";import i from"prop-types";import{c}from"./index-b2745105.js";import{d as p}from"./debounce-c993109b.js";import{Autocomplete as s}from"@material-ui/lab";import{Chip as f,TextField as d,CircularProgress as m}from"@material-ui/core";import{Close as b,SearchOutlined as g}from"@material-ui/icons";import h from"./Empty.js";import{s as y}from"./style-inject.es-1f59c1d0.js";y(".autocomplete .MuiAutocomplete-inputRoot[class*='MuiOutlinedInput-root'] {\n padding: 0px 8px; }\n\n.autocomplete .MuiChip-deleteIcon {\n width: 16px;\n height: 16px; }\n\n.autocomplete__icon {\n font-size: 1.25rem;\n margin-right: 8px; }\n\n.autocomplete--showSearchIcon .MuiAutocomplete-inputRoot[class*='MuiOutlinedInput-root'] {\n display: flex;\n flex-wrap: nowrap;\n padding: 4px 8px; }\n");var I=function(i){var y=i.options,I=i.defaultValue,v=i.renderAfterDefaultValueChange,A=i.filterable,V=i.loading,x=i.labelInValue,E=i.disabled,w=i.className,C=i.multiple,O=i.freeTyping,T=i.placeholder,_=i.searchIcon,j=i.renderInput,N=i.renderTags,F=i.onChange,S=i.onSearch,D=i.onFocus,B=i.onBlur,M=i.onEnter,P=a(!0),R=n(P,2),k=R[0],L=R[1],z=a(),H=n(z,2),J=H[0],K=H[1],U=a(),q=n(U,2),G=q[0],Q=q[1],W=a(),X=n(W,2),Y=X[0],Z=X[1],$=a(),ee=n($,2),ne=ee[0],oe=ee[1],te=(n=>{let{options:o,placeholder:a,loading:l,searchIcon:u,labelInValue:i}=n;const c=r((e=>"object"==typeof e?e.value:e),[]),p=r((e=>{const n=(Array.isArray(o)?o:[]).find((n=>c(n)===c(e)));return n?"object"==typeof n?n.label:n:"object"==typeof e?e.label:e}),[o]),s=r((e=>{if(Array.isArray(o)){if(Array.isArray(e))return e.map((e=>o.find((n=>{let{value:o}=n;return e===o||e.value===o}))||e));const n=o.find((n=>{let{value:o}=n;return e===o}));return i?e:n||{label:e,value:e}}return e}),[o,i]),h=r(((n,o)=>n.map(((n,r)=>t.createElement(f,e({label:p(n),deleteIcon:t.createElement(b,null)},o({index:r})))))),[o]),y=r((n=>t.createElement(d,e({},n,{variant:"outlined",placeholder:a,InputProps:{...n.InputProps,endAdornment:t.createElement(t.Fragment,null,l&&t.createElement(m,{className:"autocomplete__icon",color:"inherit",size:20}),u&&t.createElement(g,{className:"autocomplete__icon"}),n.InputProps.endAdornment)}}))),[l,u]);return{getValue:c,getValueFromOptions:s,defaultTag:h,defaultRenderInput:y}})(o({},{options:y,placeholder:T,loading:V,searchIcon:_,labelInValue:x})),re=te.getValue,ae=te.getValueFromOptions,le=te.defaultTag,ue=te.defaultRenderInput,ie=l(p((function(e){return S(e)}),500)).current;return u((function(){oe("string"==typeof I&&C?{label:J,value:J}:ae(I))}),[JSON.stringify(I)]),u((function(){v&&L(!1)}),[ne]),u((function(){k||L(!0)}),[k]),u((function(){G&&(K(G),ie(G))}),[G]),t.createElement("div",{className:c("autocomplete",{"autocomplete--showSearchIcon":_},w)},k&&t.createElement(s,{className:"autocomplete__component",options:Array.isArray(y)&&(O&&J?[{label:J,value:J}].concat(y):y)||[],defaultValue:ne,disabled:E,multiple:C,filterOptions:function(e,n){var o=n.inputValue,t=void 0===o?"":o;return(Array.isArray(e)?e:[]).filter((function(e){var n=(e||{}).label;return!A||(void 0===n?"":n).toLowerCase().indexOf(t.toLowerCase())>-1}))},onChange:function(e,n){Array.isArray(n)?F(n.map((function(e){return x?e:re(e)}))):n&&F(x?n:re(n))},onInputChange:function(e,n,o){n&&"string"==typeof n&&"input"===o&&Q(n)},onKeyDown:function(e){switch(e.key){case"ArrowDown":case"ArrowUp":Z(!0);break;case"Enter":if(!Y){var n=O&&!C;M(e,n?{label:J,value:J}:void 0),n&&oe({label:J,value:J})}break;default:Z(!1)}},getOptionLabel:function(e){return e&&e.label||""},getOptionDisabled:function(e){return e.disabled},renderInput:function(e){return j&&j(e)||ue(e)},renderTags:function(e,n){return N&&N(e,n)||le(e,n)},popupIcon:null,noOptionsText:t.createElement(h,null),onFocus:D,onBlur:B}))};I.defaultProps={className:void 0,defaultValue:void 0,renderAfterDefaultValueChange:!1,options:void 0,freeTyping:!1,loading:!1,disabled:!1,labelInValue:!0,searchIcon:!0,multiple:!1,placeholder:"Search...",filterable:!1,renderInput:void 0,renderTags:void 0,onChange:function(){},onSearch:function(){},onFocus:function(){},onBlur:function(){},onEnter:function(){}},I.propTypes={className:i.string,defaultValue:i.any,renderAfterDefaultValueChange:i.bool,options:i.arrayOf(i.any),freeTyping:i.bool,loading:i.bool,disabled:i.bool,labelInValue:i.bool,searchIcon:i.bool,multiple:i.bool,placeholder:i.string,filterable:i.bool,renderInput:i.func,renderTags:i.func,onChange:i.func,onSearch:i.func,onFocus:i.func,onBlur:i.func,onEnter:i.func};export{I as default};
|
package/lib/components/Avatar.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import r from"react";import{c as a}from"./index-b2745105.js";import e from"prop-types";import{Avatar as s}from"@material-ui/core";import{s as o}from"./style-inject.es-1f59c1d0.js";o("");var t=function(e){var o=e.className,t=e.shape,c=e.src,i=e.onError;return r.createElement(s,{className:a("avatar",o),variant:t,src:c},r.createElement("img",{src:c,onError:function(){return i()},alt:"test",style:{display:"none"}}))};t.defaultProps={className:void 0,shape:"circular",src:void 0,onError:void 0},t.propTypes={className:e.string,shape:e.oneOf(["circle","circular","rounded","square"]),src:e.string,onError:e.func};export{t as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as e}from"./_rollupPluginBabelHelpers-b6a1ebe2.js";import n,{useState as o,useRef as t,useEffect as i}from"react";import r from"prop-types";import{u as a,b as l,c}from"./index-b2745105.js";import{d as s}from"./debounce-c993109b.js";import{Fade as p,NoSsr as m,Box as d}from"@material-ui/core";import{i as u,a as f,r as b}from"./createSvgIcon-65652f3a.js";import{s as v}from"./style-inject.es-1f59c1d0.js";import"@material-ui/styles";import"react-dom";var x=a(l((function(e,o){Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var t=u(n),i=(0,f(b).default)(t.createElement("path",{d:"M12 8l-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14l-6-6z"}),"ExpandLessSharp");o.default=i})));v(".backTop {\n right: 30px;\n bottom: 50px;\n position: fixed;\n z-index: 10;\n opacity: 0;\n cursor: pointer; }\n .backTop__default {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n width: 70px;\n height: 70px;\n border-radius: 45px;\n opacity: 0.8;\n transition: opacity 0.3s ease-in-out; }\n .backTop__default:hover {\n opacity: 1; }\n .backTop__default .MuiSvgIcon-root {\n margin-bottom: -3px; }\n .backTop:hover {\n opacity: 0.7; }\n\n@media only screen and (max-width: 484px) {\n .backTop {\n right: 15px; } }\n");var y=function(r){var a=r.className,l=r.visibilityHeight,u=r.onClick,f=r.children,b=o(!1),v=e(b,2),y=v[0],h=v[1],w=t(s((function(){var e=window.scrollY;h(e>=l)}),100)).current;return i((function(){return window.addEventListener("scroll",(function(){return w()})),function(){window.removeEventListener("scroll",(function(){return w()}))}}),[]),n.createElement(p,{in:y,timeout:500,unmountOnExit:!0},n.createElement("div",{className:c("backTop",a),onClick:function(){window.scrollTo?window.scrollTo({top:0,left:0,behavior:"smooth"}):window.scrollTop=0,u()}},f?n.createElement("div",null,f):n.createElement(m,null,n.createElement(d,{className:"backTop__default",color:"text.primary",bgcolor:"primary.main",borderColor:"text.secondary"},n.createElement(x,null),"Top"))))};y.defaultProps={className:void 0,visibilityHeight:300,onClick:function(){},children:void 0},y.propTypes={className:r.string,visibilityHeight:r.number,onClick:r.func,children:r.node};export{y as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import t,{useEffect as n}from"react";import{c as r}from"./index-b2745105.js";import e from"prop-types";import{b as a,f as i,g as o,h as u,j as c,o as l,k as s,l as f,n as h,p as d,s as m}from"./transform-95ae0119.js";import{s as g}from"./style-inject.es-1f59c1d0.js";function p(t,n,r){t=+t,n=+n,r=(a=arguments.length)<2?(n=t,t=0,1):a<3?1:+r;for(var e=-1,a=0|Math.max(0,Math.ceil((n-t)/r)),i=new Array(a);++e<a;)i[e]=t+e*r;return i}var v=Math.sqrt(50),M=Math.sqrt(10),y=Math.sqrt(2);function b(t,n,r){var e=(n-t)/Math.max(0,r),a=Math.floor(Math.log(e)/Math.LN10),i=e/Math.pow(10,a);return a>=0?(i>=v?10:i>=M?5:i>=y?2:1)*Math.pow(10,a):-Math.pow(10,-a)/(i>=v?10:i>=M?5:i>=y?2:1)}var w=Array.prototype.slice;function x(t){return t}function k(t){return"translate("+(t+.5)+",0)"}function N(t){return"translate(0,"+(t+.5)+")"}function A(t){return function(n){return+t(n)}}function C(t){var n=Math.max(0,t.bandwidth()-1)/2;return t.round()&&(n=Math.round(n)),function(r){return+t(r)+n}}function S(){return!this.__axis}function j(t,n){var r=[],e=null,a=null,i=6,o=6,u=3,c=1===t||4===t?-1:1,l=4===t||2===t?"x":"y",s=1===t||3===t?k:N;function f(f){var h=null==e?n.ticks?n.ticks.apply(n,r):n.domain():e,d=null==a?n.tickFormat?n.tickFormat.apply(n,r):x:a,m=Math.max(i,0)+u,g=n.range(),p=+g[0]+.5,v=+g[g.length-1]+.5,M=(n.bandwidth?C:A)(n.copy()),y=f.selection?f.selection():f,b=y.selectAll(".domain").data([null]),w=y.selectAll(".tick").data(h,n).order(),k=w.exit(),N=w.enter().append("g").attr("class","tick"),j=w.select("line"),z=w.select("text");b=b.merge(b.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),w=w.merge(N),j=j.merge(N.append("line").attr("stroke","currentColor").attr(l+"2",c*i)),z=z.merge(N.append("text").attr("fill","currentColor").attr(l,c*m).attr("dy",1===t?"0em":3===t?"0.71em":"0.32em")),f!==y&&(b=b.transition(f),w=w.transition(f),j=j.transition(f),z=z.transition(f),k=k.transition(f).attr("opacity",1e-6).attr("transform",(function(t){return isFinite(t=M(t))?s(t):this.getAttribute("transform")})),N.attr("opacity",1e-6).attr("transform",(function(t){var n=this.parentNode.__axis;return s(n&&isFinite(n=n(t))?n:M(t))}))),k.remove(),b.attr("d",4===t||2==t?o?"M"+c*o+","+p+"H0.5V"+v+"H"+c*o:"M0.5,"+p+"V"+v:o?"M"+p+","+c*o+"V0.5H"+v+"V"+c*o:"M"+p+",0.5H"+v),w.attr("opacity",1).attr("transform",(function(t){return s(M(t))})),j.attr(l+"2",c*i),z.attr(l,c*m).text(d),y.filter(S).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",2===t?"start":4===t?"end":"middle"),y.each((function(){this.__axis=M}))}return f.scale=function(t){return arguments.length?(n=t,f):n},f.ticks=function(){return r=w.call(arguments),f},f.tickArguments=function(t){return arguments.length?(r=null==t?[]:w.call(t),f):r.slice()},f.tickValues=function(t){return arguments.length?(e=null==t?null:w.call(t),f):e&&e.slice()},f.tickFormat=function(t){return arguments.length?(a=t,f):a},f.tickSize=function(t){return arguments.length?(i=o=+t,f):i},f.tickSizeInner=function(t){return arguments.length?(i=+t,f):i},f.tickSizeOuter=function(t){return arguments.length?(o=+t,f):o},f.tickPadding=function(t){return arguments.length?(u=+t,f):u},f}function z(t,n){n||(n=[]);var r,e=t?Math.min(n.length,t.length):0,a=n.slice();return function(i){for(r=0;r<e;++r)a[r]=t[r]*(1-i)+n[r]*i;return a}}function E(t,n){var r,e=n?n.length:0,a=t?Math.min(e,t.length):0,i=new Array(a),o=new Array(e);for(r=0;r<a;++r)i[r]=I(t[r],n[r]);for(;r<e;++r)o[r]=n[r];return function(t){for(r=0;r<a;++r)o[r]=i[r](t);return o}}function F(t,n){var r=new Date;return t=+t,n=+n,function(e){return r.setTime(t*(1-e)+n*e),r}}function _(t,n){var r,e={},a={};for(r in null!==t&&"object"==typeof t||(t={}),null!==n&&"object"==typeof n||(n={}),n)r in t?e[r]=I(t[r],n[r]):a[r]=n[r];return function(t){for(r in e)a[r]=e[r](t);return a}}function I(t,n){var r,e,l=typeof n;return null==n||"boolean"===l?a(n):("number"===l?i:"string"===l?(r=o(n))?(n=r,u):c:n instanceof o?u:n instanceof Date?F:(e=n,!ArrayBuffer.isView(e)||e instanceof DataView?Array.isArray(n)?E:"function"!=typeof n.valueOf&&"function"!=typeof n.toString||isNaN(n)?_:i:z))(t,n)}function L(t,n){return t=+t,n=+n,function(r){return Math.round(t*(1-r)+n*r)}}function V(t,n){if((r=(t=n?t.toExponential(n-1):t.toExponential()).indexOf("e"))<0)return null;var r,e=t.slice(0,r);return[e.length>1?e[0]+e.slice(2):e,+t.slice(r+1)]}function D(t){return(t=V(Math.abs(t)))?t[1]:NaN}var O,P=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function B(t){if(!(n=P.exec(t)))throw new Error("invalid format: "+t);var n;return new $({fill:n[1],align:n[2],sign:n[3],symbol:n[4],zero:n[5],width:n[6],comma:n[7],precision:n[8]&&n[8].slice(1),trim:n[9],type:n[10]})}function $(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}function H(t,n){var r=V(t,n);if(!r)return t+"";var e=r[0],a=r[1];return a<0?"0."+new Array(-a).join("0")+e:e.length>a+1?e.slice(0,a+1)+"."+e.slice(a+1):e+new Array(a-e.length+2).join("0")}B.prototype=$.prototype,$.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var Y={"%":function(t,n){return(100*t).toFixed(n)},b:function(t){return Math.round(t).toString(2)},c:function(t){return t+""},d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:function(t,n){return t.toExponential(n)},f:function(t,n){return t.toFixed(n)},g:function(t,n){return t.toPrecision(n)},o:function(t){return Math.round(t).toString(8)},p:function(t,n){return H(100*t,n)},r:H,s:function(t,n){var r=V(t,n);if(!r)return t+"";var e=r[0],a=r[1],i=a-(O=3*Math.max(-8,Math.min(8,Math.floor(a/3))))+1,o=e.length;return i===o?e:i>o?e+new Array(i-o+1).join("0"):i>0?e.slice(0,i)+"."+e.slice(i):"0."+new Array(1-i).join("0")+V(t,Math.max(0,n+i-1))[0]},X:function(t){return Math.round(t).toString(16).toUpperCase()},x:function(t){return Math.round(t).toString(16)}};function q(t){return t}var T,R,W,X=Array.prototype.map,G=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function U(t){var n,r,e=void 0===t.grouping||void 0===t.thousands?q:(n=X.call(t.grouping,Number),r=t.thousands+"",function(t,e){for(var a=t.length,i=[],o=0,u=n[0],c=0;a>0&&u>0&&(c+u+1>e&&(u=Math.max(1,e-c)),i.push(t.substring(a-=u,a+u)),!((c+=u+1)>e));)u=n[o=(o+1)%n.length];return i.reverse().join(r)}),a=void 0===t.currency?"":t.currency[0]+"",i=void 0===t.currency?"":t.currency[1]+"",o=void 0===t.decimal?".":t.decimal+"",u=void 0===t.numerals?q:function(t){return function(n){return n.replace(/[0-9]/g,(function(n){return t[+n]}))}}(X.call(t.numerals,String)),c=void 0===t.percent?"%":t.percent+"",l=void 0===t.minus?"-":t.minus+"",s=void 0===t.nan?"NaN":t.nan+"";function f(t){var n=(t=B(t)).fill,r=t.align,f=t.sign,h=t.symbol,d=t.zero,m=t.width,g=t.comma,p=t.precision,v=t.trim,M=t.type;"n"===M?(g=!0,M="g"):Y[M]||(void 0===p&&(p=12),v=!0,M="g"),(d||"0"===n&&"="===r)&&(d=!0,n="0",r="=");var y="$"===h?a:"#"===h&&/[boxX]/.test(M)?"0"+M.toLowerCase():"",b="$"===h?i:/[%p]/.test(M)?c:"",w=Y[M],x=/[defgprs%]/.test(M);function k(t){var a,i,c,h=y,k=b;if("c"===M)k=w(t)+k,t="";else{var N=(t=+t)<0||1/t<0;if(t=isNaN(t)?s:w(Math.abs(t),p),v&&(t=function(t){t:for(var n,r=t.length,e=1,a=-1;e<r;++e)switch(t[e]){case".":a=n=e;break;case"0":0===a&&(a=e),n=e;break;default:if(!+t[e])break t;a>0&&(a=0)}return a>0?t.slice(0,a)+t.slice(n+1):t}(t)),N&&0==+t&&"+"!==f&&(N=!1),h=(N?"("===f?f:l:"-"===f||"("===f?"":f)+h,k=("s"===M?G[8+O/3]:"")+k+(N&&"("===f?")":""),x)for(a=-1,i=t.length;++a<i;)if(48>(c=t.charCodeAt(a))||c>57){k=(46===c?o+t.slice(a+1):t.slice(a))+k,t=t.slice(0,a);break}}g&&!d&&(t=e(t,1/0));var A=h.length+t.length+k.length,C=A<m?new Array(m-A+1).join(n):"";switch(g&&d&&(t=e(C+t,C.length?m-k.length:1/0),C=""),r){case"<":t=h+t+k+C;break;case"=":t=h+C+t+k;break;case"^":t=C.slice(0,A=C.length>>1)+h+t+k+C.slice(A);break;default:t=C+h+t+k}return u(t)}return p=void 0===p?6:/[gprs]/.test(M)?Math.max(1,Math.min(21,p)):Math.max(0,Math.min(20,p)),k.toString=function(){return t+""},k}return{format:f,formatPrefix:function(t,n){var r=f(((t=B(t)).type="f",t)),e=3*Math.max(-8,Math.min(8,Math.floor(D(n)/3))),a=Math.pow(10,-e),i=G[8+e/3];return function(t){return r(a*t)+i}}}}function Z(){var t,n,r=l().unknown(void 0),e=r.domain,a=r.range,i=[0,1],o=!1,u=0,c=0,f=.5;function h(){var r=e().length,l=i[1]<i[0],s=i[l-0],h=i[1-l];t=(h-s)/Math.max(1,r-u+2*c),o&&(t=Math.floor(t)),s+=(h-s-t*(r-u))*f,n=t*(1-u),o&&(s=Math.round(s),n=Math.round(n));var d=p(r).map((function(n){return s+t*n}));return a(l?d.reverse():d)}return delete r.unknown,r.domain=function(t){return arguments.length?(e(t),h()):e()},r.range=function(t){return arguments.length?(i=[+t[0],+t[1]],h()):i.slice()},r.rangeRound=function(t){return i=[+t[0],+t[1]],o=!0,h()},r.bandwidth=function(){return n},r.step=function(){return t},r.round=function(t){return arguments.length?(o=!!t,h()):o},r.padding=function(t){return arguments.length?(u=Math.min(1,c=+t),h()):u},r.paddingInner=function(t){return arguments.length?(u=Math.min(1,t),h()):u},r.paddingOuter=function(t){return arguments.length?(c=+t,h()):c},r.align=function(t){return arguments.length?(f=Math.max(0,Math.min(1,t)),h()):f},r.copy=function(){return Z(e(),i).round(o).paddingInner(u).paddingOuter(c).align(f)},s.apply(h(),arguments)}function J(t){return+t}T=U({decimal:".",thousands:",",grouping:[3],currency:["$",""],minus:"-"}),R=T.format,W=T.formatPrefix;var K=[0,1];function Q(t){return t}function tt(t,n){return(n-=t=+t)?function(r){return(r-t)/n}:(r=isNaN(n)?NaN:.5,function(){return r});var r}function nt(t){var n,r=t[0],e=t[t.length-1];return r>e&&(n=r,r=e,e=n),function(t){return Math.max(r,Math.min(e,t))}}function rt(t,n,r){var e=t[0],a=t[1],i=n[0],o=n[1];return a<e?(e=tt(a,e),i=r(o,i)):(e=tt(e,a),i=r(i,o)),function(t){return i(e(t))}}function et(t,n,r){var e=Math.min(t.length,n.length)-1,a=new Array(e),i=new Array(e),o=-1;for(t[e]<t[0]&&(t=t.slice().reverse(),n=n.slice().reverse());++o<e;)a[o]=tt(t[o],t[o+1]),i[o]=r(n[o],n[o+1]);return function(n){var r=d(t,n,1,e)-1;return i[r](a[r](n))}}function at(t,n){return n.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function it(t,n){return function(){var t,n,r,e,a,o,u=K,c=K,l=I,s=Q;function d(){return e=Math.min(u.length,c.length)>2?et:rt,a=o=null,m}function m(n){return isNaN(n=+n)?r:(a||(a=e(u.map(t),c,l)))(t(s(n)))}return m.invert=function(r){return s(n((o||(o=e(c,u.map(t),i)))(r)))},m.domain=function(t){return arguments.length?(u=f.call(t,J),s===Q||(s=nt(u)),d()):u.slice()},m.range=function(t){return arguments.length?(c=h.call(t),d()):c.slice()},m.rangeRound=function(t){return c=h.call(t),l=L,d()},m.clamp=function(t){return arguments.length?(s=t?nt(u):Q,m):s!==Q},m.interpolate=function(t){return arguments.length?(l=t,d()):l},m.unknown=function(t){return arguments.length?(r=t,m):r},function(r,e){return t=r,n=e,d()}}()(t,n)}function ot(t,n,r,e){var a,i=function(t,n,r){var e=Math.abs(n-t)/Math.max(0,r),a=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),i=e/a;return i>=v?a*=10:i>=M?a*=5:i>=y&&(a*=2),n<t?-a:a}(t,n,r);switch((e=B(null==e?",f":e)).type){case"s":var o=Math.max(Math.abs(t),Math.abs(n));return null!=e.precision||isNaN(a=function(t,n){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(D(n)/3)))-D(Math.abs(t)))}(i,o))||(e.precision=a),W(e,o);case"":case"e":case"g":case"p":case"r":null!=e.precision||isNaN(a=function(t,n){return t=Math.abs(t),n=Math.abs(n)-t,Math.max(0,D(n)-D(t))+1}(i,Math.max(Math.abs(t),Math.abs(n))))||(e.precision=a-("e"===e.type));break;case"f":case"%":null!=e.precision||isNaN(a=function(t){return Math.max(0,-D(Math.abs(t)))}(i))||(e.precision=a-2*("%"===e.type))}return R(e)}function ut(t){var n=t.domain;return t.ticks=function(t){var r=n();return function(t,n,r){var e,a,i,o,u=-1;if(r=+r,(t=+t)==(n=+n)&&r>0)return[t];if((e=n<t)&&(a=t,t=n,n=a),0===(o=b(t,n,r))||!isFinite(o))return[];if(o>0)for(t=Math.ceil(t/o),n=Math.floor(n/o),i=new Array(a=Math.ceil(n-t+1));++u<a;)i[u]=(t+u)*o;else for(t=Math.floor(t*o),n=Math.ceil(n*o),i=new Array(a=Math.ceil(t-n+1));++u<a;)i[u]=(t-u)/o;return e&&i.reverse(),i}(r[0],r[r.length-1],null==t?10:t)},t.tickFormat=function(t,r){var e=n();return ot(e[0],e[e.length-1],null==t?10:t,r)},t.nice=function(r){null==r&&(r=10);var e,a=n(),i=0,o=a.length-1,u=a[i],c=a[o];return c<u&&(e=u,u=c,c=e,e=i,i=o,o=e),(e=b(u,c,r))>0?e=b(u=Math.floor(u/e)*e,c=Math.ceil(c/e)*e,r):e<0&&(e=b(u=Math.ceil(u*e)/e,c=Math.floor(c*e)/e,r)),e>0?(a[i]=Math.floor(u/e)*e,a[o]=Math.ceil(c/e)*e,n(a)):e<0&&(a[i]=Math.ceil(u*e)/e,a[o]=Math.floor(c*e)/e,n(a)),t},t}function ct(){var t=it(Q,Q);return t.copy=function(){return at(t,ct())},s.apply(t,arguments),ut(t)}g("#barChart {\n width: 100%; }\n");var lt=function(e){var a=e.className,i=e.barChartData,o=e.setSelectedYear,u=e.fontColor,c=e.barColor,l=e.width;if(!i||0===i.length)return null;var s=100,f=30,h=90,d=30,g=window.innerWidth<767?2*window.innerWidth-s-h:700-s-h,v=function(t){var n=0;t.forEach((function(t){parseInt(t.count,10)>n&&(n=parseInt(t.count,10))})),m("div#barChart").html("");var r,e=m("#barChart").append("svg").attr("width",l+d+f).attr("height",g+s+h).append("g").attr("transform","translate(".concat(d,",").concat(s,")")),a=Z().range([0,l]).domain(t.map((function(t){return t.year}))).padding(.2);e.append("g").attr("transform","translate(0,".concat(g,")")).call((r=a,j(3,r))).style("color",u).selectAll("text").attr("transform","translate(-10,0)rotate(-45)").style("text-anchor","end").style("color",u).style("font-size",16);var i=ct().domain([0,n]).range([g,0]);e.selectAll("mybar").data(t).enter().append("rect").attr("x",(function(t){return a(t.year)})).attr("width",a.bandwidth()).attr("fill",c).attr("title",(function(t){return t.count})).attr("height",(function(){return g-i(0)})).attr("y",(function(){return i(0)})).style("cursor","pointer").on("click",(function(t){return o(t.year)})).append("svg:title").text((function(t){return"數量:".concat(t.count)})),e.selectAll("rect").transition().duration(800).attr("y",(function(t){return i(t.count)})).attr("height",(function(t){return g-i(t.count)})).delay((function(t,n){return 10*n})),e.append("g").call(function(t){return j(4,t)}(i).tickValues(p(i.domain()[0],i.domain()[1]+1,1)).tickFormat((function(t){return Math.round(t)}))).attr("id","yaxis").style("color",u).style("font-size",15)};function M(){var t=document.getElementById("barChart__block");0===t.scrollLeft&&document.getElementById("yaxis").setAttribute("transform","translate(0, 0 )"),t.scrollLeft>0&&document.getElementById("yaxis").setAttribute("transform","translate(".concat(t.scrollLeft,", 0)"))}return n((function(){i.length>0&&v(i),document.getElementById("barChart__block").addEventListener("scroll",M)}),[i]),t.createElement("div",{id:"barChart",className:r("barChart",a)})};lt.defaultProps={className:void 0,barChartData:[],setSelectedYear:function(){return null},fontColor:"#000",barColor:"#69b3a2",width:2e3},lt.propTypes={className:e.string,barChartData:e.arrayOf(e.any),setSelectedYear:e.func,fontColor:e.string,barColor:e.string,width:e.number};export{lt as default};
|
|
1
|
+
import t,{useEffect as n}from"react";import{c as r}from"./index-b2745105.js";import e from"prop-types";import{f as a,g as i,h as o,j as u,k as c,o as l,l as s,n as f,s as h,p as d,d as m}from"./transform-011f0fe5.js";import{s as g}from"./style-inject.es-1f59c1d0.js";function p(t,n,r){t=+t,n=+n,r=(a=arguments.length)<2?(n=t,t=0,1):a<3?1:+r;for(var e=-1,a=0|Math.max(0,Math.ceil((n-t)/r)),i=new Array(a);++e<a;)i[e]=t+e*r;return i}var v=Math.sqrt(50),M=Math.sqrt(10),y=Math.sqrt(2);function b(t,n,r){var e=(n-t)/Math.max(0,r),a=Math.floor(Math.log(e)/Math.LN10),i=e/Math.pow(10,a);return a>=0?(i>=v?10:i>=M?5:i>=y?2:1)*Math.pow(10,a):-Math.pow(10,-a)/(i>=v?10:i>=M?5:i>=y?2:1)}var w=Array.prototype.slice;function x(t){return t}function k(t){return"translate("+(t+.5)+",0)"}function N(t){return"translate(0,"+(t+.5)+")"}function A(t){return function(n){return+t(n)}}function C(t){var n=Math.max(0,t.bandwidth()-1)/2;return t.round()&&(n=Math.round(n)),function(r){return+t(r)+n}}function S(){return!this.__axis}function j(t,n){var r=[],e=null,a=null,i=6,o=6,u=3,c=1===t||4===t?-1:1,l=4===t||2===t?"x":"y",s=1===t||3===t?k:N;function f(f){var h=null==e?n.ticks?n.ticks.apply(n,r):n.domain():e,d=null==a?n.tickFormat?n.tickFormat.apply(n,r):x:a,m=Math.max(i,0)+u,g=n.range(),p=+g[0]+.5,v=+g[g.length-1]+.5,M=(n.bandwidth?C:A)(n.copy()),y=f.selection?f.selection():f,b=y.selectAll(".domain").data([null]),w=y.selectAll(".tick").data(h,n).order(),k=w.exit(),N=w.enter().append("g").attr("class","tick"),j=w.select("line"),z=w.select("text");b=b.merge(b.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),w=w.merge(N),j=j.merge(N.append("line").attr("stroke","currentColor").attr(l+"2",c*i)),z=z.merge(N.append("text").attr("fill","currentColor").attr(l,c*m).attr("dy",1===t?"0em":3===t?"0.71em":"0.32em")),f!==y&&(b=b.transition(f),w=w.transition(f),j=j.transition(f),z=z.transition(f),k=k.transition(f).attr("opacity",1e-6).attr("transform",(function(t){return isFinite(t=M(t))?s(t):this.getAttribute("transform")})),N.attr("opacity",1e-6).attr("transform",(function(t){var n=this.parentNode.__axis;return s(n&&isFinite(n=n(t))?n:M(t))}))),k.remove(),b.attr("d",4===t||2==t?o?"M"+c*o+","+p+"H0.5V"+v+"H"+c*o:"M0.5,"+p+"V"+v:o?"M"+p+","+c*o+"V0.5H"+v+"V"+c*o:"M"+p+",0.5H"+v),w.attr("opacity",1).attr("transform",(function(t){return s(M(t))})),j.attr(l+"2",c*i),z.attr(l,c*m).text(d),y.filter(S).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",2===t?"start":4===t?"end":"middle"),y.each((function(){this.__axis=M}))}return f.scale=function(t){return arguments.length?(n=t,f):n},f.ticks=function(){return r=w.call(arguments),f},f.tickArguments=function(t){return arguments.length?(r=null==t?[]:w.call(t),f):r.slice()},f.tickValues=function(t){return arguments.length?(e=null==t?null:w.call(t),f):e&&e.slice()},f.tickFormat=function(t){return arguments.length?(a=t,f):a},f.tickSize=function(t){return arguments.length?(i=o=+t,f):i},f.tickSizeInner=function(t){return arguments.length?(i=+t,f):i},f.tickSizeOuter=function(t){return arguments.length?(o=+t,f):o},f.tickPadding=function(t){return arguments.length?(u=+t,f):u},f}function z(t,n){n||(n=[]);var r,e=t?Math.min(n.length,t.length):0,a=n.slice();return function(i){for(r=0;r<e;++r)a[r]=t[r]*(1-i)+n[r]*i;return a}}function E(t,n){var r,e=n?n.length:0,a=t?Math.min(e,t.length):0,i=new Array(a),o=new Array(e);for(r=0;r<a;++r)i[r]=I(t[r],n[r]);for(;r<e;++r)o[r]=n[r];return function(t){for(r=0;r<a;++r)o[r]=i[r](t);return o}}function F(t,n){var r=new Date;return t=+t,n=+n,function(e){return r.setTime(t*(1-e)+n*e),r}}function _(t,n){var r,e={},a={};for(r in null!==t&&"object"==typeof t||(t={}),null!==n&&"object"==typeof n||(n={}),n)r in t?e[r]=I(t[r],n[r]):a[r]=n[r];return function(t){for(r in e)a[r]=e[r](t);return a}}function I(t,n){var r,e,l=typeof n;return null==n||"boolean"===l?a(n):("number"===l?i:"string"===l?(r=o(n))?(n=r,u):c:n instanceof o?u:n instanceof Date?F:(e=n,!ArrayBuffer.isView(e)||e instanceof DataView?Array.isArray(n)?E:"function"!=typeof n.valueOf&&"function"!=typeof n.toString||isNaN(n)?_:i:z))(t,n)}function L(t,n){return t=+t,n=+n,function(r){return Math.round(t*(1-r)+n*r)}}function V(t,n){if((r=(t=n?t.toExponential(n-1):t.toExponential()).indexOf("e"))<0)return null;var r,e=t.slice(0,r);return[e.length>1?e[0]+e.slice(2):e,+t.slice(r+1)]}function D(t){return(t=V(Math.abs(t)))?t[1]:NaN}var O,P=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function B(t){if(!(n=P.exec(t)))throw new Error("invalid format: "+t);var n;return new $({fill:n[1],align:n[2],sign:n[3],symbol:n[4],zero:n[5],width:n[6],comma:n[7],precision:n[8]&&n[8].slice(1),trim:n[9],type:n[10]})}function $(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}function H(t,n){var r=V(t,n);if(!r)return t+"";var e=r[0],a=r[1];return a<0?"0."+new Array(-a).join("0")+e:e.length>a+1?e.slice(0,a+1)+"."+e.slice(a+1):e+new Array(a-e.length+2).join("0")}B.prototype=$.prototype,$.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var Y={"%":function(t,n){return(100*t).toFixed(n)},b:function(t){return Math.round(t).toString(2)},c:function(t){return t+""},d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:function(t,n){return t.toExponential(n)},f:function(t,n){return t.toFixed(n)},g:function(t,n){return t.toPrecision(n)},o:function(t){return Math.round(t).toString(8)},p:function(t,n){return H(100*t,n)},r:H,s:function(t,n){var r=V(t,n);if(!r)return t+"";var e=r[0],a=r[1],i=a-(O=3*Math.max(-8,Math.min(8,Math.floor(a/3))))+1,o=e.length;return i===o?e:i>o?e+new Array(i-o+1).join("0"):i>0?e.slice(0,i)+"."+e.slice(i):"0."+new Array(1-i).join("0")+V(t,Math.max(0,n+i-1))[0]},X:function(t){return Math.round(t).toString(16).toUpperCase()},x:function(t){return Math.round(t).toString(16)}};function q(t){return t}var T,R,W,X=Array.prototype.map,G=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function U(t){var n,r,e=void 0===t.grouping||void 0===t.thousands?q:(n=X.call(t.grouping,Number),r=t.thousands+"",function(t,e){for(var a=t.length,i=[],o=0,u=n[0],c=0;a>0&&u>0&&(c+u+1>e&&(u=Math.max(1,e-c)),i.push(t.substring(a-=u,a+u)),!((c+=u+1)>e));)u=n[o=(o+1)%n.length];return i.reverse().join(r)}),a=void 0===t.currency?"":t.currency[0]+"",i=void 0===t.currency?"":t.currency[1]+"",o=void 0===t.decimal?".":t.decimal+"",u=void 0===t.numerals?q:function(t){return function(n){return n.replace(/[0-9]/g,(function(n){return t[+n]}))}}(X.call(t.numerals,String)),c=void 0===t.percent?"%":t.percent+"",l=void 0===t.minus?"-":t.minus+"",s=void 0===t.nan?"NaN":t.nan+"";function f(t){var n=(t=B(t)).fill,r=t.align,f=t.sign,h=t.symbol,d=t.zero,m=t.width,g=t.comma,p=t.precision,v=t.trim,M=t.type;"n"===M?(g=!0,M="g"):Y[M]||(void 0===p&&(p=12),v=!0,M="g"),(d||"0"===n&&"="===r)&&(d=!0,n="0",r="=");var y="$"===h?a:"#"===h&&/[boxX]/.test(M)?"0"+M.toLowerCase():"",b="$"===h?i:/[%p]/.test(M)?c:"",w=Y[M],x=/[defgprs%]/.test(M);function k(t){var a,i,c,h=y,k=b;if("c"===M)k=w(t)+k,t="";else{var N=(t=+t)<0||1/t<0;if(t=isNaN(t)?s:w(Math.abs(t),p),v&&(t=function(t){t:for(var n,r=t.length,e=1,a=-1;e<r;++e)switch(t[e]){case".":a=n=e;break;case"0":0===a&&(a=e),n=e;break;default:if(!+t[e])break t;a>0&&(a=0)}return a>0?t.slice(0,a)+t.slice(n+1):t}(t)),N&&0==+t&&"+"!==f&&(N=!1),h=(N?"("===f?f:l:"-"===f||"("===f?"":f)+h,k=("s"===M?G[8+O/3]:"")+k+(N&&"("===f?")":""),x)for(a=-1,i=t.length;++a<i;)if(48>(c=t.charCodeAt(a))||c>57){k=(46===c?o+t.slice(a+1):t.slice(a))+k,t=t.slice(0,a);break}}g&&!d&&(t=e(t,1/0));var A=h.length+t.length+k.length,C=A<m?new Array(m-A+1).join(n):"";switch(g&&d&&(t=e(C+t,C.length?m-k.length:1/0),C=""),r){case"<":t=h+t+k+C;break;case"=":t=h+C+t+k;break;case"^":t=C.slice(0,A=C.length>>1)+h+t+k+C.slice(A);break;default:t=C+h+t+k}return u(t)}return p=void 0===p?6:/[gprs]/.test(M)?Math.max(1,Math.min(21,p)):Math.max(0,Math.min(20,p)),k.toString=function(){return t+""},k}return{format:f,formatPrefix:function(t,n){var r=f(((t=B(t)).type="f",t)),e=3*Math.max(-8,Math.min(8,Math.floor(D(n)/3))),a=Math.pow(10,-e),i=G[8+e/3];return function(t){return r(a*t)+i}}}}function Z(){var t,n,r=l().unknown(void 0),e=r.domain,a=r.range,i=[0,1],o=!1,u=0,c=0,f=.5;function h(){var r=e().length,l=i[1]<i[0],s=i[l-0],h=i[1-l];t=(h-s)/Math.max(1,r-u+2*c),o&&(t=Math.floor(t)),s+=(h-s-t*(r-u))*f,n=t*(1-u),o&&(s=Math.round(s),n=Math.round(n));var d=p(r).map((function(n){return s+t*n}));return a(l?d.reverse():d)}return delete r.unknown,r.domain=function(t){return arguments.length?(e(t),h()):e()},r.range=function(t){return arguments.length?(i=[+t[0],+t[1]],h()):i.slice()},r.rangeRound=function(t){return i=[+t[0],+t[1]],o=!0,h()},r.bandwidth=function(){return n},r.step=function(){return t},r.round=function(t){return arguments.length?(o=!!t,h()):o},r.padding=function(t){return arguments.length?(u=Math.min(1,c=+t),h()):u},r.paddingInner=function(t){return arguments.length?(u=Math.min(1,t),h()):u},r.paddingOuter=function(t){return arguments.length?(c=+t,h()):c},r.align=function(t){return arguments.length?(f=Math.max(0,Math.min(1,t)),h()):f},r.copy=function(){return Z(e(),i).round(o).paddingInner(u).paddingOuter(c).align(f)},s.apply(h(),arguments)}function J(t){return+t}T=U({decimal:".",thousands:",",grouping:[3],currency:["$",""],minus:"-"}),R=T.format,W=T.formatPrefix;var K=[0,1];function Q(t){return t}function tt(t,n){return(n-=t=+t)?function(r){return(r-t)/n}:(r=isNaN(n)?NaN:.5,function(){return r});var r}function nt(t){var n,r=t[0],e=t[t.length-1];return r>e&&(n=r,r=e,e=n),function(t){return Math.max(r,Math.min(e,t))}}function rt(t,n,r){var e=t[0],a=t[1],i=n[0],o=n[1];return a<e?(e=tt(a,e),i=r(o,i)):(e=tt(e,a),i=r(i,o)),function(t){return i(e(t))}}function et(t,n,r){var e=Math.min(t.length,n.length)-1,a=new Array(e),i=new Array(e),o=-1;for(t[e]<t[0]&&(t=t.slice().reverse(),n=n.slice().reverse());++o<e;)a[o]=tt(t[o],t[o+1]),i[o]=r(n[o],n[o+1]);return function(n){var r=d(t,n,1,e)-1;return i[r](a[r](n))}}function at(t,n){return n.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function it(t,n){return function(){var t,n,r,e,a,o,u=K,c=K,l=I,s=Q;function d(){return e=Math.min(u.length,c.length)>2?et:rt,a=o=null,m}function m(n){return isNaN(n=+n)?r:(a||(a=e(u.map(t),c,l)))(t(s(n)))}return m.invert=function(r){return s(n((o||(o=e(c,u.map(t),i)))(r)))},m.domain=function(t){return arguments.length?(u=f.call(t,J),s===Q||(s=nt(u)),d()):u.slice()},m.range=function(t){return arguments.length?(c=h.call(t),d()):c.slice()},m.rangeRound=function(t){return c=h.call(t),l=L,d()},m.clamp=function(t){return arguments.length?(s=t?nt(u):Q,m):s!==Q},m.interpolate=function(t){return arguments.length?(l=t,d()):l},m.unknown=function(t){return arguments.length?(r=t,m):r},function(r,e){return t=r,n=e,d()}}()(t,n)}function ot(t,n,r,e){var a,i=function(t,n,r){var e=Math.abs(n-t)/Math.max(0,r),a=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),i=e/a;return i>=v?a*=10:i>=M?a*=5:i>=y&&(a*=2),n<t?-a:a}(t,n,r);switch((e=B(null==e?",f":e)).type){case"s":var o=Math.max(Math.abs(t),Math.abs(n));return null!=e.precision||isNaN(a=function(t,n){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(D(n)/3)))-D(Math.abs(t)))}(i,o))||(e.precision=a),W(e,o);case"":case"e":case"g":case"p":case"r":null!=e.precision||isNaN(a=function(t,n){return t=Math.abs(t),n=Math.abs(n)-t,Math.max(0,D(n)-D(t))+1}(i,Math.max(Math.abs(t),Math.abs(n))))||(e.precision=a-("e"===e.type));break;case"f":case"%":null!=e.precision||isNaN(a=function(t){return Math.max(0,-D(Math.abs(t)))}(i))||(e.precision=a-2*("%"===e.type))}return R(e)}function ut(t){var n=t.domain;return t.ticks=function(t){var r=n();return function(t,n,r){var e,a,i,o,u=-1;if(r=+r,(t=+t)==(n=+n)&&r>0)return[t];if((e=n<t)&&(a=t,t=n,n=a),0===(o=b(t,n,r))||!isFinite(o))return[];if(o>0)for(t=Math.ceil(t/o),n=Math.floor(n/o),i=new Array(a=Math.ceil(n-t+1));++u<a;)i[u]=(t+u)*o;else for(t=Math.floor(t*o),n=Math.ceil(n*o),i=new Array(a=Math.ceil(t-n+1));++u<a;)i[u]=(t-u)/o;return e&&i.reverse(),i}(r[0],r[r.length-1],null==t?10:t)},t.tickFormat=function(t,r){var e=n();return ot(e[0],e[e.length-1],null==t?10:t,r)},t.nice=function(r){null==r&&(r=10);var e,a=n(),i=0,o=a.length-1,u=a[i],c=a[o];return c<u&&(e=u,u=c,c=e,e=i,i=o,o=e),(e=b(u,c,r))>0?e=b(u=Math.floor(u/e)*e,c=Math.ceil(c/e)*e,r):e<0&&(e=b(u=Math.ceil(u*e)/e,c=Math.floor(c*e)/e,r)),e>0?(a[i]=Math.floor(u/e)*e,a[o]=Math.ceil(c/e)*e,n(a)):e<0&&(a[i]=Math.ceil(u*e)/e,a[o]=Math.floor(c*e)/e,n(a)),t},t}function ct(){var t=it(Q,Q);return t.copy=function(){return at(t,ct())},s.apply(t,arguments),ut(t)}g("#barChart {\n width: 100%; }\n");var lt=function(e){var a=e.className,i=e.barChartData,o=e.setSelectedYear,u=e.fontColor,c=e.barColor,l=e.width;if(!i||0===i.length)return null;var s=100,f=30,h=90,d=30,g=window.innerWidth<767?2*window.innerWidth-s-h:700-s-h,v=function(t){var n=0;t.forEach((function(t){parseInt(t.count,10)>n&&(n=parseInt(t.count,10))})),m("div#barChart").html("");var r,e=m("#barChart").append("svg").attr("width",l+d+f).attr("height",g+s+h).append("g").attr("transform","translate(".concat(d,",").concat(s,")")),a=Z().range([0,l]).domain(t.map((function(t){return t.year}))).padding(.2);e.append("g").attr("transform","translate(0,".concat(g,")")).call((r=a,j(3,r))).style("color",u).selectAll("text").attr("transform","translate(-10,0)rotate(-45)").style("text-anchor","end").style("color",u).style("font-size",16);var i=ct().domain([0,n]).range([g,0]);e.selectAll("mybar").data(t).enter().append("rect").attr("x",(function(t){return a(t.year)})).attr("width",a.bandwidth()).attr("fill",c).attr("title",(function(t){return t.count})).attr("height",(function(){return g-i(0)})).attr("y",(function(){return i(0)})).style("cursor","pointer").on("click",(function(t){return o(t.year)})).append("svg:title").text((function(t){return"數量:".concat(t.count)})),e.selectAll("rect").transition().duration(800).attr("y",(function(t){return i(t.count)})).attr("height",(function(t){return g-i(t.count)})).delay((function(t,n){return 10*n})),e.append("g").call(function(t){return j(4,t)}(i).tickValues(p(i.domain()[0],i.domain()[1]+1,1)).tickFormat((function(t){return Math.round(t)}))).attr("id","yaxis").style("color",u).style("font-size",15)};function M(){var t=document.getElementById("barChart__block");0===t.scrollLeft&&document.getElementById("yaxis").setAttribute("transform","translate(0, 0 )"),t.scrollLeft>0&&document.getElementById("yaxis").setAttribute("transform","translate(".concat(t.scrollLeft,", 0)"))}return n((function(){i.length>0&&v(i),document.getElementById("barChart__block").addEventListener("scroll",M)}),[i]),t.createElement("div",{id:"barChart",className:r("barChart",a)})};lt.defaultProps={className:void 0,barChartData:[],setSelectedYear:function(){return null},fontColor:"#000",barColor:"#69b3a2",width:2e3},lt.propTypes={className:e.string,barChartData:e.arrayOf(e.any),setSelectedYear:e.func,fontColor:e.string,barColor:e.string,width:e.number};export{lt as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import e from"react";import{c as t}from"./index-b2745105.js";import r from"prop-types";import{NavLink as a}from"react-router-dom";import{Typography as n,Breadcrumbs as o}from"@material-ui/core";import{s as c}from"./style-inject.es-1f59c1d0.js";c(".breadcrumbItem {\n display: flex;\n opacity: 0.8;\n transition: opacity 0.1s ease-in-out; }\n .breadcrumbItem:hover {\n opacity: 1; }\n .breadcrumbItem--last {\n opacity: 1;\n font-weight: 500 !important; }\n .breadcrumbItem__icon {\n display: flex;\n align-items: center;\n margin-right: 4px; }\n .breadcrumbItem__icon svg {\n font-size: 18px; }\n");const i=r=>{let{className:a,icon:o,text:c,lastItem:i,onClick:s}=r;return e.createElement(n,{color:"textPrimary",className:a,onClick:s},e.createElement("div",{className:t("breadcrumbItem",{"breadcrumbItem--last":i})},o&&e.createElement("span",{className:"breadcrumbItem__icon"},o),e.createElement("span",{className:"breadcrumbItem__text"},c)))};i.defaultProps={className:void 0,icon:void 0,text:void 0,lastItem:void 0,onClick:()=>{}},i.propTypes={className:r.string,icon:r.node,text:r.string,lastItem:r.bool,onClick:r.func};c(".breadcrumbs__link {\n cursor: pointer;\n text-decoration: none !important; }\n");var s=function(r){var n=r.className,c=r.links,s=r.separator;return e.createElement(o,{className:t("breadcrumbs",n),"aria-label":"breadcrumb",separator:s&&s.length>0?s:void 0},Array.isArray(c)&&c.length>0&&c.map((function(t,r){var n=t.icon,o=t.text,s=t.href,m=t.onClick;return r===c.length-1?e.createElement(i,{key:r.toString(),lastItem:!0,icon:n,text:o,onClick:m}):0===r?e.createElement(a,{className:"breadcrumbs__link",key:r.toString(),to:s||"/",onClick:m},e.createElement(i,{icon:n,text:o})):s?e.createElement(a,{className:"breadcrumbs__link",key:r.toString(),to:s,onClick:m},e.createElement(i,{icon:n,text:o})):e.createElement(i,{key:r.toString(),lastItem:!0,icon:n,text:o,onClick:m})})))};s.defaultProps={className:void 0,links:void 0,separator:void 0},s.propTypes={className:r.string,links:r.arrayOf(r.any),separator:r.string};export{s as default};
|
package/lib/components/Button.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import e from"react";import o from"prop-types";import{c as n}from"./index-b2745105.js";import{Button as t,CircularProgress as i}from"@material-ui/core";import{s as a}from"./style-inject.es-1f59c1d0.js";a(".button {\n border: 1px solid #ffffff99;\n border-radius: 45px;\n padding: 8px 16px;\n background: #007bff;\n color: white;\n cursor: pointer; }\n .button:hover {\n opacity: 0.9; }\n");var r=function(o){var a=o.style,r=o.className,d=o.tabIndex,l=o.alt,s=o.text,c=o.size,f=o.variant,p=o.type,m=o.color,b=o.loading,u=o.disabled,v=o.icon,y=o.endIcon,x=o.children,g=o.onClick;return e.createElement(t,{style:a,className:n("button",r),tabIndex:d,alt:l,size:c,variant:f,color:p||m,disabled:b||u,onClick:g,startIcon:v,endIcon:b?e.createElement(i,{size:16}):y},s,x)};r.defaultProps={style:void 0,className:void 0,tabIndex:void 0,alt:void 0,text:void 0,loading:!1,disabled:!1,variant:void 0,size:"small",color:"primary",type:void 0,children:void 0,icon:void 0,endIcon:void 0,onClick:function(){}},r.propTypes={style:o.objectOf(o.any),className:o.string,tabIndex:o.number,alt:o.string,text:o.string,loading:o.bool,disabled:o.bool,variant:o.oneOf(["contained","outlined","text"]),size:o.oneOf(["small","medium","large"]),color:o.oneOf(["default","inherit","primary","secondary"]),type:o.oneOf(["default","inherit","primary","secondary"]),children:o.node,icon:o.node,endIcon:o.node,onClick:o.func};export{r as default};
|