From 07d297fc2bbccb45f1f9fa43a15b9201127eb66a Mon Sep 17 00:00:00 2001 From: swarnadipa-dev Date: Tue, 12 Nov 2024 10:08:36 +0530 Subject: [PATCH 1/7] ELEMENTS-1113: expose date format --- ui/widgets/nuxeo-date-picker.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/ui/widgets/nuxeo-date-picker.js b/ui/widgets/nuxeo-date-picker.js index fcfc33f8b..29c4a517d 100644 --- a/ui/widgets/nuxeo-date-picker.js +++ b/ui/widgets/nuxeo-date-picker.js @@ -125,6 +125,14 @@ import { I18nBehavior } from '../nuxeo-i18n-behavior.js'; type: Boolean, value: false, }, + + /** + * Use this property to provide custom date format + */ + format: { + type: String, + value: '', + }, }; } @@ -188,9 +196,11 @@ import { I18nBehavior } from '../nuxeo-i18n-behavior.js'; moment.locale(window.nuxeo.I18n.language ? window.nuxeo.I18n.language.split('-')[0] : 'en'); // tell vaadin-date-picker how to display dates since default behavior is US locales (MM-DD-YYYY) // this way we can take advantage of moment locale and use the date format that is most suitable for the user - this.$.date.set('i18n.formatDate', (date) => this._moment(date).format(moment.localeData().longDateFormat('L'))); + this.$.date.set('i18n.formatDate', (date) => + this._moment(date).format(this.format ? this.format : moment.localeData().longDateFormat('L')), + ); this.$.date.set('i18n.parseDate', (text) => { - const date = this._moment(text, moment.localeData().longDateFormat('L')); + const date = this._moment(text, this.format ? this.format : moment.localeData().longDateFormat('L')); return { day: date.get('D'), month: date.get('M'), From fb489fb6b82771a2b3127003d363d8136eb75722 Mon Sep 17 00:00:00 2001 From: swarnadipa-dev Date: Tue, 12 Nov 2024 11:21:45 +0530 Subject: [PATCH 2/7] test commit --- ui/widgets/nuxeo-date-picker.js | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/ui/widgets/nuxeo-date-picker.js b/ui/widgets/nuxeo-date-picker.js index 29c4a517d..a1b7d4745 100644 --- a/ui/widgets/nuxeo-date-picker.js +++ b/ui/widgets/nuxeo-date-picker.js @@ -85,8 +85,9 @@ import { I18nBehavior } from '../nuxeo-i18n-behavior.js'; value: false, }, + //,,m, /* - * The first day of week to be displayed (e.g. `"Sunday -> 0"`, ... `"Saturday -> 6"`). + * The first day of week is to be displayed (e.g. `"Sunday -> 0"`, ... `"Saturday -> 6"`). * By default, it will be set according the locale. */ firstDayOfWeek: { @@ -125,14 +126,6 @@ import { I18nBehavior } from '../nuxeo-i18n-behavior.js'; type: Boolean, value: false, }, - - /** - * Use this property to provide custom date format - */ - format: { - type: String, - value: '', - }, }; } @@ -196,11 +189,9 @@ import { I18nBehavior } from '../nuxeo-i18n-behavior.js'; moment.locale(window.nuxeo.I18n.language ? window.nuxeo.I18n.language.split('-')[0] : 'en'); // tell vaadin-date-picker how to display dates since default behavior is US locales (MM-DD-YYYY) // this way we can take advantage of moment locale and use the date format that is most suitable for the user - this.$.date.set('i18n.formatDate', (date) => - this._moment(date).format(this.format ? this.format : moment.localeData().longDateFormat('L')), - ); + this.$.date.set('i18n.formatDate', (date) => this._moment(date).format(moment.localeData().longDateFormat('L'))); this.$.date.set('i18n.parseDate', (text) => { - const date = this._moment(text, this.format ? this.format : moment.localeData().longDateFormat('L')); + const date = this._moment(text, moment.localeData().longDateFormat('L')); return { day: date.get('D'), month: date.get('M'), @@ -232,6 +223,7 @@ import { I18nBehavior } from '../nuxeo-i18n-behavior.js'; } _valueChanged() { + /* check for valid value */ if (!this.value) { this._inputValue = null; return; From 6705f6693002d196cf9b883b4702ccdfc50714b1 Mon Sep 17 00:00:00 2001 From: swarnadipa-dev Date: Tue, 12 Nov 2024 11:28:11 +0530 Subject: [PATCH 3/7] test commit --- ui/widgets/nuxeo-date-picker.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/ui/widgets/nuxeo-date-picker.js b/ui/widgets/nuxeo-date-picker.js index a1b7d4745..afed6ba54 100644 --- a/ui/widgets/nuxeo-date-picker.js +++ b/ui/widgets/nuxeo-date-picker.js @@ -84,8 +84,6 @@ import { I18nBehavior } from '../nuxeo-i18n-behavior.js'; type: Boolean, value: false, }, - - //,,m, /* * The first day of week is to be displayed (e.g. `"Sunday -> 0"`, ... `"Saturday -> 6"`). * By default, it will be set according the locale. From 4dc70a47356accd42a341f0d14321d1e9d717ff8 Mon Sep 17 00:00:00 2001 From: swarnadipa-dev Date: Tue, 12 Nov 2024 13:25:23 +0530 Subject: [PATCH 4/7] test commit --- ui/widgets/nuxeo-date-picker.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ui/widgets/nuxeo-date-picker.js b/ui/widgets/nuxeo-date-picker.js index afed6ba54..49c462b8d 100644 --- a/ui/widgets/nuxeo-date-picker.js +++ b/ui/widgets/nuxeo-date-picker.js @@ -84,6 +84,7 @@ import { I18nBehavior } from '../nuxeo-i18n-behavior.js'; type: Boolean, value: false, }, + /* * The first day of week is to be displayed (e.g. `"Sunday -> 0"`, ... `"Saturday -> 6"`). * By default, it will be set according the locale. @@ -124,6 +125,11 @@ import { I18nBehavior } from '../nuxeo-i18n-behavior.js'; type: Boolean, value: false, }, + + format: { + type: String, + value: '', + }, }; } @@ -221,7 +227,6 @@ import { I18nBehavior } from '../nuxeo-i18n-behavior.js'; } _valueChanged() { - /* check for valid value */ if (!this.value) { this._inputValue = null; return; From 32b57db925a888db2276192d0f47847f3eacc9b9 Mon Sep 17 00:00:00 2001 From: swarnadipa-dev Date: Tue, 12 Nov 2024 14:15:51 +0530 Subject: [PATCH 5/7] test commit --- ui/widgets/nuxeo-date-picker.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/ui/widgets/nuxeo-date-picker.js b/ui/widgets/nuxeo-date-picker.js index 49c462b8d..b8af25235 100644 --- a/ui/widgets/nuxeo-date-picker.js +++ b/ui/widgets/nuxeo-date-picker.js @@ -85,6 +85,7 @@ import { I18nBehavior } from '../nuxeo-i18n-behavior.js'; value: false, }, + /* * The first day of week is to be displayed (e.g. `"Sunday -> 0"`, ... `"Saturday -> 6"`). * By default, it will be set according the locale. @@ -125,11 +126,6 @@ import { I18nBehavior } from '../nuxeo-i18n-behavior.js'; type: Boolean, value: false, }, - - format: { - type: String, - value: '', - }, }; } @@ -237,7 +233,8 @@ import { I18nBehavior } from '../nuxeo-i18n-behavior.js'; const year = `${date.get('Y')}`.padStart(4, '0'); const month = `${date.get('M') + 1}`.padStart(2, '0'); const day = `${date.get('D')}`.padStart(2, '0'); - this._inputValue = `${year}-${month}-${day}`; + const years = year; + this._inputValue = `${years}-${month}-${day}`; } else { this._inputValue = ''; } From 424a86813c2183e69d7d74a6e0dfc31418805740 Mon Sep 17 00:00:00 2001 From: swarnadipa-dev Date: Tue, 12 Nov 2024 14:32:44 +0530 Subject: [PATCH 6/7] test commit --- ui/widgets/nuxeo-date-picker.js | 1 - 1 file changed, 1 deletion(-) diff --git a/ui/widgets/nuxeo-date-picker.js b/ui/widgets/nuxeo-date-picker.js index b8af25235..cf657a402 100644 --- a/ui/widgets/nuxeo-date-picker.js +++ b/ui/widgets/nuxeo-date-picker.js @@ -85,7 +85,6 @@ import { I18nBehavior } from '../nuxeo-i18n-behavior.js'; value: false, }, - /* * The first day of week is to be displayed (e.g. `"Sunday -> 0"`, ... `"Saturday -> 6"`). * By default, it will be set according the locale. From d073e61457a4205d2228a1a3dac2be32ef475b59 Mon Sep 17 00:00:00 2001 From: swarnadipa-dev Date: Wed, 13 Nov 2024 10:38:59 +0530 Subject: [PATCH 7/7] test commit --- ui/widgets/nuxeo-date-picker.js | 5 ++--- ui/widgets/nuxeo-selectivity.js | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/ui/widgets/nuxeo-date-picker.js b/ui/widgets/nuxeo-date-picker.js index cf657a402..fcfc33f8b 100644 --- a/ui/widgets/nuxeo-date-picker.js +++ b/ui/widgets/nuxeo-date-picker.js @@ -86,7 +86,7 @@ import { I18nBehavior } from '../nuxeo-i18n-behavior.js'; }, /* - * The first day of week is to be displayed (e.g. `"Sunday -> 0"`, ... `"Saturday -> 6"`). + * The first day of week to be displayed (e.g. `"Sunday -> 0"`, ... `"Saturday -> 6"`). * By default, it will be set according the locale. */ firstDayOfWeek: { @@ -232,8 +232,7 @@ import { I18nBehavior } from '../nuxeo-i18n-behavior.js'; const year = `${date.get('Y')}`.padStart(4, '0'); const month = `${date.get('M') + 1}`.padStart(2, '0'); const day = `${date.get('D')}`.padStart(2, '0'); - const years = year; - this._inputValue = `${years}-${month}-${day}`; + this._inputValue = `${year}-${month}-${day}`; } else { this._inputValue = ''; } diff --git a/ui/widgets/nuxeo-selectivity.js b/ui/widgets/nuxeo-selectivity.js index e64d2eb22..a1f959d43 100644 --- a/ui/widgets/nuxeo-selectivity.js +++ b/ui/widgets/nuxeo-selectivity.js @@ -6936,7 +6936,7 @@ typedArrayTags[weakMapTag] = false; border: none; float: left; font: inherit; - max-width: 100%; + width: 100%; outline: 0; padding: 0; padding-top: 1px;