1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
Polymer({
is: 'print-preview-margins-settings',
behaviors: [SettingsBehavior, print_preview.SelectBehavior],
properties: {
disabled: Boolean,
/** Mirroring the enum so that it can be used from HTML bindings. */
MarginsTypeEnum: Object,
},
observers: ['onMarginsSettingChange_(settings.margins.value)'],
/** @override */
ready: function() {
this.MarginsTypeEnum = print_preview.MarginsType;
},
/**
* @param {*} newValue The new value of the margins setting.
* @private
*/
onMarginsSettingChange_: function(newValue) {
this.selectedValue =
/** @type {!print_preview.MarginsType} */ (newValue).toString();
},
/** @param {string} value The new select value. */
onProcessSelectChange: function(value) {
this.setSetting('margins', parseInt(value, 10));
},
/**
* @param {boolean} globallyDisabled Value of the |disabled| property.
* @param {number} pagesPerSheet Number of pages per sheet.
* @return {boolean} Whether the margins settings button should be disabled.
* @private
*/
getMarginsSettingsDisabled_: function(globallyDisabled, pagesPerSheet) {
return globallyDisabled || pagesPerSheet > 1;
},
});
|