Skip to content

Commit 05fbd16

Browse files
committed
feat:适配演练场,优化本地开发环境saas模式以及css导入逻辑
1 parent 3511e28 commit 05fbd16

20 files changed

Lines changed: 228 additions & 277 deletions

packages/docs/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"dependencies": {
1212
"vue": "^3.5.13",
1313
"@opentiny/vue-search-box": "^3.28.0",
14+
"@opentiny/vue": "^3.28.0",
1415
"@opentiny/vue-button": "^3.28.0",
1516
"@opentiny/vue-button-group": "^3.28.0",
1617
"@opentiny/vue-checkbox": "^3.28.0",

packages/search-box/package.json

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@opentiny/vue-search-box",
3-
"version": "3.28.1",
3+
"version": "3.28.4",
44
"description": "",
55
"homepage": "https://github.com/opentiny/tiny-search-box#readme",
66
"bugs": {
@@ -13,7 +13,12 @@
1313
"license": "MIT",
1414
"author": "",
1515
"type": "module",
16-
"sideEffects": false,
16+
"sideEffects": [
17+
"*.less",
18+
"*.css",
19+
"./theme/**/*",
20+
"./theme-saas/**/*"
21+
],
1722
"main": "lib/index.js",
1823
"module": "index.ts",
1924
"keywords": [
@@ -22,26 +27,9 @@
2227
"opentiny"
2328
],
2429
"dependencies": {
25-
"@opentiny/vue-search-box": "workspace:~",
26-
"@opentiny/vue-button": "^2.28.0",
27-
"@opentiny/vue-button-group": "^2.28.0",
28-
"@opentiny/vue-checkbox": "^2.28.0",
29-
"@opentiny/vue-checkbox-group": "^2.28.0",
30-
"@opentiny/vue-common": "^2.28.0",
31-
"@opentiny/vue-date-picker": "^2.28.0",
32-
"@opentiny/vue-dropdown": "^2.28.0",
33-
"@opentiny/vue-dropdown-item": "^2.28.0",
34-
"@opentiny/vue-dropdown-menu": "^2.28.0",
35-
"@opentiny/vue-form": "^2.28.0",
36-
"@opentiny/vue-form-item": "^2.28.0",
37-
"@opentiny/vue-icon": "^2.28.0",
38-
"@opentiny/vue-input": "^2.28.0",
39-
"@opentiny/vue-loading": "^2.28.0",
40-
"@opentiny/vue-option": "^2.28.0",
41-
"@opentiny/vue-popover": "^2.28.0",
42-
"@opentiny/vue-select": "^2.28.0",
43-
"@opentiny/vue-tag": "^2.28.0",
44-
"@opentiny/vue-tooltip": "^2.28.0",
30+
"@opentiny/vue-common": "~2.28.0",
31+
"@opentiny/vue-icon": "~2.28.0",
32+
"@opentiny/vue": "^2.28.0",
4533
"@opentiny/vue-theme": "^3.28.0",
4634
"@opentiny/vue-theme-saas": "^3.28.0"
4735
},

packages/search-box/postcss.config.cjs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ const autoprefixer = require('autoprefixer')
55
const { resolve } = require('path')
66
// 获取 Tailwind 配置文件的绝对路径
77
const tailwindConfigPath = resolve(__dirname, 'tailwind.config.cjs')
8+
9+
// 设置环境变量,确保 Tailwind 知道当前是 Saas 模式
10+
if (process.env.TINY_THEME === 'saas' || process.env.TINY_MODE === 'saas') {
11+
process.env.TAILWIND_MODE = 'saas'
12+
}
13+
814
module.exports = {
915
plugins: [
1016
// PostCSS 处理顺序:

packages/search-box/scripts/plugin-utils.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export function removeCssOutput(outDir?: string): Plugin {
6363
}
6464

6565
/**
66-
* 移动类型文件插件:从 types/src/ 移到 types/
66+
* 移动类型文件插件:从 types/src/ 移到 types/,并重命名为 index.d.ts
6767
* @param typesDir 类型文件目录路径
6868
*/
6969
export function moveTypesFiles(typesDir: string): Plugin {
@@ -73,7 +73,7 @@ export function moveTypesFiles(typesDir: string): Plugin {
7373
const typesPath = resolve(typesDir)
7474
const srcDir = resolve(typesPath, 'src')
7575
const indexPath = resolve(srcDir, 'index.type.d.ts')
76-
const targetPath = resolve(typesPath, 'index.type.d.ts')
76+
const targetPath = resolve(typesPath, 'index.d.ts')
7777

7878
if (existsSync(indexPath)) {
7979
// 读取文件内容
@@ -83,6 +83,8 @@ export function moveTypesFiles(typesDir: string): Plugin {
8383
// 删除 src 目录
8484
rmSync(srcDir, { recursive: true, force: true })
8585
console.log('已移动类型文件到 types 目录')
86+
} else {
87+
console.warn('⚠️ 类型文件不存在:', indexPath)
8688
}
8789
}
8890
}

packages/search-box/scripts/post-build.js

Lines changed: 56 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -49,33 +49,28 @@ function generateVue2NormalPackageJson() {
4949
main: 'index.js',
5050
module: 'index.js',
5151
types: 'types/index.d.ts',
52+
typings: 'types/index.d.ts', // 向后兼容
5253
sideEffects: ['*.css'],
54+
exports: {
55+
'.': {
56+
types: './types/index.d.ts',
57+
import: './index.js',
58+
require: './index.js'
59+
},
60+
'./index.css': './index.css',
61+
'./package.json': './package.json'
62+
},
5363
publishConfig: {
5464
access: 'public'
5565
},
5666
peerDependencies: {
5767
vue: '^2.6.14'
5868
},
5969
dependencies: {
60-
'@opentiny/vue-button': '^2.26.0',
61-
'@opentiny/vue-checkbox': '^2.26.0',
62-
'@opentiny/vue-checkbox-group': '^2.26.0',
63-
'@opentiny/vue-date-picker': '^2.26.0',
64-
'@opentiny/vue-dropdown': '^2.26.0',
65-
'@opentiny/vue-dropdown-item': '^2.26.0',
66-
'@opentiny/vue-dropdown-menu': '^2.26.0',
67-
'@opentiny/vue-form': '^2.26.0',
68-
'@opentiny/vue-form-item': '^2.26.0',
69-
'@opentiny/vue-icon': '^2.26.0',
70-
'@opentiny/vue-input': '^2.26.0',
71-
'@opentiny/vue-loading': '^2.26.0',
72-
'@opentiny/vue-option': '^2.26.0',
73-
'@opentiny/vue-popover': '^2.26.0',
74-
'@opentiny/vue-select': '^2.26.0',
75-
'@opentiny/vue-tag': '^2.26.0',
76-
'@opentiny/vue-tooltip': '^2.26.0',
77-
'@opentiny/vue-common': '^2.26.0',
78-
'@opentiny/vue-theme': '^3.26.0'
70+
'@opentiny/vue': '^2.28.0',
71+
'@opentiny/vue-common': '^2.28.0',
72+
'@opentiny/vue-icon': '^2.28.0',
73+
'@opentiny/vue-theme': '^3.28.0'
7974
},
8075
keywords: packageJson.keywords || [],
8176
license: packageJson.license,
@@ -94,33 +89,28 @@ function generateVue2SaasPackageJson() {
9489
main: 'index.js',
9590
module: 'index.js',
9691
types: 'types/index.d.ts',
92+
typings: 'types/index.d.ts', // 向后兼容
9793
sideEffects: ['*.css'],
94+
exports: {
95+
'.': {
96+
types: './types/index.d.ts',
97+
import: './index.js',
98+
require: './index.js'
99+
},
100+
'./index.css': './index.css',
101+
'./package.json': './package.json'
102+
},
98103
publishConfig: {
99104
access: 'public'
100105
},
101106
peerDependencies: {
102107
vue: '^2.6.14'
103108
},
104109
dependencies: {
105-
'@opentiny/vue-button': '^2.26.0',
106-
'@opentiny/vue-checkbox': '^2.26.0',
107-
'@opentiny/vue-checkbox-group': '^2.26.0',
108-
'@opentiny/vue-date-picker': '^2.26.0',
109-
'@opentiny/vue-dropdown': '^2.26.0',
110-
'@opentiny/vue-dropdown-item': '^2.26.0',
111-
'@opentiny/vue-dropdown-menu': '^2.26.0',
112-
'@opentiny/vue-form': '^2.26.0',
113-
'@opentiny/vue-form-item': '^2.26.0',
114-
'@opentiny/vue-icon': '^2.26.0',
115-
'@opentiny/vue-input': '^2.26.0',
116-
'@opentiny/vue-loading': '^2.26.0',
117-
'@opentiny/vue-option': '^2.26.0',
118-
'@opentiny/vue-popover': '^2.26.0',
119-
'@opentiny/vue-select': '^2.26.0',
120-
'@opentiny/vue-tag': '^2.26.0',
121-
'@opentiny/vue-tooltip': '^2.26.0',
122-
'@opentiny/vue-common': '^2.26.0',
123-
'@opentiny/vue-theme': '^3.26.0'
110+
'@opentiny/vue': '^2.28.0',
111+
'@opentiny/vue-common': '^2.28.0',
112+
'@opentiny/vue-icon': '^2.28.0',
113+
'@opentiny/vue-theme': '^3.28.0'
124114
},
125115
keywords: packageJson.keywords || [],
126116
license: packageJson.license,
@@ -139,33 +129,28 @@ function generateVue3NormalPackageJson() {
139129
main: 'index.js',
140130
module: 'index.js',
141131
types: 'types/index.d.ts',
132+
typings: 'types/index.d.ts', // 向后兼容
142133
sideEffects: ['*.css'],
134+
exports: {
135+
'.': {
136+
types: './types/index.d.ts',
137+
import: './index.js',
138+
require: './index.js'
139+
},
140+
'./index.css': './index.css',
141+
'./package.json': './package.json'
142+
},
143143
publishConfig: {
144144
access: 'public'
145145
},
146146
peerDependencies: {
147147
vue: '^3.0.0'
148148
},
149149
dependencies: {
150-
'@opentiny/vue-button': '^3.26.0',
151-
'@opentiny/vue-checkbox': '^3.26.0',
152-
'@opentiny/vue-checkbox-group': '^3.26.0',
153-
'@opentiny/vue-date-picker': '^3.26.0',
154-
'@opentiny/vue-dropdown': '^3.26.0',
155-
'@opentiny/vue-dropdown-item': '^3.26.0',
156-
'@opentiny/vue-dropdown-menu': '^3.26.0',
157-
'@opentiny/vue-form': '^3.26.0',
158-
'@opentiny/vue-form-item': '^3.26.0',
159-
'@opentiny/vue-icon': '^3.26.0',
160-
'@opentiny/vue-input': '^3.26.0',
161-
'@opentiny/vue-loading': '^3.26.0',
162-
'@opentiny/vue-option': '^3.26.0',
163-
'@opentiny/vue-popover': '^3.26.0',
164-
'@opentiny/vue-select': '^3.26.0',
165-
'@opentiny/vue-tag': '^3.26.0',
166-
'@opentiny/vue-tooltip': '^3.26.0',
167-
'@opentiny/vue-common': '^3.26.0',
168-
'@opentiny/vue-theme': '^3.26.0'
150+
'@opentiny/vue': '^3.28.0',
151+
'@opentiny/vue-common': '^3.28.0',
152+
'@opentiny/vue-icon': '^3.28.0',
153+
'@opentiny/vue-theme': '^3.28.0'
169154
},
170155
keywords: packageJson.keywords || [],
171156
license: packageJson.license,
@@ -184,33 +169,28 @@ function generateVue3SaasPackageJson() {
184169
main: 'index.js',
185170
module: 'index.js',
186171
types: 'types/index.d.ts',
172+
typings: 'types/index.d.ts', // 向后兼容
187173
sideEffects: ['*.css'],
174+
exports: {
175+
'.': {
176+
types: './types/index.d.ts',
177+
import: './index.js',
178+
require: './index.js'
179+
},
180+
'./index.css': './index.css',
181+
'./package.json': './package.json'
182+
},
188183
publishConfig: {
189184
access: 'public'
190185
},
191186
peerDependencies: {
192187
vue: '^3.0.0'
193188
},
194189
dependencies: {
195-
'@opentiny/vue-button': '^3.26.0',
196-
'@opentiny/vue-checkbox': '^3.26.0',
197-
'@opentiny/vue-checkbox-group': '^3.26.0',
198-
'@opentiny/vue-date-picker': '^3.26.0',
199-
'@opentiny/vue-dropdown': '^3.26.0',
200-
'@opentiny/vue-dropdown-item': '^3.26.0',
201-
'@opentiny/vue-dropdown-menu': '^3.26.0',
202-
'@opentiny/vue-form': '^3.26.0',
203-
'@opentiny/vue-form-item': '^3.26.0',
204-
'@opentiny/vue-icon': '^3.26.0',
205-
'@opentiny/vue-input': '^3.26.0',
206-
'@opentiny/vue-loading': '^3.26.0',
207-
'@opentiny/vue-option': '^3.26.0',
208-
'@opentiny/vue-popover': '^3.26.0',
209-
'@opentiny/vue-select': '^3.26.0',
210-
'@opentiny/vue-tag': '^3.26.0',
211-
'@opentiny/vue-tooltip': '^3.26.0',
212-
'@opentiny/vue-common': '^3.26.0',
213-
'@opentiny/vue-theme': '^3.26.0'
190+
'@opentiny/vue': '^3.28.0',
191+
'@opentiny/vue-common': '^3.28.0',
192+
'@opentiny/vue-icon': '^3.28.0',
193+
'@opentiny/vue-theme': '^3.28.0'
214194
},
215195
keywords: packageJson.keywords || [],
216196
license: packageJson.license,

packages/search-box/src/components/first-level-panel.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@
116116
<script>
117117
// Vue2 版本,使用 tiny-vue 的 renderless 架构
118118
import { defineComponent, setup, $props, $prefix } from '@opentiny/vue-common'
119-
import TinyDropdownItem from '@opentiny/vue-dropdown-item'
119+
import { TinyDropdownItem } from '@opentiny/vue'
120120
import { t } from '../utils/i18n.ts'
121121
122122
// 简单的 renderless 函数
@@ -175,7 +175,7 @@ export default defineComponent({
175175
default: null
176176
}
177177
},
178-
emits: ['events'],
178+
emits: ['events', 'click'],
179179
setup(props, context) {
180180
return setup({ props, context, renderless, api })
181181
}

packages/search-box/src/components/second-level-panel.vue

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -272,14 +272,16 @@
272272
<script>
273273
// Vue2 版本,使用 tiny-vue 的 renderless 架构
274274
import { defineComponent, setup, $props, $prefix } from '@opentiny/vue-common'
275-
import TinyFormItem from '@opentiny/vue-form-item'
276-
import TinyDropdownItem from '@opentiny/vue-dropdown-item'
277-
import TinyCheckbox from '@opentiny/vue-checkbox'
278-
import TinyCheckboxGroup from '@opentiny/vue-checkbox-group'
279-
import TinyDatePicker from '@opentiny/vue-date-picker'
280-
import TinyInput from '@opentiny/vue-input'
281-
import TinyButton from '@opentiny/vue-button'
282-
import TinyLoading from '@opentiny/vue-loading'
275+
import {
276+
TinyFormItem,
277+
TinyDropdownItem,
278+
TinyCheckbox,
279+
TinyCheckboxGroup,
280+
TinyDatePicker,
281+
TinyInput,
282+
TinyButton,
283+
TinyLoading
284+
} from '@opentiny/vue'
283285
import { t } from '../utils/i18n.ts'
284286
285287
// 简单的 renderless 函数
@@ -356,7 +358,7 @@ const api = [
356358
357359
export default defineComponent({
358360
name: $prefix + 'SearchBoxSecondLevelPanel',
359-
emits: ['events'],
361+
emits: ['events', 'click'],
360362
components: {
361363
TinyFormItem,
362364
TinyDropdownItem,

packages/search-box/src/composables/use-match.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// import { ref } from 'vue'
2-
import Loading from '@opentiny/vue-loading'
2+
import { Loading } from '@opentiny/vue'
33
import { debounce } from '../utils/index.ts'
44
import { hasTagItem, createNewTag, getTagId, emitChangeModelEvent } from '../utils/tag.ts'
55
import { showDropdown } from '../utils/dropdown.ts'

0 commit comments

Comments
 (0)