@94ai/nf-resizable-panels 3.2.48 → 3.2.51

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.
@@ -1,2 +1 @@
1
- export const presudos = ['', 'webkit', 'moz'];
2
1
  export const CHILD_DATA_ATTR_NAME = 'resiable-panel-child';
@@ -9,9 +9,9 @@ import {
9
9
  import {
10
10
  _getComputedStyle,
11
11
  getFlexDirection,
12
- } from './utils'
12
+ generateID
13
+ } from '@94ai/common-utils'
13
14
  import { CHILD_DATA_ATTR_NAME } from './const'
14
- import { generateID } from '../../../utils'
15
15
 
16
16
  export default defineComponent({
17
17
  name: 'nf-resizable-panels',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@94ai/nf-resizable-panels",
3
- "version": "3.2.48",
3
+ "version": "3.2.51",
4
4
  "description": "> TODO: description",
5
5
  "keywords": [],
6
6
  "author": "zoujiahe <zoujiahe@94ai.com>",
@@ -14,7 +14,8 @@
14
14
  "url": "http://94ai.gitlab.com/zoujiahe/common-ui.git"
15
15
  },
16
16
  "dependencies": {
17
- "@94ai/nf-theme-chalk": "^3.2.48",
17
+ "@94ai/common-utils": "^3.2.51",
18
+ "@94ai/nf-theme-chalk": "^3.2.51",
18
19
  "lodash-es": "^4.17.21",
19
20
  "vue-demi": "^0.14.5"
20
21
  },
@@ -31,5 +32,5 @@
31
32
  "types": "lib/index.d.ts",
32
33
  "main": "lib/nf-resizable-panels.cjs.js",
33
34
  "module": "lib/nf-resizable-panels.esm-bundler.js",
34
- "gitHead": "91145bb7df8dad2c0cb3eefb101c6158ec854269"
35
+ "gitHead": "1c4b9d8c3b8c416274a210124bf9f5f75ce01c73"
35
36
  }
@@ -1,8 +0,0 @@
1
- export declare function upperCamelCase(word: string): string;
2
- export declare function isAutoFlexBasis(el: HTMLElement): boolean;
3
- export declare function _getComputedStyle(el: HTMLElement, k: string): string | undefined;
4
- export declare function getFlexDirection(el: HTMLElement): {
5
- vertical: boolean;
6
- reverse: boolean;
7
- };
8
- export declare function mergeVNodeProps(vnode: any, ...args: any[]): any;
@@ -1,92 +0,0 @@
1
- import { presudos } from '../const'
2
- import { merge, pick, omit } from 'lodash-es';
3
- import mergeProps from '@vue/babel-helper-vue-jsx-merge-props';
4
-
5
- /**
6
- * 转驼峰
7
- * @param { string } word
8
- */
9
- export function upperCamelCase(word: string): string {
10
- const cleanedString = word.replace(/\W/g, '');
11
- const words = cleanedString.toLowerCase().split(/\B(?=[A-Z])/);
12
- const upperCamelCase = words.map(word => word.charAt(0).toUpperCase() + word.slice(1)).join('');
13
- return upperCamelCase;
14
- }
15
-
16
- /**
17
- * flex: none => flex: 0 0 auto
18
- * flex: 0 => flex: 0 1 0%
19
- * flex: 1 => flex: 1 1 0%
20
- * 没有flex => flex: 0 1 auto
21
- * @param { HTMLElement } el
22
- */
23
- export function isAutoFlexBasis(el: HTMLElement): boolean {
24
- const flexBasis = _getComputedStyle(el, 'flexBasis') as string;
25
- return flexBasis === 'auto';
26
- }
27
-
28
- /**
29
- * 兼容各浏览器getComputedStyle
30
- * @param { HTMLElement } el
31
- * @param { string } k
32
- */
33
- export function _getComputedStyle(el: HTMLElement, k: string): string | undefined {
34
- const computedStyle = getComputedStyle(el);
35
- for (let i = 0; i <= presudos.length; i++) {
36
- const key = presudos[i] ? `${presudos[i]}${upperCamelCase(k)}` : k;
37
- if (computedStyle[key]) {
38
- return computedStyle[key as keyof CSSStyleDeclaration] as string;
39
- }
40
- }
41
- return undefined;
42
- }
43
-
44
- /**
45
- * 获取元素flex方向
46
- * @param { HTMLElement } el
47
- */
48
- export function getFlexDirection(el: HTMLElement): {
49
- /**
50
- * 是否竖向
51
- */
52
- vertical: boolean,
53
- reverse: boolean,
54
- } {
55
- const flexDirection = _getComputedStyle(el, 'flexDirection') as string;
56
- const [direction, reverse] = flexDirection.split('-');
57
- return {
58
- vertical: direction === 'column',
59
- reverse: !!reverse,
60
- };
61
- }
62
-
63
-
64
- export function mergeVNodeProps(vnode, ...args) {
65
- if (vnode.componentOptions) {
66
- const { propsData, listeners, Ctor } = vnode.componentOptions;
67
- // 为了便于合并, 我们只取on和attrs两个参数,分别合并事件和属性
68
- const { on, attrs } = mergeProps([{ on: listeners, attrs: propsData }, ...args]);
69
- // 获取组件中定义的props
70
- const keys = Object.keys(Ctor.options.props || {});
71
- // 分离出组件需要的propsData和attrs
72
- const [$props, $attrs] = [pick(attrs, keys), omit(attrs, keys)];
73
-
74
- // 这里偷懒使用lodash.merge函数进行递归合并
75
- merge(vnode, {
76
- data: { attrs: $attrs },
77
- componentOptions: {
78
- listeners: on,
79
- propsData: $props,
80
- },
81
- });
82
- } else {
83
- // 非组件VNode,直接合并data。但需要注意事件使用的是on而非nativeOn
84
- // 属性根据情况可以使用attrs或domProps,这二者的区别见后文
85
- vnode.data = mergeProps([vnode.data, ...args]);
86
- }
87
-
88
- return vnode;
89
- }
90
-
91
-
92
-