@ezeep/ezeep-js 1.0.246 → 1.0.248

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.
@@ -33126,6 +33126,10 @@ let EzpPrinterSelection = class {
33126
33126
  case 'not-supported':
33127
33127
  this.noPrinters = false;
33128
33128
  break;
33129
+ case 'no-printers':
33130
+ this.noPrinters = false;
33131
+ this.printCancel.emit();
33132
+ break;
33129
33133
  }
33130
33134
  }
33131
33135
  listenStatusRetry(event) {
@@ -33603,7 +33607,7 @@ let EzpPrinterSelection = class {
33603
33607
  })), preSelected: this.selectedPrinter.id &&
33604
33608
  ((_o = this.selectedPrinterConfig.Trays) === null || _o === void 0 ? void 0 : _o.find((el) => el.Name.includes(this.selectedPrinterConfig.Default.Tray)))
33605
33609
  ? this.selectedPrinterConfig.Default.Tray
33606
- : null })) : null, index.h("ezp-input", { icon: "paper_range", suffix: "", placeholder: "1-2,4-5,8", value: this.selectedProperties.PageRanges, eventType: "paper_ranges", type: "text", label: i18next.t('printer_selection.page_ranges') })), index.h("ezp-stepper", { label: i18next.t('printer_selection.copies'), max: 10, icon: "copies" })), index.h("div", { id: "footer" }, index.h("ezp-text-button", { type: "button", level: "secondary", onClick: this.handleCancel, label: i18next.t('button_actions.cancel'), class: "action", id: "cancel" }), index.h("ezp-text-button", { disabled: this.selectedPrinter.id === '' || this.printProcessing || this.pageRangeInvalid, type: "button", onClick: this.handlePrint, label: i18next.t('button_actions.print'), ref: (button) => (this.printButton = button), class: "action", id: "print" })), !this.hidemenu && index.h("ezp-user-menu", { open: this.userMenuOpen, name: this.userName }))));
33610
+ : null })) : null, index.h("ezp-input", { icon: "paper_range", suffix: "", placeholder: "1-2,4-5,8", value: this.selectedProperties.PageRanges, eventType: "paper_ranges", type: "text", label: i18next.t('printer_selection.page_ranges') })), index.h("ezp-stepper", { label: i18next.t('printer_selection.copies'), icon: "copies" })), index.h("div", { id: "footer" }, index.h("ezp-text-button", { type: "button", level: "secondary", onClick: this.handleCancel, label: i18next.t('button_actions.cancel'), class: "action", id: "cancel" }), index.h("ezp-text-button", { disabled: this.selectedPrinter.id === '' || this.printProcessing || this.pageRangeInvalid, type: "button", onClick: this.handlePrint, label: i18next.t('button_actions.print'), ref: (button) => (this.printButton = button), class: "action", id: "print" })), !this.hidemenu && index.h("ezp-user-menu", { open: this.userMenuOpen, name: this.userName }))));
33607
33611
  }
33608
33612
  };
33609
33613
  EzpPrinterSelection.style = ezpPrinterSelectionCss;
