@questwork/vue-q-widget-vue3 3.1.1 → 3.1.3
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/dist/q-widget.min.js +34 -15
- package/dist/q-widget.min.js.LICENSE.txt +82 -1
- package/lib/helpers/index.js +1 -0
- package/lib/helpers/utilities/convertString/convertString.js +14 -0
- package/lib/helpers/utilities/convertString/index.js +1 -0
- package/lib/helpers/utilities/getStringByArr/getStringByArr.js +59 -0
- package/lib/helpers/utilities/getStringByArr/index.js +1 -0
- package/lib/helpers/utilities/getValidation/getValidation.js +19 -0
- package/lib/helpers/utilities/getValidation/index.js +1 -0
- package/lib/helpers/utilities/getValueByKeys/getValueByKeys.js +13 -0
- package/lib/helpers/utilities/getValueByKeys/index.js +1 -0
- package/lib/helpers/utilities/index.js +5 -1
- package/lib/helpers/utilities/keyValueObject/index.js +1 -0
- package/lib/helpers/utilities/keyValueObject/keyValueObject.js +7 -0
- package/lib/models/controller/controller.js +21 -6
- package/lib/models/factories/nodeFactory.js +1 -0
- package/lib/models/index.js +0 -1
- package/lib/models/nodes/element.js +1 -0
- package/lib/models/nodes/elements/index.js +3 -0
- package/lib/models/nodes/elements/qButton.js +15 -0
- package/lib/models/nodes/elements/qForm.js +21 -15
- package/lib/models/nodes/elements/qGrid.js +16 -2
- package/lib/models/nodes/elements/qHtml.js +15 -0
- package/lib/models/nodes/elements/qLabel.js +15 -0
- package/lib/models/nodes/elements/qList.js +29 -9
- package/lib/models/nodes/elements/qPaginator.js +18 -0
- package/lib/models/nodes/elements/qScheduler.js +30 -0
- package/lib/models/nodes/elements/qTab.js +13 -0
- package/package.json +17 -27
- package/vite.config.js +20 -27
- package/lib/models/controllerHelpers/controllerHelpers.js +0 -46
- package/lib/models/controllerHelpers/index.js +0 -1
- /package/lib/helpers/{utilities/configHandler → configHandler}/configHandler.js +0 -0
- /package/lib/helpers/{utilities/configHandler → configHandler}/handlers/elementQForm/buttonsHandler.js +0 -0
- /package/lib/helpers/{utilities/configHandler → configHandler}/handlers/elementQForm/elementQFormConfigHandler.js +0 -0
- /package/lib/helpers/{utilities/configHandler → configHandler}/handlers/elementQForm/index.js +0 -0
- /package/lib/helpers/{utilities/configHandler → configHandler}/handlers/elementQForm/layoutHandler.js +0 -0
- /package/lib/helpers/{utilities/configHandler → configHandler}/handlers/elementQList/actionsHandler.js +0 -0
- /package/lib/helpers/{utilities/configHandler → configHandler}/handlers/elementQList/bulkActionHandler.js +0 -0
- /package/lib/helpers/{utilities/configHandler → configHandler}/handlers/elementQList/elementQListConfigHandler.js +0 -0
- /package/lib/helpers/{utilities/configHandler → configHandler}/handlers/elementQList/headersHandler.js +0 -0
- /package/lib/helpers/{utilities/configHandler → configHandler}/handlers/elementQList/index.js +0 -0
- /package/lib/helpers/{utilities/configHandler → configHandler}/handlers/index.js +0 -0
- /package/lib/helpers/{utilities/configHandler → configHandler}/index.js +0 -0
|
@@ -1 +1,82 @@
|
|
|
1
|
-
|
|
1
|
+
Name: @questwork/q-utilities
|
|
2
|
+
Version: 0.1.0
|
|
3
|
+
License: MIT
|
|
4
|
+
Private: false
|
|
5
|
+
Description: Questwork QUtilities
|
|
6
|
+
Author: Questwork Consulting Limited <info@questwork.com> (https://questwork.com/)
|
|
7
|
+
License Copyright:
|
|
8
|
+
===
|
|
9
|
+
|
|
10
|
+
Copyright 2019 Questwork Consulting Limited
|
|
11
|
+
|
|
12
|
+
This project is free software released under the MIT/X11 license:
|
|
13
|
+
|
|
14
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
15
|
+
|
|
16
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
17
|
+
|
|
18
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
Name: lodash
|
|
23
|
+
Version: 4.17.21
|
|
24
|
+
License: MIT
|
|
25
|
+
Private: false
|
|
26
|
+
Description: Lodash modular utilities.
|
|
27
|
+
Repository: undefined
|
|
28
|
+
Homepage: https://lodash.com/
|
|
29
|
+
Author: John-David Dalton <john.david.dalton@gmail.com>
|
|
30
|
+
Contributors:
|
|
31
|
+
John-David Dalton <john.david.dalton@gmail.com>
|
|
32
|
+
Mathias Bynens <mathias@qiwi.be>
|
|
33
|
+
License Copyright:
|
|
34
|
+
===
|
|
35
|
+
|
|
36
|
+
Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
37
|
+
|
|
38
|
+
Based on Underscore.js, copyright Jeremy Ashkenas,
|
|
39
|
+
DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
|
|
40
|
+
|
|
41
|
+
This software consists of voluntary contributions made by many
|
|
42
|
+
individuals. For exact contribution history, see the revision history
|
|
43
|
+
available at https://github.com/lodash/lodash
|
|
44
|
+
|
|
45
|
+
The following license applies to all parts of this software except as
|
|
46
|
+
documented below:
|
|
47
|
+
|
|
48
|
+
====
|
|
49
|
+
|
|
50
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
51
|
+
a copy of this software and associated documentation files (the
|
|
52
|
+
"Software"), to deal in the Software without restriction, including
|
|
53
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
54
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
55
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
56
|
+
the following conditions:
|
|
57
|
+
|
|
58
|
+
The above copyright notice and this permission notice shall be
|
|
59
|
+
included in all copies or substantial portions of the Software.
|
|
60
|
+
|
|
61
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
62
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
63
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
64
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
65
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
66
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
67
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
68
|
+
|
|
69
|
+
====
|
|
70
|
+
|
|
71
|
+
Copyright and related rights for sample code are waived via CC0. Sample
|
|
72
|
+
code is defined as all source code displayed within the prose of the
|
|
73
|
+
documentation.
|
|
74
|
+
|
|
75
|
+
CC0: http://creativecommons.org/publicdomain/zero/1.0/
|
|
76
|
+
|
|
77
|
+
====
|
|
78
|
+
|
|
79
|
+
Files located in the node_modules and vendor directories are externally
|
|
80
|
+
maintained libraries used by this software which have their own
|
|
81
|
+
licenses; we recommend you read them, as their terms may differ from the
|
|
82
|
+
terms above.
|
package/lib/helpers/index.js
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { getValueByKeys } from '../getValueByKeys'
|
|
2
|
+
|
|
3
|
+
import { convertString as _convertString } from '@questwork/q-utilities'
|
|
4
|
+
|
|
5
|
+
function convertString(string, patternMatch, value) {
|
|
6
|
+
return _convertString(string, patternMatch, value, getValueByKeys)
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
convertString
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
convertString
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { convertString } from './convertString'
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { getValidation as _getValidation } from '../getValidation'
|
|
2
|
+
import { getValueByKeys as _getValueByKeys } from '../getValueByKeys'
|
|
3
|
+
|
|
4
|
+
function getStringByArr(arr, data) {
|
|
5
|
+
return _getStringByArr(arr, data, _getValueByKeys, _getValidation)
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
getStringByArr
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
getStringByArr
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function _getStringByArr(arr, data, getValueByKeys, getValidation) {
|
|
16
|
+
if (!Array.isArray(arr) || arr.length === 0) {
|
|
17
|
+
return ''
|
|
18
|
+
}
|
|
19
|
+
return arr.reduce((acc, item) => {
|
|
20
|
+
const { type, value = '', restriction, template } = item
|
|
21
|
+
if (getValidation({ rule: restriction, data })) {
|
|
22
|
+
switch (type) {
|
|
23
|
+
case ('label'): {
|
|
24
|
+
acc += (value.toString())
|
|
25
|
+
break
|
|
26
|
+
}
|
|
27
|
+
case ('value'): {
|
|
28
|
+
const _value = getValueByKeys({ keys: value.split('.'), obj: data }) || ''
|
|
29
|
+
acc += (_value.toString())
|
|
30
|
+
break
|
|
31
|
+
}
|
|
32
|
+
case ('array'): {
|
|
33
|
+
const _value = getValueByKeys({ keys: value.split('.'), obj: data }) || []
|
|
34
|
+
acc += _value.reduce((_acc, _item) => (_acc += getStringByArr(template, _item)), '')
|
|
35
|
+
break
|
|
36
|
+
}
|
|
37
|
+
case ('group'): {
|
|
38
|
+
acc += getStringByArr(template, data)
|
|
39
|
+
break
|
|
40
|
+
}
|
|
41
|
+
case ('ellipsis'): {
|
|
42
|
+
const { maxLength } = item
|
|
43
|
+
const _value = getValueByKeys({ keys: value.split('.'), obj: data }) || ''
|
|
44
|
+
if (_value.length <= maxLength) {
|
|
45
|
+
acc += (_value.toString())
|
|
46
|
+
} else {
|
|
47
|
+
acc += `${_value.substr(0, maxLength)}...`
|
|
48
|
+
}
|
|
49
|
+
break
|
|
50
|
+
}
|
|
51
|
+
default: {
|
|
52
|
+
acc += (value.toString())
|
|
53
|
+
break
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return acc
|
|
58
|
+
}, '')
|
|
59
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { getStringByArr } from './getStringByArr'
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { getValueByKeys as _getValueByKeys } from '../getValueByKeys'
|
|
2
|
+
import { KeyValueObject } from '../keyValueObject'
|
|
3
|
+
import { getValidation as _getValidation } from '@questwork/q-utilities'
|
|
4
|
+
|
|
5
|
+
function getValidation({ rule, data }) {
|
|
6
|
+
return _getValidation(rule, data, _getDataByKey, KeyValueObject)
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function _getDataByKey(key, data) {
|
|
10
|
+
const keys = key.split('.')
|
|
11
|
+
return _getValueByKeys({ keys, obj: data })
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export default {
|
|
15
|
+
getValidation
|
|
16
|
+
}
|
|
17
|
+
export {
|
|
18
|
+
getValidation
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { getValidation } from './getValidation'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { getValueByKeys } from './getValueByKeys'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { KeyValueObject } from './keyValueObject'
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { NodeFactory } from '../factories'
|
|
2
2
|
import { setId } from '../../helpers'
|
|
3
|
-
|
|
4
3
|
class Controller {
|
|
5
4
|
constructor(opt = {}) {
|
|
6
5
|
this.css = opt.css || {}
|
|
@@ -10,11 +9,16 @@ class Controller {
|
|
|
10
9
|
this.initialState = opt.initialState
|
|
11
10
|
this.name = opt.name
|
|
12
11
|
this.saveStateKeys = opt.saveStateKeys || []
|
|
13
|
-
this.setLayout(opt.layout
|
|
12
|
+
this.setLayout(opt.layout)
|
|
14
13
|
}
|
|
15
14
|
|
|
16
15
|
get isValid() {
|
|
17
|
-
return !!this.id &&
|
|
16
|
+
return !!this.id && this.isValidControllerHelpers
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
get isValidControllerHelpers() {
|
|
20
|
+
const { qUtilities } = this.controllerHelpers
|
|
21
|
+
return qUtilities && isFunction(qUtilities.convertString) && isFunction(qUtilities.getValidation)
|
|
18
22
|
}
|
|
19
23
|
|
|
20
24
|
static init(layout) {
|
|
@@ -41,7 +45,11 @@ class Controller {
|
|
|
41
45
|
return this.state
|
|
42
46
|
}
|
|
43
47
|
|
|
44
|
-
setLayout(layout
|
|
48
|
+
setLayout(layout) {
|
|
49
|
+
const controllerHelpers = {
|
|
50
|
+
...this.controllerHelpers,
|
|
51
|
+
controller: this
|
|
52
|
+
}
|
|
45
53
|
this.layout = NodeFactory.init({ layout, controllerHelpers })
|
|
46
54
|
}
|
|
47
55
|
|
|
@@ -49,15 +57,22 @@ class Controller {
|
|
|
49
57
|
this.elements = elements
|
|
50
58
|
}
|
|
51
59
|
|
|
52
|
-
updateState(state) {
|
|
60
|
+
updateState(state = {}) {
|
|
53
61
|
this.state = {
|
|
54
62
|
...this.state,
|
|
55
63
|
...state
|
|
56
64
|
}
|
|
57
|
-
this.layout
|
|
65
|
+
if (this.layout) {
|
|
66
|
+
this.layout.updateElementState(this.state)
|
|
67
|
+
}
|
|
58
68
|
}
|
|
59
69
|
}
|
|
60
70
|
|
|
71
|
+
function isFunction(fun) {
|
|
72
|
+
return typeof fun === 'function'
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
|
|
61
76
|
export default {
|
|
62
77
|
Controller
|
|
63
78
|
}
|
package/lib/models/index.js
CHANGED
|
@@ -4,6 +4,7 @@ import { configHandler } from '../../helpers'
|
|
|
4
4
|
class Element extends Node {
|
|
5
5
|
constructor(opt = {}) {
|
|
6
6
|
super(opt)
|
|
7
|
+
this.controllerHelpers = opt.controllerHelpers
|
|
7
8
|
this.configPermissions = opt.configPermissions
|
|
8
9
|
this.name = opt.name
|
|
9
10
|
this.nodeType = opt.nodeType || 'Element'
|
|
@@ -6,6 +6,7 @@ import { ElementQImport } from './qImport'
|
|
|
6
6
|
import { ElementQLabel } from './qLabel'
|
|
7
7
|
import { ElementQList } from './qList'
|
|
8
8
|
import { ElementQPaginator } from './qPaginator'
|
|
9
|
+
import { ElementQScheduler } from './qScheduler'
|
|
9
10
|
import { ElementQTab } from './qTab'
|
|
10
11
|
|
|
11
12
|
export default {
|
|
@@ -17,6 +18,7 @@ export default {
|
|
|
17
18
|
ElementQLabel,
|
|
18
19
|
ElementQList,
|
|
19
20
|
ElementQPaginator,
|
|
21
|
+
ElementQScheduler,
|
|
20
22
|
ElementQTab,
|
|
21
23
|
}
|
|
22
24
|
|
|
@@ -29,5 +31,6 @@ export {
|
|
|
29
31
|
ElementQLabel,
|
|
30
32
|
ElementQList,
|
|
31
33
|
ElementQPaginator,
|
|
34
|
+
ElementQScheduler,
|
|
32
35
|
ElementQTab,
|
|
33
36
|
}
|
|
@@ -3,6 +3,21 @@ import { Element } from '../element'
|
|
|
3
3
|
class ElementQButton extends Element {
|
|
4
4
|
constructor(opt = {}) {
|
|
5
5
|
super(opt)
|
|
6
|
+
this.defaultStateName = {
|
|
7
|
+
qButton: 'qButton'
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
getConfig() {
|
|
12
|
+
let config = this.config || {}
|
|
13
|
+
if (this.state.qButton) {
|
|
14
|
+
const stateConfig = this.state.qButton
|
|
15
|
+
config = {
|
|
16
|
+
...stateConfig,
|
|
17
|
+
...config
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return config
|
|
6
21
|
}
|
|
7
22
|
}
|
|
8
23
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import lodash from 'lodash'
|
|
1
2
|
import { Element } from '../element'
|
|
2
3
|
import { ElementQFormConfig } from '../../configs'
|
|
3
4
|
|
|
@@ -14,17 +15,30 @@ class ElementQForm extends Element {
|
|
|
14
15
|
}
|
|
15
16
|
}
|
|
16
17
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
get isValid() {
|
|
19
|
+
return super.isValid && this.isValidHelpers
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
get isValidHelpers() {
|
|
23
|
+
const { qForm } = this.controllerHelpers || {}
|
|
24
|
+
const { NodeHelper } = qForm || {}
|
|
25
|
+
if (typeof NodeHelper !== 'function') {
|
|
26
|
+
console.log('invalid form helpers')
|
|
27
|
+
return false
|
|
28
|
+
}
|
|
29
|
+
return true
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
getConfig() {
|
|
33
|
+
const config = {
|
|
34
|
+
...(this.state.qForm || {}),
|
|
35
|
+
...(this.config || {}),
|
|
36
|
+
...(this.state[this.name] || {})
|
|
23
37
|
}
|
|
24
38
|
return typeof ElementQFormConfig === 'function' ? ElementQFormConfig.init({
|
|
25
39
|
...config,
|
|
26
40
|
helpers: {
|
|
27
|
-
...
|
|
41
|
+
...this.controllerHelpers,
|
|
28
42
|
element: this
|
|
29
43
|
},
|
|
30
44
|
}) : {}
|
|
@@ -49,14 +63,6 @@ function _customizer(objValue, srcValue) {
|
|
|
49
63
|
return undefined
|
|
50
64
|
}
|
|
51
65
|
|
|
52
|
-
function _getStateConfig(qForm) {
|
|
53
|
-
const { buttons = [], layout = {}, trees = [] } = qForm || {}
|
|
54
|
-
return {
|
|
55
|
-
buttons,
|
|
56
|
-
layout,
|
|
57
|
-
trees
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
66
|
|
|
61
67
|
export default {
|
|
62
68
|
ElementQForm
|
|
@@ -9,7 +9,21 @@ class ElementQGrid extends Element {
|
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
get isValid() {
|
|
13
|
+
return super.isValid && this.isValidHelpers
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
get isValidHelpers() {
|
|
17
|
+
const { qGrid } = this.controllerHelpers || {}
|
|
18
|
+
const { QItem, Cell } = qGrid || {}
|
|
19
|
+
if (typeof QItem !== 'function' || typeof Cell !== 'function') {
|
|
20
|
+
console.log('invalid grid helpers')
|
|
21
|
+
return false
|
|
22
|
+
}
|
|
23
|
+
return true
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
getConfig() {
|
|
13
27
|
let config = this.config || {}
|
|
14
28
|
if (this.state.qGrid) {
|
|
15
29
|
const stateConfig = this.state.qGrid
|
|
@@ -21,7 +35,7 @@ class ElementQGrid extends Element {
|
|
|
21
35
|
return typeof ElementQGridConfig === 'function' ? ElementQGridConfig.init({
|
|
22
36
|
...config,
|
|
23
37
|
helpers: {
|
|
24
|
-
...
|
|
38
|
+
...this.controllerHelpers,
|
|
25
39
|
element: this,
|
|
26
40
|
},
|
|
27
41
|
}) : {}
|
|
@@ -3,6 +3,21 @@ import { Element } from '../element'
|
|
|
3
3
|
class ElementQHtml extends Element {
|
|
4
4
|
constructor(opt = {}) {
|
|
5
5
|
super(opt)
|
|
6
|
+
this.defaultStateName = {
|
|
7
|
+
qHtml: 'qHtml'
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
getConfig() {
|
|
12
|
+
let config = this.config || {}
|
|
13
|
+
if (this.state.qHtml) {
|
|
14
|
+
const stateConfig = this.state.qHtml
|
|
15
|
+
config = {
|
|
16
|
+
...stateConfig,
|
|
17
|
+
...config
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return config
|
|
6
21
|
}
|
|
7
22
|
}
|
|
8
23
|
|
|
@@ -3,6 +3,21 @@ import { Element } from '../element'
|
|
|
3
3
|
class ElementQLabel extends Element {
|
|
4
4
|
constructor(opt = {}) {
|
|
5
5
|
super(opt)
|
|
6
|
+
this.defaultStateName = {
|
|
7
|
+
qLabel: 'qLabel'
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
getConfig() {
|
|
12
|
+
let config = this.config || {}
|
|
13
|
+
if (this.state.qLabel) {
|
|
14
|
+
const stateConfig = this.state.qLabel
|
|
15
|
+
config = {
|
|
16
|
+
...stateConfig,
|
|
17
|
+
...config
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return config
|
|
6
21
|
}
|
|
7
22
|
}
|
|
8
23
|
|
|
@@ -11,19 +11,39 @@ class ElementQList extends Element {
|
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
get isValid() {
|
|
15
|
+
return super.isValid && this.isValidHelpers
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
get isValidHelpers() {
|
|
19
|
+
const { qList } = this.controllerHelpers || {}
|
|
20
|
+
const { QListBulkButton, QListButton, QRow } = qList || {}
|
|
21
|
+
if (typeof QListBulkButton !== 'function' || typeof QListButton !== 'function' || typeof QRow !== 'function') {
|
|
22
|
+
console.log('invalid list helpers')
|
|
23
|
+
return false
|
|
24
|
+
}
|
|
25
|
+
return true
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
getConfig() {
|
|
30
|
+
// let config = this.config || {}
|
|
31
|
+
// if (this.state.qList) {
|
|
32
|
+
// const stateConfig = _getStateConfig(this.state.qList)
|
|
33
|
+
// config = {
|
|
34
|
+
// ...stateConfig,
|
|
35
|
+
// ...config
|
|
36
|
+
// }
|
|
37
|
+
// }
|
|
38
|
+
const config = {
|
|
39
|
+
...(this.state.qList || {}),
|
|
40
|
+
...(this.config || {}),
|
|
41
|
+
...(this.state[this.name] || {})
|
|
22
42
|
}
|
|
23
43
|
return typeof ElementQListConfig === 'function' ? ElementQListConfig.init({
|
|
24
44
|
...config,
|
|
25
45
|
helpers: {
|
|
26
|
-
...
|
|
46
|
+
...this.controllerHelpers,
|
|
27
47
|
element: this
|
|
28
48
|
},
|
|
29
49
|
}) : {}
|
|
@@ -6,9 +6,27 @@ class ElementQPaginator extends Element {
|
|
|
6
6
|
this.defaultStateName = {
|
|
7
7
|
currentPage: 'currentPage',
|
|
8
8
|
currentPageSize: 'currentPageSize',
|
|
9
|
+
qPaginator: 'qPaginator',
|
|
9
10
|
totalRecords: 'totalRecords'
|
|
10
11
|
}
|
|
11
12
|
}
|
|
13
|
+
|
|
14
|
+
getConfig() {
|
|
15
|
+
return {
|
|
16
|
+
...(this.state.qPaginator || {}),
|
|
17
|
+
...(this.config || {}),
|
|
18
|
+
...(this.state[this.name] || {})
|
|
19
|
+
}
|
|
20
|
+
// let config = this.config || {}
|
|
21
|
+
// if (this.state.qPaginator) {
|
|
22
|
+
// const stateConfig = this.state.qPaginator
|
|
23
|
+
// config = {
|
|
24
|
+
// ...stateConfig,
|
|
25
|
+
// ...config
|
|
26
|
+
// }
|
|
27
|
+
// }
|
|
28
|
+
// return config
|
|
29
|
+
}
|
|
12
30
|
}
|
|
13
31
|
|
|
14
32
|
export default {
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Element } from '../element'
|
|
2
|
+
|
|
3
|
+
class ElementQScheduler extends Element {
|
|
4
|
+
constructor(opt = {}) {
|
|
5
|
+
super(opt)
|
|
6
|
+
this.defaultStateName = {
|
|
7
|
+
qScheduler: 'qScheduler'
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
getConfig() {
|
|
12
|
+
let config = this.config || {}
|
|
13
|
+
if (this.state.qScheduler) {
|
|
14
|
+
const stateConfig = this.state.qScheduler
|
|
15
|
+
config = {
|
|
16
|
+
...stateConfig,
|
|
17
|
+
...config
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return config
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export default {
|
|
25
|
+
ElementQScheduler
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export {
|
|
29
|
+
ElementQScheduler
|
|
30
|
+
}
|
|
@@ -5,9 +5,22 @@ class ElementQTab extends Element {
|
|
|
5
5
|
super(opt)
|
|
6
6
|
this.defaultStateName = {
|
|
7
7
|
active: 'active',
|
|
8
|
+
qTab: 'qTab',
|
|
8
9
|
tabLayout: 'tabLayout'
|
|
9
10
|
}
|
|
10
11
|
}
|
|
12
|
+
|
|
13
|
+
getConfig() {
|
|
14
|
+
let config = this.config || {}
|
|
15
|
+
if (this.state.qTab) {
|
|
16
|
+
const stateConfig = this.state.qTab
|
|
17
|
+
config = {
|
|
18
|
+
...stateConfig,
|
|
19
|
+
...config
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return config
|
|
23
|
+
}
|
|
11
24
|
}
|
|
12
25
|
|
|
13
26
|
export default {
|