docs/barcode: eslint auto-fixes
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
81f5d03e8d
commit
70dc2ff3ab
@ -53,7 +53,7 @@ let code39_codes = {
|
|||||||
"0": ['b', 's', 'b', 'S', 'B', 's', 'B', 's', 'b'],
|
"0": ['b', 's', 'b', 'S', 'B', 's', 'B', 's', 'b'],
|
||||||
"J": ['b', 's', 'b', 's', 'B', 'S', 'B', 's', 'b'],
|
"J": ['b', 's', 'b', 's', 'B', 'S', 'B', 's', 'b'],
|
||||||
"T": ['b', 's', 'b', 's', 'B', 's', 'B', 'S', 'b'],
|
"T": ['b', 's', 'b', 's', 'B', 's', 'B', 'S', 'b'],
|
||||||
"*": ['b', 'S', 'b', 's', 'B', 's', 'B', 's', 'b']
|
"*": ['b', 'S', 'b', 's', 'B', 's', 'B', 's', 'b'],
|
||||||
};
|
};
|
||||||
|
|
||||||
let colors = [
|
let colors = [
|
||||||
@ -66,25 +66,22 @@ let colors = [
|
|||||||
'#E27B99',
|
'#E27B99',
|
||||||
'#67A945',
|
'#67A945',
|
||||||
'#F6B855',
|
'#F6B855',
|
||||||
'#705A81'
|
'#705A81',
|
||||||
];
|
];
|
||||||
|
|
||||||
let lto_label_width = 70;
|
let lto_label_width = 70;
|
||||||
let lto_label_height = 17;
|
let lto_label_height = 17;
|
||||||
|
|
||||||
function foreach_label(page_layout, callback) {
|
function foreach_label(page_layout, callback) {
|
||||||
|
|
||||||
let count = 0;
|
let count = 0;
|
||||||
let row = 0;
|
let row = 0;
|
||||||
let height = page_layout.margin_top;
|
let height = page_layout.margin_top;
|
||||||
|
|
||||||
while ((height + page_layout.label_height) <= page_layout.page_height) {
|
while ((height + page_layout.label_height) <= page_layout.page_height) {
|
||||||
|
|
||||||
let column = 0;
|
let column = 0;
|
||||||
let width = page_layout.margin_left;
|
let width = page_layout.margin_left;
|
||||||
|
|
||||||
while ((width + page_layout.label_width) <= page_layout.page_width) {
|
while ((width + page_layout.label_width) <= page_layout.page_width) {
|
||||||
|
|
||||||
callback(column, row, count, width, height);
|
callback(column, row, count, width, height);
|
||||||
count += 1;
|
count += 1;
|
||||||
|
|
||||||
@ -97,11 +94,9 @@ function foreach_label(page_layout, callback) {
|
|||||||
height += page_layout.label_height;
|
height += page_layout.label_height;
|
||||||
height += page_layout.row_spacing;
|
height += page_layout.row_spacing;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function compute_max_labels(page_layout) {
|
function compute_max_labels(page_layout) {
|
||||||
|
|
||||||
let max_labels = 0;
|
let max_labels = 0;
|
||||||
foreach_label(page_layout, function() { max_labels += 1; });
|
foreach_label(page_layout, function() { max_labels += 1; });
|
||||||
return max_labels;
|
return max_labels;
|
||||||
@ -186,7 +181,6 @@ function svg_label(mode, label, label_type, pagex, pagey, label_borders) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (let c of code) {
|
for (let c of code) {
|
||||||
|
|
||||||
if (c === 's') {
|
if (c === 's') {
|
||||||
xpos += small;
|
xpos += small;
|
||||||
continue;
|
continue;
|
||||||
@ -216,7 +210,7 @@ function html_page_header() {
|
|||||||
/* no page margins */
|
/* no page margins */
|
||||||
html += "@page{margin-left: 0px;margin-right: 0px;margin-top: 0px;margin-bottom: 0px;}";
|
html += "@page{margin-left: 0px;margin-right: 0px;margin-top: 0px;margin-bottom: 0px;}";
|
||||||
/* to hide things on printed page */
|
/* to hide things on printed page */
|
||||||
html += "@media print { .unprintable { visibility: hidden; } }";
|
html += "@media print { .unprintable { visibility: hidden; } }";
|
||||||
|
|
||||||
html += "</style>";
|
html += "</style>";
|
||||||
|
|
||||||
@ -241,7 +235,6 @@ function printBarcodePage() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function generate_barcode_page(target_id, page_layout, label_list, calibration) {
|
function generate_barcode_page(target_id, page_layout, label_list, calibration) {
|
||||||
|
|
||||||
let svg = svg_page_header(page_layout.page_width, page_layout.page_height);
|
let svg = svg_page_header(page_layout.page_width, page_layout.page_height);
|
||||||
|
|
||||||
let c = calibration;
|
let c = calibration;
|
||||||
@ -255,7 +248,6 @@ function generate_barcode_page(target_id, page_layout, label_list, calibration)
|
|||||||
svg += '>';
|
svg += '>';
|
||||||
|
|
||||||
foreach_label(page_layout, function(column, row, count, xpos, ypos) {
|
foreach_label(page_layout, function(column, row, count, xpos, ypos) {
|
||||||
|
|
||||||
if (count >= label_list.length) { return; }
|
if (count >= label_list.length) { return; }
|
||||||
|
|
||||||
let item = label_list[count];
|
let item = label_list[count];
|
||||||
@ -297,12 +289,11 @@ function setupPrintFrame(frame, page_width, page_height) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function generate_calibration_page(target_id, page_layout, calibration) {
|
function generate_calibration_page(target_id, page_layout, calibration) {
|
||||||
|
|
||||||
let frame = document.getElementById(target_id);
|
let frame = document.getElementById(target_id);
|
||||||
|
|
||||||
setupPrintFrame(frame, page_layout.page_width, page_layout.page_height);
|
setupPrintFrame(frame, page_layout.page_width, page_layout.page_height);
|
||||||
|
|
||||||
let svg = svg_page_header( page_layout.page_width, page_layout.page_height);
|
let svg = svg_page_header(page_layout.page_width, page_layout.page_height);
|
||||||
|
|
||||||
svg += "<defs>";
|
svg += "<defs>";
|
||||||
svg += "<marker id='endarrow' markerWidth='10' markerHeight='7' ";
|
svg += "<marker id='endarrow' markerWidth='10' markerHeight='7' ";
|
||||||
|
@ -4,7 +4,7 @@ Ext.define('LabelList', {
|
|||||||
|
|
||||||
plugins: {
|
plugins: {
|
||||||
ptype: 'cellediting',
|
ptype: 'cellediting',
|
||||||
clicksToEdit: 1
|
clicksToEdit: 1,
|
||||||
},
|
},
|
||||||
|
|
||||||
selModel: 'cellmodel',
|
selModel: 'cellmodel',
|
||||||
@ -44,7 +44,7 @@ Ext.define('LabelList', {
|
|||||||
xtype: 'prefixfield',
|
xtype: 'prefixfield',
|
||||||
allowBlank: false,
|
allowBlank: false,
|
||||||
},
|
},
|
||||||
renderer: function (value, metaData, record) {
|
renderer: function(value, metaData, record) {
|
||||||
console.log(record);
|
console.log(record);
|
||||||
if (record.data.mode === 'placeholder') {
|
if (record.data.mode === 'placeholder') {
|
||||||
return "-";
|
return "-";
|
||||||
@ -60,7 +60,7 @@ Ext.define('LabelList', {
|
|||||||
xtype: 'ltoTapeType',
|
xtype: 'ltoTapeType',
|
||||||
allowBlank: false,
|
allowBlank: false,
|
||||||
},
|
},
|
||||||
renderer: function (value, metaData, record) {
|
renderer: function(value, metaData, record) {
|
||||||
console.log(record);
|
console.log(record);
|
||||||
if (record.data.mode === 'placeholder') {
|
if (record.data.mode === 'placeholder') {
|
||||||
return "-";
|
return "-";
|
||||||
@ -133,7 +133,7 @@ Ext.define('LabelList', {
|
|||||||
handler: function(grid, rowIndex) {
|
handler: function(grid, rowIndex) {
|
||||||
grid.getStore().removeAt(rowIndex);
|
grid.getStore().removeAt(rowIndex);
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -4,7 +4,6 @@ if (Ext.isFirefox) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function draw_labels(target_id, label_list, page_layout, calibration) {
|
function draw_labels(target_id, label_list, page_layout, calibration) {
|
||||||
|
|
||||||
let max_labels = compute_max_labels(page_layout);
|
let max_labels = compute_max_labels(page_layout);
|
||||||
|
|
||||||
let count_fixed = 0;
|
let count_fixed = 0;
|
||||||
@ -44,20 +43,16 @@ function draw_labels(target_id, label_list, page_layout, calibration) {
|
|||||||
count = fill_size;
|
count = fill_size;
|
||||||
}
|
}
|
||||||
rest -= count;
|
rest -= count;
|
||||||
|
} else if (item.end <= item.start) {
|
||||||
|
count = 1;
|
||||||
} else {
|
} else {
|
||||||
if (item.end <= item.start) {
|
count = (item.end - item.start) + 1;
|
||||||
count = 1;
|
|
||||||
} else {
|
|
||||||
count = (item.end - item.start) + 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (j = 0; j < count; j++) {
|
for (j = 0; j < count; j++) {
|
||||||
|
|
||||||
let id = item.start + j;
|
let id = item.start + j;
|
||||||
|
|
||||||
if (item.prefix.length == 6) {
|
if (item.prefix.length == 6) {
|
||||||
|
|
||||||
list.push({
|
list.push({
|
||||||
label: item.prefix,
|
label: item.prefix,
|
||||||
tape_type: item.tape_type,
|
tape_type: item.tape_type,
|
||||||
@ -66,9 +61,7 @@ function draw_labels(target_id, label_list, page_layout, calibration) {
|
|||||||
});
|
});
|
||||||
rest += count - j - 1;
|
rest += count - j - 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
let pad_len = 6-item.prefix.length;
|
let pad_len = 6-item.prefix.length;
|
||||||
let label = item.prefix + id.toString().padStart(pad_len, 0);
|
let label = item.prefix + id.toString().padStart(pad_len, 0);
|
||||||
|
|
||||||
@ -115,10 +108,10 @@ Ext.define('MainView', {
|
|||||||
label_list.push(record.data);
|
label_list.push(record.data);
|
||||||
});
|
});
|
||||||
|
|
||||||
let page_layout_view = view.down("pageLayoutPanel");
|
let page_layout_view = view.down("pageLayoutPanel");
|
||||||
let page_layout = page_layout_view.getValues();
|
let page_layout = page_layout_view.getValues();
|
||||||
|
|
||||||
let calibration_view = view.down("pageCalibration");
|
let calibration_view = view.down("pageCalibration");
|
||||||
let page_calibration = calibration_view.getValues();
|
let page_calibration = calibration_view.getValues();
|
||||||
|
|
||||||
draw_labels("print_frame", label_list, page_layout, page_calibration);
|
draw_labels("print_frame", label_list, page_layout, page_calibration);
|
||||||
@ -127,10 +120,10 @@ Ext.define('MainView', {
|
|||||||
update_calibration_preview: function() {
|
update_calibration_preview: function() {
|
||||||
let me = this;
|
let me = this;
|
||||||
let view = me.getView();
|
let view = me.getView();
|
||||||
let page_layout_view = view.down("pageLayoutPanel");
|
let page_layout_view = view.down("pageLayoutPanel");
|
||||||
let page_layout = page_layout_view.getValues();
|
let page_layout = page_layout_view.getValues();
|
||||||
|
|
||||||
let calibration_view = view.down("pageCalibration");
|
let calibration_view = view.down("pageCalibration");
|
||||||
let page_calibration = calibration_view.getValues();
|
let page_calibration = calibration_view.getValues();
|
||||||
console.log(page_calibration);
|
console.log(page_calibration);
|
||||||
generate_calibration_page('print_frame', page_layout, page_calibration);
|
generate_calibration_page('print_frame', page_layout, page_calibration);
|
||||||
@ -195,19 +188,18 @@ Ext.define('MainView', {
|
|||||||
border: false,
|
border: false,
|
||||||
flex: 1,
|
flex: 1,
|
||||||
scrollable: true,
|
scrollable: true,
|
||||||
tools:[{
|
tools: [{
|
||||||
type: 'print',
|
type: 'print',
|
||||||
tooltip: 'Open Print Dialog',
|
tooltip: 'Open Print Dialog',
|
||||||
handler: function(event, toolEl, panelHeader) {
|
handler: function(event, toolEl, panelHeader) {
|
||||||
printBarcodePage();
|
printBarcodePage();
|
||||||
}
|
},
|
||||||
}],
|
}],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
Ext.onReady(function() {
|
Ext.onReady(function() {
|
||||||
|
|
||||||
Ext.create('MainView', {
|
Ext.create('MainView', {
|
||||||
renderTo: Ext.getBody(),
|
renderTo: Ext.getBody(),
|
||||||
});
|
});
|
||||||
|
@ -139,4 +139,4 @@ Ext.define('PageCalibration', {
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
})
|
});
|
||||||
|
@ -21,7 +21,7 @@ let paper_sizes = {
|
|||||||
column_spacing: 0,
|
column_spacing: 0,
|
||||||
row_spacing: 0,
|
row_spacing: 0,
|
||||||
},
|
},
|
||||||
}
|
};
|
||||||
|
|
||||||
function paper_size_combo_data() {
|
function paper_size_combo_data() {
|
||||||
let data = [];
|
let data = [];
|
||||||
|
Loading…
Reference in New Issue
Block a user