Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions library_fdddf_diff/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# http://editorconfig.org
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
31 changes: 31 additions & 0 deletions library_fdddf_diff/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
*.log*
.cache
.DS_Store
.idea
.vscode
.eslintcache

# npm
node_modules

# test
**/test/coverage

# dist file
es
lib
dist
dist-theme
assets-package
/site
changelog.generated.md
vetur

*.tgz

# lcap files
.lcap
source.zip
manifest
nasl.extension.*
*@*.zip
3 changes: 3 additions & 0 deletions library_fdddf_diff/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
public/*.js
dist-theme
node_modules
6 changes: 6 additions & 0 deletions library_fdddf_diff/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"tabWidth": 2,
"printWidth": 150,
"singleQuote": true,
"trailingComma": "es5"
}
28 changes: 28 additions & 0 deletions library_fdddf_diff/.storybook/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
const config = {
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
addons: [
'@storybook/addon-links',
'@storybook/addon-essentials',
'@storybook/addon-onboarding',
'@storybook/addon-interactions',
],
framework: {
name: '@lcap/storybook-vue-vite',
options: {
builder: {
viteConfigPath: './vite.config.js',
},
},
},
docs: {
autodocs: 'tag',
},
viteFinal(config) {
config.server.hmr = {
port: 443,
clientPort: 443
}
return config
},
};
export default config;
27 changes: 27 additions & 0 deletions library_fdddf_diff/.storybook/preview.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import 'virtual-lcap:lcap-ui.css';
import Vue from 'vue';
import * as Components from '@/index';
import * as LcapUI from 'virtual-lcap:lcap-ui';
Vue.use(LcapUI);

Object.keys(Components).forEach((key) => {
if (Components[key] && Components[key].name) {
Vue.component(Components[key].name, Components[key]);
} else if (Components[key] && typeof Components[key].install === 'function') {
Vue.use(Components[key]);
}
});

const preview = {
parameters: {
actions: { argTypesRegex: '^on[A-Z].*' },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/i,
},
},
},
};

export default preview;
925 changes: 925 additions & 0 deletions library_fdddf_diff/.yarn/releases/yarn-stable-temp.cjs

Large diffs are not rendered by default.

74 changes: 74 additions & 0 deletions library_fdddf_diff/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# 文本对比组件库

**依赖库设计**

这个依赖库旨在提供一套用于低代码开发的文本对比工具库

**主要特性**

- **组件一:** 提供文本对比组件

## diff-viewer


**特性 1:** 支持行、字符,单词对比

**特性 2:** 支持自定义新增、删除字体,背景色


- **逻辑一:** 提供文本行对比逻辑

返回结果
`[{ value: string, added: bool, removed: bool, count: number }]`

value: 通常作为单个字符串添加、删除或常用的文本
added: true 表示该行是添加的行,false 表示该行是删除的行, 实际返回值为字符串 1或0
removed: true 表示该行是删除的行,false 表示该行是添加的行, 实际返回值为字符串 1或0
count: 更改对象中的值由多少个标记(例如,不同字符的字符,不同行的行)组成

更多参考官方文档 https://github.com/kpdecker/jsdiff

## getDiffLines

**特性 1:** 返回行级对比结果


## getDiffChars

**特性 1:** 返回字符级对比结果

## getDiffWords

**特性 1:** 返回单词级对比结果


## 使用说明

### 组件(diff-viewer)

- **attrs**
- one: String 左侧文本
- other: String 右侧文本
- diffType: String 对比维度类型,可选值:line、char、word
- delBackgroundColor: String 删除字体颜色
- delColor: String 删除背景颜色
- insBackgroundColor: String 新增字体颜色
- insColor: String 新增背景颜色

- **methods**
n/a

- **events**
n/a

### 逻辑(逻辑名)

- **methodName(params):**
n/a

## 应用演示链接

[示例演示链接](https://dev-testdiff-qa.app.codewave.163.com/dashboard/difftest)

![img](Snipaste_2024-09-08_02-26-43.jpg)

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading