@vyr/design 0.0.33 → 0.0.34

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/src/index.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import './theme'
2
+ import { useProvider } from './components/composables/useProvider'
2
3
  import { ModuleRegistry, AllCommunityModule } from 'ag-grid-community'
3
4
  import { AgGridVue as VyrTable } from 'ag-grid-vue3'
4
5
  import VyrSlot from './components/Slot.vue'
@@ -10,7 +11,7 @@ import VyrChecked from './components/Checked.vue'
10
11
  import VyrCheckedGroup from './components/CheckedGroup.vue'
11
12
  import VyrCol from './components/Col.vue'
12
13
  import VyrColorPicker from './components/ColorPicker.vue'
13
- import VyrDrapdown from './components/Dropdown.vue'
14
+ import VyrDropdown from './components/Dropdown.vue'
14
15
  import VyrDialog from './components/Dialog.vue'
15
16
  import VyrDraggable from './components/Draggable.vue'
16
17
  import VyrDynamicLayouter from './components/DynamicLayouter.vue'
@@ -33,6 +34,7 @@ ModuleRegistry.registerModules([AllCommunityModule])
33
34
 
34
35
  export * as VyrTableCommon from 'ag-grid-community'
35
36
  export {
37
+ useProvider,
36
38
  VyrTable,
37
39
  VyrSlot,
38
40
  VyrButton,
@@ -43,7 +45,7 @@ export {
43
45
  VyrCheckedGroup,
44
46
  VyrCol,
45
47
  VyrColorPicker,
46
- VyrDrapdown,
48
+ VyrDropdown,
47
49
  VyrDialog,
48
50
  VyrDraggable,
49
51
  VyrDynamicLayouter,
@@ -0,0 +1,55 @@
1
+ import { ThemeServiceInit, galaxyTheme, ThemeService as _ThemeService, Theme } from "devui-theme";
2
+
3
+ class ThemeService {
4
+ static darkTheme = {
5
+ ...galaxyTheme,
6
+ data: {
7
+ ...galaxyTheme.data,
8
+ "devui-icon-hover-bg": "#393a3e",
9
+ },
10
+ };
11
+
12
+ themeCollection = new Map<string, Theme>();
13
+ themeService: _ThemeService;
14
+ currentTheme = "dark";
15
+
16
+ constructor() {
17
+ this.themeService = ThemeServiceInit() as _ThemeService;
18
+ this.set('dark', ThemeService.darkTheme);
19
+ }
20
+
21
+ set(themeType: string, theme: Theme) {
22
+ this.themeCollection.set(themeType, theme);
23
+ }
24
+
25
+ get(themeType: string) {
26
+ return this.themeCollection.get(themeType) || null;
27
+ }
28
+
29
+ update(themeUpdate: Partial<Theme>) {
30
+ const theme = this.get(this.currentTheme);
31
+ if (theme === null) return null
32
+ const updatedTheme: Theme = {
33
+ ...theme,
34
+ ...themeUpdate,
35
+ data: {
36
+ ...theme.data,
37
+ ...themeUpdate.data,
38
+ },
39
+ };
40
+ this.set(this.currentTheme, updatedTheme);
41
+ this.apply(this.currentTheme);
42
+ }
43
+
44
+ apply(themeType = 'dark') {
45
+ const theme = this.get(themeType);
46
+ if (theme === null) return null
47
+ this.themeService.applyTheme(theme);
48
+ document.body.setAttribute("ui-theme-type", themeType);
49
+ this.currentTheme = themeType;
50
+ }
51
+ }
52
+
53
+ export {
54
+ ThemeService
55
+ };
@@ -1,6 +1,7 @@
1
1
  import '../font/iconfont.css'
2
2
  import '../theme/global.less'
3
3
  import { reactive } from "vue"
4
+ import { ThemeService } from './ThemeService'
4
5
 
5
6
  interface ThemeConfig {
6
7
  whiteColor: string
@@ -126,7 +127,7 @@ class Theme {
126
127
  optionDisabledBackgroundColor: 'rgba(77, 77, 77, 1)',
127
128
 
128
129
  optionsScrollMargin: { unit: 'px', value: 6 },
129
- optionsBorderColor: 'rgba(77, 77, 77, 1)',
130
+ optionsBorderColor: 'rgba(45, 45, 45, 1)',
130
131
  optionsBackgroundColor: 'rgba(30, 30, 30, 1)',
131
132
 
132
133
  dialogHeaderBackgroundColor: 'rgba(30, 30, 30, 0.9)',
@@ -156,4 +157,11 @@ class Theme {
156
157
 
157
158
  Theme.update(Theme.config)
158
159
 
159
- export { ThemeConfig, Theme }
160
+ export { ThemeConfig, Theme }
161
+
162
+ //使用主题服务,代替现在的旧的主题处理方式,且将css预处理器替换为 sass
163
+ const themeService = new ThemeService()
164
+
165
+ export {
166
+ themeService
167
+ }
@@ -0,0 +1,24 @@
1
+ function fallbackCopyTextToClipboard(text: string) {
2
+ const textArea = document.createElement("textarea")
3
+ textArea.setAttribute('style', 'position:fixed;z-index:-999;')
4
+ textArea.value = text
5
+ document.body.appendChild(textArea)
6
+ textArea.focus()
7
+ textArea.select()
8
+
9
+ try {
10
+ document.execCommand('copy');
11
+ } catch (err) {
12
+ console.log('复制失败')
13
+ }
14
+
15
+ document.body.removeChild(textArea);
16
+ }
17
+
18
+ const copy = (content: string) => {
19
+ return navigator.clipboard ? navigator.clipboard.writeText(content) : fallbackCopyTextToClipboard(content)
20
+ }
21
+
22
+ export {
23
+ copy
24
+ }
package/src/tool/index.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from './ArrayUtils'
2
2
  export * from './Color'
3
3
  export * from './Listener'
4
- export * from './Draggable'
4
+ export * from './Draggable'
5
+ export * from './copy'