gm-printer 10.42.4-beta.7 → 10.42.5-beta.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/locales/en.json CHANGED
@@ -16,9 +16,6 @@
16
16
  "粗细": "",
17
17
  "高": "",
18
18
  "图片大小不能超过500Kb": "",
19
- "图片大小不能超过2M": "Image size cannot exceed 2M",
20
- "仅支持jpg、jpeg、png格式的图片": "Only JPG, JPEG, and PNG images are supported",
21
- "支持插入2M以内的jpg、jpeg、png格式图片": "Support inserting JPG, JPEG, or PNG images within 2M",
22
19
  "配送单特殊控制": "",
23
20
  "添加字段": "",
24
21
  "编辑字段": "",
package/locales/th.json CHANGED
@@ -16,9 +16,6 @@
16
16
  "粗细": "",
17
17
  "高": "",
18
18
  "图片大小不能超过500Kb": "",
19
- "图片大小不能超过2M": "ขนาดรูปภาพต้องไม่เกิน 2M",
20
- "仅支持jpg、jpeg、png格式的图片": "รองรับเฉพาะรูปภาพรูปแบบ jpg, jpeg, png",
21
- "支持插入2M以内的jpg、jpeg、png格式图片": "รองรับการแทรกรูปภาพ jpg, jpeg, png ขนาดไม่เกิน 2M",
22
19
  "配送单特殊控制": "",
23
20
  "添加字段": "",
24
21
  "编辑字段": "",
@@ -16,9 +16,6 @@
16
16
  "粗细": "粗細",
17
17
  "高": "高",
18
18
  "图片大小不能超过500Kb": "圖片大小不能超過500Kb",
19
- "图片大小不能超过2M": "圖片大小不能超過2M",
20
- "仅支持jpg、jpeg、png格式的图片": "僅支持jpg、jpeg、png格式的圖片",
21
- "支持插入2M以内的jpg、jpeg、png格式图片": "支持插入2M以內的jpg、jpeg、png格式圖片",
22
19
  "添加字段": "添加字段",
23
20
  "编辑字段": "編輯字段",
24
21
  "配送单特殊控制": "配送单特殊控制",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm-printer",
3
- "version": "10.42.4-beta.7",
3
+ "version": "10.42.5-beta.0",
4
4
  "description": "diy printer",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -109,7 +109,7 @@ class CommonContextMenu extends React.Component {
109
109
  })
110
110
  }
111
111
 