@@ -34093,13 +34097,54 @@ let EzpStepper = class {
34093
34097
  *
34094
34098
  */
34095
34099
  this.handleDecrease = () => {
34096
- this.value--;
34100
+ const newValue = this.value - 1;
34101
+ // Only decrease if within safe range and above minimum
34102
+ if (newValue >= Number.MIN_SAFE_INTEGER && (this.min === undefined || newValue >= this.min)) {
34103
+ this.value = newValue;
34104
+ }
34097
34105
  };
34098
34106
  this.handleIncrease = () => {
34099
- this.value++;
34107
+ const newValue = this.value + 1;
34108
+ const effectiveMax = this.max !== undefined ? Math.min(this.max, Number.MAX_SAFE_INTEGER) : Number.MAX_SAFE_INTEGER;
34109
+ // Only increase if within safe range and below maximum
34110
+ if (newValue <= Number.MAX_SAFE_INTEGER && newValue <= effectiveMax) {
34111
+ this.value = newValue;
34112
+ }
34100
34113
  };
34101
34114
  this.handleInput = () => {
34102
- this.value = this.input.value !== '' ? parseInt(this.input.value) : this.min;
34115
+ if (!this.input)
34116
+ return;
34117
+ let inputString = this.input.value.trim();
34118
+ // If the input is empty, set the value to the minimum
34119
+ if (inputString === '') {
34120
+ this.value = this.min;
34121
+ this.input.value = this.value.toString();
34122
+ return;
34123
+ }
34124
+ // Remove all non-digit characters, keep only numbers
34125
+ const cleanedInput = inputString.replace(/\D/g, '');
34126
+ // If nothing remains after cleaning, revert to the last valid value
34127
+ if (cleanedInput === '') {
34128
+ this.input.value = this.value.toString();
34129
+ return;
34130
+ }
34131
+ // Limit input length to prevent precision loss (MAX_SAFE_INTEGER has 16 digits)
34132
+ const maxDigits = Number.MAX_SAFE_INTEGER.toString().length;
34133
+ const truncatedInput = cleanedInput.slice(0, maxDigits);
34134
+ let inputValue = Number(truncatedInput);
34135
+ // Safety check: ensure the number is within safe integer range
34136
+ if (inputValue > Number.MAX_SAFE_INTEGER) {
34137
+ inputValue = Number.MAX_SAFE_INTEGER;
34138
+ }
34139
+ // Ensure the value is between min and max
34140
+ if (this.min !== undefined && inputValue < this.min)
34141
+ inputValue = this.min;
34142
+ const effectiveMax = this.max !== undefined ? Math.min(this.max, Number.MAX_SAFE_INTEGER) : Number.MAX_SAFE_INTEGER;
34143
+ if (inputValue > effectiveMax)
34144
+ inputValue = effectiveMax;
34145
+ // Update component state and input field
34146
+ this.value = inputValue;
34147
+ this.input.value = inputValue.toString();
34103
34148
  };
34104
34149
  this.setFocus = () => {
34105
34150
  this.input.focus();
@@ -34110,6 +34155,18 @@ let EzpStepper = class {
34110
34155
  this.handleFocus = () => {
34111
34156
  this.focused = true;
34112
34157
  };
34158
+ this.handleKeyDown = (event) => {
34159
+ // If key is allowed or a Ctrl/Cmd combination, do nothing
34160
+ if (EzpStepper.ALLOWED_KEYS.includes(event.key) ||
34161
+ ((event.ctrlKey || event.metaKey) && EzpStepper.CTRL_CMD_KEYS.includes(event.key.toLowerCase()))) {
34162
+ return;
34163
+ }
34164
+ // If the key is not a digit, prevent default behavior (block input)
34165
+ const isDigit = /^\d$/.test(event.key);
34166
+ if (!isDigit) {
34167
+ event.preventDefault();
34168
+ }
34169
+ };
34113
34170
  }
34114
34171
  /**
34115
34172
  *
@@ -34117,7 +34174,8 @@ let EzpStepper = class {
34117
34174
  *
34118
34175
  */
34119
34176
  watchValue() {
34120
- this.canIncrease = this.max !== undefined ? this.value < this.max : true;
34177
+ const effectiveMax = this.max !== undefined ? Math.min(this.max, Number.MAX_SAFE_INTEGER) : Number.MAX_SAFE_INTEGER;
34178
+ this.canIncrease = this.value < effectiveMax;
34121
34179
  this.canDecrease = this.min !== undefined ? this.value > this.min : true;
34122
34180
  this.stepperChanged.emit(this.value);
34123
34181
  }
@@ -34135,12 +34193,24 @@ let EzpStepper = class {
34135
34193
  *
34136
34194
  */
34137
34195
  render() {
34138
- return (index.h(index.Host, { class: `${this.focused ? 'focused' : ''} ${this.icon ? 'has-icon' : ''}` }, index.h("div", { id: "toggle", onClick: this.setFocus }), this.icon ? index.h("ezp-icon", { id: "icon", name: this.icon }) : null, index.h("ezp-label", { id: "label", noWrap: true, text: this.label }), index.h("input", { id: "input", type: "number", ref: (input) => (this.input = input), min: this.min.toString(), max: this.max.toString(), value: this.value.toString(), onInput: this.handleInput, onFocus: this.handleFocus, onBlur: this.handleBlur }), index.h("div", { class: "buttons" }, index.h("button", { class: "button", disabled: !this.canDecrease, onClick: this.handleDecrease }, index.h("ezp-icon", { name: "minus" })), index.h("button", { class: "button", disabled: !this.canIncrease, onClick: this.handleIncrease }, index.h("ezp-icon", { name: "plus" })))));
34196
+ return (index.h(index.Host, { class: `${this.focused ? 'focused' : ''} ${this.icon ? 'has-icon' : ''}` }, index.h("div", { id: "toggle", onClick: this.setFocus }), this.icon ? index.h("ezp-icon", { id: "icon", name: this.icon }) : null, index.h("ezp-label", { id: "label", noWrap: true, text: this.label }), index.h("input", { id: "input", type: "number", ref: (input) => (this.input = input), min: this.min.toString(), max: this.max !== undefined ? this.max.toString() : undefined, value: this.value.toString(), onInput: this.handleInput, onKeyDown: this.handleKeyDown, onFocus: this.handleFocus, onBlur: this.handleBlur }), index.h("div", { class: "buttons" }, index.h("button", { class: "button", disabled: !this.canDecrease, onClick: this.handleDecrease }, index.h("ezp-icon", { name: "minus" })), index.h("button", { class: "button", disabled: !this.canIncrease, onClick: this.handleIncrease }, index.h("ezp-icon", { name: "plus" })))));
34139
34197
  }
34140
34198
  static get watchers() { return {
34141
34199
  "value": ["watchValue"]
34142
34200
  }; }
34143
34201
  };
34202
+ EzpStepper.ALLOWED_KEYS = [
34203
+ 'Backspace',
34204
+ 'Delete',
34205
+ 'Tab',
34206
+ 'Escape',
34207
+ 'Enter',
34208
+ 'ArrowLeft',
34209
+ 'ArrowUp',
34210
+ 'ArrowRight',
34211
+ 'ArrowDown',
34212
+ ];
34213
+ EzpStepper.CTRL_CMD_KEYS = ['a', 'c', 'v', 'x'];
34144
34214
  EzpStepper.style = ezpStepperCss;
34145
34215
 
34146
34216
  const ezpTextButtonCss = ":host{display:-ms-flexbox;display:flex}:host(.primary){--ezp-textButton-background-disabled:var(--ezp-core-shade-primary);--ezp-textButton-background-init:var(--ezp-theme-solid);--ezp-textButton-color-disabled:var(--ezp-core-foreground-tertiary);--ezp-textButton-color-init:var(--ezp-white-100);--ezp-textButton-opacity-active:0.74;--ezp-textButton-opacity-hover:0.84}:host(.secondary){--ezp-textButton-background-active:var(--ezp-core-shade-tertiary);--ezp-textButton-background-disabled:var(--ezp-core-shade-primary);--ezp-textButton-background-hover:var(--ezp-core-shade-secondary);--ezp-textButton-background-init:var(--ezp-core-shade-primary);--ezp-textButton-color-disabled:var(--ezp-core-foreground-tertiary);--ezp-textButton-color-init:var(--ezp-theme-solid)}:host(.tertiary){--ezp-textButton-background-active:var(--ezp-core-shade-secondary);--ezp-textButton-background-disabled:transparent;--ezp-textButton-background-hover:var(--ezp-core-shade-primary);--ezp-textButton-background-init:transparent;--ezp-textButton-color-disabled:var(--ezp-core-foreground-tertiary);--ezp-textButton-color-init:var(--ezp-theme-solid)}#button{-ms-flex-align:center;align-items:center;-webkit-appearance:none;-moz-appearance:none;appearance:none;background:var(--ezp-textButton-background, var(--ezp-textButton-background-init));border:0;border-radius:3px;-webkit-box-shadow:none;box-shadow:none;color:var(--ezp-textButton-color, var(--ezp-textButton-color-init));cursor:var(--ezp-textButton-cursor, pointer);display:-ms-flexbox;display:flex;font-family:inherit;-ms-flex-pack:center;justify-content:center;margin:0;opacity:var(--ezp-textButton-opacity, 1);outline:none;padding:var(--ezp-spacing-3);white-space:nowrap;width:100%}@media (hover: hover){#button:not(:disabled):hover{--ezp-textButton-background:var(\n --ezp-textButton-background-hover,\n var(--ezp-textButton-background-init)\n );--ezp-textButton-opacity:var(--ezp-textButton-opacity-hover, 1)}#button:not(:disabled):active{--ezp-textButton-background:var(\n --ezp-textButton-background-active,\n var(--ezp-textButton-background-init)\n );--ezp-textButton-opacity:var(--ezp-textButton-opacity-active, 1)}}#button:disabled{--ezp-textButton-background:var(--ezp-textButton-background-disabled);--ezp-textButton-color:var(--ezp-textButton-color-disabled);--ezp-textButton-cursor:default}#label{pointer-events:none}";
@@ -358,6 +358,10 @@ export class EzpPrinterSelection {
358
358
  case 'not-supported':
359
359
  this.noPrinters = false;
360
360
  break;
361
+ case 'no-printers':
362
+ this.noPrinters = false;
363
+ this.printCancel.emit();
364
+ break;
361
365
  }
362
366
  }
363
367
  listenStatusRetry(event) {
@@ -858,7 +862,7 @@ export class EzpPrinterSelection {
858
862
  ? this.selectedPrinterConfig.Default.Tray
859
863
  : null })) : null,
