data-cell-g
Advanced tools
Comparing version 0.1.2 to 0.1.3
import React from 'react'; | ||
import GantColorPicker from 'color-picker-g'; | ||
declare class ColorPicker extends React.Component<any> { | ||
export interface GantColorPickerProps { | ||
onChange?: (color?: string) => void; | ||
value?: string; | ||
} | ||
declare class ColorPicker extends React.Component<GantColorPickerProps> { | ||
static PurePicker: typeof GantColorPicker; | ||
@@ -5,0 +9,0 @@ render(): JSX.Element; |
@@ -1,1 +0,1 @@ | ||
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")),_createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass")),_possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")),_getPrototypeOf2=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")),_inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits")),_typeof2=_interopRequireDefault(require("@babel/runtime/helpers/typeof")),_react=_interopRequireDefault(require("react")),_colorPicker=_interopRequireDefault(require("color-picker-g")),_recompose=require("recompose"),_compose=require("../compose"),__decorate=function(e,r,t,o){var l,i=arguments.length,u=i<3?r:null===o?o=Object.getOwnPropertyDescriptor(r,t):o;if("object"===("undefined"==typeof Reflect?"undefined":(0,_typeof2.default)(Reflect))&&"function"==typeof Reflect.decorate)u=Reflect.decorate(e,r,t,o);else for(var a=e.length-1;0<=a;a--)(l=e[a])&&(u=(i<3?l(u):3<i?l(r,t,u):l(r,t))||u);return 3<i&&u&&Object.defineProperty(r,t,u),u},__rest=function(e,r){var t={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&r.indexOf(o)<0&&(t[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var l=0;for(o=Object.getOwnPropertySymbols(e);l<o.length;l++)r.indexOf(o[l])<0&&Object.prototype.propertyIsEnumerable.call(e,o[l])&&(t[o[l]]=e[o[l]])}return t},withColorPicker=(0,_recompose.compose)((0,_recompose.defaultProps)({onChange:function(){},value:"#ffffff"})),ColorPicker=function(e){function r(){return(0,_classCallCheck2.default)(this,r),(0,_possibleConstructorReturn2.default)(this,(0,_getPrototypeOf2.default)(r).apply(this,arguments))}return(0,_inherits2.default)(r,e),(0,_createClass2.default)(r,[{key:"render",value:function(){var e=this.props,r=(e.addonAfter,e.className,__rest(e,["addonAfter","className"]));return _react.default.createElement("span",null,_react.default.createElement(_colorPicker.default,Object.assign({},r)))}}]),r}(_react.default.Component);(ColorPicker=__decorate([(0,_recompose.compose)(_recompose.toClass,withColorPicker,(0,_compose.withEdit)(function(e){var r=e.value;return r?_react.default.createElement(_colorPicker.default,{value:r,edit:!1}):void 0}))],ColorPicker)).PurePicker=_colorPicker.default;var _default=ColorPicker;exports.default=_default; | ||
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")),_createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass")),_possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")),_getPrototypeOf2=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")),_inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits")),_typeof2=_interopRequireDefault(require("@babel/runtime/helpers/typeof")),_react=_interopRequireDefault(require("react")),_colorPicker=_interopRequireDefault(require("color-picker-g")),_recompose=require("recompose"),_compose=require("../compose");function _createSuper(o){return function(){var e,t=(0,_getPrototypeOf2.default)(o);if(_isNativeReflectConstruct()){var r=(0,_getPrototypeOf2.default)(this).constructor;e=Reflect.construct(t,arguments,r)}else e=t.apply(this,arguments);return(0,_possibleConstructorReturn2.default)(this,e)}}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}var __decorate=function(e,t,r,o){var u,l=arguments.length,c=l<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"===("undefined"==typeof Reflect?"undefined":(0,_typeof2.default)(Reflect))&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,r,o);else for(var i=e.length-1;0<=i;i--)(u=e[i])&&(c=(l<3?u(c):3<l?u(t,r,c):u(t,r))||c);return 3<l&&c&&Object.defineProperty(t,r,c),c},__rest=function(e,t){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var u=0;for(o=Object.getOwnPropertySymbols(e);u<o.length;u++)t.indexOf(o[u])<0&&Object.prototype.propertyIsEnumerable.call(e,o[u])&&(r[o[u]]=e[o[u]])}return r},withColorPicker=(0,_recompose.compose)((0,_recompose.defaultProps)({onChange:function(){},value:"#ffffff"})),ColorPicker=function(e){(0,_inherits2.default)(r,e);var t=_createSuper(r);function r(){return(0,_classCallCheck2.default)(this,r),t.apply(this,arguments)}return(0,_createClass2.default)(r,[{key:"render",value:function(){var e=__rest(this.props,[]);return _react.default.createElement("span",null,_react.default.createElement(_colorPicker.default,Object.assign({},e)))}}]),r}(_react.default.Component);(ColorPicker=__decorate([(0,_recompose.compose)(_recompose.toClass,withColorPicker,(0,_compose.withEdit)(function(e){var t=e.value;return t?_react.default.createElement(_colorPicker.default,{value:t,edit:!1}):void 0}))],ColorPicker)).PurePicker=_colorPicker.default;var _default=ColorPicker;exports.default=_default; |
@@ -1,1 +0,1 @@ | ||
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _react=_interopRequireDefault(require("react")),_Group=_interopRequireDefault(require("../input/Group.js")),__rest=function(e,t){var r={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(r[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(a=Object.getOwnPropertySymbols(e);n<a.length;n++)t.indexOf(a[n])<0&&Object.prototype.propertyIsEnumerable.call(e,a[n])&&(r[a[n]]=e[a[n]])}return r},_default=function(o){return function(e){var t=e.addonAfter,r=e.addonBefore,a=__rest(e,["addonAfter","addonBefore"]),n=_react.default.createFactory(o);return _react.default.createElement(_Group.default,{gantd:!0},r&&_react.default.createElement("span",{className:"ant-input-group-addon"},r),n(a),t&&_react.default.createElement("span",{className:"ant-input-group-addon"},t))}};exports.default=_default; | ||
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _react=_interopRequireDefault(require("react")),_Group=_interopRequireDefault(require("../input/Group")),__rest=function(e,t){var r={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(r[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(a=Object.getOwnPropertySymbols(e);n<a.length;n++)t.indexOf(a[n])<0&&Object.prototype.propertyIsEnumerable.call(e,a[n])&&(r[a[n]]=e[a[n]])}return r},_default=function(o){return function(e){var t=e.addonAfter,r=e.addonBefore,a=__rest(e,["addonAfter","addonBefore"]),n=_react.default.createFactory(o);return _react.default.createElement(_Group.default,{gantd:!0},r&&_react.default.createElement("span",{className:"ant-input-group-addon"},r),n(a),t&&_react.default.createElement("span",{className:"ant-input-group-addon"},t))}};exports.default=_default; |
export { default as withEdit } from '../with-edit'; | ||
export { default as EditStatus } from '../edit-status'; | ||
export { default as SwitchStatus } from '../switch-status'; | ||
export { default as DataEditCell } from '../data-edit-cell'; |
@@ -1,1 +0,1 @@ | ||
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"withEdit",{enumerable:!0,get:function(){return _withEdit.default}}),Object.defineProperty(exports,"EditStatus",{enumerable:!0,get:function(){return _editStatus.default}}),Object.defineProperty(exports,"SwitchStatus",{enumerable:!0,get:function(){return _switchStatus.default}});var _withEdit=_interopRequireDefault(require("../with-edit")),_editStatus=_interopRequireDefault(require("../edit-status")),_switchStatus=_interopRequireDefault(require("../switch-status")); | ||
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"withEdit",{enumerable:!0,get:function(){return _withEdit.default}}),Object.defineProperty(exports,"EditStatus",{enumerable:!0,get:function(){return _editStatus.default}}),Object.defineProperty(exports,"SwitchStatus",{enumerable:!0,get:function(){return _switchStatus.default}}),Object.defineProperty(exports,"DataEditCell",{enumerable:!0,get:function(){return _dataEditCell.default}});var _withEdit=_interopRequireDefault(require("../with-edit")),_editStatus=_interopRequireDefault(require("../edit-status")),_switchStatus=_interopRequireDefault(require("../switch-status")),_dataEditCell=_interopRequireDefault(require("../data-edit-cell")); |
@@ -1,1 +0,1 @@ | ||
"use strict";var _interopRequireWildcard=require("@babel/runtime/helpers/interopRequireWildcard"),_interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")),_react=_interopRequireWildcard(require("react")),_classnames=_interopRequireDefault(require("classnames")),__rest=function(e,r){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)r.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(t[n[a]]=e[n[a]])}return t},_default=function(y){return function(m){return _react.default.forwardRef(function(e,r){var t=e.isInner,n=e.style,a=e.wrapperClassName,u=e.onBlur,i=__rest(e,["isInner","style","wrapperClassName","onBlur"]),l=_react.default.createFactory(m),s=(0,_react.useState)(y),o=(0,_slicedToArray2.default)(s,2),c=o[0],f=o[1],p=(0,_classnames.default)("gant-input-wrapper",{"gant-input-inner":t},a),d=(0,_react.useRef)(null),_=(0,_react.useCallback)(function(e){if(d.current){var r=e.target;if(d.current.contains(r))return;if(!c)return u&&u();for(var t=document.getElementsByClassName(c),n=t.length,a=0;a<n;a++)if(t[a].contains(r))return;u&&u()}},[d.current,u,c]);return(0,_react.useEffect)(function(){return window.addEventListener("mousedown",_),function(){return window.removeEventListener("mousedown",_)}},[_]),_react.default.createElement("div",{className:p,ref:d,style:n},_react.default.createElement("div",{className:"gant-input",ref:r},l(Object.assign(Object.assign({},i),{setPopupClassName:f}))))})}};exports.default=_default; | ||
"use strict";var _interopRequireWildcard=require("@babel/runtime/helpers/interopRequireWildcard"),_interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")),_react=_interopRequireWildcard(require("react")),_classnames=_interopRequireDefault(require("classnames")),__rest=function(e,r){var t={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&r.indexOf(a)<0&&(t[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(a=Object.getOwnPropertySymbols(e);n<a.length;n++)r.indexOf(a[n])<0&&Object.prototype.propertyIsEnumerable.call(e,a[n])&&(t[a[n]]=e[a[n]])}return t},_default=function(S){return function(C){return _react.default.forwardRef(function(e,r){var t=e.isInner,a=e.wrapperStyle,n=e.wrapperClassName,u=e.onBlur,l=e.onFocus,i=e.disabledBlur,s=__rest(e,["isInner","wrapperStyle","wrapperClassName","onBlur","onFocus","disabledBlur"]),c=_react.default.createFactory(C),o=(0,_react.useState)(S),f=(0,_slicedToArray2.default)(o,2),d=f[0],p=f[1],_=(0,_react.useState)(i),m=(0,_slicedToArray2.default)(_,2),b=m[0],y=m[1];(0,_react.useEffect)(function(){y(i)},[i]);var v=(0,_react.useState)(s.autoFocus),w=(0,_slicedToArray2.default)(v,2),q=w[0],O=w[1],g=(0,_classnames.default)("gant-input-wrapper",{"gant-input-inner":t},n),R=(0,_react.useRef)(null),E=(0,_react.useCallback)(function(e){if(R.current&&q&&!b){var r=e.target;if(R.current.contains(r))return;if(!d)return O(!1),u&&u();for(var t=document.getElementsByClassName(d),a=t.length,n=0;n<a;n++)if(t[n].contains(r))return;O(!1),u&&u()}},[R.current,u,d,q,b]);(0,_react.useEffect)(function(){return window.addEventListener("mousedown",E),function(){return window.removeEventListener("mousedown",E)}},[E]);var j=(0,_react.useCallback)(function(e){q||(O(!0),l&&l())},[l,q]);return _react.default.createElement("div",{className:g,ref:R,onClick:j,style:a},_react.default.createElement("div",{className:"gant-input",ref:r},c(Object.assign(Object.assign({},s),{setPopupClassName:p,setDisabledBlur:y}))))})}};exports.default=_default; |
@@ -1,1 +0,1 @@ | ||
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0,require("antd/es/icon/style/css");var _icon=_interopRequireDefault(require("antd/es/icon")),_react=_interopRequireDefault(require("react")),_editStatus=_interopRequireDefault(require("../edit-status")),_classnames=_interopRequireDefault(require("classnames")),emptyText="暂无",undef=void 0,emptyTextArray=[undef,null,NaN,""],renderText=function(i){return function(t){var a=t.setEdit,r=t.allowEdit,e=t.className,n=_react.default.memo(function(){var e=i?i(t):t.value;return emptyTextArray.includes(e)?_react.default.createElement("span",{className:"gant-compose-noContent"},emptyText):e}),u=_react.default.memo(function(){var e=null;return r&&(e=_react.default.createElement("span",{className:"gant-compose-editPen",onClick:function(){return a(_editStatus.default.EDIT)}},_react.default.createElement(_icon.default,{type:"edit"}))),e}),l={width:"100%"};return r&&(l.paddingRight=15),_react.default.createElement("div",{className:(0,_classnames.default)("gant-compose-readWrapper",e),style:l},_react.default.createElement(n,null),_react.default.createElement(u,null))}},_default=renderText;exports.default=_default; | ||
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0,require("antd/es/icon/style/css");var _icon=_interopRequireDefault(require("antd/es/icon")),_react=_interopRequireDefault(require("react")),_editStatus=_interopRequireDefault(require("../edit-status")),_classnames=_interopRequireDefault(require("classnames")),emptyText="暂无",undef=void 0,emptyTextArray=[undef,null,NaN,""],renderText=function(l){return function(t){var a=t.setEdit,r=t.allowEdit,e=_react.default.memo(function(){var e=l?l(t):t.value;return emptyTextArray.includes(e)?_react.default.createElement("span",{className:"gant-compose-noContent"},emptyText):e}),n=_react.default.memo(function(){var e=null;return r&&(e=_react.default.createElement("span",{className:"gant-compose-editPen",onClick:function(){return a(_editStatus.default.EDIT)}},_react.default.createElement(_icon.default,{type:"edit"}))),e}),u={width:"100%"};return r&&(u.paddingRight=15),_react.default.createElement("div",{className:(0,_classnames.default)("gant-compose-readWrapper"),style:u},_react.default.createElement(e,null),_react.default.createElement(n,null))}},_default=renderText;exports.default=_default; |
@@ -1,1 +0,1 @@ | ||
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0,require("antd/es/date-picker/style/css");var _dec,_class,_temp,_datePicker=_interopRequireDefault(require("antd/es/date-picker")),_extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends")),_objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties")),_classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")),_createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass")),_possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")),_getPrototypeOf3=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")),_assertThisInitialized2=_interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized")),_inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits")),_defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty")),_react=_interopRequireDefault(require("react")),_lodash=require("lodash"),_recompose=require("recompose"),_classnames=_interopRequireDefault(require("classnames")),_input=require("../input"),_compose=require("../compose"),_utils=require("./_utils"),getText=function(e){var r=e.value,t=e.format;return r?(0,_utils.getCurTime)(r,t).format(t):""},withDatePicker=(0,_recompose.compose)(_recompose.toClass,(0,_recompose.defaultProps)({style:{},format:"YYYY-MM-DD",onChange:function(){}})),DatePicker=(_dec=(0,_recompose.compose)(withDatePicker,(0,_compose.withEdit)(getText)))((_temp=function(e){function u(){var e,t;(0,_classCallCheck2.default)(this,u);for(var r=arguments.length,i=new Array(r),a=0;a<r;a++)i[a]=arguments[a];return t=(0,_possibleConstructorReturn2.default)(this,(e=(0,_getPrototypeOf3.default)(u)).call.apply(e,[this].concat(i))),(0,_defineProperty2.default)((0,_assertThisInitialized2.default)(t),"onChange",function(e,r){(0,t.props.onChange)(r)}),t}return(0,_inherits2.default)(u,e),(0,_createClass2.default)(u,[{key:"render",value:function(){var e=this.props,r=e.value,t=(0,_objectWithoutProperties2.default)(e,["value"]),i=(0,_classnames.default)("gant-calendar-picker",t.className);return _react.default.createElement(_datePicker.default,(0,_extends2.default)({},t,{value:(0,_utils.getCurTime)(r,t.format),className:i,onChange:this.onChange}))}}]),u}(_react.default.Component),_class=_temp))||_class,_default=DatePicker;exports.default=_default; | ||
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0,require("antd/es/date-picker/style/css");var _datePicker=_interopRequireDefault(require("antd/es/date-picker")),_classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")),_createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass")),_possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")),_getPrototypeOf2=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")),_inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits")),_typeof2=_interopRequireDefault(require("@babel/runtime/helpers/typeof")),_react=_interopRequireDefault(require("react")),_recompose=require("recompose"),_classnames=_interopRequireDefault(require("classnames")),_compose=require("../compose"),_utils=require("./_utils");function _createSuper(a){return function(){var e,t=(0,_getPrototypeOf2.default)(a);if(_isNativeReflectConstruct()){var r=(0,_getPrototypeOf2.default)(this).constructor;e=Reflect.construct(t,arguments,r)}else e=t.apply(this,arguments);return(0,_possibleConstructorReturn2.default)(this,e)}}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}var __decorate=function(e,t,r,a){var u,o=arguments.length,i=o<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,r):a;if("object"===("undefined"==typeof Reflect?"undefined":(0,_typeof2.default)(Reflect))&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,a);else for(var l=e.length-1;0<=l;l--)(u=e[l])&&(i=(o<3?u(i):3<o?u(t,r,i):u(t,r))||i);return 3<o&&i&&Object.defineProperty(t,r,i),i},__rest=function(e,t){var r={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(r[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var u=0;for(a=Object.getOwnPropertySymbols(e);u<a.length;u++)t.indexOf(a[u])<0&&Object.prototype.propertyIsEnumerable.call(e,a[u])&&(r[a[u]]=e[a[u]])}return r},getText=function(e){var t=e.value,r=e.format;return t?(0,_utils.getCurTime)(t,r).format(r):""},withDatePicker=(0,_recompose.compose)(_recompose.toClass,(0,_recompose.defaultProps)({style:{},format:"YYYY-MM-DD",onChange:function(){}})),DatePicker=function(e){(0,_inherits2.default)(a,e);var t=_createSuper(a);function a(){var r;return(0,_classCallCheck2.default)(this,a),(r=t.apply(this,arguments)).onChange=function(e,t){(0,r.props.onChange)(t)},r}return(0,_createClass2.default)(a,[{key:"render",value:function(){var e=this.props,t=e.value,r=e.defaultPickerValue,a=e.defaultValue,u=__rest(e,["value","defaultPickerValue","defaultValue"]),o=(0,_classnames.default)("gant-calendar-picker",u.className);return _react.default.createElement(_datePicker.default,Object.assign({},u,{value:(0,_utils.getCurTime)(t,u.format),defaultValue:(0,_utils.getCurTime)(a,u.format),defaultPickerValue:(0,_utils.getCurTime)(r,u.format),className:o,onChange:this.onChange}))}}]),a}(_react.default.Component),_default=DatePicker=__decorate([(0,_recompose.compose)(withDatePicker,(0,_compose.withEdit)(getText))],DatePicker);exports.default=_default; |
import DatePicker from './DatePicker'; | ||
import RangePicker from './RangePicker'; | ||
export default DatePicker; | ||
export { RangePicker }; |
@@ -1,1 +0,1 @@ | ||
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"RangePicker",{enumerable:!0,get:function(){return _RangePicker.default}}),exports.default=void 0;var _DatePicker=_interopRequireDefault(require("./DatePicker")),_RangePicker=_interopRequireDefault(require("./RangePicker"));_DatePicker.default.RangePicker=_RangePicker.default;var _default=_DatePicker.default;exports.default=_default; | ||
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _DatePicker=_interopRequireDefault(require("./DatePicker")),_RangePicker=_interopRequireDefault(require("./RangePicker"));_DatePicker.default.RangePicker=_RangePicker.default;var _default=_DatePicker.default;exports.default=_default; |
@@ -1,1 +0,1 @@ | ||
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0,require("antd/es/date-picker/style/css");var _dec,_class,_temp,_datePicker=_interopRequireDefault(require("antd/es/date-picker")),_extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends")),_objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties")),_classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")),_createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass")),_possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")),_getPrototypeOf3=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")),_assertThisInitialized2=_interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized")),_inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits")),_defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty")),_react=_interopRequireDefault(require("react")),_lodash=require("lodash"),_recompose=require("recompose"),_input=require("../input"),_utils=require("./_utils"),_compose=require("../compose"),getValue=function(e){var r=e.value,t=e.format,i=e.separator;if(!r)return null;var a=r;return Array.isArray(a)||(a=[a]),a.map(function(e){return(0,_utils.getCurTime)(e,t).format(t)}).join(" ".concat(i," "))},withRangePicker=(0,_recompose.compose)(_recompose.toClass,(0,_recompose.defaultProps)({style:{},format:"YYYY-MM-DD",separator:"~",onChange:function(){}})),RangePicker=(_dec=(0,_recompose.compose)(withRangePicker,(0,_compose.withEdit)(getValue)))((_temp=function(e){function u(){var e,a;(0,_classCallCheck2.default)(this,u);for(var r=arguments.length,t=new Array(r),i=0;i<r;i++)t[i]=arguments[i];return a=(0,_possibleConstructorReturn2.default)(this,(e=(0,_getPrototypeOf3.default)(u)).call.apply(e,[this].concat(t))),(0,_defineProperty2.default)((0,_assertThisInitialized2.default)(a),"onChange",function(e,r){(0,a.props.onChange)(timeString)}),(0,_defineProperty2.default)((0,_assertThisInitialized2.default)(a),"getValue",function(){var e=a.props,r=e.value,t=e.format,i=r;return(0,_lodash.isUndefined)(i)||(Array.isArray(i)||(i=[i]),i=i.map(function(e){return(0,_utils.getCurTime)(e,t)})),i}),a}return(0,_inherits2.default)(u,e),(0,_createClass2.default)(u,[{key:"render",value:function(){var e=this.props,r=(e.addonAfter,e.className,(0,_objectWithoutProperties2.default)(e,["addonAfter","className"]));return _react.default.createElement(_datePicker.default.RangePicker,(0,_extends2.default)({},r,{value:this.getValue(),className:"gant-calendar-picker"}))}}]),u}(_react.default.Component),_class=_temp))||_class,_default=RangePicker;exports.default=_default; | ||
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0,require("antd/es/date-picker/style/css");var _datePicker=_interopRequireDefault(require("antd/es/date-picker")),_classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")),_createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass")),_possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")),_getPrototypeOf2=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")),_inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits")),_typeof2=_interopRequireDefault(require("@babel/runtime/helpers/typeof")),_react=_interopRequireDefault(require("react")),_classnames=_interopRequireDefault(require("classnames")),_lodash=require("lodash"),_recompose=require("recompose"),_utils=require("./_utils"),_compose=require("../compose");function _createSuper(a){return function(){var e,t=(0,_getPrototypeOf2.default)(a);if(_isNativeReflectConstruct()){var r=(0,_getPrototypeOf2.default)(this).constructor;e=Reflect.construct(t,arguments,r)}else e=t.apply(this,arguments);return(0,_possibleConstructorReturn2.default)(this,e)}}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}var __decorate=function(e,t,r,a){var u,n=arguments.length,o=n<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,r):a;if("object"===("undefined"==typeof Reflect?"undefined":(0,_typeof2.default)(Reflect))&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,a);else for(var i=e.length-1;0<=i;i--)(u=e[i])&&(o=(n<3?u(o):3<n?u(t,r,o):u(t,r))||o);return 3<n&&o&&Object.defineProperty(t,r,o),o},__rest=function(e,t){var r={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(r[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var u=0;for(a=Object.getOwnPropertySymbols(e);u<a.length;u++)t.indexOf(a[u])<0&&Object.prototype.propertyIsEnumerable.call(e,a[u])&&(r[a[u]]=e[a[u]])}return r},getValue=function(e){var t=e.value,r=e.format,a=e.separator;if(!t)return null;var u=t;return Array.isArray(u)||(u=[u]),u.map(function(e){return(0,_utils.getCurTime)(e,r).format(r)}).join(" ".concat(a," "))},withRangePicker=(0,_recompose.compose)(_recompose.toClass,(0,_recompose.defaultProps)({style:{},format:"YYYY-MM-DD",separator:"~",onChange:function(){}})),RangePicker=function(e){(0,_inherits2.default)(r,e);var t=_createSuper(r);function r(){var a;return(0,_classCallCheck2.default)(this,r),(a=t.apply(this,arguments)).onChange=function(e,t){(0,a.props.onChange)(t)},a.getValue=function(e){var t=a.props.format,r=e;return(0,_lodash.isUndefined)(r)||(Array.isArray(r)||(r=[r]),r=r.map(function(e){return(0,_utils.getCurTime)(e,t)})),r},a}return(0,_createClass2.default)(r,[{key:"render",value:function(){var e=this.props,t=e.className,r=e.value,a=e.defaultPickerValue,u=(e.defaultValue,e.style),n=__rest(e,["className","value","defaultPickerValue","defaultValue","style"]);return _react.default.createElement(_datePicker.default.RangePicker,Object.assign({},n,{defaultPickerValue:this.getValue(a),defaultValue:this.getValue(a),value:this.getValue(r),onChange:this.onChange,style:Object.assign(Object.assign({},u),{width:"100%"}),className:(0,_classnames.default)("gant-calendar-picker",t)}))}}]),r}(_react.default.Component),_default=RangePicker=__decorate([(0,_recompose.compose)(withRangePicker,(0,_compose.withEdit)(getValue))],RangePicker);exports.default=_default; |
@@ -1,1 +0,1 @@ | ||
"use strict";var _interopRequireWildcard=require("@babel/runtime/helpers/interopRequireWildcard"),_interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));require("antd/es/icon/style/css");var _icon=_interopRequireDefault(require("antd/es/icon")),_react=_interopRequireWildcard(require("react")),allIcons=_interopRequireWildcard(require("@ant-design/icons/lib/dist")),dynamicIcon=_icon.default,chain=new Map,GantIcon=function(e){var t=(0,_react.useState)(function(){return dynamicIcon}),n=(0,_slicedToArray2.default)(t,2),r=n[0],a=n[1];return(0,_react.useEffect)(function(){return chain.set(e.type,a),function(){chain.delete(e.type)}},[r,e.type]),(0,_react.useMemo)(function(){return"string"==typeof e.type?e.type.startsWith("http")?_react.default.createElement(_icon.default,{component:function(){return _react.default.createElement("img",{src:e.type,alt:"icon",className:"ant-pro-sider-menu-icon"})}}):e.type.startsWith(e.perfix)?_react.default.createElement(r,Object.assign({},e,{type:e.type})):_react.default.createElement(_icon.default,Object.assign({},e,{type:e.type})):e.type},[e.type,r])};GantIcon.updateFromIconfontCN=function(e){var t=_icon.default.createFromIconfontCN(e);dynamicIcon=t;var n=!0,r=!1,a=void 0;try{for(var i,c=chain.values()[Symbol.iterator]();!(n=(i=c.next()).done);n=!0){(0,i.value)(function(){return t})}}catch(e){r=!0,a=e}finally{try{n||null==c.return||c.return()}finally{if(r)throw a}}},GantIcon.Ant=_icon.default;var excludeIcons=["interation","colum-height"];function getIconsByTheme(e){for(var t=[],n=0,r=Object.values(allIcons);n<r.length;n++){var a=r[n];a.theme===e&&(excludeIcons.includes(a.name)||t.push(a.name))}return t}GantIcon.getOutLine=function(){return getIconsByTheme("outline")},GantIcon.getFill=function(){return getIconsByTheme("fill")},GantIcon.getTwoTone=function(){return getIconsByTheme("twotone")};var _default=GantIcon;exports.default=_default; | ||
"use strict";var _interopRequireWildcard=require("@babel/runtime/helpers/interopRequireWildcard"),_interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));require("antd/es/icon/style/css");var _icon=_interopRequireDefault(require("antd/es/icon")),_react=_interopRequireWildcard(require("react")),allIcons=_interopRequireWildcard(require("@ant-design/icons/lib/dist"));function _createForOfIteratorHelper(e){if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(e=_unsupportedIterableToArray(e))){var t=0,r=function(){};return{s:r,n:function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var n,a,o=!0,i=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return o=e.done,e},e:function(e){i=!0,a=e},f:function(){try{o||null==n.return||n.return()}finally{if(i)throw a}}}}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(r):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var dynamicIcon=_icon.default,chain=new Map,GantIcon=function(e){var t=(0,_react.useState)(function(){return dynamicIcon}),r=(0,_slicedToArray2.default)(t,2),n=r[0],a=r[1];return(0,_react.useEffect)(function(){return chain.set(e.type,a),function(){chain.delete(e.type)}},[n,e.type]),(0,_react.useMemo)(function(){return"string"==typeof e.type?e.type.startsWith("http")?_react.default.createElement(_icon.default,{component:function(){return _react.default.createElement("img",{src:e.type,alt:"icon",className:"ant-pro-sider-menu-icon"})}}):e.type.startsWith(e.perfix)?_react.default.createElement(n,Object.assign({},e,{type:e.type})):_react.default.createElement(_icon.default,Object.assign({},e,{type:e.type})):e.type},[e.type,n])};GantIcon.updateFromIconfontCN=function(e){var t=_icon.default.createFromIconfontCN(e);dynamicIcon=t;var r,n=_createForOfIteratorHelper(chain.values());try{for(n.s();!(r=n.n()).done;){(0,r.value)(function(){return t})}}catch(e){n.e(e)}finally{n.f()}},GantIcon.Ant=_icon.default;var excludeIcons=["interation","colum-height"];function getIconsByTheme(e){for(var t=[],r=0,n=Object.values(allIcons);r<n.length;r++){var a=n[r];a.theme===e&&(excludeIcons.includes(a.name)||t.push(a.name))}return t}GantIcon.getOutLine=function(){return getIconsByTheme("outline")},GantIcon.getFill=function(){return getIconsByTheme("fill")},GantIcon.getTwoTone=function(){return getIconsByTheme("twotone")};var _default=GantIcon;exports.default=_default; |
@@ -1,1 +0,1 @@ | ||
"use strict";var _interopRequireWildcard=require("@babel/runtime/helpers/interopRequireWildcard"),_interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports.IconSelector=exports.default=void 0,require("antd/es/empty/style/css");var _empty=_interopRequireDefault(require("antd/es/empty"));require("antd/es/radio/style/css");var _radio=_interopRequireDefault(require("antd/es/radio"));require("antd/es/drawer/style/css");var IconTypes,_drawer=_interopRequireDefault(require("antd/es/drawer")),_slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")),_react=_interopRequireWildcard(require("react")),_classnames=_interopRequireDefault(require("classnames")),_lodash=_interopRequireDefault(require("lodash")),_recompose=require("recompose"),_Icon=_interopRequireDefault(require("./Icon")),_compose=require("../compose"),_input=_interopRequireDefault(require("../input")),_editStatus=_interopRequireDefault(require("../edit-status")),__rest=function(e,t){var r={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(r[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(a=Object.getOwnPropertySymbols(e);n<a.length;n++)t.indexOf(a[n])<0&&Object.prototype.propertyIsEnumerable.call(e,a[n])&&(r[a[n]]=e[a[n]])}return r},tr=function(e){return e},getOutLine=_Icon.default.getOutLine,updateFromIconfontCN=_Icon.default.updateFromIconfontCN,Ant=_Icon.default.Ant,outline=getOutLine(),bodyStyle={height:"calc(100vh - 41px)",padding:10,overflow:"hidden"};!function(e){e.IconFont="IconFont",e.AntIcon="AntIcon"}(IconTypes=IconTypes||{});var defaultprops={perfix:"icon-",value:""},drawerClassname="gant-icon-selector-drawer-wrapper",IconHouse=function(e){var t=e.onChange,r=e.value,a=(e.onBlur,e.addonAfter,e.allowEdit,e.onEnter,e.perfix),n=(e.controlMode,__rest(e,["onChange","value","onBlur","addonAfter","allowEdit","onEnter","perfix","controlMode"])),o="gant-icon-selector",l=(0,_react.useState)(!1),c=(0,_slicedToArray2.default)(l,2),u=c[0],i=c[1],s=(0,_react.useState)([]),d=(0,_slicedToArray2.default)(s,2),f=d[0],p=d[1],_=(0,_react.useState)(""),m=(0,_slicedToArray2.default)(_,2),y=m[0],v=m[1],I=(0,_react.useState)(r),E=(0,_slicedToArray2.default)(I,2),q=E[0],h=E[1],b=(0,_react.useMemo)(function(){var e=[IconTypes.AntIcon];return _lodash.default.isEmpty(f)||e.push(IconTypes.IconFont),e},[f]),g=(0,_react.useState)(b[0]),C=(0,_slicedToArray2.default)(g,2),w=C[0],S=C[1],A=(0,_react.useMemo)(function(){return{IconFont:f,AntIcon:outline}},[f]);(0,_react.useEffect)(function(){h(r)},[r]);var x=(0,_react.useCallback)(function(){u||v(""),i(!u)},[u]),O=(0,_react.useCallback)(function(e){h(e),t&&t(e),x()},[]);(0,_react.useState)(function(){var e=document.querySelector("svg");if(e){var t=[].slice.call(e.querySelectorAll("symbol")).map(function(e){return e.id});p(t)}});var T=(0,_react.useCallback)(function(e){S(e.target.value)},[]),R=(0,_react.useMemo)(function(){return A[w].filter(function(e){return e.includes(y)})},[A,w,y]);return _react.default.createElement(_react.default.Fragment,null,_react.default.createElement("div",{className:"gant-icon-select",onClick:x},q?_react.default.createElement(_Icon.default,Object.assign({type:q,title:tr("点击切换"),perfix:a},n)):_react.default.createElement("span",{className:o+"-btn"},tr("点击选择"))),_react.default.createElement(_drawer.default,{width:u?500:0,title:tr("请选择图标"),destroyOnClose:!0,placement:"right",onClose:x,visible:u,bodyStyle:bodyStyle,className:drawerClassname},_react.default.createElement("div",{className:(0,_classnames.default)(o+"-search")},_react.default.createElement(_radio.default.Group,{value:w,onChange:T},b.map(function(e){return _react.default.createElement(_radio.default.Button,{key:e,value:e},e)})),_react.default.createElement("div",{style:{flex:1,marginLeft:10}},_react.default.createElement(_input.default,{edit:_editStatus.default.EDIT,value:y,onChange:v,placeholder:tr("搜索"),allowClear:!0}))),_react.default.createElement("div",{className:(0,_classnames.default)(o+"-scroll")},R.length?null:_react.default.createElement(_empty.default,{image:_empty.default.PRESENTED_IMAGE_SIMPLE,description:tr("没有匹配图标"),style:{margin:"30px auto 0"}}),_react.default.createElement("div",{className:(0,_classnames.default)(o+"-content")},R.map(function(e){return _react.default.createElement("div",{className:o+"-content-item",title:e,key:e,onClick:function(){return O(e)}},_react.default.createElement(_Icon.default,{perfix:a,type:e,className:o+"-content-item-iconitem"}),_react.default.createElement("div",{style:{width:"100%"}},e))})))))},IconSelector=(0,_recompose.compose)(_recompose.toClass,(0,_recompose.defaultProps)(defaultprops),(0,_recompose.withProps)(function(e){var t=e.allowEdit,r=e.edit,a=e.style,n=void 0===a?{}:a,o=e.type,l=e.value,c=e.onChange,u=Object.assign({},n),i=!(_lodash.default.isUndefined(l)||_lodash.default.isUndefined(c));return i||(u.display="inline-block"),{style:u,value:l||o,allowEdit:i&&t,edit:i?r:_editStatus.default.CANCEL,controlMode:i}}),(0,_compose.withEdit)(function(e){var t=e.value,r=e.style,a=e.theme,n=e.spin,o=e.rotate,l=e.component,c=e.twoToneColor,u=e.controlMode,i=e.perfix,s=_react.default.createElement(_Icon.default,{type:t,perfix:i,style:r,theme:a,spin:n,rotate:o,component:l,twoToneColor:c});return!u||t?s:void 0},drawerClassname))(IconHouse);(exports.IconSelector=IconSelector).updateFromIconfontCN=updateFromIconfontCN,IconSelector.Ant=Ant;var _default=IconSelector;exports.default=_default; | ||
"use strict";var _interopRequireWildcard=require("@babel/runtime/helpers/interopRequireWildcard"),_interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports.IconSelector=exports.default=void 0,require("antd/es/empty/style/css");var _empty=_interopRequireDefault(require("antd/es/empty"));require("antd/es/radio/style/css");var _radio=_interopRequireDefault(require("antd/es/radio"));require("antd/es/drawer/style/css");var IconTypes,_drawer=_interopRequireDefault(require("antd/es/drawer")),_slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")),_react=_interopRequireWildcard(require("react")),_classnames=_interopRequireDefault(require("classnames")),_lodash=_interopRequireDefault(require("lodash")),_recompose=require("recompose"),_Icon=_interopRequireDefault(require("./Icon")),_compose=require("../compose"),_input=_interopRequireDefault(require("../input")),_editStatus=_interopRequireDefault(require("../edit-status")),__rest=function(e,t){var r={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(r[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(a=Object.getOwnPropertySymbols(e);n<a.length;n++)t.indexOf(a[n])<0&&Object.prototype.propertyIsEnumerable.call(e,a[n])&&(r[a[n]]=e[a[n]])}return r},tr=function(e){return e},getOutLine=_Icon.default.getOutLine,updateFromIconfontCN=_Icon.default.updateFromIconfontCN,Ant=_Icon.default.Ant,outline=getOutLine(),bodyStyle={height:"calc(100vh - 41px)",padding:10,overflow:"hidden"};!function(e){e.IconFont="IconFont",e.AntIcon="AntIcon"}(IconTypes=IconTypes||{});var defaultprops={perfix:"icon-",value:""},drawerClassname="gant-icon-selector-drawer-wrapper",IconHouse=function(e){var t=e.onChange,r=e.value,a=(e.onBlur,e.addonAfter,e.allowEdit,e.onEnter,e.perfix),n=(e.controlMode,__rest(e,["onChange","value","onBlur","addonAfter","allowEdit","onEnter","perfix","controlMode"])),o="gant-icon-selector",l=(0,_react.useState)(!1),c=(0,_slicedToArray2.default)(l,2),u=c[0],i=c[1],s=(0,_react.useState)([]),d=(0,_slicedToArray2.default)(s,2),f=d[0],p=d[1],_=(0,_react.useState)(""),m=(0,_slicedToArray2.default)(_,2),y=m[0],v=m[1],I=(0,_react.useState)(r),E=(0,_slicedToArray2.default)(I,2),q=E[0],h=E[1],b=(0,_react.useMemo)(function(){var e=[IconTypes.AntIcon];return _lodash.default.isEmpty(f)||e.push(IconTypes.IconFont),e},[f]),g=(0,_react.useState)(b[0]),w=(0,_slicedToArray2.default)(g,2),C=w[0],S=w[1],A=(0,_react.useMemo)(function(){return{IconFont:f,AntIcon:outline}},[f]);(0,_react.useEffect)(function(){h(r)},[r]);var x=(0,_react.useCallback)(function(){u||v(""),i(!u)},[u]),N=(0,_react.useCallback)(function(e){h(e),t&&t(e),x()},[]);(0,_react.useState)(function(){var e=document.querySelector("svg");if(e){var t=[].slice.call(e.querySelectorAll("symbol")).map(function(e){return e.id});p(t)}});var T=(0,_react.useCallback)(function(e){S(e.target.value)},[]),O=(0,_react.useMemo)(function(){return A[C].filter(function(e){return e.includes(y)})},[A,C,y]);return _react.default.createElement(_react.default.Fragment,null,_react.default.createElement("div",{className:"gant-icon-select",onClick:x},q?_react.default.createElement(_Icon.default,Object.assign({type:q,title:tr("点击切换"),perfix:a},n)):_react.default.createElement("span",{className:o+"-btn"},tr("点击选择"))),_react.default.createElement(_drawer.default,{width:u?500:0,title:tr("请选择图标"),destroyOnClose:!0,placement:"right",onClose:x,visible:u,bodyStyle:bodyStyle,className:drawerClassname},_react.default.createElement("div",{className:(0,_classnames.default)(o+"-search")},_react.default.createElement(_radio.default.Group,{value:C,onChange:T},b.map(function(e){return _react.default.createElement(_radio.default.Button,{key:e,value:e},e)})),_react.default.createElement("div",{style:{flex:1,marginLeft:10}},_react.default.createElement(_input.default,{edit:_editStatus.default.EDIT,value:y,onChange:v,placeholder:tr("搜索"),allowClear:!0}))),_react.default.createElement("div",{className:(0,_classnames.default)(o+"-scroll")},O.length?null:_react.default.createElement(_empty.default,{image:_empty.default.PRESENTED_IMAGE_SIMPLE,description:tr("没有匹配图标"),style:{margin:"30px auto 0"}}),_react.default.createElement("div",{className:(0,_classnames.default)(o+"-content")},O.map(function(e){return _react.default.createElement("div",{className:o+"-content-item",title:e,key:e,onClick:function(){return N(e)}},_react.default.createElement(_Icon.default,{perfix:a,type:e,className:o+"-content-item-iconitem"}),_react.default.createElement("div",{style:{width:"100%"}},e))})))))},IconSelector=(0,_recompose.compose)(_recompose.toClass,(0,_recompose.defaultProps)(defaultprops),(0,_recompose.withProps)(function(e){var t=e.allowEdit,r=e.edit,a=(e.style,e.type),n=e.value,o=e.onChange,l={},c=!(_lodash.default.isUndefined(n)||_lodash.default.isUndefined(o));return c||(l.display="inline-block"),{wrapperStyle:l,value:n||a,allowEdit:c&&t,edit:c?r:_editStatus.default.CANCEL,controlMode:c}}),(0,_compose.withEdit)(function(e){var t=e.value,r=e.style,a=e.theme,n=e.spin,o=e.rotate,l=e.component,c=e.twoToneColor,u=e.controlMode,i=e.perfix,s=e.className,d=_react.default.createElement(_Icon.default,{type:t,perfix:i,style:r,theme:a,spin:n,rotate:o,component:l,twoToneColor:c,className:s});return!u||t?d:void 0},drawerClassname))(IconHouse);(exports.IconSelector=IconSelector).updateFromIconfontCN=updateFromIconfontCN,IconSelector.Ant=Ant;var _default=IconSelector;exports.default=_default; |
@@ -0,1 +1,2 @@ | ||
export { default as DataEditCell } from './data-edit-cell'; | ||
export { default as withEdit } from './with-edit'; | ||
@@ -2,0 +3,0 @@ export { default as EditStatus } from './edit-status'; |
@@ -1,1 +0,1 @@ | ||
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"withEdit",{enumerable:!0,get:function(){return _withEdit.default}}),Object.defineProperty(exports,"EditStatus",{enumerable:!0,get:function(){return _editStatus.default}}),Object.defineProperty(exports,"SwitchStatus",{enumerable:!0,get:function(){return _switchStatus.default}}),Object.defineProperty(exports,"Input",{enumerable:!0,get:function(){return _input.default}}),Object.defineProperty(exports,"InputCellPhone",{enumerable:!0,get:function(){return _inputCellPhone.default}}),Object.defineProperty(exports,"InputTelePhone",{enumerable:!0,get:function(){return _inputTelePhone.default}}),Object.defineProperty(exports,"InputUrl",{enumerable:!0,get:function(){return _inputUrl.default}}),Object.defineProperty(exports,"InputEmail",{enumerable:!0,get:function(){return _inputEmail.default}}),Object.defineProperty(exports,"InputLanguage",{enumerable:!0,get:function(){return _inputLanguage.default}}),Object.defineProperty(exports,"InputMoney",{enumerable:!0,get:function(){return _inputMoney.default}}),Object.defineProperty(exports,"InputNumber",{enumerable:!0,get:function(){return _inputNumber.default}}),Object.defineProperty(exports,"DatePicker",{enumerable:!0,get:function(){return _datePicker.default}}),Object.defineProperty(exports,"ColorPicker",{enumerable:!0,get:function(){return _colorPicker.default}}),Object.defineProperty(exports,"Selector",{enumerable:!0,get:function(){return _selector.default}}),Object.defineProperty(exports,"LocationSelector",{enumerable:!0,get:function(){return _locationSelector.default}}),Object.defineProperty(exports,"Icon",{enumerable:!0,get:function(){return _icon.default}});var _withEdit=_interopRequireDefault(require("./with-edit")),_editStatus=_interopRequireDefault(require("./edit-status")),_switchStatus=_interopRequireDefault(require("./switch-status")),_input=_interopRequireDefault(require("./input")),_inputCellPhone=_interopRequireDefault(require("./input-cell-phone")),_inputTelePhone=_interopRequireDefault(require("./input-tele-phone")),_inputUrl=_interopRequireDefault(require("./input-url")),_inputEmail=_interopRequireDefault(require("./input-email")),_inputLanguage=_interopRequireDefault(require("./input-language")),_inputMoney=_interopRequireDefault(require("./input-money")),_inputNumber=_interopRequireDefault(require("./input-number")),_datePicker=_interopRequireDefault(require("./date-picker")),_colorPicker=_interopRequireDefault(require("./color-picker")),_selector=_interopRequireDefault(require("./selector")),_locationSelector=_interopRequireDefault(require("./location-selector")),_icon=_interopRequireDefault(require("./icon")); | ||
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"DataEditCell",{enumerable:!0,get:function(){return _dataEditCell.default}}),Object.defineProperty(exports,"withEdit",{enumerable:!0,get:function(){return _withEdit.default}}),Object.defineProperty(exports,"EditStatus",{enumerable:!0,get:function(){return _editStatus.default}}),Object.defineProperty(exports,"SwitchStatus",{enumerable:!0,get:function(){return _switchStatus.default}}),Object.defineProperty(exports,"Input",{enumerable:!0,get:function(){return _input.default}}),Object.defineProperty(exports,"InputCellPhone",{enumerable:!0,get:function(){return _inputCellPhone.default}}),Object.defineProperty(exports,"InputTelePhone",{enumerable:!0,get:function(){return _inputTelePhone.default}}),Object.defineProperty(exports,"InputUrl",{enumerable:!0,get:function(){return _inputUrl.default}}),Object.defineProperty(exports,"InputEmail",{enumerable:!0,get:function(){return _inputEmail.default}}),Object.defineProperty(exports,"InputLanguage",{enumerable:!0,get:function(){return _inputLanguage.default}}),Object.defineProperty(exports,"InputMoney",{enumerable:!0,get:function(){return _inputMoney.default}}),Object.defineProperty(exports,"InputNumber",{enumerable:!0,get:function(){return _inputNumber.default}}),Object.defineProperty(exports,"DatePicker",{enumerable:!0,get:function(){return _datePicker.default}}),Object.defineProperty(exports,"ColorPicker",{enumerable:!0,get:function(){return _colorPicker.default}}),Object.defineProperty(exports,"Selector",{enumerable:!0,get:function(){return _selector.default}}),Object.defineProperty(exports,"LocationSelector",{enumerable:!0,get:function(){return _locationSelector.default}}),Object.defineProperty(exports,"Icon",{enumerable:!0,get:function(){return _icon.default}});var _dataEditCell=_interopRequireDefault(require("./data-edit-cell")),_withEdit=_interopRequireDefault(require("./with-edit")),_editStatus=_interopRequireDefault(require("./edit-status")),_switchStatus=_interopRequireDefault(require("./switch-status")),_input=_interopRequireDefault(require("./input")),_inputCellPhone=_interopRequireDefault(require("./input-cell-phone")),_inputTelePhone=_interopRequireDefault(require("./input-tele-phone")),_inputUrl=_interopRequireDefault(require("./input-url")),_inputEmail=_interopRequireDefault(require("./input-email")),_inputLanguage=_interopRequireDefault(require("./input-language")),_inputMoney=_interopRequireDefault(require("./input-money")),_inputNumber=_interopRequireDefault(require("./input-number")),_datePicker=_interopRequireDefault(require("./date-picker")),_colorPicker=_interopRequireDefault(require("./color-picker")),_selector=_interopRequireDefault(require("./selector")),_locationSelector=_interopRequireDefault(require("./location-selector")),_icon=_interopRequireDefault(require("./icon")); |
@@ -1,1 +0,1 @@ | ||
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault"),_interopRequireWildcard=require("@babel/runtime/helpers/interopRequireWildcard");Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0,require("antd/es/input/style/css");var _input=_interopRequireDefault(require("antd/es/input")),_extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends")),_classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")),_createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass")),_possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")),_getPrototypeOf2=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")),_assertThisInitialized2=_interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized")),_inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits")),_defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty")),_objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));require("antd/es/select/style/css");var _dec,_class,_temp,_select=_interopRequireDefault(require("antd/es/select")),_react=_interopRequireWildcard(require("react")),_recompose=require("recompose"),_classnames=_interopRequireDefault(require("classnames")),_lodash=require("lodash"),_compose=require("../compose"),_codes=_interopRequireDefault(require("./codes.json")),reg=/^1$|^1[3-9]$|^1[3-9][0-9]\d{0,8}$/,phoneFormatter=function(e){return Array.from(e).map(function(e,t){return t%4==3?"-".concat(e):e}).join("")},withPhoneCode=(0,_recompose.compose)(_recompose.toClass,(0,_recompose.withProps)(function(e){var t=e.value,r=void 0===t?{}:t,o=r.key;return{code:void 0===o?"86":o,phone:r.value}}),(0,_recompose.defaultProps)({placeholder:"请输入手机号码",allowClear:!0}),(0,_recompose.withProps)(function(e){var r=e.onChange,o=e.phone,t=e.code;return{onCodeChange:function(e){if(r){var t=o;"86"!==e||o.length<=11&®.test(o)||(t=""),r({key:e,value:t})}},onPhoneChange:function(e){r&&r({key:t,value:e})},filterOption:function(e,t){return t.key.includes(e)}}})),withValidate=(0,_recompose.compose)((0,_recompose.withHandlers)({validateValue:function(e){var t=e.phone;return function(){return!t||11===t.length&®.test(t)}}}),(0,_recompose.withPropsOnChange)(["phone"],function(e){return{confirmable:(0,e.validateValue)()}}),(0,_recompose.lifecycle)({componentDidMount:function(){var e=this.props,t=e.validateValue,r=e.onPhoneChange;t()||r("")}})),CellPhone=(_dec=(0,_recompose.compose)(withPhoneCode,withValidate,(0,_compose.withEdit)(function(e){var t=e.code,r=e.phone;return r?"+".concat(t," ").concat(r):""},"gantd-input-cellphone-addonBefore"),(0,_recompose.withProps)(function(e){var t=e.code,r=e.onCodeChange,o=e.filterOption;return{addonBefore:_react.default.createElement(_select.default,{dropdownClassName:"gantd-input-cellphone-addonBefore",style:{width:86},value:t,onChange:r,filterOption:o,showSearch:!0},_codes.default.map(function(e){return _react.default.createElement(_select.default.Option,{key:e,value:e},"+",e)}))}}),(0,_recompose.mapProps)(function(e){e.onCodeChange,e.searchCode,e.codeList,e.filterOption;return(0,_objectWithoutProperties2.default)(e,["onCodeChange","searchCode","codeList","filterOption"])})))((_temp=function(e){function r(e){var t;return(0,_classCallCheck2.default)(this,r),t=(0,_possibleConstructorReturn2.default)(this,(0,_getPrototypeOf2.default)(r).call(this,e)),(0,_defineProperty2.default)((0,_assertThisInitialized2.default)(t),"state",{value:""}),t.onChange=t.onChange.bind((0,_assertThisInitialized2.default)(t)),t.onKeyDown=t.onKeyDown.bind((0,_assertThisInitialized2.default)(t)),t}return(0,_inherits2.default)(r,e),(0,_createClass2.default)(r,[{key:"onChange",value:function(e){var t=this.props,r=t.onPhoneChange,o=t.code,n=e.target.value;n?("86"!==o||n.length<=11&®.test(n))&&(r(n),this.setState({value:n})):(r(""),this.setState({value:""}))}},{key:"onKeyDown",value:function(e){var t=this.props,r=t.validateValue,o=t.onEnter;r()&&o(e)}},{key:"render",value:function(){var e=this.props,t=(e.onPhoneChange,e.validateValue,e.onEnter,(0,_objectWithoutProperties2.default)(e,["onPhoneChange","validateValue","onEnter"])),r=this.state.value,o=(0,_lodash.get)(t,"phone",r);return _react.default.createElement(_input.default,(0,_extends2.default)({},t,{value:o,onBlur:function(){},onKeyDown:this.onKeyDown,onChange:this.onChange}))}}]),r}(_react.Component),_class=_temp))||_class,_default=CellPhone;exports.default=_default; | ||
"use strict";var _interopRequireWildcard=require("@babel/runtime/helpers/interopRequireWildcard"),_interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0,require("antd/es/select/style/css");var _select=_interopRequireDefault(require("antd/es/select"));require("antd/es/input/style/css");var _input=_interopRequireDefault(require("antd/es/input")),_classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")),_createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass")),_assertThisInitialized2=_interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized")),_possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")),_getPrototypeOf2=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")),_inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits")),_typeof2=_interopRequireDefault(require("@babel/runtime/helpers/typeof")),_react=_interopRequireWildcard(require("react")),_recompose=require("recompose"),_lodash=require("lodash"),_compose=require("../compose"),_codes=_interopRequireDefault(require("./codes.json"));function _createSuper(n){return function(){var e,t=(0,_getPrototypeOf2.default)(n);if(_isNativeReflectConstruct()){var r=(0,_getPrototypeOf2.default)(this).constructor;e=Reflect.construct(t,arguments,r)}else e=t.apply(this,arguments);return(0,_possibleConstructorReturn2.default)(this,e)}}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}var __decorate=function(e,t,r,n){var o,a=arguments.length,i=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"===("undefined"==typeof Reflect?"undefined":(0,_typeof2.default)(Reflect))&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,n);else for(var l=e.length-1;0<=l;l--)(o=e[l])&&(i=(a<3?o(i):3<a?o(t,r,i):o(t,r))||i);return 3<a&&i&&Object.defineProperty(t,r,i),i},__rest=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r},reg=/^1$|^1[3-9]$|^1[3-9][0-9]\d{0,8}$/,phoneFormatter=function(e){return Array.from(e).map(function(e,t){return t%4==3?"-".concat(e):e}).join("")},withPhoneCode=(0,_recompose.compose)(_recompose.toClass,(0,_recompose.withProps)(function(e){var t=e.value,r=void 0===t?{}:t,n=r.key;return{code:void 0===n?"86":n,phone:r.value}}),(0,_recompose.defaultProps)({placeholder:"请输入手机号码",allowClear:!0}),(0,_recompose.withProps)(function(e){var r=e.onChange,n=e.phone,t=e.code;return{onCodeChange:function(e){if(r){var t=n;"86"!==e||n.length<=11&®.test(n)||(t=""),r({key:e,value:t})}},onPhoneChange:function(e){r&&r({key:t,value:e})},filterOption:function(e,t){return t.key.includes(e)}}})),withValidate=(0,_recompose.compose)((0,_recompose.withHandlers)({validateValue:function(e){var t=e.phone;return function(){return!t||11===t.length&®.test(t)}}}),(0,_recompose.withPropsOnChange)(["phone"],function(e){return{confirmable:(0,e.validateValue)()}}),(0,_recompose.lifecycle)({componentDidMount:function(){var e=this.props,t=e.validateValue,r=e.onPhoneChange;t()||r("")}})),CellPhone=function(e){(0,_inherits2.default)(n,e);var r=_createSuper(n);function n(e){var t;return(0,_classCallCheck2.default)(this,n),(t=r.call(this,e)).state={value:""},t.onChange=t.onChange.bind((0,_assertThisInitialized2.default)(t)),t.onKeyDown=t.onKeyDown.bind((0,_assertThisInitialized2.default)(t)),t}return(0,_createClass2.default)(n,[{key:"onChange",value:function(e){var t=this.props,r=t.onPhoneChange,n=t.code,o=e.target.value;o?("86"!==n||o.length<=11&®.test(o))&&(r(o),this.setState({value:o})):(r(""),this.setState({value:""}))}},{key:"onKeyDown",value:function(e){var t=this.props,r=t.validateValue,n=t.onEnter;r()&&n(e)}},{key:"render",value:function(){var e=this.props,t=(e.onPhoneChange,e.validateValue,e.onEnter,__rest(e,["onPhoneChange","validateValue","onEnter"])),r=this.state.value,n=(0,_lodash.get)(t,"phone",r);return _react.default.createElement(_input.default,Object.assign({},t,{value:n,onKeyDown:this.onKeyDown,onChange:this.onChange}))}}]),n}(_react.Component);CellPhone=__decorate([(0,_recompose.compose)(withPhoneCode,withValidate,(0,_compose.withEdit)(function(e){var t=e.code,r=e.phone;return r?"+".concat(t," ").concat(r):""},"gantd-input-cellphone-addonBefore"),(0,_recompose.withProps)(function(e){var t=e.code,r=e.onCodeChange,n=e.filterOption;return{addonBefore:_react.default.createElement(_select.default,{dropdownClassName:"gantd-input-cellphone-addonBefore",style:{width:86},value:t,onChange:r,filterOption:n,showSearch:!0},_codes.default.map(function(e){return _react.default.createElement(_select.default.Option,{key:e,value:e},"+",e)}))}}),(0,_recompose.mapProps)(function(e){e.onCodeChange,e.searchCode,e.codeList,e.filterOption;return __rest(e,["onCodeChange","searchCode","codeList","filterOption"])}))],CellPhone);var CellPhoneWrapper=function(e){(0,_inherits2.default)(r,e);var t=_createSuper(r);function r(){return(0,_classCallCheck2.default)(this,r),t.apply(this,arguments)}return(0,_createClass2.default)(r,[{key:"render",value:function(){return _react.default.createElement(CellPhone,Object.assign({},this.props))}}]),r}(_react.Component);exports.default=CellPhoneWrapper; |
@@ -1,1 +0,1 @@ | ||
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));require("antd/es/auto-complete/style/css");var _dec,_class,_temp,_autoComplete=_interopRequireDefault(require("antd/es/auto-complete")),_classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")),_createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass")),_possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")),_getPrototypeOf3=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")),_assertThisInitialized2=_interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized")),_inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits")),_defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty")),_react=_interopRequireDefault(require("react")),_recompose=require("recompose"),_input=require("../input"),_compose=require("../compose"),emails=["qq.com","163.com","126.com","139.com","gmail.com","sohu.com","sina.com","outlook.com","amazon.com","yahoo.com","hotmail.com"],emailRegexp=/^[a-zA-Z_\-0-9\u4e00-\u9fa5]+(\.[a-zA-Z_\-0-9\u4e00-\u9fa5]+)?@([a-zA-Z_\-0-9]{2,10}\.){1,3}[a-zA-Z]{2,10}$/,withResult=(0,_recompose.compose)((0,_recompose.withState)("list","setList",[]),(0,_recompose.defaultProps)({style:{},allowClear:!0,placeholder:"请输入邮箱",onChange:function(){}}),(0,_recompose.withProps)(function(e){var t=e.value;return{confirmable:!t||emailRegexp.test(t)}}),(0,_recompose.lifecycle)({componentDidMount:function(){var e=this.props,t=e.value,r=e.onChange;t&&!emailRegexp.test(t)&&r()}})),Email=(_dec=(0,_recompose.compose)(withResult,(0,_compose.withEdit)(function(e){return e.value})))((_temp=function(e){function i(){var e,r;(0,_classCallCheck2.default)(this,i);for(var t=arguments.length,a=new Array(t),o=0;o<t;o++)a[o]=arguments[o];return r=(0,_possibleConstructorReturn2.default)(this,(e=(0,_getPrototypeOf3.default)(i)).call.apply(e,[this].concat(a))),(0,_defineProperty2.default)((0,_assertThisInitialized2.default)(r),"onSearch",function(t){(0,r.props.setList)(!t||0<=t.indexOf("@")?[]:emails.map(function(e){return"".concat(t,"@").concat(e)}))}),(0,_defineProperty2.default)((0,_assertThisInitialized2.default)(r),"getDataSource",function(){return r.props.list.map(function(e){return _react.default.createElement(_autoComplete.default.Option,{key:e,value:e},e)})}),(0,_defineProperty2.default)((0,_assertThisInitialized2.default)(r),"renderSelect",function(){var e=(0,_extends2.default)({},r.props);return _react.default.createElement(_autoComplete.default,(0,_extends2.default)({},e,{className:"gant-select-email",showSearch:!0,dropdownMatchSelectWidth:!1,onSearch:r.onSearch}),r.getDataSource())}),r}return(0,_inherits2.default)(i,e),(0,_createClass2.default)(i,[{key:"render",value:function(){var e=this.props;e.addonAfter,e.className;return this.renderSelect()}}]),i}(_react.default.Component),_class=_temp))||_class,_default=Email;exports.default=_default; | ||
"use strict";var _interopRequireWildcard=require("@babel/runtime/helpers/interopRequireWildcard"),_interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0,require("antd/es/auto-complete/style/css");var _autoComplete=_interopRequireDefault(require("antd/es/auto-complete")),_classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")),_createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass")),_possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")),_getPrototypeOf2=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")),_inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits")),_typeof2=_interopRequireDefault(require("@babel/runtime/helpers/typeof")),_react=_interopRequireWildcard(require("react")),_classnames=_interopRequireDefault(require("classnames")),_recompose=require("recompose"),_compose=require("../compose");function _createSuper(o){return function(){var e,t=(0,_getPrototypeOf2.default)(o);if(_isNativeReflectConstruct()){var r=(0,_getPrototypeOf2.default)(this).constructor;e=Reflect.construct(t,arguments,r)}else e=t.apply(this,arguments);return(0,_possibleConstructorReturn2.default)(this,e)}}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}var __decorate=function(e,t,r,o){var a,n=arguments.length,l=n<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"===("undefined"==typeof Reflect?"undefined":(0,_typeof2.default)(Reflect))&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,r,o);else for(var u=e.length-1;0<=u;u--)(a=e[u])&&(l=(n<3?a(l):3<n?a(t,r,l):a(t,r))||l);return 3<n&&l&&Object.defineProperty(t,r,l),l},__rest=function(e,t){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(o=Object.getOwnPropertySymbols(e);a<o.length;a++)t.indexOf(o[a])<0&&Object.prototype.propertyIsEnumerable.call(e,o[a])&&(r[o[a]]=e[o[a]])}return r},emails=["qq.com","163.com","126.com","139.com","gmail.com","sohu.com","sina.com","outlook.com","amazon.com","yahoo.com","hotmail.com"],emailRegexp=/^[a-zA-Z_\-0-9\u4e00-\u9fa5]+(\.[a-zA-Z_\-0-9\u4e00-\u9fa5]+)?@([a-zA-Z_\-0-9]{2,10}\.){1,3}[a-zA-Z]{2,10}$/,withResult=(0,_recompose.compose)((0,_recompose.withState)("list","setList",[]),(0,_recompose.defaultProps)({allowClear:!0,placeholder:"请输入邮箱",onChange:function(){}}),(0,_recompose.withProps)(function(e){var t=e.value;return{confirmable:!t||emailRegexp.test(t)}}),(0,_recompose.lifecycle)({componentDidMount:function(){var e=this.props,t=e.value,r=e.onChange;t&&!emailRegexp.test(t)&&r()}})),Email=function(e){(0,_inherits2.default)(r,e);var t=_createSuper(r);function r(){var a;return(0,_classCallCheck2.default)(this,r),(a=t.apply(this,arguments)).onSearch=function(t){(0,a.props.setList)(!t||0<=t.indexOf("@")?[]:emails.map(function(e){return"".concat(t,"@").concat(e)}))},a.getDataSource=function(){return a.props.list.map(function(e){return _react.default.createElement(_autoComplete.default.Option,{key:e,value:e},e)})},a.renderSelect=function(){var e=a.props,t=e.dropdownClassName,r=e.className,o=(e.list,__rest(e,["dropdownClassName","className","list"]));return _react.default.createElement(_autoComplete.default,Object.assign({className:(0,_classnames.default)("gant-select-email",r),showSearch:!0,dropdownMatchSelectWidth:!1,dropdownClassName:(0,_classnames.default)("gant-select-email-dropdown",t)},o,{onSearch:a.onSearch}),a.getDataSource())},a}return(0,_createClass2.default)(r,[{key:"render",value:function(){return this.renderSelect()}}]),r}(_react.default.Component);Email=__decorate([(0,_recompose.compose)(withResult,(0,_compose.withEdit)(function(e){return e.value},"gant-select-email-dropdown"))],Email);var EmailWrapper=function(e){(0,_inherits2.default)(r,e);var t=_createSuper(r);function r(){return(0,_classCallCheck2.default)(this,r),t.apply(this,arguments)}return(0,_createClass2.default)(r,[{key:"render",value:function(){return _react.default.createElement(Email,Object.assign({},this.props))}}]),r}(_react.Component);exports.default=EmailWrapper; |
@@ -1,1 +0,1 @@ | ||
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault"),_interopRequireWildcard=require("@babel/runtime/helpers/interopRequireWildcard");Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0,require("antd/es/input/style/css");var _input=_interopRequireDefault(require("antd/es/input")),_extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends")),_objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties")),_classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")),_createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass")),_possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")),_getPrototypeOf3=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")),_assertThisInitialized2=_interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized")),_inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits")),_defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));require("antd/es/select/style/css");var _dec,_class,_temp,_select=_interopRequireDefault(require("antd/es/select")),_slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")),_toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray")),_react=_interopRequireWildcard(require("react")),_lodash=require("lodash"),_recompose=require("recompose"),_compose=require("../compose"),defaultLocaleList=[{locale:"zh-CN",label:"中文"},{locale:"en-US",label:"English"}],getMergeLocale=function(e){if(e.length){var r=[].concat(defaultLocaleList,(0,_toConsumableArray2.default)(e)).map(function(e){return[e.locale,e.label]}),t=new Map(r),a=[],l=!0,n=!1,o=void 0;try{for(var u,i=t.entries()[Symbol.iterator]();!(l=(u=i.next()).done);l=!0){var c=(0,_slicedToArray2.default)(u.value,2),s=c[0],p=c[1];a.push({label:p,locale:s})}}catch(e){n=!0,o=e}finally{try{l||null==i.return||i.return()}finally{if(n)throw o}}}return defaultLocaleList},withLangSelect=(0,_recompose.compose)((0,_recompose.defaultProps)({allowClear:!0,placeholder:"请输入文本",onChange:function(){},localeList:[]}),(0,_recompose.withState)("cacheMap","setCacheMap",function(e){var r=e.value,t=void 0===r?[]:r;if(Array.isArray(t)&&t.length){var a=(0,_lodash.map)(t,function(e){return[e.locale,e.value]});return new Map(a)}return new Map}),(0,_recompose.withProps)(function(e){var r=e.localeList,c=e.cacheMap,s=e.onChange;return{language:(0,_lodash.map)(getMergeLocale(defaultLocaleList,r),function(e){return(0,_lodash.pick)(e,["locale","label"])}),onChange:function(){var e=[],r=!0,t=!1,a=void 0;try{for(var l,n=c.entries()[Symbol.iterator]();!(r=(l=n.next()).done);r=!0){var o=(0,_slicedToArray2.default)(l.value,2),u=o[0],i=o[1];e.push({locale:u,value:i})}}catch(e){t=!0,a=e}finally{try{r||null==n.return||n.return()}finally{if(t)throw a}}s(e)}}}),(0,_recompose.withState)("currentLocale","setCurrentLocale",function(e){var r=e.value,t=void 0===r?[]:r,a=e.language;return(t[0]||a[0]).locale}),(0,_recompose.withHandlers)({onLocaleChange:function(e){var r=e.setCurrentLocale;return function(e){r(e)}}})),InputLang=(_dec=(0,_recompose.compose)(_recompose.toClass,withLangSelect,(0,_compose.withEdit)(function(e){var r=e.currentLocale;return e.cacheMap.get(r)},"gantd-input-lang-addonBefore"),(0,_recompose.withProps)(function(e){var r=e.onLocaleChange,t=e.language,a=e.cacheMap,l=e.currentLocale;return{addonBefore:_react.default.createElement(_select.default,{dropdownClassName:"gantd-input-lang-addonBefore",style:{width:75},value:l,onChange:r},t.map(function(e){return _react.default.createElement(_select.default.Option,{value:e.locale,key:e.locale},e.label)})),currentValue:a.get(l)}})))((_temp=function(e){function l(){var e,n;(0,_classCallCheck2.default)(this,l);for(var r=arguments.length,t=new Array(r),a=0;a<r;a++)t[a]=arguments[a];return n=(0,_possibleConstructorReturn2.default)(this,(e=(0,_getPrototypeOf3.default)(l)).call.apply(e,[this].concat(t))),(0,_defineProperty2.default)((0,_assertThisInitialized2.default)(n),"onInputChange",function(e){var r=e.target.value,t=n.props,a=t.currentLocale,l=t.onChange;t.cacheMap.set(a,r),l()}),n}return(0,_inherits2.default)(l,e),(0,_createClass2.default)(l,[{key:"render",value:function(){var e=this.props,r=e.onEnter,t=(e.setlocale,e.cacheId,e.cacheMap,e.localeList,e.setCurrentLocale,e.onLocaleChange,e.currentValue),a=(e.setCacheMap,e.currentLocale,(0,_objectWithoutProperties2.default)(e,["onEnter","setlocale","cacheId","cacheMap","localeList","setCurrentLocale","onLocaleChange","currentValue","setCacheMap","currentLocale"]));return _react.default.createElement(_input.default,(0,_extends2.default)({},a,{value:t,onKeyDown:r,onChange:this.onInputChange}))}}]),l}(_react.Component),_class=_temp))||_class,_default=InputLang;exports.default=_default; | ||
"use strict";var _interopRequireWildcard=require("@babel/runtime/helpers/interopRequireWildcard"),_interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0,require("antd/es/select/style/css");var _select=_interopRequireDefault(require("antd/es/select"));require("antd/es/input/style/css");var _input=_interopRequireDefault(require("antd/es/input")),_classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")),_createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass")),_possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")),_getPrototypeOf2=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")),_inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits")),_slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")),_toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray")),_typeof2=_interopRequireDefault(require("@babel/runtime/helpers/typeof")),_react=_interopRequireWildcard(require("react")),_lodash=require("lodash"),_recompose=require("recompose"),_compose=require("../compose");function _createSuper(a){return function(){var e,r=(0,_getPrototypeOf2.default)(a);if(_isNativeReflectConstruct()){var t=(0,_getPrototypeOf2.default)(this).constructor;e=Reflect.construct(r,arguments,t)}else e=r.apply(this,arguments);return(0,_possibleConstructorReturn2.default)(this,e)}}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}function _createForOfIteratorHelper(e){if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(e=_unsupportedIterableToArray(e))){var r=0,t=function(){};return{s:t,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:t}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,n,o=!0,l=!1;return{s:function(){a=e[Symbol.iterator]()},n:function(){var e=a.next();return o=e.done,e},e:function(e){l=!0,n=e},f:function(){try{o||null==a.return||a.return()}finally{if(l)throw n}}}}function _unsupportedIterableToArray(e,r){if(e){if("string"==typeof e)return _arrayLikeToArray(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(t):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(e,r):void 0}}function _arrayLikeToArray(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,a=new Array(r);t<r;t++)a[t]=e[t];return a}var __decorate=function(e,r,t,a){var n,o=arguments.length,l=o<3?r:null===a?a=Object.getOwnPropertyDescriptor(r,t):a;if("object"===("undefined"==typeof Reflect?"undefined":(0,_typeof2.default)(Reflect))&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,r,t,a);else for(var u=e.length-1;0<=u;u--)(n=e[u])&&(l=(o<3?n(l):3<o?n(r,t,l):n(r,t))||l);return 3<o&&l&&Object.defineProperty(r,t,l),l},__rest=function(e,r){var t={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&r.indexOf(a)<0&&(t[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(a=Object.getOwnPropertySymbols(e);n<a.length;n++)r.indexOf(a[n])<0&&Object.prototype.propertyIsEnumerable.call(e,a[n])&&(t[a[n]]=e[a[n]])}return t},defaultLocaleList=[{locale:"zh-CN",label:"中文"},{locale:"en-US",label:"English"}],getMergeLocale=function(e){if(e.length){var r,t=[].concat(defaultLocaleList,(0,_toConsumableArray2.default)(e)).map(function(e){return[e.locale,e.label]}),a=[],n=_createForOfIteratorHelper(new Map(t).entries());try{for(n.s();!(r=n.n()).done;){var o=(0,_slicedToArray2.default)(r.value,2),l=o[0],u=o[1];a.push({label:u,locale:l})}}catch(e){n.e(e)}finally{n.f()}}return defaultLocaleList},withLangSelect=(0,_recompose.compose)((0,_recompose.defaultProps)({allowClear:!0,placeholder:"请输入文本",onChange:function(){},localeList:[]}),(0,_recompose.withState)("cacheMap","setCacheMap",function(e){var r=e.value,t=void 0===r?[]:r;if(Array.isArray(t)&&t.length){var a=(0,_lodash.map)(t,function(e){return[e.locale,e.value]});return new Map(a)}return new Map}),(0,_recompose.withProps)(function(e){var r=e.localeList,l=e.cacheMap,u=e.onChange;return{language:(0,_lodash.map)(getMergeLocale(r),function(e){return(0,_lodash.pick)(e,["locale","label"])}),onChange:function(){var e,r=[],t=_createForOfIteratorHelper(l.entries());try{for(t.s();!(e=t.n()).done;){var a=(0,_slicedToArray2.default)(e.value,2),n=a[0],o=a[1];r.push({locale:n,value:o})}}catch(e){t.e(e)}finally{t.f()}u(r)}}}),(0,_recompose.withState)("currentLocale","setCurrentLocale",function(e){var r=e.value,t=void 0===r?[]:r,a=e.language;return(t[0]||a[0]).locale}),(0,_recompose.withHandlers)({onLocaleChange:function(e){var r=e.setCurrentLocale;return function(e){r(e)}}})),InputLang=function(e){(0,_inherits2.default)(t,e);var r=_createSuper(t);function t(){var o;return(0,_classCallCheck2.default)(this,t),(o=r.apply(this,arguments)).onInputChange=function(e){var r=e.target.value,t=o.props,a=t.currentLocale,n=t.onChange;t.cacheMap.set(a,r),n()},o}return(0,_createClass2.default)(t,[{key:"render",value:function(){var e=this.props,r=e.onEnter,t=(e.setlocale,e.cacheId,e.cacheMap,e.localeList,e.setCurrentLocale,e.onLocaleChange,e.currentValue),a=(e.setCacheMap,e.currentLocale,__rest(e,["onEnter","setlocale","cacheId","cacheMap","localeList","setCurrentLocale","onLocaleChange","currentValue","setCacheMap","currentLocale"]));return _react.default.createElement(_input.default,Object.assign({},a,{value:t,onKeyDown:r,onChange:this.onInputChange}))}}]),t}(_react.Component);InputLang=__decorate([(0,_recompose.compose)(_recompose.toClass,withLangSelect,(0,_compose.withEdit)(function(e){var r=e.currentLocale;return e.cacheMap.get(r)},"gantd-input-lang-addonBefore"),(0,_recompose.withProps)(function(e){var r=e.onLocaleChange,t=e.language,a=e.cacheMap,n=e.currentLocale;return{addonBefore:_react.default.createElement(_select.default,{dropdownClassName:"gantd-input-lang-addonBefore",style:{width:75},value:n,onChange:r},t.map(function(e){return _react.default.createElement(_select.default.Option,{value:e.locale,key:e.locale},e.label)})),currentValue:a.get(n)}}))],InputLang);var InputLangWapper=function(e){(0,_inherits2.default)(t,e);var r=_createSuper(t);function t(){return(0,_classCallCheck2.default)(this,t),r.apply(this,arguments)}return(0,_createClass2.default)(t,[{key:"render",value:function(){return _react.default.createElement(InputLang,Object.assign({},this.props))}}]),t}(_react.Component);exports.default=InputLangWapper; |
@@ -1,1 +0,1 @@ | ||
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault"),_interopRequireWildcard=require("@babel/runtime/helpers/interopRequireWildcard");Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends")),_objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties")),_classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")),_createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass")),_possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")),_getPrototypeOf2=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")),_assertThisInitialized2=_interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized")),_inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits")),_defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));require("antd/es/select/style/css");var _dec,_class,_temp,_select=_interopRequireDefault(require("antd/es/select")),_react=_interopRequireWildcard(require("react")),_lodash=require("lodash"),_numeral=_interopRequireDefault(require("numeral")),_recompose=require("recompose"),_inputNumber=_interopRequireDefault(require("../input-number")),_compose=require("../compose"),_symbol=_interopRequireDefault(require("./symbol.json")),withMoneyType=(0,_recompose.compose)(_recompose.toClass,(0,_recompose.defaultProps)({allowClear:!0,precision:2,onEnter:function(){}}),(0,_recompose.withProps)(function(e){var r=e.precision,t=Math.max(0,r);return{precision:t,format:"0,0."+"0".repeat(t),step:1/Math.pow(10,t),reg:new RegExp("[1-9](?:[0-9]+)?(?:.[0-9]{0,".concat(t,"})?|0.[0-9]{0,").concat(t,"}"))}}),(0,_recompose.withProps)(function(e){var r=e.value,t=void 0===r?{}:r,n=e.format,a=e.onChange,o=t.key,u=void 0===o?_symbol.default[0]:o,i=t.value,l={currency:u,money:i};if(i){var s=Number((0,_numeral.default)(i).format(n));i!==s&&(l.money=s,a({key:l.currency,value:s}))}return l}),(0,_recompose.withProps)(function(e){var r=e.onChange,t=e.currency,n=e.money;return{onCurrencyChange:function(e){r({key:e,value:n})},onMoneyChange:function(e){r({key:t,value:e})}}})),InputMoney=(_dec=(0,_recompose.compose)(withMoneyType,(0,_compose.withEdit)(function(e){var r=e.currency,t=e.money,n=e.format;if(!(0,_lodash.isNumber)(t))return null;var a=(0,_numeral.default)(t).format(n);return"".concat(r," ").concat(a)},"gantd-input-money-addonBefore"),(0,_recompose.withProps)(function(e){var r=e.currency,t=e.onCurrencyChange;return{addonBefore:_react.default.createElement(_select.default,{dropdownClassName:"gantd-input-money-addonBefore",style:{width:75},value:r,onChange:t},_symbol.default.map(function(e){return _react.default.createElement(_select.default.Option,{key:e,value:e},e)}))}})))((_temp=function(e){function t(e){var r;return(0,_classCallCheck2.default)(this,t),r=(0,_possibleConstructorReturn2.default)(this,(0,_getPrototypeOf2.default)(t).call(this,e)),(0,_defineProperty2.default)((0,_assertThisInitialized2.default)(r),"state",{value:void 0}),r.onChange=r.onChange.bind((0,_assertThisInitialized2.default)(r)),r}return(0,_inherits2.default)(t,e),(0,_createClass2.default)(t,[{key:"onChange",value:function(e){var r=this.props,t=r.reg,n=r.onMoneyChange,a=String((0,_numeral.default)(e).value()),o=a.match(t);o&&o[0]&&(a=o[0]),a=(0,_numeral.default)(a).value(),this.setState({value:a}),n(a)}},{key:"render",value:function(){var e=this.props,r=(e.setType,e.onEnter),t=(e.onValueChange,e.precision,e.format,e.reg,(0,_objectWithoutProperties2.default)(e,["setType","onEnter","onValueChange","precision","format","reg"])),n=this.state.value;return _react.default.createElement(_inputNumber.default,(0,_extends2.default)({},t,{isInner:!0,value:t.money||n,min:0,edit:_compose.EditStatus.EDIT,onPressEnter:r,onChange:this.onChange}))}}]),t}(_react.Component),_class=_temp))||_class,_default=InputMoney;exports.default=_default; | ||
"use strict";var _interopRequireWildcard=require("@babel/runtime/helpers/interopRequireWildcard"),_interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0,require("antd/es/select/style/css");var _select=_interopRequireDefault(require("antd/es/select")),_classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")),_createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass")),_assertThisInitialized2=_interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized")),_possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")),_getPrototypeOf2=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")),_inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits")),_typeof2=_interopRequireDefault(require("@babel/runtime/helpers/typeof")),_react=_interopRequireWildcard(require("react")),_lodash=require("lodash"),_numeral=_interopRequireDefault(require("numeral")),_recompose=require("recompose"),_inputNumber=_interopRequireDefault(require("../input-number")),_compose=require("../compose"),_symbol=_interopRequireDefault(require("./symbol.json"));function _createSuper(n){return function(){var e,t=(0,_getPrototypeOf2.default)(n);if(_isNativeReflectConstruct()){var r=(0,_getPrototypeOf2.default)(this).constructor;e=Reflect.construct(t,arguments,r)}else e=t.apply(this,arguments);return(0,_possibleConstructorReturn2.default)(this,e)}}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}var __decorate=function(e,t,r,n){var o,a=arguments.length,u=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"===("undefined"==typeof Reflect?"undefined":(0,_typeof2.default)(Reflect))&&"function"==typeof Reflect.decorate)u=Reflect.decorate(e,t,r,n);else for(var i=e.length-1;0<=i;i--)(o=e[i])&&(u=(a<3?o(u):3<a?o(t,r,u):o(t,r))||u);return 3<a&&u&&Object.defineProperty(t,r,u),u},__rest=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r},withMoneyType=(0,_recompose.compose)((0,_recompose.defaultProps)({allowClear:!0,precision:2,onEnter:function(){}}),(0,_recompose.withProps)(function(e){var t=e.precision,r=Math.max(0,t);return{precision:r,format:"0,0."+"0".repeat(r),step:1/Math.pow(10,r),reg:new RegExp("[1-9](?:[0-9]+)?(?:.[0-9]{0,".concat(r,"})?|0.[0-9]{0,").concat(r,"}"))}}),(0,_recompose.withProps)(function(e){var t=e.value,r=void 0===t?{}:t,n=(e.format,e.onChange,r.key);return{currency:void 0===n?_symbol.default[0]:n,money:r.value}}),(0,_recompose.withProps)(function(e){var t=e.onChange,r=e.currency,n=e.money;return{onCurrencyChange:function(e){t({key:e,value:n})},onMoneyChange:function(e){t({key:r,value:e})}}})),InputMoney=function(e){(0,_inherits2.default)(n,e);var r=_createSuper(n);function n(e){var t;return(0,_classCallCheck2.default)(this,n),(t=r.call(this,e)).state={value:void 0},t.onChange=t.onChange.bind((0,_assertThisInitialized2.default)(t)),t}return(0,_createClass2.default)(n,[{key:"onChange",value:function(e){var t=this.props,r=t.reg,n=t.onMoneyChange,o=String((0,_numeral.default)(e).value()),a=o.match(r);a&&a[0]&&(o=a[0]),o=(0,_numeral.default)(o).value(),this.setState({value:o}),n(o)}},{key:"render",value:function(){var e=this.props,t=(e.setType,e.onEnter),r=(e.onValueChange,e.precision,e.format,e.reg,__rest(e,["setType","onEnter","onValueChange","precision","format","reg"])),n=this.state.value;return _react.default.createElement(_inputNumber.default,Object.assign({},r,{isInner:!0,value:r.money||n,min:0,edit:_compose.EditStatus.EDIT,onPressEnter:t,onChange:this.onChange}))}}]),n}(_react.Component);InputMoney=__decorate([(0,_recompose.compose)(withMoneyType,(0,_compose.withEdit)(function(e){var t=e.currency,r=e.money,n=e.format;if(!(0,_lodash.isNumber)(r))return null;var o=(0,_numeral.default)(r).format(n);return"".concat(t," ").concat(o)},"gantd-input-money-addonBefore"),(0,_recompose.withProps)(function(e){var t=e.currency,r=e.onCurrencyChange;return{addonBefore:_react.default.createElement(_select.default,{dropdownClassName:"gantd-input-money-addonBefore",style:{width:75},value:t,onChange:r},_symbol.default.map(function(e){return _react.default.createElement(_select.default.Option,{key:e,value:e},e)}))}}))],InputMoney);var InputMoneyWrapper=function(e){(0,_inherits2.default)(r,e);var t=_createSuper(r);function r(){return(0,_classCallCheck2.default)(this,r),t.apply(this,arguments)}return(0,_createClass2.default)(r,[{key:"render",value:function(){return _react.default.createElement(InputMoney,Object.assign({},this.props))}}]),r}(_react.Component);exports.default=InputMoneyWrapper; |
@@ -1,1 +0,1 @@ | ||
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0,require("antd/es/input-number/style/css");var _dec,_class,_inputNumber=_interopRequireDefault(require("antd/es/input-number")),_extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends")),_objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties")),_classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")),_createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass")),_possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")),_getPrototypeOf2=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")),_inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits")),_react=_interopRequireDefault(require("react")),_lodash=require("lodash"),_numeral=_interopRequireDefault(require("numeral")),_recompose=require("recompose"),_input=require("../input"),_compose=require("../compose"),_classnames=_interopRequireDefault(require("classnames")),withInputNumber=(0,_recompose.compose)((0,_recompose.defaultProps)({onChange:function(){}}),(0,_recompose.withProps)(function(e){var r=e.value,t=e.onChange,u=r;return r&&!(0,_lodash.isNumber)(r)&&t(u=null),(0,_lodash.isNil)(u)||(u=(0,_numeral.default)(r).value()),{value:u}})),InputNumber=(_dec=(0,_recompose.compose)(_recompose.toClass,withInputNumber,(0,_compose.withEdit)(function(e){return e.value})))(_class=function(e){function r(){return(0,_classCallCheck2.default)(this,r),(0,_possibleConstructorReturn2.default)(this,(0,_getPrototypeOf2.default)(r).apply(this,arguments))}return(0,_inherits2.default)(r,e),(0,_createClass2.default)(r,[{key:"render",value:function(){var e=this.props,r=(e.addonAfter,e.addonBefore,e.className),t=(0,_objectWithoutProperties2.default)(e,["addonAfter","addonBefore","className"]);return _react.default.createElement(_inputNumber.default,(0,_extends2.default)({},t,{className:(0,_classnames.default)("gant-input-number",r)}))}}]),r}(_react.default.Component))||_class,_default=InputNumber;exports.default=_default; | ||
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0,require("antd/es/input-number/style/css");var _inputNumber=_interopRequireDefault(require("antd/es/input-number")),_classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")),_createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass")),_possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")),_getPrototypeOf2=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")),_inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits")),_typeof2=_interopRequireDefault(require("@babel/runtime/helpers/typeof")),_react=_interopRequireDefault(require("react")),_lodash=require("lodash"),_numeral=_interopRequireDefault(require("numeral")),_recompose=require("recompose"),_compose=require("../compose"),_classnames=_interopRequireDefault(require("classnames"));function _createSuper(u){return function(){var e,t=(0,_getPrototypeOf2.default)(u);if(_isNativeReflectConstruct()){var r=(0,_getPrototypeOf2.default)(this).constructor;e=Reflect.construct(t,arguments,r)}else e=t.apply(this,arguments);return(0,_possibleConstructorReturn2.default)(this,e)}}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}var __decorate=function(e,t,r,u){var n,o=arguments.length,a=o<3?t:null===u?u=Object.getOwnPropertyDescriptor(t,r):u;if("object"===("undefined"==typeof Reflect?"undefined":(0,_typeof2.default)(Reflect))&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,u);else for(var l=e.length-1;0<=l;l--)(n=e[l])&&(a=(o<3?n(a):3<o?n(t,r,a):n(t,r))||a);return 3<o&&a&&Object.defineProperty(t,r,a),a},__rest=function(e,t){var r={};for(var u in e)Object.prototype.hasOwnProperty.call(e,u)&&t.indexOf(u)<0&&(r[u]=e[u]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(u=Object.getOwnPropertySymbols(e);n<u.length;n++)t.indexOf(u[n])<0&&Object.prototype.propertyIsEnumerable.call(e,u[n])&&(r[u[n]]=e[u[n]])}return r},withInputNumber=(0,_recompose.compose)((0,_recompose.withProps)(function(e){var t=e.value,r=e.onChange,u=e.format,n=t;return t&&!(0,_lodash.isNumber)(t)&&(n=null),(0,_lodash.isNil)(n)||(n=(0,_numeral.default)(n).value()),{value:n,onChange:function(e){var t=e;u&&(t=Number((0,_numeral.default)(t).format(u))),r&&r(t)}}})),InputNumber=function(e){(0,_inherits2.default)(r,e);var t=_createSuper(r);function r(){return(0,_classCallCheck2.default)(this,r),t.apply(this,arguments)}return(0,_createClass2.default)(r,[{key:"render",value:function(){var e=this.props,t=e.className,r=__rest(e,["className"]);return _react.default.createElement(_inputNumber.default,Object.assign({},r,{className:(0,_classnames.default)("gant-input-number",t)}))}}]),r}(_react.default.Component),_default=InputNumber=__decorate([(0,_recompose.compose)(_recompose.toClass,withInputNumber,(0,_compose.withEdit)(function(e){return e.value}),(0,_recompose.mapProps)(function(e){var t=e.onEnter,r=__rest(e,["onEnter"]);return Object.assign({onPressEnter:t},r)}))],InputNumber);exports.default=_default; |
@@ -1,1 +0,1 @@ | ||
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault"),_interopRequireWildcard=require("@babel/runtime/helpers/interopRequireWildcard");Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0,require("antd/es/input/style/css");var _input=_interopRequireDefault(require("antd/es/input")),_extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends")),_classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")),_createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass")),_possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")),_getPrototypeOf3=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")),_assertThisInitialized2=_interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized")),_inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits")),_defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty")),_objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));require("antd/es/select/style/css");var _dec,_class,_temp,_select=_interopRequireDefault(require("antd/es/select")),_slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")),_toArray2=_interopRequireDefault(require("@babel/runtime/helpers/toArray")),_react=_interopRequireWildcard(require("react")),_recompose=require("recompose"),_compose=require("../compose"),_codes=_interopRequireDefault(require("./codes.json")),isPhone=/^\d{7,8}$/,reg=/^\d{0,8}$/,withCode=(0,_recompose.compose)(_recompose.toClass,(0,_recompose.withProps)(function(e){var t=e.value,r=void 0===t?{}:t,o=r.key;return{code:void 0===o?"010":o,phone:r.value}}),(0,_recompose.defaultProps)({placeholder:"请输入电话号码",allowClear:!0}),(0,_recompose.withProps)(function(e){var t=e.onChange,r=e.code,o=e.phone;return{filterOption:function(e,t){var r=t.key,o=t.props.label;return r.includes(e)||o.includes(e)},onCodeChange:function(e){t({key:e,value:o})},onPhoneChange:function(e){t({key:r,value:e})}}})),getValue=function(e){var t=e.code,r=e.phone;return r?"".concat(t," - ").concat(r):""},TelePhone=(_dec=(0,_recompose.compose)(withCode,(0,_recompose.withPropsOnChange)(["phone"],function(e){var t=e.phone;return{confirmable:!t||isPhone.test(String(t))}}),(0,_compose.withEdit)(getValue,"gantd-input-telphone-addonBefore"),(0,_recompose.withProps)(function(e){var t=e.code,r=e.onCodeChange,o=e.filterOption;return{addonBefore:_react.default.createElement(_select.default,{dropdownClassName:"gantd-input-telphone-addonBefore",style:{width:130},value:t,onChange:r,showSearch:!0,filterOption:o},_codes.default.map(function(e,t){var r=e,o=(0,_toArray2.default)(e),n=(0,_slicedToArray2.default)(o[0],2),a=n[0],i=n[1],l=o.slice(1);return i||(r=l),_react.default.createElement(_select.default.OptGroup,{label:a,key:a},r.map(function(e){return 1<e.length?_react.default.createElement(_select.default.Option,{key:e[1],value:e[1],label:e[0]},_react.default.createElement("span",null,e[1]),_react.default.createElement("span",{style:{display:"inline-block",marginLeft:6}},e[0])):void 0}))}))}}),(0,_recompose.mapProps)(function(e){e.filterOption;return(0,_objectWithoutProperties2.default)(e,["filterOption"])})))((_temp=function(e){function a(){var e,n;(0,_classCallCheck2.default)(this,a);for(var t=arguments.length,r=new Array(t),o=0;o<t;o++)r[o]=arguments[o];return n=(0,_possibleConstructorReturn2.default)(this,(e=(0,_getPrototypeOf3.default)(a)).call.apply(e,[this].concat(r))),(0,_defineProperty2.default)((0,_assertThisInitialized2.default)(n),"onChange",function(e){var t=n.props.onPhoneChange,r=e.target.value;r&&!reg.test(r)||t(r)}),(0,_defineProperty2.default)((0,_assertThisInitialized2.default)(n),"onKeyDown",function(e){var t=n.props,r=t.value,o=t.onEnter;r&&!isPhone.test(r)||o(e)}),n}return(0,_inherits2.default)(a,e),(0,_createClass2.default)(a,[{key:"render",value:function(){var e=this.props,t=(e.onEnter,e.onPhoneChange,e.onCodeChange,e.phone),r=(0,_objectWithoutProperties2.default)(e,["onEnter","onPhoneChange","onCodeChange","phone"]);return _react.default.createElement(_input.default,(0,_extends2.default)({},r,{value:t,onKeyDown:this.onKeyDown,onChange:this.onChange}))}}]),a}(_react.Component),_class=_temp))||_class,_default=TelePhone;exports.default=_default; | ||
"use strict";var _interopRequireWildcard=require("@babel/runtime/helpers/interopRequireWildcard"),_interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")),_toArray2=_interopRequireDefault(require("@babel/runtime/helpers/toArray"));require("antd/es/select/style/css");var _select=_interopRequireDefault(require("antd/es/select"));require("antd/es/input/style/css");var _input=_interopRequireDefault(require("antd/es/input")),_classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")),_createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass")),_possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")),_getPrototypeOf2=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")),_inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits")),_typeof2=_interopRequireDefault(require("@babel/runtime/helpers/typeof")),_react=_interopRequireWildcard(require("react")),_recompose=require("recompose"),_compose=require("../compose"),_codes=_interopRequireDefault(require("./codes.json"));function _createSuper(n){return function(){var e,t=(0,_getPrototypeOf2.default)(n);if(_isNativeReflectConstruct()){var r=(0,_getPrototypeOf2.default)(this).constructor;e=Reflect.construct(t,arguments,r)}else e=t.apply(this,arguments);return(0,_possibleConstructorReturn2.default)(this,e)}}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}var __decorate=function(e,t,r,n){var o,a=arguments.length,l=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"===("undefined"==typeof Reflect?"undefined":(0,_typeof2.default)(Reflect))&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,r,n);else for(var u=e.length-1;0<=u;u--)(o=e[u])&&(l=(a<3?o(l):3<a?o(t,r,l):o(t,r))||l);return 3<a&&l&&Object.defineProperty(t,r,l),l},__rest=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r},isPhone=/^\d{7,8}$/,reg=/^\d{0,8}$/,withCode=(0,_recompose.compose)(_recompose.toClass,(0,_recompose.withProps)(function(e){var t=e.value,r=void 0===t?{}:t,n=r.key;return{code:void 0===n?"010":n,phone:r.value}}),(0,_recompose.defaultProps)({placeholder:"请输入电话号码",allowClear:!0}),(0,_recompose.withProps)(function(e){var t=e.onChange,r=e.code,n=e.phone;return{filterOption:function(e,t){var r=t.key,n=t.props.label;return r.includes(e)||n.includes(e)},onCodeChange:function(e){t({key:e,value:n})},onPhoneChange:function(e){t({key:r,value:e})}}})),getValue=function(e){var t=e.code,r=e.phone;return r?"".concat(t," - ").concat(r):""},TelePhone=function(e){(0,_inherits2.default)(r,e);var t=_createSuper(r);function r(){var a;return(0,_classCallCheck2.default)(this,r),(a=t.apply(this,arguments)).onChange=function(e){var t=a.props.onPhoneChange,r=e.target.value;r&&!reg.test(r)||t(r)},a.onKeyDown=function(e){var t=a.props,r=(t.value,t.code),n=t.phone,o=t.onEnter;r&&!isPhone.test(n)||o(e)},a}return(0,_createClass2.default)(r,[{key:"render",value:function(){var e=this.props,t=(e.onEnter,e.onPhoneChange,e.onCodeChange,e.phone),r=__rest(e,["onEnter","onPhoneChange","onCodeChange","phone"]);return _react.default.createElement(_input.default,Object.assign({},r,{value:t,onKeyDown:this.onKeyDown,onChange:this.onChange}))}}]),r}(_react.Component);TelePhone=__decorate([(0,_recompose.compose)(withCode,(0,_recompose.withPropsOnChange)(["phone"],function(e){var t=e.phone;return{confirmable:!t||isPhone.test(String(t))}}),(0,_compose.withEdit)(getValue,"gantd-input-telphone-addonBefore"),(0,_recompose.withProps)(function(e){var t=e.code,r=e.onCodeChange,n=e.filterOption;return{addonBefore:_react.default.createElement(_select.default,{dropdownClassName:"gantd-input-telphone-addonBefore",style:{width:130},value:t,onChange:r,showSearch:!0,filterOption:n},_codes.default.map(function(e,t){var r=e,n=(0,_toArray2.default)(e),o=(0,_slicedToArray2.default)(n[0],2),a=o[0],l=o[1],u=n.slice(1);return l||(r=u),_react.default.createElement(_select.default.OptGroup,{label:a,key:a},r.map(function(e){return 1<e.length?_react.default.createElement(_select.default.Option,{key:e[1],value:e[1],label:e[0]},_react.default.createElement("span",null,e[1]),_react.default.createElement("span",{style:{display:"inline-block",marginLeft:6}},e[0])):void 0}))}))}}),(0,_recompose.mapProps)(function(e){e.filterOption;return __rest(e,["filterOption"])}))],TelePhone);var TelePhoneWrapper=function(e){(0,_inherits2.default)(r,e);var t=_createSuper(r);function r(){return(0,_classCallCheck2.default)(this,r),t.apply(this,arguments)}return(0,_createClass2.default)(r,[{key:"render",value:function(){return _react.default.createElement(TelePhone,Object.assign({},this.props))}}]),r}(_react.Component);exports.default=TelePhoneWrapper; |
@@ -1,1 +0,1 @@ | ||
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0,require("antd/es/input/style/css");var _dec,_class,_input=_interopRequireDefault(require("antd/es/input")),_extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends")),_objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties")),_classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")),_createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass")),_possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")),_getPrototypeOf2=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")),_inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits")),_react=_interopRequireDefault(require("react")),_compose=require("../compose"),getValue=function(e){var t=e.value;if(!/[\w\-]+(\.[\w\-]+)+([\w\-.,@?^=%&:\/~+#]*[\w\-@?^=%&\/~+#])?$/.test(t))return t;return/^(ht|f)tps?:\/\//.test(t)||(t="http://".concat(t)),_react.default.createElement("a",{href:t,target:"_blank",rel:"noopener noreferrer"},t)},Url=(_dec=(0,_compose.withEdit)(getValue))(_class=function(e){function t(){return(0,_classCallCheck2.default)(this,t),(0,_possibleConstructorReturn2.default)(this,(0,_getPrototypeOf2.default)(t).apply(this,arguments))}return(0,_inherits2.default)(t,e),(0,_createClass2.default)(t,[{key:"render",value:function(){var e=this.props,t=e.onEnter,r=e.onChange,u=(0,_objectWithoutProperties2.default)(e,["onEnter","onChange"]);return _react.default.createElement(_input.default,(0,_extends2.default)({onKeyDown:t,onChange:function(e){return r(e.target.value)}},u))}}]),t}(_react.default.Component))||_class,_default=Url;exports.default=_default; | ||
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0,require("antd/es/input/style/css");var _input=_interopRequireDefault(require("antd/es/input")),_classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")),_createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass")),_possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")),_getPrototypeOf2=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")),_inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits")),_typeof2=_interopRequireDefault(require("@babel/runtime/helpers/typeof")),_react=_interopRequireDefault(require("react")),_compose=require("../compose"),_recompose=require("recompose");function _createSuper(n){return function(){var e,t=(0,_getPrototypeOf2.default)(n);if(_isNativeReflectConstruct()){var r=(0,_getPrototypeOf2.default)(this).constructor;e=Reflect.construct(t,arguments,r)}else e=t.apply(this,arguments);return(0,_possibleConstructorReturn2.default)(this,e)}}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}var __decorate=function(e,t,r,n){var o,u=arguments.length,a=u<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"===("undefined"==typeof Reflect?"undefined":(0,_typeof2.default)(Reflect))&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var l=e.length-1;0<=l;l--)(o=e[l])&&(a=(u<3?o(a):3<u?o(t,r,a):o(t,r))||a);return 3<u&&a&&Object.defineProperty(t,r,a),a},__rest=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r},getValue=function(e){var t=e.value;if(!/[\w\-]+(\.[\w\-]+)+([\w\-.,@?^=%&:\/~+#]*[\w\-@?^=%&\/~+#])?$/.test(t))return t;return/^(ht|f)tps?:\/\//.test(t)||(t="http://".concat(t)),_react.default.createElement("a",{href:t,target:"_blank",rel:"noopener noreferrer"},t)},Url=function(e){(0,_inherits2.default)(r,e);var t=_createSuper(r);function r(){return(0,_classCallCheck2.default)(this,r),t.apply(this,arguments)}return(0,_createClass2.default)(r,[{key:"render",value:function(){var e=this.props,t=e.onChange,r=__rest(e,["onChange"]),n=r.onEnter,o=__rest(r,["onEnter"]);return _react.default.createElement(_input.default,Object.assign({onChange:function(e){return t(e.target.value)},onKeyDown:n},o))}}]),r}(_react.default.Component),_default=Url=__decorate([(0,_recompose.compose)(_recompose.toClass,(0,_compose.withEdit)(getValue))],Url);exports.default=_default; |
@@ -1,1 +0,1 @@ | ||
"use strict";var _interopRequireWildcard=require("@babel/runtime/helpers/interopRequireWildcard"),_interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0,require("antd/es/input/style/css");var _input=_interopRequireDefault(require("antd/es/input")),_extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends")),_defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty")),_objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties")),_react=_interopRequireWildcard(require("react")),_classnames2=_interopRequireDefault(require("classnames")),_default=function(e){var r,t=e.gant,i=void 0===t||t,u=(0,_objectWithoutProperties2.default)(e,["gant"]),a=(0,_react.useMemo)(function(){var r=0;return _react.default.Children.map(u.children,function(e){e&&(r+=1)}),r},[u.children]);return _react.default.createElement(_input.default.Group,(0,_extends2.default)({},u,{className:(0,_classnames2.default)(u.className,(r={},(0,_defineProperty2.default)(r,"gant-input-group",i),(0,_defineProperty2.default)(r,"gant-input-group-child",1===a),(0,_defineProperty2.default)(r,"gant-input-group-children",1<a),r))}))};exports.default=_default; | ||
"use strict";var _interopRequireWildcard=require("@babel/runtime/helpers/interopRequireWildcard"),_interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));require("antd/es/input/style/css");var _input=_interopRequireDefault(require("antd/es/input")),_react=_interopRequireWildcard(require("react")),_classnames2=_interopRequireDefault(require("classnames")),__rest=function(e,r){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)r.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(t[n[a]]=e[n[a]])}return t},_default=function(e){var r,t=e.gant,n=void 0===t||t,a=__rest(e,["gant"]),i=(0,_react.useMemo)(function(){var r=0;return _react.default.Children.map(a.children,function(e){e&&(r+=1)}),r},[a.children]);return _react.default.createElement(_input.default.Group,Object.assign({},a,{className:(0,_classnames2.default)(a.className,(r={},(0,_defineProperty2.default)(r,"gant-input-group",n),(0,_defineProperty2.default)(r,"gant-input-group-child",1===i),(0,_defineProperty2.default)(r,"gant-input-group-children",1<i),r))}))};exports.default=_default; |
import Input from './Input'; | ||
import TextArea from './TextArea'; | ||
import Password from './Password'; | ||
import Search from './Search'; | ||
import Group from './Group'; | ||
export { GantInputProps } from './Input'; | ||
export { GantTextAreaProps } from './TextArea'; | ||
export { GantSearchProps } from './Search'; | ||
export default Input; | ||
export { TextArea, Search, Group, Password, }; |
@@ -1,1 +0,1 @@ | ||
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"TextArea",{enumerable:!0,get:function(){return _TextArea.default}}),Object.defineProperty(exports,"Password",{enumerable:!0,get:function(){return _Password.default}}),Object.defineProperty(exports,"Search",{enumerable:!0,get:function(){return _Search.default}}),Object.defineProperty(exports,"Group",{enumerable:!0,get:function(){return _Group.default}}),exports.default=void 0;var _Input=_interopRequireDefault(require("./Input")),_TextArea=_interopRequireDefault(require("./TextArea")),_Password=_interopRequireDefault(require("./Password")),_Search=_interopRequireDefault(require("./Search")),_Group=_interopRequireDefault(require("./Group"));_Input.default.TextArea=_TextArea.default,_Input.default.Search=_Search.default,_Input.default.Group=_Group.default,_Input.default.Password=_Password.default;var _default=_Input.default;exports.default=_default; | ||
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _Input=_interopRequireDefault(require("./Input")),_TextArea=_interopRequireDefault(require("./TextArea")),_Password=_interopRequireDefault(require("./Password")),_Search=_interopRequireDefault(require("./Search"));_Input.default.TextArea=_TextArea.default,_Input.default.Search=_Search.default,_Input.default.Password=_Password.default;var _default=_Input.default;exports.default=_default; |
@@ -1,1 +0,1 @@ | ||
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0,require("antd/es/input/style/css");var _input=_interopRequireDefault(require("antd/es/input")),_extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends")),_objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties")),_classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")),_createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass")),_possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")),_getPrototypeOf3=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")),_assertThisInitialized2=_interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized")),_inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits")),_defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty")),_react=_interopRequireDefault(require("react")),_compose=require("../compose"),_datacell=_interopRequireDefault(require("../compose/datacell")),Input=function(e){function u(){var e,a;(0,_classCallCheck2.default)(this,u);for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];return a=(0,_possibleConstructorReturn2.default)(this,(e=(0,_getPrototypeOf3.default)(u)).call.apply(e,[this].concat(r))),(0,_defineProperty2.default)((0,_assertThisInitialized2.default)(a),"onChange",function(e){var t=a.props,r=t.onChange,i=t.strict,u=e.target.value;i&&(u=u.replace(/[^a-zA-Z0-9\u4e00-\u9fa5]/g,"")),r(u)}),a}return(0,_inherits2.default)(u,e),(0,_createClass2.default)(u,[{key:"render",value:function(){var i=this,e=this.props,t=(e.strict,e.onChange,(0,_objectWithoutProperties2.default)(e,["strict","onChange"]));return _react.default.createElement(_datacell.default,(0,_extends2.default)({},t,{onChange:this.onChange}),function(e){var t=e.onEnter,r=(0,_objectWithoutProperties2.default)(e,["onEnter"]);return _react.default.createElement(_input.default,(0,_extends2.default)({},r,{onKeyDown:t,ref:function(e){i.inputDOM=e}}))})}}]),u}(_react.default.Component),_default=Input;exports.default=_default; | ||
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0,require("antd/es/input/style/css");var _input=_interopRequireDefault(require("antd/es/input")),_classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")),_createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass")),_possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")),_getPrototypeOf2=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")),_inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits")),_react=_interopRequireDefault(require("react")),_index=require("../index");function _createSuper(n){return function(){var e,t=(0,_getPrototypeOf2.default)(n);if(_isNativeReflectConstruct()){var r=(0,_getPrototypeOf2.default)(this).constructor;e=Reflect.construct(t,arguments,r)}else e=t.apply(this,arguments);return(0,_possibleConstructorReturn2.default)(this,e)}}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}var __rest=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var u=0;for(n=Object.getOwnPropertySymbols(e);u<n.length;u++)t.indexOf(n[u])<0&&Object.prototype.propertyIsEnumerable.call(e,n[u])&&(r[n[u]]=e[n[u]])}return r},Input=function(e){(0,_inherits2.default)(r,e);var t=_createSuper(r);function r(){var a;return(0,_classCallCheck2.default)(this,r),(a=t.apply(this,arguments)).onChange=function(e){var t=a.props,r=t.onChange,n=t.strict,u=e.target.value;n&&(u=u.replace(/[^a-zA-Z0-9\u4e00-\u9fa5]/g,"")),r&&r(u)},a}return(0,_createClass2.default)(r,[{key:"render",value:function(){var n=this,e=this.props,t=(e.strict,__rest(e,["strict"]));return _react.default.createElement(_index.DataEditCell,Object.assign({},t),function(e){var t=e.onEnter,r=(e.onChange,__rest(e,["onEnter","onChange"]));return _react.default.createElement(_input.default,Object.assign({},r,{onChange:function(e){return n.onChange(e)},onKeyDown:t}))})}}]),r}(_react.default.Component),_default=Input;exports.default=_default; |
@@ -1,1 +0,1 @@ | ||
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0,require("antd/es/input/style/css");var _dec,_class,_class2,_temp,_input=_interopRequireDefault(require("antd/es/input")),_extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends")),_objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties")),_classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")),_createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass")),_possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")),_getPrototypeOf2=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")),_inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits")),_defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty")),_react=_interopRequireDefault(require("react")),_compose=require("../compose"),getText=function(e){var t=e.value;return t?_react.default.createElement("div",null,Array.from(t).fill("●")):""},Password=(_dec=(0,_compose.withEdit)(getText))((_temp=_class2=function(e){function t(){return(0,_classCallCheck2.default)(this,t),(0,_possibleConstructorReturn2.default)(this,(0,_getPrototypeOf2.default)(t).apply(this,arguments))}return(0,_inherits2.default)(t,e),(0,_createClass2.default)(t,[{key:"render",value:function(){var e=this.props,t=e.onChange,r=e.onEnter,u=(e.style,(0,_objectWithoutProperties2.default)(e,["onChange","onEnter","style"]));return _react.default.createElement(_input.default.Password,(0,_extends2.default)({},u,{onChange:function(e){return t(e.target.value)},onKeyDown:r}))}}]),t}(_react.default.Component),(0,_defineProperty2.default)(_class2,"defaultProps",{style:{}}),_class=_temp))||_class,_default=Password;exports.default=_default; | ||
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0,require("antd/es/input/style/css");var _input=_interopRequireDefault(require("antd/es/input")),_classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")),_createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass")),_possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")),_getPrototypeOf2=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")),_inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits")),_typeof2=_interopRequireDefault(require("@babel/runtime/helpers/typeof")),_react=_interopRequireDefault(require("react")),_compose=require("../compose");function _createSuper(n){return function(){var e,t=(0,_getPrototypeOf2.default)(n);if(_isNativeReflectConstruct()){var r=(0,_getPrototypeOf2.default)(this).constructor;e=Reflect.construct(t,arguments,r)}else e=t.apply(this,arguments);return(0,_possibleConstructorReturn2.default)(this,e)}}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}var __decorate=function(e,t,r,n){var u,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"===("undefined"==typeof Reflect?"undefined":(0,_typeof2.default)(Reflect))&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var l=e.length-1;0<=l;l--)(u=e[l])&&(a=(o<3?u(a):3<o?u(t,r,a):u(t,r))||a);return 3<o&&a&&Object.defineProperty(t,r,a),a},__rest=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var u=0;for(n=Object.getOwnPropertySymbols(e);u<n.length;u++)t.indexOf(n[u])<0&&Object.prototype.propertyIsEnumerable.call(e,n[u])&&(r[n[u]]=e[n[u]])}return r},getText=function(e){var t=e.value;return t?_react.default.createElement("div",null,Array.from(t).fill("●")):""},Password=function(e){(0,_inherits2.default)(r,e);var t=_createSuper(r);function r(){return(0,_classCallCheck2.default)(this,r),t.apply(this,arguments)}return(0,_createClass2.default)(r,[{key:"render",value:function(){var e=this.props,t=e.onChange,r=__rest(e,["onChange"]),n=r.onEnter,u=__rest(r,["onEnter"]);return _react.default.createElement(_input.default.Password,Object.assign({onKeyDown:n},u,{onChange:function(e){return t(e.target.value)}}))}}]),r}(_react.default.Component);Password.defaultProps={style:{}};var _default=Password=__decorate([(0,_compose.withEdit)(getText)],Password);exports.default=_default; |
@@ -1,1 +0,1 @@ | ||
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0,require("antd/es/input/style/css");var _dec,_class,_class2,_temp,_input=_interopRequireDefault(require("antd/es/input")),_extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends")),_objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties")),_classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")),_createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass")),_possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")),_getPrototypeOf2=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")),_inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits")),_defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty")),_react=_interopRequireDefault(require("react")),_compose=require("../compose"),getText=function(e){return e.value},Search=(_dec=(0,_compose.withEdit)(getText))((_temp=_class2=function(e){function t(){return(0,_classCallCheck2.default)(this,t),(0,_possibleConstructorReturn2.default)(this,(0,_getPrototypeOf2.default)(t).apply(this,arguments))}return(0,_inherits2.default)(t,e),(0,_createClass2.default)(t,[{key:"render",value:function(){var e=this.props,t=e.onChange,r=e.onEnter,u=(e.style,(0,_objectWithoutProperties2.default)(e,["onChange","onEnter","style"]));return _react.default.createElement(_input.default.Search,(0,_extends2.default)({},u,{onChange:function(e){return t(e.target.value)},onKeyDown:r}))}}]),t}(_react.default.Component),(0,_defineProperty2.default)(_class2,"defaultProps",{style:{}}),_class=_temp))||_class,_default=Search;exports.default=_default; | ||
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0,require("antd/es/input/style/css");var _input=_interopRequireDefault(require("antd/es/input")),_classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")),_createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass")),_possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")),_getPrototypeOf2=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")),_inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits")),_typeof2=_interopRequireDefault(require("@babel/runtime/helpers/typeof")),_react=_interopRequireDefault(require("react")),_compose=require("../compose");function _createSuper(n){return function(){var e,t=(0,_getPrototypeOf2.default)(n);if(_isNativeReflectConstruct()){var r=(0,_getPrototypeOf2.default)(this).constructor;e=Reflect.construct(t,arguments,r)}else e=t.apply(this,arguments);return(0,_possibleConstructorReturn2.default)(this,e)}}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}var __decorate=function(e,t,r,n){var u,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"===("undefined"==typeof Reflect?"undefined":(0,_typeof2.default)(Reflect))&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var i=e.length-1;0<=i;i--)(u=e[i])&&(a=(o<3?u(a):3<o?u(t,r,a):u(t,r))||a);return 3<o&&a&&Object.defineProperty(t,r,a),a},__rest=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var u=0;for(n=Object.getOwnPropertySymbols(e);u<n.length;u++)t.indexOf(n[u])<0&&Object.prototype.propertyIsEnumerable.call(e,n[u])&&(r[n[u]]=e[n[u]])}return r},getText=function(e){return e.value},Search=function(e){(0,_inherits2.default)(r,e);var t=_createSuper(r);function r(){return(0,_classCallCheck2.default)(this,r),t.apply(this,arguments)}return(0,_createClass2.default)(r,[{key:"render",value:function(){var e=this.props,t=e.onChange,r=(e.style,__rest(e,["onChange","style"])),n=r.onEnter,u=__rest(r,["onEnter"]);return _react.default.createElement(_input.default.Search,Object.assign({onKeyDown:n},u,{onChange:function(e){return t(e.target.value)}}))}}]),r}(_react.default.Component);Search.defaultProps={style:{}};var _default=Search=__decorate([(0,_compose.withEdit)(getText)],Search);exports.default=_default; |
@@ -1,1 +0,1 @@ | ||
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0,require("antd/es/input/style/css");var _dec,_class,_class2,_temp,_input=_interopRequireDefault(require("antd/es/input")),_extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends")),_objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties")),_classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")),_createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass")),_possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")),_getPrototypeOf2=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")),_inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits")),_defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty")),_react=_interopRequireDefault(require("react")),_Group=_interopRequireDefault(require("./Group")),_compose=require("../compose"),getText=function(e){var t=e.value;return t?_react.default.createElement("div",{style:{whiteSpace:"normal",wordWrap:"break-word"}},t):null},TextArea=(_dec=(0,_compose.withEdit)(getText))((_temp=_class2=function(e){function t(){return(0,_classCallCheck2.default)(this,t),(0,_possibleConstructorReturn2.default)(this,(0,_getPrototypeOf2.default)(t).apply(this,arguments))}return(0,_inherits2.default)(t,e),(0,_createClass2.default)(t,[{key:"render",value:function(){var e=this.props,t=e.onChange,r=e.onEnter,u=(0,_objectWithoutProperties2.default)(e,["onChange","onEnter"]);return _react.default.createElement(_input.default.TextArea,(0,_extends2.default)({},u,{onChange:function(e){return t(e.target.value)},onKeyDown:r}))}}]),t}(_react.default.Component),(0,_defineProperty2.default)(_class2,"defaultProps",{style:{}}),_class=_temp))||_class,_default=TextArea;exports.default=_default; | ||
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0,require("antd/es/input/style/css");var _input=_interopRequireDefault(require("antd/es/input")),_classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")),_createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass")),_possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")),_getPrototypeOf2=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")),_inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits")),_typeof2=_interopRequireDefault(require("@babel/runtime/helpers/typeof")),_react=_interopRequireDefault(require("react")),_compose=require("../compose");function _createSuper(n){return function(){var e,t=(0,_getPrototypeOf2.default)(n);if(_isNativeReflectConstruct()){var r=(0,_getPrototypeOf2.default)(this).constructor;e=Reflect.construct(t,arguments,r)}else e=t.apply(this,arguments);return(0,_possibleConstructorReturn2.default)(this,e)}}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}var __decorate=function(e,t,r,n){var u,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"===("undefined"==typeof Reflect?"undefined":(0,_typeof2.default)(Reflect))&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var l=e.length-1;0<=l;l--)(u=e[l])&&(a=(o<3?u(a):3<o?u(t,r,a):u(t,r))||a);return 3<o&&a&&Object.defineProperty(t,r,a),a},__rest=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var u=0;for(n=Object.getOwnPropertySymbols(e);u<n.length;u++)t.indexOf(n[u])<0&&Object.prototype.propertyIsEnumerable.call(e,n[u])&&(r[n[u]]=e[n[u]])}return r},getText=function(e){var t=e.value;return t?_react.default.createElement("div",{style:{whiteSpace:"normal",wordWrap:"break-word"}},t):null},TextArea=function(e){(0,_inherits2.default)(r,e);var t=_createSuper(r);function r(){return(0,_classCallCheck2.default)(this,r),t.apply(this,arguments)}return(0,_createClass2.default)(r,[{key:"render",value:function(){var e=this.props,t=e.onChange,r=__rest(e,["onChange"]),n=r.onEnter,u=__rest(r,["onEnter"]);return _react.default.createElement(_input.default.TextArea,Object.assign({},u,{onChange:function(e){return t(e.target.value)},onKeyDown:n}))}}]),r}(_react.default.Component);TextArea.defaultProps={style:{}};var _default=TextArea=__decorate([(0,_compose.withEdit)(getText)],TextArea);exports.default=_default; |
@@ -1,1 +0,1 @@ | ||
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0,require("antd/es/cascader/style/css");var _dec,_class,_cascader=_interopRequireDefault(require("antd/es/cascader")),_extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends")),_objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties")),_classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")),_createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass")),_possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")),_getPrototypeOf2=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")),_inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits")),_slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")),_react=_interopRequireDefault(require("react")),_district_zh=_interopRequireDefault(require("./district_zh.json")),_input=require("../input"),_compose=require("../compose"),_recompose=require("recompose"),transformData=function o(e,t){var u=1<arguments.length&&void 0!==t?t:1;return Object.entries(_district_zh.default[e]).map(function(e){var t=(0,_slicedToArray2.default)(e,2),r=t[0],i=t[1],a={label:i,value:r};return!_district_zh.default[r]||_district_zh.default[r][r]&&_district_zh.default[r][r]===i||u<3&&(a.children=o(r,u+1)),a})},getLocationNameList=function(a){var o=[],u=_district_zh.default.COUNTRIES;return a&&a.length&&a.forEach(function(e,t){if(0===t)o.push(u[e]||"未知地址");else{var r=a[t-1],i=_district_zh.default[r];i&&o.push(i[e]||"未知地址")}}),o},getValue=function(e){var t=e.value;return getLocationNameList(t).join(" / ")},withLocation=(0,_recompose.compose)(_recompose.toClass,(0,_recompose.defaultProps)({style:{},options:transformData("COUNTRIES"),placeholder:"请选择地址"})),Location=(_dec=(0,_recompose.compose)(withLocation,(0,_compose.withEdit)(getValue)))(_class=function(e){function t(){return(0,_classCallCheck2.default)(this,t),(0,_possibleConstructorReturn2.default)(this,(0,_getPrototypeOf2.default)(t).apply(this,arguments))}return(0,_inherits2.default)(t,e),(0,_createClass2.default)(t,[{key:"render",value:function(){var e=this.props,t=(e.onEnter,(0,_objectWithoutProperties2.default)(e,["onEnter"]));return _react.default.createElement(_cascader.default,(0,_extends2.default)({},t,{className:"gant-location-cascader",changeOnSelect:!0,showSearch:{filter:function(t,e){return e.some(function(e){return-1<e.label.toLowerCase().indexOf(t.toLowerCase())})}}}))}}]),t}(_react.default.Component))||_class,_default=Location;exports.default=_default,Location.getLocationName=function(e){return getLocationNameList(e)}; | ||
"use strict";var _interopRequireWildcard=require("@babel/runtime/helpers/interopRequireWildcard"),_interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0,require("antd/es/cascader/style/css");var _cascader=_interopRequireDefault(require("antd/es/cascader")),_classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")),_createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass")),_possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")),_getPrototypeOf2=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")),_inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits")),_slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")),_typeof2=_interopRequireDefault(require("@babel/runtime/helpers/typeof")),_react=_interopRequireWildcard(require("react")),_classnames=_interopRequireDefault(require("classnames")),_district_zh=_interopRequireDefault(require("./district_zh.json")),_compose=require("../compose"),_recompose=require("recompose");function _createSuper(a){return function(){var e,t=(0,_getPrototypeOf2.default)(a);if(_isNativeReflectConstruct()){var r=(0,_getPrototypeOf2.default)(this).constructor;e=Reflect.construct(t,arguments,r)}else e=t.apply(this,arguments);return(0,_possibleConstructorReturn2.default)(this,e)}}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}var __decorate=function(e,t,r,a){var o,n=arguments.length,i=n<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,r):a;if("object"===("undefined"==typeof Reflect?"undefined":(0,_typeof2.default)(Reflect))&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,a);else for(var c=e.length-1;0<=c;c--)(o=e[c])&&(i=(n<3?o(i):3<n?o(t,r,i):o(t,r))||i);return 3<n&&i&&Object.defineProperty(t,r,i),i},__rest=function(e,t){var r={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(r[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(a=Object.getOwnPropertySymbols(e);o<a.length;o++)t.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(r[a[o]]=e[a[o]])}return r},transformData=function n(e,t){var i=1<arguments.length&&void 0!==t?t:1;return Object.entries(_district_zh.default[e]).map(function(e){var t=(0,_slicedToArray2.default)(e,2),r=t[0],a=t[1],o={label:a,value:r};return!_district_zh.default[r]||_district_zh.default[r][r]&&_district_zh.default[r][r]===a||i<3&&(o.children=n(r,i+1)),o})},getLocationNameList=function(o){var n=[],i=_district_zh.default.COUNTRIES;return o&&o.length&&o.forEach(function(e,t){if(0===t)n.push(i[e]||"未知地址");else{var r=o[t-1],a=_district_zh.default[r];a&&n.push(a[e]||"未知地址")}}),n},getValue=function(e){var t=e.value;return getLocationNameList(t).join(" / ")},withLocation=(0,_recompose.compose)(_recompose.toClass,(0,_recompose.defaultProps)({style:{},options:transformData("COUNTRIES"),placeholder:"请选择地址"})),Location=function(e){(0,_inherits2.default)(r,e);var t=_createSuper(r);function r(){return(0,_classCallCheck2.default)(this,r),t.apply(this,arguments)}return(0,_createClass2.default)(r,[{key:"render",value:function(){var e=this.props,t=(e.onEnter,e.className),r=e.popupClassName,a=__rest(e,["onEnter","className","popupClassName"]);return _react.default.createElement(_cascader.default,Object.assign({},a,{className:(0,_classnames.default)("gant-location-cascader",t),changeOnSelect:!0,popupClassName:(0,_classnames.default)("gant-location-cascader-popup",r),showSearch:{filter:function(t,e){return e.some(function(e){return-1<e.label.toLowerCase().indexOf(t.toLowerCase())})}}}))}}]),r}(_react.default.Component);Location=__decorate([(0,_recompose.compose)(withLocation,(0,_compose.withEdit)(getValue,"gant-location-cascader-popup"))],Location);var LocationWrapper=function(e){(0,_inherits2.default)(r,e);var t=_createSuper(r);function r(){return(0,_classCallCheck2.default)(this,r),t.apply(this,arguments)}return(0,_createClass2.default)(r,[{key:"render",value:function(){return _react.default.createElement(Location,Object.assign({},this.props))}}]),r}(_react.Component);(exports.default=LocationWrapper).getLocationName=function(e){return getLocationNameList(e)}; |
@@ -1,1 +0,1 @@ | ||
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));require("antd/es/select/style/css");var _select=_interopRequireDefault(require("antd/es/select")),_objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties")),_slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")),_classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")),_createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass")),_possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")),_getPrototypeOf3=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")),_assertThisInitialized2=_interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized")),_inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits")),_defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));require("antd/es/tag/style/css");var _dec,_class,_class2,_temp,_tag=_interopRequireDefault(require("antd/es/tag")),_react=_interopRequireDefault(require("react")),_propTypes=_interopRequireDefault(require("prop-types")),_lodash=require("lodash"),_recompose=require("recompose"),_input=require("../input"),_compose=require("../compose"),boolMap=new Map([["false",!1],["true",!0],[!1,"false"],[!0,"true"]]);function formatBoolValue(e){return boolMap.has(e)?boolMap.get(e):e}var withSelect=(0,_recompose.compose)((0,_recompose.defaultProps)({valueProp:"value",labelProp:"label",style:{},dataSource:[],allowClear:!0,mode:"",onChange:function(){}}),(0,_recompose.withState)("label","setLabel",null),(0,_recompose.withState)("selectRef","setSelectRef",null),(0,_recompose.withPropsOnChange)(["value"],function(e){var t=e.mode,r=e.value,l=e.setLabel,a=e.dataSource,u=e.children;if((0,_lodash.isNil)(r))l(null);else{var i,o=r,n=[];Array.isArray(r)||(o=[o]),o=o.map(formatBoolValue),a&&a.length?n=a:u&&(n=_react.default.Children.map(u,function(e){var t=e.props,r=t.value,l=t.children;return{value:r,label:t.label||l}})),i=o.map(function(t){var e=n.find(function(e){return e.value===t});if(e&&e.label)return e.label}),["multiple","tags"].includes(t)?l(i):l(i[0])}})),Select=(_dec=(0,_recompose.compose)(withSelect,(0,_compose.withEdit)(function(e){var t=e.label,r=e.mode;return t&&t.length?"multiple"===r?t.filter(Boolean).join("、"):"tags"===r?t.filter(Boolean).map(function(e){return _react.default.createElement(_tag.default,{key:e},e)}):t:""}),(0,_recompose.withPropsOnChange)(["value","label"],function(e){var t=e.mode,r=e.value,l=e.label;if((0,_lodash.isNil)(r))return{value:void 0};var a=r;return Array.isArray(r)||(a=[a]),["multiple","tags"].includes(t)?{value:(0,_lodash.zipWith)(a,l,function(e,t){return{key:e,label:t}})}:{value:{key:a[0],label:l}}})))((_temp=_class2=function(e){function a(){var e,f;(0,_classCallCheck2.default)(this,a);for(var t=arguments.length,r=new Array(t),l=0;l<t;l++)r[l]=arguments[l];return f=(0,_possibleConstructorReturn2.default)(this,(e=(0,_getPrototypeOf3.default)(a)).call.apply(e,[this].concat(r))),(0,_defineProperty2.default)((0,_assertThisInitialized2.default)(f),"onSelect",function(){var e=f.props,t=e.onSelect,r=e.selectRef,l=e.mode;t&&"function"==typeof t&&t.apply(void 0,arguments),["multiple","tags"].includes(l)||setTimeout(function(){r.blur()},0)}),(0,_defineProperty2.default)((0,_assertThisInitialized2.default)(f),"onChange",function(e){var t=f.props,r=t.onChange,l=t.setLabel,a=Array.isArray(e),u=a?e:[e],i=["key","label"].map(function(t){return u.map(function(e){return e&&e[t]})}),o=(0,_slicedToArray2.default)(i,2),n=o[0],s=o[1],p=a?n.map(formatBoolValue):formatBoolValue(n[0]),c=a?s:s[0];r(p),l(c)}),(0,_defineProperty2.default)((0,_assertThisInitialized2.default)(f),"renderSelect",function(){var e=f.props,t=e.dataSource,r=void 0===t?[]:t,l=e.style,a=(l.width,(0,_objectWithoutProperties2.default)(l,["width"])),u=e.children,i=e.setSelectRef,o=e.valueProp,n=e.labelProp,s=(0,_objectWithoutProperties2.default)(e,["dataSource","style","children","setSelectRef","valueProp","labelProp"]);return _react.default.createElement(_select.default,(0,_extends2.default)({},s,{ref:i,labelInValue:!0,style:a,onSelect:f.onSelect,onChange:f.onChange,className:"gant-select"}),u||r.map(function(e){var t=String(e[o]);return _react.default.createElement(_select.default.Option,{value:t,key:t},e[n])}))}),f}return(0,_inherits2.default)(a,e),(0,_createClass2.default)(a,[{key:"render",value:function(){var e=this.props,t=e.addonAfter,r=e.style,l=e.className;return _react.default.createElement(_input.Group,{gant:!0,style:r,className:l},this.renderSelect(),t?_react.default.createElement("span",{className:"ant-input-group-addon"},t):null)}}]),a}(_react.default.Component),(0,_defineProperty2.default)(_class2,"properTypes",{mode:_propTypes.default.oneOf(["multiple","tags"])}),_class=_temp))||_class;Select.Option=_select.default.Option;var _default=Select;exports.default=_default; | ||
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));require("antd/es/select/style/css");var _select=_interopRequireDefault(require("antd/es/select")),_objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties")),_slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")),_classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")),_createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass")),_assertThisInitialized2=_interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized")),_possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")),_getPrototypeOf2=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")),_inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits")),_defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));require("antd/es/tag/style/css");var _dec,_class,_class2,_temp,_tag=_interopRequireDefault(require("antd/es/tag")),_react=_interopRequireDefault(require("react")),_propTypes=_interopRequireDefault(require("prop-types")),_lodash=require("lodash"),_recompose=require("recompose"),_input=require("../input"),_compose=require("../compose");function _createSuper(l){return function(){var e,t=(0,_getPrototypeOf2.default)(l);if(_isNativeReflectConstruct()){var r=(0,_getPrototypeOf2.default)(this).constructor;e=Reflect.construct(t,arguments,r)}else e=t.apply(this,arguments);return(0,_possibleConstructorReturn2.default)(this,e)}}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}var boolMap=new Map([["false",!1],["true",!0],[!1,"false"],[!0,"true"]]);function formatBoolValue(e){return boolMap.has(e)?boolMap.get(e):e}var withSelect=(0,_recompose.compose)((0,_recompose.defaultProps)({valueProp:"value",labelProp:"label",style:{},dataSource:[],allowClear:!0,mode:"",onChange:function(){}}),(0,_recompose.withState)("label","setLabel",null),(0,_recompose.withState)("selectRef","setSelectRef",null),(0,_recompose.withPropsOnChange)(["value"],function(e){var t=e.mode,r=e.value,l=e.setLabel,a=e.dataSource,u=e.children;if((0,_lodash.isNil)(r))l(null);else{var o,i=r,n=[];Array.isArray(r)||(i=[i]),i=i.map(formatBoolValue),a&&a.length?n=a:u&&(n=_react.default.Children.map(u,function(e){var t=e.props,r=t.value,l=t.children;return{value:r,label:t.label||l}})),o=i.map(function(t){var e=n.find(function(e){return e.value===t});if(e&&e.label)return e.label}),["multiple","tags"].includes(t)?l(o):l(o[0])}})),Select=(_dec=(0,_recompose.compose)(withSelect,(0,_compose.withEdit)(function(e){var t=e.label,r=e.mode;return t&&t.length?"multiple"===r?t.filter(Boolean).join("、"):"tags"===r?t.filter(Boolean).map(function(e){return _react.default.createElement(_tag.default,{key:e},e)}):t:""}),(0,_recompose.withPropsOnChange)(["value","label"],function(e){var t=e.mode,r=e.value,l=e.label;if((0,_lodash.isNil)(r))return{value:void 0};var a=r;return Array.isArray(r)||(a=[a]),["multiple","tags"].includes(t)?{value:(0,_lodash.zipWith)(a,l,function(e,t){return{key:e,label:t}})}:{value:{key:a[0],label:l}}})))((_temp=_class2=function(e){(0,_inherits2.default)(a,e);var l=_createSuper(a);function a(){var f;(0,_classCallCheck2.default)(this,a);for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return f=l.call.apply(l,[this].concat(t)),(0,_defineProperty2.default)((0,_assertThisInitialized2.default)(f),"onSelect",function(){var e=f.props,t=e.onSelect,r=e.selectRef,l=e.mode;t&&"function"==typeof t&&t.apply(void 0,arguments),["multiple","tags"].includes(l)||setTimeout(function(){r.blur()},0)}),(0,_defineProperty2.default)((0,_assertThisInitialized2.default)(f),"onChange",function(e){var t=f.props,r=t.onChange,l=t.setLabel,a=Array.isArray(e),u=a?e:[e],o=["key","label"].map(function(t){return u.map(function(e){return e&&e[t]})}),i=(0,_slicedToArray2.default)(o,2),n=i[0],s=i[1],c=a?n.map(formatBoolValue):formatBoolValue(n[0]),p=a?s:s[0];r(c),l(p)}),(0,_defineProperty2.default)((0,_assertThisInitialized2.default)(f),"renderSelect",function(){var e=f.props,t=e.dataSource,r=void 0===t?[]:t,l=e.style,a=(l.width,(0,_objectWithoutProperties2.default)(l,["width"])),u=e.children,o=e.setSelectRef,i=e.valueProp,n=e.labelProp,s=(0,_objectWithoutProperties2.default)(e,["dataSource","style","children","setSelectRef","valueProp","labelProp"]);return _react.default.createElement(_select.default,(0,_extends2.default)({},s,{ref:o,labelInValue:!0,style:a,onSelect:f.onSelect,onChange:f.onChange,className:"gant-select"}),u||r.map(function(e){var t=String(e[i]);return _react.default.createElement(_select.default.Option,{value:t,key:t},e[n])}))}),f}return(0,_createClass2.default)(a,[{key:"render",value:function(){var e=this.props,t=e.addonAfter,r=e.style,l=e.className;return _react.default.createElement(_input.Group,{gant:!0,style:r,className:l},this.renderSelect(),t?_react.default.createElement("span",{className:"ant-input-group-addon"},t):null)}}]),a}(_react.default.Component),(0,_defineProperty2.default)(_class2,"properTypes",{mode:_propTypes.default.oneOf(["multiple","tags"])}),_class=_temp))||_class;Select.Option=_select.default.Option;var _default=Select;exports.default=_default; |
import React, { Component } from 'react'; | ||
import { SelectProps, SelectValue as AntSelectValue } from 'antd/lib/select'; | ||
import { WithEditInProps } from '../with-edit'; | ||
import { WidthBasicProps } from '../compose/widthbasic'; | ||
declare type ProtoExtends<T, U> = U & { | ||
@@ -21,2 +21,3 @@ [K in Exclude<keyof T, keyof U>]?: NonNullable<T[K]>; | ||
isFilter: boolean; | ||
hideSelected: boolean; | ||
onSearch: (_: any) => any; | ||
@@ -34,13 +35,13 @@ onSelect: (_: any) => any; | ||
declare type DefaultProps<R> = ProtoExtends<typeof defaultprop, { | ||
query: Query<R>; | ||
dataSource: R[]; | ||
style: React.CSSProperties; | ||
optionLabel: Label; | ||
multiple: boolean; | ||
onSelect: (k: string, item: R) => void; | ||
selectorId: string; | ||
onChange: (key: SelectValue) => void; | ||
query?: Query<R>; | ||
dataSource?: R[]; | ||
style?: React.CSSProperties; | ||
optionLabel?: Label; | ||
multiple?: boolean; | ||
onSelect?: (k: string, item: R) => void; | ||
selectorId?: string; | ||
onChange?: (key: SelectValue) => void; | ||
}>; | ||
declare type BasicSelectorProps<T, R> = ProtoExtends<SelectProps<T>, DefaultProps<R>>; | ||
export declare type SelectorProps<T, R> = ProtoExtends<WithEditInProps<T>, BasicSelectorProps<T, R>>; | ||
export declare type SelectorProps<T, R> = ProtoExtends<WidthBasicProps, BasicSelectorProps<T, R>>; | ||
export default class Selector<T, R> extends Component<SelectorProps<T, R>> { | ||
@@ -47,0 +48,0 @@ render(): JSX.Element; |
@@ -1,1 +0,1 @@ | ||
"use strict";var _interopRequireWildcard=require("@babel/runtime/helpers/interopRequireWildcard"),_interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray")),_classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")),_createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass")),_possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")),_getPrototypeOf2=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")),_assertThisInitialized2=_interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized")),_inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits")),_slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")),_defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));require("antd/es/select/style/css");var _select=_interopRequireDefault(require("antd/es/select")),_react=_interopRequireWildcard(require("react")),_lodash=require("lodash"),_recompose=require("recompose"),_warning=_interopRequireDefault(require("util-g/lib/warning")),_classnames=_interopRequireDefault(require("classnames")),_withEdit=_interopRequireDefault(require("../with-edit")),__rest=function(e,t){var r={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(r[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(a=Object.getOwnPropertySymbols(e);n<a.length;n++)t.indexOf(a[n])<0&&Object.prototype.propertyIsEnumerable.call(e,a[n])&&(r[a[n]]=e[a[n]])}return r},selectorCache=new Map,Option=_select.default.Option,defaultprop={query:null,valueProp:"value",labelProp:"label",style:{},dataSource:[],multiple:!1,allowClear:!0,showSearch:!0,readOnly:!1,useStorage:!0,useCache:!0,optionLabel:null,isFilter:!0,onSearch:function(e){return e},onSelect:function(e){return e},onChange:function(e){return e},onDeselect:function(e){return e},onDropdownVisibleChange:function(e){return e},blurOnSelect:!1},withLocalStorage=(0,_recompose.compose)((0,_recompose.defaultProps)({selectorId:"selector"}),(0,_recompose.withProps)(function(e){var t=e.selectorId;return(0,_warning.default)(t,"请确保selectorId为一个有效字符串"),{reg:new RegExp("^".concat(t,"-(.*)$")),selectorStorageId:"selector:".concat(t)}}),(0,_recompose.withState)("storageList","setStorageList",function(e){var t=e.selectorStorageId;return JSON.parse(localStorage.getItem(t)||"[]")}),(0,_recompose.withHandlers)({forceUpdateStorageList:function(e){var t=e.setStorageList,r=e.storageList,a=e.selectorStorageId;return function(){var e=JSON.parse(localStorage.getItem(a)||"[]");(0,_lodash.isEqual)(r,e)||t(e)}}})),withSelector=(0,_recompose.compose)((0,_recompose.defaultProps)(defaultprop),(0,_recompose.withState)("label","setLabel",null),(0,_recompose.withState)("cacheLabel","setCacheLabel",function(e){return e.optionLabel}),(0,_recompose.withState)("loading","setLoading",!1),(0,_recompose.withState)("filter","setFilter",""),(0,_recompose.withState)("selectRef","setSelectRef",null),(0,_recompose.withState)("dataList","setDataList",function(e){return e.dataSource}),(0,_recompose.withPropsOnChange)(["filter"],function(e){var t=e.filter,r=e.selectorId;return{taskId:"".concat(r,":").concat(escape(t).replace(/\%u/g,""))}}),(0,_recompose.withHandlers)({transformDataToList:function(e){var i=e.labelProp,s=e.valueProp,u=e.renderItem;return function(e){return e.map(function(e){if(u)return u(e,Option);if((0,_lodash.isPlainObject)(e)){var t=e.disabled,r=e.title,a=e.className,n=e[s]||e.value,o=n||e.key,l=e[i];return _react.default.createElement(Option,{key:o,value:n,disabled:t,title:r,className:a},l)}return _react.default.createElement(Option,{key:e,value:e},e)})}},getValue:function(e){var t=e.valueProp;return function(e){return t&&(0,_lodash.isPlainObject)(e)?e[t]:e}},getLabel:function(e){var t=e.labelProp;return function(e){return t&&(0,_lodash.isPlainObject)(e)?e[t]:e}},setLabel:function(e){var t=e.setLabel;return function(e){return t(Array.isArray(e)?e.join("、"):e)}}}),(0,_recompose.withHandlers)({getItemLabel:function(e){var n=e.dataList,o=e.storageList,l=e.selectorId,i=e.getValue,s=e.getLabel,u=e.optionLabel;return function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,r=n;t.startsWith(l)&&(r=o);var a=r.find(function(e){return i(e)===t});return a?s(a):(Array.isArray(u)?u:[u])[e]}}}),(0,_recompose.withPropsOnChange)(["value"],function(e){var a=e.dataList,n=e.storageList,t=e.value,o=e.getValue,l=e.selectorId,r=Array.isArray(t),i=(r?t:[t]).map(function(t){var e=a.find(function(e){return o(e)===t}),r=n.find(function(e){return o(e)===t});return!e&&r?"".concat(l,"-").concat(t):t});return{value:r?i:i[0]}}),(0,_recompose.withHandlers)({setLabelWithValue:function(e){var a=e.value,n=e.setLabel,o=e.multiple,l=e.mode,i=e.setCacheLabel,s=e.getItemLabel;return function(){if((0,_lodash.isNil)(a))n(null);else{var e=a,t=null,r=Array.isArray(a);o||"multiple"===l?r||(e=[a]):r&&(e=a[0]),t=Array.isArray(e)?e.map(function(e,t){return s(e,t)}):s(e),n(t),i(t)}}}}),(0,_recompose.withHandlers)({updateStorage:function(e){var l=e.selectorId,i=e.selectorStorageId,s=e.storageList,u=e.getValue,c=e.valueProp,p=e.setStorageList,f=e.useStorage;return function(t,e){if(f){var r="".concat(l,"-").concat(u(t)),a=e;if(!a){var n=s.some(function(e){return u(e)===r});(a=n)||(c&&(0,_lodash.isPlainObject)(t)?s.push(Object.assign(Object.assign({},t),(0,_defineProperty2.default)({},c,r))):s.push(r),s.slice(-5))}a&&s.map(function(e){return u(e)===r?c&&(0,_lodash.isPlainObject)(t)?Object.assign(Object.assign({},t),(0,_defineProperty2.default)({},c,r)):r:e});var o=(0,_lodash.cloneDeep)(s);p(o),localStorage.setItem(i,JSON.stringify(o))}}},getData:function(e){var t=e.taskId,r=e.useCache,a=e.loading,n=e.setLoading,o=e.query,l=e.filter,i=e.setDataList;return function(){if(o){var e=null;if(r){if(!(e=selectorCache.get(t))){if(a)return;n(!0),e=o(l),selectorCache.set(t,e)}}else e=o(l);e.then&&"function"==typeof e.then||(e=Promise.resolve(e)),e.then(function(e){if(n(!1),!Array.isArray(e))throw new Error("选择器选项列表只能是数组格式");i(e)})}}}}),(0,_recompose.withPropsOnChange)(["dataList","filter","storageList","loading"],function(e){var t=e.dataList,r=e.filter,a=e.storageList,o=e.transformDataToList,n=e.loading,l=e.useStorage,i=e.query,s=e.labelProp,u=e.getLabel,c=e.isFilter,p=t;if(!i&&r&&c)try{p=t.filter(function(a){return~r.split("").reduce(function(e,t){if(-1===e)return-1;var r=u(a);if(!r)throw new Error("应用选择器的过滤功能,请确保列表数据中".concat(s,"属性存在,或修改'labelProp'对应的属性名称,作为过滤的依据"));return r.slice(e).indexOf(t)},0)})}catch(e){}var f=[_react.default.createElement(_select.default.Option,{key:"none",disabled:!0},n?"加载中...":"没有查询到数据")];if(p.length)if(p.some(function(e){return e.group})){var d=p.every(function(e){return e.group}),h=(0,_lodash.groupBy)(p,"group");d||(h["其他选项"]=h[void 0]),f=Object.entries(h).reduce(function(e,t){var r=(0,_slicedToArray2.default)(t,2),a=r[0],n=r[1];return"undefined"!==a&&e.push(_react.default.createElement(_select.default.OptGroup,{key:a,label:a},o(n))),e},[])}else f=o(p);if(l){var _=_react.default.createElement(_select.default.OptGroup,{key:"result",label:"搜索结果"},f);return{renderList:[_react.default.createElement(_select.default.OptGroup,{key:"recent",label:"最近选择"},a.length?o(a):_react.default.createElement(_select.default.Option,{key:"empty",disabled:!0},"没有最近选择"))].concat(_)}}return{renderList:f}}),(0,_recompose.withPropsOnChange)(["query"],function(e){return(0,e.getData)()}),(0,_recompose.withPropsOnChange)(["value","optionLabel","dataList"],function(e){return(0,e.setLabelWithValue)()}),(0,_recompose.withPropsOnChange)(["optionLabel"],function(e){var t=e.optionLabel;return(0,e.setCacheLabel)(t)}),(0,_recompose.withPropsOnChange)(["dataSource"],function(e){var t=e.dataSource;return(0,e.setDataList)(t)}),(0,_recompose.mapProps)(function(e){e.dataSource,e.transformDataToList;return __rest(e,["dataSource","transformDataToList"])})),withChange=(0,_recompose.withPropsOnChange)(["value","cacheLabel"],function(e){var t=e.value,r=e.cacheLabel,a=e.multiple,n=e.mode;if((0,_lodash.isNil)(t))return{value:void 0};var o=t;if(a||"multiple"===n?Array.isArray(t)||(o=[t]):Array.isArray(t)&&(o=t[0]),Array.isArray(o)){return{value:Array.isArray(r)?(0,_lodash.zipWith)(o,r,function(e,t){return{key:e,label:t}}):o.map(function(e){return{key:e,label:""}})}}return{value:{key:o,label:r}}}),BasicSelector=function(e){function t(e){var h;return(0,_classCallCheck2.default)(this,t),(h=(0,_possibleConstructorReturn2.default)(this,(0,_getPrototypeOf2.default)(t).call(this,e))).onSearch=(0,_lodash.debounce)(function(e){var t=h.props,r=t.onSearch,a=t.setFilter,n=t.getData;a(e),n(),r(e)},300),h.onChange=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var a=t[0],n=h.props,o=n.onChange,l=n.setCacheLabel,i=void 0,s=void 0;if(a)if(Array.isArray(a)){var u=new Map;a.forEach(function(e){var t=e.key,r=e.label,a=h.storageToReal(t);u.has(a)?u.delete(a):u.set(a,r)}),u.size&&(i=(0,_toConsumableArray2.default)(u.keys()),s=(0,_toConsumableArray2.default)(u.values()))}else i=h.storageToReal(a.key),s=a.label;l(s),o(i),a||h.onSearch("")},h.onopen=function(e){var t=h.props,r=t.onDropdownVisibleChange,a=t.forceUpdateStorageList;e&&a(),r(e)},h.storageToReal=function(e){var t=h.props,r=t.selectorId,a=t.reg;return e.startsWith(r)?e.replace(a,"$1"):e},h.renderSelect=function(){var e=(0,_assertThisInitialized2.default)(h),t=e.onSearch,r=e.onSelect,a=e.onChange,n=e.onopen,o=h.props,l=o.multiple,i=o.readOnly,s=o.renderList,u=o.loading,c=(o.style,o.addonAfter,o.setSelectRef),p=o.dropdownClassName,f=o.children,d=__rest(o,["multiple","readOnly","renderList","loading","style","addonAfter","setSelectRef","dropdownClassName","children"]);return i&&(d.open=!1,d.showSearch=!1),l&&(d.mode="multiple"),_react.default.createElement(_select.default,Object.assign({loading:u},d,{ref:c,className:"gant-selector",onSearch:t,onSelect:r,onChange:a,onDropdownVisibleChange:n,labelInValue:!0,filterOption:!1,dropdownClassName:(0,_classnames.default)(p,"gant-selector-dropdown")}),f||s)},h.onSelect=h.onSelect.bind((0,_assertThisInitialized2.default)(h)),h.onSearch=h.onSearch.bind((0,_assertThisInitialized2.default)(h)),h}return(0,_inherits2.default)(t,e),(0,_createClass2.default)(t,[{key:"onSelect",value:function(t,e){var r=this.props,a=r.onSelect,n=r.dataList,o=r.storageList,l=r.selectorId,i=r.getValue,s=r.updateStorage,u=r.selectRef,c=r.multiple,p=r.mode,f=r.query,d=r.filter,h=r.setFilter,_=r.blurOnSelect,m=this.storageToReal(t.key),g=n.find(function(e){return i(e)===m}),b=t.key.startsWith(l);if(!b||g)a(m,g),s(g,b);else{var y=o.find(function(e){return i(e)===t.key});a(m,y)}!_||c||["multiple","tags"].includes(p)||setTimeout(function(){u.blur()},0),!f&&d&&h("")}},{key:"render",value:function(){this.props.className;return this.renderSelect()}}]),t}(_react.PureComponent),SelectorComponent=(0,_recompose.compose)(_recompose.toClass,withLocalStorage,withSelector,(0,_withEdit.default)(function(e){return e.label},"gant-selector-dropdown"),withChange)(BasicSelector),Selector=function(e){function t(){return(0,_classCallCheck2.default)(this,t),(0,_possibleConstructorReturn2.default)(this,(0,_getPrototypeOf2.default)(t).apply(this,arguments))}return(0,_inherits2.default)(t,e),(0,_createClass2.default)(t,[{key:"render",value:function(){return _react.default.createElement(SelectorComponent,Object.assign({},this.props))}}]),t}(_react.Component);exports.default=Selector; | ||
"use strict";var _interopRequireWildcard=require("@babel/runtime/helpers/interopRequireWildcard"),_interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray")),_classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")),_createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass")),_assertThisInitialized2=_interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized")),_possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")),_getPrototypeOf2=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")),_inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits")),_slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")),_defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));require("antd/es/select/style/css");var _select=_interopRequireDefault(require("antd/es/select")),_react=_interopRequireWildcard(require("react")),_lodash=require("lodash"),_recompose=require("recompose"),_warning=_interopRequireDefault(require("util-g/lib/warning")),_classnames=_interopRequireDefault(require("classnames")),_withEdit=_interopRequireDefault(require("../with-edit"));function _createSuper(a){return function(){var e,t=(0,_getPrototypeOf2.default)(a);if(_isNativeReflectConstruct()){var r=(0,_getPrototypeOf2.default)(this).constructor;e=Reflect.construct(t,arguments,r)}else e=t.apply(this,arguments);return(0,_possibleConstructorReturn2.default)(this,e)}}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}var __rest=function(e,t){var r={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(r[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(a=Object.getOwnPropertySymbols(e);n<a.length;n++)t.indexOf(a[n])<0&&Object.prototype.propertyIsEnumerable.call(e,a[n])&&(r[a[n]]=e[a[n]])}return r},selectorCache=new Map,Option=_select.default.Option,defaultprop={query:null,valueProp:"value",labelProp:"label",style:{},dataSource:[],multiple:!1,allowClear:!0,showSearch:!0,readOnly:!1,useStorage:!0,useCache:!0,optionLabel:null,isFilter:!0,hideSelected:!1,onSearch:function(e){return e},onSelect:function(e){return e},onChange:function(e){return e},onDeselect:function(e){return e},onDropdownVisibleChange:function(e){return e},blurOnSelect:!1},withLocalStorage=(0,_recompose.compose)((0,_recompose.defaultProps)({selectorId:"selector"}),(0,_recompose.withProps)(function(e){var t=e.selectorId;return(0,_warning.default)(t,"请确保selectorId为一个有效字符串"),{reg:new RegExp("^".concat(t,"-(.*)$")),selectorStorageId:"selector:".concat(t)}}),(0,_recompose.withState)("storageList","setStorageList",function(e){var t=e.selectorStorageId;return JSON.parse(localStorage.getItem(t)||"[]")}),(0,_recompose.withHandlers)({forceUpdateStorageList:function(e){var t=e.setStorageList,r=e.storageList,a=e.selectorStorageId;return function(){var e=JSON.parse(localStorage.getItem(a)||"[]");(0,_lodash.isEqual)(r,e)||t(e)}}})),withSelector=(0,_recompose.compose)((0,_recompose.defaultProps)(defaultprop),(0,_recompose.withState)("label","setLabel",null),(0,_recompose.withState)("cacheLabel","setCacheLabel",function(e){return e.optionLabel}),(0,_recompose.withState)("loading","setLoading",!1),(0,_recompose.withState)("filter","setFilter",""),(0,_recompose.withState)("selectRef","setSelectRef",null),(0,_recompose.withState)("dataList","setDataList",function(e){return e.dataSource}),(0,_recompose.withPropsOnChange)(["filter"],function(e){var t=e.filter,r=e.selectorId;return{taskId:"".concat(r,":").concat(escape(t).replace(/\%u/g,""))}}),(0,_recompose.withHandlers)({storageToReal:function(e){var t=e.selectorId,r=e.reg;return function(e){return e.startsWith(t)?e.replace(r,"$1"):e}},getValue:function(e){var t=e.valueProp;return function(e){return t&&(0,_lodash.isPlainObject)(e)?e[t]:e}},getLabel:function(e){var t=e.labelProp;return function(e){return t&&(0,_lodash.isPlainObject)(e)?e[t]:e}},setLabel:function(e){var t=e.setLabel;return function(e){return t(Array.isArray(e)?e.filter(Boolean).join("、"):e)}}}),(0,_recompose.withHandlers)({getItemLabel:function(e){var n=e.dataList,o=e.storageList,l=e.selectorId,i=e.getValue,s=e.getLabel,u=e.optionLabel;return function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,r=n;t.startsWith(l)&&(r=o);var a=r.find(function(e){return i(e)===t});return a?s(a):(Array.isArray(u)?u:[u])[e]}}}),(0,_recompose.withPropsOnChange)(["multiple","mode"],function(e){var t=e.multiple,r=e.mode;return{isMultiple:t||"multiple"===r||"tags"===r}}),(0,_recompose.withPropsOnChange)(["value"],function(e){var a=e.dataList,n=e.storageList,t=e.value,o=e.getValue,l=e.selectorId,r=e.isMultiple;if((0,_lodash.isNil)(t))return{value:void 0};var i=(Array.isArray(t)?t:[t]).map(function(t){var e=a.find(function(e){return o(e)===t}),r=n.find(function(e){return o(e)===t});return!e&&r?"".concat(l,"-").concat(t):t});return{value:r?i:i[0]}}),(0,_recompose.withHandlers)({transformDataToList:function(e){var u=e.labelProp,c=e.valueProp,f=e.renderItem,p=e.hideSelected,d=e.isMultiple,h=(e.getValue,e.value);return function(e){return e.map(function(e){if(f)return f(e,Option);if((0,_lodash.isPlainObject)(e)){var t,r=e.disabled,a=e.title,n=e.className,o=e[c]||e.value,l=o||e.key,i=e[u],s=!0;return p&&(s=d?h.every(function(e){return e!==o}):h!==o),s||(t={display:"none"}),_react.default.createElement(Option,{key:l,value:o,disabled:r,title:a,style:t,className:n},i)}return _react.default.createElement(Option,{key:e,value:e},e)})}},setLabelWithValue:function(e){var t=e.value,r=e.setLabel,a=e.setCacheLabel,n=e.getItemLabel;return function(){if((0,_lodash.isNil)(t))r(null);else{var e=null;e=Array.isArray(t)?t.map(function(e,t){return e?n(e,t):null}):n(t),r(e),a(e)}}}}),(0,_recompose.withHandlers)({updateStorage:function(e){var l=e.selectorId,i=e.selectorStorageId,s=e.storageList,u=e.getValue,c=e.valueProp,f=e.setStorageList,p=e.useStorage;return function(t,e){if(p){var r="".concat(l,"-").concat(u(t)),a=e;if(!a){var n=s.some(function(e){return u(e)===r});(a=n)||(c&&(0,_lodash.isPlainObject)(t)?s.push(Object.assign(Object.assign({},t),(0,_defineProperty2.default)({},c,r))):s.push(r),s.slice(-5))}a&&s.map(function(e){return u(e)===r?c&&(0,_lodash.isPlainObject)(t)?Object.assign(Object.assign({},t),(0,_defineProperty2.default)({},c,r)):r:e});var o=(0,_lodash.cloneDeep)(s);f(o),localStorage.setItem(i,JSON.stringify(o))}}},getData:function(e){var t=e.taskId,r=e.useCache,a=e.loading,n=e.setLoading,o=e.query,l=e.filter,i=e.setDataList;return function(){if(o){var e=null;if(r){if(!(e=selectorCache.get(t))){if(a)return;n(!0),e=o(l),selectorCache.set(t,e)}}else e=o(l);e.then&&"function"==typeof e.then||(e=Promise.resolve(e)),e.then(function(e){if(n(!1),!Array.isArray(e))throw new Error("选择器选项列表只能是数组格式");i(e)})}}}}),(0,_recompose.withPropsOnChange)(["dataList","filter","storageList","loading"],function(e){var t=e.dataList,r=e.filter,a=e.storageList,o=e.transformDataToList,n=e.loading,l=e.useStorage,i=e.query,s=e.labelProp,u=e.getLabel,c=e.isFilter,f=t;if(!i&&r&&c)try{f=t.filter(function(a){return~r.split("").reduce(function(e,t){if(-1===e)return-1;var r=u(a);if(!r)throw new Error("应用选择器的过滤功能,请确保列表数据中".concat(s,"属性存在,或修改'labelProp'对应的属性名称,作为过滤的依据"));return r.slice(e).indexOf(t)},0)})}catch(e){console.error(e)}var p=[_react.default.createElement(_select.default.Option,{key:"none",disabled:!0},n?"加载中...":"没有查询到数据")];if(f.length)if(f.some(function(e){return e.group})){var d=f.every(function(e){return e.group}),h=(0,_lodash.groupBy)(f,"group");d||(h["其他选项"]=h[void 0]),p=Object.entries(h).reduce(function(e,t){var r=(0,_slicedToArray2.default)(t,2),a=r[0],n=r[1];return"undefined"!==a&&e.push(_react.default.createElement(_select.default.OptGroup,{key:a,label:a},o(n))),e},[])}else p=o(f);if(l){var _=_react.default.createElement(_select.default.OptGroup,{key:"result",label:"搜索结果"},p);return{renderList:[_react.default.createElement(_select.default.OptGroup,{key:"recent",label:"最近选择"},a.length?o(a):_react.default.createElement(_select.default.Option,{key:"empty",disabled:!0},"没有最近选择"))].concat(_)}}return{renderList:p}}),(0,_recompose.withPropsOnChange)(["query"],function(e){return(0,e.getData)()}),(0,_recompose.withPropsOnChange)(["value","optionLabel","dataList"],function(e){return(0,e.setLabelWithValue)()}),(0,_recompose.withPropsOnChange)(["optionLabel"],function(e){var t=e.optionLabel;return(0,e.setCacheLabel)(t)}),(0,_recompose.withPropsOnChange)(["dataSource"],function(e){var t=e.dataSource;return(0,e.setDataList)(t)}),(0,_recompose.mapProps)(function(e){e.dataSource,e.transformDataToList;return __rest(e,["dataSource","transformDataToList"])})),withChange=(0,_recompose.withPropsOnChange)(["value","cacheLabel"],function(e){var t=e.value,r=e.cacheLabel,a=e.isMultiple;if((0,_lodash.isNil)(t))return{value:void 0};if(a){return{value:Array.isArray(r)?(0,_lodash.zipWith)(t,r,function(e,t){return{key:e,label:t}}):t.map(function(e){return{key:e,label:""}})}}return{value:{key:t,label:r}}}),BasicSelector=function(e){(0,_inherits2.default)(r,e);var t=_createSuper(r);function r(e){var h;return(0,_classCallCheck2.default)(this,r),(h=t.call(this,e)).onSearch=(0,_lodash.debounce)(function(e){var t=h.props,r=t.onSearch,a=t.setFilter,n=t.getData;a(e),n(),r(e)},300),h.onChange=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var a=t[0],n=h.props,o=n.onChange,l=n.setCacheLabel,i=n.storageToReal,s=void 0,u=void 0;if(a)if(Array.isArray(a)){var c=new Map;a.forEach(function(e){var t=e.key,r=e.label,a=i(t);c.has(a)?c.delete(a):c.set(a,r)}),c.size&&(s=(0,_toConsumableArray2.default)(c.keys()),u=(0,_toConsumableArray2.default)(c.values()))}else s=i(a.key),u=a.label;l(u),o(s),a||h.onSearch("")},h.onopen=function(e){var t=h.props,r=t.onDropdownVisibleChange,a=t.forceUpdateStorageList;e&&a(),r(e)},h.renderSelect=function(){var e=(0,_assertThisInitialized2.default)(h),t=e.onSearch,r=e.onSelect,a=e.onChange,n=e.onopen,o=h.props,l=o.multiple,i=o.readOnly,s=o.renderList,u=o.loading,c=(o.style,o.addonAfter,o.setSelectRef),f=o.dropdownClassName,p=o.children,d=__rest(o,["multiple","readOnly","renderList","loading","style","addonAfter","setSelectRef","dropdownClassName","children"]);return i&&(d.open=!1,d.showSearch=!1),l&&(d.mode="multiple"),_react.default.createElement(_select.default,Object.assign({loading:u},d,{ref:c,className:"gant-selector",onSearch:t,onSelect:r,onChange:a,onDropdownVisibleChange:n,labelInValue:!0,filterOption:!1,dropdownClassName:(0,_classnames.default)(f,"gant-selector-dropdown")}),p||s)},h.onSelect=h.onSelect.bind((0,_assertThisInitialized2.default)(h)),h.onSearch=h.onSearch.bind((0,_assertThisInitialized2.default)(h)),h}return(0,_createClass2.default)(r,[{key:"onSelect",value:function(t,e){var r=this.props,a=r.onSelect,n=r.dataList,o=r.storageList,l=r.selectorId,i=r.getValue,s=r.updateStorage,u=r.selectRef,c=r.isMultiple,f=r.query,p=r.filter,d=r.setFilter,h=r.blurOnSelect,_=(0,r.storageToReal)(t.key),g=n.find(function(e){return i(e)===_}),m=t.key.startsWith(l);if(!m||g)a(_,g),s(g,m);else{var b=o.find(function(e){return i(e)===t.key});a(_,b)}h&&!c&&setTimeout(function(){u.blur()},0),!f&&p&&d("")}},{key:"render",value:function(){return this.renderSelect()}}]),r}(_react.PureComponent),SelectorComponent=(0,_recompose.compose)(_recompose.toClass,withLocalStorage,withSelector,(0,_withEdit.default)(function(e){return e.label},"gant-selector-dropdown"),withChange)(BasicSelector),Selector=function(e){(0,_inherits2.default)(r,e);var t=_createSuper(r);function r(){return(0,_classCallCheck2.default)(this,r),t.apply(this,arguments)}return(0,_createClass2.default)(r,[{key:"render",value:function(){return _react.default.createElement(SelectorComponent,Object.assign({},this.props))}}]),r}(_react.Component);exports.default=Selector; |
@@ -1,34 +0,4 @@ | ||
import React from 'react'; | ||
import { GetText } from '../compose/renderText'; | ||
import EditStatus from '../edit-status'; | ||
export declare type OnSave = <T>(id: string, value: T, cb: Function) => void; | ||
export interface WithEditProps<T> { | ||
value: T; | ||
allowEdit: boolean; | ||
confirmable: boolean; | ||
onChange: (v: T) => void; | ||
onSave: OnSave; | ||
onCancel: Function; | ||
onConfirm: Function; | ||
onEnter: Function; | ||
edit: EditStatus; | ||
isInner: boolean; | ||
} | ||
export interface WithEditInProps<T> { | ||
value?: T; | ||
allowEdit?: boolean; | ||
confirmable?: boolean; | ||
onChange: (v: T) => void; | ||
onSave?: OnSave; | ||
onCancel?: Function; | ||
edit?: EditStatus; | ||
isInner?: boolean; | ||
} | ||
export interface WithEditOutProps<T> { | ||
value: T; | ||
onChange: (v: T) => any; | ||
addonAfter: React.ReactElement; | ||
} | ||
export declare const widthBasic: (popupClassName?: string) => any; | ||
export { WithEditInProps } from '../compose/widthbasic'; | ||
declare const _default: <T extends any>(getText: GetText<T>, popupClassName?: string) => any; | ||
export default _default; |
@@ -1,1 +0,1 @@ | ||
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.widthBasic=void 0,require("antd/es/icon/style/css");var _icon=_interopRequireDefault(require("antd/es/icon"));require("antd/es/tooltip/style/css");var _tooltip=_interopRequireDefault(require("antd/es/tooltip")),_slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")),_react=_interopRequireDefault(require("react")),_propTypes=_interopRequireDefault(require("prop-types")),_recompose=require("recompose"),_renderText=_interopRequireDefault(require("../compose/renderText")),_inputwrapper=_interopRequireDefault(require("../compose/inputwrapper")),_editwrapper=_interopRequireDefault(require("../compose/editwrapper")),_editStatus=_interopRequireDefault(require("../edit-status")),__rest=function(e,t){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(o=Object.getOwnPropertySymbols(e);a<o.length;a++)t.indexOf(o[a])<0&&Object.prototype.propertyIsEnumerable.call(e,o[a])&&(r[o[a]]=e[o[a]])}return r},defaultComProps={allowEdit:!0,edit:_editStatus.default.CANCEL,confirmable:!0,onChange:function(){},onCancel:function(){},onSave:function(){},onEnter:function(){}},proptypes={allowEdit:_propTypes.default.bool,confirmable:_propTypes.default.bool,edit:_propTypes.default.oneOf([_editStatus.default.EDIT,_editStatus.default.CANCEL,_editStatus.default.SAVE]),style:_propTypes.default.shape({width:_propTypes.default.oneOfType([_propTypes.default.string,_propTypes.default.number])}),onChange:_propTypes.default.func,onCancel:_propTypes.default.func,onSave:_propTypes.default.func,onEnter:_propTypes.default.func},computedEditStatus=function(e,t){return e===_editStatus.default.EDIT||t===_editStatus.default.EDIT},widthBasic=function(e){return(0,_recompose.compose)((0,_inputwrapper.default)(e),(0,_recompose.defaultProps)(defaultComProps),(0,_recompose.setStatic)("propsTypes",proptypes),(0,_recompose.withState)("selfEdit","setEdit",_editStatus.default.CANCEL),(0,_recompose.withState)("cacheValue","setCacheValue",null),(0,_recompose.withHandlers)({computedCache:function(e){var r=e.edit,o=e.selfEdit,a=e.setCacheValue,u=e.value,n=e.cacheValue,i=e.onChange,l=e.onCancel;return function(e,t){computedEditStatus(r,o)?a(u):([[e,r],[t,o]].find(function(e){var t=(0,_slicedToArray2.default)(e,2);return t[0]!==t[1]})[1]===_editStatus.default.CANCEL&&(u!==n&&i(n),l(n)),a(null))}},onConfirm:function(e){var t=e.value,r=e.onSave,o=e.id,a=e.selfEdit,u=e.setEdit,n=e.confirmable;return function(){a&&n&&r(o,t,function(){return u(_editStatus.default.SAVE)})}}}),(0,_recompose.withHandlers)({onEnter:function(e){var t=e.onConfirm,r=e.onEnter;return function(e){"Enter"===e.key&&13===e.keyCode&&t(),r(e)}}}),(0,_recompose.withPropsOnChange)(function(e,t){var r=t.edit,o=t.selfEdit,a=t.computedCache,u=t.setEdit,n=computedEditStatus(e.edit,e.selfEdit)!==computedEditStatus(r,o);return n&&a(e.edit,e.selfEdit),r===_editStatus.default.EDIT&&o===_editStatus.default.EDIT&&u(_editStatus.default.CANCEL),n},function(e){var t=e.edit,r=e.selfEdit;return{computedEdit:computedEditStatus(t,r)}}),(0,_recompose.withProps)(function(e){var t=e.onConfirm,r=e.setEdit,o=e.selfEdit,a=e.addonAfter,u=(e.onChange,_react.default.createElement(_react.default.Fragment,null,a?_react.default.createElement("div",{className:"gant-compose-extra"},a):void 0,_react.default.createElement(_tooltip.default,{title:"确认"},_react.default.createElement(_icon.default,{type:"check",onClick:t,className:"gant-compose-success"})),_react.default.createElement(_tooltip.default,{title:"取消"},_react.default.createElement(_icon.default,{type:"close",onClick:function(){return r(_editStatus.default.CANCEL)},className:"gant-compose-error",style:{marginLeft:8}}))));return{addonAfter:o===_editStatus.default.EDIT&&u||a}}))};exports.widthBasic=widthBasic;var _default=function(e,t){return(0,_recompose.compose)(widthBasic(t),(0,_recompose.branch)(function(e){return!e.computedEdit},function(){return(0,_renderText.default)(e)}),_editwrapper.default,(0,_recompose.mapProps)(function(e){e.edit,e.allowEdit,e.selfEdit,e.setEdit,e.cacheValue,e.setCacheValue,e.computedCache,e.onConfirm,e.computedEdit,e.onCancel,e.onSave,e.confirmable,e.setPopupClassName;return __rest(e,["edit","allowEdit","selfEdit","setEdit","cacheValue","setCacheValue","computedCache","onConfirm","computedEdit","onCancel","onSave","confirmable","setPopupClassName"])}))};exports.default=_default; | ||
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _recompose=require("recompose"),_renderText=_interopRequireDefault(require("../compose/renderText")),_editwrapper=_interopRequireDefault(require("../compose/editwrapper")),_widthbasic=require("../compose/widthbasic"),__rest=function(e,r){var t={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&r.indexOf(o)<0&&(t[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(o=Object.getOwnPropertySymbols(e);i<o.length;i++)r.indexOf(o[i])<0&&Object.prototype.propertyIsEnumerable.call(e,o[i])&&(t[o[i]]=e[o[i]])}return t},_default=function(e,r){return(0,_recompose.compose)((0,_widthbasic.widthBasic)(r),(0,_recompose.branch)(function(e){return!e.computedEdit},function(){return(0,_renderText.default)(e)}),_editwrapper.default,(0,_recompose.mapProps)(function(e){e.allowEdit,e.setEdit,e.computedEdit,e.setPopupClassName,e.setDisabledBlur;return __rest(e,["allowEdit","setEdit","computedEdit","setPopupClassName","setDisabledBlur"])}))};exports.default=_default; |
{ | ||
"name": "data-cell-g", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "gantd data-cell-g", | ||
@@ -64,3 +64,3 @@ "main": "lib/index.js", | ||
}, | ||
"gitHead": "bcc26b021789b924a250693151bb5b46c3d2f29b" | ||
"gitHead": "cebc7fb67471ad11c67cf2a756a90d0cb563cfd4" | ||
} |
@@ -27,3 +27,2 @@ import moment from 'moment' | ||
} | ||
return (d => d)() | ||
@@ -30,0 +29,0 @@ } |
@@ -1,13 +0,6 @@ | ||
type DatePickerShape = { | ||
RangePicker?: any | ||
} | ||
import DatePicker from './DatePicker' | ||
import RangePicker from './RangePicker' | ||
(<DatePickerShape>DatePicker).RangePicker = RangePicker | ||
export default DatePicker | ||
export { | ||
RangePicker | ||
} | ||
import DatePicker from './DatePicker'; | ||
import RangePicker from './RangePicker'; | ||
DatePicker.RangePicker = RangePicker; | ||
export default DatePicker; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
737103
264
22855
43