imatrix-ui 2.9.21-boe03 → 2.9.21-boe04
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/package.json +1 -1
- package/src/plugins.js +5 -12
- package/src/styles/index.scss +5 -0
- package/USAGE.md +0 -0
- package/build/build-components.js +0 -70
- package/build/build-src.js +0 -151
package/package.json
CHANGED
package/src/plugins.js
CHANGED
|
@@ -7,19 +7,12 @@ import ElementUI from 'element-ui'
|
|
|
7
7
|
import 'element-ui/lib/theme-chalk/index.css'
|
|
8
8
|
import locale from 'element-ui/lib/locale/lang/zh-CN' // lang i18n
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
// import SuperUI from 'imatrix-ui' // 避免循环引用
|
|
13
|
-
// import 'imatrix-ui/lib/super-ui.css'
|
|
10
|
+
import SuperUI from 'imatrix-ui'
|
|
11
|
+
import 'imatrix-ui/lib/super-ui.css'
|
|
14
12
|
|
|
15
|
-
//
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
// 权限相关
|
|
19
|
-
// import 'imatrix-ui/src/permission' // permission control
|
|
20
|
-
import './permission' // 改为相对路径,避免循环引用
|
|
21
|
-
import permission from './directives/permission'
|
|
13
|
+
import 'imatrix-ui/src/permission' // permission control
|
|
14
|
+
import permission from 'imatrix-ui/src/directives/permission'
|
|
22
15
|
|
|
23
16
|
Vue.use(ElementUI, { locale })
|
|
24
|
-
|
|
17
|
+
Vue.use(SuperUI)
|
|
25
18
|
permission.install(Vue)
|
package/src/styles/index.scss
CHANGED
package/USAGE.md
DELETED
|
File without changes
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
const path = require('path')
|
|
2
|
-
const fs = require('fs')
|
|
3
|
-
const { execSync } = require('child_process')
|
|
4
|
-
|
|
5
|
-
const packagesDir = path.resolve(__dirname, '../packages')
|
|
6
|
-
const outputDir = path.resolve(__dirname, '../lib')
|
|
7
|
-
|
|
8
|
-
// 获取所有组件目录
|
|
9
|
-
const getComponents = () => {
|
|
10
|
-
const files = fs.readdirSync(packagesDir)
|
|
11
|
-
return files.filter(file => {
|
|
12
|
-
const filePath = path.join(packagesDir, file)
|
|
13
|
-
const stat = fs.statSync(filePath)
|
|
14
|
-
const hasIndex = fs.existsSync(path.join(filePath, 'index.js'))
|
|
15
|
-
return stat.isDirectory() && hasIndex && file !== 'directives' && file !== 'plugins' && file !== 'utils'
|
|
16
|
-
})
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
// 构建单个组件
|
|
20
|
-
const buildComponent = (componentName) => {
|
|
21
|
-
console.log(`Building component: ${componentName}`)
|
|
22
|
-
|
|
23
|
-
const componentPath = path.join(packagesDir, componentName, 'index.js')
|
|
24
|
-
|
|
25
|
-
try {
|
|
26
|
-
const buildCommand = `npx vue-cli-service build --target lib --name ${componentName} --dest lib/${componentName} ${componentPath}`
|
|
27
|
-
execSync(buildCommand, { stdio: 'inherit' })
|
|
28
|
-
|
|
29
|
-
console.log(`✓ Built ${componentName}`)
|
|
30
|
-
} catch (error) {
|
|
31
|
-
console.error(`✗ Failed to build ${componentName}:`, error.message)
|
|
32
|
-
}
|
|
33
|
-
}// 主构建流程
|
|
34
|
-
const buildComponents = () => {
|
|
35
|
-
console.log('Starting component library build...')
|
|
36
|
-
|
|
37
|
-
// 确保输出目录存在
|
|
38
|
-
if (!fs.existsSync(outputDir)) {
|
|
39
|
-
fs.mkdirSync(outputDir, { recursive: true })
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const components = getComponents()
|
|
43
|
-
console.log(`Found ${components.length} components:`, components.join(', '))
|
|
44
|
-
|
|
45
|
-
// 逐个构建组件
|
|
46
|
-
components.forEach(buildComponent)
|
|
47
|
-
|
|
48
|
-
// 创建组件入口索引文件
|
|
49
|
-
createComponentsIndex(components)
|
|
50
|
-
|
|
51
|
-
console.log('Component library build completed!')
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
// 创建组件索引文件
|
|
55
|
-
const createComponentsIndex = (components) => {
|
|
56
|
-
const imports = components.map(name =>
|
|
57
|
-
`export { default as ${name.replace(/-([a-z])/g, (match, p1) => p1.toUpperCase())} } from './${name}/${name}.umd.min.js'`
|
|
58
|
-
).join('\n')
|
|
59
|
-
|
|
60
|
-
const indexContent = `// 按需引入组件
|
|
61
|
-
${imports}
|
|
62
|
-
|
|
63
|
-
// 全量引入(保持向后兼容)
|
|
64
|
-
export { default } from './super-ui.umd.min.js'
|
|
65
|
-
`
|
|
66
|
-
|
|
67
|
-
fs.writeFileSync(path.join(outputDir, 'components.js'), indexContent)
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
buildComponents()
|
package/build/build-src.js
DELETED
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
const path = require('path')
|
|
2
|
-
const fs = require('fs')
|
|
3
|
-
|
|
4
|
-
const srcDir = path.resolve(__dirname, '../src')
|
|
5
|
-
const outputDir = path.resolve(__dirname, '../lib/src')
|
|
6
|
-
|
|
7
|
-
// 需要排除的文件(避免循环引用)
|
|
8
|
-
const excludeFiles = [
|
|
9
|
-
'plugins.js' // 这个文件引用了 imatrix-ui 自己,会造成循环引用
|
|
10
|
-
]
|
|
11
|
-
|
|
12
|
-
// 检查文件是否应该被排除
|
|
13
|
-
const shouldExclude = (filePath) => {
|
|
14
|
-
const fileName = path.basename(filePath)
|
|
15
|
-
return excludeFiles.includes(fileName)
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
// 直接复制整个src目录到lib/src,保持原始结构
|
|
19
|
-
const copySrcDirectory = () => {
|
|
20
|
-
console.log('Copying src directory to lib/src...')
|
|
21
|
-
|
|
22
|
-
// 删除现有的lib/src目录
|
|
23
|
-
if (fs.existsSync(outputDir)) {
|
|
24
|
-
fs.rmSync(outputDir, { recursive: true, force: true })
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// 创建lib/src目录
|
|
28
|
-
fs.mkdirSync(outputDir, { recursive: true })
|
|
29
|
-
|
|
30
|
-
let excludedCount = 0
|
|
31
|
-
|
|
32
|
-
// 递归复制文件和目录
|
|
33
|
-
const copyRecursive = (src, dest) => {
|
|
34
|
-
const stat = fs.statSync(src)
|
|
35
|
-
|
|
36
|
-
// 检查是否应该排除这个文件
|
|
37
|
-
if (stat.isFile() && shouldExclude(src)) {
|
|
38
|
-
console.log(`⚠️ Excluding ${path.relative(srcDir, src)} (避免循环引用)`)
|
|
39
|
-
excludedCount++
|
|
40
|
-
return
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
if (stat.isDirectory()) {
|
|
44
|
-
// 创建目录
|
|
45
|
-
if (!fs.existsSync(dest)) {
|
|
46
|
-
fs.mkdirSync(dest)
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// 复制目录内容
|
|
50
|
-
const items = fs.readdirSync(src)
|
|
51
|
-
items.forEach(item => {
|
|
52
|
-
copyRecursive(path.join(src, item), path.join(dest, item))
|
|
53
|
-
})
|
|
54
|
-
} else {
|
|
55
|
-
// 复制文件
|
|
56
|
-
fs.copyFileSync(src, dest)
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
try {
|
|
61
|
-
copyRecursive(srcDir, outputDir)
|
|
62
|
-
console.log('✓ Successfully copied src directory')
|
|
63
|
-
|
|
64
|
-
// 统计复制的文件
|
|
65
|
-
const countFiles = (dir) => {
|
|
66
|
-
let count = 0
|
|
67
|
-
const items = fs.readdirSync(dir)
|
|
68
|
-
items.forEach(item => {
|
|
69
|
-
const fullPath = path.join(dir, item)
|
|
70
|
-
if (fs.statSync(fullPath).isDirectory()) {
|
|
71
|
-
count += countFiles(fullPath)
|
|
72
|
-
} else {
|
|
73
|
-
count++
|
|
74
|
-
}
|
|
75
|
-
})
|
|
76
|
-
return count
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
const fileCount = countFiles(outputDir)
|
|
80
|
-
console.log(`✓ Copied ${fileCount} files from src directory`)
|
|
81
|
-
if (excludedCount > 0) {
|
|
82
|
-
console.log(`✓ Excluded ${excludedCount} files to avoid circular dependencies`)
|
|
83
|
-
}
|
|
84
|
-
} catch (error) {
|
|
85
|
-
console.error('✗ Failed to copy src directory:', error.message)
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
// 创建src使用说明文件
|
|
90
|
-
const createSrcReadme = () => {
|
|
91
|
-
const readmeContent = `# iMatrix-UI src 目录
|
|
92
|
-
|
|
93
|
-
这个目录包含了 iMatrix-UI 的源码文件,支持直接引入使用。
|
|
94
|
-
|
|
95
|
-
## 🎨 样式文件
|
|
96
|
-
|
|
97
|
-
\`\`\`scss
|
|
98
|
-
// 引入完整样式
|
|
99
|
-
import 'imatrix-ui/src/styles/index.scss'
|
|
100
|
-
|
|
101
|
-
// 引入特定样式
|
|
102
|
-
import 'imatrix-ui/src/styles/mixin.scss'
|
|
103
|
-
import 'imatrix-ui/src/styles/element-ui.scss'
|
|
104
|
-
\`\`\`
|
|
105
|
-
|
|
106
|
-
## 🔧 工具函数
|
|
107
|
-
|
|
108
|
-
\`\`\`javascript
|
|
109
|
-
// 引入工具函数
|
|
110
|
-
import { parseTime, formatTime } from 'imatrix-ui/src/utils/index.js'
|
|
111
|
-
import { openPage } from 'imatrix-ui/src/utils/jump-page-utils.js'
|
|
112
|
-
|
|
113
|
-
// 引入通用工具
|
|
114
|
-
import * as commonUtil from 'imatrix-ui/src/utils/common-util.js'
|
|
115
|
-
\`\`\`
|
|
116
|
-
|
|
117
|
-
## 📁 目录结构
|
|
118
|
-
|
|
119
|
-
- \`styles/\` - 样式文件(SCSS)
|
|
120
|
-
- \`utils/\` - 工具函数
|
|
121
|
-
- \`directives/\` - Vue指令
|
|
122
|
-
- \`api/\` - API相关
|
|
123
|
-
- \`i18n/\` - 国际化文件
|
|
124
|
-
- \`assets/\` - 静态资源
|
|
125
|
-
|
|
126
|
-
## 💡 使用建议
|
|
127
|
-
|
|
128
|
-
1. **样式引入**:推荐在项目入口处引入样式文件
|
|
129
|
-
2. **工具函数**:按需引入需要的工具函数
|
|
130
|
-
3. **主题定制**:可以引入特定主题的样式文件
|
|
131
|
-
|
|
132
|
-
## ⚠️ 注意事项
|
|
133
|
-
|
|
134
|
-
- 直接引用src文件需要确保您的构建工具支持相应的文件类型
|
|
135
|
-
- SCSS文件需要在您的项目中配置SASS/SCSS编译器
|
|
136
|
-
- 某些工具函数可能依赖特定的第三方库
|
|
137
|
-
`
|
|
138
|
-
|
|
139
|
-
fs.writeFileSync(path.join(outputDir, 'README.md'), readmeContent)
|
|
140
|
-
console.log('✓ Created src/README.md documentation')
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
// 主函数
|
|
144
|
-
const buildSrc = () => {
|
|
145
|
-
console.log('Starting src directory build...')
|
|
146
|
-
copySrcDirectory()
|
|
147
|
-
createSrcReadme()
|
|
148
|
-
console.log('Src directory build completed!')
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
buildSrc()
|