860
864
  h("ezp-input", { icon: "paper_range", suffix: "", placeholder: "1-2,4-5,8", value: this.selectedProperties.PageRanges, eventType: "paper_ranges", type: "text", label: i18next.t('printer_selection.page_ranges') })),
861
- h("ezp-stepper", { label: i18next.t('printer_selection.copies'), max: 10, icon: "copies" })),
865
+ h("ezp-stepper", { label: i18next.t('printer_selection.copies'), icon: "copies" })),
862
866
  h("div", { id: "footer" },
863
867
  h("ezp-text-button", { type: "button", level: "secondary", onClick: this.handleCancel, label: i18next.t('button_actions.cancel'), class: "action", id: "cancel" }),
864
868
  h("ezp-text-button", { disabled: this.selectedPrinter.id === '' || this.printProcessing || this.pageRangeInvalid, type: "button", onClick: this.handlePrint, label: i18next.t('button_actions.print'), ref: (button) => (this.printButton = button), class: "action", id: "print" })),
@@ -24,13 +24,54 @@ export class EzpStepper {
24
24
  *
25
25
  */
26
26
  this.handleDecrease = () => {
27
- this.value--;
27
+ const newValue = this.value - 1;
28
+ // Only decrease if within safe range and above minimum
29
+ if (newValue >= Number.MIN_SAFE_INTEGER && (this.min === undefined || newValue >= this.min)) {
30
+ this.value = newValue;
31
+ }
28
32
  };
29
33
  this.handleIncrease = () => {
30
- this.value++;
34
+ const newValue = this.value + 1;
35
+ const effectiveMax = this.max !== undefined ? Math.min(this.max, Number.MAX_SAFE_INTEGER) : Number.MAX_SAFE_INTEGER;
36
+ // Only increase if within safe range and below maximum
37
+ if (newValue <= Number.MAX_SAFE_INTEGER && newValue <= effectiveMax) {
38
+ this.value = newValue;
39
+ }
31
40
  };
32
41
  this.handleInput = () => {
33
- this.value = this.input.value !== '' ? parseInt(this.input.value) : this.min;
42
+ if (!this.input)
43
+ return;
44
+ let inputString = this.input.value.trim();
45
+ // If the input is empty, set the value to the minimum
46
+ if (inputString === '') {
47
+ this.value = this.min;
48
+ this.input.value = this.value.toString();
49
+ return;
50
+ }
51
+ // Remove all non-digit characters, keep only numbers
52
+ const cleanedInput = inputString.replace(/\D/g, '');
53
+ // If nothing remains after cleaning, revert to the last valid value
54
+ if (cleanedInput === '') {
55
+ this.input.value = this.value.toString();
56
+ return;
57
+ }
58
+ // Limit input length to prevent precision loss (MAX_SAFE_INTEGER has 16 digits)
59
+ const maxDigits = Number.MAX_SAFE_INTEGER.toString().length;
60
+ const truncatedInput = cleanedInput.slice(0, maxDigits);
61
+ let inputValue = Number(truncatedInput);
62
+ // Safety check: ensure the number is within safe integer range
63
+ if (inputValue > Number.MAX_SAFE_INTEGER) {
64
+ inputValue = Number.MAX_SAFE_INTEGER;
65
+ }
66
+ // Ensure the value is between min and max
67
+ if (this.min !== undefined && inputValue < this.min)
68
+ inputValue = this.min;
69
+ const effectiveMax = this.max !== undefined ? Math.min(this.max, Number.MAX_SAFE_INTEGER) : Number.MAX_SAFE_INTEGER;
70
+ if (inputValue > effectiveMax)
71
+ inputValue = effectiveMax;
72
+ // Update component state and input field
73
+ this.value = inputValue;
74
+ this.input.value = inputValue.toString();
34
75
  };
35
76
  this.setFocus = () => {
36
77
  this.input.focus();
@@ -41,6 +82,18 @@ export class EzpStepper {
41
82
  this.handleFocus = () => {
42
83
  this.focused = true;
43
84
  };
85
+ this.handleKeyDown = (event) => {
86
+ // If key is allowed or a Ctrl/Cmd combination, do nothing
87
+ if (EzpStepper.ALLOWED_KEYS.includes(event.key) ||
88
+ ((event.ctrlKey || event.metaKey) && EzpStepper.CTRL_CMD_KEYS.includes(event.key.toLowerCase()))) {
89
+ return;
90
+ }
91
+ // If the key is not a digit, prevent default behavior (block input)
92
+ const isDigit = /^\d$/.test(event.key);
93
+ if (!isDigit) {
94
+ event.preventDefault();
95
+ }
96
+ };
44
97
  }
45
98
  /**
46
99
  *
@@ -48,7 +101,8 @@ export class EzpStepper {
48
101
  *
49
102
  */
50
103
  watchValue() {
51
- this.canIncrease = this.max !== undefined ? this.value < this.max : true;
104
+ const effectiveMax = this.max !== undefined ? Math.min(this.max, Number.MAX_SAFE_INTEGER) : Number.MAX_SAFE_INTEGER;
105
+ this.canIncrease = this.value < effectiveMax;
52
106
  this.canDecrease = this.min !== undefined ? this.value > this.min : true;
53
107
  this.stepperChanged.emit(this.value);
54
108
  }
@@ -70,7 +124,7 @@ export class EzpStepper {
70
124
  h("div", { id: "toggle", onClick: this.setFocus }),
71
125
  this.icon ? h("ezp-icon", { id: "icon", name: this.icon }) : null,
72
126
  h("ezp-label", { id: "label", noWrap: true, text: this.label }),
73
- h("input", { id: "input", type: "number", ref: (input) => (this.input = input), min: this.min.toString(), max: this.max.toString(), value: this.value.toString(), onInput: this.handleInput, onFocus: this.handleFocus, onBlur: this.handleBlur }),
127
+ h("input", { id: "input", type: "number", ref: (input) => (this.input = input), min: this.min.toString(), max: this.max !== undefined ? this.max.toString() : undefined, value: this.value.toString(), onInput: this.handleInput, onKeyDown: this.handleKeyDown, onFocus: this.handleFocus, onBlur: this.handleBlur }),
74
128
  h("div", { class: "buttons" },
75
129
  h("button", { class: "button", disabled: !this.canDecrease, onClick: this.handleDecrease },
76
130
  h("ezp-icon", { name: "minus" })),
@@ -189,3 +243,15 @@ export class EzpStepper {
189
243
  "methodName": "watchValue"
190
244
  }]; }
191
245
  }
246
+ EzpStepper.ALLOWED_KEYS = [
247
+ 'Backspace',
248
+ 'Delete',
249
+ 'Tab',
250
+ 'Escape',
251
+ 'Enter',
252
+ 'ArrowLeft',
253
+ 'ArrowUp',
254
+ 'ArrowRight',
255
+ 'ArrowDown',
256
+ ];
257
+ EzpStepper.CTRL_CMD_KEYS = ['a', 'c', 'v', 'x'];
@@ -33151,6 +33151,10 @@ let EzpPrinterSelection$1 = class extends HTMLElement {
33151
33151
  case 'not-supported':
33152
33152
  this.noPrinters = false;
33153
33153
  break;
33154
+ case 'no-printers':
33155
+ this.noPrinters = false;
33156
+ this.printCancel.emit();
33157
+ break;
33154
33158
  }
33155
33159
  }
