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 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
- (__props.titleRender)
42027
- ? (openBlock(), createBlock(unref(BaseDialogRender), {
42028
- key: 0,
42029
- render: __props.titleRender
42030
- }, null, 8 /* PROPS */, ["render"]))
42031
- : (__props.title)
42032
- ? (openBlock(), createElementBlock("span", _hoisted_1, toDisplayString(__props.title), 1 /* TEXT */))
42033
- : renderSlot(_ctx.$slots, "header", { key: 2 })
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
- (__props.footerRender)
42037
- ? (openBlock(), createBlock(unref(BaseDialogRender), {
42038
- key: 0,
42039
- render: __props.footerRender
42040
- }, null, 8 /* PROPS */, ["render"]))
42041
- : (__props.showFooter)
42042
- ? (openBlock(), createElementBlock("div", _hoisted_3, [
42043
- (__props.cancelBtnConfig.show)
42044
- ? (openBlock(), createBlock(unref(BaseButton), mergeProps({
42045
- key: 0,
42046
- size: "large"
42047
- }, __props.cancelBtnConfig, { click: handleCancelClick }), {
42048
- default: withCtx(function () { return [
42049
- createTextVNode(toDisplayString(__props.cancelBtnConfig.content), 1 /* TEXT */)
42050
- ]; }),
42051
- _: 1 /* STABLE */
42052
- }, 16 /* FULL_PROPS */))
42053
- : createCommentVNode("v-if", true),
42054
- (__props.confirmBtnConfig.show)
42055
- ? (openBlock(), createBlock(unref(BaseButton), mergeProps({
42056
- key: 1,
42057
- size: "large"
42058
- }, __props.confirmBtnConfig, { click: handleConfirmClick }), {
42059
- default: withCtx(function () { return [
42060
- createTextVNode(toDisplayString(__props.confirmBtnConfig.content), 1 /* TEXT */)
42061
- ]; }),
42062
- _: 1 /* STABLE */
42063
- }, 16 /* FULL_PROPS */))
42064
- : createCommentVNode("v-if", true)
42065
- ]))
42066
- : createCommentVNode("v-if", true)
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
- (__props.contentRender)
42070
- ? (openBlock(), createBlock(unref(BaseDialogRender), {
42071
- key: 0,
42072
- render: __props.contentRender
42073
- }, null, 8 /* PROPS */, ["render"]))
42074
- : (__props.content)
42075
- ? (openBlock(), createElementBlock("div", _hoisted_2, toDisplayString(__props.content), 1 /* TEXT */))
42076
- : renderSlot(_ctx.$slots, "default", { key: 2 })
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
- } }, options));
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
- (__props.titleRender)
42030
- ? (vue.openBlock(), vue.createBlock(vue.unref(BaseDialogRender), {
42031
- key: 0,
42032
- render: __props.titleRender
42033
- }, null, 8 /* PROPS */, ["render"]))
42034
- : (__props.title)
42035
- ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_1, vue.toDisplayString(__props.title), 1 /* TEXT */))
42036
- : vue.renderSlot(_ctx.$slots, "header", { key: 2 })
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
- (__props.footerRender)
42040
- ? (vue.openBlock(), vue.createBlock(vue.unref(BaseDialogRender), {
42041
- key: 0,
42042
- render: __props.footerRender
42043
- }, null, 8 /* PROPS */, ["render"]))
42044
- : (__props.showFooter)
42045
- ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3, [
42046
- (__props.cancelBtnConfig.show)
42047
- ? (vue.openBlock(), vue.createBlock(vue.unref(BaseButton), vue.mergeProps({
42048
- key: 0,
42049
- size: "large"
42050
- }, __props.cancelBtnConfig, { click: handleCancelClick }), {
42051
- default: vue.withCtx(function () { return [
42052
- vue.createTextVNode(vue.toDisplayString(__props.cancelBtnConfig.content), 1 /* TEXT */)
42053
- ]; }),
42054
- _: 1 /* STABLE */
42055
- }, 16 /* FULL_PROPS */))
42056
- : vue.createCommentVNode("v-if", true),
42057
- (__props.confirmBtnConfig.show)
42058
- ? (vue.openBlock(), vue.createBlock(vue.unref(BaseButton), vue.mergeProps({
42059
- key: 1,
42060
- size: "large"
42061
- }, __props.confirmBtnConfig, { click: handleConfirmClick }), {
42062
- default: vue.withCtx(function () { return [
42063
- vue.createTextVNode(vue.toDisplayString(__props.confirmBtnConfig.content), 1 /* TEXT */)
42064
- ]; }),
42065
- _: 1 /* STABLE */
42066
- }, 16 /* FULL_PROPS */))
42067
- : vue.createCommentVNode("v-if", true)
42068
- ]))
42069
- : vue.createCommentVNode("v-if", true)
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
- (__props.contentRender)
42073
- ? (vue.openBlock(), vue.createBlock(vue.unref(BaseDialogRender), {
42074
- key: 0,
42075
- render: __props.contentRender
42076
- }, null, 8 /* PROPS */, ["render"]))
42077
- : (__props.content)
42078
- ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2, vue.toDisplayString(__props.content), 1 /* TEXT */))
42079
- : vue.renderSlot(_ctx.$slots, "default", { key: 2 })
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
- } }, options));
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xrk-components",
3
- "version": "0.4.2-beta.4",
3
+ "version": "0.4.2-beta.6",
4
4
  "description": "",
5
5
  "main": "lib/index.esm.js",
6
6
  "typings": "lib/packages/index.d.ts",