@everymatrix/cashier-method-details 1.29.4 → 1.29.5

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": "@everymatrix/cashier-method-details",
3
- "version": "1.29.4",
3
+ "version": "1.29.5",
4
4
  "main": "index.js",
5
5
  "svelte": "src/index.ts",
6
6
  "scripts": {
@@ -35,5 +35,5 @@
35
35
  "publishConfig": {
36
36
  "access": "public"
37
37
  },
38
- "gitHead": "70873f2feed3be9c071d9ad09343a833b236b4fc"
38
+ "gitHead": "f2e3f1edbe2a15979fd224f987ea52d179bb95f0"
39
39
  }
@@ -17,8 +17,6 @@
17
17
  import FlatpickrLanguages from "flatpickr/dist/l10n";
18
18
  import dayjs from 'dayjs';
19
19
  import customParseFormat from 'dayjs/plugin/customParseFormat';
20
- import isSameOrBefore from 'dayjs/plugin/isSameOrBefore';
21
- import isSameOrAfter from 'dayjs/plugin/isSameOrAfter';
22
20
  import type {PaymentMethod} from "./CashierMethodDetails.types";
23
21
  export class PaymentMethodDetails {
24
22
  name: string;
@@ -394,8 +392,6 @@
394
392
  window.addEventListener('closeCashierReceiptPage', closeReceiptPage, false);
395
393
  document.addEventListener('click',closeAllLookups);
396
394
  dayjs.extend(customParseFormat);
397
- dayjs.extend(isSameOrBefore);
398
- dayjs.extend(isSameOrAfter);
399
395
 
400
396
  return () => {
401
397
  window.removeEventListener('closeModal', closeModal);
@@ -702,7 +698,7 @@
702
698
  const inputValue = dayjs(value, format);
703
699
  const maxValue = dayjs(field.maxValue, format);
704
700
  const minValue = dayjs(field.minValue, format);
705
- if (inputValue.isSameOrBefore(minValue) || inputValue.isSameOrAfter(maxValue)) {
701
+ if (inputValue.isBefore(minValue) || inputValue.isAfter(maxValue)) {
706
702
  fieldValidation[field.name] = $_('invalidFieldError',{ values: { field: field.label }})
707
703
  return;
708
704
  }
@@ -793,7 +789,8 @@
793
789
  on:input="{() => { validateField(field) }}"
794
790
  on:blur="{() => { showError[field.name] = true; validateField(field) }}">
795
791
  {:else if field.type === FieldTypes.Time || field.type === FieldTypes.Date || field.type === FieldTypes.DateTime}
796
- <input type="text" bind:value={ prepareFields[field.name] } pattern={field.format}
792
+ <div class="DateInput">
793
+ <input class="DateTimePicker" type="text" bind:value={ prepareFields[field.name] } pattern={field.format}
797
794
  data-field={JSON.stringify(field)}
798
795
  placeholder={field.placeholder}
799
796
  on:input={() => { showError[field.name] = true; dateTimeValidation(field) }}
@@ -801,6 +798,10 @@
801
798
  on:blur={() => { showError[field.name] = true; dateTimeValidation(field) }}
802
799
  bind:this={flatpickrEl[flatpickrEl.length]}
803
800
  >
801
+ {#if isMobile(userAgent)}
802
+ <div class="MobileDateInput">{prepareFields[field.name]}</div>
803
+ {/if}
804
+ </div>
804
805
  {:else if field.type === FieldTypes.Number || field.type === FieldTypes.Money}
805
806
  <input type="number" placeholder="{field.placeholder}" bind:value={prepareFields[field.name]}
806
807
  on:input="{() => { validateField(field) }}"
@@ -976,12 +977,16 @@
976
977
  margin: 0;
977
978
  }
978
979
 
980
+ input::-webkit-date-and-time-value {
981
+ visibility: hidden;
982
+ }
983
+
979
984
  input[type=number] {
980
985
  -moz-appearance: textfield;
981
986
  }
982
987
  .CashierMethodDetails {
983
988
  width: 100%;
984
- height: 100%;
989
+ height: inherit;
985
990
  container-name: method-details;
986
991
  container-type: inline-size;
987
992
  }
@@ -1279,6 +1284,19 @@
1279
1284
  display: block;
1280
1285
  }
1281
1286
  }
1287
+ }
1288
+ .DateInput {
1289
+ position: relative;
1290
+ }
1291
+ .MobileDateInput {
1292
+ position: absolute;
1293
+ top: 50%;
1294
+ transform: translateY(-50%);
1295
+ left: 15px;
1296
+ }
1297
+ .DateTimePicker {
1298
+ width: -webkit-fill-available;
1299
+ width: -moz-available;
1282
1300
  }
1283
1301
  .CustomSelect {
1284
1302
  width: 100%;
@@ -1341,11 +1359,21 @@
1341
1359
  text-overflow: ellipsis;
1342
1360
  }
1343
1361
 
1344
- label, input, .Description, .FormLogo .ChangePaymeth {
1362
+ label, input, .Description, .FormLogo .ChangePaymeth, .OptionList div {
1345
1363
  font-size: var(--emw--font-size-x-small, 12px);
1346
1364
  }
1347
1365
  .SelectedMethodDescription, .AmountLimits {
1348
1366
  font-size: var(--emw--font-size-2x-small, 10px);
1349
1367
  }
1350
- }
1368
+
1369
+ .DateTimePicker {
1370
+ -webkit-appearance: none;
1371
+ -moz-appearance: none;
1372
+ font-size: inherit;
1373
+ background: none;
1374
+ width: -webkit-fill-available;
1375
+ font-size: 0;
1376
+ width: -moz-available;
1377
+ }
1378
+ }
1351
1379
  </style>