33156
33160
  listenStatusRetry(event) {
@@ -33628,7 +33632,7 @@ let EzpPrinterSelection$1 = class extends HTMLElement {
33628
33632
  })), preSelected: this.selectedPrinter.id &&
33629
33633
  ((_o = this.selectedPrinterConfig.Trays) === null || _o === void 0 ? void 0 : _o.find((el) => el.Name.includes(this.selectedPrinterConfig.Default.Tray)))
33630
33634
  ? this.selectedPrinterConfig.Default.Tray
33631
- : null })) : null, h("ezp-input", { icon: "paper_range", suffix: "", placeholder: "1-2,4-5,8", value: this.selectedProperties.PageRanges, eventType: "paper_ranges", type: "text", label: i18next.t('printer_selection.page_ranges') })), h("ezp-stepper", { label: i18next.t('printer_selection.copies'), max: 10, icon: "copies" })), h("div", { id: "footer" }, h("ezp-text-button", { type: "button", level: "secondary", onClick: this.handleCancel, label: i18next.t('button_actions.cancel'), class: "action", id: "cancel" }), h("ezp-text-button", { disabled: this.selectedPrinter.id === '' || this.printProcessing || this.pageRangeInvalid, type: "button", onClick: this.handlePrint, label: i18next.t('button_actions.print'), ref: (button) => (this.printButton = button), class: "action", id: "print" })), !this.hidemenu && h("ezp-user-menu", { open: this.userMenuOpen, name: this.userName }))));
33635
+ : null })) : null, h("ezp-input", { icon: "paper_range", suffix: "", placeholder: "1-2,4-5,8", value: this.selectedProperties.PageRanges, eventType: "paper_ranges", type: "text", label: i18next.t('printer_selection.page_ranges') })), h("ezp-stepper", { label: i18next.t('printer_selection.copies'), icon: "copies" })), h("div", { id: "footer" }, h("ezp-text-button", { type: "button", level: "secondary", onClick: this.handleCancel, label: i18next.t('button_actions.cancel'), class: "action", id: "cancel" }), h("ezp-text-button", { disabled: this.selectedPrinter.id === '' || this.printProcessing || this.pageRangeInvalid, type: "button", onClick: this.handlePrint, label: i18next.t('button_actions.print'), ref: (button) => (this.printButton = button), class: "action", id: "print" })), !this.hidemenu && h("ezp-user-menu", { open: this.userMenuOpen, name: this.userName }))));
33632
33636
  }
