@peng_kai/kit 0.2.8 → 0.2.9

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.
@@ -149,11 +149,14 @@ const antdValueResolvers: Record<number, (value: any) => any> = {
149
149
  </script>
150
150
 
151
151
  <script setup lang="ts">
152
- const props = defineProps<{
152
+ const props = withDefaults(defineProps<{
153
153
  categoryApi: Api.Request
154
154
  configApi: Api.Request
155
155
  updateApi: Api.Request
156
- }>();
156
+ readonly?: boolean
157
+ }>(), {
158
+ readonly: false,
159
+ });
157
160
 
158
161
  const queryClient = useQueryClient();
159
162
 
@@ -247,6 +250,7 @@ function resetSetting() {
247
250
  class="ant-cover__col2-form"
248
251
  layout="vertical"
249
252
  :disabled="settingMutator.isPending.value"
253
+ :readonly="props.readonly"
250
254
  >
251
255
  <template v-for="item of configList" :key="item.key">
252
256
  <FormItem v-bind="settingForm.itemProps[item.key]" :label="item.label" :extra="item.summary">
@@ -313,7 +317,7 @@ function resetSetting() {
313
317
  </template>
314
318
  </Form>
315
319
 
316
- <template #actions>
320
+ <template v-if="!props.readonly" #actions>
317
321
  <Button :disabled="settingMutator.isPending.value" @click="resetSetting()">
318
322
  重置
319
323
  </Button>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@peng_kai/kit",
3
3
  "type": "module",
4
- "version": "0.2.8",
4
+ "version": "0.2.9",
5
5
  "description": "",
6
6
  "author": "",
7
7
  "license": "ISC",
@@ -2,13 +2,13 @@ import { type Component, reactive } from 'vue';
2
2
  import type { ComponentExposed } from 'vue-component-type-helpers';
3
3
  import { makeDestructurable } from '@vueuse/core';
4
4
 
5
- export function useTemplateRefs<T extends Record<string, Component | HTMLElement>>() {
5
+ export function useTemplateRefs<T extends Record<string, Component>>() {
6
6
  type TK = keyof T;
7
- type TI = {
8
- [K in TK]?: T[K] extends Component ? ComponentExposed<T[K]> : T[K]
7
+ type TRs = {
8
+ [K in TK]?: T[K] extends (HTMLElement | SVGElement) ? T[K] : ComponentExposed<T[K]>
9
9
  };
10
10
 
11
- const refs = reactive({} as TI);
11
+ const refs = reactive({} as TRs);
12
12
  const setRefs = new Proxy({} as { [K in TK]: (t: any) => void }, {
13
13
  get(_, p: any) {
14
14
  return (t: any) => {