gm-printer 10.28.0-beta.2 → 10.28.0-beta.3

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.28.0-beta.2",
3
+ "version": "10.28.0-beta.3",
4
4
  "description": "diy printer",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -1,7 +1,7 @@
1
1
  import i18next from '../../locales'
2
2
  import React, { useEffect } from 'react'
3
3
  import PropTypes from 'prop-types'
4
- import { tableClassNameList, LONG_PRINT } from '../config'
4
+ import { tableClassNameList, longPrintTableClassNameList, LONG_PRINT } from '../config'
5
5
  import _ from 'lodash'
6
6
  import { Hr, ImageUploader } from '../common/component'
7
7
  import { observer, inject } from 'mobx-react'
@@ -221,6 +221,22 @@ class CommonContextMenu extends React.Component {
221
221
  </>
222
222
  )}
223
223
 
224
+ {isLongPrint && (
225
+ <>
226
+ {' '}
227
+ {_.map(longPrintTableClassNameList, o => (
228
+ <div
229
+ onClick={this.handleSetTableConfig.bind(this, o.value)}
230
+ key={o.value}
231
+ className={isActive(o.value) ? 'active' : ''}
232
+ >
233
+ {o.text}
234
+ </div>
235
+ ))}{' '}
236
+ <Hr />
237
+ </>)
238
+ }
239
+
224
240
  <div onClick={this.handleAddContent.bind(this, 0, '')}>
225
241
  {i18next.t('向上插入区域块')}
226
242
  </div>
@@ -380,6 +380,23 @@ class EditorField extends React.Component {
380
380
  </Flex>
381
381
  )}
382
382
 
383
+ {isLongPrint && (
384
+ <Flex alignCenter>
385
+ <Flex alignCenter>{i18next.t('表格样式')}:</Flex>
386
+ <Select
387
+ className='gm-printer-edit-select'
388
+ value={editStore.tableCustomStyle}
389
+ onChange={editStore.changeTableCustomStyle}
390
+ >
391
+ <Option value='default'>{i18next.t('默认样式')}</Option>
392
+ <Option value='className0'>{i18next.t('样式一')}</Option>
393
+ <Option value='className1'>{i18next.t('样式二')}</Option>
394
+ <Option value='className2'>{i18next.t('样式三')}</Option>
395
+ <Option value='specialTable'>{i18next.t('样式四')}</Option>
396
+ </Select>
397
+ </Flex>
398
+ )}
399
+
383
400
  <Gap height='5px' />
384
401
 
385
402
  <Flex>