33633
33637
  static get style() { return ezpPrinterSelectionCss; }
33634
33638
  };
@@ -34126,13 +34130,54 @@ let EzpStepper$1 = class extends HTMLElement {
34126
34130
  *
34127
34131
  */
34128
34132
  this.handleDecrease = () => {
34129
- this.value--;
34133
+ const newValue = this.value - 1;
34134
+ // Only decrease if within safe range and above minimum
34135
+ if (newValue >= Number.MIN_SAFE_INTEGER && (this.min === undefined || newValue >= this.min)) {
34136
+ this.value = newValue;
34137
+ }
34130
34138
  };
34131
34139
  this.handleIncrease = () => {
34132
- this.value++;
34140
+ const newValue = this.value + 1;
34141
+ const effectiveMax = this.max !== undefined ? Math.min(this.max, Number.MAX_SAFE_INTEGER) : Number.MAX_SAFE_INTEGER;
34142
+ // Only increase if within safe range and below maximum
34143
+ if (newValue <= Number.MAX_SAFE_INTEGER && newValue <= effectiveMax) {
34144
+ this.value = newValue;
34145
+ }
34133
34146
  };
34134
34147
  this.handleInput = () => {
34135
- this.value = this.input.value !== '' ? parseInt(this.input.value) : this.min;
34148
+ if (!this.input)
34149
+ return;
34150
+ let inputString = this.input.value.trim();
34151
+ // If the input is empty, set the value to the minimum
34152
+ if (inputString === '') {
34153
+ this.value = this.min;
34154
+ this.input.value = this.value.toString();
34155
+ return;
34156
+ }
34157
+ // Remove all non-digit characters, keep only numbers
34158
+ const cleanedInput = inputString.replace(/\D/g, '');
34159
+ // If nothing remains after cleaning, revert to the last valid value
34160
+ if (cleanedInput === '') {
34161
+ this.input.value = this.value.toString();
34162
+ return;
34163
+ }
34164
+ // Limit input length to prevent precision loss (MAX_SAFE_INTEGER has 16 digits)
34165
+ const maxDigits = Number.MAX_SAFE_INTEGER.toString().length;
34166
+ const truncatedInput = cleanedInput.slice(0, maxDigits);
34167
+ let inputValue = Number(truncatedInput);
34168
+ // Safety check: ensure the number is within safe integer range
34169
+ if (inputValue > Number.MAX_SAFE_INTEGER) {
34170
+ inputValue = Number.MAX_SAFE_INTEGER;
34171
+ }
34172
+ // Ensure the value is between min and max
34173
+ if (this.min !== undefined && inputValue < this.min)
34174
+ inputValue = this.min;
34175
+ const effectiveMax = this.max !== undefined ? Math.min(this.max, Number.MAX_SAFE_INTEGER) : Number.MAX_SAFE_INTEGER;
34176
+ if (inputValue > effectiveMax)
34177
+ inputValue = effectiveMax;
34178
+ // Update component state and input field
34179
+ this.value = inputValue;
34180
+ this.input.value = inputValue.toString();
34136
34181
  };
34137
34182
  this.setFocus = () => {
34138
34183
  this.input.focus();
@@ -34143,6 +34188,18 @@ let EzpStepper$1 = class extends HTMLElement {
34143
34188
  this.handleFocus = () => {
34144
34189
  this.focused = true;
34145
34190
  };
34191
+ this.handleKeyDown = (event) => {
34192
+ // If key is allowed or a Ctrl/Cmd combination, do nothing
34193
+ if (EzpStepper$1.ALLOWED_KEYS.includes(event.key) ||
34194
+ ((event.ctrlKey || event.metaKey) && EzpStepper$1.CTRL_CMD_KEYS.includes(event.key.toLowerCase()))) {
34195
+ return;
34196
+ }
34197
+ // If the key is not a digit, prevent default behavior (block input)
34198
+ const isDigit = /^\d$/.test(event.key);
34199
+ if (!isDigit) {
34200
+ event.preventDefault();
34201
+ }
34202
+ };
34146
34203
  }
34147
34204
  /**
34148
34205
  *
@@ -34150,7 +34207,8 @@ let EzpStepper$1 = class extends HTMLElement {
34150
34207
  *
34151
34208
  */
34152
34209
  watchValue() {
34153
- this.canIncrease = this.max !== undefined ? this.value < this.max : true;
34210
+ const effectiveMax = this.max !== undefined ? Math.min(this.max, Number.MAX_SAFE_INTEGER) : Number.MAX_SAFE_INTEGER;
34211
+ this.canIncrease = this.value < effectiveMax;
34154
34212
  this.canDecrease = this.min !== undefined ? this.value > this.min : true;
34155
34213
  this.stepperChanged.emit(this.value);
34156
34214
  }
@@ -34168,13 +34226,25 @@ let EzpStepper$1 = class extends HTMLElement {
34168
34226
  *
34169
34227
  */
34170
34228
  render() {
34171
- return (h(Host, { class: `${this.focused ? 'focused' : ''} ${this.icon ? 'has-icon' : ''}` }, h("div", { id: "toggle", onClick: this.setFocus }), this.icon ? h("ezp-icon", { id: "icon", name: this.icon }) : null, h("ezp-label", { id: "label", noWrap: true, text: this.label }), h("input", { id: "input", type: "number", ref: (input) => (this.input = input), min: this.min.toString(), max: this.max.toString(), value: this.value.toString(), onInput: this.handleInput, onFocus: this.handleFocus, onBlur: this.handleBlur }), h("div", { class: "buttons" }, h("button", { class: "button", disabled: !this.canDecrease, onClick: this.handleDecrease }, h("ezp-icon", { name: "minus" })), h("button", { class: "button", disabled: !this.canIncrease, onClick: this.handleIncrease }, h("ezp-icon", { name: "plus" })))));
34229
+ return (h(Host, { class: `${this.focused ? 'focused' : ''} ${this.icon ? 'has-icon' : ''}` }, h("div", { id: "toggle", onClick: this.setFocus }), this.icon ? h("ezp-icon", { id: "icon", name: this.icon }) : null, h("ezp-label", { id: "label", noWrap: true, text: this.label }), h("input", { id: "input", type: "number", ref: (input) => (this.input = input), min: this.min.toString(), max: this.max !== undefined ? this.max.toString() : undefined, value: this.value.toString(), onInput: this.handleInput, onKeyDown: this.handleKeyDown, onFocus: this.handleFocus, onBlur: this.handleBlur }), h("div", { class: "buttons" }, h("button", { class: "button", disabled: !this.canDecrease, onClick: this.handleDecrease }, h("ezp-icon", { name: "minus" })), h("button", { class: "button", disabled: !this.canIncrease, onClick: this.handleIncrease }, h("ezp-icon", { name: "plus" })))));
34172
34230
  }
34173
34231
  static get watchers() { return {
34174
34232
  "value": ["watchValue"]
34175
34233
  }; }
34176
34234
  static get style() { return ezpStepperCss; }
34177
34235
  };
34236
+ EzpStepper$1.ALLOWED_KEYS = [
34237
+ 'Backspace',
34238
+ 'Delete',
34239
+ 'Tab',
34240
+ 'Escape',
34241
+ 'Enter',
34242
+ 'ArrowLeft',
34243
+ 'ArrowUp',
34244
+ 'ArrowRight',
34245
+ 'ArrowDown',
34246
+ ];
34247
+ EzpStepper$1.CTRL_CMD_KEYS = ['a', 'c', 'v', 'x'];
34178
34248
 
34179
34249
  const ezpTextButtonCss = ":host{display:-ms-flexbox;display:flex}:host(.primary){--ezp-textButton-background-disabled:var(--ezp-core-shade-primary);--ezp-textButton-background-init:var(--ezp-theme-solid);--ezp-textButton-color-disabled:var(--ezp-core-foreground-tertiary);--ezp-textButton-color-init:var(--ezp-white-100);--ezp-textButton-opacity-active:0.74;--ezp-textButton-opacity-hover:0.84}:host(.secondary){--ezp-textButton-background-active:var(--ezp-core-shade-tertiary);--ezp-textButton-background-disabled:var(--ezp-core-shade-primary);--ezp-textButton-background-hover:var(--ezp-core-shade-secondary);--ezp-textButton-background-init:var(--ezp-core-shade-primary);--ezp-textButton-color-disabled:var(--ezp-core-foreground-tertiary);--ezp-textButton-color-init:var(--ezp-theme-solid)}:host(.tertiary){--ezp-textButton-background-active:var(--ezp-core-shade-secondary);--ezp-textButton-background-disabled:transparent;--ezp-textButton-background-hover:var(--ezp-core-shade-primary);--ezp-textButton-background-init:transparent;--ezp-textButton-color-disabled:var(--ezp-core-foreground-tertiary);--ezp-textButton-color-init:var(--ezp-theme-solid)}#button{-ms-flex-align:center;align-items:center;-webkit-appearance:none;-moz-appearance:none;appearance:none;background:var(--ezp-textButton-background, var(--ezp-textButton-background-init));border:0;border-radius:3px;-webkit-box-shadow:none;box-shadow:none;color:var(--ezp-textButton-color, var(--ezp-textButton-color-init));cursor:var(--ezp-textButton-cursor, pointer);display:-ms-flexbox;display:flex;font-family:inherit;-ms-flex-pack:center;justify-content:center;margin:0;opacity:var(--ezp-textButton-opacity, 1);outline:none;padding:var(--ezp-spacing-3);white-space:nowrap;width:100%}@media (hover: hover){#button:not(:disabled):hover{--ezp-textButton-background:var(\n --ezp-textButton-background-hover,\n var(--ezp-textButton-background-init)\n );--ezp-textButton-opacity:var(--ezp-textButton-opacity-hover, 1)}#button:not(:disabled):active{--ezp-textButton-background:var(\n --ezp-textButton-background-active,\n var(--ezp-textButton-background-init)\n );--ezp-textButton-opacity:var(--ezp-textButton-opacity-active, 1)}}#button:disabled{--ezp-textButton-background:var(--ezp-textButton-background-disabled);--ezp-textButton-color:var(--ezp-textButton-color-disabled);--ezp-textButton-cursor:default}#label{pointer-events:none}";
34180
34250
 
@@ -33122,6 +33122,10 @@ let EzpPrinterSelection = class {
33122
33122
  case 'not-supported':
33123
33123
  this.noPrinters = false;
33124
33124
  break;
33125
+ case 'no-printers':
33126
+ this.noPrinters = false;
33127
+ this.printCancel.emit();
33128
+ break;
33125
33129
  }
33126
33130
  }
33127
33131
  listenStatusRetry(event) {
@@ -33599,7 +33603,7 @@ let EzpPrinterSelection = class {
33599
33603
  })), preSelected: this.selectedPrinter.id &&
