gm-printer-label 3.0.15 → 3.0.16-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/.eslintcache
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
[{"/Volumes/gm-project/gm-printer-label/src/index.js":"1","/Volumes/gm-project/gm-printer-label/src/common/editor_compoents/edit_modify_filed.js":"2","/Volumes/gm-project/gm-printer-label/src/common/config.js":"3","/Volumes/gm-project/gm-printer-label/src/common/editor_compoents/store.js":"4","/Volumes/gm-project/gm-printer-label/src/util.js":"5","/Volumes/gm-project/gm-printer-label/src/printer/printer.js":"6","/Volumes/gm-project/gm-printer-label/src/printer/page.js":"7","/Volumes/gm-project/gm-printer-label/src/printer/block.js":"8","/Volumes/gm-project/gm-printer-label/src/common/editor_compoents/edit.js":"9"},{"size":180,"mtime":1658462117054,"results":"
|
|
1
|
+
[{"/Volumes/gm-project/gm-printer-label/src/index.js":"1","/Volumes/gm-project/gm-printer-label/src/common/editor_compoents/edit_modify_filed.js":"2","/Volumes/gm-project/gm-printer-label/src/common/config.js":"3","/Volumes/gm-project/gm-printer-label/src/common/editor_compoents/store.js":"4","/Volumes/gm-project/gm-printer-label/src/util.js":"5","/Volumes/gm-project/gm-printer-label/src/printer/printer.js":"6","/Volumes/gm-project/gm-printer-label/src/printer/page.js":"7","/Volumes/gm-project/gm-printer-label/src/printer/block.js":"8","/Volumes/gm-project/gm-printer-label/src/common/editor_compoents/edit.js":"9","/Volumes/gm-project/gm-printer-label/src/common/editor_compoents/edit_select.js":"10"},{"size":180,"mtime":1658462117054,"results":"11","hashOfConfig":"12"},{"size":4629,"mtime":1658462013375},{"size":1699,"mtime":1658461960259},{"size":7294,"mtime":1661759246118,"results":"13","hashOfConfig":"12"},{"size":1937,"mtime":1661225223156,"results":"14","hashOfConfig":"12"},{"size":1793,"mtime":1661759246118,"results":"15","hashOfConfig":"12"},{"size":411,"mtime":1660567552793},{"size":10456,"mtime":1661225238153},{"size":2928,"mtime":1661759246116},{"size":6103,"mtime":1661767254469},{"filePath":"16","messages":"17","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"17s6x9q",{"filePath":"18","messages":"19","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"20","messages":"21","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"22","messages":"23","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"/Volumes/gm-project/gm-printer-label/src/index.js",[],"/Volumes/gm-project/gm-printer-label/src/common/editor_compoents/store.js",[],"/Volumes/gm-project/gm-printer-label/src/util.js",[],"/Volumes/gm-project/gm-printer-label/src/printer/printer.js",[]]
|
package/package.json
CHANGED
|
@@ -21,7 +21,7 @@ class Edit extends React.Component {
|
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
render() {
|
|
24
|
+
render () {
|
|
25
25
|
const {
|
|
26
26
|
data,
|
|
27
27
|
initDefaultTemp,
|
|
@@ -31,7 +31,7 @@ class Edit extends React.Component {
|
|
|
31
31
|
editStore,
|
|
32
32
|
insertBlocksConfig,
|
|
33
33
|
uploadQiniuImage,
|
|
34
|
-
|
|
34
|
+
showDoublePage
|
|
35
35
|
} = this.props
|
|
36
36
|
return (
|
|
37
37
|
<div className='gm-printer-label-edit'>
|
|
@@ -49,21 +49,22 @@ class Edit extends React.Component {
|
|
|
49
49
|
</Flex>
|
|
50
50
|
|
|
51
51
|
<div className='gm-printer-label-edit-header'>
|
|
52
|
-
<EditTitle onSave={onSave} initDefaultTemp={initDefaultTemp}
|
|
53
|
-
<Gap height='10px'
|
|
52
|
+
<EditTitle onSave={onSave} initDefaultTemp={initDefaultTemp}/>
|
|
53
|
+
<Gap height='10px'/>
|
|
54
54
|
<EditSelect
|
|
55
55
|
insertBlocksConfig={insertBlocksConfig}
|
|
56
56
|
initDefaultTemp={initDefaultTemp}
|
|
57
57
|
defaultTempList={defaultTempList}
|
|
58
58
|
uploadQiniuImage={uploadQiniuImage}
|
|
59
|
+
showDoublePage={showDoublePage}
|
|
59
60
|
/>
|
|
60
|
-
<Gap height='5px'
|
|
61
|
-
<EditModifyFiled
|
|
62
|
-
<Gap height='5px'
|
|
63
|
-
<EditAddFiled data={addFields}
|
|
61
|
+
<Gap height='5px'/>
|
|
62
|
+
<EditModifyFiled/>
|
|
63
|
+
<Gap height='5px'/>
|
|
64
|
+
<EditAddFiled data={addFields}/>
|
|
64
65
|
|
|
65
66
|
{/* 挂载shadow down中的Dialog组件 */}
|
|
66
|
-
<div id='gm-printer-label-modal'
|
|
67
|
+
<div id='gm-printer-label-modal'/>
|
|
67
68
|
</div>
|
|
68
69
|
|
|
69
70
|
<div
|
|
@@ -76,7 +77,6 @@ class Edit extends React.Component {
|
|
|
76
77
|
config={editStore.config}
|
|
77
78
|
data={data}
|
|
78
79
|
onChange={this.handleChange}
|
|
79
|
-
doublePageType={doublePageType}
|
|
80
80
|
/>
|
|
81
81
|
</ContextMenu>
|
|
82
82
|
</div>
|
|
@@ -94,12 +94,11 @@ Edit.propTypes = {
|
|
|
94
94
|
defaultTempList: PropTypes.object,
|
|
95
95
|
addFields: PropTypes.object.isRequired,
|
|
96
96
|
insertBlocksConfig: PropTypes.array.isRequired,
|
|
97
|
-
|
|
98
|
-
doublePageType: PropTypes.bool,
|
|
97
|
+
showDoublePage: PropTypes.bool
|
|
99
98
|
}
|
|
100
99
|
|
|
101
100
|
Edit.deaultProps = {
|
|
102
|
-
onSave: _.noop
|
|
101
|
+
onSave: _.noop
|
|
103
102
|
}
|
|
104
103
|
|
|
105
104
|
export default Edit
|
|
@@ -57,12 +57,17 @@ class EditSelect extends React.Component {
|
|
|
57
57
|
|
|
58
58
|
handleChangeCustomizeSize = (name, value) => {
|
|
59
59
|
const { editStore } = this.props
|
|
60
|
-
|
|
61
60
|
editStore.setCustomizePageSize(name, value)
|
|
62
61
|
}
|
|
63
62
|
|
|
64
63
|
render () {
|
|
65
|
-
const {
|
|
64
|
+
const {
|
|
65
|
+
defaultTempList,
|
|
66
|
+
editStore,
|
|
67
|
+
insertBlocksConfig,
|
|
68
|
+
uploadQiniuImage,
|
|
69
|
+
showDoublePage
|
|
70
|
+
} = this.props
|
|
66
71
|
const {
|
|
67
72
|
tempKey,
|
|
68
73
|
config: { name, page }
|
|
@@ -113,7 +118,9 @@ class EditSelect extends React.Component {
|
|
|
113
118
|
</Option>
|
|
114
119
|
))}
|
|
115
120
|
{/* 格式不同,单独处理 */}
|
|
116
|
-
<Option key='-1' value='-1'>
|
|
121
|
+
<Option key='-1' value='-1'>
|
|
122
|
+
{i18next.t('自定义尺寸')}
|
|
123
|
+
</Option>
|
|
117
124
|
</Select>
|
|
118
125
|
</Flex>
|
|
119
126
|
{page.type === '-1' && (
|
|
@@ -122,27 +129,41 @@ class EditSelect extends React.Component {
|
|
|
122
129
|
<div>{i18next.t('宽度')}:</div>
|
|
123
130
|
<InputNumber
|
|
124
131
|
className='gm-printer-label-edit-input-custom'
|
|
125
|
-
value={
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
132
|
+
value={page.customizeWidth}
|
|
133
|
+
onChange={this.handleChangeCustomizeSize.bind(
|
|
134
|
+
this,
|
|
135
|
+
'customizeWidth'
|
|
136
|
+
)}
|
|
130
137
|
/>
|
|
131
138
|
</Flex>
|
|
132
139
|
<Flex alignCenter className='gm-padding-top-5'>
|
|
133
140
|
<div>{i18next.t('高度')}:</div>
|
|
134
141
|
<InputNumber
|
|
135
142
|
className='gm-printer-label-edit-input-custom'
|
|
136
|
-
value={
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
143
|
+
value={page.customizeHeight}
|
|
144
|
+
onChange={this.handleChangeCustomizeSize.bind(
|
|
145
|
+
this,
|
|
146
|
+
'customizeHeight'
|
|
147
|
+
)}
|
|
141
148
|
/>
|
|
142
149
|
</Flex>
|
|
143
150
|
</Flex>
|
|
144
151
|
)}
|
|
145
|
-
|
|
152
|
+
{showDoublePage && (
|
|
153
|
+
<Flex alignCenter className='gm-padding-top-5'>
|
|
154
|
+
<div>{i18next.t('预览区域放大展示')}:</div>
|
|
155
|
+
<input
|
|
156
|
+
type='checkbox'
|
|
157
|
+
checked={page.doublePage === true}
|
|
158
|
+
onChange={(v) =>
|
|
159
|
+
this.handleChangeCustomizeSize.bind(
|
|
160
|
+
this,
|
|
161
|
+
'doublePage'
|
|
162
|
+
)(v.target.checked)
|
|
163
|
+
}
|
|
164
|
+
/>
|
|
165
|
+
</Flex>
|
|
166
|
+
)}
|
|
146
167
|
<Gap height='10px'/>
|
|
147
168
|
|
|
148
169
|
<Flex alignCenter style={{ flexWrap: 'wrap' }}>
|
|
@@ -184,7 +205,8 @@ EditSelect.propTypes = {
|
|
|
184
205
|
editStore: PropTypes.object,
|
|
185
206
|
initDefaultTemp: PropTypes.string,
|
|
186
207
|
defaultTempList: PropTypes.object,
|
|
187
|
-
insertBlocksConfig: PropTypes.array.isRequired
|
|
208
|
+
insertBlocksConfig: PropTypes.array.isRequired,
|
|
209
|
+
showDoublePage: PropTypes.bool
|
|
188
210
|
}
|
|
189
211
|
|
|
190
212
|
export default EditSelect
|
|
@@ -289,11 +289,11 @@ class EditStore {
|
|
|
289
289
|
getHandledConfig (config) {
|
|
290
290
|
const result = _.cloneDeep(config)
|
|
291
291
|
// 添加自定义尺寸字段
|
|
292
|
-
|
|
293
292
|
result.page = {
|
|
294
293
|
...result.page,
|
|
295
294
|
customizeWidth: result.page.customizeWidth || 100, // 若没有则默认为100
|
|
296
|
-
customizeHeight: result.page.customizeHeight || 100
|
|
295
|
+
customizeHeight: result.page.customizeHeight || 100,
|
|
296
|
+
doublePage: result.page.doublePage || false
|
|
297
297
|
}
|
|
298
298
|
|
|
299
299
|
return result
|
package/src/printer/printer.js
CHANGED
|
@@ -16,10 +16,10 @@ class Printer extends React.Component {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
render () {
|
|
19
|
-
const { config, selected, data, isStation
|
|
20
|
-
const { type, style, customizeWidth, customizeHeight } =
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
const { config, selected, data, isStation } = this.props
|
|
20
|
+
const { type, style, customizeWidth, customizeHeight, doublePage } =
|
|
21
|
+
config.page
|
|
22
|
+
const ratio = doublePage ? 2 : 1
|
|
23
23
|
const width =
|
|
24
24
|
(type === '-1'
|
|
25
25
|
? customizeWidth
|
|
@@ -32,7 +32,6 @@ class Printer extends React.Component {
|
|
|
32
32
|
: +pageTypeMap[type].height.split('mm')[0]) *
|
|
33
33
|
ratio +
|
|
34
34
|
'mm'
|
|
35
|
-
|
|
36
35
|
return (
|
|
37
36
|
<div
|
|
38
37
|
className='gm-printer-label'
|
|
@@ -64,9 +63,7 @@ Printer.propTypes = {
|
|
|
64
63
|
config: PropTypes.object.isRequired,
|
|
65
64
|
data: PropTypes.object.isRequired, // 格式化后的数据
|
|
66
65
|
onReady: PropTypes.func,
|
|
67
|
-
isStation: PropTypes.bool
|
|
68
|
-
/** 放大编辑窗口 */
|
|
69
|
-
doublePageType: PropTypes.bool
|
|
66
|
+
isStation: PropTypes.bool
|
|
70
67
|
}
|
|
71
68
|
|
|
72
69
|
export default Printer
|