@questwork/vue-q-widget-vue3 3.1.0 → 3.1.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/dist/q-widget.min.js +29 -8
- 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 -5
- 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/qButton.js +15 -0
- package/lib/models/nodes/elements/qForm.js +17 -3
- 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/qTab.js +13 -0
- package/package.json +23 -38
- package/vite.config.js +64 -14
- 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
package/vite.config.js
CHANGED
|
@@ -1,19 +1,13 @@
|
|
|
1
|
-
import { URL, fileURLToPath } from 'node:url'
|
|
2
1
|
import { defineConfig } from 'vite'
|
|
3
|
-
import { libInjectCss } from 'vite-plugin-lib-inject-css'
|
|
4
2
|
import vue from '@vitejs/plugin-vue'
|
|
5
3
|
import license from 'rollup-plugin-license'
|
|
6
4
|
import commonjs from 'vite-plugin-commonjs'
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
// 与 ./webpack/prod.config.js 的 output.library 名一致
|
|
5
|
+
|
|
10
6
|
const libName = 'QWidget'
|
|
11
|
-
// libName 的 kebab-case 格式
|
|
12
7
|
const fileName = 'q-widget'
|
|
13
8
|
|
|
14
9
|
export default defineConfig({
|
|
15
10
|
build: {
|
|
16
|
-
target: ['chrome100', 'safari15', 'firefox91'],
|
|
17
11
|
lib: {
|
|
18
12
|
entry: './src/index.js',
|
|
19
13
|
name: libName,
|
|
@@ -23,6 +17,7 @@ export default defineConfig({
|
|
|
23
17
|
rollupOptions: {
|
|
24
18
|
external: ['vue'],
|
|
25
19
|
output: {
|
|
20
|
+
assetFileNames: `${fileName}.min.[ext]`,
|
|
26
21
|
globals: {
|
|
27
22
|
vue: 'Vue',
|
|
28
23
|
},
|
|
@@ -34,19 +29,74 @@ export default defineConfig({
|
|
|
34
29
|
output: `./dist/${fileName}.min.js.LICENSE.txt`,
|
|
35
30
|
},
|
|
36
31
|
}),
|
|
37
|
-
|
|
38
|
-
banner: `/*! For license information please see ${fileName}.min.js.LICENSE.txt
|
|
39
|
-
})
|
|
32
|
+
rewriteUmdPlugin({
|
|
33
|
+
banner: `/*! For license information please see ${fileName}.min.js.LICENSE.txt */`,
|
|
34
|
+
}),
|
|
40
35
|
],
|
|
41
36
|
},
|
|
37
|
+
target: ['chrome100', 'safari15', 'firefox91'],
|
|
38
|
+
terserOptions: {
|
|
39
|
+
compress: false,
|
|
40
|
+
mangle: false,
|
|
41
|
+
},
|
|
42
42
|
},
|
|
43
43
|
esbuild: {
|
|
44
44
|
legalComments: 'none',
|
|
45
45
|
},
|
|
46
|
-
plugins: [
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
plugins: [
|
|
47
|
+
vue(),
|
|
48
|
+
commonjs(),
|
|
49
|
+
],
|
|
50
|
+
css: {
|
|
51
|
+
preprocessorOptions: {
|
|
52
|
+
scss: {
|
|
53
|
+
api: 'modern-compiler',
|
|
54
|
+
},
|
|
50
55
|
},
|
|
51
56
|
},
|
|
52
57
|
})
|
|
58
|
+
|
|
59
|
+
function rewriteUmdPlugin(options) {
|
|
60
|
+
const {
|
|
61
|
+
banner
|
|
62
|
+
} = options || {}
|
|
63
|
+
return {
|
|
64
|
+
name: 'rewrite-umd',
|
|
65
|
+
generateBundle(_ctx, options2) {
|
|
66
|
+
if (_ctx.format !== 'umd') {
|
|
67
|
+
return
|
|
68
|
+
}
|
|
69
|
+
const data = Object.values(options2)[0]
|
|
70
|
+
const { code, exports, imports } = data
|
|
71
|
+
const defineReg = /^\(function\((?<root>\w+),(?<factory>\w+)\)\{(?<rest>.*?)\|\|self,(?<scriptTag>.*?)\)\}\)\(this,function/s
|
|
72
|
+
const rewritten = code
|
|
73
|
+
.replace(defineReg, (...args) => {
|
|
74
|
+
const { root, factory, scriptTag } = args.at(-1)
|
|
75
|
+
return `${banner || ''}
|
|
76
|
+
;(function(${root},${factory}){
|
|
77
|
+
if (typeof exports == "object" && typeof module < "u") { // for commonjs
|
|
78
|
+
const returns = {}
|
|
79
|
+
${factory}(returns, ${imports.map((i) => `require("${i}")`).join(', ')});
|
|
80
|
+
module.exports = returns;
|
|
81
|
+
${exports.map((exp) => `exports.${exp} = returns.${exp};`).join('\n')}
|
|
82
|
+
}
|
|
83
|
+
else if (typeof define == "function" && define.amd) { // for amd
|
|
84
|
+
define(["exports", ${imports.map((i) => `"${i}"`).join(', ')}], ${factory});
|
|
85
|
+
}
|
|
86
|
+
else { // for browser script tag
|
|
87
|
+
${root} = (typeof globalThis < "u") ? globalThis : ${root} || self;
|
|
88
|
+
${scriptTag};
|
|
89
|
+
}
|
|
90
|
+
})(this,function`
|
|
91
|
+
})
|
|
92
|
+
|
|
93
|
+
// return the exports object at the end
|
|
94
|
+
.replace(new RegExp(/Object.defineProperty\((?<name>\w+),Symbol.toStringTag,{value:"Module"}\)}\);/), (...args) => {
|
|
95
|
+
const { name } = args.at(-1)
|
|
96
|
+
return `Object.defineProperty(${name},Symbol.toStringTag,{value:"Module"}); return ${name}; });`
|
|
97
|
+
})
|
|
98
|
+
|
|
99
|
+
data.code = rewritten
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
class ControllerHelpers {
|
|
2
|
-
constructor(opt) {
|
|
3
|
-
this.permissionHandler = permissionHandler
|
|
4
|
-
Object.keys(opt).forEach((key) => {
|
|
5
|
-
this[key] = opt[key]
|
|
6
|
-
})
|
|
7
|
-
}
|
|
8
|
-
static init(controllerHelpers) {
|
|
9
|
-
const instance = new ControllerHelpers(controllerHelpers)
|
|
10
|
-
return instance.isValid ? instance : null
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
get isValid() {
|
|
14
|
-
return isFunction(this.getControllerState)
|
|
15
|
-
&& isFunction(this.getControllerUniqueKey)
|
|
16
|
-
&& isFunction(this.saveControllerState)
|
|
17
|
-
&& isFunction(this.startLoading)
|
|
18
|
-
&& isFunction(this.stopLoading)
|
|
19
|
-
&& isFunction(this.runChains)
|
|
20
|
-
&& this.qForm && isFunction(this.qForm.NodeHelper)
|
|
21
|
-
&& this.qGrid && isFunction(this.qGrid.QItem) && isFunction(this.qGrid.Cell)
|
|
22
|
-
&& this.qList && isFunction(this.qList.QRow) && isFunction(this.qList.QListBulkButton) && isFunction(this.qList.QListButton)
|
|
23
|
-
&& this.qUtilities && isFunction(this.qUtilities.convertString) && isFunction(this.qUtilities.getValidation) && isFunction(this.qUtilities.lodash)
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function isFunction(fun) {
|
|
28
|
-
return typeof fun === 'function'
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
function permissionHandler() {
|
|
32
|
-
return {
|
|
33
|
-
isAllowCreate: true,
|
|
34
|
-
isAllowRead: true,
|
|
35
|
-
isAllowUpdate: true,
|
|
36
|
-
isAllowDelete: true
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export default {
|
|
41
|
-
ControllerHelpers
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export {
|
|
45
|
-
ControllerHelpers
|
|
46
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { ControllerHelpers } from './controllerHelpers'
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/lib/helpers/{utilities/configHandler → configHandler}/handlers/elementQForm/index.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/lib/helpers/{utilities/configHandler → configHandler}/handlers/elementQList/index.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|