112
- handleInsertBlock = (type, link, ratio) => {
112
+ handleInsertBlock = (type, link) => {
113
113
  const { editStore } = this.props
114
114
  const { name, block } = this.state
115
115
 
@@ -120,8 +120,7 @@ class CommonContextMenu extends React.Component {
120
120
  left: block.left + 'px',
121
121
  top: block.top + 'px'
122
122
  },
123
- link,
124
- ratio
123
+ link
125
124
  )
126
125
 
127
126
  this.setState({
@@ -161,8 +160,8 @@ class CommonContextMenu extends React.Component {
161
160
  })
162
161
  }
163
162
 
164
- handleInsertImage = (imgURL, ratio) => {
165
- this.handleInsertBlock('image', imgURL, ratio)
163
+ handleInsertImage = imgURL => {
164
+ this.handleInsertBlock('image', imgURL)
166
165
  }
167
166
 
168
167
  handleRemove = () => {
@@ -328,7 +327,6 @@ class CommonContextMenu extends React.Component {
328
327
  onSuccess={this.handleInsertImage}
329
328
  key={v.value}
330
329
  text={v.text}
331
- imageConfig={this.props.editStore.imageConfig}
332
330
  />
333
331
  ) : (
334
332
  <div
@@ -391,26 +391,12 @@ Line.propTypes = {
391
391
 
392
392
  class Size extends React.Component {
393
393
  handleChange = (type, value) => {
394
- const { onChange, style, ratio } = this.props
394
+ const { onChange, style } = this.props
395
395
 
396
- const next = {
396
+ onChange({
397
397
  ...style,
398
398
  [type]: value
399
- }
400
-
401
- // 电子签章:有原始比例时宽高联动,不允许拉变形
402
- if (ratio && value !== '' && !value.endsWith('%')) {
403
- const num = parseFloat(value)
404
- if (!_.isNaN(num) && num > 0) {
405
- if (type === 'width') {
406
- next.height = Math.round(num / ratio) + 'px'
407
- } else {
408
- next.width = Math.round(num * ratio) + 'px'
409
- }
410
- }
411
- }
412
-
413
- onChange(next)
399
+ })
414
400
  }
415
401
 
416
402
  render() {
@@ -434,8 +420,7 @@ class Size extends React.Component {
434
420
 
435
421
  Size.propTypes = {
436
422
  style: PropTypes.object.isRequired,
437
- onChange: PropTypes.func.isRequired,
438
- ratio: PropTypes.number
423
+ onChange: PropTypes.func.isRequired
439
424
  }
440
425
 
441
426
  class ImageUploader extends React.Component {
@@ -452,26 +437,7 @@ class ImageUploader extends React.Component {
452
437
  : event.target.files
453
438
  const file = droppedFiles[0]
454
439
 
455
- if (!file) return
456
-
457
- const { imageConfig } = this.props
458
-
459
- if (imageConfig) {
460
- // 增强模式(电子签章):校验类型与大小,提示文案由配置方给出
461
- const acceptTypes = imageConfig.acceptTypes || [
462
- 'image/jpeg',
463
- 'image/jpg',
464
- 'image/png'
465
- ]
466
- if (!_.includes(acceptTypes, file.type)) {
467
- Tip.warning(imageConfig.wrongTypeTip)
468
- return
469
- }
470
- if (file.size > imageConfig.maxSize) {
471
- Tip.warning(imageConfig.overSizeTip)
472
- return
473
- }
474
- } else if (file.size > 512 * 1024) {
440
+ if (file.size > 512 * 1024) {
475
441
  Tip.warning(i18next.t('图片大小不能超过500Kb'))
476
442
  return
477
443
  }
@@ -497,21 +463,7 @@ class ImageUploader extends React.Component {
497
463
  .post()
498
464
  .then(json => {
499
465
  const imgURL = `${url.imgUrl}/${json.data.img_path_id}`
500
-
501
- // 增强模式下加载原图尺寸,记录原始比例供锁比例使用
502
- if (imageConfig) {
503
- const img = document.createElement('img')
504
- img.onload = () => {
505
- this.props.onSuccess(imgURL, img.naturalWidth / img.naturalHeight)
506
- }
507
- img.onerror = () => {
508
- // 拿不到尺寸时降级:只插入不锁比例
509
- this.props.onSuccess(imgURL)
510
- }
511
- img.src = imgURL
512
- } else {
513
- this.props.onSuccess(imgURL)
514
- }
466
+ this.props.onSuccess(imgURL)
515
467
  })
516
468
  }
517
469
 
@@ -521,23 +473,16 @@ class ImageUploader extends React.Component {
521
473
  }
522
474
 
523
475
  render() {
524
- const { imageConfig } = this.props
525
-
526
476
  return (
527
477
  <>
528
478
  <div onClick={this.handleClick} onDrop={this.handleUpload}>
529
479
  {this.props.text}
530
- {imageConfig && imageConfig.acceptHint && (
531
- <div className='gm-printer-contextmenu-hint'>
532
- {imageConfig.acceptHint}
533
- </div>
534
- )}
535
480
  </div>
536
481
  <input
537
482
  style={{ display: 'none' }}
538
483
  type='file'
539
484
  ref={this.input}
540
- accept={(imageConfig && imageConfig.accept) || 'image/*'}
485
+ accept='image/*'
541
486
  onChange={this.handleUpload}
542
487
  />
543
488
  </>
@@ -547,8 +492,7 @@ class ImageUploader extends React.Component {
547
492
 
548
493
  ImageUploader.propTypes = {
549
494
  onSuccess: PropTypes.func.isRequired,
550
- text: PropTypes.string.isRequired,
551
- imageConfig: PropTypes.object
495
+ text: PropTypes.string.isRequired
552
496
  }
553
497
 
554
498
  class InputWithUnit extends React.Component {
@@ -100,7 +100,7 @@ class EditorField extends React.Component {
100
100
 
101
101
  renderBlocks() {
102
102
  const { editStore, showNewDate } = this.props
103
- const { type, text, style, link, ratio } = editStore.computedSelectedInfo
103
+ const { type, text, style, link } = editStore.computedSelectedInfo
104
104
 
105
105
  return (
106
106
  <div>
@@ -149,11 +149,6 @@ class EditorField extends React.Component {
149
149
  <Size
150
150
  style={style}
151
151
  onChange={this.handleChangeBlock.bind(this, 'style')}
152
- ratio={
153
- editStore.imageConfig && editStore.imageConfig.resizable
154
- ? ratio
155
- : undefined
156
- }
157
152
  />
158
153
  <Gap />
159
154
 
@@ -8,6 +8,33 @@ import _ from 'lodash'
8
8
  import { dispatchMsg } from '../util'
9
9
  import PropTypes from 'prop-types'
10
10
 
11
+ /**
12
+ * 本机字体可用性检测(DOM 宽度法):
13
+ * 用同一文本分别以「不存在的字体(强制走浏览器 fallback 默认)」和「目标字体栈」
14
+ * 离屏渲染量宽,宽度差 >0.5px 说明栈中有字体真实命中(未安装时会 fallback 到与
15
+ * 假字体相同的系统默认,宽度一致)。基线不能用 monospace:中文等宽字体自身会
16
+ * fallback 到系统默认,与目标字体栈的 fallback 同源,导致未安装也判 true。
17
+ */
18
+ const isFontInstalled = (fontFamily) => {
19
+ if (typeof document === 'undefined' || !fontFamily) return true
20
+ const host = document.body
21
+ if (!host) return true
22
+ const probe = document.createElement('div')
23
+ probe.textContent = '配送单验收签字汉字测试123'
24
+ probe.style.cssText =
25
+ 'position:absolute;left:-9999px;top:0;font-size:32px;white-space:nowrap;'
26
+ const widthOf = (ff) => {
27
+ probe.style.fontFamily = ff
28
+ host.appendChild(probe)
29
+ const w = probe.getBoundingClientRect().width
30
+ host.removeChild(probe)
31
+ return w
32
+ }
33
+ // 基线:一个肯定不存在的字体名 → 浏览器对中文回落系统默认;目标栈若全未安装,回落结果与之等宽
34
+ const base = widthOf('GmDefinitelyNotAFont999')
35
+ return Math.abs(widthOf(fontFamily) - base) > 0.5
36
+ }
37
+
11
38
  @inject('editStore')
12
39
  @observer
13
40
  class EditorSelector extends React.Component {
@@ -56,7 +83,7 @@ class EditorSelector extends React.Component {
56
83
  computedSelectedRegionTip,
57
84
  selectedRegion
58
85
  } = this.props.editStore
59
- const { showFontFamily } = this.props
86
+ const { showFontFamily, fontFamilies } = this.props
60
87
  const isDIY = page.type === 'DIY'
61
88
  const isLongPrint = page.type === LONG_PRINT
62
89
  return (
@@ -134,11 +161,23 @@ class EditorSelector extends React.Component {
134
161
  value={page.fontFamily || ''}
135
162
  onChange={this.handleFontFamily}
136
163
  >
137
- {_.map(fontFamilyList, v => (
138
- <Option key={v.value} value={v.value}>
139
- {v.text}
140
- </Option>
141
- ))}
164
+ {_.map(fontFamilies || fontFamilyList, v => {
165
+ // 非默认字体且本机未安装时,选项标注提示:选中后打印/导出会退化为默认字体
166
+ const installed = isFontInstalled(v.value)
167
+ return (
168
+ <Option key={v.value} value={v.value}>
169
+ {v.text}
170
+ {!installed && (
171
+ <span
172
+ className='gm-text-red gm-padding-left-5'
173
+ style={{ fontSize: '11px' }}
174
+ >
175
+ (本机未安装,将退化默认字体)
176
+ </span>
177
+ )}
178
+ </Option>
179
+ )
180
+ })}
142
181
  </Select>
143
182
  </Flex>
144
183
  )}
@@ -213,6 +252,8 @@ class EditorSelector extends React.Component {
213
252
  EditorSelector.propTypes = {
214
253
  isPurchase: PropTypes.bool,
215
254
  showFontFamily: PropTypes.bool,
255
+ // 自定义打印字体列表(扩展接口):[{ value, text }];不传用内置 fontFamilyList
256
+ fontFamilies: PropTypes.array,
216
257
  editStore: PropTypes.object
217
258
  }
218
259
  EditorSelector.defaultProps = {
@@ -38,10 +38,6 @@ class EditorStore {
38
38
  @observable
39
39
  tableCustomStyle = 'default'
40
40
 
41
- // 插入图片增强配置(电子签章),null 时保持旧行为(500Kb/image/*)
42
- // { maxSize, maxSizeLabel, accept, acceptHint, resizable }
43
- imageConfig = null
44
-
45
41
  @observable
46
42
  emptyTableData = []
47
43
 
@@ -242,6 +238,8 @@ class EditorStore {
242
238
  }
243
239
  }).join('/')
244
240
  } else {
241
+ // 空值守卫(同 dev 4d5b401):station 集成分支会给无配置模板塞 sort_setting: null 等空键,
242
+ // 无守卫时 null.style 崩(TypeError: Cannot read properties of null)
245
243
  return v && v.style ? v.style.height : ''
246
244
  }
247
245
  }).join('_')
@@ -263,6 +261,24 @@ class EditorStore {
263
261
  this.remainPageHeihgt = remainHeight
264
262
  }
265
263
 
264
+ @action
265
+ getFilledTableData(tableData) {
266
+ const { autoFillConfig } = this.config
267
+ if (!this.selectedRegion && !autoFillConfig?.checked) return []
268
+ let tr_count = 0
269
+
270
+ tr_count = Math.floor(
271
+ this.remainPageHeihgt / this.computedTableCustomerRowHeight
272
+ )
273
+ if (tr_count <= 0) return []
274
+
275
+ const sample = (tableData || []).find(item => item && !item._isEmptyData)
276
+ const dataKey =
277
+ this.computedTableSpecialConfig?.dataKey || autoFillConfig?.dataKey
278
+ const colNumber = detectColNumber(dataKey, tableData)
279
+ return createEmptyRows(tr_count, sample, colNumber)
280
+ }
281
+
266
282
  /** 多栏表缺失时(如双栏切三栏),从单栏/双栏源表现场打包到 mockData */
267
283
  @action
268
284
  ensureMockMultiTable(dataKey) {
@@ -327,14 +343,18 @@ class EditorStore {
327
343
  this.ensureMockMultiTable(getDataKey(dataKey, 'vertical'))
328
344
  }
329
345
 
330
- // 开启时不在编辑器侧预推空行:预推依赖挂载时上报的剩余高度,布局(纸张/表格/
331
- // 排列)变化后会过期,第一次开启填充会按旧基准多推,把已渲染完的表格撑到下一页。
332
- // 空行统一由 Printer 侧「先分页拿基准 → 补空 → 重分页」写入(见 printer.js)
333
346
  const syncEmptyRows = key => {
334
347
  if (!this.mockData._table?.[key]) return
348
+ const list = this.mockData._table[key]
349
+ const hasHadEmptyData = _.some(list, data => data?._isEmptyData)
350
+ if (isAutoFilling && !hasHadEmptyData) {
351
+ list.push(...this.getFilledTableData(list))
352
+ }
335
353
  if (!isAutoFilling) {
336
354
  this.clearExtraTableData(key)
355
+ return
337
356
  }
357
+ this.mockData._table[key] = list
338
358
  }
339
359
 
340
360
  const numberEmptyRows = key => {
@@ -363,12 +383,13 @@ class EditorStore {
363
383
  const baseRowCount = sourceItems.length
364
384
  ? Math.max(1, Math.ceil(sourceItems.length / colNumber))
365
385
  : 0
366
- // 钉死总行:repack 后 _isEmptyData 会变少,不能再用 emptyTable.length;
367
- // 无空行时不预推,交由 Printer 按当前分页基准补
386
+ // 钉死总行:repack 后 _isEmptyData 会变少,不能再用 emptyTable.length
368
387
  const emptyCount = resolveVerticalEmptyCount(
369
388
  list.length,
370
389
  baseRowCount,
371
- emptyTable.length,
390
+ emptyTable.length > 0
391
+ ? emptyTable.length
392
+ : this.getFilledTableData(list).length,
372
393
  emptyTable.length > 0
373
394
  )
374
395
  const dataRows = baseRowCount
@@ -474,11 +495,6 @@ class EditorStore {
474
495
  @action.bound
475
496
  setPageSize(field, value) {
476
497
  this.config.page.size[field] = value
477
- // 页面几何变化会让预览 Printer 重挂载;行数填充开启时清掉按旧页高算出的空行,
478
- // 重挂载后按新几何重补(对齐切换商品排列时的处理,见 setTableDataKeyEffect)
479
- if (this.isAutoFilling || this.config?.autoFillConfig?.checked) {
480
- this.clearAllTableEmptyData()
481
- }
482
498
  }
483
499
 
484
500
  @computed
@@ -530,28 +546,6 @@ class EditorStore {
530
546
  height: size.width
531
547
  }
532
548
  }
533
- // 可用页高变了,行数填充开启时清掉按旧方向算出的空行,重挂载后重补
534
- if (this.isAutoFilling || this.config?.autoFillConfig?.checked) {
535
- this.clearAllTableEmptyData()
536
- }
537
- }
538
- }
539
-
540
- // 模板级打印字体(page.fontFamily),空值清掉字段恢复默认字体
541
- @action
542
- setPageFontFamily(value) {
543
- this.config.page = {
544
- ...this.config.page,
545
- fontFamily: value || undefined
546
- }
547
- }
548
-
549
- // 模板级打印字体(page.fontFamily),空值清掉字段恢复默认字体
550
- @action
551
- setPageFontFamily(value) {
552
- this.config.page = {
553
- ...this.config.page,
554
- fontFamily: value || undefined
555
549
  }
556
550
  }
557
551
 
@@ -601,12 +595,6 @@ class EditorStore {
601
595
  gap,
602
596
  name
603
597
  }
604
- // 纸张类型/内边距变了,可用页高随之变化;行数填充开启时清掉按旧纸张算出的
605
- // 空行(fillTableEmptyIndex 对已有空行沿用旧数量不重算,旧数量会把同页后续
606
- // 表格挤到下一页),交给 Printer 重挂载后按新页高重补
607
- if (this.isAutoFilling || this.config?.autoFillConfig?.checked) {
608
- this.clearAllTableEmptyData()
609
- }
610
598
  }
611
599
 
612
600
  @action
@@ -753,7 +741,7 @@ class EditorStore {
753
741
  }
754
742
 
755
743
  @action
756
- addConfigBlock(name, type, pos = {}, link = '', ratio) {
744
+ addConfigBlock(name, type, pos = {}, link = '') {
757
745
  let blocks
758
746
  const arr = name.split('.')
759
747
 
@@ -793,25 +781,19 @@ class EditorStore {
793
781
  }
794
782
  })
795
783
  break
796
- case 'image': {
797
- // 有原始比例时按比例初始化高度,避免插入即变形;无 ratio(降级/旧链路)保持 100x100
798
- const w = 100
799
- const h = ratio ? Math.round(w / ratio) : w
784
+ case 'image':
800
785
  blocks.push({
801
786
  type: 'image',
802
787
  link: link,
803
- // 电子签章:记录原图宽高比,锁比例用;旧数据无此字段则不锁
804
- ratio: ratio,
805
788
  style: {
806
789
  position: 'absolute',
807
790
  left: pos.left || '0px',
808
791
  top: pos.top || '0px',
809
- width: w + 'px',
810
- height: h + 'px'
792
+ width: '100px',
793
+ height: '100px'
811
794
  }
812
795
  })
813
796
  break
814
- }
815
797
  case 'counter':
816
798
  blocks.push({
817
799
  type: 'counter',
@@ -1604,8 +1586,7 @@ class EditorStore {
1604
1586
  const table = this.config.contents[arr[2]]
1605
1587
  const prefix = getDataKeyPrefix(table.dataKey)
1606
1588
  // 切换「按商品/按商户排序」时保留已开启的商品分类、双栏后缀,避免点完分类再切排序把 category 冲掉
1607
- const baseSuffix =
1608
- dataKey === 'goods' ? 'independent_rol_sku' : 'independent_rol_address'
1589
+ const baseSuffix = dataKey === 'goods' ? 'independent_rol_sku' : 'independent_rol_address'
1609
1590
  const nextDataKey = buildDataKey(
1610
1591
  prefix,
1611
1592
  `${baseSuffix}${getDataKeyModifierSuffix(table.dataKey)}`
@@ -1636,10 +1617,7 @@ class EditorStore {
1636
1617
 
1637
1618
  const { dataKey } = table
1638
1619
  // independent_rol_* / detail_one_row_*(含 category、multi 后缀)在下拉里都映射回「按采购明细单行」
1639
- if (
1640
- isIndependentRolDataKey(dataKey) ||
1641
- isDetailOneRowSelectKey(dataKey)
1642
- ) {
1620
+ if (isIndependentRolDataKey(dataKey) || isDetailOneRowSelectKey(dataKey)) {
1643
1621
  return buildDataKey(getDataKeyPrefix(dataKey), 'detail_one_row')
1644
1622
  }
1645
1623
  return dataKey
@@ -1,22 +1,13 @@
1
1
  import React from 'react'
2
- import PropTypes from 'prop-types'
3
2
  import { Provider } from 'mobx-react'
4
3
  import { getStyleWithDiff } from '../util'
5
4
 
6
5
  const withStore = store => WrapComponent =>
7
6
  class extends React.Component {
8
- static propTypes = {
9
- config: PropTypes.object,
10
- mockData: PropTypes.object,
11
- imageConfig: PropTypes.object
12
- }
13
-
14
7
  constructor(props) {
15
8
  super(props)
16
9
  this.store = store
17
10
  this.store.init(props.config, props.mockData)
18
- // 插入图片增强配置(电子签章):由业务侧 props 传入,不传为 null 保持旧行为
19
- this.store.imageConfig = props.imageConfig || null
20
11
  }
21
12
 
22
13
  componentDidMount() {
@@ -166,18 +166,6 @@
166
166
  color: white;
167
167
  background: rgb(82, 146, 247);
168
168
  }
169
-
170
- // 电子签章:插入图片菜单项下的格式提示小字
171
- .gm-printer-contextmenu-hint {
172
- font-size: 10px;
173
- color: #f5222d;
174
- line-height: 1.4;
175
- padding: 0;
176
- &:hover {
177
- color: #f5222d;
178
- background: transparent;
179
- }
180
- }
181
169
  }
182
170
  }
183
171
 
@@ -256,37 +244,6 @@
256
244
  outline: 1px solid rgb(82, 146, 247);
257
245
  z-index: 11;
258
246
  }
259
-
260
- // 电子签章:图片四角黑色加粗拖拽手柄
261
- .gm-printer-resize-handle {
262
- position: absolute;
263
- width: 10px;
264
- height: 10px;
265
- background: #000;
266
- border: 2px solid #fff;
267
- z-index: 12;
268
-
269
- &.gm-printer-resize-lt {
270
- left: -6px;
271
- top: -6px;
272
- cursor: nwse-resize;
273
- }
274
- &.gm-printer-resize-rt {
275
- right: -6px;
276
- top: -6px;
277
- cursor: nesw-resize;
278
- }
279
- &.gm-printer-resize-lb {
280
- left: -6px;
281
- bottom: -6px;
282
- cursor: nesw-resize;
283
- }
284
- &.gm-printer-resize-rb {
285
- right: -6px;
286
- bottom: -6px;
287
- cursor: nwse-resize;
288
- }
289
- }
290
247
  }
291
248
 
292
249
  .gm-printer-table {
@@ -9,7 +9,6 @@ import EditorTitle from '../common/editor_title'
9
9
  import EditorSelect from '../common/editor_select'
10
10
  import SpecialField from '../common/editor_special_field'
11
11
  import SpecialOtherField from '../common/editor_special_other_field'
12
- import SortSettingField from '../common/editor_sort_setting'
13
12
  import EditorField from '../common/editor_edit_field'
14
13
  import EditorAddField from '../common/editor_add_field'
15
14
  import EditorPageSummary from '../common/editor_page_summary'
@@ -49,7 +48,8 @@ class Editor extends React.Component {
49
48
  showNewDate,
50
49
  mockData,
51
50
  mergeClassificationAndLabel,
52
- customTableConfigs
51
+ customTableConfigs,
52
+ fontFamilies
53
53
  } = this.props
54
54
 
55
55
  return (
@@ -85,12 +85,10 @@ class Editor extends React.Component {
85
85
  <span>{':' + i18next.t('商户配送单')}</span>
86
86
  </>
87
87
  <Gap height='10px' />
88
- <EditorSelect showFontFamily />
88
+ <EditorSelect showFontFamily fontFamilies={fontFamilies} />
89
89
  <Gap height='5px' />
90
90
  <SpecialField addFields={addFields} mockData={mockData} />
91
91
  <SpecialOtherField addFields={addFields} mockData={mockData} />
92
- <Gap height='5px' />
93
- <SortSettingField showOrderSort />
94
92
  <EditorCutomizedConfig />
95
93
  <Gap height='5px' />
96
94
  <EditorField
@@ -125,7 +123,10 @@ Editor.propTypes = {
125
123
  addFields: PropTypes.object.isRequired,
126
124
  showNewDate: PropTypes.bool,
127
125
  mergeClassificationAndLabel: PropTypes.bool,
128
- customTableConfigs: PropTypes.array
126
+ customTableConfigs: PropTypes.array,
127
+ // 自定义打印字体列表(扩展接口):[{ value: 'KaiTi, Kaiti SC, 楷体', text: '楷体' }],
128
+ // 不传用内置 fontFamilyList;value 建议「Windows 名, macOS 名, 中文名」三段 fallback
129
+ fontFamilies: PropTypes.array
129
130
  }
130
131
 
131
132
  Editor.defaultProps = {
@@ -49,7 +49,8 @@ class Editor extends React.Component {
49
49
  mockData,
50
50
  mergeClassificationAndLabel,
51
51
  customTableConfigs,
52
- menuConfig
52
+ menuConfig,
53
+ fontFamilies
53
54
  } = this.props
54
55
  return (
55
56
  <div className='gm-printer-edit'>
@@ -84,7 +85,7 @@ class Editor extends React.Component {
84
85
  <span>{':' + i18next.t('商户配送单')}</span>
85
86
  </>
86
87
  <Gap height='10px' />
87
- <EditorSelect showFontFamily />
88
+ <EditorSelect showFontFamily fontFamilies={fontFamilies} />
88
89
  <Gap height='5px' />
89
90
  <SpecialField addFields={addFields} mockData={mockData} />
90
91
  <SpecialOtherField addFields={addFields} mockData={mockData} />
@@ -126,6 +127,8 @@ Editor.propTypes = {
126
127
  showNewDate: PropTypes.bool,
127
128
  mergeClassificationAndLabel: PropTypes.bool,
128
129
  customTableConfigs: PropTypes.array,
130
+ // 自定义打印字体列表(扩展接口),透传给 EditorSelect;不传用内置 fontFamilyList
131
+ fontFamilies: PropTypes.array,
129
132
  menuConfig: PropTypes.oneOfType([
130
133
  PropTypes.arrayOf(PropTypes.string),
131
134
  PropTypes.object
@@ -1,19 +1,6 @@
1
1
  import EditorStore from '../common/editor_store'
2
2
  import i18next from '../../locales'
3
3
 
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
-
17
4
  class Store extends EditorStore {
18
5
  // 复写父类方法
19
6
  setTableDataKeyEffect(target, dataKey) {