@questwork/vue-q-widget-vue3 3.1.0
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/.babelrc.json +16 -0
- package/LICENSE +9 -0
- package/dist/q-widget.min.js +14 -0
- package/dist/q-widget.min.js.LICENSE.txt +1 -0
- package/lib/helpers/controller/index.js +11 -0
- package/lib/helpers/controller/saveState.js +26 -0
- package/lib/helpers/controller/showError.js +27 -0
- package/lib/helpers/index.js +2 -0
- package/lib/helpers/utilities/configHandler/configHandler.js +26 -0
- package/lib/helpers/utilities/configHandler/handlers/elementQForm/buttonsHandler.js +41 -0
- package/lib/helpers/utilities/configHandler/handlers/elementQForm/elementQFormConfigHandler.js +38 -0
- package/lib/helpers/utilities/configHandler/handlers/elementQForm/index.js +1 -0
- package/lib/helpers/utilities/configHandler/handlers/elementQForm/layoutHandler.js +54 -0
- package/lib/helpers/utilities/configHandler/handlers/elementQList/actionsHandler.js +41 -0
- package/lib/helpers/utilities/configHandler/handlers/elementQList/bulkActionHandler.js +53 -0
- package/lib/helpers/utilities/configHandler/handlers/elementQList/elementQListConfigHandler.js +43 -0
- package/lib/helpers/utilities/configHandler/handlers/elementQList/headersHandler.js +48 -0
- package/lib/helpers/utilities/configHandler/handlers/elementQList/index.js +1 -0
- package/lib/helpers/utilities/configHandler/handlers/index.js +15 -0
- package/lib/helpers/utilities/configHandler/index.js +1 -0
- package/lib/helpers/utilities/index.js +2 -0
- package/lib/helpers/utilities/setId/index.js +1 -0
- package/lib/helpers/utilities/setId/setId.js +10 -0
- package/lib/index.js +2 -0
- package/lib/models/configs/config.js +23 -0
- package/lib/models/configs/elementQForm/buttonHandler.js +68 -0
- package/lib/models/configs/elementQForm/elementQForm.js +34 -0
- package/lib/models/configs/elementQForm/index.js +1 -0
- package/lib/models/configs/elementQForm/makeFormHandler.js +27 -0
- package/lib/models/configs/elementQForm/nodeHandler.js +60 -0
- package/lib/models/configs/elementQGrid/elementQGrid.js +50 -0
- package/lib/models/configs/elementQGrid/index.js +1 -0
- package/lib/models/configs/elementQGrid/makeClasses.js +86 -0
- package/lib/models/configs/elementQList/elementQList.js +75 -0
- package/lib/models/configs/elementQList/index.js +1 -0
- package/lib/models/configs/elementQList/makeQWidgetQListBulkButton.js +78 -0
- package/lib/models/configs/elementQList/makeQWidgetQListButton.js +83 -0
- package/lib/models/configs/elementQList/makeQWidgetQListHeader.js +75 -0
- package/lib/models/configs/index.js +3 -0
- package/lib/models/controller/controller.js +67 -0
- package/lib/models/controller/index.js +1 -0
- package/lib/models/controllerHelpers/controllerHelpers.js +46 -0
- package/lib/models/controllerHelpers/index.js +1 -0
- package/lib/models/factories/index.js +1 -0
- package/lib/models/factories/nodeFactory.js +55 -0
- package/lib/models/index.js +5 -0
- package/lib/models/nodes/container.js +37 -0
- package/lib/models/nodes/containers/box.js +16 -0
- package/lib/models/nodes/containers/column.js +16 -0
- package/lib/models/nodes/containers/headerSticky.js +16 -0
- package/lib/models/nodes/containers/index.js +18 -0
- package/lib/models/nodes/containers/row.js +16 -0
- package/lib/models/nodes/element.js +124 -0
- package/lib/models/nodes/elements/index.js +33 -0
- package/lib/models/nodes/elements/qButton.js +15 -0
- package/lib/models/nodes/elements/qForm.js +67 -0
- package/lib/models/nodes/elements/qGrid.js +35 -0
- package/lib/models/nodes/elements/qHtml.js +15 -0
- package/lib/models/nodes/elements/qImport.js +15 -0
- package/lib/models/nodes/elements/qLabel.js +15 -0
- package/lib/models/nodes/elements/qList.js +46 -0
- package/lib/models/nodes/elements/qPaginator.js +20 -0
- package/lib/models/nodes/elements/qTab.js +19 -0
- package/lib/models/nodes/index.js +21 -0
- package/lib/models/nodes/node.js +69 -0
- package/package.json +73 -0
- package/vite.config.js +52 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Element } from '../element'
|
|
2
|
+
|
|
3
|
+
class ElementQPaginator extends Element {
|
|
4
|
+
constructor(opt = {}) {
|
|
5
|
+
super(opt)
|
|
6
|
+
this.defaultStateName = {
|
|
7
|
+
currentPage: 'currentPage',
|
|
8
|
+
currentPageSize: 'currentPageSize',
|
|
9
|
+
totalRecords: 'totalRecords'
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export default {
|
|
15
|
+
ElementQPaginator
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export {
|
|
19
|
+
ElementQPaginator
|
|
20
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Element } from '../element'
|
|
2
|
+
|
|
3
|
+
class ElementQTab extends Element {
|
|
4
|
+
constructor(opt = {}) {
|
|
5
|
+
super(opt)
|
|
6
|
+
this.defaultStateName = {
|
|
7
|
+
active: 'active',
|
|
8
|
+
tabLayout: 'tabLayout'
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default {
|
|
14
|
+
ElementQTab
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export {
|
|
18
|
+
ElementQTab
|
|
19
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Container } from './container'
|
|
2
|
+
import Containers from './containers'
|
|
3
|
+
import { Element } from './element'
|
|
4
|
+
import Elements from './elements'
|
|
5
|
+
import { Node } from './node'
|
|
6
|
+
|
|
7
|
+
const NODE_TYPE = {
|
|
8
|
+
...Containers,
|
|
9
|
+
...Elements,
|
|
10
|
+
Container,
|
|
11
|
+
Element,
|
|
12
|
+
Node
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default {
|
|
16
|
+
...NODE_TYPE
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export {
|
|
20
|
+
NODE_TYPE
|
|
21
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { setId } from '../../helpers'
|
|
2
|
+
|
|
3
|
+
class Node {
|
|
4
|
+
constructor(opt = {}) {
|
|
5
|
+
// this.active = typeof opt.active === 'boolean' ? opt.active : true
|
|
6
|
+
this.id = opt.id || setId('node')
|
|
7
|
+
this.css = opt.css || {}
|
|
8
|
+
this.hidden = opt.hidden || false
|
|
9
|
+
this.nodeType = 'Node'
|
|
10
|
+
this.permissionResult = opt.permissionResult
|
|
11
|
+
this.permissionResultHandler(this.permissionResult)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
get isValid() {
|
|
15
|
+
return !!this.id
|
|
16
|
+
&& !this.hidden
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
get isCreated() {
|
|
20
|
+
return !!this
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
static init(layout) {
|
|
24
|
+
const instance = new this(layout)
|
|
25
|
+
return instance.isValid ? instance : null
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
getElementState() {
|
|
29
|
+
return this
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
getType() {
|
|
33
|
+
return this.type
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
isExist(nodes) {
|
|
37
|
+
const { name } = this
|
|
38
|
+
return !!nodes.find((node) => name && node.name === name)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
permissionResultHandler(permissionResult) {
|
|
42
|
+
const { event, isAllowCreate, isAllowRead, isAllowUpdate, isAllowDelete } = permissionResult
|
|
43
|
+
if (event) {
|
|
44
|
+
if (typeof this[event] === 'function') {
|
|
45
|
+
this[event]({ val: true })
|
|
46
|
+
} else {
|
|
47
|
+
console.log(`do not have the event ${event}`)
|
|
48
|
+
}
|
|
49
|
+
} else if (!(isAllowCreate && isAllowRead && isAllowUpdate && isAllowDelete)) {
|
|
50
|
+
this.setHidden({ val: true })
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
setHidden({ val }) {
|
|
55
|
+
this.hidden = val
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
updateElementState(state) {
|
|
59
|
+
return this
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export default {
|
|
64
|
+
Node
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export {
|
|
68
|
+
Node
|
|
69
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@questwork/vue-q-widget-vue3",
|
|
3
|
+
"version": "3.1.0",
|
|
4
|
+
"description": "Questwork vue component Sample",
|
|
5
|
+
"main": "dist/q-widget.min.js",
|
|
6
|
+
"author": {
|
|
7
|
+
"name": "Questwork Consulting Limited",
|
|
8
|
+
"email": "info@questwork.com",
|
|
9
|
+
"url": "http://www.questwork.com/"
|
|
10
|
+
},
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"devDependencies": {
|
|
13
|
+
"@babel/core": "^7.12.16",
|
|
14
|
+
"@babel/eslint-parser": "^7.12.16",
|
|
15
|
+
"@babel/preset-env": "^7.22.4",
|
|
16
|
+
"@questwork/vue-q-buttons-vue3": "^3.1.0",
|
|
17
|
+
"@questwork/vue-q-form-vue3": "3.1.0",
|
|
18
|
+
"@questwork/vue-q-grid-vue3": "^3.1.0",
|
|
19
|
+
"@questwork/vue-q-list-vue3": "^3.1.0",
|
|
20
|
+
"@questwork/vue-q-modal-vue3": "^3.1.0",
|
|
21
|
+
"@questwork/vue-q-paginator-vue3": "^3.1.0",
|
|
22
|
+
"@storybook/addon-links": "^8.4.6",
|
|
23
|
+
"@storybook/addon-viewport": "^8.4.6",
|
|
24
|
+
"@storybook/source-loader": "^8.4.6",
|
|
25
|
+
"@storybook/test": "^8.4.6",
|
|
26
|
+
"@storybook/vue3": "^8.4.6",
|
|
27
|
+
"@storybook/vue3-vite": "^8.4.6",
|
|
28
|
+
"@vitejs/plugin-vue": "^5.2.1",
|
|
29
|
+
"babel-loader": "^8.2.4",
|
|
30
|
+
"chai": "^4.3.6",
|
|
31
|
+
"chromedriver": "^116.0.0",
|
|
32
|
+
"clean-webpack-plugin": "^3.0.0",
|
|
33
|
+
"cross-env": "^7.0.3",
|
|
34
|
+
"css-loader": "^3.6.0",
|
|
35
|
+
"eslint": "^8.47.0",
|
|
36
|
+
"eslint-config-airbnb-base": "11.2.0",
|
|
37
|
+
"eslint-plugin-import": "2.3.0",
|
|
38
|
+
"eslint-plugin-storybook": "^0.11.1",
|
|
39
|
+
"eslint-plugin-vue": "^8.0.3",
|
|
40
|
+
"file-loader": "^6.2.0",
|
|
41
|
+
"gulp": "^4.0.2",
|
|
42
|
+
"lodash": "^4.17.21",
|
|
43
|
+
"rollup-plugin-license": "^3.5.3",
|
|
44
|
+
"rollup-webpack-umd": "^0.1.2",
|
|
45
|
+
"sass": "^1.49.11",
|
|
46
|
+
"sass-loader": "^8.0.2",
|
|
47
|
+
"selenium-webdriver": "^4.11.1",
|
|
48
|
+
"sinon": "^9.2.4",
|
|
49
|
+
"sinon-chai": "^3.7.0",
|
|
50
|
+
"storybook": "^8.4.6",
|
|
51
|
+
"style-loader": "^1.3.0",
|
|
52
|
+
"underscore": "1.4.4",
|
|
53
|
+
"url-loader": "^4.1.1",
|
|
54
|
+
"vite": "^6.0.2",
|
|
55
|
+
"vite-plugin-commonjs": "^0.10.4",
|
|
56
|
+
"vite-plugin-lib-inject-css": "^2.1.1",
|
|
57
|
+
"vue": "^3.5.13",
|
|
58
|
+
"vue-loader": "^15.10.1",
|
|
59
|
+
"vue-template-compiler": "^2.6.14",
|
|
60
|
+
"webpack": "^5.71.0",
|
|
61
|
+
"webpack-cli": "^4.9.2",
|
|
62
|
+
"webpack-merge": "^4.2.2",
|
|
63
|
+
"webpack-node-externals": "^1.7.2"
|
|
64
|
+
},
|
|
65
|
+
"engines": {
|
|
66
|
+
"node": ">=10.0.0"
|
|
67
|
+
},
|
|
68
|
+
"scripts": {
|
|
69
|
+
"build": "vite build",
|
|
70
|
+
"build:storybook": "storybook build -c .storybook -o storybook",
|
|
71
|
+
"storybook": "storybook dev -p 6061"
|
|
72
|
+
}
|
|
73
|
+
}
|
package/vite.config.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { URL, fileURLToPath } from 'node:url'
|
|
2
|
+
import { defineConfig } from 'vite'
|
|
3
|
+
import { libInjectCss } from 'vite-plugin-lib-inject-css'
|
|
4
|
+
import vue from '@vitejs/plugin-vue'
|
|
5
|
+
import license from 'rollup-plugin-license'
|
|
6
|
+
import commonjs from 'vite-plugin-commonjs'
|
|
7
|
+
import UmdRewrite from 'rollup-webpack-umd'
|
|
8
|
+
|
|
9
|
+
// 与 ./webpack/prod.config.js 的 output.library 名一致
|
|
10
|
+
const libName = 'QWidget'
|
|
11
|
+
// libName 的 kebab-case 格式
|
|
12
|
+
const fileName = 'q-widget'
|
|
13
|
+
|
|
14
|
+
export default defineConfig({
|
|
15
|
+
build: {
|
|
16
|
+
target: ['chrome100', 'safari15', 'firefox91'],
|
|
17
|
+
lib: {
|
|
18
|
+
entry: './src/index.js',
|
|
19
|
+
name: libName,
|
|
20
|
+
fileName: () => `${fileName}.min.js`,
|
|
21
|
+
formats: ['umd'],
|
|
22
|
+
},
|
|
23
|
+
rollupOptions: {
|
|
24
|
+
external: ['vue'],
|
|
25
|
+
output: {
|
|
26
|
+
globals: {
|
|
27
|
+
vue: 'Vue',
|
|
28
|
+
},
|
|
29
|
+
exports: 'named',
|
|
30
|
+
},
|
|
31
|
+
plugins: [
|
|
32
|
+
license({
|
|
33
|
+
thirdParty: {
|
|
34
|
+
output: `./dist/${fileName}.min.js.LICENSE.txt`,
|
|
35
|
+
},
|
|
36
|
+
}),
|
|
37
|
+
UmdRewrite({
|
|
38
|
+
banner: `/*! For license information please see ${fileName}.min.js.LICENSE.txt */`
|
|
39
|
+
})
|
|
40
|
+
],
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
esbuild: {
|
|
44
|
+
legalComments: 'none',
|
|
45
|
+
},
|
|
46
|
+
plugins: [vue(), libInjectCss(), commonjs()],
|
|
47
|
+
resolve: {
|
|
48
|
+
alias: {
|
|
49
|
+
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
})
|