gm-printer 10.38.8-beta.2 → 10.38.8
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/build/demo.js +9 -9
- package/package.json +1 -1
- package/src/common/editor_edit_field.js +1 -7
- package/src/common/editor_store.js +4 -66
- package/src/common/hoc_with_store.js +1 -9
- package/src/editor/context_menu.js +0 -1
- package/src/editor/context_menu_config.js +0 -1
- package/src/editor/editor.js +0 -2
- package/src/editor/editor_menu_config.js +0 -2
- package/src/editor_account/context_menu.js +0 -1
- package/src/editor_account/editor.js +0 -2
- package/src/editor_account_statement/context_menu.js +0 -1
- package/src/editor_account_statement/editor.js +0 -2
- package/src/editor_box_label/context_menu.js +0 -1
- package/src/editor_box_label/editor.js +0 -5
- package/src/editor_purchase/context_menu.js +0 -1
- package/src/editor_purchase/editor.js +0 -2
- package/src/editor_salemenus/context_menu.js +0 -1
- package/src/editor_salemenus/editor.js +0 -2
- package/src/editor_settle/context_menu.js +0 -1
- package/src/editor_settle/editor.js +0 -2
- package/src/editor_statement/context_menu.js +0 -1
- package/src/editor_statement/editor.js +0 -2
- package/src/editor_stockin/context_menu.js +0 -1
- package/src/editor_stockin/editor.js +0 -2
- package/src/editor_stockout/context_menu.js +0 -1
- package/src/editor_stockout/editor.js +0 -2
- package/src/examining_report_editor/context_menu.js +0 -1
- package/src/examining_report_editor/editor.js +0 -2
- package/src/examining_report_editor/store.js +2 -2
- package/src/printer/merge_page.js +0 -12
- package/src/printer/page.js +1 -11
- package/src/printer/printer.js +3 -16
- package/src/printer/store.js +0 -9
- package/src/common/editor_page_border.js +0 -84
- package/src/common/page_border.js +0 -102
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import i18next from '../../locales'
|
|
2
|
-
import React from 'react'
|
|
3
|
-
import PropTypes from 'prop-types'
|
|
4
|
-
import { observer, inject } from 'mobx-react'
|
|
5
|
-
import { Gap, Title } from './component'
|
|
6
|
-
import { Flex } from '../components'
|
|
7
|
-
|
|
8
|
-
@inject('editStore')
|
|
9
|
-
@observer
|
|
10
|
-
class EditorPageBorder extends React.Component {
|
|
11
|
-
handleSelect = id => {
|
|
12
|
-
this.props.editStore.setPageBorderId(id)
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
render() {
|
|
16
|
-
const { editStore } = this.props
|
|
17
|
-
const { borderId } = editStore.config.page || {}
|
|
18
|
-
const list = editStore.computedAvailablePageBorders
|
|
19
|
-
|
|
20
|
-
return (
|
|
21
|
-
<div>
|
|
22
|
-
<Title title={i18next.t('编辑边框')} />
|
|
23
|
-
<Gap />
|
|
24
|
-
{!list.length ? (
|
|
25
|
-
<div className='gm-text-desc'>{i18next.t('暂无可用边框')}</div>
|
|
26
|
-
) : (
|
|
27
|
-
<Flex wrap>
|
|
28
|
-
{list.map(item => {
|
|
29
|
-
const active = borderId === item.id
|
|
30
|
-
return (
|
|
31
|
-
<div
|
|
32
|
-
key={item.id}
|
|
33
|
-
onClick={() => this.handleSelect(item.id)}
|
|
34
|
-
style={{
|
|
35
|
-
width: 88,
|
|
36
|
-
margin: '0 8px 8px 0',
|
|
37
|
-
padding: 4,
|
|
38
|
-
cursor: 'pointer',
|
|
39
|
-
border: active ? '2px solid #56a3f2' : '1px solid #eee',
|
|
40
|
-
textAlign: 'center'
|
|
41
|
-
}}
|
|
42
|
-
>
|
|
43
|
-
<img
|
|
44
|
-
src={item.imageUrl}
|
|
45
|
-
alt={item.name}
|
|
46
|
-
style={{
|
|
47
|
-
width: '100%',
|
|
48
|
-
height: 64,
|
|
49
|
-
objectFit: 'contain',
|
|
50
|
-
display: 'block'
|
|
51
|
-
}}
|
|
52
|
-
/>
|
|
53
|
-
<div style={{ marginTop: 4, fontSize: 12 }}>{item.name}</div>
|
|
54
|
-
</div>
|
|
55
|
-
)
|
|
56
|
-
})}
|
|
57
|
-
<div
|
|
58
|
-
onClick={() => this.handleSelect(null)}
|
|
59
|
-
style={{
|
|
60
|
-
width: 88,
|
|
61
|
-
margin: '0 8px 8px 0',
|
|
62
|
-
padding: 4,
|
|
63
|
-
cursor: 'pointer',
|
|
64
|
-
border: !borderId ? '2px solid #56a3f2' : '1px dashed #ccc',
|
|
65
|
-
textAlign: 'center',
|
|
66
|
-
lineHeight: '64px',
|
|
67
|
-
fontSize: 12,
|
|
68
|
-
color: '#999'
|
|
69
|
-
}}
|
|
70
|
-
>
|
|
71
|
-
{i18next.t('无边框')}
|
|
72
|
-
</div>
|
|
73
|
-
</Flex>
|
|
74
|
-
)}
|
|
75
|
-
</div>
|
|
76
|
-
)
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
EditorPageBorder.propTypes = {
|
|
81
|
-
editStore: PropTypes.object
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export default EditorPageBorder
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import _ from 'lodash'
|
|
2
|
-
import { pageTypeMap } from '../config'
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @param {Array<{id:string,name:string,imageUrl:string,pageTypes:string[],gap?:object}>} types
|
|
6
|
-
* @param {string} pageType
|
|
7
|
-
*/
|
|
8
|
-
export function filterPageBorderTypes(types, pageType) {
|
|
9
|
-
if (!types || !types.length || !pageType) return []
|
|
10
|
-
return types.filter(
|
|
11
|
-
item => item && _.includes(item.pageTypes || [], pageType)
|
|
12
|
-
)
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export function findPageBorderType(types, borderId) {
|
|
16
|
-
if (!borderId || !types) return null
|
|
17
|
-
return types.find(item => item && item.id === borderId) || null
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* 当前 borderId 是否仍适用于 pageType;不适用则应清空
|
|
22
|
-
*/
|
|
23
|
-
export function isPageBorderCompatible(types, borderId, pageType) {
|
|
24
|
-
if (!borderId) return true
|
|
25
|
-
return !!filterPageBorderTypes(types, pageType).find(
|
|
26
|
-
item => item.id === borderId
|
|
27
|
-
)
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* 取边框自带边距;无配置则返回 null(表示不覆盖 page.gap)
|
|
32
|
-
*/
|
|
33
|
-
export function getPageBorderGap(types, borderId) {
|
|
34
|
-
const item = findPageBorderType(types, borderId)
|
|
35
|
-
if (!item || !item.gap) return null
|
|
36
|
-
const { paddingTop, paddingRight, paddingBottom, paddingLeft } = item.gap
|
|
37
|
-
if (
|
|
38
|
-
paddingTop == null &&
|
|
39
|
-
paddingRight == null &&
|
|
40
|
-
paddingBottom == null &&
|
|
41
|
-
paddingLeft == null
|
|
42
|
-
) {
|
|
43
|
-
return null
|
|
44
|
-
}
|
|
45
|
-
return {
|
|
46
|
-
paddingTop: paddingTop || '0mm',
|
|
47
|
-
paddingRight: paddingRight || '0mm',
|
|
48
|
-
paddingBottom: paddingBottom || '0mm',
|
|
49
|
-
paddingLeft: paddingLeft || '0mm'
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* 选中边框:有 gap 则用边框 gap,无 gap 则保持 currentGap
|
|
55
|
-
* 清空边框:回退纸张默认 gap
|
|
56
|
-
*/
|
|
57
|
-
export function resolvePageGapForBorder({
|
|
58
|
-
pageBorderTypes,
|
|
59
|
-
borderId,
|
|
60
|
-
pageType,
|
|
61
|
-
currentGap
|
|
62
|
-
}) {
|
|
63
|
-
if (borderId) {
|
|
64
|
-
const borderGap = getPageBorderGap(pageBorderTypes, borderId)
|
|
65
|
-
if (borderGap) return borderGap
|
|
66
|
-
return currentGap ? { ...currentGap } : null
|
|
67
|
-
}
|
|
68
|
-
const defaultGap = pageTypeMap[pageType]?.gap
|
|
69
|
-
if (defaultGap) {
|
|
70
|
-
return { ...defaultGap }
|
|
71
|
-
}
|
|
72
|
-
return currentGap ? { ...currentGap } : null
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* 生成要合并进 .gm-printer-page 的边框背景 style
|
|
77
|
-
* 不满足条件时返回 {}
|
|
78
|
-
*/
|
|
79
|
-
export function getPageBorderBackgroundStyle({
|
|
80
|
-
enablePageBorder,
|
|
81
|
-
borderId,
|
|
82
|
-
pageBorderTypes
|
|
83
|
-
}) {
|
|
84
|
-
if (!enablePageBorder || !borderId) return {}
|
|
85
|
-
const item = findPageBorderType(pageBorderTypes, borderId)
|
|
86
|
-
if (!item || !item.imageUrl) return {}
|
|
87
|
-
return {
|
|
88
|
-
backgroundImage: `url(${item.imageUrl})`,
|
|
89
|
-
backgroundSize: '100% 100%',
|
|
90
|
-
backgroundRepeat: 'no-repeat'
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* pageStyle 在前,边框 background* 覆盖其上
|
|
96
|
-
*/
|
|
97
|
-
export function mergePageStyleWithBorder(pageStyle, borderStyle) {
|
|
98
|
-
return {
|
|
99
|
-
...(pageStyle || {}),
|
|
100
|
-
...(borderStyle || {})
|
|
101
|
-
}
|
|
102
|
-
}
|