@ithinkdt/page 4.2.0-0 → 4.2.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/README.md +1 -0
- package/package.json +6 -6
- package/src/description.js +1 -1
- package/src/form.d.ts +1 -0
- package/src/form.js +3 -2
- package/src/modal.d.ts +9 -3
- package/src/modal.js +6 -6
- package/src/rules.js +1 -1
- package/src/table.js +5 -1
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ithinkdt/page",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.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": "^
|
|
44
|
-
"@ithinkdt/common": "~4.2.
|
|
43
|
+
"nanoid": "^6.0.0",
|
|
44
|
+
"@ithinkdt/common": "~4.2.1"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"vue": ">=3.5",
|
|
@@ -49,9 +49,9 @@
|
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"typescript": "~6.0.3",
|
|
52
|
-
"vite": "^8.1.
|
|
53
|
-
"vue": "^3.5.
|
|
54
|
-
"vue-router": "^5.
|
|
52
|
+
"vite": "^8.1.5",
|
|
53
|
+
"vue": "^3.5.40",
|
|
54
|
+
"vue-router": "^5.2.0"
|
|
55
55
|
},
|
|
56
56
|
"scripts": {
|
|
57
57
|
"release": "pnpm publish --no-git-checks"
|
package/src/description.js
CHANGED
|
@@ -78,7 +78,7 @@ export function useDescriptionsHelper(
|
|
|
78
78
|
|
|
79
79
|
ignoreDefaultEmptyRender_ ??= options?.ignoreDefaultEmptyRender
|
|
80
80
|
const render0 = (model) => {
|
|
81
|
-
if (!unref(ignoreDefaultEmptyRender_) &&
|
|
81
|
+
if (renderEmptyValue && !unref(ignoreDefaultEmptyRender_) && prop[0] !== '$' && isNone(model[prop])) {
|
|
82
82
|
return renderEmptyValue(type_, 'description')
|
|
83
83
|
}
|
|
84
84
|
return render_(model)
|
package/src/form.d.ts
CHANGED
|
@@ -218,6 +218,7 @@ export interface FormRenderExtraOptions {
|
|
|
218
218
|
|
|
219
219
|
export interface FormRenderParam extends FormRenderExtraOptions, Omit<FormHelper<Record<string, unknown>>, 'invalid'> {
|
|
220
220
|
inModal: boolean
|
|
221
|
+
modalType: 'dialog' | 'drawer'
|
|
221
222
|
readonly: boolean
|
|
222
223
|
invalid: boolean
|
|
223
224
|
handleSubmit(this: void, model: Record<string, unknown>): Promise<boolean | void>
|
package/src/form.js
CHANGED
|
@@ -84,7 +84,7 @@ export function useFormHelper(items, { initial: initial0, rules, onChange, inFil
|
|
|
84
84
|
|
|
85
85
|
ignoreDefaultEmptyRender_ ??= options?.ignoreDefaultEmptyRender
|
|
86
86
|
const render0 = (params, model) => {
|
|
87
|
-
if (!unref(ignoreDefaultEmptyRender_) &&
|
|
87
|
+
if (renderEmptyValue && !unref(ignoreDefaultEmptyRender_) && name[0] !== '$' && params?.readonly && isNone(model[name])) {
|
|
88
88
|
return renderEmptyValue(type_, 'form')
|
|
89
89
|
}
|
|
90
90
|
return render_(params, model)
|
|
@@ -125,7 +125,7 @@ export function useFormHelper(items, { initial: initial0, rules, onChange, inFil
|
|
|
125
125
|
),
|
|
126
126
|
)
|
|
127
127
|
let result2
|
|
128
|
-
if (!
|
|
128
|
+
if (!prop0 && !invalid.value) {
|
|
129
129
|
const ret = await beforeSubmit(prop)
|
|
130
130
|
result2 = ret[1]
|
|
131
131
|
}
|
|
@@ -542,6 +542,7 @@ export function useFormModal({ initial, items, rules, onSubmit, submitText, canc
|
|
|
542
542
|
...options,
|
|
543
543
|
readonly,
|
|
544
544
|
inModal: true,
|
|
545
|
+
modalType: unref(options.type) ?? 'dialog',
|
|
545
546
|
validation: validation.value,
|
|
546
547
|
restoreValidation: (props) => {
|
|
547
548
|
form.restoreValidation(props)
|
package/src/modal.d.ts
CHANGED
|
@@ -77,8 +77,14 @@ export declare function useModal(options: ModalDrawerOptions | ModalDialogOption
|
|
|
77
77
|
ModalReturns
|
|
78
78
|
& [open: ModalReturns['open'], close: ModalReturns['close'], visible: ComputedRef<boolean>]
|
|
79
79
|
|
|
80
|
-
export declare function useModalRef():
|
|
81
|
-
|
|
82
|
-
|
|
80
|
+
export declare function useModalRef(): {
|
|
81
|
+
inModal: true
|
|
82
|
+
modalType: ComputedRef<'dialog' | 'drawer'>
|
|
83
|
+
visible: ComputedRef<boolean>
|
|
84
|
+
close: ModalReturns['close']
|
|
85
|
+
setTitle: (title: ModalOptionsBase['title']) => void
|
|
86
|
+
} | {
|
|
87
|
+
inModal: false
|
|
88
|
+
}
|
|
83
89
|
|
|
84
90
|
export declare const ModalProvider: DefineComponent<{}>
|
package/src/modal.js
CHANGED
|
@@ -100,6 +100,7 @@ export function useModal({ content, confirmText, confirmLoading, cancelText, can
|
|
|
100
100
|
props: {},
|
|
101
101
|
setup() {
|
|
102
102
|
provide(ModalInjectionKey, {
|
|
103
|
+
modalType: computed(() => unref(renderParam.type) ?? 'dialog'),
|
|
103
104
|
visible,
|
|
104
105
|
close,
|
|
105
106
|
title2,
|
|
@@ -130,10 +131,9 @@ export function useModal({ content, confirmText, confirmLoading, cancelText, can
|
|
|
130
131
|
|
|
131
132
|
export function useModalRef() {
|
|
132
133
|
const modal = inject(ModalInjectionKey, null)
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
return returns
|
|
134
|
+
return {
|
|
135
|
+
...modal,
|
|
136
|
+
inModal: !!modal,
|
|
137
|
+
setTitle: (title2) => { modal && (modal.title2.value = title2) },
|
|
138
|
+
}
|
|
139
139
|
}
|
package/src/rules.js
CHANGED
|
@@ -70,7 +70,7 @@ export function required(message, { required = true, trigger = ['input', 'blur',
|
|
|
70
70
|
[requiredRuleSymbol]: true,
|
|
71
71
|
trigger,
|
|
72
72
|
validator: (value) => {
|
|
73
|
-
if (
|
|
73
|
+
if (typeof value === 'number' || typeof value === 'bigint' || typeof value === 'boolean' || !unref(required)) return
|
|
74
74
|
if (value === undefined || value === null) {
|
|
75
75
|
return message(value, { required: true })
|
|
76
76
|
}
|
package/src/table.js
CHANGED
|
@@ -76,7 +76,7 @@ export function useTableHelper(columns, { customizable, actions, actionWidth, ac
|
|
|
76
76
|
|
|
77
77
|
ignoreDefaultEmptyRender_ ??= options?.ignoreDefaultEmptyRender
|
|
78
78
|
const render0 = (record, i) => {
|
|
79
|
-
if (!unref(ignoreDefaultEmptyRender_) &&
|
|
79
|
+
if (renderEmptyValue && !unref(ignoreDefaultEmptyRender_) && prop[0] !== '$' && isNone(record[prop])) {
|
|
80
80
|
return renderEmptyValue(type_, 'description')
|
|
81
81
|
}
|
|
82
82
|
return render_(record, i)
|
|
@@ -281,6 +281,9 @@ export function useTableHelper(columns, { customizable, actions, actionWidth, ac
|
|
|
281
281
|
prop: '$expand',
|
|
282
282
|
type: 'expand',
|
|
283
283
|
expandable: typeof expandable === 'function' ? expandable : undefined,
|
|
284
|
+
width: 40,
|
|
285
|
+
maxWidth: 40,
|
|
286
|
+
resizable: false,
|
|
284
287
|
renderExpand,
|
|
285
288
|
hidden: computed(() => unref(expandable) === false),
|
|
286
289
|
fixed: 'left',
|
|
@@ -302,6 +305,7 @@ export function useTableHelper(columns, { customizable, actions, actionWidth, ac
|
|
|
302
305
|
width: 50,
|
|
303
306
|
maxWidth: 50,
|
|
304
307
|
visible: false,
|
|
308
|
+
resizable: false,
|
|
305
309
|
},
|
|
306
310
|
)
|
|
307
311
|
}
|