@ithinkdt/page 4.1.0 → 4.1.1

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": "@ithinkdt/page",
3
- "version": "4.1.0",
3
+ "version": "4.1.1",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "iThinkDT Page",
@@ -40,8 +40,8 @@
40
40
  "sideEffects": false,
41
41
  "dependencies": {
42
42
  "@vueuse/core": "^14.3.0",
43
- "nanoid": "^5.1.11",
44
- "@ithinkdt/common": "^4.1.0"
43
+ "nanoid": "^5.1.15",
44
+ "@ithinkdt/common": "^4.1.1"
45
45
  },
46
46
  "peerDependencies": {
47
47
  "vue": ">=3.5",
package/src/crud.js CHANGED
@@ -70,10 +70,7 @@ function _useSimpleCrudModal(crudType, getItems, request, options) {
70
70
  const setModalType = (crudType) => {
71
71
  let type = options.modalType
72
72
  if (typeof type === 'function') {
73
- type = type({
74
- model: model.value,
75
- type: crudType,
76
- })
73
+ type = type(crudType)
77
74
  } else if (isRef(type)) {
78
75
  type = type.value
79
76
  }
@@ -123,6 +120,7 @@ function _useSimpleCrudModal(crudType, getItems, request, options) {
123
120
  initial
124
121
  .then((res) => {
125
122
  model.value = res
123
+ modal.reset(res)
126
124
  }).finally(() => {
127
125
  loading.value = false
128
126
  })
@@ -56,10 +56,10 @@ export function useDescriptionsHelper(
56
56
 
57
57
  const bindings = { }
58
58
  for (const k of Object.keys(options ?? {})) {
59
- if (k.length > render.length && k.startsWith(render)) {
60
- bindings[uncapitalize(k.slice(render.length))] = options[k]
61
- delete options[k]
62
- }
59
+ if (!(k.length > render.length && k.startsWith(render))) continue
60
+
61
+ bindings[uncapitalize(k.slice(render.length))] = options[k]
62
+ delete options[k]
63
63
  }
64
64
  const bindings0 = computed(() => {
65
65
  return Object.fromEntries(Object.entries(bindings)
package/src/form.d.ts CHANGED
@@ -255,6 +255,7 @@ export type FormModalOptions<Model extends {}> = FormModalOptionsBase & FormHelp
255
255
  export interface FormModal<Model extends {}> extends Omit<ModalReturns, 'open'> {
256
256
  open(this: void, model: MaybePromise<Model>, title?: VNodeChild | (() => VNodeChild)): PromiseLike<Model>
257
257
  reinit(this: void): void
258
+ reset(this: void, initial?: Partial<Model>, overwrite?: boolean, reinit?: boolean): Partial<Model>
258
259
  }
259
260
  export declare function useFormModal<Model extends {}>(options: FormModalOptions<Model>):
260
261
  FormModal<Model>
package/src/form.js CHANGED
@@ -61,10 +61,10 @@ export function useFormHelper(items, { initial: initial0, rules, onChange, inFil
61
61
  }
62
62
  const bindings = {}
63
63
  for (const k of Object.keys(options)) {
64
- if (k.length > render.length && k.startsWith(render)) {
65
- bindings[uncapitalize(k.slice(render.length))] = options[k]
66
- delete options[k]
67
- }
64
+ if (!(k.length > render.length && k.startsWith(render))) continue
65
+
66
+ bindings[uncapitalize(k.slice(render.length))] = options[k]
67
+ delete options[k]
68
68
  }
69
69
  const bindings0 = computed(() => {
70
70
  return Object.fromEntries(Object.entries(bindings)
@@ -439,9 +439,7 @@ export function useFilterHelper(items, { customizable = false, cached, cacheVers
439
439
  const raw = StorageSerializers.object.write([sort, hidden])
440
440
  return storage.setItem(key, raw)
441
441
  }
442
- }
443
-
444
- if (!customizable) {
442
+ } else {
445
443
  reinit()
446
444
  }
447
445
 
@@ -598,6 +596,7 @@ export function useFormModal({ initial, items, rules, onSubmit, submitText, canc
598
596
  ...modal,
599
597
  open,
600
598
  reinit: form.reinit,
599
+ reset: form.reset,
601
600
  })
602
601
  return returns
603
602
  }
package/src/table.js CHANGED
@@ -54,10 +54,10 @@ export function useTableHelper(columns, { customizable, actions, actionWidth, ac
54
54
  }
55
55
  const bindings = {}
56
56
  for (const k of Object.keys(options)) {
57
- if (k.length > render.length && k.startsWith(render)) {
58
- bindings[uncapitalize(k.slice(render.length))] = options[k]
59
- delete options[k]
60
- }
57
+ if (!(k.length > render.length && k.startsWith(render))) continue
58
+
59
+ bindings[uncapitalize(k.slice(render.length))] = options[k]
60
+ delete options[k]
61
61
  }
62
62
  const bindings0 = computed(() => {
63
63
  return Object.fromEntries(Object.entries(bindings)
@@ -360,9 +360,7 @@ export function useTableHelper(columns, { customizable, actions, actionWidth, ac
360
360
  const raw = StorageSerializers.object.write([sort, hidden, fixed, width])
361
361
  return storage.setItem(key, raw)
362
362
  }
363
- }
364
-
365
- if (!customizable) {
363
+ } else {
366
364
  reinit()
367
365
  }
368
366