gm-printer 10.13.8-alpha.2 → 10.13.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/.eslintcache +1 -1
- package/build/demo.js +54 -0
- package/package.json +1 -1
- package/src/common/component.js +1 -1
- package/src/common/editor_edit_field.js +17 -1
- package/src/common/editor_select.js +4 -5
- package/src/common/editor_special_field.js +1 -1
- package/src/common/editor_store.js +0 -7
- package/src/common/editor_title.js +2 -3
- package/src/common/get_editor_css.js +1 -1
- package/src/common/hoc_with_shadow_dom.js +5 -5
- package/src/common/hoc_with_store.js +25 -64
- package/src/components/tooltip/index.js +1 -1
- package/src/config.js +0 -2
- package/src/editor/context_menu.js +2 -12
- package/src/editor/editor.js +1 -1
- package/src/editor_account/context_menu.js +3 -7
- package/src/editor_account/editor.js +1 -1
- package/src/editor_account_statement/editor.js +1 -1
- package/src/editor_purchase/context_menu.js +0 -5
- package/src/editor_purchase/editor.js +1 -1
- package/src/editor_purchase/editor_special_table.js +1 -8
- package/src/editor_salemenus/context_menu.js +1 -5
- package/src/editor_salemenus/editor.js +1 -1
- package/src/editor_settle/context_menu.js +9 -20
- package/src/editor_settle/editor.js +1 -1
- package/src/editor_statement/context_menu.js +2 -6
- package/src/editor_statement/editor.js +1 -1
- package/src/editor_stockin/context_menu.js +3 -7
- package/src/editor_stockin/editor.js +1 -1
- package/src/editor_stockout/context_menu.js +1 -5
- package/src/editor_stockout/editor.js +1 -1
- package/src/index.js +1 -2
- package/src/printer/barcode.js +0 -6
- package/src/printer/get_css.js +1 -1
- package/src/util.js +6 -5
- package/yarn-error.log +0 -9663
package/package.json
CHANGED
package/src/common/component.js
CHANGED
|
@@ -205,6 +205,12 @@ class EditorField extends React.Component {
|
|
|
205
205
|
(editStore.computedTableSpecialConfig.subtotal &&
|
|
206
206
|
get(subtotal, 'isUpperLowerCaseSeparate')) ||
|
|
207
207
|
false
|
|
208
|
+
// 位置交换
|
|
209
|
+
const subtotalCommutationPlace =
|
|
210
|
+
(editStore.computedTableSpecialConfig.subtotal &&
|
|
211
|
+
get(subtotal, 'isCommutationPlace')) ||
|
|
212
|
+
false
|
|
213
|
+
|
|
208
214
|
return (
|
|
209
215
|
<div>
|
|
210
216
|
<Title title={i18next.t('编辑字段')} />
|
|
@@ -270,7 +276,7 @@ class EditorField extends React.Component {
|
|
|
270
276
|
</Flex>
|
|
271
277
|
|
|
272
278
|
<Flex alignCenter className='gm-padding-top-5 gm-text-desc'>
|
|
273
|
-
{i18next.t('
|
|
279
|
+
{i18next.t('商品排列仅适用于双栏商品设置')}
|
|
274
280
|
</Flex>
|
|
275
281
|
|
|
276
282
|
<Gap height='5px' />
|
|
@@ -370,6 +376,16 @@ class EditorField extends React.Component {
|
|
|
370
376
|
onChange={this.handleSubtotalStyleChange}
|
|
371
377
|
/>
|
|
372
378
|
</Flex>
|
|
379
|
+
{/* <Flex style={{ margin: '5px 0 5px 62px' }}>
|
|
380
|
+
<Flex alignCenter>
|
|
381
|
+
<input
|
|
382
|
+
type='checkbox'
|
|
383
|
+
checked={subtotalCommutationPlace}
|
|
384
|
+
onChange={editStore.setSubtotalCommutationPlace}
|
|
385
|
+
/>
|
|
386
|
+
</Flex>
|
|
387
|
+
<Flex> {i18next.t('合计、每页合计交换位置')}</Flex>
|
|
388
|
+
</Flex> */}
|
|
373
389
|
<EditorSubtotalCheck
|
|
374
390
|
subtotalCheckDisabled
|
|
375
391
|
subtotalChecked={subtotalNeedUpperCase}
|
|
@@ -126,7 +126,7 @@ class EditorSelector extends React.Component {
|
|
|
126
126
|
</Flex>
|
|
127
127
|
|
|
128
128
|
{this.props.isPurchase && (
|
|
129
|
-
|
|
129
|
+
<React.Fragment>
|
|
130
130
|
<Flex alignCenter className='gm-padding-top-5'>
|
|
131
131
|
<div>{i18next.t('批量打印设置')}:</div>
|
|
132
132
|
<Select
|
|
@@ -146,7 +146,7 @@ class EditorSelector extends React.Component {
|
|
|
146
146
|
连续打印(一张采购单可能出现多个供应商)
|
|
147
147
|
</p>
|
|
148
148
|
</div>
|
|
149
|
-
|
|
149
|
+
</React.Fragment>
|
|
150
150
|
)}
|
|
151
151
|
|
|
152
152
|
<Flex alignCenter className='gm-padding-top-5 gm-text-red'>
|
|
@@ -158,10 +158,9 @@ class EditorSelector extends React.Component {
|
|
|
158
158
|
}
|
|
159
159
|
|
|
160
160
|
EditorSelector.propTypes = {
|
|
161
|
-
isPurchase: PropTypes.bool
|
|
162
|
-
editStore: PropTypes.object
|
|
161
|
+
isPurchase: PropTypes.bool
|
|
163
162
|
}
|
|
164
|
-
EditorSelector.
|
|
163
|
+
EditorSelector.deaultProps = {
|
|
165
164
|
isPurchase: false
|
|
166
165
|
}
|
|
167
166
|
|
|
@@ -33,7 +33,7 @@ class SpecialField extends React.Component {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
SpecialField.propTypes = {
|
|
36
|
-
fields: PropTypes.object,
|
|
36
|
+
fields: PropTypes.object.isRequired,
|
|
37
37
|
handleAddField: PropTypes.func,
|
|
38
38
|
addFields: PropTypes.object.isRequired,
|
|
39
39
|
editStore: PropTypes.object,
|
|
@@ -427,14 +427,7 @@ class EditorStore {
|
|
|
427
427
|
newDataKey = _.concat(keyArr, key)
|
|
428
428
|
}
|
|
429
429
|
|
|
430
|
-
if (newDataKey.includes('multi') && key === 'multi3') {
|
|
431
|
-
newDataKey = _.without(newDataKey, 'multi')
|
|
432
|
-
} else if (newDataKey.includes('multi3') && key === 'multi') {
|
|
433
|
-
newDataKey = _.without(newDataKey, 'multi3')
|
|
434
|
-
}
|
|
435
|
-
|
|
436
430
|
newDataKey = _.sortBy(newDataKey, [
|
|
437
|
-
o => o === 'multi3',
|
|
438
431
|
o => o === 'multi',
|
|
439
432
|
o => o === 'category',
|
|
440
433
|
o => o === 'orders'
|
|
@@ -126,10 +126,9 @@ class EditorTitle extends React.Component {
|
|
|
126
126
|
|
|
127
127
|
EditorTitle.propTypes = {
|
|
128
128
|
onSave: PropTypes.func.isRequired,
|
|
129
|
-
isPurchase: PropTypes.bool
|
|
130
|
-
editStore: PropTypes.object
|
|
129
|
+
isPurchase: PropTypes.bool
|
|
131
130
|
}
|
|
132
|
-
EditorTitle.
|
|
131
|
+
EditorTitle.deaultProps = {
|
|
133
132
|
isPurchase: false
|
|
134
133
|
}
|
|
135
134
|
|
|
@@ -8,21 +8,21 @@ const withShadowDom = WrapCom => {
|
|
|
8
8
|
return class extends React.Component {
|
|
9
9
|
ref = React.createRef()
|
|
10
10
|
|
|
11
|
-
componentDidMount() {
|
|
11
|
+
componentDidMount () {
|
|
12
12
|
const shadowRoot = this.ref.current.attachShadow({ mode: 'open' })
|
|
13
13
|
// 在window下挂 shadow root
|
|
14
14
|
window.shadowRoot = shadowRoot
|
|
15
|
-
ReactDOM.render(<WrapCom {...this.props}
|
|
15
|
+
ReactDOM.render(<WrapCom {...this.props}/>, shadowRoot)
|
|
16
16
|
insertCSS(getPrinterCSS() + getEditorCSS(), shadowRoot)
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
componentWillUnmount() {
|
|
19
|
+
componentWillUnmount () {
|
|
20
20
|
// 移除示例,不然很多意想不到的事情发生
|
|
21
21
|
ReactDOM.unmountComponentAtNode(window.shadowRoot)
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
render() {
|
|
25
|
-
return <div id='shadowroot' ref={this.ref}
|
|
24
|
+
render () {
|
|
25
|
+
return <div id='shadowroot' ref={this.ref}/>
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
}
|
|
@@ -4,65 +4,29 @@ import { getStyleWithDiff } from '../util'
|
|
|
4
4
|
|
|
5
5
|
const withStore = store => WrapComponent =>
|
|
6
6
|
class extends React.Component {
|
|
7
|
-
constructor(props) {
|
|
7
|
+
constructor (props) {
|
|
8
8
|
super(props)
|
|
9
9
|
this.store = store
|
|
10
10
|
this.store.init(props.config)
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
componentDidMount() {
|
|
14
|
-
window.document.addEventListener(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
)
|
|
18
|
-
window.document.addEventListener(
|
|
19
|
-
|
|
20
|
-
this.handleSelectedRegion
|
|
21
|
-
)
|
|
22
|
-
window.document.addEventListener(
|
|
23
|
-
'gm-printer-panel-style-set',
|
|
24
|
-
this.handlePrinterPanelStyleSet
|
|
25
|
-
)
|
|
26
|
-
window.document.addEventListener(
|
|
27
|
-
'gm-printer-block-style-set',
|
|
28
|
-
this.handlePrinterBlockStyleSet
|
|
29
|
-
)
|
|
30
|
-
window.document.addEventListener(
|
|
31
|
-
'gm-printer-block-text-set',
|
|
32
|
-
this.handlePrinterBlockTextSet
|
|
33
|
-
)
|
|
34
|
-
window.document.addEventListener(
|
|
35
|
-
'gm-printer-table-drag',
|
|
36
|
-
this.handlePrinterTableDrag
|
|
37
|
-
)
|
|
13
|
+
componentDidMount () {
|
|
14
|
+
window.document.addEventListener('gm-printer-select', this.handlePrinterSelect)
|
|
15
|
+
window.document.addEventListener('gm-printer-select-region', this.handleSelectedRegion)
|
|
16
|
+
window.document.addEventListener('gm-printer-panel-style-set', this.handlePrinterPanelStyleSet)
|
|
17
|
+
window.document.addEventListener('gm-printer-block-style-set', this.handlePrinterBlockStyleSet)
|
|
18
|
+
window.document.addEventListener('gm-printer-block-text-set', this.handlePrinterBlockTextSet)
|
|
19
|
+
window.document.addEventListener('gm-printer-table-drag', this.handlePrinterTableDrag)
|
|
38
20
|
window.document.addEventListener('keydown', this.handleKeyDown)
|
|
39
21
|
}
|
|
40
22
|
|
|
41
|
-
componentWillUnmount() {
|
|
42
|
-
window.document.removeEventListener(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
)
|
|
46
|
-
window.document.removeEventListener(
|
|
47
|
-
|
|
48
|
-
this.handleSelectedRegion
|
|
49
|
-
)
|
|
50
|
-
window.document.removeEventListener(
|
|
51
|
-
'gm-printer-panel-style-set',
|
|
52
|
-
this.handlePrinterPanelStyleSet
|
|
53
|
-
)
|
|
54
|
-
window.document.removeEventListener(
|
|
55
|
-
'gm-printer-block-style-set',
|
|
56
|
-
this.handlePrinterBlockStyleSet
|
|
57
|
-
)
|
|
58
|
-
window.document.removeEventListener(
|
|
59
|
-
'gm-printer-block-text-set',
|
|
60
|
-
this.handlePrinterBlockTextSet
|
|
61
|
-
)
|
|
62
|
-
window.document.removeEventListener(
|
|
63
|
-
'gm-printer-table-drag',
|
|
64
|
-
this.handlePrinterTableDrag
|
|
65
|
-
)
|
|
23
|
+
componentWillUnmount () {
|
|
24
|
+
window.document.removeEventListener('gm-printer-select', this.handlePrinterSelect)
|
|
25
|
+
window.document.removeEventListener('gm-printer-select-region', this.handleSelectedRegion)
|
|
26
|
+
window.document.removeEventListener('gm-printer-panel-style-set', this.handlePrinterPanelStyleSet)
|
|
27
|
+
window.document.removeEventListener('gm-printer-block-style-set', this.handlePrinterBlockStyleSet)
|
|
28
|
+
window.document.removeEventListener('gm-printer-block-text-set', this.handlePrinterBlockTextSet)
|
|
29
|
+
window.document.removeEventListener('gm-printer-table-drag', this.handlePrinterTableDrag)
|
|
66
30
|
window.document.removeEventListener('keydown', this.handleKeyDown)
|
|
67
31
|
}
|
|
68
32
|
|
|
@@ -71,31 +35,31 @@ const withStore = store => WrapComponent =>
|
|
|
71
35
|
this.store.setSelectedRegion(selected)
|
|
72
36
|
}
|
|
73
37
|
|
|
74
|
-
handlePrinterSelect = e => {
|
|
38
|
+
handlePrinterSelect = (e) => {
|
|
75
39
|
const { selected } = e.detail
|
|
76
40
|
this.store.setSelected(selected)
|
|
77
41
|
}
|
|
78
42
|
|
|
79
|
-
handlePrinterPanelStyleSet = e => {
|
|
43
|
+
handlePrinterPanelStyleSet = (e) => {
|
|
80
44
|
const { name, style } = e.detail
|
|
81
45
|
this.store.setConfigPanelStyle(name, style)
|
|
82
46
|
}
|
|
83
47
|
|
|
84
|
-
handlePrinterBlockStyleSet = e => {
|
|
48
|
+
handlePrinterBlockStyleSet = (e) => {
|
|
85
49
|
const { style } = e.detail
|
|
86
50
|
this.store.setConfigBlockBy('style', style)
|
|
87
51
|
}
|
|
88
52
|
|
|
89
|
-
handlePrinterBlockTextSet = e => {
|
|
53
|
+
handlePrinterBlockTextSet = (e) => {
|
|
90
54
|
const { text } = e.detail
|
|
91
55
|
this.store.setConfigBlockBy('text', text)
|
|
92
56
|
}
|
|
93
57
|
|
|
94
|
-
handlePrinterTableDrag = e => {
|
|
58
|
+
handlePrinterTableDrag = (e) => {
|
|
95
59
|
this.store.exchangeTableColumn(e.detail.target, e.detail.source)
|
|
96
60
|
}
|
|
97
61
|
|
|
98
|
-
handleKeyDown = e => {
|
|
62
|
+
handleKeyDown = (e) => {
|
|
99
63
|
if (e.target !== window.document.body) {
|
|
100
64
|
return
|
|
101
65
|
}
|
|
@@ -117,11 +81,7 @@ const withStore = store => WrapComponent =>
|
|
|
117
81
|
diffY += 1
|
|
118
82
|
}
|
|
119
83
|
|
|
120
|
-
const newStyle = getStyleWithDiff(
|
|
121
|
-
this.store.computedSelectedInfo.style,
|
|
122
|
-
diffX,
|
|
123
|
-
diffY
|
|
124
|
-
)
|
|
84
|
+
const newStyle = getStyleWithDiff(this.store.computedSelectedInfo.style, diffX, diffY)
|
|
125
85
|
|
|
126
86
|
this.store.setConfigBlockBy('style', newStyle)
|
|
127
87
|
} else if (this.store.computedIsSelectTable) {
|
|
@@ -140,12 +100,13 @@ const withStore = store => WrapComponent =>
|
|
|
140
100
|
}
|
|
141
101
|
}
|
|
142
102
|
|
|
143
|
-
render() {
|
|
103
|
+
render () {
|
|
144
104
|
return (
|
|
145
105
|
<Provider editStore={this.store} mockData={this.props.mockData}>
|
|
146
|
-
<WrapComponent {...this.props}
|
|
106
|
+
<WrapComponent {...this.props}/>
|
|
147
107
|
</Provider>
|
|
148
108
|
)
|
|
149
109
|
}
|
|
150
110
|
}
|
|
111
|
+
|
|
151
112
|
export default withStore
|
package/src/config.js
CHANGED
|
@@ -4,7 +4,7 @@ import CommonContextMenu from '../common/common_context_menu'
|
|
|
4
4
|
import { inject, observer } from 'mobx-react'
|
|
5
5
|
import _ from 'lodash'
|
|
6
6
|
import { Printer } from '../printer'
|
|
7
|
-
import
|
|
7
|
+
import { noSubtotalBtnTableDataKeySet } from './editor'
|
|
8
8
|
|
|
9
9
|
const blockTypeList = [
|
|
10
10
|
{ value: '', text: i18next.t('插入文本') },
|
|
@@ -62,7 +62,6 @@ class ContextMenu extends React.Component {
|
|
|
62
62
|
const keyArr = dataKey.split('_')
|
|
63
63
|
|
|
64
64
|
const isMultiActive = keyArr.includes('multi')
|
|
65
|
-
const isThreeActive = keyArr.includes('multi3')
|
|
66
65
|
const isCategoryActive = keyArr.includes('category')
|
|
67
66
|
const isSubtotalActive = subtotal.show
|
|
68
67
|
|
|
@@ -74,12 +73,6 @@ class ContextMenu extends React.Component {
|
|
|
74
73
|
>
|
|
75
74
|
{i18next.t('双栏商品')}
|
|
76
75
|
</div>
|
|
77
|
-
<div
|
|
78
|
-
onClick={this.handleChangeTableDataKey.bind(this, 'multi3', name)}
|
|
79
|
-
className={isThreeActive ? 'active' : ''}
|
|
80
|
-
>
|
|
81
|
-
{i18next.t('三栏商品')}
|
|
82
|
-
</div>
|
|
83
76
|
<div
|
|
84
77
|
onClick={this.handleChangeTableDataKey.bind(this, 'category', name)}
|
|
85
78
|
className={isCategoryActive ? 'active' : ''}
|
|
@@ -114,8 +107,5 @@ class ContextMenu extends React.Component {
|
|
|
114
107
|
)
|
|
115
108
|
}
|
|
116
109
|
}
|
|
117
|
-
|
|
118
|
-
editStore: PropTypes.object,
|
|
119
|
-
mockData: PropTypes.object
|
|
120
|
-
}
|
|
110
|
+
|
|
121
111
|
export default ContextMenu
|
package/src/editor/editor.js
CHANGED
|
@@ -4,7 +4,6 @@ import CommonContextMenu from '../common/common_context_menu'
|
|
|
4
4
|
import { inject, observer } from 'mobx-react'
|
|
5
5
|
import _ from 'lodash'
|
|
6
6
|
import { Printer } from '../printer'
|
|
7
|
-
import PropTypes from 'prop-types'
|
|
8
7
|
|
|
9
8
|
const blockTypeList = [
|
|
10
9
|
{ value: '', text: i18next.t('插入文本') },
|
|
@@ -51,8 +50,8 @@ class ContextMenu extends React.Component {
|
|
|
51
50
|
}
|
|
52
51
|
|
|
53
52
|
const arr = name.split('.')
|
|
54
|
-
const { subtotal } = this.props.editStore.config.contents[arr[2]]
|
|
55
|
-
|
|
53
|
+
const { dataKey, subtotal } = this.props.editStore.config.contents[arr[2]]
|
|
54
|
+
const keyArr = dataKey.split('_')
|
|
56
55
|
|
|
57
56
|
// const isMultiActive = keyArr.includes('multi')
|
|
58
57
|
// const isCategoryActive = keyArr.includes('category')
|
|
@@ -100,8 +99,5 @@ class ContextMenu extends React.Component {
|
|
|
100
99
|
)
|
|
101
100
|
}
|
|
102
101
|
}
|
|
103
|
-
|
|
104
|
-
editStore: PropTypes.object,
|
|
105
|
-
mockData: PropTypes.object
|
|
106
|
-
}
|
|
102
|
+
|
|
107
103
|
export default ContextMenu
|
|
@@ -3,7 +3,6 @@ import React from 'react'
|
|
|
3
3
|
import CommonContextMenu from '../common/common_context_menu'
|
|
4
4
|
import { inject, observer } from 'mobx-react'
|
|
5
5
|
import { Printer } from '../printer'
|
|
6
|
-
import PropTypes from 'prop-types'
|
|
7
6
|
import _ from 'lodash'
|
|
8
7
|
|
|
9
8
|
const blockTypeList = [
|
|
@@ -85,8 +84,4 @@ class ContextMenu extends React.Component {
|
|
|
85
84
|
}
|
|
86
85
|
}
|
|
87
86
|
|
|
88
|
-
ContextMenu.propTypes = {
|
|
89
|
-
editStore: PropTypes.object,
|
|
90
|
-
mockData: PropTypes.object
|
|
91
|
-
}
|
|
92
87
|
export default ContextMenu
|
|
@@ -119,12 +119,6 @@ class TableDetailEditor extends React.Component {
|
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
-
TableDetailEditor.propTypes = {
|
|
123
|
-
addFields: PropTypes.object.isRequired,
|
|
124
|
-
editStore: PropTypes.object,
|
|
125
|
-
config: PropTypes.object
|
|
126
|
-
}
|
|
127
|
-
|
|
128
122
|
@inject('editStore')
|
|
129
123
|
@observer
|
|
130
124
|
class EditorSpecialTable extends React.Component {
|
|
@@ -150,8 +144,7 @@ class EditorSpecialTable extends React.Component {
|
|
|
150
144
|
}
|
|
151
145
|
|
|
152
146
|
EditorSpecialTable.propTypes = {
|
|
153
|
-
addFields: PropTypes.object.isRequired
|
|
154
|
-
editStore: PropTypes.object
|
|
147
|
+
addFields: PropTypes.object.isRequired
|
|
155
148
|
}
|
|
156
149
|
|
|
157
150
|
export default EditorSpecialTable
|
|
@@ -4,7 +4,6 @@ import _ from 'lodash'
|
|
|
4
4
|
import CommonContextMenu from '../common/common_context_menu'
|
|
5
5
|
import { inject, observer } from 'mobx-react'
|
|
6
6
|
import { Printer } from '../printer'
|
|
7
|
-
import PropTypes from 'prop-types'
|
|
8
7
|
import { hasSubtotalBtnTableDataKeySet } from './editor'
|
|
9
8
|
|
|
10
9
|
const blockTypeList = [
|
|
@@ -102,8 +101,5 @@ class ContextMenu extends React.Component {
|
|
|
102
101
|
)
|
|
103
102
|
}
|
|
104
103
|
}
|
|
105
|
-
|
|
106
|
-
editStore: PropTypes.object,
|
|
107
|
-
mockData: PropTypes.object
|
|
108
|
-
}
|
|
104
|
+
|
|
109
105
|
export default ContextMenu
|
|
@@ -4,7 +4,6 @@ import CommonContextMenu from '../common/common_context_menu'
|
|
|
4
4
|
import { inject, observer } from 'mobx-react'
|
|
5
5
|
import { Printer } from '../printer'
|
|
6
6
|
import _ from 'lodash'
|
|
7
|
-
import PropTypes from 'prop-types'
|
|
8
7
|
|
|
9
8
|
const blockTypeList = [
|
|
10
9
|
{ value: '', text: i18next.t('插入文本') },
|
|
@@ -18,13 +17,13 @@ const blockTypeList = [
|
|
|
18
17
|
}))
|
|
19
18
|
@observer
|
|
20
19
|
class ContextMenu extends React.Component {
|
|
21
|
-
handleSubtotal = name => {
|
|
20
|
+
handleSubtotal = (name) => {
|
|
22
21
|
const { editStore } = this.props
|
|
23
22
|
|
|
24
23
|
editStore.setSubtotalShow(name)
|
|
25
24
|
}
|
|
26
25
|
|
|
27
|
-
hasSubtotalBtn = name => {
|
|
26
|
+
hasSubtotalBtn = (name) => {
|
|
28
27
|
if (!name) return false
|
|
29
28
|
|
|
30
29
|
const arr = name.split('.')
|
|
@@ -35,7 +34,7 @@ class ContextMenu extends React.Component {
|
|
|
35
34
|
}
|
|
36
35
|
}
|
|
37
36
|
|
|
38
|
-
renderOrderActionBtn = name => {
|
|
37
|
+
renderOrderActionBtn = (name) => {
|
|
39
38
|
if (!this.hasSubtotalBtn(name)) {
|
|
40
39
|
return null
|
|
41
40
|
}
|
|
@@ -46,24 +45,18 @@ class ContextMenu extends React.Component {
|
|
|
46
45
|
const isSubtotalActive = subtotal.show
|
|
47
46
|
|
|
48
47
|
return (
|
|
49
|
-
|
|
50
|
-
<div
|
|
51
|
-
|
|
52
|
-
className={isSubtotalActive ? 'active' : ''}
|
|
53
|
-
>
|
|
54
|
-
{i18next.t('每页合计')}
|
|
48
|
+
<React.Fragment>
|
|
49
|
+
<div onClick={this.handleSubtotal.bind(this, name)}
|
|
50
|
+
className={isSubtotalActive ? 'active' : ''}>{i18next.t('每页合计')}
|
|
55
51
|
</div>
|
|
56
|
-
|
|
52
|
+
</React.Fragment>
|
|
57
53
|
)
|
|
58
54
|
}
|
|
59
55
|
|
|
60
|
-
render() {
|
|
56
|
+
render () {
|
|
61
57
|
const { editStore, mockData } = this.props
|
|
62
58
|
return (
|
|
63
|
-
<CommonContextMenu
|
|
64
|
-
renderTableAction={this.renderOrderActionBtn}
|
|
65
|
-
insertBlockList={blockTypeList}
|
|
66
|
-
>
|
|
59
|
+
<CommonContextMenu renderTableAction={this.renderOrderActionBtn} insertBlockList={blockTypeList}>
|
|
67
60
|
<Printer
|
|
68
61
|
key={editStore.computedPrinterKey}
|
|
69
62
|
selected={editStore.selected}
|
|
@@ -76,8 +69,4 @@ class ContextMenu extends React.Component {
|
|
|
76
69
|
}
|
|
77
70
|
}
|
|
78
71
|
|
|
79
|
-
ContextMenu.propTypes = {
|
|
80
|
-
editStore: PropTypes.object,
|
|
81
|
-
mockData: PropTypes.object
|
|
82
|
-
}
|
|
83
72
|
export default ContextMenu
|
|
@@ -3,7 +3,6 @@ import React from 'react'
|
|
|
3
3
|
import CommonContextMenu from '../common/common_context_menu'
|
|
4
4
|
import { inject, observer } from 'mobx-react'
|
|
5
5
|
import { Printer } from '../printer'
|
|
6
|
-
import PropTypes from 'prop-types'
|
|
7
6
|
|
|
8
7
|
const blockTypeList = [
|
|
9
8
|
{ value: '', text: i18next.t('插入文本') },
|
|
@@ -17,7 +16,7 @@ const blockTypeList = [
|
|
|
17
16
|
}))
|
|
18
17
|
@observer
|
|
19
18
|
class ContextMenu extends React.Component {
|
|
20
|
-
render() {
|
|
19
|
+
render () {
|
|
21
20
|
const { editStore, mockData } = this.props
|
|
22
21
|
return (
|
|
23
22
|
<CommonContextMenu insertBlockList={blockTypeList}>
|
|
@@ -32,8 +31,5 @@ class ContextMenu extends React.Component {
|
|
|
32
31
|
)
|
|
33
32
|
}
|
|
34
33
|
}
|
|
35
|
-
|
|
36
|
-
editStore: PropTypes.object,
|
|
37
|
-
mockData: PropTypes.object
|
|
38
|
-
}
|
|
34
|
+
|
|
39
35
|
export default ContextMenu
|
|
@@ -3,7 +3,6 @@ import React from 'react'
|
|
|
3
3
|
import CommonContextMenu from '../common/common_context_menu'
|
|
4
4
|
import { inject, observer } from 'mobx-react'
|
|
5
5
|
import { Printer } from '../printer'
|
|
6
|
-
import PropTypes from 'prop-types'
|
|
7
6
|
|
|
8
7
|
const blockTypeList = [
|
|
9
8
|
{ value: '', text: i18next.t('插入文本') },
|
|
@@ -33,7 +32,7 @@ class ContextMenu extends React.Component {
|
|
|
33
32
|
const isMultiActive = keyArr.includes('multi')
|
|
34
33
|
|
|
35
34
|
return (
|
|
36
|
-
|
|
35
|
+
<React.Fragment>
|
|
37
36
|
<div
|
|
38
37
|
onClick={this.handleChangeTableDataKey.bind(this, 'multi', name)}
|
|
39
38
|
className={isMultiActive ? 'active' : ''}
|
|
@@ -52,7 +51,7 @@ class ContextMenu extends React.Component {
|
|
|
52
51
|
>
|
|
53
52
|
{i18next.t('入库金额小计')}
|
|
54
53
|
</div>
|
|
55
|
-
|
|
54
|
+
</React.Fragment>
|
|
56
55
|
)
|
|
57
56
|
}
|
|
58
57
|
|
|
@@ -74,8 +73,5 @@ class ContextMenu extends React.Component {
|
|
|
74
73
|
)
|
|
75
74
|
}
|
|
76
75
|
}
|
|
77
|
-
|
|
78
|
-
editStore: PropTypes.object,
|
|
79
|
-
mockData: PropTypes.object
|
|
80
|
-
}
|
|
76
|
+
|
|
81
77
|
export default ContextMenu
|