vue2-client 1.15.129 → 1.15.130

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue2-client",
3
- "version": "1.15.129",
3
+ "version": "1.15.130",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint",
@@ -1,107 +1,21 @@
1
1
  <script setup lang="ts">
2
2
  import XButtons from '@vue2-client/base-client/components/common/XButtons/XButtons.vue'
3
- import { ref, onMounted, onUpdated, getCurrentInstance, watch, nextTick } from 'vue'
3
+ import { ref } from 'vue'
4
4
 
5
5
  defineProps({
6
+ // HButtons特有的属性
6
7
  buttonStyle: {
7
8
  type: String,
8
9
  default: 'button24'
9
10
  }
10
11
  })
11
12
 
12
- const xButtonsRef = ref(null)
13
- const instance = getCurrentInstance()
14
-
15
- // 防抖控制
16
- let syncTimeout = null
17
- function debounceSync (callback, delay = 100) {
18
- if (syncTimeout) clearTimeout(syncTimeout)
19
- syncTimeout = setTimeout(callback, delay)
20
- }
21
-
22
- // 方法缓存,避免重复挂载
23
- const syncedMethods = new WeakMap()
24
-
25
- function syncChildRefs () {
26
- if (!instance || !instance.proxy || !xButtonsRef.value) return
27
- const proxy = instance.proxy
28
- const target = proxy.$refs
29
- const childRefs = xButtonsRef.value.$refs
30
- if (!childRefs) return
31
-
32
- Object.entries(childRefs).forEach(([key, value]) => {
33
- const v = Array.isArray(value) ? value[0] : value
34
- if (target[key] !== v) target[key] = v
35
- })
36
- if (target.xButtonsRef !== xButtonsRef.value) target.xButtonsRef = xButtonsRef.value
37
- }
38
-
39
- function getAllFunctionNames (obj) {
40
- if (!obj) return []
41
- const names = new Set()
42
- let current = obj
43
- while (current && current !== Object.prototype) {
44
- Object.getOwnPropertyNames(current).forEach(name => {
45
- if (typeof obj[name] === 'function' && name !== 'constructor') names.add(name)
46
- })
47
- current = Object.getPrototypeOf(current)
48
- }
49
- return Array.from(names)
50
- }
51
-
52
- function syncChildMethods () {
53
- if (!instance || !instance.proxy || !xButtonsRef.value) return
54
- const proxy = instance.proxy
55
- const inner = xButtonsRef.value
56
- const cached = syncedMethods.get(inner) || new Set()
57
-
58
- getAllFunctionNames(inner).forEach(name => {
59
- if (cached.has(name) || proxy[name]) return
60
- proxy[name] = function () {
61
- if (xButtonsRef.value && typeof xButtonsRef.value[name] === 'function') {
62
- return xButtonsRef.value[name].apply(xButtonsRef.value, arguments)
63
- }
64
- }
65
- cached.add(name)
66
- })
67
- syncedMethods.set(inner, cached)
68
- }
69
-
70
- function syncAll () {
71
- syncChildRefs()
72
- syncChildMethods()
73
- }
74
-
75
- // 子组件生命周期事件回调,确保及时同步
76
- function onInnerMounted () { nextTick(function () { debounceSync(syncAll) }) }
77
- function onInnerUpdated () { nextTick(function () { debounceSync(syncChildRefs) }) }
78
-
79
- // 生命周期与监听
80
- onMounted(() => nextTick(() => debounceSync(syncAll)))
81
- onUpdated(() => nextTick(() => debounceSync(syncAll)))
82
-
83
- watch(() => xButtonsRef.value && xButtonsRef.value.$refs, () => nextTick(() => debounceSync(syncChildRefs)), { deep: true, flush: 'post' })
84
- watch(() => xButtonsRef.value, () => nextTick(() => debounceSync(syncChildMethods)), { flush: 'post' })
85
-
86
- // 常用方法显式代理(API更清晰)
87
- function createMethodProxy (methodName) {
88
- return function () {
89
- const inst = xButtonsRef.value
90
- if (inst && typeof inst[methodName] === 'function') return inst[methodName].apply(inst, arguments)
91
- }
92
- }
93
-
94
- const COMMON_METHODS = [
95
- 'clickByKey', 'setButtons', 'disableButton', 'enableButton'
96
- ]
13
+ // 内部 XButtons 实例引用
14
+ const xButtonsRef = ref()
97
15
 
