@nice2dev/ui-printing 1.2.1 → 1.2.2

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": "@nice2dev/ui-printing",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "description": "React components for print management: template editor, template browser, print preview, print queue and print button",
5
5
  "keywords": [
6
6
  "printing",
@@ -50,7 +50,7 @@
50
50
  "@nice2dev/ui": "^1.2.0"
51
51
  },
52
52
  "devDependencies": {
53
- "@nice2dev/ui": "^1.2.1",
53
+ "@nice2dev/ui": "^1.2.2",
54
54
  "@types/react": "^19.2.18",
55
55
  "@types/react-dom": "^19.2.7",
56
56
  "@vitejs/plugin-react": "^4.7.0",
@@ -139,7 +139,7 @@ export const NicePrintButton: React.FC<NicePrintButtonProps> = ({
139
139
  >
140
140
  {p.name}{' '}
141
141
  {p.status === 'offline' || (!p.isOnline && p.status == null)
142
- ? '(Offline)'
142
+ ? t('printing.offline', '(Offline)')
143
143
  : p.status === 'busy'
144
144
  ? `(${t('printing.printerBusyLabel', 'Busy')})`
145
145
  : ''}
@@ -161,7 +161,7 @@ export const NicePrintButton: React.FC<NicePrintButtonProps> = ({
161
161
  : s === 'busy'
162
162
  ? t('printing.printerBusyLabel', 'Busy')
163
163
  : s === 'offline'
164
- ? 'Offline'
164
+ ? t('printing.offline2', 'Offline')
165
165
  : t('printing.printerError', 'Error')}
166
166
  </span>
167
167
  </>
@@ -370,7 +370,10 @@ export const NicePrintPreview: React.FC<NicePrintPreviewProps> = ({
370
370
  <div className={styles.footerBar}>
371
371
  <span>{template.name}</span>
372
372
  <span>
373
- {template.paperSize} · {template.orientation === 'portrait' ? 'Pion' : 'Poziom'}
373
+ {template.paperSize} ·{' '}
374
+ {template.orientation === 'portrait'
375
+ ? t('printing.portrait', 'Portrait')
376
+ : t('printing.landscape', 'Landscape')}
374
377
  </span>
375
378
  {template.sections.reduce((acc, s) => acc + s.fields.length, 0)}{' '}
376
379
  {t('printing.fields', 'fields')}
@@ -286,6 +286,7 @@ const FieldElement: React.FC<FieldElementProps> = ({
286
286
  onResizeStart,
287
287
  readOnly,
288
288
  }) => {
289
+ const { t } = useNiceTranslation();
289
290
  const pos = field.position;
290
291
  const st = field.style;
291
292
  const mm = (v: number) => v * zoom * MM_TO_PX;
@@ -345,7 +346,7 @@ const FieldElement: React.FC<FieldElementProps> = ({
345
346
  ) : isBarcode ? (
346
347
  <div className={styles.fieldBarcodePlaceholder}>
347
348
  <NiceIcon name={field.type === 'qr' ? 'qr-code' : 'barcode'} size={14} />{' '}
348
- {field.type === 'qr' ? 'QR' : 'Barcode'}
349
+ {field.type === 'qr' ? 'QR' : t('templateEditor.barcode', 'Barcode')}
349
350
  </div>
350
351
  ) : field.type === 'signature' ? (
351
352
  <div className={styles.fieldSignaturePlaceholder}>
@@ -1121,7 +1122,7 @@ const LeftPanel: React.FC<LeftPanelProps> = ({
1121
1122
  {
1122
1123
  id: uid(),
1123
1124
  type: 'text',
1124
- text: 'COPY',
1125
+ text: t('templateEditor.copy', 'COPY'),
1125
1126
  opacity: 0.12,
1126
1127
  angle: -45,
1127
1128
  fontSize: 60,
@@ -1298,7 +1299,7 @@ const LeftPanel: React.FC<LeftPanelProps> = ({
1298
1299
  onUpdateTpl({ margins: { ...tpl.margins, [side]: +e.target.value } })
1299
1300
  }
1300
1301
  />
1301
- <span className={styles.settingsUnit}>mm</span>
1302
+ <span className={styles.settingsUnit}>{t('templateEditor.mm', 'mm')}</span>
1302
1303
  </div>
1303
1304
  ))}
1304
1305
  </div>
@@ -1409,8 +1410,8 @@ const PropertiesPanel: React.FC<PropertiesPanelProps> = ({
1409
1410
  {[
1410
1411
  { key: 'x' as const, label: 'X', unit: 'mm' },
1411
1412
  { key: 'y' as const, label: 'Y', unit: 'mm' },
1412
- { key: 'width' as const, label: 'Szer.', unit: 'mm' },
1413
- { key: 'height' as const, label: 'Wys.', unit: 'mm' },
1413
+ { key: 'width' as const, label: t('templateEditor.widthShort', 'W'), unit: 'mm' },
1414
+ { key: 'height' as const, label: t('templateEditor.heightShort', 'H'), unit: 'mm' },
1414
1415
  ].map(({ key, label, unit }) => (
1415
1416
  <div key={key} className={styles.posCell}>
1416
1417
  <label className={styles.posLabel}>{label}</label>
@@ -1693,7 +1694,7 @@ const PropertiesPanel: React.FC<PropertiesPanelProps> = ({
1693
1694
  value={field.style.padding ?? 0}
1694
1695
  onChange={(e) => s({ padding: +e.target.value })}
1695
1696
  />
1696
- <span className={styles.styleUnit}>mm</span>
1697
+ <span className={styles.styleUnit}>{t('templateEditor.mm', 'mm')}</span>
1697
1698
  </div>
1698
1699
  <div className={styles.styleRow}>
1699
1700
  <label className={styles.styleLabel}>
@@ -1838,9 +1839,9 @@ const PropertiesPanel: React.FC<PropertiesPanelProps> = ({
1838
1839
  >
1839
1840
  <option value="eq">= {tr('printing.editor.opEqual', 'equal')}</option>
1840
1841
  <option value="neq">≠ {tr('printing.editor.opNotEqual', 'not equal')}</option>
1841
- <option value="gt">&gt; wieksze</option>
1842
- <option value="lt">&lt; mniejsze</option>
1843
- <option value="contains">zawiera</option>
1842
+ <option value="gt">{t('templateEditor.greaterThan', '> greater than')}</option>
1843
+ <option value="lt">{t('templateEditor.lessThan', '< less than')}</option>
1844
+ <option value="contains">{t('templateEditor.contains', 'contains')}</option>
1844
1845
  </select>
1845
1846
  </div>
1846
1847
  <div className={styles.styleRow}>
@@ -1906,6 +1907,7 @@ export const NiceTemplateEditor: React.FC<NiceTemplateEditorProps> = ({
1906
1907
  style,
1907
1908
  theme = 'light',
1908
1909
  }) => {
1910
+ const { t } = useNiceTranslation();
1909
1911
  const [{ past, present: tpl, future }, dispatch] = useReducer(historyReducer, {
1910
1912
  past: [],
1911
1913
  present: initialTemplate ?? defaultTemplate(),
@@ -1984,7 +1986,7 @@ export const NiceTemplateEditor: React.FC<NiceTemplateEditorProps> = ({
1984
1986
  {
1985
1987
  id: uid(),
1986
1988
  type: 'text',
1987
- text: 'COPY',
1989
+ text: t('templateEditor.copy', 'COPY'),
1988
1990
  opacity: 0.12,
1989
1991
  angle: -45,
1990
1992
  fontSize: 60,
@@ -2027,7 +2029,7 @@ export const NiceTemplateEditor: React.FC<NiceTemplateEditorProps> = ({
2027
2029
  onChange?.({ ...tpl, ...updated });
2028
2030
  setSelectedIds(new Set([field.id]));
2029
2031
  },
2030
- [tpl, activeSection, onChange],
2032
+ [tpl, activeSection, onChange, t, tr, update],
2031
2033
  );
2032
2034
 
2033
2035
  // -- Drop from left panel --