gm-printer 10.13.7 → 10.13.8-alpha.0

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
- [{"/Users/yancheng/gm/gm-open-source/gm-printer/src/printer/table.js":"1","/Users/yancheng/gm/gm-open-source/gm-printer/src/printer/store.js":"2","/Users/yancheng/gm/gm-open-source/gm-printer/src/editor/editor.js":"3","/Users/yancheng/gm/gm-open-source/gm-printer/src/editor/context_menu.js":"4","/Users/yancheng/gm/gm-open-source/gm-printer/src/components/tooltip/index.js":"5","/Users/yancheng/gm/gm-open-source/gm-printer/src/common/common_context_menu.js":"6","/Users/yancheng/gm/gm-open-source/gm-printer/src/util.js":"7","/Users/yancheng/gm/gm-open-source/gm-printer/src/printer/printer.js":"8","/Users/yancheng/gm/gm-open-source/gm-printer/src/printer/do_print.js":"9","/Users/yancheng/gm/gm-open-source/gm-printer/src/common/editor_special_field.js":"10","/Users/yancheng/gm/gm-open-source/gm-printer/src/common/hoc_with_store.js":"11","/Users/yancheng/gm/gm-open-source/gm-printer/src/common/hoc_with_shadow_dom.js":"12","/Users/yancheng/gm/gm-open-source/gm-printer/src/common/editor_title.js":"13","/Users/yancheng/gm/gm-open-source/gm-printer/src/common/editor_store.js":"14","/Users/yancheng/gm/gm-open-source/gm-printer/src/common/editor_add_field.js":"15","/Users/yancheng/gm/gm-open-source/gm-printer/src/common/editor_page_summary.js":"16","/Users/yancheng/gm/gm-open-source/gm-printer/src/editor_account/editor.js":"17","/Users/yancheng/gm/gm-open-source/gm-printer/src/editor_account/context_menu.js":"18"},{"size":9238,"mtime":1637656903443,"results":"19","hashOfConfig":"20"},{"size":12882,"mtime":1638178010006,"results":"21","hashOfConfig":"20"},{"size":4244,"mtime":1635494969691,"results":"22","hashOfConfig":"20"},{"size":3683,"mtime":1635851060224,"results":"23","hashOfConfig":"20"},{"size":616,"mtime":1621235314060,"results":"24","hashOfConfig":"25"},{"size":9693,"mtime":1621242097206,"results":"26","hashOfConfig":"25"},{"size":7133,"mtime":1637651237275,"results":"27","hashOfConfig":"20"},{"size":8733,"mtime":1635931829112,"results":"28","hashOfConfig":"20"},{"size":3119,"mtime":1634191808754,"results":"29","hashOfConfig":"20"},{"size":1113,"mtime":1635407660514,"results":"30","hashOfConfig":"20"},{"size":3905,"mtime":1635304242763},{"size":861,"mtime":1635246075403,"results":"31","hashOfConfig":"20"},{"size":3260,"mtime":1635334661529,"results":"32","hashOfConfig":"20"},{"size":24504,"mtime":1635908548975,"results":"33","hashOfConfig":"20"},{"size":1907,"mtime":1635492860490,"results":"34","hashOfConfig":"20"},{"size":3548,"mtime":1635409410379,"results":"35","hashOfConfig":"20"},{"size":2989,"mtime":1635495718901,"results":"36","hashOfConfig":"20"},{"size":3465,"mtime":1635495798948,"results":"37","hashOfConfig":"20"},{"filePath":"38","messages":"39","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"1j0d8vf",{"filePath":"40","messages":"41","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"42","messages":"43","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"44","messages":"45","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"46","messages":"47","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"175njjo",{"filePath":"48","messages":"49","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"50","messages":"51","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"52","messages":"53","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"54","messages":"55","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"56","messages":"57","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"58","messages":"59","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"60","messages":"61","errorCount":13,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"62","messages":"63","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"64","messages":"65","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"66","messages":"67","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"68","messages":"69","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"70","messages":"71","errorCount":2,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"/Users/yancheng/gm/gm-open-source/gm-printer/src/printer/table.js",[],"/Users/yancheng/gm/gm-open-source/gm-printer/src/printer/store.js",[],"/Users/yancheng/gm/gm-open-source/gm-printer/src/editor/editor.js",[],"/Users/yancheng/gm/gm-open-source/gm-printer/src/editor/context_menu.js",[],"/Users/yancheng/gm/gm-open-source/gm-printer/src/components/tooltip/index.js",[],"/Users/yancheng/gm/gm-open-source/gm-printer/src/common/common_context_menu.js",[],"/Users/yancheng/gm/gm-open-source/gm-printer/src/util.js",[],"/Users/yancheng/gm/gm-open-source/gm-printer/src/printer/printer.js",[],"/Users/yancheng/gm/gm-open-source/gm-printer/src/printer/do_print.js",[],"/Users/yancheng/gm/gm-open-source/gm-printer/src/common/editor_special_field.js",[],"/Users/yancheng/gm/gm-open-source/gm-printer/src/common/hoc_with_shadow_dom.js",[],"/Users/yancheng/gm/gm-open-source/gm-printer/src/common/editor_title.js",["72","73","74","75","76","77","78","79","80","81","82","83","84"],"/Users/yancheng/gm/gm-open-source/gm-printer/src/common/editor_store.js",[],"/Users/yancheng/gm/gm-open-source/gm-printer/src/common/editor_add_field.js",[],"/Users/yancheng/gm/gm-open-source/gm-printer/src/common/editor_page_summary.js",[],"/Users/yancheng/gm/gm-open-source/gm-printer/src/editor_account/editor.js",[],"/Users/yancheng/gm/gm-open-source/gm-printer/src/editor_account/context_menu.js",["85","86"],{"ruleId":"87","severity":2,"message":"88","line":47,"column":13,"nodeType":"89","messageId":"90","endLine":47,"endColumn":22},{"ruleId":"87","severity":2,"message":"91","line":48,"column":30,"nodeType":"92","messageId":"90","endLine":48,"endColumn":36},{"ruleId":"87","severity":2,"message":"93","line":49,"column":31,"nodeType":"92","messageId":"90","endLine":49,"endColumn":47},{"ruleId":"87","severity":2,"message":"93","line":50,"column":21,"nodeType":"92","messageId":"90","endLine":50,"endColumn":37},{"ruleId":"87","severity":2,"message":"88","line":56,"column":13,"nodeType":"89","messageId":"90","endLine":56,"endColumn":22},{"ruleId":"87","severity":2,"message":"94","line":59,"column":20,"nodeType":"92","messageId":"90","endLine":59,"endColumn":32},{"ruleId":"87","severity":2,"message":"91","line":61,"column":23,"nodeType":"92","messageId":"90","endLine":61,"endColumn":29},{"ruleId":"87","severity":2,"message":"95","line":61,"column":30,"nodeType":"92","messageId":"90","endLine":61,"endColumn":34},{"ruleId":"87","severity":2,"message":"96","line":63,"column":15,"nodeType":"92","messageId":"90","endLine":63,"endColumn":19},{"ruleId":"87","severity":2,"message":"88","line":67,"column":23,"nodeType":"89","messageId":"90","endLine":67,"endColumn":32},{"ruleId":"87","severity":2,"message":"91","line":70,"column":32,"nodeType":"92","messageId":"90","endLine":70,"endColumn":38},{"ruleId":"87","severity":2,"message":"88","line":78,"column":13,"nodeType":"89","messageId":"90","endLine":78,"endColumn":22},{"ruleId":"87","severity":2,"message":"91","line":84,"column":42,"nodeType":"92","messageId":"90","endLine":84,"endColumn":48},{"ruleId":"97","severity":2,"message":"98","line":64,"column":11,"nodeType":"92","endLine":64,"endColumn":17},{"ruleId":"97","severity":2,"message":"99","line":102,"column":24,"nodeType":"92","endLine":102,"endColumn":32},"react/prop-types","'editStore' is missing in props validation","Property","missingPropType","'editStore.config' is missing in props validation","Identifier","'editStore.config.batchPrintConfig' is missing in props validation","'editStore.originConfig' is missing in props validation","'editStore.config.name' is missing in props validation","'editStore.init' is missing in props validation","no-unused-vars","'keyArr' is assigned a value but never used.","'mockData' is assigned a value but never used."]
1
+ [{"/Users/min/Documents/GMFE/gm-util/gm-printer/src/util.js":"1","/Users/min/Documents/GMFE/gm-util/gm-printer/src/printer/get_css.js":"2","/Users/min/Documents/GMFE/gm-util/gm-printer/src/printer/barcode.js":"3","/Users/min/Documents/GMFE/gm-util/gm-printer/src/index.js":"4","/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_stockout/context_menu.js":"5","/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_stockin/context_menu.js":"6","/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_statement/context_menu.js":"7","/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_settle/context_menu.js":"8","/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_salemenus/context_menu.js":"9","/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_purchase/editor_special_table.js":"10","/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_purchase/context_menu.js":"11","/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_account/context_menu.js":"12","/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor/context_menu.js":"13","/Users/min/Documents/GMFE/gm-util/gm-printer/src/config.js":"14","/Users/min/Documents/GMFE/gm-util/gm-printer/src/common/hoc_with_store.js":"15","/Users/min/Documents/GMFE/gm-util/gm-printer/src/common/hoc_with_shadow_dom.js":"16","/Users/min/Documents/GMFE/gm-util/gm-printer/src/common/get_editor_css.js":"17","/Users/min/Documents/GMFE/gm-util/gm-printer/src/common/editor_title.js":"18","/Users/min/Documents/GMFE/gm-util/gm-printer/src/common/editor_store.js":"19","/Users/min/Documents/GMFE/gm-util/gm-printer/src/common/editor_select.js":"20","/Users/min/Documents/GMFE/gm-util/gm-printer/src/common/editor_edit_field.js":"21"},{"size":7133,"mtime":1638862566087,"results":"22","hashOfConfig":"23"},{"size":291,"mtime":1638935573926,"results":"24","hashOfConfig":"23"},{"size":523,"mtime":1638935549030,"results":"25","hashOfConfig":"23"},{"size":1093,"mtime":1638861826721,"results":"26","hashOfConfig":"23"},{"size":2315,"mtime":1638930939570,"results":"27","hashOfConfig":"23"},{"size":2314,"mtime":1638930918783,"results":"28","hashOfConfig":"23"},{"size":1100,"mtime":1638930900747,"results":"29","hashOfConfig":"23"},{"size":2062,"mtime":1638930869535,"results":"30","hashOfConfig":"23"},{"size":3013,"mtime":1638930838581,"results":"31","hashOfConfig":"23"},{"size":4379,"mtime":1638935458586,"results":"32","hashOfConfig":"23"},{"size":2543,"mtime":1638935387181,"results":"33","hashOfConfig":"23"},{"size":2965,"mtime":1638935364549,"results":"34","hashOfConfig":"23"},{"size":3519,"mtime":1638930747457,"results":"35","hashOfConfig":"23"},{"size":2833,"mtime":1638861837310,"results":"36","hashOfConfig":"23"},{"size":4212,"mtime":1638935746667,"results":"37","hashOfConfig":"23"},{"size":861,"mtime":1638931446915,"results":"38","hashOfConfig":"23"},{"size":178,"mtime":1638931439249,"results":"39","hashOfConfig":"23"},{"size":3272,"mtime":1638931374761,"results":"40","hashOfConfig":"23"},{"size":22205,"mtime":1638862315362,"results":"41","hashOfConfig":"23"},{"size":4903,"mtime":1638931210449,"results":"42","hashOfConfig":"23"},{"size":13268,"mtime":1638930638946,"results":"43","hashOfConfig":"23"},{"filePath":"44","messages":"45","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"jpc0be",{"filePath":"46","messages":"47","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"48","messages":"49","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"50","messages":"51","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"52","messages":"53","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"54","messages":"55","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"56","messages":"57","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"58","messages":"59","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"60","messages":"61","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"62","messages":"63","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"64","messages":"65","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"66","messages":"67","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"68","messages":"69","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"70","messages":"71","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"72","messages":"73","errorCount":2,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"74","messages":"75","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"76","messages":"77","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"78","messages":"79","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"80","messages":"81","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"82","messages":"83","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"84","messages":"85","errorCount":1,"warningCount":2,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"/Users/min/Documents/GMFE/gm-util/gm-printer/src/util.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/printer/get_css.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/printer/barcode.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/index.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_stockout/context_menu.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_stockin/context_menu.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_statement/context_menu.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_settle/context_menu.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_salemenus/context_menu.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_purchase/editor_special_table.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_purchase/context_menu.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_account/context_menu.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor/context_menu.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/config.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/common/hoc_with_store.js",["86","87"],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/common/hoc_with_shadow_dom.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/common/get_editor_css.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/common/editor_title.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/common/editor_store.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/common/editor_select.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/common/editor_edit_field.js",["88","89","90"],{"ruleId":"91","severity":2,"message":"92","line":10,"column":29,"nodeType":"93","endLine":10,"endColumn":35},{"ruleId":"91","severity":2,"message":"94","line":145,"column":63,"nodeType":"93","endLine":145,"endColumn":71},{"ruleId":"95","severity":1,"message":"96","line":265,"column":13,"nodeType":"97","endLine":265,"endColumn":49},{"ruleId":"95","severity":1,"message":"96","line":283,"column":13,"nodeType":"97","endLine":283,"endColumn":56},{"ruleId":"98","severity":2,"message":"99","line":436,"column":22,"nodeType":"100","messageId":"101","endLine":436,"endColumn":31},"react/prop-types","'config' is missing in props validation","Identifier","'mockData' is missing in props validation","react/jsx-handler-names","Handler function for onChange prop key must begin with 'handle'","JSXAttribute","gmfe/i18n-check","t函数的key只能为字符串常量(Literal),请使用单引号或双引号包裹","MemberExpression","isVariable"]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm-printer",
3
- "version": "10.13.7",
3
+ "version": "10.13.8-alpha.0",
4
4
  "description": "diy printer",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -205,12 +205,6 @@ 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
-
214
208
  return (
215
209
  <div>
216
210
  <Title title={i18next.t('编辑字段')} />
@@ -276,7 +270,7 @@ class EditorField extends React.Component {
276
270
  </Flex>
277
271
 
278
272
  <Flex alignCenter className='gm-padding-top-5 gm-text-desc'>
279
- {i18next.t('商品排列仅适用于双栏商品设置')}
273
+ {i18next.t('商品排列仅适用于双栏、三栏商品设置')}
280
274
  </Flex>
281
275
 
282
276
  <Gap height='5px' />
@@ -376,16 +370,6 @@ class EditorField extends React.Component {
376
370
  onChange={this.handleSubtotalStyleChange}
377
371
  />
378
372
  </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>&nbsp;{i18next.t('合计、每页合计交换位置')}</Flex>
388
- </Flex> */}
389
373
  <EditorSubtotalCheck
390
374
  subtotalCheckDisabled
391
375
  subtotalChecked={subtotalNeedUpperCase}
@@ -126,7 +126,7 @@ class EditorSelector extends React.Component {
126
126
  </Flex>
127
127
 
128
128
  {this.props.isPurchase && (
129
- <React.Fragment>
129
+ <>
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
- </React.Fragment>
149
+ </>
150
150
  )}
151
151
 
152
152
  <Flex alignCenter className='gm-padding-top-5 gm-text-red'>
@@ -158,9 +158,10 @@ class EditorSelector extends React.Component {
158
158
  }
159
159
 
160
160
  EditorSelector.propTypes = {
161
- isPurchase: PropTypes.bool
161
+ isPurchase: PropTypes.bool,
162
+ editStore: PropTypes.object
162
163
  }
163
- EditorSelector.deaultProps = {
164
+ EditorSelector.defaultProps = {
164
165
  isPurchase: false
165
166
  }
166
167
 
@@ -427,7 +427,14 @@ 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
+
430
436
  newDataKey = _.sortBy(newDataKey, [
437
+ o => o === 'multi3',
431
438
  o => o === 'multi',
432
439
  o => o === 'category',
433
440
  o => o === 'orders'
@@ -126,9 +126,10 @@ class EditorTitle extends React.Component {
126
126
 
127
127
  EditorTitle.propTypes = {
128
128
  onSave: PropTypes.func.isRequired,
129
- isPurchase: PropTypes.bool
129
+ isPurchase: PropTypes.bool,
130
+ editStore: PropTypes.object
130
131
  }
131
- EditorTitle.deaultProps = {
132
+ EditorTitle.defaultProps = {
132
133
  isPurchase: false
133
134
  }
134
135
 
@@ -1,6 +1,6 @@
1
1
  // eslint-disable-next-line
2
2
  import editorCSS from 'css-loader!postcss-loader!less-loader!./style.lesss'
3
3
 
4
- export default function getEditorCSS () {
4
+ export default function getEditorCSS() {
5
5
  return editorCSS.toString()
6
6
  }
@@ -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}/>, shadowRoot)
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,29 +4,65 @@ 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('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)
13
+ componentDidMount() {
14
+ window.document.addEventListener(
15
+ 'gm-printer-select',
16
+ this.handlePrinterSelect
17
+ )
18
+ window.document.addEventListener(
19
+ 'gm-printer-select-region',
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
+ )
20
38
  window.document.addEventListener('keydown', this.handleKeyDown)
21
39
  }
22
40
 
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)
41
+ componentWillUnmount() {
42
+ window.document.removeEventListener(
43
+ 'gm-printer-select',
44
+ this.handlePrinterSelect
45
+ )
46
+ window.document.removeEventListener(
47
+ 'gm-printer-select-region',
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
+ )
30
66
  window.document.removeEventListener('keydown', this.handleKeyDown)
31
67
  }
32
68
 
@@ -35,31 +71,31 @@ const withStore = store => WrapComponent =>
35
71
  this.store.setSelectedRegion(selected)
36
72
  }
37
73
 
38
- handlePrinterSelect = (e) => {
74
+ handlePrinterSelect = e => {
39
75
  const { selected } = e.detail
40
76
  this.store.setSelected(selected)
41
77
  }
42
78
 
43
- handlePrinterPanelStyleSet = (e) => {
79
+ handlePrinterPanelStyleSet = e => {
44
80
  const { name, style } = e.detail
45
81
  this.store.setConfigPanelStyle(name, style)
46
82
  }
47
83
 
48
- handlePrinterBlockStyleSet = (e) => {
84
+ handlePrinterBlockStyleSet = e => {
49
85
  const { style } = e.detail
50
86
  this.store.setConfigBlockBy('style', style)
51
87
  }
52
88
 
53
- handlePrinterBlockTextSet = (e) => {
89
+ handlePrinterBlockTextSet = e => {
54
90
  const { text } = e.detail
55
91
  this.store.setConfigBlockBy('text', text)
56
92
  }
57
93
 
58
- handlePrinterTableDrag = (e) => {
94
+ handlePrinterTableDrag = e => {
59
95
  this.store.exchangeTableColumn(e.detail.target, e.detail.source)
60
96
  }
61
97
 
62
- handleKeyDown = (e) => {
98
+ handleKeyDown = e => {
63
99
  if (e.target !== window.document.body) {
64
100
  return
65
101
  }
@@ -81,7 +117,11 @@ const withStore = store => WrapComponent =>
81
117
  diffY += 1
82
118
  }
83
119
 
84
- const newStyle = getStyleWithDiff(this.store.computedSelectedInfo.style, diffX, diffY)
120
+ const newStyle = getStyleWithDiff(
121
+ this.store.computedSelectedInfo.style,
122
+ diffX,
123
+ diffY
124
+ )
85
125
 
86
126
  this.store.setConfigBlockBy('style', newStyle)
87
127
  } else if (this.store.computedIsSelectTable) {
@@ -100,13 +140,12 @@ const withStore = store => WrapComponent =>
100
140
  }
101
141
  }
102
142
 
103
- render () {
143
+ render() {
104
144
  return (
105
145
  <Provider editStore={this.store} mockData={this.props.mockData}>
106
- <WrapComponent {...this.props}/>
146
+ <WrapComponent {...this.props} />
107
147
  </Provider>
108
148
  )
109
149
  }
110
150
  }
111
-
112
151
  export default withStore
package/src/config.js CHANGED
@@ -125,3 +125,5 @@ export const blockTypeList = [
125
125
  ]
126
126
 
127
127
  export const MULTI_SUFFIX = '_MULTI_SUFFIX'
128
+
129
+ export const MULTI_SUFFIX3 = '_MULTI_SUFFIX3'
@@ -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 { noSubtotalBtnTableDataKeySet } from './editor'
7
+ import PropTypes from 'prop-types'
8
8
 
9
9
  const blockTypeList = [
10
10
  { value: '', text: i18next.t('插入文本') },
@@ -62,6 +62,7 @@ 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')
65
66
  const isCategoryActive = keyArr.includes('category')
66
67
  const isSubtotalActive = subtotal.show
67
68
 
@@ -73,6 +74,12 @@ class ContextMenu extends React.Component {
73
74
  >
74
75
  {i18next.t('双栏商品')}
75
76
  </div>
77
+ <div
78
+ onClick={this.handleChangeTableDataKey.bind(this, 'multi3', name)}
79
+ className={isThreeActive ? 'active' : ''}
80
+ >
81
+ {i18next.t('三栏商品')}
82
+ </div>
76
83
  <div
77
84
  onClick={this.handleChangeTableDataKey.bind(this, 'category', name)}
78
85
  className={isCategoryActive ? 'active' : ''}
@@ -107,5 +114,8 @@ class ContextMenu extends React.Component {
107
114
  )
108
115
  }
109
116
  }
110
-
117
+ ContextMenu.propTypes = {
118
+ editStore: PropTypes.object.isRequired,
119
+ mockData: PropTypes.object.isRequired
120
+ }
111
121
  export default ContextMenu
@@ -4,6 +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 PropTypes from 'prop-types'
7
8
 
8
9
  const blockTypeList = [
9
10
  { value: '', text: i18next.t('插入文本') },
@@ -50,8 +51,8 @@ class ContextMenu extends React.Component {
50
51
  }
51
52
 
52
53
  const arr = name.split('.')
53
- const { dataKey, subtotal } = this.props.editStore.config.contents[arr[2]]
54
- const keyArr = dataKey.split('_')
54
+ const { subtotal } = this.props.editStore.config.contents[arr[2]]
55
+ // const keyArr = dataKey.split('_')
55
56
 
56
57
  // const isMultiActive = keyArr.includes('multi')
57
58
  // const isCategoryActive = keyArr.includes('category')
@@ -99,5 +100,8 @@ class ContextMenu extends React.Component {
99
100
  )
100
101
  }
101
102
  }
102
-
103
+ ContextMenu.propTypes = {
104
+ editStore: PropTypes.object.isRequired,
105
+ mockData: PropTypes.object.isRequired
106
+ }
103
107
  export default ContextMenu
@@ -3,6 +3,7 @@ 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'
6
7
  import _ from 'lodash'
7
8
 
8
9
  const blockTypeList = [
@@ -84,4 +85,8 @@ class ContextMenu extends React.Component {
84
85
  }
85
86
  }
86
87
 
88
+ ContextMenu.propTypes = {
89
+ editStore: PropTypes.object.isRequired,
90
+ mockData: PropTypes.object.isRequired
91
+ }
87
92
  export default ContextMenu
@@ -119,6 +119,12 @@ 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
+
122
128
  @inject('editStore')
123
129
  @observer
124
130
  class EditorSpecialTable extends React.Component {
@@ -144,7 +150,8 @@ class EditorSpecialTable extends React.Component {
144
150
  }
145
151
 
146
152
  EditorSpecialTable.propTypes = {
147
- addFields: PropTypes.object.isRequired
153
+ addFields: PropTypes.object.isRequired,
154
+ editStore: PropTypes.object
148
155
  }
149
156
 
150
157
  export default EditorSpecialTable
@@ -4,6 +4,7 @@ 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'
7
8
  import { hasSubtotalBtnTableDataKeySet } from './editor'
8
9
 
9
10
  const blockTypeList = [
@@ -101,5 +102,8 @@ class ContextMenu extends React.Component {
101
102
  )
102
103
  }
103
104
  }
104
-
105
+ ContextMenu.propTypes = {
106
+ editStore: PropTypes.object.isRequired,
107
+ mockData: PropTypes.object.isRequired
108
+ }
105
109
  export default ContextMenu
@@ -4,6 +4,7 @@ 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'
7
8
 
8
9
  const blockTypeList = [
9
10
  { value: '', text: i18next.t('插入文本') },
@@ -17,13 +18,13 @@ const blockTypeList = [
17
18
  }))
18
19
  @observer
19
20
  class ContextMenu extends React.Component {
20
- handleSubtotal = (name) => {
21
+ handleSubtotal = name => {
21
22
  const { editStore } = this.props
22
23
 
23
24
  editStore.setSubtotalShow(name)
24
25
  }
25
26
 
26
- hasSubtotalBtn = (name) => {
27
+ hasSubtotalBtn = name => {
27
28
  if (!name) return false
28
29
 
29
30
  const arr = name.split('.')
@@ -34,7 +35,7 @@ class ContextMenu extends React.Component {
34
35
  }
35
36
  }
36
37
 
37
- renderOrderActionBtn = (name) => {
38
+ renderOrderActionBtn = name => {
38
39
  if (!this.hasSubtotalBtn(name)) {
39
40
  return null
40
41
  }
@@ -45,18 +46,24 @@ class ContextMenu extends React.Component {
45
46
  const isSubtotalActive = subtotal.show
46
47
 
47
48
  return (
48
- <React.Fragment>
49
- <div onClick={this.handleSubtotal.bind(this, name)}
50
- className={isSubtotalActive ? 'active' : ''}>{i18next.t('每页合计')}
49
+ <>
50
+ <div
51
+ onClick={this.handleSubtotal.bind(this, name)}
52
+ className={isSubtotalActive ? 'active' : ''}
53
+ >
54
+ {i18next.t('每页合计')}
51
55
  </div>
52
- </React.Fragment>
56
+ </>
53
57
  )
54
58
  }
55
59
 
56
- render () {
60
+ render() {
57
61
  const { editStore, mockData } = this.props
58
62
  return (
59
- <CommonContextMenu renderTableAction={this.renderOrderActionBtn} insertBlockList={blockTypeList}>
63
+ <CommonContextMenu
64
+ renderTableAction={this.renderOrderActionBtn}
65
+ insertBlockList={blockTypeList}
66
+ >
60
67
  <Printer
61
68
  key={editStore.computedPrinterKey}
62
69
  selected={editStore.selected}
@@ -69,4 +76,8 @@ class ContextMenu extends React.Component {
69
76
  }
70
77
  }
71
78
 
79
+ ContextMenu.propTypes = {
80
+ editStore: PropTypes.object.isRequired,
81
+ mockData: PropTypes.object.isRequired
82
+ }
72
83
  export default ContextMenu
@@ -3,6 +3,7 @@ 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'
6
7
 
7
8
  const blockTypeList = [
8
9
  { value: '', text: i18next.t('插入文本') },
@@ -16,7 +17,7 @@ const blockTypeList = [
16
17
  }))
17
18
  @observer
18
19
  class ContextMenu extends React.Component {
19
- render () {
20
+ render() {
20
21
  const { editStore, mockData } = this.props
21
22
  return (
22
23
  <CommonContextMenu insertBlockList={blockTypeList}>
@@ -31,5 +32,8 @@ class ContextMenu extends React.Component {
31
32
  )
32
33
  }
33
34
  }
34
-
35
+ ContextMenu.propTypes = {
36
+ editStore: PropTypes.object.isRequired,
37
+ mockData: PropTypes.object.isRequired
38
+ }
35
39
  export default ContextMenu
@@ -3,6 +3,7 @@ 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'
6
7
 
7
8
  const blockTypeList = [
8
9
  { value: '', text: i18next.t('插入文本') },
@@ -32,7 +33,7 @@ class ContextMenu extends React.Component {
32
33
  const isMultiActive = keyArr.includes('multi')
33
34
 
34
35
  return (
35
- <React.Fragment>
36
+ <>
36
37
  <div
37
38
  onClick={this.handleChangeTableDataKey.bind(this, 'multi', name)}
38
39
  className={isMultiActive ? 'active' : ''}
@@ -51,7 +52,7 @@ class ContextMenu extends React.Component {
51
52
  >
52
53
  {i18next.t('入库金额小计')}
53
54
  </div>
54
- </React.Fragment>
55
+ </>
55
56
  )
56
57
  }
57
58
 
@@ -73,5 +74,8 @@ class ContextMenu extends React.Component {
73
74
  )
74
75
  }
75
76
  }
76
-
77
+ ContextMenu.propTypes = {
78
+ editStore: PropTypes.object.isRequired,
79
+ mockData: PropTypes.object.isRequired
80
+ }
77
81
  export default ContextMenu