neo.mjs 5.10.0 → 5.10.2
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/examples/ServiceWorker.mjs +2 -2
- package/examples/container/base/MainContainer.mjs +78 -0
- package/examples/container/{app.mjs → base/app.mjs} +1 -1
- package/examples/container/{index.html → base/index.html} +1 -1
- package/examples/container/{neo-config.json → base/neo-config.json} +2 -2
- package/examples/container/dialog/MainContainer.mjs +68 -0
- package/examples/container/dialog/MainContainerController.mjs +80 -0
- package/examples/container/dialog/app.mjs +6 -0
- package/examples/container/dialog/index.html +11 -0
- package/examples/container/dialog/neo-config.json +7 -0
- package/examples/form/field/checkbox/MainContainer.mjs +2 -2
- package/examples/form/field/text/MainContainer.mjs +2 -2
- package/package.json +3 -3
- package/resources/scss/src/container/Dialog.scss +12 -0
- package/src/DefaultConfig.mjs +2 -2
- package/src/container/Dialog.mjs +221 -0
- package/src/dialog/header/Toolbar.mjs +7 -7
- package/src/form/field/CheckBox.mjs +19 -2
- package/src/form/field/Select.mjs +15 -9
- package/src/form/field/Text.mjs +20 -5
- package/src/main/addon/Dialog.mjs +68 -0
- package/examples/container/MainContainer.mjs +0 -93
package/apps/ServiceWorker.mjs
CHANGED
@@ -0,0 +1,78 @@
|
|
1
|
+
import Button from '../../../src/button/Base.mjs';
|
2
|
+
import Container from '../../../src/container/Base.mjs';
|
3
|
+
|
4
|
+
/**
|
5
|
+
* @class Neo.examples.container.base.MainContainer
|
6
|
+
* @extends Neo.container.Base
|
7
|
+
*/
|
8
|
+
class MainContainer extends Container {
|
9
|
+
static config = {
|
10
|
+
className: 'Neo.examples.container.base.MainContainer',
|
11
|
+
autoMount: true,
|
12
|
+
layout : 'vbox',
|
13
|
+
|
14
|
+
items: [{
|
15
|
+
ntype : 'button',
|
16
|
+
iconCls: 'fa fa-home',
|
17
|
+
text : 'Hello',
|
18
|
+
width : 200
|
19
|
+
}, {
|
20
|
+
ntype : 'button',
|
21
|
+
iconCls: 'fa fa-user',
|
22
|
+
text : 'World'
|
23
|
+
}, {
|
24
|
+
ntype : 'container',
|
25
|
+
layout: {
|
26
|
+
ntype: 'hbox',
|
27
|
+
align: 'stretch'
|
28
|
+
},
|
29
|
+
items : [{
|
30
|
+
ntype : 'button',
|
31
|
+
iconCls: 'fa fa-home',
|
32
|
+
style : {color: 'red'},
|
33
|
+
text : 'Hello2',
|
34
|
+
width : 200
|
35
|
+
}, {
|
36
|
+
ntype : 'button',
|
37
|
+
flex : 1,
|
38
|
+
iconCls : 'fa fa-user',
|
39
|
+
iconColor: 'red',
|
40
|
+
text : 'World2'
|
41
|
+
}]
|
42
|
+
}, {
|
43
|
+
ntype: 'container',
|
44
|
+
|
45
|
+
layout: {
|
46
|
+
ntype: 'vbox',
|
47
|
+
align: 'start'
|
48
|
+
},
|
49
|
+
|
50
|
+
style: {
|
51
|
+
marginTop: '30px'
|
52
|
+
},
|
53
|
+
|
54
|
+
items: [{
|
55
|
+
ntype : 'button',
|
56
|
+
iconCls : 'fa fa-home',
|
57
|
+
iconPosition: 'right',
|
58
|
+
text : 'Right'
|
59
|
+
}, {
|
60
|
+
ntype : 'button',
|
61
|
+
flex : 1,
|
62
|
+
iconCls : 'fa fa-user',
|
63
|
+
iconPosition: 'top',
|
64
|
+
text : 'Top'
|
65
|
+
}, {
|
66
|
+
ntype : 'button',
|
67
|
+
flex : 1,
|
68
|
+
iconCls : 'fa fa-play-circle',
|
69
|
+
iconPosition: 'bottom',
|
70
|
+
text : 'Bottom'
|
71
|
+
}]
|
72
|
+
}]
|
73
|
+
}
|
74
|
+
}
|
75
|
+
|
76
|
+
Neo.applyClassConfig(MainContainer);
|
77
|
+
|
78
|
+
export default MainContainer;
|
@@ -0,0 +1,68 @@
|
|
1
|
+
import Button from '../../../src/button/Base.mjs';
|
2
|
+
import ConfigurationViewport from '../../ConfigurationViewport.mjs';
|
3
|
+
import MainContainerController from './MainContainerController.mjs';
|
4
|
+
import NumberField from '../../../src/form/field/Number.mjs';
|
5
|
+
import TextField from '../../../src/form/field/Text.mjs';
|
6
|
+
|
7
|
+
/**
|
8
|
+
* @class Neo.examples.container.dialog.MainContainer
|
9
|
+
* @extends Neo.examples.ConfigurationViewport
|
10
|
+
*/
|
11
|
+
class MainContainer extends ConfigurationViewport {
|
12
|
+
static config = {
|
13
|
+
className : 'Neo.examples.container.dialog.MainContainer',
|
14
|
+
configItemLabelWidth: 160,
|
15
|
+
configItemWidth : 280,
|
16
|
+
controller : MainContainerController,
|
17
|
+
layout : {ntype: 'hbox', align: 'stretch'}
|
18
|
+
}
|
19
|
+
|
20
|
+
createConfigurationComponents() {
|
21
|
+
let me = this;
|
22
|
+
|
23
|
+
return [{
|
24
|
+
module : TextField,
|
25
|
+
clearable : true,
|
26
|
+
labelText : 'title',
|
27
|
+
listeners : {change: me.controller.onConfigChange.bind(me.controller, 'title')},
|
28
|
+
style : {marginTop: '10px'},
|
29
|
+
value : 'example dialog'
|
30
|
+
}, {
|
31
|
+
module : NumberField,
|
32
|
+
clearable : true,
|
33
|
+
labelText : 'height',
|
34
|
+
listeners : {change: me.controller.onConfigChange.bind(me.controller, 'height')},
|
35
|
+
maxValue : 1000,
|
36
|
+
minValue : 100,
|
37
|
+
stepSize : 10,
|
38
|
+
style : {marginTop: '10px'},
|
39
|
+
value : 300
|
40
|
+
}, {
|
41
|
+
module : NumberField,
|
42
|
+
clearable : true,
|
43
|
+
labelText : 'width',
|
44
|
+
listeners : {change: me.controller.onConfigChange.bind(me.controller, 'width')},
|
45
|
+
maxValue : 2000,
|
46
|
+
minValue : 100,
|
47
|
+
stepSize : 10,
|
48
|
+
style : {marginTop: '10px'},
|
49
|
+
value : 500
|
50
|
+
}];
|
51
|
+
}
|
52
|
+
|
53
|
+
createExampleComponent() {
|
54
|
+
let controller = this.getController();
|
55
|
+
return Neo.create({
|
56
|
+
module : Button,
|
57
|
+
height : 50,
|
58
|
+
text : 'show Dialog',
|
59
|
+
ui : 'primary',
|
60
|
+
width : 150,
|
61
|
+
handler : controller.onButtonClick.bind(controller)
|
62
|
+
});
|
63
|
+
}
|
64
|
+
}
|
65
|
+
|
66
|
+
Neo.applyClassConfig(MainContainer);
|
67
|
+
|
68
|
+
export default MainContainer;
|
@@ -0,0 +1,80 @@
|
|
1
|
+
import Component from '../../../src/controller/Component.mjs';
|
2
|
+
|
3
|
+
/**
|
4
|
+
* @class Neo.examples.container.dialog.MainContainerController
|
5
|
+
* @extends Neo.controller.Component
|
6
|
+
*/
|
7
|
+
class MainContainerController extends Component {
|
8
|
+
static config = {
|
9
|
+
/**
|
10
|
+
* @member {String} className='Neo.examples.container.dialog.MainContainerController'
|
11
|
+
* @protected
|
12
|
+
*/
|
13
|
+
className: 'Neo.examples.container.dialog.MainContainerController'
|
14
|
+
}
|
15
|
+
|
16
|
+
dialog = null;
|
17
|
+
title = 'example dialog';
|
18
|
+
height = 300;
|
19
|
+
width = 500;
|
20
|
+
|
21
|
+
/**
|
22
|
+
*
|
23
|
+
* @param {*} config
|
24
|
+
*/
|
25
|
+
construct(config) {
|
26
|
+
super.construct(config);
|
27
|
+
}
|
28
|
+
|
29
|
+
/**
|
30
|
+
*
|
31
|
+
* @param {Object} data
|
32
|
+
*/
|
33
|
+
async onButtonClick(data) {
|
34
|
+
if (!this.dialog) {
|
35
|
+
let module = await import ('../../../src/container/Dialog.mjs');
|
36
|
+
this.dialog = Neo.create({
|
37
|
+
module: module.default,
|
38
|
+
appName: this.component.appName,
|
39
|
+
autoMount: true,
|
40
|
+
autoRender: true,
|
41
|
+
title: this.title,
|
42
|
+
height: this.height,
|
43
|
+
width: this.width,
|
44
|
+
iconCls: ['fa', 'fa-home'],
|
45
|
+
|
46
|
+
headerConfig: {
|
47
|
+
items: [{
|
48
|
+
ntype: 'button',
|
49
|
+
text: 'foo'
|
50
|
+
}],
|
51
|
+
style: {borderBottom: 'solid 1px #bdbdbd'}
|
52
|
+
},
|
53
|
+
|
54
|
+
items: [{
|
55
|
+
ntype: 'container',
|
56
|
+
html: 'text'
|
57
|
+
}]
|
58
|
+
})
|
59
|
+
}
|
60
|
+
this.dialog.show();
|
61
|
+
|
62
|
+
console.log(data, this);
|
63
|
+
}
|
64
|
+
|
65
|
+
/**
|
66
|
+
* @param {String} config
|
67
|
+
* @param {Object} opts
|
68
|
+
*/
|
69
|
+
onConfigChange(config, opts) {
|
70
|
+
if (this.dialog) {
|
71
|
+
this.dialog[config] = opts.value;
|
72
|
+
} else {
|
73
|
+
this[config] = opts.value;
|
74
|
+
}
|
75
|
+
}
|
76
|
+
}
|
77
|
+
|
78
|
+
Neo.applyClassConfig(MainContainerController);
|
79
|
+
|
80
|
+
export default MainContainerController;
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<!DOCTYPE HTML>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
<title>Neo Dialog</title>
|
7
|
+
</head>
|
8
|
+
<body>
|
9
|
+
<script src="../../../src/MicroLoader.mjs" type="module"></script>
|
10
|
+
</body>
|
11
|
+
</html>
|
@@ -100,7 +100,7 @@ class MainContainer extends ConfigurationViewport {
|
|
100
100
|
handler: (() => {me.exampleComponent.reset()}),
|
101
101
|
style : {marginTop: '10px', width: '50%'},
|
102
102
|
text : 'reset()'
|
103
|
-
}]
|
103
|
+
}]
|
104
104
|
}
|
105
105
|
|
106
106
|
createExampleComponent() {
|
@@ -108,7 +108,7 @@ class MainContainer extends ConfigurationViewport {
|
|
108
108
|
labelText : 'Label',
|
109
109
|
labelWidth: 70,
|
110
110
|
width : 200
|
111
|
-
})
|
111
|
+
})
|
112
112
|
}
|
113
113
|
}
|
114
114
|
|
@@ -182,7 +182,7 @@ class MainContainer extends ConfigurationViewport {
|
|
182
182
|
handler: (() => {me.exampleComponent.reset()}),
|
183
183
|
style : {marginTop: '10px', width: '50%'},
|
184
184
|
text : 'reset()'
|
185
|
-
}]
|
185
|
+
}]
|
186
186
|
}
|
187
187
|
|
188
188
|
createExampleComponent() {
|
@@ -201,7 +201,7 @@ class MainContainer extends ConfigurationViewport {
|
|
201
201
|
},
|
202
202
|
scope: this
|
203
203
|
}
|
204
|
-
})
|
204
|
+
})
|
205
205
|
}
|
206
206
|
}
|
207
207
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "neo.mjs",
|
3
|
-
"version": "5.10.
|
3
|
+
"version": "5.10.2",
|
4
4
|
"description": "The webworkers driven UI framework",
|
5
5
|
"type": "module",
|
6
6
|
"repository": {
|
@@ -52,12 +52,12 @@
|
|
52
52
|
"envinfo": "^7.8.1",
|
53
53
|
"fs-extra": "^11.1.1",
|
54
54
|
"highlightjs-line-numbers.js": "^2.8.0",
|
55
|
-
"inquirer": "^9.2.
|
55
|
+
"inquirer": "^9.2.6",
|
56
56
|
"neo-jsdoc": "^1.0.1",
|
57
57
|
"neo-jsdoc-x": "^1.0.5",
|
58
58
|
"postcss": "^8.4.23",
|
59
59
|
"sass": "^1.62.1",
|
60
|
-
"webpack": "^5.
|
60
|
+
"webpack": "^5.84.1",
|
61
61
|
"webpack-cli": "^5.1.1",
|
62
62
|
"webpack-dev-server": "4.15.0",
|
63
63
|
"webpack-hook-plugin": "^1.0.7",
|
package/src/DefaultConfig.mjs
CHANGED
@@ -236,12 +236,12 @@ const DefaultConfig = {
|
|
236
236
|
useVdomWorker: true,
|
237
237
|
/**
|
238
238
|
* buildScripts/injectPackageVersion.mjs will update this value
|
239
|
-
* @default '5.10.
|
239
|
+
* @default '5.10.2'
|
240
240
|
* @memberOf! module:Neo
|
241
241
|
* @name config.version
|
242
242
|
* @type String
|
243
243
|
*/
|
244
|
-
version: '5.10.
|
244
|
+
version: '5.10.2'
|
245
245
|
};
|
246
246
|
|
247
247
|
Object.assign(DefaultConfig, {
|
@@ -0,0 +1,221 @@
|
|
1
|
+
import Base from '../container/Panel.mjs';
|
2
|
+
import NeoArray from '../util/Array.mjs';
|
3
|
+
import HeaderToolbar from '../dialog/header/Toolbar.mjs';
|
4
|
+
|
5
|
+
/**
|
6
|
+
* Lightweight implementation using the dialog tag.
|
7
|
+
* See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dialog
|
8
|
+
* @class Neo.container.Dialog
|
9
|
+
* @extends Neo.container.Panel
|
10
|
+
*/
|
11
|
+
class Dialog extends Base {
|
12
|
+
static config = {
|
13
|
+
/**
|
14
|
+
* @member {String} className='Neo.container.Dialog'
|
15
|
+
* @protected
|
16
|
+
*/
|
17
|
+
className: 'Neo.container.Dialog',
|
18
|
+
/**
|
19
|
+
* @member {String} ntype='container-dialog'
|
20
|
+
* @protected
|
21
|
+
*/
|
22
|
+
ntype: 'container-dialog',
|
23
|
+
/**
|
24
|
+
* @member {String[]} baseCls=['container-dialog']
|
25
|
+
* @protected
|
26
|
+
*/
|
27
|
+
baseCls: ['neo-container-dialog', 'neo-panel', 'neo-container'],
|
28
|
+
/**
|
29
|
+
* @member {Object} headerConfig=null
|
30
|
+
*/
|
31
|
+
headerConfig: null,
|
32
|
+
/**
|
33
|
+
* @member {Neo.toolbar.Base|null} headerToolbar=null
|
34
|
+
*/
|
35
|
+
headerToolbar: null,
|
36
|
+
/**
|
37
|
+
* The CSS class to use for an icon, e.g. 'fa fa-home'
|
38
|
+
* @member {String|null} [iconCls_=null]
|
39
|
+
*/
|
40
|
+
iconCls_: null,
|
41
|
+
/**
|
42
|
+
* @member {Object[]} items
|
43
|
+
*/
|
44
|
+
items: [],
|
45
|
+
/**
|
46
|
+
* @member {String} title=null
|
47
|
+
*/
|
48
|
+
title_: null,
|
49
|
+
/**
|
50
|
+
* @member {Object} _vdom={tag: 'dialog', cn: []}
|
51
|
+
*/
|
52
|
+
_vdom:
|
53
|
+
{tag: 'dialog', cn: []}
|
54
|
+
}
|
55
|
+
|
56
|
+
/**
|
57
|
+
* @param {Object} config
|
58
|
+
*/
|
59
|
+
construct(config) {
|
60
|
+
super.construct(config);
|
61
|
+
this.createHeader();
|
62
|
+
}
|
63
|
+
|
64
|
+
/**
|
65
|
+
* Triggered after the iconCls config got changed
|
66
|
+
* @param {String} value
|
67
|
+
* @param {String} oldValue
|
68
|
+
* @protected
|
69
|
+
*/
|
70
|
+
afterSetIconCls(value, oldValue) {
|
71
|
+
console.log(value, oldValue)
|
72
|
+
|
73
|
+
if (!this.headers) { return }
|
74
|
+
let iconNode = this.headers.down({flag: 'dialog-header-icon'});
|
75
|
+
let iconNodeCls = [...iconNode.cls];
|
76
|
+
|
77
|
+
NeoArray.remove(iconNodeCls, oldValue);
|
78
|
+
NeoArray.add( iconNodeCls, value);
|
79
|
+
|
80
|
+
iconNode.cls = iconNodeCls;
|
81
|
+
|
82
|
+
iconNode.removeDom = !value || value === '';
|
83
|
+
this.update();
|
84
|
+
}
|
85
|
+
|
86
|
+
/**
|
87
|
+
* Triggered after the title config got changed
|
88
|
+
* @param {String} value
|
89
|
+
* @param {String} oldValue
|
90
|
+
* @protected
|
91
|
+
*/
|
92
|
+
afterSetTitle(value, oldValue) {
|
93
|
+
this.headerToolbar?.set({
|
94
|
+
title: value
|
95
|
+
});
|
96
|
+
}
|
97
|
+
|
98
|
+
/**
|
99
|
+
* Converts the iconCls array into a string on beforeGet
|
100
|
+
* @returns {String}
|
101
|
+
* @protected
|
102
|
+
*/
|
103
|
+
beforeGetIconCls() {
|
104
|
+
let iconCls = this._iconCls;
|
105
|
+
|
106
|
+
if (Array.isArray(iconCls)) {
|
107
|
+
return iconCls.join(' ');
|
108
|
+
}
|
109
|
+
|
110
|
+
return iconCls;
|
111
|
+
}
|
112
|
+
|
113
|
+
/**
|
114
|
+
* Triggered before the iconCls config gets changed. Converts the string into an array if needed.
|
115
|
+
* @param {Array|String|null} value
|
116
|
+
* @param {Array|String|null} oldValue
|
117
|
+
* @returns {Array}
|
118
|
+
* @protected
|
119
|
+
*/
|
120
|
+
beforeSetIconCls(value, oldValue) {
|
121
|
+
if (value && !Array.isArray(value)) {
|
122
|
+
value = value.split(' ').filter(Boolean);
|
123
|
+
}
|
124
|
+
|
125
|
+
return value;
|
126
|
+
}
|
127
|
+
|
128
|
+
/**
|
129
|
+
* close the dialog in main thread
|
130
|
+
*/
|
131
|
+
close() {
|
132
|
+
let me = this;
|
133
|
+
|
134
|
+
Neo.main.addon.Dialog.close({
|
135
|
+
id: me.id,
|
136
|
+
appName: me.appName
|
137
|
+
});
|
138
|
+
}
|
139
|
+
|
140
|
+
/**
|
141
|
+
* @protected
|
142
|
+
*/
|
143
|
+
createHeader() {
|
144
|
+
let me = this,
|
145
|
+
cls = ['neo-header-toolbar', 'neo-toolbar'],
|
146
|
+
headers = me.headers || [],
|
147
|
+
headerConfigCopy = {...me.headerConfig};
|
148
|
+
delete headerConfigCopy.items;
|
149
|
+
|
150
|
+
me.headerToolbar = Neo.create({
|
151
|
+
module : HeaderToolbar,
|
152
|
+
actions: [{action: 'close', iconCls: 'fa-solid fa-xmark'}],
|
153
|
+
appName : me.appName,
|
154
|
+
cls,
|
155
|
+
dock : 'top',
|
156
|
+
flex : 'none',
|
157
|
+
id : me.getHeaderToolbarId(),
|
158
|
+
listeners: {headerAction: me.executeHeaderAction, scope: me},
|
159
|
+
items : [{
|
160
|
+
cls: me.iconCls,
|
161
|
+
flag : 'dialog-header-icon',
|
162
|
+
}, {
|
163
|
+
ntype : 'label',
|
164
|
+
cls : ['neo-panel-header-text', 'neo-label'],
|
165
|
+
flag : 'title-label',
|
166
|
+
removeDom: !me.title,
|
167
|
+
text : me.title
|
168
|
+
}, ...me.headerConfig.items],
|
169
|
+
|
170
|
+
...headerConfigCopy
|
171
|
+
});
|
172
|
+
|
173
|
+
headers.unshift(me.headerToolbar);
|
174
|
+
|
175
|
+
me.headers = headers;
|
176
|
+
}
|
177
|
+
|
178
|
+
/**
|
179
|
+
* {Object} data
|
180
|
+
*/
|
181
|
+
executeHeaderAction(data) {
|
182
|
+
let me = this,
|
183
|
+
|
184
|
+
map = {
|
185
|
+
close : me.close
|
186
|
+
};
|
187
|
+
|
188
|
+
map[data.action]?.call(me, data);
|
189
|
+
|
190
|
+
me.fire('headerAction', {
|
191
|
+
dialog: me,
|
192
|
+
...data
|
193
|
+
})
|
194
|
+
}
|
195
|
+
|
196
|
+
/**
|
197
|
+
* Returns the id of the header toolbar
|
198
|
+
* @returns {String}
|
199
|
+
*/
|
200
|
+
getHeaderToolbarId() {
|
201
|
+
return this.id + '-header-toolbar';
|
202
|
+
}
|
203
|
+
|
204
|
+
/**
|
205
|
+
* Shows the dialog (with / without Modal) in main thread
|
206
|
+
* @param {Boolean} modal
|
207
|
+
*/
|
208
|
+
async show(modal = true) {
|
209
|
+
let me = this;
|
210
|
+
await Neo.timeout(20);
|
211
|
+
|
212
|
+
Neo.main.addon.Dialog[modal ? 'showModal': 'show']({
|
213
|
+
id: me.id,
|
214
|
+
appName: me.appName
|
215
|
+
});
|
216
|
+
}
|
217
|
+
}
|
218
|
+
|
219
|
+
Neo.applyClassConfig(Dialog);
|
220
|
+
|
221
|
+
export default Dialog;
|
@@ -48,8 +48,8 @@ class Toolbar extends Base {
|
|
48
48
|
*/
|
49
49
|
afterSetTitle(value, oldValue) {
|
50
50
|
this.down({flag: 'title-label'})?.set({
|
51
|
-
|
52
|
-
text
|
51
|
+
hidden: !value,
|
52
|
+
text : value
|
53
53
|
})
|
54
54
|
}
|
55
55
|
|
@@ -62,11 +62,11 @@ class Toolbar extends Base {
|
|
62
62
|
items = me.items || [];
|
63
63
|
|
64
64
|
items.push({
|
65
|
-
ntype
|
66
|
-
cls
|
67
|
-
flag
|
68
|
-
|
69
|
-
text
|
65
|
+
ntype : 'label',
|
66
|
+
cls : ['neo-panel-header-text', 'neo-label'],
|
67
|
+
flag : 'title-label',
|
68
|
+
hidden: !me.title,
|
69
|
+
text : me.title
|
70
70
|
});
|
71
71
|
|
72
72
|
if (me.actions) {
|
@@ -79,6 +79,17 @@ class CheckBox extends Base {
|
|
79
79
|
* @member {String[]} labelCls_=[]
|
80
80
|
*/
|
81
81
|
labelCls_: [],
|
82
|
+
/**
|
83
|
+
* Edge-case config in case we want to render leading content with their own selectors like:
|
84
|
+
* <span class="my-label-id-cls">E10</span> • Firstname
|
85
|
+
* @member {String|null} labelId_=null
|
86
|
+
*/
|
87
|
+
labelId_: null,
|
88
|
+
/**
|
89
|
+
* CSS rules for labelId
|
90
|
+
* @member {String[]} labelIdCls_=[]
|
91
|
+
*/
|
92
|
+
labelIdCls_: [],
|
82
93
|
/**
|
83
94
|
* Valid values: 'left', 'top'
|
84
95
|
* @member {String} labelPosition_='left'
|
@@ -296,8 +307,14 @@ class CheckBox extends Base {
|
|
296
307
|
* @protected
|
297
308
|
*/
|
298
309
|
afterSetLabelText(value, oldValue) {
|
299
|
-
|
300
|
-
|
310
|
+
let me = this;
|
311
|
+
|
312
|
+
if (me.labelId) {
|
313
|
+
value = `<span class="${me.labelIdCls.join(',')}">${me.labelId}</span> • ${value}`
|
314
|
+
}
|
315
|
+
|
316
|
+
me.vdom.cn[0].cn[0].innerHTML = value;
|
317
|
+
me.update()
|
301
318
|
}
|
302
319
|
|
303
320
|
/**
|
@@ -193,17 +193,23 @@ class Select extends Picker {
|
|
193
193
|
let me = this,
|
194
194
|
filters;
|
195
195
|
|
196
|
-
if (value
|
197
|
-
|
196
|
+
if (value) {
|
197
|
+
if (me.useFilter) {
|
198
|
+
filters = value.filters || [];
|
199
|
+
|
200
|
+
filters.push({
|
201
|
+
includeEmptyValues: true,
|
202
|
+
operator : me.filterOperator,
|
203
|
+
property : me.displayField,
|
204
|
+
value : value.get(me.value)?.[me.displayField] || me.value
|
205
|
+
});
|
198
206
|
|
199
|
-
|
200
|
-
|
201
|
-
operator : me.filterOperator,
|
202
|
-
property : me.displayField,
|
203
|
-
value : value.get(me.value)?.[me.displayField] || me.value
|
204
|
-
});
|
207
|
+
value.filters = filters
|
208
|
+
}
|
205
209
|
|
206
|
-
|
210
|
+
if (me.list) {
|
211
|
+
me.list.store = value
|
212
|
+
}
|
207
213
|
}
|
208
214
|
}
|
209
215
|
|
package/src/form/field/Text.mjs
CHANGED
@@ -130,6 +130,17 @@ class Text extends Base {
|
|
130
130
|
* @member {String[]} labelCls_=[]
|
131
131
|
*/
|
132
132
|
labelCls_: [],
|
133
|
+
/**
|
134
|
+
* Edge-case config in case we want to render leading content with their own selectors like:
|
135
|
+
* <span class="my-label-id-cls">E10</span> • Firstname
|
136
|
+
* @member {String|null} labelId_=null
|
137
|
+
*/
|
138
|
+
labelId_: null,
|
139
|
+
/**
|
140
|
+
* CSS rules for labelId
|
141
|
+
* @member {String[]} labelIdCls_=[]
|
142
|
+
*/
|
143
|
+
labelIdCls_: [],
|
133
144
|
/**
|
134
145
|
* @member {String} labelOptionalText_=' (Optional)'
|
135
146
|
*/
|
@@ -502,6 +513,10 @@ class Text extends Base {
|
|
502
513
|
let me = this,
|
503
514
|
isEmpty = me.isEmpty();
|
504
515
|
|
516
|
+
if (me.labelId) {
|
517
|
+
value = `<span class="${me.labelIdCls.join(',')}">${me.labelId}</span> • ${value}`
|
518
|
+
}
|
519
|
+
|
505
520
|
me.getLabelEl().innerHTML = value;
|
506
521
|
|
507
522
|
if (!me.hideLabel) {
|
@@ -512,9 +527,9 @@ class Text extends Base {
|
|
512
527
|
|
513
528
|
me.promiseVdomUpdate().then(() => {
|
514
529
|
me.updateCenterBorderElWidth(isEmpty)
|
515
|
-
})
|
530
|
+
})
|
516
531
|
} else {
|
517
|
-
me.update()
|
532
|
+
me.update()
|
518
533
|
}
|
519
534
|
}
|
520
535
|
}
|
@@ -532,7 +547,7 @@ class Text extends Base {
|
|
532
547
|
label = vdom.cn[0];
|
533
548
|
|
534
549
|
label.width = value;
|
535
|
-
!me.hideLabel && me.updateInputWidth()
|
550
|
+
!me.hideLabel && me.updateInputWidth()
|
536
551
|
}
|
537
552
|
}
|
538
553
|
|
@@ -544,7 +559,7 @@ class Text extends Base {
|
|
544
559
|
*/
|
545
560
|
afterSetMaxLength(value, oldValue) {
|
546
561
|
this.validate(); // silent
|
547
|
-
this.changeInputElKey('maxlength', value)
|
562
|
+
this.changeInputElKey('maxlength', value)
|
548
563
|
}
|
549
564
|
|
550
565
|
/**
|
@@ -576,7 +591,7 @@ class Text extends Base {
|
|
576
591
|
|
577
592
|
for (; i < len; i++) {
|
578
593
|
if (!triggers[i].vdom.removeDom) {
|
579
|
-
triggers[i].mounted = value
|
594
|
+
triggers[i].mounted = value
|
580
595
|
}
|
581
596
|
}
|
582
597
|
|
@@ -0,0 +1,68 @@
|
|
1
|
+
import Base from '../../core/Base.mjs';
|
2
|
+
import DomAccess from '../DomAccess.mjs'
|
3
|
+
/**
|
4
|
+
* Addon for component.Dialog
|
5
|
+
* @class Neo.main.addon.Dialog
|
6
|
+
* @extends Neo.core.Base
|
7
|
+
* @singleton
|
8
|
+
*/
|
9
|
+
class Dialog extends Base {
|
10
|
+
static config = {
|
11
|
+
/**
|
12
|
+
* @member {String} className='Neo.main.addon.Dialog'
|
13
|
+
* @protected
|
14
|
+
*/
|
15
|
+
className: 'Neo.main.addon.Dialog',
|
16
|
+
/**
|
17
|
+
* Remote method access for other workers
|
18
|
+
* @member {Object} remote={app: [//...]}
|
19
|
+
* @protected
|
20
|
+
*/
|
21
|
+
remote: {
|
22
|
+
app: [
|
23
|
+
'close',
|
24
|
+
'show',
|
25
|
+
'showModal'
|
26
|
+
]
|
27
|
+
},
|
28
|
+
/**
|
29
|
+
* @member {Boolean} singleton=true
|
30
|
+
* @protected
|
31
|
+
*/
|
32
|
+
singleton: true
|
33
|
+
}
|
34
|
+
|
35
|
+
/**
|
36
|
+
* @param {Object} data
|
37
|
+
* @param {String} data.id
|
38
|
+
* @returns {Boolean}
|
39
|
+
*/
|
40
|
+
close(data) {
|
41
|
+
DomAccess.getElement(data.id).close()
|
42
|
+
return true;
|
43
|
+
}
|
44
|
+
|
45
|
+
/**
|
46
|
+
* @param {Object} data
|
47
|
+
* @param {String} data.id
|
48
|
+
* @returns {Boolean}
|
49
|
+
*/
|
50
|
+
show(data) {
|
51
|
+
DomAccess.getElement(data.id).show()
|
52
|
+
return true;
|
53
|
+
}
|
54
|
+
|
55
|
+
/**
|
56
|
+
* @param {Object} data
|
57
|
+
* @param {String} data.id
|
58
|
+
* @returns {Boolean}
|
59
|
+
*/
|
60
|
+
showModal(data) {
|
61
|
+
DomAccess.getElement(data.id).showModal()
|
62
|
+
return true;
|
63
|
+
}
|
64
|
+
}
|
65
|
+
|
66
|
+
let instance = Neo.applyClassConfig(Dialog);
|
67
|
+
|
68
|
+
export default instance;
|
@@ -1,93 +0,0 @@
|
|
1
|
-
import Button from '../../src/button/Base.mjs';
|
2
|
-
import Container from '../../src/container/Base.mjs';
|
3
|
-
|
4
|
-
/**
|
5
|
-
* @class Neo.examples.container.MainContainer
|
6
|
-
* @extends Neo.container.Base
|
7
|
-
*/
|
8
|
-
class MainContainer extends Container {
|
9
|
-
static config = {
|
10
|
-
className: 'Neo.examples.container.MainContainer',
|
11
|
-
autoMount: true,
|
12
|
-
layout : 'vbox',
|
13
|
-
|
14
|
-
items: [
|
15
|
-
{
|
16
|
-
ntype : 'button',
|
17
|
-
iconCls: 'fa fa-home',
|
18
|
-
text : 'Hello',
|
19
|
-
width : 200
|
20
|
-
},
|
21
|
-
{
|
22
|
-
ntype : 'button',
|
23
|
-
iconCls: 'fa fa-user',
|
24
|
-
text : 'World'
|
25
|
-
},
|
26
|
-
{
|
27
|
-
ntype : 'container',
|
28
|
-
layout: {
|
29
|
-
ntype: 'hbox',
|
30
|
-
align: 'stretch'
|
31
|
-
},
|
32
|
-
items: [
|
33
|
-
{
|
34
|
-
ntype : 'button',
|
35
|
-
iconCls: 'fa fa-home',
|
36
|
-
text : 'Hello2',
|
37
|
-
width : 200,
|
38
|
-
|
39
|
-
style: {
|
40
|
-
color: 'red'
|
41
|
-
}
|
42
|
-
},
|
43
|
-
{
|
44
|
-
ntype : 'button',
|
45
|
-
flex : 1,
|
46
|
-
iconCls : 'fa fa-user',
|
47
|
-
iconColor: 'red',
|
48
|
-
text : 'World2'
|
49
|
-
},
|
50
|
-
]
|
51
|
-
},
|
52
|
-
{
|
53
|
-
ntype : 'container',
|
54
|
-
|
55
|
-
layout: {
|
56
|
-
ntype: 'vbox',
|
57
|
-
align: 'start'
|
58
|
-
},
|
59
|
-
|
60
|
-
style: {
|
61
|
-
marginTop: '30px'
|
62
|
-
},
|
63
|
-
|
64
|
-
items: [
|
65
|
-
{
|
66
|
-
ntype : 'button',
|
67
|
-
iconCls : 'fa fa-home',
|
68
|
-
iconPosition: 'right',
|
69
|
-
text : 'Right'
|
70
|
-
},
|
71
|
-
{
|
72
|
-
ntype : 'button',
|
73
|
-
flex : 1,
|
74
|
-
iconCls : 'fa fa-user',
|
75
|
-
iconPosition: 'top',
|
76
|
-
text : 'Top'
|
77
|
-
},
|
78
|
-
{
|
79
|
-
ntype : 'button',
|
80
|
-
flex : 1,
|
81
|
-
iconCls : 'fa fa-play-circle',
|
82
|
-
iconPosition: 'bottom',
|
83
|
-
text : 'Bottom'
|
84
|
-
}
|
85
|
-
]
|
86
|
-
}
|
87
|
-
]
|
88
|
-
}
|
89
|
-
}
|
90
|
-
|
91
|
-
Neo.applyClassConfig(MainContainer);
|
92
|
-
|
93
|
-
export default MainContainer;
|