16
+ // 暴露方法:获取内部 XButtons 实例
98
17
  defineExpose({
99
- getXButtonsInstance: () => xButtonsRef.value,
100
- // 显式常用方法
101
- ...COMMON_METHODS.reduce((acc, m) => {
102
- acc[m] = createMethodProxy(m)
103
- return acc
104
- }, {})
18
+ getXButtonsInstance: function () { return xButtonsRef.value }
105
19
  })
106
20
  </script>
107
21
 
@@ -116,8 +30,6 @@ defineExpose({
116
30
  ref="xButtonsRef"
117
31
  v-bind="$attrs"
118
32
  v-on="$listeners"
119
- @hook:mounted="onInnerMounted"
120
- @hook:updated="onInnerUpdated"
121
33
  >
122
34
  <template v-for="(_, name) in $slots" #[name]="slotData">
123
35
  <slot :name="name" v-bind="slotData" />
@@ -127,5 +39,69 @@ defineExpose({
127
39
  </template>
128
40
 
129
41
  <style scoped lang="less">
130
- .h-buttons-wrapper { }
42
+ .h-buttons-wrapper {
43
+ // 基础样式
44
+ :deep(.ant-btn-group) {
45
+ .ant-btn {
46
+ border-radius: 6px;
47
+ background-color: #FFFFFF;
48
+ border: 1px solid #9499A0;
49
+ color: #313131;
50
+ font-weight: normal;
51
+ letter-spacing: 0em;
52
+ width: 110px;
53
+ font-size: 16px;
54
+ font-family: "Source Han Sans";
55
+ line-height: normal;
56
+ margin-right: 25px;
57
+ height: 32px;
58
+ }
59
+ }
60
+
61
+ // button24样式
62
+ &.h-buttons-button24 {
63
+ :deep(.ant-btn-group) {
64
+ .ant-btn {
65
+ border: 1px solid #CDCDCD;
66
+ color: #5D5C5C;
67
+ font-weight: normal;
68
+ letter-spacing: 0em;
69
+ font-size: 16px;
70
+ line-height: normal;
71
+ margin-right: 25px;
72
+ border-radius: 6px;
73
+ background-color: #FFFFFF;
74
+ // 这个不合理
75
+ // top: -100px;
76
+ width: fit-content;
77
+ min-width: 110px;
78
+ font-family: "Source Han Sans";
79
+ height: 32px;
80
+ }
81
+ }
82
+ }
83
+
84
+ // button23样式
85
+ &.h-buttons-button23 {
86
+ :deep(.ant-btn-group) {
87
+ .ant-btn {
88
+ border: none;
89
+ padding: 0 !important;
90
+ color: #FFFFFF;
91
+ font-weight: normal;
92
+ letter-spacing: 0em;
93
+ font-size: 16px;
94
+ line-height: normal;
95
+ border-radius: 50%;
96
+ background-color: #1890FF;
97
+ margin-left: 10px;
98
+ top: -88px;
99
+ width: 30px;
100
+ font-family: "Source Han Sans";
101
+ height: 30px;
102
+ }
103
+ }
104
+ }
105
+
106
+ }
131
107
  </style>
@@ -1,117 +1,22 @@
1
1
  <script setup lang="ts">
2
2
  import XFormTable from '@vue2-client/base-client/components/common/XFormTable/XFormTable.vue'
3
- import { ref, onMounted, onUpdated, getCurrentInstance, watch, nextTick } from 'vue'
3
+ import { ref } from 'vue'
4
4
 
5
5
  defineProps({
6
+ // HFormTable特有的属性
6
7
  tableStyle: {
7
8
  type: String,
8
9
  default: 'formtable-col1'
9
10
  }
10
11
  })
11
12
 
12
- const xFormTableRef = ref(null)
13
- const instance = getCurrentInstance()
14
-
15
- // 防抖控制
16
- let syncTimeout = null
17
- function debounceSync (callback, delay = 100) {
18
- if (syncTimeout) clearTimeout(syncTimeout)
19
- syncTimeout = setTimeout(callback, delay)
20
- }
21
-
22
- // 方法缓存,避免重复挂载
23
- const syncedMethods = new WeakMap()
24
-
25
- function syncChildRefs () {
26
- if (!instance || !instance.proxy || !xFormTableRef.value) return
27
- const proxy = instance.proxy
28
- const target = proxy.$refs
29
- const childRefs = xFormTableRef.value.$refs
30
- if (!childRefs) return
31
-
32
- Object.entries(childRefs).forEach(([key, value]) => {
33
- const v = Array.isArray(value) ? value[0] : value
34
- if (target[key] !== v) target[key] = v
35
- })
36
- if (target.xFormTableRef !== xFormTableRef.value) target.xFormTableRef = xFormTableRef.value
37
- }
38
-
39
- function getAllFunctionNames (obj) {
40
- if (!obj) return []
41
- const names = new Set()
42
- let current = obj
43
- while (current && current !== Object.prototype) {
44
- Object.getOwnPropertyNames(current).forEach(name => {
45
- if (typeof obj[name] === 'function' && name !== 'constructor') names.add(name)
46
- })
47
- current = Object.getPrototypeOf(current)
48
- }
49
- return Array.from(names)
50
- }
51
-
52
- function syncChildMethods () {
53
- if (!instance || !instance.proxy || !xFormTableRef.value) return
54
- const proxy = instance.proxy
55
- const inner = xFormTableRef.value
56
- const cached = syncedMethods.get(inner) || new Set()
57
-
58
- getAllFunctionNames(inner).forEach(name => {
59
- if (cached.has(name) || proxy[name]) return
60
- proxy[name] = function () {
61
- if (xFormTableRef.value && typeof xFormTableRef.value[name] === 'function') {
62
- return xFormTableRef.value[name].apply(xFormTableRef.value, arguments)
63
- }
64
- }
65
- cached.add(name)
66
- })
67
- syncedMethods.set(inner, cached)
68
- }
69
-
70
- function syncAll () {
71
- syncChildRefs()
72
- syncChildMethods()
73
- }
74
-
75
- // 子组件生命周期事件回调,确保及时同步
76
- function onInnerMounted () { nextTick(function () { debounceSync(syncAll) }) }
77
- function onInnerUpdated () { nextTick(function () { debounceSync(syncChildRefs) }) }
78
-
79
- // 生命周期与监听
80
- onMounted(() => nextTick(() => debounceSync(syncAll)))
81
- onUpdated(() => nextTick(() => debounceSync(syncAll)))
82
-
83
- watch(() => xFormTableRef.value && xFormTableRef.value.$refs, () => nextTick(() => debounceSync(syncChildRefs)), { deep: true, flush: 'post' })
84
- watch(() => xFormTableRef.value, () => nextTick(() => debounceSync(syncChildMethods)), { flush: 'post' })
85
-
86
- // 常用方法显式代理(API更清晰)
87
- function createMethodProxy (methodName) {
88
- return function () {
89
- const inst = xFormTableRef.value
90
- if (inst && typeof inst[methodName] === 'function') return inst[methodName].apply(inst, arguments)
91
- }
92
- }
93
-
94
- const COMMON_METHODS = [
95
- 'reload', 'init', 'doSearch', 'resetForm', 'refreshTable',
96
- 'clearRowKeys', 'update', 'setTableData'
97
- ]
13
+ // 创建对XFormTable组件的引用
14
+ const xFormTableRef = ref()
98
15
 
16
+ // 暴露方法给父组件使用
99
17
  defineExpose({
100
- getXFormTableInstance: () => xFormTableRef.value,
101
- // 显式常用方法
102
- ...COMMON_METHODS.reduce((acc, m) => {
103
- acc[m] = createMethodProxy(m)
104
- return acc
105
- }, {}),
106
- // 便捷:获取内部表格/表单ref
107
- getTableRef: () => {
108
- const refs = xFormTableRef.value && xFormTableRef.value.$refs
109
- return (refs && (refs.table || refs.xTable)) || undefined
110
- },
111
- getFormRef: () => {
112
- const refs = xFormTableRef.value && xFormTableRef.value.$refs
113
- return (refs && (refs.form || refs.xForm)) || undefined
114
- }
18
+ // 为了兼容性,保留getXFormTableInstance方法
19
+ getXFormTableInstance: () => xFormTableRef.value
115
20
  })
116
21
  </script>
117
22
 
@@ -126,8 +31,6 @@ defineExpose({
126
31
  ref="xFormTableRef"
127
32
  v-bind="$attrs"
128
33
  v-on="$listeners"
129
- @hook:mounted="onInnerMounted"
130
- @hook:updated="onInnerUpdated"
131
34
  >
132
35
  <template v-for="(_, name) in $slots" #[name]="slotData">
133
36
  <slot :name="name" v-bind="slotData" />
@@ -1,134 +1,22 @@
1
1
  <script setup lang="ts">
2
2
  import XTab from '@vue2-client/base-client/components/common/XTab/XTab.vue'
3
- import { ref, onMounted, onUpdated, getCurrentInstance, watch, nextTick } from 'vue'
3
+ import { ref } from 'vue'
4
4
 
5
5
  defineProps({
6
+ // HTab特有的属性
6
7
  hasTopMargin: {
7
8
  type: Boolean,
8
9
  default: true
9
10
  }
10
11
  })
11
12
 
12
- const emit = defineEmits(['ready'])
13
-
14
- const xTabRef = ref(null)
15
- const instance = getCurrentInstance()
16
-
17
- // 就绪承诺
18
- let _resolveReady = null
19
- let _readyPromise = null
20
- function resetReady () {
21
- _readyPromise = new Promise(function (resolve) { _resolveReady = resolve })
22
- }
23
- resetReady()
24
- function markReady () {
25
- if (_resolveReady) { _resolveReady(); _resolveReady = null }
26
- emit('ready')
27
- }
28
-
29
- // 防抖控制
30
- let syncTimeout = null
31
- function debounceSync (callback, delay = 100) {
32
- if (syncTimeout) clearTimeout(syncTimeout)
33
- syncTimeout = setTimeout(callback, delay)
34
- }
35
-
36
- // 方法缓存
37
- const syncedMethods = new WeakMap()
38
-
39
- function getAllFunctionNames (obj) {
40
- if (!obj) return []
41
- const names = new Set()
42
- let current = obj
43
- while (current && current !== Object.prototype) {
44
- Object.getOwnPropertyNames(current).forEach(name => {
45
- if (typeof obj[name] === 'function' && name !== 'constructor') names.add(name)
46
- })
47
- current = Object.getPrototypeOf(current)
48
- }
49
- return Array.from(names)
50
- }
51
-
52
- function syncChildMethods () {
53
- if (!instance || !instance.proxy || !xTabRef.value) return
54
- const proxy = instance.proxy
55
- const inner = xTabRef.value
56
- const cached = syncedMethods.get(inner) || new Set()
57
- getAllFunctionNames(inner).forEach(name => {
58
- if (cached.has(name) || proxy[name]) return
59
- proxy[name] = function () {
60
- if (xTabRef.value && typeof xTabRef.value[name] === 'function') {
61
- return xTabRef.value[name].apply(xTabRef.value, arguments)
62
- }
63
- }
64
- cached.add(name)
65
- })
66
- syncedMethods.set(inner, cached)
67
- }
68
-
69
- // 访问时动态合并 $refs:原始 + 子组件(拍平数组)+ xTabRef
70
- function installRefsGetter () {
71
- if (!instance || !instance.proxy) return
72
- const proxy = instance.proxy
73
- const baseRefs = proxy.$refs
74
- if (!baseRefs) return
75
- try {
76
- Object.defineProperty(proxy, '$refs', {
77
- configurable: true,
78
- get () {
79
- const merged = {}
80
- // 基础 refs
81
- if (baseRefs) {
82
- Object.keys(baseRefs).forEach(function (k) { merged[k] = baseRefs[k] })
83
- }
84
- // 子组件 refs
85
- const child = xTabRef.value && xTabRef.value.$refs
86
- if (child) {
87
- Object.keys(child).forEach(function (k) {
88
- const v = Array.isArray(child[k]) ? child[k][0] : child[k]
89
- merged[k] = v
90
- })
91
- }
92
- // xTabRef 本身
93
- merged.xTabRef = xTabRef.value
94
- return merged
95
- }
96
- })
97
- } catch (e) {
98
- // 忽略 defineProperty 失败,保持原逻辑
99
- }
100
- }
101
-
102
- function syncAll () {
103
- syncChildMethods()
104
- markReady()
105
- }
106
-
107
- // 生命周期与监听
108
- onMounted(() => nextTick(() => {
109
- installRefsGetter()
110
- debounceSync(function () { syncAll() })
111
- }))
112
- onUpdated(() => nextTick(() => debounceSync(function () { syncAll() })))
113
- watch(() => xTabRef.value, () => nextTick(() => { resetReady(); debounceSync(function () { syncAll() }) }), { flush: 'post' })
114
-
115
- // 常用方法显式代理
116
- function createMethodProxy (methodName) {
117
- return function () {
118
- const inst = xTabRef.value
119
- if (inst && typeof inst[methodName] === 'function') return inst[methodName].apply(inst, arguments)
120
- }
121
- }
122
-
123
- const COMMON_METHODS = ['tabPaneChange', 'initConfig', 'getConfig']
13
+ // 创建对XTab组件的引用
14
+ const xTabRef = ref()
124
15
 
16
+ // 暴露方法给父组件使用
125
17
  defineExpose({
18
+ // 为了兼容性,保留getXTabInstance方法
126
19
  getXTabInstance: () => xTabRef.value,
127
- whenReady: () => _readyPromise,
128
- ...COMMON_METHODS.reduce((acc, m) => { acc[m] = createMethodProxy(m); return acc }, {}),
129
- getActiveKey: () => xTabRef.value && xTabRef.value.activeKey,
130
- getConfigData: () => xTabRef.value && xTabRef.value.config,
131
- getShowTabBar: () => xTabRef.value && xTabRef.value.showTabBar,
132
20
  })
133
21
  </script>
134
22
 
@@ -148,9 +36,16 @@ defineExpose({
148
36
 
149
37
  <style scoped lang="less">
150
38
  .h-tab-wrapper {
151
- :deep(.ant-tabs-tab-next) { display: none; }
39
+ // 基础样式
40
+ :deep(.ant-tabs-tab-next) {
41
+ display: none;
42
+ }
43
+
152
44
  :deep(.ant-tabs-nav) {
153
- .ant-tabs-tab-next-icon { display: none; }
45
+ .ant-tabs-tab-next-icon {
46
+ display: none;
47
+ }
48
+
154
49
  .ant-tabs-tab {
155
50
  background-color: transparent;
156
51
  border-radius: 6px 6px 0 0;
@@ -164,6 +59,7 @@ defineExpose({
164
59
  height: 32px;
165
60
  text-align: center;
166
61
  }
62
+
167
63
  .ant-tabs-tab-active {
168
64
  background-color: #0057FE;
169
65
  color: #ffffff;
@@ -173,14 +69,43 @@ defineExpose({
173
69
  text-align: center;
174
70
  }
175
71
  }
176
- :deep(.ant-tabs-bar) { border-bottom: 2px solid #0057FE; }
177
- :deep(.ant-tabs-tab-arrow-show) { display: none; }
178
- :deep(.ant-tabs-ink-bar) { background-color: transparent; bottom: -1px; display: none; height: 0; }
179
- :deep(.ant-tabs-tab-prev-icon-target) { display: none; }
72
+
73
+ :deep(.ant-tabs-bar) {
74
+ border-bottom: 2px solid #0057FE;
75
+ }
76
+
77
+ :deep(.ant-tabs-tab-arrow-show) {
78
+ display: none;
79
+ }
80
+
81
+ :deep(.ant-tabs-ink-bar) {
82
+ background-color: transparent;
83
+ bottom: -1px;
84
+ display: none;
85
+ height: 0;
86
+ }
87
+
88
+ :deep(.ant-tabs-tab-prev-icon-target) {
89
+ display: none;
90
+ }
91
+
92
+ // 带顶部边距的样式
180
93
  &.h-tab-has-top-margin {
181
- :deep(.ant-tabs-nav) { margin-top: 6px; }
182
- :deep(.ant-tabs-bar) { margin: 0 6px; }
183
- :deep(.ant-card-body) { padding: 6px 0; .ant-card-body { padding: 6px; } }
94
+ :deep(.ant-tabs-nav) {
95
+ margin-top: 6px;
96
+ }
97
+
98
+ :deep(.ant-tabs-bar) {
99
+ margin: 0 6px;
100
+ }
101
+
102
+ :deep(.ant-card-body) {
103
+ padding: 6px 0;
104
+
105
+ .ant-card-body {
106
+ padding: 6px;
107
+ }
108
+ }
184
109
  }
185
110
  }
186
111
  </style>