gm-printer-label 3.3.6-beta.0 → 3.3.6-beta.2
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/.eslintrc.js +12 -0
- package/.github/workflows/release.yml +46 -0
- package/.prettierrc.js +5 -0
- package/.stylelintrc +3 -0
- package/babel.config.js +7 -0
- package/i18n.config.js +9 -0
- package/locales/en.json +42 -0
- package/locales/index.js +32 -0
- package/locales/th.json +42 -0
- package/locales/zh-HK.json +43 -0
- package/locales/zh.json +1 -0
- package/package.json +15 -11
- package/postcss.config.js +9 -0
- package/src/common/config.js +82 -0
- package/src/common/editor_compoents/component.js +481 -0
- package/src/common/editor_compoents/config_text.js +47 -0
- package/src/common/editor_compoents/context_menu.js +129 -0
- package/src/common/editor_compoents/edit.js +106 -0
- package/src/common/editor_compoents/edit_add_filed.js +54 -0
- package/src/common/editor_compoents/edit_modify_filed.js +199 -0
- package/src/common/editor_compoents/edit_select.js +212 -0
- package/src/common/editor_compoents/edit_title.js +110 -0
- package/src/common/editor_compoents/index.js +10 -0
- package/src/common/editor_compoents/store.js +381 -0
- package/src/common/editor_compoents/style.less +425 -0
- package/src/common/editor_compoents/with_shadow_dom_hoc.js +30 -0
- package/src/common/editor_compoents/with_store_hoc.js +92 -0
- package/src/components/css/animation.less +95 -0
- package/src/components/css/button.less +49 -0
- package/src/components/css/distance.less +324 -0
- package/src/components/css/text.less +74 -0
- package/src/components/css/variables.less +12 -0
- package/src/components/dialog/index.js +72 -0
- package/src/components/dialog/style.less +64 -0
- package/src/components/dropdown/drop_down.js +67 -0
- package/src/components/dropdown/drop_down_item.js +37 -0
- package/src/components/dropdown/drop_down_items.js +22 -0
- package/src/components/dropdown/index.js +9 -0
- package/src/components/dropdown/style.less +51 -0
- package/src/components/flex/index.js +103 -0
- package/src/components/flex/style.less +101 -0
- package/src/components/index.js +15 -0
- package/src/components/index.less +10 -0
- package/src/components/input_number/index.js +158 -0
- package/src/components/input_number/style.less +10 -0
- package/src/components/select/index.js +7 -0
- package/src/components/select/option.js +32 -0
- package/src/components/select/select.js +122 -0
- package/src/components/select/style.less +79 -0
- package/src/components/tip/index.js +48 -0
- package/src/components/tip/style.less +22 -0
- package/src/editor_label/edit_store.js +3 -0
- package/src/editor_label/editor.js +5 -0
- package/src/editor_label/editor_with_shadow_dom.js +4 -0
- package/src/editor_label/index.js +1 -0
- package/src/editor_presorting/edit_store.js +3 -0
- package/src/editor_presorting/editor_with_shadow_dom.js +6 -0
- package/src/editor_presorting/index.js +1 -0
- package/src/index.js +7 -0
- package/src/printer/barcode.js +38 -0
- package/src/printer/batch_printer.js +43 -0
- package/src/printer/block.js +544 -0
- package/src/printer/components/table_type.js +46 -0
- package/src/printer/index.js +111 -0
- package/src/printer/normalize.css +341 -0
- package/src/printer/page.js +26 -0
- package/src/printer/printer.js +71 -0
- package/src/printer/qrcode.js +17 -0
- package/src/printer/style.less +28 -0
- package/src/util.js +87 -0
- package/webpack.config.js +53 -0
- package/lib/main.js +0 -27
- package/lib/package.json +0 -96
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import ReactDOM from 'react-dom'
|
|
3
|
+
import PropTypes from 'prop-types'
|
|
4
|
+
import { SvgInfoCircle } from 'gm-svg'
|
|
5
|
+
import Flex from '../flex'
|
|
6
|
+
import _ from 'lodash'
|
|
7
|
+
|
|
8
|
+
const tips = []
|
|
9
|
+
|
|
10
|
+
const Tip = (props) => {
|
|
11
|
+
const { list } = props
|
|
12
|
+
|
|
13
|
+
return <React.Fragment>
|
|
14
|
+
{_.map(list, (item, index) => {
|
|
15
|
+
return (
|
|
16
|
+
<div key={index} className='gm-animated gm-animated-fade-in-right-100'>
|
|
17
|
+
<Flex alignCenter className='gm-tip'>
|
|
18
|
+
<SvgInfoCircle className='gm-svg-info'/>
|
|
19
|
+
<div style={{ paddingLeft: '10px' }}>
|
|
20
|
+
<div>{item}</div>
|
|
21
|
+
</div>
|
|
22
|
+
</Flex>
|
|
23
|
+
</div>
|
|
24
|
+
)
|
|
25
|
+
})}
|
|
26
|
+
</React.Fragment>
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function getTipDOM (id) {
|
|
30
|
+
return window.shadowRoot.getElementById(id)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
Tip.warning = (message = '') => {
|
|
34
|
+
tips.push(message)
|
|
35
|
+
|
|
36
|
+
setTimeout(() => {
|
|
37
|
+
tips.shift()
|
|
38
|
+
ReactDOM.render(<Tip list={tips}/>, getTipDOM('gm-printer-tip'))
|
|
39
|
+
}, 3000)
|
|
40
|
+
|
|
41
|
+
ReactDOM.render(<Tip list={tips}/>, getTipDOM('gm-printer-tip'))
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
Tip.propTypes = {
|
|
45
|
+
list: PropTypes.array.isRequired
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export default Tip
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
.gm-tip {
|
|
2
|
+
min-width: 250px;
|
|
3
|
+
height: 50px;
|
|
4
|
+
box-shadow: 0 1px 6px rgba(0, 0, 0, 0.2) !important;
|
|
5
|
+
cursor: pointer;
|
|
6
|
+
margin-bottom: 18px;
|
|
7
|
+
background-color: #fff;
|
|
8
|
+
border: 1px solid transparent;
|
|
9
|
+
border-radius: 0;
|
|
10
|
+
padding-left: 20px;
|
|
11
|
+
|
|
12
|
+
.gm-svg-info {
|
|
13
|
+
color: #31708f;
|
|
14
|
+
font-size: 20px;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
@media print {
|
|
19
|
+
.gm-tip {
|
|
20
|
+
display: none;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as PrinterEditShadow } from './editor_with_shadow_dom'
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import withShadowDom from '../common/editor_compoents/with_shadow_dom_hoc'
|
|
2
|
+
import Edit from '../common/editor_compoents/edit'
|
|
3
|
+
import editStore from './edit_store'
|
|
4
|
+
import withStore from '../common/editor_compoents/with_store_hoc'
|
|
5
|
+
|
|
6
|
+
export default withShadowDom(withStore(editStore)(Edit))
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as LabelEditorPreSort } from './editor_with_shadow_dom'
|
package/src/index.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import jsBarcode from 'jsbarcode'
|
|
3
|
+
import PropTypes from 'prop-types'
|
|
4
|
+
|
|
5
|
+
class BarCode extends React.Component {
|
|
6
|
+
barcode = React.createRef()
|
|
7
|
+
|
|
8
|
+
componentDidMount () {
|
|
9
|
+
const { value, ...rest } = this.props
|
|
10
|
+
if (!value) return
|
|
11
|
+
/** jsBarCode的具体options前往:
|
|
12
|
+
* https://blog.csdn.net/shencailing/article/details/122101956
|
|
13
|
+
*/
|
|
14
|
+
jsBarcode(this.barcode.current, value, {
|
|
15
|
+
...rest
|
|
16
|
+
})
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
render () {
|
|
20
|
+
// 可设置条形码的宽高
|
|
21
|
+
const { dataName, value, height = '', svgWidth } = this.props
|
|
22
|
+
if (!value) return null
|
|
23
|
+
return <svg
|
|
24
|
+
data-name={dataName}
|
|
25
|
+
ref={this.barcode}
|
|
26
|
+
style={{
|
|
27
|
+
width: svgWidth, height: height + 'px'
|
|
28
|
+
}}
|
|
29
|
+
/>
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
BarCode.propTypes = {
|
|
34
|
+
value: PropTypes.string,
|
|
35
|
+
dataName: PropTypes.string
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export default BarCode
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import Printer from './printer'
|
|
3
|
+
import _ from 'lodash'
|
|
4
|
+
import PropTypes from 'prop-types'
|
|
5
|
+
|
|
6
|
+
class BatchPrinter extends React.Component {
|
|
7
|
+
constructor (props) {
|
|
8
|
+
super(props)
|
|
9
|
+
this.ready = 0
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
handleReady = () => {
|
|
13
|
+
this.ready++
|
|
14
|
+
if (this.ready === this.props.list.length) {
|
|
15
|
+
this.props.onReady()
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
render () {
|
|
20
|
+
const { list, isStation } = this.props
|
|
21
|
+
return _.map(list, ({ config, data }, i) => (
|
|
22
|
+
<Printer
|
|
23
|
+
key={i}
|
|
24
|
+
data={data}
|
|
25
|
+
config={config}
|
|
26
|
+
onReady={this.handleReady}
|
|
27
|
+
isStation={isStation}
|
|
28
|
+
/>
|
|
29
|
+
))
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
BatchPrinter.propTypes = {
|
|
34
|
+
list: PropTypes.array.isRequired,
|
|
35
|
+
onReady: PropTypes.func,
|
|
36
|
+
isStation: PropTypes.bool
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
BatchPrinter.defaultProps = {
|
|
40
|
+
onReady: _.noop
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export default BatchPrinter
|