@paperless/core 2.0.1-beta.196 → 2.0.1-beta.197

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.
@@ -2983,6 +2983,7 @@ const Datepicker = class {
2983
2983
  year: 'yyyy',
2984
2984
  month: 'LLLL, yyyy',
2985
2985
  day: 'dd-MM-yyyy',
2986
+ dayNoDashes: 'ddMMyyyy',
2986
2987
  };
2987
2988
  parseValue(value) {
2988
2989
  if (!value && this.preselectToday) {
@@ -3063,7 +3064,7 @@ const Datepicker = class {
3063
3064
  this.parseValue(this.value);
3064
3065
  }
3065
3066
  render() {
3066
- return (h("p-dropdown", { key: '292f2fdf660dc97f02b1eba3f8961e17f5721398', allowOverflow: true, strategy: this.strategy, placement: this.placement, disableTriggerClick: true, applyMaxWidth: false, applyFullWidth: false, insideClick: true, show: this._showDropdown }, h("p-field", { key: '868662cb3f17130eb93c903ba2b2905849281e16', slot: 'trigger', icon: this.hideIconWhenFilled && !!this._value ? null : 'calendar-multi', iconPosition: 'start', size: this.size, prefix: this.prefix, label: this.label, loading: this.loading, helper: this.helper, required: asBoolean(this.required), showOptional: asBoolean(this.showOptional), error: this.error, forceShowTooltip: !!this.error?.length && !this._showDropdown, disabled: asBoolean(this.disabled), focused: this._showDropdown, value: this._getFormattedDate(), placeholder: this.placeholder, onFocus: () => this._onFocus(), onBlur: () => this._onBlur(), onValueChange: ev => this._onValueChange(ev.detail), onInputRefChange: ev => (this._inputRef = ev.detail) }), this.enableNativePicker && this._isMobileBrowser && (h("input", { key: 'bcef80055ed36a6f3ca3cf97c47848516d4cd5f6', slot: 'trigger', type: this.mode === 'day' ? 'date' : 'month', class: 'pointer-events-none absolute left-0 top-0 z-[-10] overflow-hidden opacity-0', onInput: ev => this._onNativeInput(ev), ref: ref => (this._dateInputRef = ref), value: this._value && format(this._value, 'yyyy-MM-dd'), min: this.minDate && format(new Date(this.minDate), 'yyyy-MM-dd'), max: this.maxDate && format(new Date(this.maxDate), 'yyyy-MM-dd') })), h("div", { key: '096d5e65af11c056c8105e52c224c17a8519c735', slot: 'items' }, h("p-calendar", { key: 'cca5ae8837fb46979c7d495914a249118d93cb9e', variant: 'embedded', value: this._value, onValueChange: ({ detail }) => (this.value = detail), preselectToday: this.preselectToday, disabledDates: this.disabledDates, minDate: this.minDate, maxDate: this.maxDate, disableWeekends: this.disableWeekends, enableToday: this.enableToday, todayText: this.todayText, mode: this.mode }))));
3067
+ return (h("p-dropdown", { key: '1b991cdf5bc3e03b162a7bef4a6190413d187241', allowOverflow: true, strategy: this.strategy, placement: this.placement, disableTriggerClick: true, applyMaxWidth: false, applyFullWidth: false, insideClick: true, show: this._showDropdown }, h("p-field", { key: '2811ba01f522bd273c67fa120e8f83c6e3f91ff3', slot: 'trigger', icon: this.hideIconWhenFilled && !!this._value ? null : 'calendar-multi', iconPosition: 'start', size: this.size, prefix: this.prefix, label: this.label, loading: this.loading, helper: this.helper, required: asBoolean(this.required), showOptional: asBoolean(this.showOptional), error: this.error, forceShowTooltip: !!this.error?.length && !this._showDropdown, disabled: asBoolean(this.disabled), focused: this._showDropdown, value: this._getFormattedDate(), placeholder: this.placeholder, onFocus: () => this._onFocus(), onBlur: () => this._onBlur(), onValueChange: ev => this._onValueChange(ev.detail), onInputRefChange: ev => (this._inputRef = ev.detail) }), this.enableNativePicker && this._isMobileBrowser && (h("input", { key: 'f2db96e7c890522a5bedcede831e6cbd2d27f2f6', slot: 'trigger', type: this.mode === 'day' ? 'date' : 'month', class: 'pointer-events-none absolute left-0 top-0 z-[-10] overflow-hidden opacity-0', onInput: ev => this._onNativeInput(ev), ref: ref => (this._dateInputRef = ref), value: this._value && format(this._value, 'yyyy-MM-dd'), min: this.minDate && format(new Date(this.minDate), 'yyyy-MM-dd'), max: this.maxDate && format(new Date(this.maxDate), 'yyyy-MM-dd') })), h("div", { key: 'ac88ae7b06ab91cf08da6ef3b363a53629299f2e', slot: 'items' }, h("p-calendar", { key: 'c53e934194a8ff323113d3b7f9e286941ef6c0ab', variant: 'embedded', value: this._value, onValueChange: ({ detail }) => (this.value = detail), preselectToday: this.preselectToday, disabledDates: this.disabledDates, minDate: this.minDate, maxDate: this.maxDate, disableWeekends: this.disableWeekends, enableToday: this.enableToday, todayText: this.todayText, mode: this.mode }))));
3067
3068
  }
3068
3069
  documentClickHandler({ target }) {
3069
3070
  if (!this._showDropdown || childOf(target, this._el)) {
@@ -3080,7 +3081,7 @@ const Datepicker = class {
3080
3081
  }
3081
3082
  this._showDropdown = true;
3082
3083
  }
3083
- _onBlur() {
3084
+ _onBlur(parseFormat = this.format) {
3084
3085
  if (this._isMobileBrowser && this._dateInputRef) {
3085
3086
  return;
3086
3087
  }
@@ -3088,24 +3089,31 @@ const Datepicker = class {
3088
3089
  if (target.value === null) {
3089
3090
  return;
3090
3091
  }
3091
- const value = parse(target.value, this.format, new Date());
3092
+ const value = parse(target.value, parseFormat, new Date());
3092
3093
  if (value === this._value) {
3093
3094
  return;
3094
3095
  }
3095
- if (!isValid(value) || this._isDisabledDay(value)) {
3096
+ const valid = isValid(value);
3097
+ if (!valid && parseFormat === this.format && this.mode === 'day') {
3098
+ return this._onBlur(this._defaultFormats['dayNoDashes']);
3099
+ }
3100
+ if (!valid || this._isDisabledDay(value)) {
3096
3101
  target.value = this._getFormattedDate();
3097
3102
  return;
3098
3103
  }
3099
3104
  this._setValue(value, false);
3100
3105
  }
3101
- _onValueChange(value) {
3106
+ _onValueChange(value, parseFormat = this.format) {
3102
3107
  if (this._onInputTimeout) {
3103
3108
  clearTimeout(this._onInputTimeout);
3104
3109
  this._onInputTimeout = null;
3105
3110
  }
3106
3111
  this._onInputTimeout = setTimeout(() => {
3107
- const parsedValue = parse(value, this.format, new Date());
3108
- if (!isValid(parsedValue) || format(parsedValue, this.format) !== value) {
3112
+ const parsedValue = parse(value, parseFormat, new Date());
3113
+ if (!isValid(parsedValue) || format(parsedValue, parseFormat) !== value) {
3114
+ if (this.mode === 'day') {
3115
+ this._onValueChange(value, this._defaultFormats['dayNoDashes']);
3116
+ }
3109
3117
  return;
3110
3118
  }
3111
3119
  this._setValue(parsedValue, false);