@@ -547,7 +564,7 @@ class EditorField extends React.Component {
547
564
  value={
548
565
  subtotal && subtotal?.fields?.length > 1
549
566
  ? _.find(subtotal?.fields, item => !item.valueField)?.name ??
550
- ''
567
+ ''
551
568
  : ''
552
569
  }
553
570
  onChange={editStore.setSubtotalFields}
package/src/config.js CHANGED
@@ -125,7 +125,16 @@ export const borderStyleList = [
125
125
  export const tableClassNameList = [
126
126
  { value: '', text: i18next.t('默认样式') },
127
127
  { value: 'className0', text: i18next.t('浅实线样式') },
128
- { value: 'className1', text: i18next.t('无实线样式') }
128
+ { value: 'className1', text: i18next.t('无实线样式') },
129
+ { value: 'className2', text: i18next.t('样式三') }
130
+ ]
131
+
132
+ export const longPrintTableClassNameList = [
133
+ { value: '', text: i18next.t('默认样式') },
134
+ { value: 'className0', text: i18next.t('样式一') },
135
+ { value: 'className1', text: i18next.t('样式二') },
136
+ { value: 'className2', text: i18next.t('样式三') },
137
+ { value: 'specialTable', text: i18next.t('样式四') }
129
138
  ]
130
139
 
131
140
  export const tableDataKeyList = [
@@ -164,7 +164,7 @@ class Printer extends React.Component {
164
164
  }
165
165
 
166
166
  renderLongPage() {
167
- const { printerStore } = this.props
167
+ const { printerStore, isSomeSubtotalTr } = this.props
168
168
  const { config } = printerStore
169
169
  return (
170
170
  <Page>
@@ -174,17 +174,32 @@ class Printer extends React.Component {
174
174
  case 'table':
175
175
  // eslint-disable-next-line no-case-declarations
176
176
  const list = printerStore.data._table[content.dataKey]
177
- return (
178
- <LongPrintTable
177
+ // console.log(content, "content");
178
+ if (content.className === "specialTable") {
179
+ return (
180
+ <LongPrintTable
181
+ key={`contents.table.${index}`}
182
+ name={`contents.table.${index}`}
183
+ config={content}
184
+ range={{ begin: 0, end: list?.length || 0 }}
185
+ pageIndex={0}
186
+ placeholder={`${i18next.t('区域')} ${index}`}
187
+ />
188
+ )
189
+ } else {
190
+ return <Table
179
191
  key={`contents.table.${index}`}
180
192
  name={`contents.table.${index}`}
181
193
  config={content}
182
- range={{ begin: 0, end: list?.length || 0 }}
183
- pageIndex={0}
194
+ range={{
195
+ begin: 0,
196
+ end: list?.length || 0
197
+ }}
184
198
  placeholder={`${i18next.t('区域')} ${index}`}
199
+ pageIndex={0}
200
+ isSomeSubtotalTr={isSomeSubtotalTr}
185
201
  />
186
- )
187
-
202
+ }
188
203
  default:
189
204
  return (
190
205
  <Panel
@@ -224,10 +239,10 @@ class Printer extends React.Component {
224
239
 
225
240
  const end = isAutofillConfig
226
241
  ? panel.end +
227
- Math.floor(
228
- remainPageHeight /
229
- printerStore.computedTableCustomerRowHeight
230
- )
242
+ Math.floor(
243
+ remainPageHeight /
244
+ printerStore.computedTableCustomerRowHeight
245
+ )
231
246
  : panel.end
232
247
  switch (panel.type) {
233
248
  case 'table':
package/.eslintcache DELETED
@@ -1 +0,0 @@
1
- [{"/Users/joke/Desktop/gm-printer/src/printer/printer.js":"1","/Users/joke/Desktop/gm-printer/src/printer/page.js":"2","/Users/joke/Desktop/gm-printer/src/printer/long_print_table/index.js":"3","/Users/joke/Desktop/gm-printer/src/editor/context_menu.js":"4","/Users/joke/Desktop/gm-printer/src/config.js":"5","/Users/joke/Desktop/gm-printer/src/common/editor_select.js":"6","/Users/joke/Desktop/gm-printer/src/common/editor_edit_field.js":"7","/Users/joke/Desktop/gm-printer/src/common/common_context_menu.js":"8"},{"size":12305,"mtime":1728981026281},{"size":1899,"mtime":1728981006613},{"size":11905,"mtime":1728980840768,"results":"9","hashOfConfig":"10"},{"size":6329,"mtime":1728980977665},{"size":3185,"mtime":1728980903446},{"size":6042,"mtime":1728980953458,"results":"11","hashOfConfig":"10"},{"size":24316,"mtime":1728980939561},{"size":9821,"mtime":1728980917598,"results":"12","hashOfConfig":"10"},{"filePath":"13","messages":"14","errorCount":4,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"1ho4xzn",{"filePath":"15","messages":"16","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"17","messages":"18","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"/Users/joke/Desktop/gm-printer/src/printer/long_print_table/index.js",["19","20","21","22"],"/Users/joke/Desktop/gm-printer/src/common/editor_select.js",[],"/Users/joke/Desktop/gm-printer/src/common/common_context_menu.js",[],{"ruleId":"23","severity":2,"message":"24","line":100,"column":26,"nodeType":"25","endLine":100,"endColumn":33},{"ruleId":"26","severity":2,"message":"27","line":240,"column":5,"nodeType":"28","endLine":339,"endColumn":6},{"ruleId":"29","severity":2,"message":"30","line":257,"column":22,"nodeType":"25","messageId":"31","endLine":257,"endColumn":32},{"ruleId":"29","severity":2,"message":"30","line":297,"column":30,"nodeType":"25","messageId":"31","endLine":297,"endColumn":40},"no-unused-vars","'dataKey' is assigned a value but never used.","Identifier","no-unreachable","Unreachable code.","ReturnStatement","no-undef","'getTdStyle' is not defined.","undef"]