@kne/react-form-antd 2.1.35 → 2.1.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.css +8 -0
- package/dist/index.css.map +1 -1
- package/dist/index.js +191 -108
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +183 -123
- package/dist/index.modern.js.map +1 -1
- package/package.json +4 -3
package/dist/index.css
CHANGED
package/dist/index.css.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.scss"],"names":[],"mappings":"AAAA;EACE,gBAAgB;EAChB,eAAe,EAAE;EACjB;IACE,WAAW,EAAE;EACf;IACE,eAAe;IACf,kBAAkB;IAClB,iBAAiB,EAAE;EACrB;IACE,kBAAkB;IAClB,iBAAiB,EAAE;EACrB;IACE,mBAAmB,EAAE;EACvB;IACE,sBAAsB,EAAE;EAC1B;IACE,gBAAgB,EAAE;EACpB;IACE,eAAe;IACf,gBAAgB;IAChB,iBAAiB;IACjB,cAAc;IACd,kBAAkB,EAAE;EACtB;IACE,eAAe;IACf,kBAAkB,EAAE;EACtB;IACE,sBAAsB,EAAE;IACxB;MACE,qBAAqB;MACrB,kBAAkB,EAAE;MACpB;QACE,eAAe,EAAE;IACrB;MACE,0BAA0B;MAC1B,eAAe,EAAE;MACjB;QACE,gBAAgB,EAAE;IACtB;MACE,eAAe;MACf,iBAAiB,EAAE;IACrB;MACE,kBAAkB,EAAE;EACxB;IACE,aAAa,EAAE;EACjB;IACE,iBAAiB;IACjB,kBAAkB;IAClB,iBAAiB;IACjB,iBAAiB;IACjB,kBAAkB,EAAE;IACpB;MACE,kBAAkB;MAClB,cAAc;MACd,iBAAiB;MACjB,YAAY;MACZ,iBAAiB;MACjB,4BAA4B,EAAE;EAClC;IACE,kBAAkB;IAClB,OAAO;IACP,kBAAkB,EAAE;EACtB;IACE,eAAe;IACf,cAAc;IACd,iBAAiB,EAAE;EACrB;IACE,mBAAmB;IACnB,8BAA8B,EAAE;IAChC;MACE,qBAAqB,EAAE;MACvB;QACE,4CAA4C,EAAE;MAChD;QACE,qBAAqB,EAAE;QACvB;UACE,4CAA4C,EAAE;MAClD;QACE,qBAAqB,EAAE;MACzB;QACE,gBAAgB,EAAE;MACpB;QACE,4CAA4C,EAAE;MAChD;QACE,qBAAqB,EAAE;MACzB;QACE,4CAA4C,EAAE;IAClD;MACE,cAAc;MACd,eAAe;MACf,kBAAkB;MAClB,qBAAqB;MACrB,OAAO,EAAE;;AAEf;EACE,UAAU,EAAE;;AAEd;EACE,aAAa,EAAE;;AAEjB;EACE,cAAc,EAAE;;AAElB;EACE,WAAW;EACX,YAAY;EACZ,gBAAgB;EAChB,aAAa;EACb,uBAAuB;EACvB,mBAAmB,EAAE;EACrB;IACE,eAAe;IACf,gBAAgB,EAAE;;AAEtB;EACE,0BAA0B;EAC1B,kBAAkB,EAAE;EACpB;IACE,kBAAkB;IAClB,iBAAiB;IACjB,eAAe;IACf,0BAA0B;IAC1B,iBAAiB;IACjB,oBAAoB,EAAE;EACxB;IACE,UAAU,EAAE;;AAEhB;EACE,kBAAkB,EAAE;;AAEtB;EACE,aAAa;EACb,mBAAmB;EACnB,yBAAyB;EACzB,aAAa,EAAE;EACf;IACE,WAAW;IACX,YAAY,EAAE","file":"index.css","sourcesContent":[".react-form, .react-form--large, .react-form--small, .react-form--inner, .react-form--inner--large, .react-form--inner--small, .react-form--inline, .react-form--inline--large, .react-form--inline--small {\n text-align: left;\n font-size: 12px; }\n .react-form .ant-select, .react-form--large .ant-select, .react-form--small .ant-select, .react-form--inner .ant-select, .react-form--inner--large .ant-select, .react-form--inner--small .ant-select, .react-form--inline .ant-select, .react-form--inline--large .ant-select, .react-form--inline--small .ant-select {\n width: 100%; }\n .react-form--large .react-form__field-label {\n font-size: 14px;\n margin-right: 20px;\n line-height: 34px; }\n .react-form--small .react-form__field-label {\n margin-right: 12px;\n line-height: 24px; }\n .react-form--inner .react-form__field, .react-form--inner--large .react-form__field, .react-form--inner--small .react-form__field {\n margin-bottom: 22px; }\n .react-form--inner .react-form__field-main, .react-form--inner--large .react-form__field-main, .react-form--inner--small .react-form__field-main {\n flex-direction: column; }\n .react-form--inner .react-form__field-input, .react-form--inner--large .react-form__field-input, .react-form--inner--small .react-form__field-input {\n align-self: auto; }\n .react-form--inner .react-form__field-label, .react-form--inner--large .react-form__field-label, .react-form--inner--small .react-form__field-label {\n font-size: 14px;\n text-align: left;\n font-weight: bold;\n margin-left: 0;\n margin-bottom: 2px; }\n .react-form--inner--small .react-form__field-label {\n font-size: 12px;\n margin-bottom: 1px; }\n .react-form--inline, .react-form--inline--large, .react-form--inline--small {\n padding: 30px 30px 6px; }\n .react-form--inline .react-form__field, .react-form--inline--large .react-form__field, .react-form--inline--small .react-form__field {\n display: inline-block;\n margin-right: 40px; }\n .react-form--inline .react-form__field:last-child, .react-form--inline--large .react-form__field:last-child, .react-form--inline--small .react-form__field:last-child {\n margin-right: 0; }\n .react-form--inline .react-form__field-label, .react-form--inline--large .react-form__field-label, .react-form--inline--small .react-form__field-label {\n min-width: auto !important;\n padding-left: 0; }\n .react-form--inline .react-form__field-label.is-req:before, .react-form--inline--large .react-form__field-label.is-req:before, .react-form--inline--small .react-form__field-label.is-req:before {\n position: static; }\n .react-form--inline--large .react-form__field-label {\n font-size: 14px;\n line-height: 34px; }\n .react-form--inline--small .react-form__field-label {\n margin-right: 12px; }\n .react-form__field-main {\n display: flex; }\n .react-form__field-label {\n text-align: right;\n margin-right: 16px;\n line-height: 30px;\n margin-left: 10px;\n position: relative; }\n .react-form__field-label.is-req:before {\n position: absolute;\n color: #fc3333;\n font-weight: bold;\n content: '*';\n margin-right: 4px;\n transform: translateX(-10px); }\n .react-form__field-input {\n align-self: center;\n flex: 1;\n position: relative; }\n .react-form__field-describable {\n font-size: 12px;\n color: #999999;\n line-height: 20px; }\n .react-form__field {\n margin-bottom: 24px;\n transition: border-color 300ms; }\n .react-form__field.is-req-error .react-form__field-component, .react-form__field.is-error .react-form__field-component {\n border-color: #fc3333; }\n .react-form__field.is-req-error .react-form__field-component:focus, .react-form__field.is-error .react-form__field-component:focus {\n box-shadow: 0 0 0 2px rgba(252, 51, 51, 0.2); }\n .react-form__field.is-req-error .react-form__field-component .ant-select-selection, .react-form__field.is-req-error .react-form__field-component .ant-input, .react-form__field.is-req-error .react-form__field-component .ant-radio-inner, .react-form__field.is-error .react-form__field-component .ant-select-selection, .react-form__field.is-error .react-form__field-component .ant-input, .react-form__field.is-error .react-form__field-component .ant-radio-inner {\n border-color: #fc3333; }\n .react-form__field.is-req-error .react-form__field-component .ant-select-selection:focus, .react-form__field.is-req-error .react-form__field-component .ant-input:focus, .react-form__field.is-req-error .react-form__field-component .ant-radio-inner:focus, .react-form__field.is-error .react-form__field-component .ant-select-selection:focus, .react-form__field.is-error .react-form__field-component .ant-input:focus, .react-form__field.is-error .react-form__field-component .ant-radio-inner:focus {\n box-shadow: 0 0 0 2px rgba(252, 51, 51, 0.2); }\n .react-form__field.is-req-error .react-form__field-component .ant-upload.ant-upload-select-picture-card, .react-form__field.is-error .react-form__field-component .ant-upload.ant-upload-select-picture-card {\n border-color: #fc3333; }\n .react-form__field.is-req-error .react-form__field-component.ant-input-affix-wrapper .ant-input, .react-form__field.is-error .react-form__field-component.ant-input-affix-wrapper .ant-input {\n box-shadow: none; }\n .react-form__field.is-req-error .react-form__field-component.ant-input-affix-wrapper-focused, .react-form__field.is-error .react-form__field-component.ant-input-affix-wrapper-focused {\n box-shadow: 0 0 0 2px rgba(252, 51, 51, 0.2); }\n .react-form__field.is-req-error .react-form__field-component.ant-select > .ant-select-selector, .react-form__field.is-error .react-form__field-component.ant-select > .ant-select-selector {\n border-color: #fc3333; }\n .react-form__field.is-req-error .react-form__field-component.ant-select.ant-select-focused > .ant-select-selector, .react-form__field.is-error .react-form__field-component.ant-select.ant-select-focused > .ant-select-selector {\n box-shadow: 0 0 0 2px rgba(252, 51, 51, 0.2); }\n .react-form__field-error {\n color: #fc3333;\n font-size: 12px;\n position: absolute;\n top: calc(100% + 1px);\n left: 0; }\n\n.react-form-modal .ant-modal-content > .ant-modal-body {\n padding: 0; }\n\n.react-form-modal .ant-modal-confirm-btns {\n display: none; }\n\n.react-form-modal.ant-modal-confirm .ant-modal-header, .react-form-modal.ant-modal-confirm .ant-modal-close {\n display: block; }\n\n.react-form-avatar .preview {\n width: 85px;\n height: 85px;\n overflow: hidden;\n display: flex;\n justify-content: center;\n align-items: center; }\n .react-form-avatar .preview img {\n max-width: 100%;\n max-height: 100%; }\n\n.data_range_picker {\n color: rgba(0, 0, 0, 0.85);\n position: relative; }\n .data_range_picker .zhijin {\n position: absolute;\n line-height: 31px;\n font-size: 14px;\n color: rgba(0, 0, 0, 0.85);\n margin-left: 12px;\n pointer-events: auto; }\n .data_range_picker .zhijin_show {\n z-index: 9; }\n\n.data_range_picker_dis .ant-picker-input input {\n color: transparent; }\n\n.svg_box {\n display: flex;\n align-items: center;\n color: rgba(0, 0, 0, 0.5);\n margin: 0 4px; }\n .svg_box svg {\n width: 16px;\n height: 16px; }\n"]}
|
|
1
|
+
{"version":3,"sources":["index.scss"],"names":[],"mappings":"AAAA;EACE,gBAAgB;EAChB,eAAe,EAAE;EACjB;IACE,WAAW,EAAE;EACf;IACE,eAAe;IACf,kBAAkB;IAClB,iBAAiB,EAAE;EACrB;IACE,kBAAkB;IAClB,iBAAiB,EAAE;EACrB;IACE,mBAAmB,EAAE;EACvB;IACE,sBAAsB,EAAE;EAC1B;IACE,gBAAgB,EAAE;EACpB;IACE,eAAe;IACf,gBAAgB;IAChB,iBAAiB;IACjB,cAAc;IACd,kBAAkB,EAAE;EACtB;IACE,eAAe;IACf,kBAAkB,EAAE;EACtB;IACE,sBAAsB,EAAE;IACxB;MACE,qBAAqB;MACrB,kBAAkB,EAAE;MACpB;QACE,eAAe,EAAE;IACrB;MACE,0BAA0B;MAC1B,eAAe,EAAE;MACjB;QACE,gBAAgB,EAAE;IACtB;MACE,eAAe;MACf,iBAAiB,EAAE;IACrB;MACE,kBAAkB,EAAE;EACxB;IACE,aAAa,EAAE;EACjB;IACE,iBAAiB;IACjB,kBAAkB;IAClB,iBAAiB;IACjB,iBAAiB;IACjB,kBAAkB,EAAE;IACpB;MACE,kBAAkB;MAClB,cAAc;MACd,iBAAiB;MACjB,YAAY;MACZ,iBAAiB;MACjB,4BAA4B,EAAE;EAClC;IACE,kBAAkB;IAClB,OAAO;IACP,kBAAkB,EAAE;EACtB;IACE,eAAe;IACf,cAAc;IACd,iBAAiB,EAAE;EACrB;IACE,mBAAmB;IACnB,8BAA8B,EAAE;IAChC;MACE,qBAAqB,EAAE;MACvB;QACE,4CAA4C,EAAE;MAChD;QACE,qBAAqB,EAAE;QACvB;UACE,4CAA4C,EAAE;MAClD;QACE,qBAAqB,EAAE;MACzB;QACE,gBAAgB,EAAE;MACpB;QACE,4CAA4C,EAAE;MAChD;QACE,qBAAqB,EAAE;MACzB;QACE,4CAA4C,EAAE;IAClD;MACE,cAAc;MACd,eAAe;MACf,kBAAkB;MAClB,qBAAqB;MACrB,OAAO,EAAE;;AAEf;EACE,UAAU,EAAE;;AAEd;EACE,aAAa,EAAE;;AAEjB;EACE,cAAc,EAAE;;AAElB;EACE,WAAW;EACX,YAAY;EACZ,gBAAgB;EAChB,aAAa;EACb,uBAAuB;EACvB,mBAAmB,EAAE;EACrB;IACE,eAAe;IACf,gBAAgB,EAAE;;AAEtB;EACE,0BAA0B;EAC1B,kBAAkB,EAAE;EACpB;IACE,kBAAkB;IAClB,iBAAiB;IACjB,eAAe;IACf,0BAA0B;IAC1B,iBAAiB;IACjB,oBAAoB,EAAE;EACxB;IACE,UAAU,EAAE;;AAEhB;EACE,kBAAkB,EAAE;;AAEtB;EACE,aAAa;EACb,mBAAmB;EACnB,yBAAyB;EACzB,aAAa,EAAE;EACf;IACE,WAAW;IACX,YAAY,EAAE;;AAElB;EACE,eAAe,EAAE;;AAEnB;EACE,mBAAmB;EACnB,WAAW;EACX,eAAe,EAAE","file":"index.css","sourcesContent":[".react-form, .react-form--large, .react-form--small, .react-form--inner, .react-form--inner--large, .react-form--inner--small, .react-form--inline, .react-form--inline--large, .react-form--inline--small {\n text-align: left;\n font-size: 12px; }\n .react-form .ant-select, .react-form--large .ant-select, .react-form--small .ant-select, .react-form--inner .ant-select, .react-form--inner--large .ant-select, .react-form--inner--small .ant-select, .react-form--inline .ant-select, .react-form--inline--large .ant-select, .react-form--inline--small .ant-select {\n width: 100%; }\n .react-form--large .react-form__field-label {\n font-size: 14px;\n margin-right: 20px;\n line-height: 34px; }\n .react-form--small .react-form__field-label {\n margin-right: 12px;\n line-height: 24px; }\n .react-form--inner .react-form__field, .react-form--inner--large .react-form__field, .react-form--inner--small .react-form__field {\n margin-bottom: 22px; }\n .react-form--inner .react-form__field-main, .react-form--inner--large .react-form__field-main, .react-form--inner--small .react-form__field-main {\n flex-direction: column; }\n .react-form--inner .react-form__field-input, .react-form--inner--large .react-form__field-input, .react-form--inner--small .react-form__field-input {\n align-self: auto; }\n .react-form--inner .react-form__field-label, .react-form--inner--large .react-form__field-label, .react-form--inner--small .react-form__field-label {\n font-size: 14px;\n text-align: left;\n font-weight: bold;\n margin-left: 0;\n margin-bottom: 2px; }\n .react-form--inner--small .react-form__field-label {\n font-size: 12px;\n margin-bottom: 1px; }\n .react-form--inline, .react-form--inline--large, .react-form--inline--small {\n padding: 30px 30px 6px; }\n .react-form--inline .react-form__field, .react-form--inline--large .react-form__field, .react-form--inline--small .react-form__field {\n display: inline-block;\n margin-right: 40px; }\n .react-form--inline .react-form__field:last-child, .react-form--inline--large .react-form__field:last-child, .react-form--inline--small .react-form__field:last-child {\n margin-right: 0; }\n .react-form--inline .react-form__field-label, .react-form--inline--large .react-form__field-label, .react-form--inline--small .react-form__field-label {\n min-width: auto !important;\n padding-left: 0; }\n .react-form--inline .react-form__field-label.is-req:before, .react-form--inline--large .react-form__field-label.is-req:before, .react-form--inline--small .react-form__field-label.is-req:before {\n position: static; }\n .react-form--inline--large .react-form__field-label {\n font-size: 14px;\n line-height: 34px; }\n .react-form--inline--small .react-form__field-label {\n margin-right: 12px; }\n .react-form__field-main {\n display: flex; }\n .react-form__field-label {\n text-align: right;\n margin-right: 16px;\n line-height: 30px;\n margin-left: 10px;\n position: relative; }\n .react-form__field-label.is-req:before {\n position: absolute;\n color: #fc3333;\n font-weight: bold;\n content: '*';\n margin-right: 4px;\n transform: translateX(-10px); }\n .react-form__field-input {\n align-self: center;\n flex: 1;\n position: relative; }\n .react-form__field-describable {\n font-size: 12px;\n color: #999999;\n line-height: 20px; }\n .react-form__field {\n margin-bottom: 24px;\n transition: border-color 300ms; }\n .react-form__field.is-req-error .react-form__field-component, .react-form__field.is-error .react-form__field-component {\n border-color: #fc3333; }\n .react-form__field.is-req-error .react-form__field-component:focus, .react-form__field.is-error .react-form__field-component:focus {\n box-shadow: 0 0 0 2px rgba(252, 51, 51, 0.2); }\n .react-form__field.is-req-error .react-form__field-component .ant-select-selection, .react-form__field.is-req-error .react-form__field-component .ant-input, .react-form__field.is-req-error .react-form__field-component .ant-radio-inner, .react-form__field.is-error .react-form__field-component .ant-select-selection, .react-form__field.is-error .react-form__field-component .ant-input, .react-form__field.is-error .react-form__field-component .ant-radio-inner {\n border-color: #fc3333; }\n .react-form__field.is-req-error .react-form__field-component .ant-select-selection:focus, .react-form__field.is-req-error .react-form__field-component .ant-input:focus, .react-form__field.is-req-error .react-form__field-component .ant-radio-inner:focus, .react-form__field.is-error .react-form__field-component .ant-select-selection:focus, .react-form__field.is-error .react-form__field-component .ant-input:focus, .react-form__field.is-error .react-form__field-component .ant-radio-inner:focus {\n box-shadow: 0 0 0 2px rgba(252, 51, 51, 0.2); }\n .react-form__field.is-req-error .react-form__field-component .ant-upload.ant-upload-select-picture-card, .react-form__field.is-error .react-form__field-component .ant-upload.ant-upload-select-picture-card {\n border-color: #fc3333; }\n .react-form__field.is-req-error .react-form__field-component.ant-input-affix-wrapper .ant-input, .react-form__field.is-error .react-form__field-component.ant-input-affix-wrapper .ant-input {\n box-shadow: none; }\n .react-form__field.is-req-error .react-form__field-component.ant-input-affix-wrapper-focused, .react-form__field.is-error .react-form__field-component.ant-input-affix-wrapper-focused {\n box-shadow: 0 0 0 2px rgba(252, 51, 51, 0.2); }\n .react-form__field.is-req-error .react-form__field-component.ant-select > .ant-select-selector, .react-form__field.is-error .react-form__field-component.ant-select > .ant-select-selector {\n border-color: #fc3333; }\n .react-form__field.is-req-error .react-form__field-component.ant-select.ant-select-focused > .ant-select-selector, .react-form__field.is-error .react-form__field-component.ant-select.ant-select-focused > .ant-select-selector {\n box-shadow: 0 0 0 2px rgba(252, 51, 51, 0.2); }\n .react-form__field-error {\n color: #fc3333;\n font-size: 12px;\n position: absolute;\n top: calc(100% + 1px);\n left: 0; }\n\n.react-form-modal .ant-modal-content > .ant-modal-body {\n padding: 0; }\n\n.react-form-modal .ant-modal-confirm-btns {\n display: none; }\n\n.react-form-modal.ant-modal-confirm .ant-modal-header, .react-form-modal.ant-modal-confirm .ant-modal-close {\n display: block; }\n\n.react-form-avatar .preview {\n width: 85px;\n height: 85px;\n overflow: hidden;\n display: flex;\n justify-content: center;\n align-items: center; }\n .react-form-avatar .preview img {\n max-width: 100%;\n max-height: 100%; }\n\n.data_range_picker {\n color: rgba(0, 0, 0, 0.85);\n position: relative; }\n .data_range_picker .zhijin {\n position: absolute;\n line-height: 31px;\n font-size: 14px;\n color: rgba(0, 0, 0, 0.85);\n margin-left: 12px;\n pointer-events: auto; }\n .data_range_picker .zhijin_show {\n z-index: 9; }\n\n.data_range_picker_dis .ant-picker-input input {\n color: transparent; }\n\n.svg_box {\n display: flex;\n align-items: center;\n color: rgba(0, 0, 0, 0.5);\n margin: 0 4px; }\n .svg_box svg {\n width: 16px;\n height: 16px; }\n\n.react-form-avatar-btn {\n cursor: pointer; }\n\n.react-form-avatar-tips {\n margin-bottom: 14px;\n color: #999;\n font-size: 12px; }\n"]}
|
package/dist/index.js
CHANGED
|
@@ -6,6 +6,7 @@ var reactFormHelper = require('@kne/react-form-helper');
|
|
|
6
6
|
var merge = require('lodash/merge');
|
|
7
7
|
var get = require('lodash/get');
|
|
8
8
|
var antd = require('antd');
|
|
9
|
+
var withLayer = require('@kne/with-layer');
|
|
9
10
|
var icons = require('@ant-design/icons');
|
|
10
11
|
var AvatarEditor = require('react-avatar-editor');
|
|
11
12
|
var omit = require('lodash/omit');
|
|
@@ -18,12 +19,32 @@ var uniqueId = require('lodash/uniqueId');
|
|
|
18
19
|
|
|
19
20
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
20
21
|
|
|
22
|
+
function _interopNamespace(e) {
|
|
23
|
+
if (e && e.__esModule) return e;
|
|
24
|
+
var n = Object.create(null);
|
|
25
|
+
if (e) {
|
|
26
|
+
Object.keys(e).forEach(function (k) {
|
|
27
|
+
if (k !== 'default') {
|
|
28
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
29
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
get: function () { return e[k]; }
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
n["default"] = e;
|
|
37
|
+
return n;
|
|
38
|
+
}
|
|
39
|
+
|
|
21
40
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
41
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
22
42
|
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
23
43
|
var classnames__default = /*#__PURE__*/_interopDefaultLegacy(classnames);
|
|
24
44
|
var ReactForm__default = /*#__PURE__*/_interopDefaultLegacy(ReactForm);
|
|
25
45
|
var merge__default = /*#__PURE__*/_interopDefaultLegacy(merge);
|
|
26
46
|
var get__default = /*#__PURE__*/_interopDefaultLegacy(get);
|
|
47
|
+
var withLayer__default = /*#__PURE__*/_interopDefaultLegacy(withLayer);
|
|
27
48
|
var AvatarEditor__default = /*#__PURE__*/_interopDefaultLegacy(AvatarEditor);
|
|
28
49
|
var omit__default = /*#__PURE__*/_interopDefaultLegacy(omit);
|
|
29
50
|
var moment__default = /*#__PURE__*/_interopDefaultLegacy(moment);
|
|
@@ -33,7 +54,7 @@ var groupBy__default = /*#__PURE__*/_interopDefaultLegacy(groupBy);
|
|
|
33
54
|
var uniqueId__default = /*#__PURE__*/_interopDefaultLegacy(uniqueId);
|
|
34
55
|
|
|
35
56
|
function _extends() {
|
|
36
|
-
_extends = Object.assign
|
|
57
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
37
58
|
for (var i = 1; i < arguments.length; i++) {
|
|
38
59
|
var source = arguments[i];
|
|
39
60
|
|
|
@@ -46,7 +67,6 @@ function _extends() {
|
|
|
46
67
|
|
|
47
68
|
return target;
|
|
48
69
|
};
|
|
49
|
-
|
|
50
70
|
return _extends.apply(this, arguments);
|
|
51
71
|
}
|
|
52
72
|
|
|
@@ -110,7 +130,7 @@ var preset = (function (props) {
|
|
|
110
130
|
ReactForm.preset(globalParams.rules);
|
|
111
131
|
});
|
|
112
132
|
|
|
113
|
-
var _excluded$
|
|
133
|
+
var _excluded$9 = ["className", "cache", "enterSubmit", "scrollToError", "scrollProps", "type", "size", "children"];
|
|
114
134
|
var ScrollToError = reactFormHelper.widget.ScrollToError,
|
|
115
135
|
EnterSubmit = reactFormHelper.widget.EnterSubmit,
|
|
116
136
|
FormStore = reactFormHelper.widget.FormStore,
|
|
@@ -123,7 +143,7 @@ var Form = React.forwardRef(function (originProps, ref) {
|
|
|
123
143
|
scrollToError = originProps.scrollToError,
|
|
124
144
|
scrollProps = originProps.scrollProps,
|
|
125
145
|
children = originProps.children,
|
|
126
|
-
props = _objectWithoutPropertiesLoose(originProps, _excluded$
|
|
146
|
+
props = _objectWithoutPropertiesLoose(originProps, _excluded$9);
|
|
127
147
|
|
|
128
148
|
var baseClass = 'react-form';
|
|
129
149
|
var computedClass = baseClass;
|
|
@@ -182,35 +202,168 @@ Form.propTypes = {
|
|
|
182
202
|
})
|
|
183
203
|
};
|
|
184
204
|
|
|
205
|
+
var RotateIcon = function RotateIcon(props) {
|
|
206
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends({
|
|
207
|
+
width: "1em",
|
|
208
|
+
height: "1em",
|
|
209
|
+
viewBox: "0 0 14 14",
|
|
210
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
211
|
+
xmlnsXlink: "http://www.w3.org/1999/xlink"
|
|
212
|
+
}, props), /*#__PURE__*/React__namespace.createElement("title", null, "\u65CB\u8F6C"), /*#__PURE__*/React__namespace.createElement("g", {
|
|
213
|
+
id: "PC\\u7AEF",
|
|
214
|
+
stroke: "none",
|
|
215
|
+
strokeWidth: 1,
|
|
216
|
+
fill: "none",
|
|
217
|
+
fillRule: "evenodd"
|
|
218
|
+
}, /*#__PURE__*/React__namespace.createElement("g", {
|
|
219
|
+
id: "\\u56FE\\u6807",
|
|
220
|
+
transform: "translate(-77.000000, -1567.000000)",
|
|
221
|
+
fill: "#222222",
|
|
222
|
+
fillRule: "nonzero"
|
|
223
|
+
}, /*#__PURE__*/React__namespace.createElement("g", {
|
|
224
|
+
id: "\\u65CB\\u8F6C",
|
|
225
|
+
transform: "translate(77.000000, 1567.000000)"
|
|
226
|
+
}, /*#__PURE__*/React__namespace.createElement("path", {
|
|
227
|
+
d: "M9.16414904,5.6345426 C9.35110931,5.6345426 9.53041217,5.70881228 9.66261304,5.84101315 C9.79481391,5.97321402 9.86908359,6.15251688 9.86908359,6.33947715 L9.86908359,12.683888 C9.86908359,13.0732126 9.55347364,13.3888226 9.16414904,13.3888226 L0.704934547,13.3888226 C0.315609953,13.3888226 1.8189894e-12,13.0732126 1.8189894e-12,12.683888 L1.8189894e-12,6.33947715 C1.8189894e-12,6.15251688 0.0742696765,5.97321402 0.206470548,5.84101315 C0.33867142,5.70881228 0.517974281,5.6345426 0.704934547,5.6345426 L9.16414904,5.6345426 Z M8.4592145,7.04441168 L1.40986909,7.04441168 L1.40986909,11.9789535 L8.4592145,11.9789535 L8.4592145,7.04441168 Z M7.58258803,0.714885198 C7.63035214,0.738767256 7.66052367,0.787585825 7.66052367,0.840987728 L7.66052367,2.02739256 C11.1625178,2.03011634 14,4.86980822 14,8.37180343 C14,8.62367799 13.8656872,8.85643618 13.6475639,8.98238459 C13.4294405,9.108333 13.1606904,9.108333 12.942567,8.98238459 C12.7244437,8.85643618 12.5900924,8.62367799 12.5901309,8.37180343 C12.5901323,5.64845715 10.3838686,3.43998499 7.66052367,3.43726164 L7.66052367,4.50664733 C7.66052367,4.56004923 7.63035214,4.6088678 7.58258803,4.63274986 C7.53482391,4.65663192 7.47766614,4.65147801 7.43494462,4.61943686 L4.99093655,2.78660706 C4.95543522,2.75998107 4.93454178,2.71819419 4.93454178,2.67381753 C4.93454178,2.62944087 4.95543522,2.58765399 4.99093655,2.561028 L7.43494462,0.728198195 C7.47766614,0.696157053 7.53482391,0.691003139 7.58258803,0.714885198 Z",
|
|
228
|
+
id: "\\u5F62\\u72B6\\u7ED3\\u5408"
|
|
229
|
+
})))));
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
var FullIcon = function FullIcon(props) {
|
|
233
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends({
|
|
234
|
+
width: "1em",
|
|
235
|
+
height: "1em",
|
|
236
|
+
viewBox: "0 0 14 14",
|
|
237
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
238
|
+
xmlnsXlink: "http://www.w3.org/1999/xlink"
|
|
239
|
+
}, props), /*#__PURE__*/React__namespace.createElement("title", null, "\u5145\u6EE1"), /*#__PURE__*/React__namespace.createElement("g", {
|
|
240
|
+
id: "PC\\u7AEF",
|
|
241
|
+
stroke: "none",
|
|
242
|
+
strokeWidth: 1,
|
|
243
|
+
fill: "none",
|
|
244
|
+
fillRule: "evenodd"
|
|
245
|
+
}, /*#__PURE__*/React__namespace.createElement("g", {
|
|
246
|
+
id: "\\u56FE\\u6807",
|
|
247
|
+
transform: "translate(-145.000000, -1567.000000)",
|
|
248
|
+
fill: "#222222",
|
|
249
|
+
fillRule: "nonzero"
|
|
250
|
+
}, /*#__PURE__*/React__namespace.createElement("g", {
|
|
251
|
+
id: "\\u5145\\u6EE1",
|
|
252
|
+
transform: "translate(145.000000, 1567.000000)"
|
|
253
|
+
}, /*#__PURE__*/React__namespace.createElement("path", {
|
|
254
|
+
d: "M12.09375,0 C12.35,0 12.6,0.05 12.8359375,0.15 C13.0640625,0.2453125 13.2671875,0.3828125 13.4421875,0.5578125 C13.6171875,0.7328125 13.7546875,0.9375 13.85,1.1640625 C13.95,1.4 14,1.65 14,1.90625 L14,1.90625 L14,12.09375 C14,12.35 13.95,12.6 13.85,12.8359375 C13.7546875,13.0640625 13.6171875,13.2671875 13.4421875,13.4421875 C13.2671875,13.6171875 13.0625,13.7546875 12.8359375,13.85 C12.6,13.95 12.35,14 12.09375,14 L12.09375,14 L1.90625,14 C1.65,14 1.4,13.95 1.1640625,13.85 C0.9359375,13.7546875 0.7328125,13.6171875 0.5578125,13.4421875 C0.3828125,13.2671875 0.2453125,13.0625 0.15,12.8359375 C0.05,12.6 0,12.35 0,12.09375 L0,12.09375 L0,1.90625 C0,1.65 0.05,1.4 0.15,1.1640625 C0.2453125,0.9359375 0.3828125,0.7328125 0.5578125,0.5578125 C0.7328125,0.3828125 0.9375,0.2453125 1.1640625,0.15 C1.4,0.05 1.65,0 1.90625,0 L1.90625,0 Z M12.09375,1.125 L1.90625,1.125 C1.475,1.125 1.125,1.475 1.125,1.90625 L1.125,1.90625 L1.125,12.09375 C1.125,12.525 1.475,12.875 1.90625,12.875 L1.90625,12.875 L12.09375,12.875 C12.525,12.875 12.875,12.525 12.875,12.09375 L12.875,12.09375 L12.875,1.90625 C12.875,1.475 12.525,1.125 12.09375,1.125 L12.09375,1.125 Z M2.5734375,7.484375 C2.878125,7.490625 3.125,7.740625 3.125,8.046875 L3.125,8.046875 L3.125,10.0640625 L5.1265625,8.0625 C5.3453125,7.84375 5.703125,7.84375 5.921875,8.0625 C6.140625,8.28125 6.140625,8.6390625 5.921875,8.8578125 L5.921875,8.8578125 L3.903125,10.875 L5.909375,10.875 C6.2265625,10.875 6.4890625,11.13125 6.484375,11.4484375 C6.478125,11.7546875 6.228125,12 5.921875,12 L5.921875,12 L2.5734375,12 C2.25625,12 2,11.74375 2,11.4265625 L2,11.4265625 L2,8.0578125 C2,7.740625 2.2578125,7.478125 2.5734375,7.484375 Z M11.4296875,2 C11.7453125,2 12,2.25625 12,2.5703125 L12,2.5703125 L12,5.940625 C12,6.2578125 11.7421875,6.5203125 11.4265625,6.5140625 C11.121875,6.5078125 10.875,6.2578125 10.875,5.9515625 L10.875,5.9515625 L10.875,3.9359375 L8.8734375,5.9375 C8.6546875,6.15625 8.296875,6.15625 8.078125,5.9375 C7.859375,5.71875 7.859375,5.3609375 8.078125,5.1421875 L8.078125,5.1421875 L10.0953125,3.125 L8.0890625,3.125 C7.771875,3.125 7.509375,2.86875 7.515625,2.5515625 C7.521875,2.2453125 7.771875,2 8.078125,2 L8.078125,2 Z",
|
|
255
|
+
id: "\\u5F62\\u72B6\\u7ED3\\u5408"
|
|
256
|
+
})))));
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
var _excluded$8 = ["close", "file", "editor", "onComplete"];
|
|
185
260
|
var useOnChange$d = reactFormHelper.hooks.useOnChange;
|
|
186
261
|
var avatarParams = globalParams.field.avatar;
|
|
262
|
+
var createAvatarEditor = withLayer__default["default"](function (_ref) {
|
|
263
|
+
var close = _ref.close,
|
|
264
|
+
file = _ref.file,
|
|
265
|
+
editor = _ref.editor,
|
|
266
|
+
onComplete = _ref.onComplete,
|
|
267
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$8);
|
|
268
|
+
|
|
269
|
+
var editorRef = React.useRef(null);
|
|
270
|
+
|
|
271
|
+
var _useState = React.useState(0),
|
|
272
|
+
rotate = _useState[0],
|
|
273
|
+
setRotate = _useState[1];
|
|
274
|
+
|
|
275
|
+
var _useState2 = React.useState(function () {
|
|
276
|
+
if (editor.width === editor.height) {
|
|
277
|
+
return 1;
|
|
278
|
+
}
|
|
187
279
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
280
|
+
return 0.35;
|
|
281
|
+
}),
|
|
282
|
+
scale = _useState2[0],
|
|
283
|
+
setScale = _useState2[1];
|
|
284
|
+
|
|
285
|
+
return /*#__PURE__*/React__default["default"].createElement(antd.Modal, _extends({}, props, {
|
|
286
|
+
centered: true,
|
|
287
|
+
onOk: function onOk() {
|
|
288
|
+
onComplete && onComplete(editorRef.current.getImage().toDataURL());
|
|
289
|
+
close();
|
|
290
|
+
}
|
|
291
|
+
}), editor.tips ? /*#__PURE__*/React__default["default"].createElement("div", {
|
|
292
|
+
className: "react-form-avatar-tips"
|
|
293
|
+
}, editor.tips) : null, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
294
|
+
style: {
|
|
295
|
+
"width": editor.width,
|
|
296
|
+
"margin": "auto"
|
|
297
|
+
}
|
|
298
|
+
}, /*#__PURE__*/React__default["default"].createElement(AvatarEditor__default["default"], {
|
|
299
|
+
ref: editorRef,
|
|
300
|
+
image: file,
|
|
301
|
+
width: editor.width,
|
|
302
|
+
height: editor.height,
|
|
303
|
+
border: 1,
|
|
304
|
+
borderRadius: editor.borderRadius,
|
|
305
|
+
color: [24, 144, 255, 1] // RGBA
|
|
306
|
+
,
|
|
307
|
+
scale: scale,
|
|
308
|
+
rotate: rotate
|
|
309
|
+
}), /*#__PURE__*/React__default["default"].createElement(antd.Row, {
|
|
310
|
+
gutter: 4,
|
|
311
|
+
align: "middle"
|
|
312
|
+
}, /*#__PURE__*/React__default["default"].createElement(antd.Col, {
|
|
313
|
+
span: 4
|
|
314
|
+
}, /*#__PURE__*/React__default["default"].createElement(RotateIcon, {
|
|
315
|
+
className: "react-form-avatar-btn",
|
|
316
|
+
onClick: function onClick() {
|
|
317
|
+
setRotate(function (rotate) {
|
|
318
|
+
return rotate + 90;
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
})), /*#__PURE__*/React__default["default"].createElement(antd.Col, {
|
|
322
|
+
span: 4
|
|
323
|
+
}, /*#__PURE__*/React__default["default"].createElement(FullIcon, {
|
|
324
|
+
className: "react-form-avatar-btn",
|
|
325
|
+
onClick: function onClick() {
|
|
326
|
+
setScale(1);
|
|
327
|
+
}
|
|
328
|
+
})), /*#__PURE__*/React__default["default"].createElement(antd.Col, {
|
|
329
|
+
flex: 1
|
|
330
|
+
}, /*#__PURE__*/React__default["default"].createElement(antd.Slider, {
|
|
331
|
+
tooltipVisible: false,
|
|
332
|
+
value: scale,
|
|
333
|
+
step: 0.05,
|
|
334
|
+
min: 0.2,
|
|
335
|
+
max: 3,
|
|
336
|
+
onChange: setScale
|
|
337
|
+
})))));
|
|
338
|
+
});
|
|
339
|
+
|
|
340
|
+
var _Avatar = function _Avatar(_ref2) {
|
|
341
|
+
var className = _ref2.className,
|
|
342
|
+
imageUrl = _ref2.value,
|
|
343
|
+
propsChange = _ref2.onChange,
|
|
344
|
+
onBeforeUpload = _ref2.beforeUpload,
|
|
345
|
+
transformResponse = _ref2.transformResponse,
|
|
346
|
+
action = _ref2.action,
|
|
347
|
+
imageType = _ref2.imageType,
|
|
348
|
+
size = _ref2.fileSize,
|
|
349
|
+
children = _ref2.children,
|
|
350
|
+
extraRender = _ref2.extraRender,
|
|
351
|
+
onError = _ref2.onError,
|
|
352
|
+
openEditor = _ref2.openEditor,
|
|
353
|
+
editorTips = _ref2.editorTips,
|
|
354
|
+
targetEditor = _ref2.editor,
|
|
355
|
+
previewImg = _ref2.previewImg,
|
|
356
|
+
previewRender = _ref2.previewRender;
|
|
357
|
+
|
|
358
|
+
var _useState3 = React.useState(false),
|
|
359
|
+
loading = _useState3[0],
|
|
360
|
+
setLoading = _useState3[1];
|
|
361
|
+
|
|
362
|
+
var _useState4 = React.useState(imageUrl),
|
|
363
|
+
showImageUrl = _useState4[0],
|
|
364
|
+
setImageUrl = _useState4[1];
|
|
365
|
+
|
|
366
|
+
React.useRef();
|
|
214
367
|
var defaultEditor = {
|
|
215
368
|
open: false,
|
|
216
369
|
width: 250,
|
|
@@ -218,10 +371,12 @@ var _Avatar = function _Avatar(_ref) {
|
|
|
218
371
|
borderRadius: 1,
|
|
219
372
|
text: "确定",
|
|
220
373
|
cancelText: '取消',
|
|
221
|
-
title: "裁剪图片"
|
|
374
|
+
title: "裁剪图片",
|
|
375
|
+
tips: null
|
|
222
376
|
};
|
|
223
377
|
var editor = merge__default["default"]({}, defaultEditor, {
|
|
224
|
-
open: openEditor
|
|
378
|
+
open: openEditor,
|
|
379
|
+
tips: editorTips
|
|
225
380
|
}, targetEditor);
|
|
226
381
|
React.useEffect(function () {
|
|
227
382
|
setImageUrl(imageUrl);
|
|
@@ -247,75 +402,6 @@ var _Avatar = function _Avatar(_ref) {
|
|
|
247
402
|
});
|
|
248
403
|
};
|
|
249
404
|
|
|
250
|
-
var AvatarEditorBox = function AvatarEditorBox(_ref2) {
|
|
251
|
-
var file = _ref2.file;
|
|
252
|
-
|
|
253
|
-
var _useState3 = React.useState(0),
|
|
254
|
-
rotate = _useState3[0],
|
|
255
|
-
setRotate = _useState3[1];
|
|
256
|
-
|
|
257
|
-
var _useState4 = React.useState(function () {
|
|
258
|
-
if (editor.width === editor.height) {
|
|
259
|
-
return 1;
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
return 0.35;
|
|
263
|
-
}),
|
|
264
|
-
scale = _useState4[0],
|
|
265
|
-
setScale = _useState4[1];
|
|
266
|
-
|
|
267
|
-
var onChange = function onChange(v) {
|
|
268
|
-
setRotate(v);
|
|
269
|
-
};
|
|
270
|
-
|
|
271
|
-
var onChangeScale = function onChangeScale(v) {
|
|
272
|
-
setScale(v);
|
|
273
|
-
};
|
|
274
|
-
|
|
275
|
-
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
276
|
-
style: {
|
|
277
|
-
"width": editor.width,
|
|
278
|
-
"margin": "auto"
|
|
279
|
-
}
|
|
280
|
-
}, /*#__PURE__*/React__default["default"].createElement(AvatarEditor__default["default"], {
|
|
281
|
-
ref: editorRef,
|
|
282
|
-
image: file,
|
|
283
|
-
width: editor.width,
|
|
284
|
-
height: editor.height,
|
|
285
|
-
border: 1,
|
|
286
|
-
borderRadius: editor.borderRadius,
|
|
287
|
-
color: [24, 144, 255, 1] // RGBA
|
|
288
|
-
,
|
|
289
|
-
scale: scale,
|
|
290
|
-
rotate: rotate
|
|
291
|
-
}), /*#__PURE__*/React__default["default"].createElement(antd.Row, {
|
|
292
|
-
gutter: 4
|
|
293
|
-
}, /*#__PURE__*/React__default["default"].createElement(antd.Col, {
|
|
294
|
-
span: 4
|
|
295
|
-
}, /*#__PURE__*/React__default["default"].createElement("span", null, "\u65CB\u8F6C")), /*#__PURE__*/React__default["default"].createElement(antd.Col, {
|
|
296
|
-
span: 15
|
|
297
|
-
}, /*#__PURE__*/React__default["default"].createElement(antd.Slider, {
|
|
298
|
-
tooltipVisible: false,
|
|
299
|
-
defaultValue: rotate,
|
|
300
|
-
min: -180,
|
|
301
|
-
max: 180,
|
|
302
|
-
onChange: onChange
|
|
303
|
-
}))), /*#__PURE__*/React__default["default"].createElement(antd.Row, {
|
|
304
|
-
gutter: 4
|
|
305
|
-
}, /*#__PURE__*/React__default["default"].createElement(antd.Col, {
|
|
306
|
-
span: 4
|
|
307
|
-
}, /*#__PURE__*/React__default["default"].createElement("span", null, "\u653E\u5927")), /*#__PURE__*/React__default["default"].createElement(antd.Col, {
|
|
308
|
-
span: 15
|
|
309
|
-
}, /*#__PURE__*/React__default["default"].createElement(antd.Slider, {
|
|
310
|
-
tooltipVisible: false,
|
|
311
|
-
defaultValue: scale,
|
|
312
|
-
step: 0.05,
|
|
313
|
-
min: 0.2,
|
|
314
|
-
max: 3,
|
|
315
|
-
onChange: onChangeScale
|
|
316
|
-
}))));
|
|
317
|
-
};
|
|
318
|
-
|
|
319
405
|
var uploadButton = /*#__PURE__*/React__default["default"].createElement("div", null, loading ? /*#__PURE__*/React__default["default"].createElement(icons.LoadingOutlined, null) : /*#__PURE__*/React__default["default"].createElement(icons.PlusOutlined, null), children);
|
|
320
406
|
|
|
321
407
|
var beforeUpload = function beforeUpload(file) {
|
|
@@ -349,17 +435,15 @@ var _Avatar = function _Avatar(_ref) {
|
|
|
349
435
|
|
|
350
436
|
|
|
351
437
|
if (editor.open) {
|
|
352
|
-
|
|
438
|
+
createAvatarEditor({
|
|
439
|
+
editor: editor,
|
|
440
|
+
file: file,
|
|
353
441
|
title: editor.title,
|
|
354
442
|
icon: "",
|
|
355
443
|
width: editor.width * 2,
|
|
356
|
-
content: /*#__PURE__*/React__default["default"].createElement(AvatarEditorBox, {
|
|
357
|
-
file: file
|
|
358
|
-
}),
|
|
359
444
|
cancelText: editor.cancelText,
|
|
360
445
|
okText: editor.text,
|
|
361
|
-
|
|
362
|
-
var base64 = editorRef.current.getImage().toDataURL();
|
|
446
|
+
onComplete: function onComplete(base64) {
|
|
363
447
|
setImageUrl(base64);
|
|
364
448
|
var blob = dataURLtoBlob(base64);
|
|
365
449
|
var files = new window.File([blob], file.name, {
|
|
@@ -367,7 +451,6 @@ var _Avatar = function _Avatar(_ref) {
|
|
|
367
451
|
});
|
|
368
452
|
onBeforeUpload && onBeforeUpload(files);
|
|
369
453
|
resolve(files);
|
|
370
|
-
close();
|
|
371
454
|
}
|
|
372
455
|
});
|
|
373
456
|
} else {
|