xrk-components 0.4.2-beta.4 → 0.4.2-beta.6
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/lib/index.esm.js +63 -50
- package/lib/index.umd.js +63 -50
- package/lib/packages/hooks/use-create-modal.d.ts +1 -0
- package/package.json +1 -1
package/lib/index.esm.js
CHANGED
|
@@ -42023,57 +42023,63 @@ var script = /*#__PURE__*/ defineComponent(__assign(__assign({}, __default__), {
|
|
|
42023
42023
|
onClosed: handleClosed
|
|
42024
42024
|
}, {
|
|
42025
42025
|
header: withCtx(function () { return [
|
|
42026
|
-
(
|
|
42027
|
-
|
|
42028
|
-
|
|
42029
|
-
|
|
42030
|
-
|
|
42031
|
-
|
|
42032
|
-
|
|
42033
|
-
|
|
42026
|
+
renderSlot(_ctx.$slots, "header", {}, function () { return [
|
|
42027
|
+
(__props.titleRender)
|
|
42028
|
+
? (openBlock(), createBlock(unref(BaseDialogRender), {
|
|
42029
|
+
key: 0,
|
|
42030
|
+
render: __props.titleRender
|
|
42031
|
+
}, null, 8 /* PROPS */, ["render"]))
|
|
42032
|
+
: (__props.title)
|
|
42033
|
+
? (openBlock(), createElementBlock("span", _hoisted_1, toDisplayString(__props.title), 1 /* TEXT */))
|
|
42034
|
+
: createCommentVNode("v-if", true)
|
|
42035
|
+
]; })
|
|
42034
42036
|
]; }),
|
|
42035
42037
|
footer: withCtx(function () { return [
|
|
42036
|
-
(
|
|
42037
|
-
|
|
42038
|
-
|
|
42039
|
-
|
|
42040
|
-
|
|
42041
|
-
|
|
42042
|
-
|
|
42043
|
-
(
|
|
42044
|
-
|
|
42045
|
-
|
|
42046
|
-
|
|
42047
|
-
|
|
42048
|
-
|
|
42049
|
-
|
|
42050
|
-
|
|
42051
|
-
|
|
42052
|
-
|
|
42053
|
-
|
|
42054
|
-
|
|
42055
|
-
|
|
42056
|
-
|
|
42057
|
-
|
|
42058
|
-
|
|
42059
|
-
|
|
42060
|
-
|
|
42061
|
-
|
|
42062
|
-
|
|
42063
|
-
|
|
42064
|
-
|
|
42065
|
-
|
|
42066
|
-
|
|
42038
|
+
renderSlot(_ctx.$slots, "footer", {}, function () { return [
|
|
42039
|
+
(__props.footerRender)
|
|
42040
|
+
? (openBlock(), createBlock(unref(BaseDialogRender), {
|
|
42041
|
+
key: 0,
|
|
42042
|
+
render: __props.footerRender
|
|
42043
|
+
}, null, 8 /* PROPS */, ["render"]))
|
|
42044
|
+
: (__props.showFooter)
|
|
42045
|
+
? (openBlock(), createElementBlock("div", _hoisted_3, [
|
|
42046
|
+
(__props.cancelBtnConfig.show)
|
|
42047
|
+
? (openBlock(), createBlock(unref(BaseButton), mergeProps({
|
|
42048
|
+
key: 0,
|
|
42049
|
+
size: "large"
|
|
42050
|
+
}, __props.cancelBtnConfig, { click: handleCancelClick }), {
|
|
42051
|
+
default: withCtx(function () { return [
|
|
42052
|
+
createTextVNode(toDisplayString(__props.cancelBtnConfig.content), 1 /* TEXT */)
|
|
42053
|
+
]; }),
|
|
42054
|
+
_: 1 /* STABLE */
|
|
42055
|
+
}, 16 /* FULL_PROPS */))
|
|
42056
|
+
: createCommentVNode("v-if", true),
|
|
42057
|
+
(__props.confirmBtnConfig.show)
|
|
42058
|
+
? (openBlock(), createBlock(unref(BaseButton), mergeProps({
|
|
42059
|
+
key: 1,
|
|
42060
|
+
size: "large"
|
|
42061
|
+
}, __props.confirmBtnConfig, { click: handleConfirmClick }), {
|
|
42062
|
+
default: withCtx(function () { return [
|
|
42063
|
+
createTextVNode(toDisplayString(__props.confirmBtnConfig.content), 1 /* TEXT */)
|
|
42064
|
+
]; }),
|
|
42065
|
+
_: 1 /* STABLE */
|
|
42066
|
+
}, 16 /* FULL_PROPS */))
|
|
42067
|
+
: createCommentVNode("v-if", true)
|
|
42068
|
+
]))
|
|
42069
|
+
: createCommentVNode("v-if", true)
|
|
42070
|
+
]; })
|
|
42067
42071
|
]; }),
|
|
42068
42072
|
default: withCtx(function () { return [
|
|
42069
|
-
(
|
|
42070
|
-
|
|
42071
|
-
|
|
42072
|
-
|
|
42073
|
-
|
|
42074
|
-
|
|
42075
|
-
|
|
42076
|
-
|
|
42073
|
+
renderSlot(_ctx.$slots, "default", {}, function () { return [
|
|
42074
|
+
(__props.contentRender)
|
|
42075
|
+
? (openBlock(), createBlock(unref(BaseDialogRender), {
|
|
42076
|
+
key: 0,
|
|
42077
|
+
render: __props.contentRender
|
|
42078
|
+
}, null, 8 /* PROPS */, ["render"]))
|
|
42079
|
+
: (__props.content)
|
|
42080
|
+
? (openBlock(), createElementBlock("div", _hoisted_2, toDisplayString(__props.content), 1 /* TEXT */))
|
|
42081
|
+
: createCommentVNode("v-if", true)
|
|
42082
|
+
]; })
|
|
42077
42083
|
]; }),
|
|
42078
42084
|
_: 3 /* FORWARDED */
|
|
42079
42085
|
}, 8 /* PROPS */, ["custom-class", "modelValue", "closeOnClickModal", "closeOnPressEscape", "appendToBody", "destroyOnClose", "center", "width", "showClose"]));
|
|
@@ -42189,12 +42195,18 @@ var useCreateModal = function (component, options, app) {
|
|
|
42189
42195
|
var _instance = null;
|
|
42190
42196
|
var container = document.createElement('div');
|
|
42191
42197
|
var remove = function () {
|
|
42192
|
-
_instance = null;
|
|
42193
42198
|
container.remove();
|
|
42199
|
+
_instance = null;
|
|
42194
42200
|
};
|
|
42195
|
-
_instance = createVNode(component, __assign({ remove: remove, onRemove: function () {
|
|
42201
|
+
_instance = createVNode(component, __assign({ remove: remove, close: remove, onRemove: function () {
|
|
42196
42202
|
remove();
|
|
42197
|
-
}
|
|
42203
|
+
},
|
|
42204
|
+
// 兼容base-dialog
|
|
42205
|
+
onClose: function () {
|
|
42206
|
+
remove();
|
|
42207
|
+
},
|
|
42208
|
+
// 兼容base-dialog,true会导致没有append到container容器中
|
|
42209
|
+
appendToBody: false }, options));
|
|
42198
42210
|
// inject 函数调用组件导致内部inject无法接收到,需要使用app.provide(全局): https://github.com/vuejs/core/issues/6220
|
|
42199
42211
|
// context createApp需要use插件,内部才能使用插件\库相关API。可以直接修改上下文: https://github.com/vuejs/core/issues/2097
|
|
42200
42212
|
if (app) {
|
|
@@ -42205,6 +42217,7 @@ var useCreateModal = function (component, options, app) {
|
|
|
42205
42217
|
// 在组件添加一个 remove 方法用来销毁组件
|
|
42206
42218
|
// 组件内调用 currentInstance.ctx.remove()
|
|
42207
42219
|
_instance.component.ctx.remove = remove;
|
|
42220
|
+
_instance.component.ctx.close = close;
|
|
42208
42221
|
console.log(_instance, '组件_instance');
|
|
42209
42222
|
// 更新props方法
|
|
42210
42223
|
_instance.component.ctx.$updateProps = function (props) {
|
package/lib/index.umd.js
CHANGED
|
@@ -42026,57 +42026,63 @@ usage: app.provide(ID_INJECTION_KEY, {
|
|
|
42026
42026
|
onClosed: handleClosed
|
|
42027
42027
|
}, {
|
|
42028
42028
|
header: vue.withCtx(function () { return [
|
|
42029
|
-
(
|
|
42030
|
-
|
|
42031
|
-
|
|
42032
|
-
|
|
42033
|
-
|
|
42034
|
-
|
|
42035
|
-
|
|
42036
|
-
|
|
42029
|
+
vue.renderSlot(_ctx.$slots, "header", {}, function () { return [
|
|
42030
|
+
(__props.titleRender)
|
|
42031
|
+
? (vue.openBlock(), vue.createBlock(vue.unref(BaseDialogRender), {
|
|
42032
|
+
key: 0,
|
|
42033
|
+
render: __props.titleRender
|
|
42034
|
+
}, null, 8 /* PROPS */, ["render"]))
|
|
42035
|
+
: (__props.title)
|
|
42036
|
+
? (vue.openBlock(), vue.createElementBlock("span", _hoisted_1, vue.toDisplayString(__props.title), 1 /* TEXT */))
|
|
42037
|
+
: vue.createCommentVNode("v-if", true)
|
|
42038
|
+
]; })
|
|
42037
42039
|
]; }),
|
|
42038
42040
|
footer: vue.withCtx(function () { return [
|
|
42039
|
-
(
|
|
42040
|
-
|
|
42041
|
-
|
|
42042
|
-
|
|
42043
|
-
|
|
42044
|
-
|
|
42045
|
-
|
|
42046
|
-
(
|
|
42047
|
-
|
|
42048
|
-
|
|
42049
|
-
|
|
42050
|
-
|
|
42051
|
-
|
|
42052
|
-
vue.
|
|
42053
|
-
|
|
42054
|
-
|
|
42055
|
-
|
|
42056
|
-
|
|
42057
|
-
|
|
42058
|
-
|
|
42059
|
-
|
|
42060
|
-
|
|
42061
|
-
|
|
42062
|
-
|
|
42063
|
-
vue.
|
|
42064
|
-
|
|
42065
|
-
|
|
42066
|
-
|
|
42067
|
-
|
|
42068
|
-
|
|
42069
|
-
|
|
42041
|
+
vue.renderSlot(_ctx.$slots, "footer", {}, function () { return [
|
|
42042
|
+
(__props.footerRender)
|
|
42043
|
+
? (vue.openBlock(), vue.createBlock(vue.unref(BaseDialogRender), {
|
|
42044
|
+
key: 0,
|
|
42045
|
+
render: __props.footerRender
|
|
42046
|
+
}, null, 8 /* PROPS */, ["render"]))
|
|
42047
|
+
: (__props.showFooter)
|
|
42048
|
+
? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3, [
|
|
42049
|
+
(__props.cancelBtnConfig.show)
|
|
42050
|
+
? (vue.openBlock(), vue.createBlock(vue.unref(BaseButton), vue.mergeProps({
|
|
42051
|
+
key: 0,
|
|
42052
|
+
size: "large"
|
|
42053
|
+
}, __props.cancelBtnConfig, { click: handleCancelClick }), {
|
|
42054
|
+
default: vue.withCtx(function () { return [
|
|
42055
|
+
vue.createTextVNode(vue.toDisplayString(__props.cancelBtnConfig.content), 1 /* TEXT */)
|
|
42056
|
+
]; }),
|
|
42057
|
+
_: 1 /* STABLE */
|
|
42058
|
+
}, 16 /* FULL_PROPS */))
|
|
42059
|
+
: vue.createCommentVNode("v-if", true),
|
|
42060
|
+
(__props.confirmBtnConfig.show)
|
|
42061
|
+
? (vue.openBlock(), vue.createBlock(vue.unref(BaseButton), vue.mergeProps({
|
|
42062
|
+
key: 1,
|
|
42063
|
+
size: "large"
|
|
42064
|
+
}, __props.confirmBtnConfig, { click: handleConfirmClick }), {
|
|
42065
|
+
default: vue.withCtx(function () { return [
|
|
42066
|
+
vue.createTextVNode(vue.toDisplayString(__props.confirmBtnConfig.content), 1 /* TEXT */)
|
|
42067
|
+
]; }),
|
|
42068
|
+
_: 1 /* STABLE */
|
|
42069
|
+
}, 16 /* FULL_PROPS */))
|
|
42070
|
+
: vue.createCommentVNode("v-if", true)
|
|
42071
|
+
]))
|
|
42072
|
+
: vue.createCommentVNode("v-if", true)
|
|
42073
|
+
]; })
|
|
42070
42074
|
]; }),
|
|
42071
42075
|
default: vue.withCtx(function () { return [
|
|
42072
|
-
(
|
|
42073
|
-
|
|
42074
|
-
|
|
42075
|
-
|
|
42076
|
-
|
|
42077
|
-
|
|
42078
|
-
|
|
42079
|
-
|
|
42076
|
+
vue.renderSlot(_ctx.$slots, "default", {}, function () { return [
|
|
42077
|
+
(__props.contentRender)
|
|
42078
|
+
? (vue.openBlock(), vue.createBlock(vue.unref(BaseDialogRender), {
|
|
42079
|
+
key: 0,
|
|
42080
|
+
render: __props.contentRender
|
|
42081
|
+
}, null, 8 /* PROPS */, ["render"]))
|
|
42082
|
+
: (__props.content)
|
|
42083
|
+
? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2, vue.toDisplayString(__props.content), 1 /* TEXT */))
|
|
42084
|
+
: vue.createCommentVNode("v-if", true)
|
|
42085
|
+
]; })
|
|
42080
42086
|
]; }),
|
|
42081
42087
|
_: 3 /* FORWARDED */
|
|
42082
42088
|
}, 8 /* PROPS */, ["custom-class", "modelValue", "closeOnClickModal", "closeOnPressEscape", "appendToBody", "destroyOnClose", "center", "width", "showClose"]));
|
|
@@ -42192,12 +42198,18 @@ usage: app.provide(ID_INJECTION_KEY, {
|
|
|
42192
42198
|
var _instance = null;
|
|
42193
42199
|
var container = document.createElement('div');
|
|
42194
42200
|
var remove = function () {
|
|
42195
|
-
_instance = null;
|
|
42196
42201
|
container.remove();
|
|
42202
|
+
_instance = null;
|
|
42197
42203
|
};
|
|
42198
|
-
_instance = vue.createVNode(component, __assign({ remove: remove, onRemove: function () {
|
|
42204
|
+
_instance = vue.createVNode(component, __assign({ remove: remove, close: remove, onRemove: function () {
|
|
42199
42205
|
remove();
|
|
42200
|
-
}
|
|
42206
|
+
},
|
|
42207
|
+
// 兼容base-dialog
|
|
42208
|
+
onClose: function () {
|
|
42209
|
+
remove();
|
|
42210
|
+
},
|
|
42211
|
+
// 兼容base-dialog,true会导致没有append到container容器中
|
|
42212
|
+
appendToBody: false }, options));
|
|
42201
42213
|
// inject 函数调用组件导致内部inject无法接收到,需要使用app.provide(全局): https://github.com/vuejs/core/issues/6220
|
|
42202
42214
|
// context createApp需要use插件,内部才能使用插件\库相关API。可以直接修改上下文: https://github.com/vuejs/core/issues/2097
|
|
42203
42215
|
if (app) {
|
|
@@ -42208,6 +42220,7 @@ usage: app.provide(ID_INJECTION_KEY, {
|
|
|
42208
42220
|
// 在组件添加一个 remove 方法用来销毁组件
|
|
42209
42221
|
// 组件内调用 currentInstance.ctx.remove()
|
|
42210
42222
|
_instance.component.ctx.remove = remove;
|
|
42223
|
+
_instance.component.ctx.close = close;
|
|
42211
42224
|
console.log(_instance, '组件_instance');
|
|
42212
42225
|
// 更新props方法
|
|
42213
42226
|
_instance.component.ctx.$updateProps = function (props) {
|
|
@@ -2,6 +2,7 @@ import { App, Component } from 'vue';
|
|
|
2
2
|
declare type anyObj = Record<string, any>;
|
|
3
3
|
interface ModalInstance {
|
|
4
4
|
remove(): void;
|
|
5
|
+
close(): void;
|
|
5
6
|
$updateProps(props: anyObj): void;
|
|
6
7
|
}
|
|
7
8
|
export declare const useCreateModal: (component: Component, options?: anyObj, app?: App) => ModalInstance;
|