Skip to content

Commit 2d082f1

Browse files
author
jieliu52
committed
Merge branch 'dev' of https://github.com/opentiny/tiny-vue into feat-tree-menu
2 parents d2d184e + a7632bb commit 2d082f1

File tree

30 files changed

+856
-61
lines changed

30 files changed

+856
-61
lines changed

examples/sites/demos/pc/app/grid/custom-style/class-name-composition-api.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,6 @@ const tableData = ref([
7575

7676
<style>
7777
.gridClassName {
78-
background: #e6f7ff;
78+
background-color: #2db7f5;
7979
}
8080
</style>

examples/sites/demos/pc/app/grid/custom-style/class-name.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ import { test, expect } from '@playwright/test'
33
test('自定义列样式', async ({ page }) => {
44
page.on('pageerror', (exception) => expect(exception).toBeNull())
55
await page.goto('grid-custom-style#custom-style-class-name')
6-
await expect(page.locator('.gridClassName').first()).toHaveCSS('background-color', 'rgb(230, 247, 255)')
6+
await expect(page.locator('.gridClassName').first()).toHaveCSS('background-color', 'rgb(45, 183, 245)')
77
})

examples/sites/demos/pc/app/grid/custom-style/class-name.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,6 @@ export default {
8484

8585
<style>
8686
.gridClassName {
87-
background: #e6f7ff;
87+
background-color: #2db7f5;
8888
}
8989
</style>

examples/sites/demos/pc/app/grid/editor/active-strictly-composition-api.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,6 @@ function cellClassName({ row, column }) {
7878

7979
<style>
8080
.disable-cell-edit {
81-
background-color: #e8ebef;
81+
background-color: var(--tv-color-bg-disabled);
8282
}
8383
</style>

examples/sites/demos/pc/app/grid/editor/active-strictly.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,6 @@ export default {
8787

8888
<style>
8989
.disable-cell-edit {
90-
background-color: #e8ebef;
90+
background-color: var(--tv-color-bg-disabled);
9191
}
9292
</style>

examples/sites/demos/pc/app/grid/editor/editor-bg-composition-api.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,6 @@ function cellClassName({ row, column }) {
7373

7474
<style>
7575
.disable-cell-edit {
76-
background-color: #e8ebef;
76+
background-color: var(--tv-color-bg-disabled);
7777
}
7878
</style>

examples/sites/demos/pc/app/grid/editor/editor-bg.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,6 @@ export default {
8282

8383
<style>
8484
.disable-cell-edit {
85-
background-color: #e8ebef;
85+
background-color: var(--tv-color-bg-disabled);
8686
}
8787
</style>

examples/sites/demos/pc/app/grid/loading/grid-custom-loading-composition-api.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,6 @@ const loadingComponent = () => (
7070
display: flex;
7171
align-items: center;
7272
justify-content: center;
73-
background: rgba(0, 0, 0, 0.3);
73+
background: var(--tv-color-bg-mask);
7474
}
7575
</style>

examples/sites/demos/pc/app/grid/loading/grid-custom-loading.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,6 @@ export default {
8383
display: flex;
8484
align-items: center;
8585
justify-content: center;
86-
background: rgba(0, 0, 0, 0.3);
86+
background: var(--tv-color-bg-mask);
8787
}
8888
</style>

examples/sites/demos/pc/webdoc/faq.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,15 @@ export default defineConfig({
7373
}
7474
</style>
7575
```
76+
77+
## 4、`webpack` 无法解析富文本组件相关依赖包
78+
79+
`webpack``vue-cli` 默认不会解析转换 `node_modules` 中的依赖包,导致在工程中无法识别 `quill``@opentiny/fluent-editor` 包中的 `javascript` 高级语法。
80+
81+
可以通过在 `vue.config.js` 文件中增加如下配置解决:
82+
83+
```js
84+
module.exports = {
85+
transpileDependencies: ['@opentiny/fluent-editor', 'quill']
86+
}
87+
```

packages/renderless/src/grid/utils/dom.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,11 +188,15 @@ export const colToVisible = ($table, column, move) => {
188188
}
189189

190190
export const hasDataTag = (el, value) => {
191-
// el可能为shadow-root,shadow-root没有getAttribute方法
192-
if (!el || !value || !el.getAttribute) {
191+
if (!el || !value) {
193192
return false
194193
}
195194

195+
// 处理遇到 shadowRoot的情况
196+
if (el.host) {
197+
el = el.host
198+
}
199+
196200
return (' ' + el.getAttribute('data-tag') + ' ').includes(' ' + value + ' ')
197201
}
198202

packages/renderless/src/ip-address/index.ts

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -89,32 +89,31 @@ export const getValue =
8989
export const setValue =
9090
({ api, props, state }: { api: IIpAddressApi; props: IIpAddressProps; state: IIpAddressState }) =>
9191
(value: string) => {
92-
if (value) {
93-
/* istanbul ignore else */
94-
if (api?.ipValidator?.(value)) {
95-
if (api.isIP6(props.type)) {
96-
state.address = value.split(':').map((item) => ({ value: item }))
97-
if (state.address.length < 8) {
98-
let insertIndex = 0
99-
state.address.forEach((item, index) => {
100-
if (item.value === '') {
101-
item.value = '0000'
102-
insertIndex = index
103-
}
104-
})
105-
for (let i = 0; i <= 8 - state.address.length; i++) {
106-
state.address.splice(insertIndex, 0, { value: '0000' })
107-
}
108-
}
109-
} else {
110-
state.address = value.split('.').map((item) => ({ value: item }))
92+
if (!value || !api?.ipValidator?.(value)) {
93+
const createValue = () => ({ value: '' })
94+
state.address = api.isIP6(props.type)
95+
? Array.from({ length: 8 }, createValue)
96+
: Array.from({ length: 4 }, createValue)
97+
98+
return
99+
}
100+
101+
if (api.isIP6(props.type)) {
102+
state.address = value.split(':').map((item) => ({ value: item }))
103+
if (state.address.length < 8) {
104+
const missingCount = 8 - state.address.length
105+
const emptyIndex = state.address.findIndex((item) => item.value === '')
106+
const insertIndex = emptyIndex >= 0 ? emptyIndex : 0
107+
108+
if (emptyIndex >= 0) {
109+
state.address[emptyIndex].value = '0000'
111110
}
111+
112+
const newItems = Array(missingCount).fill({ value: '0000' })
113+
state.address.splice(insertIndex, 0, ...newItems)
112114
}
113115
} else {
114-
const createValue = () => ({ value: '' })
115-
state.address = api.isIP6(props.type)
116-
? new Array(8).fill('').map(createValue)
117-
: new Array(4).fill('').map(createValue)
116+
state.address = value.split('.').map((item) => ({ value: item }))
118117
}
119118
}
120119

packages/renderless/src/year-table/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export const getIsDefault =
2626
export const getIsDisabled =
2727
({ props }) =>
2828
(year) => {
29-
return props.selectionMode.startsWith('year') && typeof props.disabledDate === 'function'
29+
return typeof props.disabledDate === 'function'
3030
? props.disabledDate(new Date(year, 0, 1, 0))
3131
: false
3232
}

packages/theme/build/buildVarToObj.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import fs from 'node:fs'
2+
3+
export default () => {
4+
let varsString = fs.readFileSync('../src/base/vars.less', {encoding: 'utf-8'})
5+
6+
varsString = varsString.replace(':root', 'export const mapVar =')
7+
.replaceAll(' --tv', ' "--tv')
8+
.replaceAll(': ', ':')
9+
.replaceAll(':', '": "')
10+
.replaceAll(';', '",')
11+
12+
fs.writeFileSync('./mapVar.js', varsString)
13+
}

packages/theme/build/gulp-dist.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ import svgInline from 'gulp-svg-inline'
99
import prefixer from 'gulp-autoprefixer'
1010
import fg from 'fast-glob'
1111
import fs from 'node:fs'
12+
import buildVarToObj from './buildVarToObj.js'
13+
import writeDefaultValue from './writeDefaultValue.js'
14+
15+
buildVarToObj()
16+
writeDefaultValue()
1217

1318
const source = '../src'
1419
const dist = '../dist'

0 commit comments

Comments
 (0)