neo.mjs 6.15.5 → 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 +3 -3
- package/resources/data/deck/learnneo/pages/Welcome.md +8 -0
- package/resources/data/deck/learnneo/pages/WhyNeo-Speed.md +5 -3
- package/resources/data/deck/learnneo/tree.json +4 -4
- 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 +20 -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/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,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
|
@@ -201,7 +201,7 @@ class CheckBox extends Base {
|
|
201
201
|
me.update();
|
202
202
|
|
203
203
|
if (oldValue !== undefined) {
|
204
|
-
me.fireChangeEvent(me.
|
204
|
+
me.fireChangeEvent(me.getSubmitValue(), me.getOldSubmitValue())
|
205
205
|
}
|
206
206
|
}
|
207
207
|
|
@@ -498,20 +498,28 @@ class CheckBox extends Base {
|
|
498
498
|
}
|
499
499
|
|
500
500
|
/**
|
501
|
-
* Counterpart to
|
501
|
+
* Counterpart to getSubmitValue(), returning the uncheckedValue if checked
|
502
502
|
* @returns {String|null}
|
503
503
|
*/
|
504
|
-
|
504
|
+
getOldSubmitValue() {
|
505
505
|
let me = this;
|
506
506
|
|
507
507
|
return me.checked ? me.uncheckedValue : me.value
|
508
508
|
}
|
509
509
|
|
510
|
+
/**
|
511
|
+
* @deprecated in v7.x
|
512
|
+
* @returns {String|null}
|
513
|
+
*/
|
514
|
+
getOldValue() {
|
515
|
+
return this.getOldSubmitValue()
|
516
|
+
}
|
517
|
+
|
510
518
|
/**
|
511
519
|
* Returns this.value if checked, otherwise this.uncheckedValue
|
512
520
|
* @returns {String|null}
|
513
521
|
*/
|
514
|
-
|
522
|
+
getSubmitValue() {
|
515
523
|
let me = this;
|
516
524
|
|
517
525
|
return me.checked ? me.value : me.uncheckedValue
|
@@ -554,7 +562,7 @@ class CheckBox extends Base {
|
|
554
562
|
|
555
563
|
me.checked = checked;
|
556
564
|
|
557
|
-
me.fireUserChangeEvent(me.
|
565
|
+
me.fireUserChangeEvent(me.getSubmitValue(), me.getOldSubmitValue())
|
558
566
|
}
|
559
567
|
|
560
568
|
/**
|
@@ -254,12 +254,12 @@ class ComboBox extends Picker {
|
|
254
254
|
// Promote an array of items to be a Store
|
255
255
|
if (Array.isArray(value)) {
|
256
256
|
value = {
|
257
|
-
data
|
257
|
+
data: value.map((v, i) => {
|
258
258
|
// Simplest case is just picking string values.
|
259
259
|
if (typeof v === 'string') {
|
260
260
|
v = {
|
261
|
-
[
|
262
|
-
[
|
261
|
+
[displayField]: v,
|
262
|
+
[valueField] : v
|
263
263
|
}
|
264
264
|
}
|
265
265
|
|
@@ -273,8 +273,8 @@ class ComboBox extends Picker {
|
|
273
273
|
if (Neo.typeOf(value) === 'Object' && !value.model && !value.module && !value.ntype) {
|
274
274
|
value.model = {
|
275
275
|
fields: [
|
276
|
-
{name:
|
277
|
-
{name:
|
276
|
+
{name: displayField, type: 'String'},
|
277
|
+
{name: valueField, type: 'String'}
|
278
278
|
]
|
279
279
|
}
|
280
280
|
}
|
@@ -483,7 +483,7 @@ class ComboBox extends Picker {
|
|
483
483
|
/**
|
484
484
|
* @returns {Number|String}
|
485
485
|
*/
|
486
|
-
|
486
|
+
getSubmitValue() {
|
487
487
|
let me = this;
|
488
488
|
|
489
489
|
return me.value?.[me.valueField] || me.emptyValue
|
@@ -510,6 +510,11 @@ class ComboBox extends Picker {
|
|
510
510
|
onFocusLeave(data) {
|
511
511
|
let me = this;
|
512
512
|
|
513
|
+
/*
|
514
|
+
* If we are leaving the field, using forceSelection=true and the field does not have a selected record,
|
515
|
+
* we do want to pick the closest match => the focussed record (honoring filters).
|
516
|
+
* If no record is found, we will clear the field instead.
|
517
|
+
*/
|
513
518
|
if (me.forceSelection && !me.value) {
|
514
519
|
me.programmaticValueChange = true;
|
515
520
|
me.value = me.store.get(me.activeRecordId);
|
@@ -533,13 +538,13 @@ class ComboBox extends Picker {
|
|
533
538
|
}
|
534
539
|
}
|
535
540
|
|
536
|
-
// TODO:
|
537
|
-
// When we are using a `Collection` as our `valueCollection`, and that `Collection` is the
|
538
|
-
// `items` of the List's `selectionModel`, then this will be `onValueCollectionChange`,
|
539
|
-
// a `mutate` listener on our own `valueCollection` which backs our `value` field which
|
540
|
-
// will be implemented by a getter which accesses `valueCollection`.
|
541
|
-
// This will become important for implementing multiSelect
|
542
541
|
/**
|
542
|
+
* todo:
|
543
|
+
* When we are using a `Collection` as our `valueCollection`, and that `Collection` is the
|
544
|
+
* `items` of the List's `selectionModel`, then this will be `onValueCollectionChange`,
|
545
|
+
* a `mutate` listener on our own `valueCollection` which backs our `value` field which
|
546
|
+
* will be implemented by a getter which accesses `valueCollection`.
|
547
|
+
* This will become important for implementing multiSelect
|
543
548
|
* @param {Object} selectionChangeEvent
|
544
549
|
* @param {Object[]} selectionChangeEvent.selection
|
545
550
|
* @protected
|
@@ -584,12 +589,12 @@ class ComboBox extends Picker {
|
|
584
589
|
* @protected
|
585
590
|
*/
|
586
591
|
onListItemNavigate(record) {
|
587
|
-
let {
|
592
|
+
let {activeIndex} = record;
|
588
593
|
|
589
594
|
if (activeIndex >= 0) {
|
590
595
|
const
|
591
|
-
me
|
592
|
-
{
|
596
|
+
me = this,
|
597
|
+
{store} = me;
|
593
598
|
|
594
599
|
me.activeRecord = store.getAt(activeIndex);
|
595
600
|
me.activeRecordId = me.activeRecord[store.keyProperty || model.keyProperty];
|
package/src/form/field/Date.mjs
CHANGED
@@ -85,7 +85,7 @@ class DateField extends Picker {
|
|
85
85
|
*/
|
86
86
|
invalidInput = false
|
87
87
|
/**
|
88
|
-
* Setting the value to true will return a Date object when calling
|
88
|
+
* Setting the value to true will return a Date object when calling getSubmitValue()
|
89
89
|
* @member {Boolean} submitDateObject=false
|
90
90
|
*/
|
91
91
|
submitDateObject = false
|
@@ -183,7 +183,7 @@ class DateField extends Picker {
|
|
183
183
|
/**
|
184
184
|
* @returns {Date|String|null}
|
185
185
|
*/
|
186
|
-
|
186
|
+
getSubmitValue() {
|
187
187
|
let value = this.value;
|
188
188
|
|
189
189
|
if(this.submitDateObject && value) {
|
package/src/form/field/Text.mjs
CHANGED
@@ -1003,14 +1003,16 @@ class Text extends Base {
|
|
1003
1003
|
value = [value]
|
1004
1004
|
}
|
1005
1005
|
|
1006
|
-
let me
|
1006
|
+
let me = this,
|
1007
|
+
{appName, windowId} = me;
|
1007
1008
|
|
1008
1009
|
value.forEach((item, index) => {
|
1009
1010
|
if (item.isClass) {
|
1010
1011
|
value[index] = Neo.create(item, {
|
1011
|
-
appName
|
1012
|
-
id
|
1013
|
-
field
|
1012
|
+
appName,
|
1013
|
+
id : me.getTriggerId(item.prototype.type),
|
1014
|
+
field: me,
|
1015
|
+
windowId
|
1014
1016
|
})
|
1015
1017
|
} else if (!(item instanceof BaseTrigger)) {
|
1016
1018
|
if (!item.module && !item.ntype) {
|
@@ -1024,8 +1026,9 @@ class Text extends Base {
|
|
1024
1026
|
|
1025
1027
|
value[index] = Neo[item.className ? 'create' : 'ntype']({
|
1026
1028
|
...item,
|
1027
|
-
appName
|
1028
|
-
field
|
1029
|
+
appName,
|
1030
|
+
field: me,
|
1031
|
+
windowId
|
1029
1032
|
})
|
1030
1033
|
}
|
1031
1034
|
});
|
@@ -1145,6 +1148,15 @@ class Text extends Base {
|
|
1145
1148
|
return `${this.id}__label`
|
1146
1149
|
}
|
1147
1150
|
|
1151
|
+
/**
|
1152
|
+
* @returns {*}
|
1153
|
+
*/
|
1154
|
+
getSubmitValue() {
|
1155
|
+
let superSubmitValue = super.getSubmitValue();
|
1156
|
+
|
1157
|
+
return this.xssProtected ? StringUtil.escapeHtml(superSubmitValue) : superSubmitValue
|
1158
|
+
}
|
1159
|
+
|
1148
1160
|
/**
|
1149
1161
|
* @param {String} type
|
1150
1162
|
* @returns {Neo.form.field.trigger.Base|null}
|
@@ -1192,17 +1204,6 @@ class Text extends Base {
|
|
1192
1204
|
return this.id + '-trigger-' + type
|
1193
1205
|
}
|
1194
1206
|
|
1195
|
-
/**
|
1196
|
-
* @returns {*}
|
1197
|
-
*/
|
1198
|
-
getValue() {
|
1199
|
-
if (this.xssProtected) {
|
1200
|
-
return StringUtil.escapeHtml(super.getValue())
|
1201
|
-
} else {
|
1202
|
-
return super.getValue()
|
1203
|
-
}
|
1204
|
-
}
|
1205
|
-
|
1206
1207
|
/**
|
1207
1208
|
* @returns {Boolean}
|
1208
1209
|
*/
|