33600
33604
  ((_o = this.selectedPrinterConfig.Trays) === null || _o === void 0 ? void 0 : _o.find((el) => el.Name.includes(this.selectedPrinterConfig.Default.Tray)))
33601
33605
  ? this.selectedPrinterConfig.Default.Tray
33602
- : null })) : null, h("ezp-input", { icon: "paper_range", suffix: "", placeholder: "1-2,4-5,8", value: this.selectedProperties.PageRanges, eventType: "paper_ranges", type: "text", label: i18next.t('printer_selection.page_ranges') })), h("ezp-stepper", { label: i18next.t('printer_selection.copies'), max: 10, icon: "copies" })), h("div", { id: "footer" }, h("ezp-text-button", { type: "button", level: "secondary", onClick: this.handleCancel, label: i18next.t('button_actions.cancel'), class: "action", id: "cancel" }), h("ezp-text-button", { disabled: this.selectedPrinter.id === '' || this.printProcessing || this.pageRangeInvalid, type: "button", onClick: this.handlePrint, label: i18next.t('button_actions.print'), ref: (button) => (this.printButton = button), class: "action", id: "print" })), !this.hidemenu && h("ezp-user-menu", { open: this.userMenuOpen, name: this.userName }))));
33606
+ : null })) : null, h("ezp-input", { icon: "paper_range", suffix: "", placeholder: "1-2,4-5,8", value: this.selectedProperties.PageRanges, eventType: "paper_ranges", type: "text", label: i18next.t('printer_selection.page_ranges') })), h("ezp-stepper", { label: i18next.t('printer_selection.copies'), icon: "copies" })), h("div", { id: "footer" }, h("ezp-text-button", { type: "button", level: "secondary", onClick: this.handleCancel, label: i18next.t('button_actions.cancel'), class: "action", id: "cancel" }), h("ezp-text-button", { disabled: this.selectedPrinter.id === '' || this.printProcessing || this.pageRangeInvalid, type: "button", onClick: this.handlePrint, label: i18next.t('button_actions.print'), ref: (button) => (this.printButton = button), class: "action", id: "print" })), !this.hidemenu && h("ezp-user-menu", { open: this.userMenuOpen, name: this.userName }))));
33603
33607
  }
