|
153 | 153 |
|
154 | 154 | // Set expected properties if not provided
|
155 | 155 | if (!Array.isArray(this.model.children)) {
|
156 |
| - this.model.children = []; |
| 156 | + this.$set(this.model, 'children', []); |
157 | 157 | }
|
158 | 158 |
|
159 | 159 | // Set basic node options
|
160 | 160 | if (typeof this.model.expandable !== 'boolean') {
|
161 |
| - this.model.expandable = true; |
| 161 | + this.$set(this.model, 'expandable', true); |
162 | 162 | }
|
163 | 163 | if (typeof this.model.selectable !== 'boolean') {
|
164 |
| - this.model.selectable = false; |
| 164 | + this.$set(this.model, 'selectable', false); |
165 | 165 | }
|
166 | 166 |
|
167 | 167 | this.$_treeViewNode_normalizeNodeInputData();
|
|
177 | 177 | // For nodes that are inputs, they must specify at least a type.
|
178 | 178 | // Only a subset of types are accepted.
|
179 | 179 | if (input === null || typeof input !== 'object' || !['checkbox', 'radio'].includes(input.type)) {
|
180 |
| - this.model.input = null; |
| 180 | + this.$set(this.model, 'input', null); |
181 | 181 | }
|
182 | 182 | else {
|
183 | 183 | if (typeof input.name !== 'string' || input.name.trim().length === 0) {
|
184 |
| - input.name = null; |
| 184 | + this.$set(input, 'name', null); |
185 | 185 | }
|
186 | 186 |
|
187 | 187 | if (input.type === 'radio') {
|
188 | 188 | if (typeof input.name !== 'string' || input.name.trim().length === 0) {
|
189 |
| - input.name = 'unspecifiedRadioName'; |
| 189 | + this.$set(input, 'name', 'unspecifiedRadioName'); |
190 | 190 | }
|
191 | 191 | if (typeof input.value !== 'string' || input.value.trim().length === 0) {
|
192 |
| - input.value = this.model.label.replace(/[\s&<>"'\/]/g, ''); |
| 192 | + this.$set(input, 'value', this.model.label.replace(/[\s&<>"'\/]/g, '')); |
193 | 193 | }
|
194 | 194 | if (!this.radioGroupValues.hasOwnProperty(input.name)) {
|
195 |
| - this.radioGroupValues[input.name] = ''; |
| 195 | + this.$set(this.radioGroupValues, input.name, ''); |
196 | 196 | }
|
197 | 197 | }
|
198 | 198 | }
|
|
202 | 202 | */
|
203 | 203 | $_treeViewNode_normalizeNodeStateData() {
|
204 | 204 | if (this.model.state === null || typeof this.model.state !== 'object') {
|
205 |
| - this.model.state = {}; |
| 205 | + this.$set(this.model, 'state', {}); |
206 | 206 | }
|
207 | 207 |
|
208 | 208 | let state = this.model.state;
|
209 | 209 |
|
210 | 210 | if (typeof state.expanded !== 'boolean') {
|
211 |
| - state.expanded = false; |
| 211 | + this.$set(state, 'expanded', false); |
212 | 212 | }
|
213 | 213 | if (typeof state.selected !== 'boolean') {
|
214 |
| - state.selected = false; |
| 214 | + this.$set(state, 'selected', false); |
215 | 215 | }
|
216 | 216 |
|
217 | 217 | if (this.model.input) {
|
218 | 218 | if (state.input === null || typeof state.input !== 'object') {
|
219 |
| - state.input = {}; |
| 219 | + this.$set(state, 'input', {}); |
220 | 220 | }
|
221 | 221 |
|
222 | 222 | if (state.input.disabled === null || typeof state.input.disabled !== 'boolean') {
|
223 |
| - state.input.disabled = false; |
| 223 | + this.$set(state.input, 'disabled', false); |
224 | 224 | }
|
225 | 225 |
|
226 | 226 | if (this.model.input.type === 'checkbox') {
|
227 | 227 |
|
228 | 228 | if (typeof state.input.value !== 'boolean') {
|
229 |
| - state.input.value = false; |
| 229 | + this.$set(state.input, 'value', false); |
230 | 230 | }
|
231 | 231 | }
|
232 | 232 | }
|
|
0 commit comments