neo.mjs 6.15.4 → 6.15.6
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/apps/ServiceWorker.mjs +2 -2
- package/apps/form/view/FormContainerController.mjs +1 -1
- package/apps/form/view/ViewportController.mjs +2 -2
- package/apps/portal/view/home/MainContainer.mjs +2 -2
- package/apps/portal/view/learn/ContentView.mjs +1 -1
- package/apps/portal/view/learn/LivePreview.mjs +0 -27
- package/apps/realworld2/view/user/LoginFormContainer.mjs +1 -1
- package/docs/app/view/MainContainer.mjs +1 -11
- package/examples/ServiceWorker.mjs +2 -2
- package/examples/component/timer/MainContainerController.mjs +2 -2
- package/examples/component/toast/MainContainerController.mjs +2 -2
- package/examples/date/selectorContainer/MainContainer.mjs +215 -0
- package/examples/date/selectorContainer/app.mjs +6 -0
- package/examples/date/selectorContainer/index.html +11 -0
- package/examples/date/selectorContainer/neo-config.json +6 -0
- package/package.json +5 -5
- package/resources/data/deck/learnneo/pages/TestLivePreview.md +1 -2
- package/resources/data/deck/learnneo/pages/Welcome.md +68 -0
- package/resources/data/deck/learnneo/pages/WhyNeo-Multi-Threaded.md +2 -0
- package/resources/data/deck/learnneo/pages/WhyNeo-Multi-Window.md +3 -3
- package/resources/data/deck/learnneo/pages/WhyNeo-Speed.md +36 -12
- package/resources/data/deck/learnneo/tree.json +5 -4
- package/resources/scss/src/apps/portal/learn/PageContainer.scss +4 -3
- package/resources/scss/src/date/SelectorContainer.scss +120 -0
- package/resources/scss/theme-dark/date/SelectorContainer.scss +24 -0
- package/resources/scss/theme-light/date/SelectorContainer.scss +24 -0
- package/resources/scss/theme-neo-light/date/SelectorContainer.scss +24 -0
- package/src/DefaultConfig.mjs +2 -2
- package/src/Neo.mjs +5 -5
- package/src/component/Base.mjs +1 -1
- package/src/container/Base.mjs +42 -17
- package/src/controller/Component.mjs +5 -4
- package/src/core/Observable.mjs +30 -5
- package/src/core/Util.mjs +1 -1
- package/src/date/DayViewComponent.mjs +251 -0
- package/src/date/SelectorContainer.mjs +352 -0
- package/src/date/SelectorContainerModel.mjs +33 -0
- package/src/form/Container.mjs +10 -2
- package/src/form/field/Base.mjs +10 -2
- package/src/form/field/CheckBox.mjs +13 -5
- package/src/form/field/ComboBox.mjs +21 -15
- package/src/form/field/Date.mjs +2 -2
- package/src/form/field/Text.mjs +18 -17
- package/src/main/addon/IntersectionObserver.mjs +27 -20
- package/src/tab/Container.mjs +56 -55
- package/test/components/app.mjs +1 -0
- package/test/components/files/component/Base.mjs +88 -0
- package/test/components/siesta.js +1 -0
- package/docs/app/model/Tutorial.mjs +0 -41
- package/docs/app/store/Tutorials.mjs +0 -28
- package/docs/app/view/TutorialsTreeList.mjs +0 -51
- package/docs/tutorials/01_Concept.html +0 -45
- package/docs/tutorials/01_Concept.json +0 -123
- package/docs/tutorials/01_Concept.md +0 -55
- package/docs/tutorials/02_ClassSystem.html +0 -171
- package/docs/tutorials/02_ClassSystem.md +0 -187
- package/docs/tutorials/03_ComponentLifecycle.html +0 -28
- package/docs/tutorials/03_ComponentLifecycle.md +0 -23
- package/docs/tutorials/04_VdomVnode.html +0 -161
- package/docs/tutorials/05_RemoteMethodAccess.html +0 -82
- package/docs/tutorials/06_EcmaScript6Plus.html +0 -10
- package/docs/tutorials/07_WebWorkers.html +0 -9
- package/docs/tutorials/08_DomEvents.html +0 -7
- package/docs/tutorials/09_TodoList_version1.html +0 -503
- package/docs/tutorials/11_CreateApp.html +0 -94
- package/docs/tutorials/tutorials.json +0 -100
- package/resources/scss/src/apps/docs/TutorialsTreeList.scss +0 -7
@@ -0,0 +1,251 @@
|
|
1
|
+
import Base from '../component/Base.mjs';
|
2
|
+
import DateUtil from '../util/Date.mjs';
|
3
|
+
import NeoArray from '../util/Array.mjs';
|
4
|
+
|
5
|
+
const todayDate = new Date();
|
6
|
+
|
7
|
+
const today = {
|
8
|
+
day : todayDate.getDate(),
|
9
|
+
month: todayDate.getMonth(),
|
10
|
+
year : todayDate.getFullYear()
|
11
|
+
};
|
12
|
+
|
13
|
+
/**
|
14
|
+
* @class Neo.date.DayViewComponent
|
15
|
+
* @extends Neo.component.Base
|
16
|
+
*/
|
17
|
+
class DayViewComponent extends Base {
|
18
|
+
static config = {
|
19
|
+
/**
|
20
|
+
* @member {String} className='Neo.date.DayViewComponent'
|
21
|
+
* @protected
|
22
|
+
*/
|
23
|
+
className: 'Neo.date.DayViewComponent',
|
24
|
+
/**
|
25
|
+
* @member {String} className='day-view-component'
|
26
|
+
* @protected
|
27
|
+
*/
|
28
|
+
ntype: 'day-view-component',
|
29
|
+
/**
|
30
|
+
* @member {String[]} baseCls=['neo-day-view']
|
31
|
+
* @protected
|
32
|
+
*/
|
33
|
+
baseCls: ['neo-day-view'],
|
34
|
+
/**
|
35
|
+
* @member {Object} bind
|
36
|
+
*/
|
37
|
+
bind: {
|
38
|
+
intlFormatDay: data => data.intlFormatDay,
|
39
|
+
weekStartDay : data => data.weekStartDay
|
40
|
+
},
|
41
|
+
/**
|
42
|
+
* @member {Date|null} currentDate_=null
|
43
|
+
* @protected
|
44
|
+
*/
|
45
|
+
currentDate_: null,
|
46
|
+
/**
|
47
|
+
* @member {Intl.DateTimeFormat|null} intlFormatDay=null
|
48
|
+
* @protected
|
49
|
+
*/
|
50
|
+
intlFormatDay: null,
|
51
|
+
/**
|
52
|
+
* 0-6 => Sun-Sat
|
53
|
+
* @member {Number} weekStartDay_=0
|
54
|
+
*/
|
55
|
+
weekStartDay_: 0,
|
56
|
+
/**
|
57
|
+
* @member {Object} _vdom
|
58
|
+
*/
|
59
|
+
_vdom:
|
60
|
+
{cn: []}
|
61
|
+
}
|
62
|
+
|
63
|
+
/**
|
64
|
+
* @param {Object} config
|
65
|
+
*/
|
66
|
+
construct(config) {
|
67
|
+
super.construct(config);
|
68
|
+
this.createContent(true)
|
69
|
+
}
|
70
|
+
|
71
|
+
/**
|
72
|
+
* Triggered after the currentDate config got changed
|
73
|
+
* @param {Date} value
|
74
|
+
* @param {Date} oldValue
|
75
|
+
* @protected
|
76
|
+
*/
|
77
|
+
afterSetCurrentDate(value, oldValue) {
|
78
|
+
this.isConstructed && this.recreateContent(false)
|
79
|
+
}
|
80
|
+
|
81
|
+
/**
|
82
|
+
* Triggered after the weekStartDay config got changed
|
83
|
+
* @param {Number} value
|
84
|
+
* @param {Number} oldValue
|
85
|
+
* @protected
|
86
|
+
*/
|
87
|
+
afterSetWeekStartDay(value, oldValue) {
|
88
|
+
this.isConstructed && this.recreateContent(false)
|
89
|
+
}
|
90
|
+
|
91
|
+
/**
|
92
|
+
* @returns {Object}
|
93
|
+
*/
|
94
|
+
createDayNamesRow() {
|
95
|
+
let me = this,
|
96
|
+
date = DateUtil.clone(me.currentDate),
|
97
|
+
i = 0,
|
98
|
+
len = 7,
|
99
|
+
row = {cls: ['neo-row', 'neo-header-row'], cn: []},
|
100
|
+
config, day;
|
101
|
+
|
102
|
+
date.setDate(me.currentDate.getDate() - me.currentDate.getDay() + me.weekStartDay);
|
103
|
+
|
104
|
+
for (; i < len; i++) {
|
105
|
+
config =
|
106
|
+
{cls: ['neo-cell'], cn: [
|
107
|
+
{cls : ['neo-cell-content'], html: me.intlFormatDay.format(date)}
|
108
|
+
]};
|
109
|
+
|
110
|
+
day = date.getDay();
|
111
|
+
|
112
|
+
if (!me.showWeekends && (day === 0 || day === 6)) {
|
113
|
+
config.removeDom = true
|
114
|
+
}
|
115
|
+
|
116
|
+
row.cn.push(config);
|
117
|
+
|
118
|
+
date.setDate(date.getDate() + 1)
|
119
|
+
}
|
120
|
+
|
121
|
+
return row
|
122
|
+
}
|
123
|
+
|
124
|
+
/**
|
125
|
+
* @param {Boolean} silent=false true to update the vdom silently
|
126
|
+
* @param {Object} [containerEl]
|
127
|
+
*/
|
128
|
+
createContent(silent=false, containerEl) {
|
129
|
+
let me = this,
|
130
|
+
currentDate = me.currentDate,
|
131
|
+
currentDay = currentDate.getDate(),
|
132
|
+
currentMonth = currentDate.getMonth(),
|
133
|
+
currentYear = currentDate.getFullYear(),
|
134
|
+
date = me.currentDate, // cloned
|
135
|
+
maxDate = me.maxValue && new Date(`${me.maxValue}T00:00:00.000Z`),
|
136
|
+
minDate = me.minValue && new Date(`${me.minValue}T00:00:00.000Z`),
|
137
|
+
valueDate = new Date(`${me.value}T00:00:00.000Z`),
|
138
|
+
valueMonth = valueDate.getMonth(),
|
139
|
+
valueYear = valueDate.getFullYear(),
|
140
|
+
daysInMonth = DateUtil.getDaysInMonth(currentDate),
|
141
|
+
firstDayInMonth = DateUtil.getFirstDayOfMonth(currentDate),
|
142
|
+
firstDayOffset = firstDayInMonth - me.weekStartDay,
|
143
|
+
centerEl = containerEl || me.vdom,
|
144
|
+
columns = 7,
|
145
|
+
i = 0,
|
146
|
+
cellId, config, dateDay, day, hasContent, j, row, rows;
|
147
|
+
|
148
|
+
firstDayOffset = firstDayOffset < 0 ? firstDayOffset + 7 : firstDayOffset;
|
149
|
+
rows = (daysInMonth + firstDayOffset) / 7 > 5 ? 6 : 5;
|
150
|
+
day = 1 - firstDayOffset;
|
151
|
+
|
152
|
+
date.setDate(day);
|
153
|
+
|
154
|
+
centerEl.cn.push(me.createDayNamesRow());
|
155
|
+
|
156
|
+
for (; i < rows; i++) {
|
157
|
+
row = {cls: ['neo-row'], cn: []};
|
158
|
+
|
159
|
+
for (j=0; j < columns; j++) {
|
160
|
+
hasContent = day > 0 && day <= daysInMonth;
|
161
|
+
cellId = me.getCellId(currentYear, currentMonth + 1, day);
|
162
|
+
|
163
|
+
dateDay = date.getDay();
|
164
|
+
|
165
|
+
config ={
|
166
|
+
id : cellId,
|
167
|
+
cls : hasContent ? ['neo-cell'] : ['neo-cell', 'neo-disabled'],
|
168
|
+
tabIndex: hasContent ? -1 : null,
|
169
|
+
cn: [{
|
170
|
+
cls : ['neo-cell-content'],
|
171
|
+
html: hasContent ? day : me.showDisabledDays ? date.getDate() : ''
|
172
|
+
}]
|
173
|
+
};
|
174
|
+
|
175
|
+
if (dateDay === 0 || dateDay === 6) {
|
176
|
+
if (!me.showWeekends) {
|
177
|
+
config.removeDom = true
|
178
|
+
}
|
179
|
+
|
180
|
+
config.cls.push('neo-weekend');
|
181
|
+
}
|
182
|
+
|
183
|
+
if (maxDate && date > maxDate || minDate && date < minDate) {
|
184
|
+
NeoArray.add(config.cls, 'neo-disabled')
|
185
|
+
}
|
186
|
+
|
187
|
+
if (today.year === currentYear && today.month === currentMonth && today.day === day) {
|
188
|
+
config.cn[0].cls.push('neo-today')
|
189
|
+
}
|
190
|
+
|
191
|
+
if (valueYear === currentYear && valueMonth === currentMonth && day === currentDay) {
|
192
|
+
config.cls.push('neo-selected');
|
193
|
+
me.selectionModel.items = [cellId] // silent update
|
194
|
+
}
|
195
|
+
|
196
|
+
row.cn.push(config);
|
197
|
+
|
198
|
+
date.setDate(date.getDate() + 1);
|
199
|
+
|
200
|
+
day++
|
201
|
+
}
|
202
|
+
|
203
|
+
centerEl.cn.push(row)
|
204
|
+
}
|
205
|
+
|
206
|
+
!silent && me.update()
|
207
|
+
}
|
208
|
+
|
209
|
+
/**
|
210
|
+
* @param {Number|String} year
|
211
|
+
* @param {Number|String} month
|
212
|
+
* @param {Number|String} day
|
213
|
+
* @returns {String} id
|
214
|
+
*/
|
215
|
+
getCellId(year, month, day) {
|
216
|
+
day = day.toString();
|
217
|
+
|
218
|
+
if (day.length < 2) {
|
219
|
+
day = '0' + day
|
220
|
+
}
|
221
|
+
|
222
|
+
month = month.toString();
|
223
|
+
|
224
|
+
if (month.length < 2) {
|
225
|
+
month = '0' + month
|
226
|
+
}
|
227
|
+
|
228
|
+
return this.id + '__' + year + '-' + month + '-' + day
|
229
|
+
}
|
230
|
+
|
231
|
+
/**
|
232
|
+
* Recreates the current month view
|
233
|
+
* @param {Boolean} [syncIds=true]
|
234
|
+
* @protected
|
235
|
+
*/
|
236
|
+
recreateContent(syncIds=true) {
|
237
|
+
let me = this;
|
238
|
+
|
239
|
+
me.vdom.cn = [];
|
240
|
+
me.createContent(true);
|
241
|
+
|
242
|
+
// using force => we do want to keep the same ids
|
243
|
+
syncIds && me.syncVdomIds(me.vnode, me.vdom, true);
|
244
|
+
|
245
|
+
me.update()
|
246
|
+
}
|
247
|
+
}
|
248
|
+
|
249
|
+
Neo.setupClass(DayViewComponent);
|
250
|
+
|
251
|
+
export default DayViewComponent;
|
@@ -0,0 +1,352 @@
|
|
1
|
+
import ClassSystemUtil from '../util/ClassSystem.mjs';
|
2
|
+
import Container from '../container/Base.mjs';
|
3
|
+
import DateSelectorModel from '../selection/DateSelectorModel.mjs';
|
4
|
+
import DayViewComponent from './DayViewComponent.mjs';
|
5
|
+
import DateUtil from '../util/Date.mjs';
|
6
|
+
import NeoArray from '../util/Array.mjs';
|
7
|
+
import SelectorContainerModel from './SelectorContainerModel.mjs';
|
8
|
+
import Toolbar from '../toolbar/Base.mjs';
|
9
|
+
|
10
|
+
const todayDate = new Date();
|
11
|
+
|
12
|
+
/**
|
13
|
+
* @class Neo.date.SelectorContainer
|
14
|
+
* @extends Neo.container.Base
|
15
|
+
*/
|
16
|
+
class SelectorContainer extends Container {
|
17
|
+
static config = {
|
18
|
+
/**
|
19
|
+
* @member {String} className='Neo.date.SelectorContainer'
|
20
|
+
* @protected
|
21
|
+
*/
|
22
|
+
className: 'Neo.date.SelectorContainer',
|
23
|
+
/**
|
24
|
+
* @member {String} ntype='date-selector'
|
25
|
+
* @protected
|
26
|
+
*/
|
27
|
+
ntype: 'date-selector',
|
28
|
+
/**
|
29
|
+
* @member {String[]} baseCls=['neo-dateselector','neo-container']
|
30
|
+
*/
|
31
|
+
baseCls: ['neo-dateselector', 'neo-container'],
|
32
|
+
/**
|
33
|
+
* @member {Object} bind
|
34
|
+
*/
|
35
|
+
bind: {
|
36
|
+
intlFormatDay: {twoWay: true, value: data => data.intlFormatDay},
|
37
|
+
weekStartDay : {twoWay: true, value: data => data.weekStartDay}
|
38
|
+
},
|
39
|
+
/**
|
40
|
+
* Date object created on the value config
|
41
|
+
* @member {Date|null} currentDate_=null
|
42
|
+
* @protected
|
43
|
+
*/
|
44
|
+
currentDate_: null,
|
45
|
+
/**
|
46
|
+
* @member {String} dateFormat='Y-m-d'
|
47
|
+
*/
|
48
|
+
dateFormat: 'Y-m-d',
|
49
|
+
/**
|
50
|
+
* The format of the column headers.
|
51
|
+
* Valid values are: narrow, short & long
|
52
|
+
* @member {String} dayNameFormat_='short'
|
53
|
+
*/
|
54
|
+
dayNameFormat_: 'short',
|
55
|
+
/**
|
56
|
+
* @member {Intl.DateTimeFormat|null} intlFormatDay_=null
|
57
|
+
* @protected
|
58
|
+
*/
|
59
|
+
intlFormatDay_: null,
|
60
|
+
/**
|
61
|
+
* Internal flag to prevent changing the date while change animations are still running
|
62
|
+
* @member {Boolean} isUpdating_=false
|
63
|
+
* @protected
|
64
|
+
*/
|
65
|
+
isUpdating_: false,
|
66
|
+
/**
|
67
|
+
* @member {Object[]} items
|
68
|
+
*/
|
69
|
+
items: [{
|
70
|
+
module: Toolbar,
|
71
|
+
cls : ['neo-header-toolbar'],
|
72
|
+
flex : 'none',
|
73
|
+
|
74
|
+
itemDefaults: {
|
75
|
+
ntype: 'button',
|
76
|
+
ui : 'tertiary' // todo: should be ghost
|
77
|
+
},
|
78
|
+
|
79
|
+
items : [{
|
80
|
+
handler: 'up.onPrevButtonClick',
|
81
|
+
iconCls: 'fas fa-circle-chevron-left'
|
82
|
+
}, {
|
83
|
+
flex: 1,
|
84
|
+
text: '2024'
|
85
|
+
}, {
|
86
|
+
handler: 'up.onNextButtonClick',
|
87
|
+
iconCls: 'fas fa-circle-chevron-right'
|
88
|
+
}]
|
89
|
+
}, {
|
90
|
+
module: Container,
|
91
|
+
layout: 'card',
|
92
|
+
items : [{
|
93
|
+
module : DayViewComponent,
|
94
|
+
reference: 'day-view'
|
95
|
+
}]
|
96
|
+
}],
|
97
|
+
/**
|
98
|
+
* Additional used keys for the selection model
|
99
|
+
* @member {Object} keys
|
100
|
+
*/
|
101
|
+
keys: {},
|
102
|
+
/**
|
103
|
+
* @member {String} locale_=Neo.config.locale
|
104
|
+
*/
|
105
|
+
locale_: Neo.config.locale,
|
106
|
+
/**
|
107
|
+
* @member {String|null} maxValue_=null
|
108
|
+
*/
|
109
|
+
maxValue_: null,
|
110
|
+
/**
|
111
|
+
* @member {String|null} minValue_=null
|
112
|
+
*/
|
113
|
+
minValue_: null,
|
114
|
+
/**
|
115
|
+
* @member {Neo.model.Component} model=SelectorContainerModel
|
116
|
+
*/
|
117
|
+
model: SelectorContainerModel,
|
118
|
+
/**
|
119
|
+
* Used for wheel events. min value = 1.
|
120
|
+
* A higher value means lesser sensitivity for wheel events
|
121
|
+
* => you need to scroll "more" to trigger a month / year change
|
122
|
+
* @member {Number} mouseWheelDelta=1
|
123
|
+
*/
|
124
|
+
mouseWheelDelta: 1,
|
125
|
+
/**
|
126
|
+
* True to scroll new years in from the top
|
127
|
+
* @member {Boolean} scrollNewYearFromTop=false
|
128
|
+
*/
|
129
|
+
scrollNewYearFromTop: false,
|
130
|
+
/**
|
131
|
+
* Either pass a selection.Model module, an instance or a config object
|
132
|
+
* @member {Object|Neo.selection.Model} selectionModel_=null
|
133
|
+
*/
|
134
|
+
selectionModel_: null,
|
135
|
+
/**
|
136
|
+
* True to show inner cell & header cell borders
|
137
|
+
* @member {Boolean} showCellBorders_=true
|
138
|
+
*/
|
139
|
+
showCellBorders_: false,
|
140
|
+
/**
|
141
|
+
* True to show the days of the previous or next month (not selectable)
|
142
|
+
* @member {Boolean} showDisabledDays_=true
|
143
|
+
*/
|
144
|
+
showDisabledDays_: true,
|
145
|
+
/**
|
146
|
+
* @member {Boolean} showWeekends_=true
|
147
|
+
*/
|
148
|
+
showWeekends_: true,
|
149
|
+
/**
|
150
|
+
* True to use sliding animations
|
151
|
+
* @member {Boolean} useAnimations=true
|
152
|
+
*/
|
153
|
+
useAnimations: true,
|
154
|
+
/**
|
155
|
+
* @member {String} value_=DateUtil.convertToyyyymmdd(new Date())
|
156
|
+
*/
|
157
|
+
value_: DateUtil.convertToyyyymmdd(todayDate),
|
158
|
+
/**
|
159
|
+
* 0-6 => Sun-Sat
|
160
|
+
* @member {Number} weekStartDay_=0
|
161
|
+
*/
|
162
|
+
weekStartDay_: 0
|
163
|
+
}
|
164
|
+
|
165
|
+
/**
|
166
|
+
* Stores the last date change which got triggered while a month / year transition was running
|
167
|
+
* @member {Date|null} cachedUpdate=null
|
168
|
+
* @protected
|
169
|
+
*/
|
170
|
+
cachedUpdate = null
|
171
|
+
|
172
|
+
/**
|
173
|
+
* Convenience shortcut
|
174
|
+
* @returns {Object|Neo.component.Base|null}
|
175
|
+
*/
|
176
|
+
get dayView() {
|
177
|
+
return this.getItem('day-view')
|
178
|
+
}
|
179
|
+
|
180
|
+
/**
|
181
|
+
* Triggered after the currentDate config got changed
|
182
|
+
* @param {Date} value
|
183
|
+
* @param {Date} oldValue
|
184
|
+
* @protected
|
185
|
+
*/
|
186
|
+
afterSetCurrentDate(value, oldValue) {
|
187
|
+
let me = this;
|
188
|
+
|
189
|
+
if (me.mounted) {
|
190
|
+
// todo
|
191
|
+
} else if (value) {
|
192
|
+
// me.updateHeaderMonth(0, 0, true);
|
193
|
+
// me.updateHeaderYear(0, true);
|
194
|
+
me.dayView.currentDate = value
|
195
|
+
}
|
196
|
+
}
|
197
|
+
|
198
|
+
/**
|
199
|
+
* Triggered after the dayNameFormat config got changed
|
200
|
+
* @param {String} value
|
201
|
+
* @param {String} oldValue
|
202
|
+
* @protected
|
203
|
+
*/
|
204
|
+
afterSetDayNameFormat(value, oldValue) {
|
205
|
+
this.updateHeaderDays(value, oldValue)
|
206
|
+
}
|
207
|
+
|
208
|
+
/**
|
209
|
+
* Triggered after the showCellBorders config got changed
|
210
|
+
* @param {Boolean} value
|
211
|
+
* @param {Boolean} oldValue
|
212
|
+
* @protected
|
213
|
+
*/
|
214
|
+
afterSetShowCellBorders(value, oldValue) {
|
215
|
+
let me = this,
|
216
|
+
cls = me.cls;
|
217
|
+
|
218
|
+
NeoArray.toggle(cls, 'neo-hide-inner-borders', !value);
|
219
|
+
me.cls = cls
|
220
|
+
}
|
221
|
+
|
222
|
+
/**
|
223
|
+
* Triggered after the value config got changed
|
224
|
+
* @param {String} value
|
225
|
+
* @param {String} oldValue
|
226
|
+
* @protected
|
227
|
+
*/
|
228
|
+
afterSetValue(value, oldValue) {
|
229
|
+
let me = this;
|
230
|
+
|
231
|
+
if (value) {
|
232
|
+
if (!me.isUpdating) {
|
233
|
+
me.currentDate = new Date(`${value}T00:00:00.000Z`);
|
234
|
+
|
235
|
+
me.fire('change', {
|
236
|
+
component: me,
|
237
|
+
oldValue,
|
238
|
+
value
|
239
|
+
})
|
240
|
+
} else {
|
241
|
+
me.cacheUpdate()
|
242
|
+
}
|
243
|
+
}
|
244
|
+
}
|
245
|
+
|
246
|
+
/**
|
247
|
+
* Triggered before the dayNameFormat config gets changed
|
248
|
+
* @param {String} value
|
249
|
+
* @param {String} oldValue
|
250
|
+
* @protected
|
251
|
+
*/
|
252
|
+
beforeSetDayNameFormat(value, oldValue) {
|
253
|
+
return this.beforeSetEnumValue(value, oldValue, 'dayNameFormat', DateUtil.prototype.dayNameFormats)
|
254
|
+
}
|
255
|
+
|
256
|
+
/**
|
257
|
+
* Triggered before the selectionModel config gets changed.
|
258
|
+
* @param {Neo.selection.Model} value
|
259
|
+
* @param {Neo.selection.Model} oldValue
|
260
|
+
* @protected
|
261
|
+
*/
|
262
|
+
beforeSetSelectionModel(value, oldValue) {
|
263
|
+
oldValue && oldValue.destroy();
|
264
|
+
|
265
|
+
return ClassSystemUtil.beforeSetInstance(value, DateSelectorModel)
|
266
|
+
}
|
267
|
+
|
268
|
+
/**
|
269
|
+
* Triggered before the weekStartDay config gets changed
|
270
|
+
* @param {String} value
|
271
|
+
* @param {String} oldValue
|
272
|
+
* @protected
|
273
|
+
*/
|
274
|
+
beforeSetWeekStartDay(value, oldValue) {
|
275
|
+
return this.beforeSetEnumValue(value, oldValue, 'weekStartDay', DateUtil.prototype.weekStartDays)
|
276
|
+
}
|
277
|
+
|
278
|
+
/**
|
279
|
+
* Stores the last date change which could not get applied while a transition was running
|
280
|
+
* @param {Date} [date=this.currentDate]
|
281
|
+
* @protected
|
282
|
+
*/
|
283
|
+
cacheUpdate(date=this.currentDate) {
|
284
|
+
this.cachedUpdate = date
|
285
|
+
}
|
286
|
+
|
287
|
+
/**
|
288
|
+
* @param {Number} increment
|
289
|
+
*/
|
290
|
+
changeMonth(increment) {
|
291
|
+
let date = this.currentDate; // cloned
|
292
|
+
date.setMonth(date.getMonth() + increment);
|
293
|
+
this.value = DateUtil.convertToyyyymmdd(date)
|
294
|
+
}
|
295
|
+
|
296
|
+
/**
|
297
|
+
* @param {Object} data
|
298
|
+
*/
|
299
|
+
onNextButtonClick(data) {
|
300
|
+
this.changeMonth(1)
|
301
|
+
}
|
302
|
+
|
303
|
+
/**
|
304
|
+
* @param {Object} data
|
305
|
+
*/
|
306
|
+
onPrevButtonClick(data) {
|
307
|
+
this.changeMonth(-1)
|
308
|
+
}
|
309
|
+
|
310
|
+
/**
|
311
|
+
* @param {String} value
|
312
|
+
* @param {String} oldValue
|
313
|
+
* @param {Boolean} [silent=false]
|
314
|
+
*/
|
315
|
+
updateHeaderDays(value, oldValue, silent=false) {
|
316
|
+
let me = this;
|
317
|
+
|
318
|
+
let foo = me.intlFormatDay; // todo
|
319
|
+
me.intlFormatDay = new Intl.DateTimeFormat(me.locale, {weekday: value});
|
320
|
+
|
321
|
+
if (oldValue !== undefined) {
|
322
|
+
let centerEl = me.dayView.vdom.cn[0],
|
323
|
+
date = me.currentDate, // cloned
|
324
|
+
i = 0,
|
325
|
+
day, node;
|
326
|
+
|
327
|
+
date.setDate(me.currentDate.getDate() - me.currentDate.getDay() + me.weekStartDay);
|
328
|
+
|
329
|
+
for (; i < 7; i++) {
|
330
|
+
node = centerEl.cn[i];
|
331
|
+
|
332
|
+
node.cn[0].html = me.intlFormatDay.format(date);
|
333
|
+
|
334
|
+
day = date.getDay();
|
335
|
+
|
336
|
+
if (!me.showWeekends && (day === 0 || day === 6)) {
|
337
|
+
node.removeDom = true
|
338
|
+
} else {
|
339
|
+
delete node.removeDom
|
340
|
+
}
|
341
|
+
|
342
|
+
date.setDate(date.getDate() + 1)
|
343
|
+
}
|
344
|
+
|
345
|
+
!silent && me.update()
|
346
|
+
}
|
347
|
+
}
|
348
|
+
}
|
349
|
+
|
350
|
+
Neo.setupClass(SelectorContainer);
|
351
|
+
|
352
|
+
export default SelectorContainer;
|
@@ -0,0 +1,33 @@
|
|
1
|
+
import Component from '../model/Component.mjs';
|
2
|
+
|
3
|
+
/**
|
4
|
+
* @class Neo.date.SelectorContainerModel
|
5
|
+
* @extends Neo.model.Component
|
6
|
+
*/
|
7
|
+
class SelectorContainerModel extends Component {
|
8
|
+
static config = {
|
9
|
+
/**
|
10
|
+
* @member {String} className='Neo.date.SelectorContainerModel'
|
11
|
+
* @protected
|
12
|
+
*/
|
13
|
+
className: 'Neo.date.SelectorContainerModel',
|
14
|
+
/**
|
15
|
+
* @member {Object} data
|
16
|
+
*/
|
17
|
+
data: {
|
18
|
+
/**
|
19
|
+
* @member {Intl.DateTimeFormat|null} data.intlFormatDay=null
|
20
|
+
*/
|
21
|
+
intlFormatDay: null,
|
22
|
+
/**
|
23
|
+
* 0-6 => Sun-Sat
|
24
|
+
* @member {Number} data.weekStartDay=0
|
25
|
+
*/
|
26
|
+
weekStartDay: 0
|
27
|
+
}
|
28
|
+
}
|
29
|
+
}
|
30
|
+
|
31
|
+
Neo.setupClass(SelectorContainerModel);
|
32
|
+
|
33
|
+
export default SelectorContainerModel;
|
package/src/form/Container.mjs
CHANGED
@@ -198,14 +198,14 @@ class Container extends BaseContainer {
|
|
198
198
|
/**
|
199
199
|
* @returns {Promise<Object>}
|
200
200
|
*/
|
201
|
-
async
|
201
|
+
async getSubmitValues() {
|
202
202
|
let fields = await this.getFields(),
|
203
203
|
Radio = Neo.form.field.Radio,
|
204
204
|
values = {},
|
205
205
|
fieldName, key, ns, nsArray, value;
|
206
206
|
|
207
207
|
fields.forEach(field => {
|
208
|
-
value = field.
|
208
|
+
value = field.getSubmitValue();
|
209
209
|
|
210
210
|
if (field.name) {
|
211
211
|
fieldName = field.name;
|
@@ -254,6 +254,14 @@ class Container extends BaseContainer {
|
|
254
254
|
return values
|
255
255
|
}
|
256
256
|
|
257
|
+
/**
|
258
|
+
* @deprecated in v7.x
|
259
|
+
* @returns {Promise<Object>}
|
260
|
+
*/
|
261
|
+
async getValues() {
|
262
|
+
return this.getSubmitValues()
|
263
|
+
}
|
264
|
+
|
257
265
|
/**
|
258
266
|
* Returns true in case no form field isValid() call returns false
|
259
267
|
* @returns {Promise<Boolean>}
|
package/src/form/field/Base.mjs
CHANGED
@@ -305,10 +305,18 @@ class Base extends Component {
|
|
305
305
|
/**
|
306
306
|
* @returns {*}
|
307
307
|
*/
|
308
|
-
|
308
|
+
getSubmitValue() {
|
309
309
|
return this.value
|
310
310
|
}
|
311
311
|
|
312
|
+
/**
|
313
|
+
* @deprecated in v7.x
|
314
|
+
* @returns {*}
|
315
|
+
*/
|
316
|
+
getValue() {
|
317
|
+
return this.getSubmitValue()
|
318
|
+
}
|
319
|
+
|
312
320
|
/**
|
313
321
|
* @returns {Boolean}
|
314
322
|
*/
|
@@ -337,7 +345,7 @@ class Base extends Component {
|
|
337
345
|
|
338
346
|
let me = this,
|
339
347
|
FormContainer = Neo.form?.Container,
|
340
|
-
opts = {...data, component: me, value: me.
|
348
|
+
opts = {...data, component: me, value: me.getSubmitValue()};
|
341
349
|
|
342
350
|
if (me.isTouchedEvent === 'focusLeave') {
|
343
351
|
me.isTouched = true
|