33604
33608
  };
33605
33609
  EzpPrinterSelection.style = ezpPrinterSelectionCss;
@@ -34089,13 +34093,54 @@ let EzpStepper = class {
34089
34093
  *
34090
34094
  */
34091
34095
  this.handleDecrease = () => {
34092
- this.value--;
34096
+ const newValue = this.value - 1;
34097
+ // Only decrease if within safe range and above minimum
34098
+ if (newValue >= Number.MIN_SAFE_INTEGER && (this.min === undefined || newValue >= this.min)) {
34099
+ this.value = newValue;
34100
+ }
34093
34101
  };
34094
34102
  this.handleIncrease = () => {
34095
- this.value++;
34103
+ const newValue = this.value + 1;
34104
+ const effectiveMax = this.max !== undefined ? Math.min(this.max, Number.MAX_SAFE_INTEGER) : Number.MAX_SAFE_INTEGER;
34105
+ // Only increase if within safe range and below maximum
34106
+ if (newValue <= Number.MAX_SAFE_INTEGER && newValue <= effectiveMax) {
34107
+ this.value = newValue;
34108
+ }
34096
34109
  };
34097
34110
  this.handleInput = () => {
34098
- this.value = this.input.value !== '' ? parseInt(this.input.value) : this.min;
34111
+ if (!this.input)
34112
+ return;
34113
+ let inputString = this.input.value.trim();
34114
+ // If the input is empty, set the value to the minimum
34115
+ if (inputString === '') {
34116
+ this.value = this.min;
34117
+ this.input.value = this.value.toString();
34118
+ return;
34119
+ }
34120
+ // Remove all non-digit characters, keep only numbers
34121
+ const cleanedInput = inputString.replace(/\D/g, '');
34122
+ // If nothing remains after cleaning, revert to the last valid value
34123
+ if (cleanedInput === '') {
34124
+ this.input.value = this.value.toString();
34125
+ return;
34126
+ }
34127
+ // Limit input length to prevent precision loss (MAX_SAFE_INTEGER has 16 digits)
34128
+ const maxDigits = Number.MAX_SAFE_INTEGER.toString().length;
34129
+ const truncatedInput = cleanedInput.slice(0, maxDigits);
34130
+ let inputValue = Number(truncatedInput);
34131
+ // Safety check: ensure the number is within safe integer range
34132
+ if (inputValue > Number.MAX_SAFE_INTEGER) {
34133
+ inputValue = Number.MAX_SAFE_INTEGER;
34134
+ }
34135
+ // Ensure the value is between min and max
34136
+ if (this.min !== undefined && inputValue < this.min)
34137
+ inputValue = this.min;
34138
+ const effectiveMax = this.max !== undefined ? Math.min(this.max, Number.MAX_SAFE_INTEGER) : Number.MAX_SAFE_INTEGER;
34139
+ if (inputValue > effectiveMax)
34140
+ inputValue = effectiveMax;
34141
+ // Update component state and input field
34142
+ this.value = inputValue;
34143
+ this.input.value = inputValue.toString();
34099
34144
  };
34100
34145
  this.setFocus = () => {
34101
34146
  this.input.focus();
@@ -34106,6 +34151,18 @@ let EzpStepper = class {
34106
34151
  this.handleFocus = () => {
34107
34152
  this.focused = true;
34108
34153
  };
34154
+ this.handleKeyDown = (event) => {
34155
+ // If key is allowed or a Ctrl/Cmd combination, do nothing
34156
+ if (EzpStepper.ALLOWED_KEYS.includes(event.key) ||
34157
+ ((event.ctrlKey || event.metaKey) && EzpStepper.CTRL_CMD_KEYS.includes(event.key.toLowerCase()))) {
34158
+ return;
34159
+ }
34160
+ // If the key is not a digit, prevent default behavior (block input)
34161
+ const isDigit = /^\d$/.test(event.key);
34162
+ if (!isDigit) {
34163
+ event.preventDefault();
34164
+ }
34165
+ };
34109
34166
  }
34110
34167
  /**
34111
34168
  *
@@ -34113,7 +34170,8 @@ let EzpStepper = class {
34113
34170
  *
34114
34171
  */
34115
34172
  watchValue() {
34116
- this.canIncrease = this.max !== undefined ? this.value < this.max : true;
34173
+ const effectiveMax = this.max !== undefined ? Math.min(this.max, Number.MAX_SAFE_INTEGER) : Number.MAX_SAFE_INTEGER;
34174
+ this.canIncrease = this.value < effectiveMax;
34117
34175
  this.canDecrease = this.min !== undefined ? this.value > this.min : true;
34118
34176
  this.stepperChanged.emit(this.value);
34119
34177
  }
@@ -34131,12 +34189,24 @@ let EzpStepper = class {
34131
34189
  *
34132
34190
  */
34133
34191
  render() {
34134
- return (h(Host, { class: `${this.focused ? 'focused' : ''} ${this.icon ? 'has-icon' : ''}` }, h("div", { id: "toggle", onClick: this.setFocus }), this.icon ? h("ezp-icon", { id: "icon", name: this.icon }) : null, h("ezp-label", { id: "label", noWrap: true, text: this.label }), h("input", { id: "input", type: "number", ref: (input) => (this.input = input), min: this.min.toString(), max: this.max.toString(), value: this.value.toString(), onInput: this.handleInput, onFocus: this.handleFocus, onBlur: this.handleBlur }), h("div", { class: "buttons" }, h("button", { class: "button", disabled: !this.canDecrease, onClick: this.handleDecrease }, h("ezp-icon", { name: "minus" })), h("button", { class: "button", disabled: !this.canIncrease, onClick: this.handleIncrease }, h("ezp-icon", { name: "plus" })))));
34192
+ return (h(Host, { class: `${this.focused ? 'focused' : ''} ${this.icon ? 'has-icon' : ''}` }, h("div", { id: "toggle", onClick: this.setFocus }), this.icon ? h("ezp-icon", { id: "icon", name: this.icon }) : null, h("ezp-label", { id: "label", noWrap: true, text: this.label }), h("input", { id: "input", type: "number", ref: (input) => (this.input = input), min: this.min.toString(), max: this.max !== undefined ? this.max.toString() : undefined, value: this.value.toString(), onInput: this.handleInput, onKeyDown: this.handleKeyDown, onFocus: this.handleFocus, onBlur: this.handleBlur }), h("div", { class: "buttons" }, h("button", { class: "button", disabled: !this.canDecrease, onClick: this.handleDecrease }, h("ezp-icon", { name: "minus" })), h("button", { class: "button", disabled: !this.canIncrease, onClick: this.handleIncrease }, h("ezp-icon", { name: "plus" })))));
34135
34193
  }
34136
34194
  static get watchers() { return {
34137
34195
  "value": ["watchValue"]
34138
34196
  }; }
34139
34197
  };
34198
+ EzpStepper.ALLOWED_KEYS = [
34199
+ 'Backspace',
34200
+ 'Delete',
34201
+ 'Tab',
34202
+ 'Escape',
34203
+ 'Enter',
34204
+ 'ArrowLeft',
34205
+ 'ArrowUp',
34206
+ 'ArrowRight',
34207
+ 'ArrowDown',
34208
+ ];
34209
+ EzpStepper.CTRL_CMD_KEYS = ['a', 'c', 'v', 'x'];
34140
34210
  EzpStepper.style = ezpStepperCss;
34141
34211
 
34142
34212
  const ezpTextButtonCss = ":host{display:-ms-flexbox;display:flex}:host(.primary){--ezp-textButton-background-disabled:var(--ezp-core-shade-primary);--ezp-textButton-background-init:var(--ezp-theme-solid);--ezp-textButton-color-disabled:var(--ezp-core-foreground-tertiary);--ezp-textButton-color-init:var(--ezp-white-100);--ezp-textButton-opacity-active:0.74;--ezp-textButton-opacity-hover:0.84}:host(.secondary){--ezp-textButton-background-active:var(--ezp-core-shade-tertiary);--ezp-textButton-background-disabled:var(--ezp-core-shade-primary);--ezp-textButton-background-hover:var(--ezp-core-shade-secondary);--ezp-textButton-background-init:var(--ezp-core-shade-primary);--ezp-textButton-color-disabled:var(--ezp-core-foreground-tertiary);--ezp-textButton-color-init:var(--ezp-theme-solid)}:host(.tertiary){--ezp-textButton-background-active:var(--ezp-core-shade-secondary);--ezp-textButton-background-disabled:transparent;--ezp-textButton-background-hover:var(--ezp-core-shade-primary);--ezp-textButton-background-init:transparent;--ezp-textButton-color-disabled:var(--ezp-core-foreground-tertiary);--ezp-textButton-color-init:var(--ezp-theme-solid)}#button{-ms-flex-align:center;align-items:center;-webkit-appearance:none;-moz-appearance:none;appearance:none;background:var(--ezp-textButton-background, var(--ezp-textButton-background-init));border:0;border-radius:3px;-webkit-box-shadow:none;box-shadow:none;color:var(--ezp-textButton-color, var(--ezp-textButton-color-init));cursor:var(--ezp-textButton-cursor, pointer);display:-ms-flexbox;display:flex;font-family:inherit;-ms-flex-pack:center;justify-content:center;margin:0;opacity:var(--ezp-textButton-opacity, 1);outline:none;padding:var(--ezp-spacing-3);white-space:nowrap;width:100%}@media (hover: hover){#button:not(:disabled):hover{--ezp-textButton-background:var(\n --ezp-textButton-background-hover,\n var(--ezp-textButton-background-init)\n );--ezp-textButton-opacity:var(--ezp-textButton-opacity-hover, 1)}#button:not(:disabled):active{--ezp-textButton-background:var(\n --ezp-textButton-background-active,\n var(--ezp-textButton-background-init)\n );--ezp-textButton-opacity:var(--ezp-textButton-opacity-active, 1)}}#button:disabled{--ezp-textButton-background:var(--ezp-textButton-background-disabled);--ezp-textButton-color:var(--ezp-textButton-color-disabled);--ezp-textButton-cursor:default}#label{pointer-events:none}";