gm-printer 10.41.6-beta.0 → 10.41.6-beta.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm-printer",
3
- "version": "10.41.6-beta.0",
3
+ "version": "10.41.6-beta.1",
4
4
  "description": "diy printer",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -1,13 +1,22 @@
1
1
  import React from 'react'
2
+ import PropTypes from 'prop-types'
2
3
  import { Provider } from 'mobx-react'
3
4
  import { getStyleWithDiff } from '../util'
4
5
 
5
6
  const withStore = store => WrapComponent =>
6
7
  class extends React.Component {
8
+ static propTypes = {
9
+ config: PropTypes.object,
10
+ mockData: PropTypes.object,
11
+ imageConfig: PropTypes.object
12
+ }
13
+
7
14
  constructor(props) {
8
15
  super(props)
9
16
  this.store = store
10
17
  this.store.init(props.config, props.mockData)
18
+ // 插入图片增强配置(电子签章):由业务侧 props 传入,不传为 null 保持旧行为
19
+ this.store.imageConfig = props.imageConfig || null
11
20
  }
12
21
 
13
22
  componentDidMount() {
@@ -1,19 +1,20 @@
1
1
  import EditorStore from '../common/editor_store'
2
2
  import i18next from '../../locales'
3
3
 
4
- class Store extends EditorStore {
5
- // 插入图片增强(电子签章 1056076):2M/指定格式/锁比例/四角拖拽
6
- imageConfig = {
7
- maxSize: 2 * 1024 * 1024,
8
- maxSizeLabel: '2M',
9
- accept: 'image/jpeg,image/jpg,image/png',
10
- acceptTypes: ['image/jpeg', 'image/jpg', 'image/png'],
11
- acceptHint: i18next.t('支持插入2M以内的jpg、jpeg、png格式图片'),
12
- overSizeTip: i18next.t('图片大小不能超过2M'),
13
- wrongTypeTip: i18next.t('仅支持jpg、jpeg、png格式的图片'),
14
- resizable: true
15
- }
4
+ // 配送单"电子签章"插入图片增强预设(1056076):2M/指定格式/锁比例/四角拖拽
5
+ // 由业务侧显式传入 <Editor imageConfig={imageConfigDelivery} /> 才生效,不传保持旧行为
6
+ export const imageConfigDelivery = {
7
+ maxSize: 2 * 1024 * 1024,
8
+ maxSizeLabel: '2M',
9
+ accept: 'image/jpeg,image/jpg,image/png',
10
+ acceptTypes: ['image/jpeg', 'image/jpg', 'image/png'],
11
+ acceptHint: i18next.t('支持插入2M以内的jpg、jpeg、png格式图片'),
12
+ overSizeTip: i18next.t('图片大小不能超过2M'),
13
+ wrongTypeTip: i18next.t('仅支持jpg、jpeg、png格式的图片'),
14
+ resizable: true
15
+ }
16
16
 
17
+ class Store extends EditorStore {
17
18
  // 复写父类方法
18
19
  setTableDataKeyEffect(target, dataKey) {
19
20
  switch (dataKey) {
package/src/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  // ‼️优先初始化语言设置(必须先初始化语言)
2
2
  import '../locales'
3
3
  import Editor, { Editor2 } from './editor'
4
+ import { imageConfigDelivery } from './editor/store'
4
5
 
5
6
  import EditorPurchase from './editor_purchase'
6
7
  import EditorExaminingReport from './examining_report_editor'
@@ -30,6 +31,7 @@ export { setLocale } from '../locales'
30
31
  export {
31
32
  Editor,
32
33
  Editor2,
34
+ imageConfigDelivery,
33
35
  EditorStockIn,
34
36
  EditorStockOut,
35
37
  EditorPurchase,