el-plus 0.0.23 → 0.0.25

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.
@@ -1,4 +1,4 @@
1
- /*! ElPlus v0.0.23 */
1
+ /*! ElPlus v0.0.25 */
2
2
 
3
3
  import { useAttrs, getCurrentInstance, inject, provide, ref, nextTick, defineComponent, computed, createVNode, Fragment, withDirectives, resolveComponent, mergeProps, resolveDirective, useTemplateRef, createTextVNode, h, mergeModels, useModel, createElementBlock, openBlock, normalizeStyle, normalizeClass, unref, createCommentVNode, withCtx, renderSlot, renderList, createBlock, vShow, toDisplayString, reactive, useSlots, watch, onMounted, createSlots, normalizeProps, guardReactiveProps, markRaw, Transition, shallowReactive, isVNode, render, createElementVNode, toRaw } from 'vue';
4
4
  import { buttonProps, useLocale as useLocale$1, ElLoading, ElMessage, ElMessageBox, formProps as formProps$1, formEmits as formEmits$1, ElTooltip, formItemProps as formItemProps$1, ElFormItem, ElForm, ElRow, ElCol, inputProps as inputProps$1, inputEmits as inputEmits$1, configProviderContextKey, ElConfigProvider, ElDialog, ElButton, ElTable, ElIcon, selectProps as selectProps$1, selectEmits as selectEmits$1, ElPageHeader, datePickerProps, linkProps as linkProps$1 } from 'element-plus';
@@ -1350,22 +1350,25 @@ const useTemplatePromise = (options = {}) => {
1350
1350
  if (index2 !== -1) instances.value.splice(index2, 1);
1351
1351
  } else {
1352
1352
  props.isVisible = false;
1353
- const wrapper = document.querySelector(".ep-template-promise");
1354
- if (wrapper.style["zIndex"]) {
1355
- return;
1356
- }
1353
+ }
1354
+ });
1355
+ return props.promise;
1356
+ };
1357
+ const open = (...args) => {
1358
+ instances.value = [];
1359
+ const com = create(...args);
1360
+ nextTick(() => {
1361
+ const wrapper = document.querySelector(".ep-template-promise.is-init");
1362
+ if (wrapper) {
1357
1363
  const dialog = wrapper?.querySelector(".el-modal-dialog");
1358
1364
  const zIndex = dialog ? dialog.style["z-index"] : "";
1359
1365
  if (zIndex && wrapper) {
1360
1366
  wrapper.style.zIndex = zIndex;
1361
1367
  }
1368
+ wrapper.classList.remove("is-init");
1362
1369
  }
1363
1370
  });
1364
- return props.promise;
1365
- };
1366
- const open = (...args) => {
1367
- instances.value = [];
1368
- return create(...args);
1371
+ return com;
1369
1372
  };
1370
1373
  const component = /* @__PURE__ */ defineComponent((_, ctx) => {
1371
1374
  const {
@@ -1374,7 +1377,7 @@ const useTemplatePromise = (options = {}) => {
1374
1377
  const renderList = () => instances.value.map((props) => {
1375
1378
  return withDirectives(h("div", {
1376
1379
  // key: props.key,
1377
- class: "ep-template-promise"
1380
+ class: "ep-template-promise is-init"
1378
1381
  }, render ? render(props, ctx) : slots.default?.(props)), [[vShow, props.isVisible]]);
1379
1382
  });
1380
1383
  if (transition) return () => {
@@ -3536,7 +3539,7 @@ var components = [
3536
3539
  EpLink
3537
3540
  ];
3538
3541
 
3539
- var version = "0.0.23";
3542
+ var version = "0.0.25";
3540
3543
 
3541
3544
  var globalProperties = {
3542
3545
  install(app) {
@@ -3560,14 +3563,14 @@ const useChooseDialog = (options = {}) => {
3560
3563
  multiple,
3561
3564
  ...rest
3562
3565
  } = options;
3563
- let selections = [];
3566
+ let selections = ref([]);
3564
3567
  const showSingleSelectionCol = !multiple;
3565
3568
  const scopedSlots = {};
3566
3569
  if (!showSingleSelectionCol) {
3567
3570
  scopedSlots.footerPrepend = () => {
3568
3571
  return createVNode("span", {
3569
3572
  "class": bem.e("selected-count")
3570
- }, [t("ep.chooseDialog.selected"), selections.length, t("ep.chooseDialog.unit")]);
3573
+ }, [t("ep.chooseDialog.selected"), selections.value.length, t("ep.chooseDialog.unit")]);
3571
3574
  };
3572
3575
  }
3573
3576
  return useDialog({
@@ -3577,7 +3580,7 @@ const useChooseDialog = (options = {}) => {
3577
3580
  scopedSlots,
3578
3581
  title,
3579
3582
  onConfirm: (resolve) => {
3580
- resolve(toRaw(selections));
3583
+ resolve(JSON.parse(JSON.stringify(selections)));
3581
3584
  },
3582
3585
  render: ({
3583
3586
  resolve
@@ -3595,10 +3598,10 @@ const useChooseDialog = (options = {}) => {
3595
3598
  tableProps: {
3596
3599
  height: 300,
3597
3600
  onSelectionChange: (newSel) => {
3598
- selections = newSel;
3601
+ selections.value = newSel;
3599
3602
  },
3600
3603
  onSingleSelectionChange: (newSel) => {
3601
- selections = newSel;
3604
+ selections.value = newSel;
3602
3605
  resolve(toRaw(selections));
3603
3606
  }
3604
3607
  }
@@ -1,4 +1,4 @@
1
- import { reactive, createVNode, toRaw } from 'vue';
1
+ import { ref, reactive, createVNode, toRaw } from 'vue';
2
2
  import { useDialog } from './use-dialog.mjs';
3
3
  import { createNameSpace } from '../../utils/bem.mjs';
4
4
  import { EpSearchListPage } from '../../components/search-list-page/index.mjs';
@@ -15,14 +15,14 @@ const useChooseDialog = (options = {}) => {
15
15
  multiple,
16
16
  ...rest
17
17
  } = options;
18
- let selections = [];
18
+ let selections = ref([]);
19
19
  const showSingleSelectionCol = !multiple;
20
20
  const scopedSlots = {};
21
21
  if (!showSingleSelectionCol) {
22
22
  scopedSlots.footerPrepend = () => {
23
23
  return createVNode("span", {
24
24
  "class": bem.e("selected-count")
25
- }, [t("ep.chooseDialog.selected"), selections.length, t("ep.chooseDialog.unit")]);
25
+ }, [t("ep.chooseDialog.selected"), selections.value.length, t("ep.chooseDialog.unit")]);
26
26
  };
27
27
  }
28
28
  return useDialog({
@@ -32,7 +32,7 @@ const useChooseDialog = (options = {}) => {
32
32
  scopedSlots,
33
33
  title,
34
34
  onConfirm: (resolve) => {
35
- resolve(toRaw(selections));
35
+ resolve(JSON.parse(JSON.stringify(selections)));
36
36
  },
37
37
  render: ({
38
38
  resolve
@@ -50,10 +50,10 @@ const useChooseDialog = (options = {}) => {
50
50
  tableProps: {
51
51
  height: 300,
52
52
  onSelectionChange: (newSel) => {
53
- selections = newSel;
53
+ selections.value = newSel;
54
54
  },
55
55
  onSingleSelectionChange: (newSel) => {
56
- selections = newSel;
56
+ selections.value = newSel;
57
57
  resolve(toRaw(selections));
58
58
  }
59
59
  }
@@ -1 +1 @@
1
- {"version":3,"file":"use-choose-dialog.mjs","sources":["../../../../../packages/hooks/dialog/use-choose-dialog.tsx"],"sourcesContent":["import { useDialog } from './use-dialog'\nimport { createNameSpace } from '@el-plus/utils/bem'\nimport { EpSearchListPage } from '@el-plus/components/search-list-page'\nimport type { DialogOptions } from './use-dialog'\nimport type { SearchListPageProps } from '@el-plus/components/search-list-page'\nimport { reactive, ref, toRaw } from 'vue'\nconst bem = createNameSpace('choose-dialog')\nimport { useLocale } from '@el-plus/hooks/use-locale'\n\ntype Options = {\n title?: string\n dialogProps?: DialogOptions\n multiple?: boolean\n} & SearchListPageProps\nexport const useChooseDialog = (options: Options = {}) => {\n const { t } = useLocale()\n const { dialogProps, title, multiple, ...rest } = options\n let selections = []\n const showSingleSelectionCol = !multiple\n const scopedSlots: DialogOptions['scopedSlots'] = {}\n if (!showSingleSelectionCol) {\n scopedSlots.footerPrepend = () => {\n return (\n <span class={bem.e('selected-count')}>\n {t('ep.chooseDialog.selected')}\n {selections.length}\n {t('ep.chooseDialog.unit')}\n </span>\n )\n }\n }\n return useDialog({\n class: bem.b(),\n width: '80%',\n showFooter: !showSingleSelectionCol,\n scopedSlots,\n title,\n onConfirm: (resolve) => {\n resolve(toRaw(selections))\n },\n render: ({ resolve }) => {\n const formData = rest.formData || reactive({})\n return (\n <EpSearchListPage\n {...{\n showSelectionCol: multiple,\n showSingleSelectionCol,\n formData,\n ...rest,\n formProps: {\n col: 3,\n ...rest.formProps,\n },\n tableProps: {\n height: 300,\n onSelectionChange: (newSel) => {\n selections = newSel\n },\n onSingleSelectionChange: (newSel) => {\n selections = newSel\n resolve(toRaw(selections))\n },\n },\n }}\n />\n )\n },\n ...dialogProps,\n })\n}\n"],"names":["bem","createNameSpace","useChooseDialog","options","t","useLocale","dialogProps","title","multiple","rest","selections","showSingleSelectionCol","scopedSlots","footerPrepend","_createVNode","e","length","useDialog","class","b","width","showFooter","onConfirm","resolve","toRaw","render","formData","reactive","EpSearchListPage","showSelectionCol","formProps","col","tableProps","height","onSelectionChange","newSel","onSingleSelectionChange"],"mappings":";;;;;;AAMA,MAAMA,GAAAA,GAAMC,gBAAgB,eAAe,CAAA;AAQpC,MAAMC,eAAAA,GAAkBA,CAACC,OAAAA,GAAmB,EAAC,KAAM;AACxD,EAAA,MAAM;AAAA,IAAEC;AAAAA,MAAMC,SAAAA,EAAU;AACxB,EAAA,MAAM;AAAA,IAAEC,WAAAA;AAAAA,IAAaC,KAAAA;AAAAA,IAAOC,QAAAA;AAAAA,IAAU,GAAGC;AAAAA,GAAK,GAAIN,OAAAA;AAClD,EAAA,IAAIO,aAAa,EAAA;AACjB,EAAA,MAAMC,yBAAyB,CAACH,QAAAA;AAChC,EAAA,MAAMI,cAA4C,EAAC;AACnD,EAAA,IAAI,CAACD,sBAAAA,EAAwB;AAC3BC,IAAAA,WAAAA,CAAYC,gBAAgB,MAAM;AAChC,MAAA,OAAAC,YAAA,MAAA,EAAA;AAAA,QAAA,OAAA,EACed,GAAAA,CAAIe,CAAAA,CAAE,gBAAgB;AAAA,OAAC,EAAA,CACjCX,CAAAA,CAAE,0BAA0B,CAAA,EAC5BM,WAAWM,MAAAA,EACXZ,CAAAA,CAAE,sBAAsB,CAAC,CAAA,CAAA;AAAA,IAGhC,CAAA;AAAA,EACF;AACA,EAAA,OAAOa,SAAAA,CAAU;AAAA,IACfC,KAAAA,EAAOlB,IAAImB,CAAAA,EAAE;AAAA,IACbC,KAAAA,EAAO,KAAA;AAAA,IACPC,YAAY,CAACV,sBAAAA;AAAAA,IACbC,WAAAA;AAAAA,IACAL,KAAAA;AAAAA,IACAe,WAAYC,CAAAA,OAAAA,KAAY;AACtBA,MAAAA,OAAAA,CAAQC,KAAAA,CAAMd,UAAU,CAAC,CAAA;AAAA,IAC3B,CAAA;AAAA,IACAe,QAAQA,CAAC;AAAA,MAAEF;AAAAA,KAAQ,KAAM;AACvB,MAAA,MAAMG,QAAAA,GAAWjB,IAAAA,CAAKiB,QAAAA,IAAYC,QAAAA,CAAS,EAAE,CAAA;AAC7C,MAAA,OAAAb,YAAAc,gBAAAA,EAAA;AAAA,QAGMC,gBAAAA,EAAkBrB,QAAAA;AAAAA,QAClBG,sBAAAA;AAAAA,QACAe,QAAAA;AAAAA,QACA,GAAGjB,IAAAA;AAAAA,QACHqB,SAAAA,EAAW;AAAA,UACTC,GAAAA,EAAK,CAAA;AAAA,UACL,GAAGtB,IAAAA,CAAKqB;AAAAA,SACV;AAAA,QACAE,UAAAA,EAAY;AAAA,UACVC,MAAAA,EAAQ,GAAA;AAAA,UACRC,mBAAoBC,CAAAA,MAAAA,KAAW;AAC7BzB,YAAAA,UAAAA,GAAayB,MAAAA;AAAAA,UACf,CAAA;AAAA,UACAC,yBAA0BD,CAAAA,MAAAA,KAAW;AACnCzB,YAAAA,UAAAA,GAAayB,MAAAA;AACbZ,YAAAA,OAAAA,CAAQC,KAAAA,CAAMd,UAAU,CAAC,CAAA;AAAA,UAC3B;AAAA;AACF,SAAC,IAAA,CAAA;AAAA,IAIT,CAAA;AAAA,IACA,GAAGJ;AAAAA,GACJ,CAAA;AACH;;;;"}
1
+ {"version":3,"file":"use-choose-dialog.mjs","sources":["../../../../../packages/hooks/dialog/use-choose-dialog.tsx"],"sourcesContent":["import { useDialog } from './use-dialog'\nimport { createNameSpace } from '@el-plus/utils/bem'\nimport { EpSearchListPage } from '@el-plus/components/search-list-page'\nimport type { DialogOptions } from './use-dialog'\nimport type { SearchListPageProps } from '@el-plus/components/search-list-page'\nimport { reactive, ref, toRaw } from 'vue'\nconst bem = createNameSpace('choose-dialog')\nimport { useLocale } from '@el-plus/hooks/use-locale'\n\ntype Options = {\n title?: string\n dialogProps?: DialogOptions\n multiple?: boolean\n} & SearchListPageProps\nexport const useChooseDialog = (options: Options = {}) => {\n const { t } = useLocale()\n const { dialogProps, title, multiple, ...rest } = options\n let selections = ref([])\n const showSingleSelectionCol = !multiple\n const scopedSlots: DialogOptions['scopedSlots'] = {}\n if (!showSingleSelectionCol) {\n scopedSlots.footerPrepend = () => {\n return (\n <span class={bem.e('selected-count')}>\n {t('ep.chooseDialog.selected')}\n {selections.value.length}\n {t('ep.chooseDialog.unit')}\n </span>\n )\n }\n }\n return useDialog({\n class: bem.b(),\n width: '80%',\n showFooter: !showSingleSelectionCol,\n scopedSlots,\n title,\n onConfirm: (resolve) => {\n resolve(JSON.parse(JSON.stringify(selections)))\n },\n render: ({ resolve }) => {\n const formData = rest.formData || reactive({})\n return (\n <EpSearchListPage\n {...{\n showSelectionCol: multiple,\n showSingleSelectionCol,\n formData,\n ...rest,\n formProps: {\n col: 3,\n ...rest.formProps,\n },\n tableProps: {\n height: 300,\n onSelectionChange: (newSel) => {\n selections.value = newSel\n },\n onSingleSelectionChange: (newSel) => {\n selections.value = newSel\n resolve(toRaw(selections))\n },\n },\n }}\n />\n )\n },\n ...dialogProps,\n })\n}\n"],"names":["bem","createNameSpace","useChooseDialog","options","t","useLocale","dialogProps","title","multiple","rest","selections","ref","showSingleSelectionCol","scopedSlots","footerPrepend","_createVNode","e","value","length","useDialog","class","b","width","showFooter","onConfirm","resolve","JSON","parse","stringify","render","formData","reactive","EpSearchListPage","showSelectionCol","formProps","col","tableProps","height","onSelectionChange","newSel","onSingleSelectionChange","toRaw"],"mappings":";;;;;;AAMA,MAAMA,GAAAA,GAAMC,gBAAgB,eAAe,CAAA;AAQpC,MAAMC,eAAAA,GAAkBA,CAACC,OAAAA,GAAmB,EAAC,KAAM;AACxD,EAAA,MAAM;AAAA,IAAEC;AAAAA,MAAMC,SAAAA,EAAU;AACxB,EAAA,MAAM;AAAA,IAAEC,WAAAA;AAAAA,IAAaC,KAAAA;AAAAA,IAAOC,QAAAA;AAAAA,IAAU,GAAGC;AAAAA,GAAK,GAAIN,OAAAA;AAClD,EAAA,IAAIO,UAAAA,GAAaC,GAAAA,CAAI,EAAE,CAAA;AACvB,EAAA,MAAMC,yBAAyB,CAACJ,QAAAA;AAChC,EAAA,MAA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AAW;AAC7B7B,YAAAA,UAAAA,CAAWO,KAAAA,GAAQsB,MAAAA;AAAAA,UACrB,CAAA;AAAA,UACAC,yBAA0BD,CAAAA,MAAAA,KAAW;AACnC7B,YAAAA,UAAAA,CAAWO,KAAAA,GAAQsB,MAAAA;AACnBd,YAAAA,OAAAA,CAAQgB,KAAAA,CAAM/B,UAAU,CAAC,CAAA;AAAA,UAC3B;AAAA;AACF,SAAC,IAAA,CAAA;AAAA,IAIT,CAAA;AAAA,IACA,GAAGJ;AAAAA,GACJ,CAAA;AACH;;;;"}
@@ -1,4 +1,4 @@
1
- import { ref, defineComponent, markRaw, createVNode, Transition, shallowReactive, isVNode, withDirectives, h, vShow } from 'vue';
1
+ import { ref, defineComponent, markRaw, nextTick, createVNode, Transition, shallowReactive, isVNode, withDirectives, h, vShow } from 'vue';
2
2
 
3
3
  function _isSlot(s) {
4
4
  return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
@@ -42,22 +42,25 @@ const useTemplatePromise = (options = {}) => {
42
42
  if (index2 !== -1) instances.value.splice(index2, 1);
43
43
  } else {
44
44
  props.isVisible = false;
45
- const wrapper = document.querySelector(".ep-template-promise");
46
- if (wrapper.style["zIndex"]) {
47
- return;
48
- }
45
+ }
46
+ });
47
+ return props.promise;
48
+ };
49
+ const open = (...args) => {
50
+ instances.value = [];
51
+ const com = create(...args);
52
+ nextTick(() => {
53
+ const wrapper = document.querySelector(".ep-template-promise.is-init");
54
+ if (wrapper) {
49
55
  const dialog = wrapper?.querySelector(".el-modal-dialog");
50
56
  const zIndex = dialog ? dialog.style["z-index"] : "";
51
57
  if (zIndex && wrapper) {
52
58
  wrapper.style.zIndex = zIndex;
53
59
  }
60
+ wrapper.classList.remove("is-init");
54
61
  }
55
62
  });
56
- return props.promise;
57
- };
58
- const open = (...args) => {
59
- instances.value = [];
60
- return create(...args);
63
+ return com;
61
64
  };
62
65
  const component = /* @__PURE__ */ defineComponent((_, ctx) => {
63
66
  const {
@@ -66,7 +69,7 @@ const useTemplatePromise = (options = {}) => {
66
69
  const renderList = () => instances.value.map((props) => {
67
70
  return withDirectives(h("div", {
68
71
  // key: props.key,
69
- class: "ep-template-promise"
72
+ class: "ep-template-promise is-init"
70
73
  }, render ? render(props, ctx) : slots.default?.(props)), [[vShow, props.isVisible]]);
71
74
  });
72
75
  if (transition) return () => {
@@ -1 +1 @@
1
- {"version":3,"file":"use-template-promise.mjs","sources":["../../../../packages/hooks/use-template-promise.tsx"],"sourcesContent":["// 参考 https://github.com/vueuse/vueuse/blob/main/packages/core/createTemplatePromise/index.ts\n\nimport type {\n DefineComponent,\n Ref,\n TransitionProps,\n VNode,\n SetupContext,\n} from 'vue'\nimport {\n defineComponent,\n ref,\n shallowReactive,\n Transition,\n Fragment,\n h,\n createApp,\n getCurrentInstance,\n render as vRender,\n markRaw,\n withDirectives,\n vShow,\n} from 'vue'\n\nexport interface TemplatePromiseOptions {\n // 过渡\n transition?: TransitionProps\n // 是否销毁\n destroy?: boolean\n // 自定义渲染\n render?: (props, ctx: SetupContext) => VNode\n}\nexport type TemplatePromise<\n Return,\n Args extends any[] = [],\n> = DefineComponent<object> & {\n // new (): {\n // $slots: {\n // default: (_: TemplatePromiseProps<Return, Args>) => any\n // }\n // }\n} & {\n open: (...args: Args) => Promise<Return>\n}\nexport interface TemplatePromiseProps<Return, Args extends any[] = []> {\n promise: Promise<Return> | undefined\n resolve: (v: Return) => void\n reject: (v: any) => void\n args: Args\n options: TemplatePromiseOptions\n isResolving: boolean\n isVisible: boolean\n key: number\n}\nexport const useTemplatePromise = <Return, Args extends any[] = []>(\n options: TemplatePromiseOptions = {},\n): TemplatePromise<Return, Args> => {\n const {\n destroy = false,\n render,\n transition = {\n name: 'fade',\n appear: true,\n },\n } = options\n const instances = ref([]) as Ref<TemplatePromiseProps<Return, Args>[]>\n let index = 0\n\n const create = (...args: Args) => {\n const key = index++\n const props = shallowReactive<TemplatePromiseProps<Return, Args>>({\n key,\n args,\n promise: undefined,\n resolve: () => {},\n reject: () => {},\n isResolving: false,\n isVisible: true,\n options,\n })\n instances.value.push(props)\n props.promise = new Promise<Return>((_resolve, _reject) => {\n props.resolve = (v) => {\n props.isResolving = true\n return _resolve(v)\n }\n props.reject = _reject\n }).finally(() => {\n if (destroy) {\n props.promise = undefined\n const index = instances.value.indexOf(props)\n if (index !== -1) instances.value.splice(index, 1)\n } else {\n props.isVisible = false\n const wrapper = document.querySelector(\n '.ep-template-promise',\n ) as HTMLElement\n if (wrapper.style['zIndex']) {\n return\n }\n const dialog = wrapper?.querySelector('.el-modal-dialog') as HTMLElement\n const zIndex = dialog ? dialog.style['z-index'] : ''\n if (zIndex && wrapper) {\n wrapper.style.zIndex = zIndex\n }\n }\n })\n return props.promise\n }\n const open = (...args: Args) => {\n instances.value = []\n return create(...args)\n }\n const component = defineComponent((_, ctx) => {\n const { slots } = ctx\n const renderList = () =>\n instances.value.map((props) => {\n return withDirectives(\n h(\n 'div',\n {\n // key: props.key,\n class: 'ep-template-promise',\n },\n render ? render(props, ctx) : slots.default?.(props),\n ),\n [[vShow, props.isVisible]],\n )\n })\n if (transition)\n return () => <Transition {...transition}>{renderList()}</Transition>\n\n return renderList\n })\n // @ts-expect-error There's a breaking type change in Vue 3.3 <https://github.com/vuejs/core/pull/7963>\n component.open = open\n return markRaw(component as TemplatePromise<Return, Args>)\n}\n"],"names":["_isSlot","s","Object","prototype","toString","call","_isVNode","useTemplatePromise","options","destroy","render","transition","name","appear","instances","ref","index","create","args","key","props","shallowReactive","promise","undefined","resolve","reject","isResolving","isVisible","value","push","Promise","_resolve","_reject","v","finally","indexOf","splice","wrapper","document","querySelector","style","dialog","zIndex","open","component","defineComponent","_","ctx","slots","renderList","map","withDirectives","h","class","default","vShow","_slot","_createVNode","Transition","markRaw"],"mappings":";;AAsBY,SAAAA,QAAAC,CAAAA,EAAA;AAAA,EAAA,OAAA,OAAAA,CAAAA,KAAA,UAAA,IAAAC,MAAAA,CAAAC,SAAAA,CAAAC,QAAA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UAAAA,GAAaA,MACjBnC,SAAAA,CAAUc,KAAAA,CAAMsB,IAAK9B,CAAAA,KAAAA,KAAU;AAC7B,MAAA,OAAO+B,cAAAA,CACLC,EACE,KAAA,EACA;AAAA;AAAA,QAEEC,KAAAA,EAAO;AAAA,SAET3C,MAAAA,GAASA,MAAAA,CAAOU,KAAAA,EAAO2B,GAAG,IAAIC,KAAAA,CAAMM,OAAAA,GAAUlC,KAAK,CACrD,GACA,CAAC,CAACmC,OAAOnC,KAAAA,CAAMO,SAAS,CAAC,CAC3B,CAAA;AAAA,IACF,CAAC,CAAA;AACH,IAAA,IAAIhB,UAAAA,SACK,MAAA;AAAA,MAAA,IAAA6C,KAAAA;AAAA,MAAA,OAAAC,WAAAA,CAAAC,YAAsB/C,UAAAA,EAAUX,OAAAA,CAAAwD,QAAGP,UAAAA,EAAY,IAAAO,KAAAA,GAAA;AAAA,QAAAF,OAAAA,EAAAA,MAAA,CAAAE,KAAA;AAAA,OAAA,CAAA;AAAA,IAAA,CAAA;AAExD,IAAA,OAAOP,UAAAA;AAAAA,EACT,CAAC,CAAA;AAEDL,EAAAA,SAAAA,CAAUD,IAAAA,GAAOA,IAAAA;AACjB,EAAA,OAAOgB,QAAQf,SAA0C,CAAA;AAC3D;;;;"}
1
+ {"version":3,"file":"use-template-promise.mjs","sources":["../../../../packages/hooks/use-template-promise.tsx"],"sourcesContent":["// 参考 https://github.com/vueuse/vueuse/blob/main/packages/core/createTemplatePromise/index.ts\n\nimport type {\n DefineComponent,\n Ref,\n TransitionProps,\n VNode,\n SetupContext,\n} from 'vue'\nimport {\n defineComponent,\n ref,\n shallowReactive,\n Transition,\n Fragment,\n h,\n createApp,\n getCurrentInstance,\n render as vRender,\n markRaw,\n withDirectives,\n vShow,\n nextTick,\n} from 'vue'\n\nexport interface TemplatePromiseOptions {\n // 过渡\n transition?: TransitionProps\n // 是否销毁\n destroy?: boolean\n // 自定义渲染\n render?: (props, ctx: SetupContext) => VNode\n}\nexport type TemplatePromise<\n Return,\n Args extends any[] = [],\n> = DefineComponent<object> & {\n // new (): {\n // $slots: {\n // default: (_: TemplatePromiseProps<Return, Args>) => any\n // }\n // }\n} & {\n open: (...args: Args) => Promise<Return>\n}\nexport interface TemplatePromiseProps<Return, Args extends any[] = []> {\n promise: Promise<Return> | undefined\n resolve: (v: Return) => void\n reject: (v: any) => void\n args: Args\n options: TemplatePromiseOptions\n isResolving: boolean\n isVisible: boolean\n key: number\n}\nexport const useTemplatePromise = <Return, Args extends any[] = []>(\n options: TemplatePromiseOptions = {},\n): TemplatePromise<Return, Args> => {\n const {\n destroy = false,\n render,\n transition = {\n name: 'fade',\n appear: true,\n },\n } = options\n const instances = ref([]) as Ref<TemplatePromiseProps<Return, Args>[]>\n let index = 0\n\n const create = (...args: Args) => {\n const key = index++\n const props = shallowReactive<TemplatePromiseProps<Return, Args>>({\n key,\n args,\n promise: undefined,\n resolve: () => {},\n reject: () => {},\n isResolving: false,\n isVisible: true,\n options,\n })\n instances.value.push(props)\n props.promise = new Promise<Return>((_resolve, _reject) => {\n props.resolve = (v) => {\n props.isResolving = true\n return _resolve(v)\n }\n props.reject = _reject\n }).finally(() => {\n if (destroy) {\n props.promise = undefined\n const index = instances.value.indexOf(props)\n if (index !== -1) instances.value.splice(index, 1)\n } else {\n props.isVisible = false\n // const wrapper = document.querySelector(\n // '.ep-template-promise',\n // ) as HTMLElement\n // if (wrapper.style['zIndex']) {\n // return\n // }\n // const dialog = wrapper?.querySelector('.el-modal-dialog') as HTMLElement\n // const zIndex = dialog ? dialog.style['z-index'] : ''\n // if (zIndex && wrapper) {\n // wrapper.style.zIndex = zIndex\n // }\n }\n })\n return props.promise\n }\n const open = (...args: Args) => {\n instances.value = []\n const com = create(...args)\n nextTick(() => {\n const wrapper = document.querySelector(\n '.ep-template-promise.is-init',\n ) as HTMLElement\n if (wrapper) {\n const dialog = wrapper?.querySelector('.el-modal-dialog') as HTMLElement\n const zIndex = dialog ? dialog.style['z-index'] : ''\n if (zIndex && wrapper) {\n wrapper.style.zIndex = zIndex\n }\n // 删除is-init的class\n wrapper.classList.remove('is-init')\n }\n })\n return com\n }\n const component = defineComponent((_, ctx) => {\n const { slots } = ctx\n const renderList = () =>\n instances.value.map((props) => {\n return withDirectives(\n h(\n 'div',\n {\n // key: props.key,\n class: 'ep-template-promise is-init',\n },\n render ? render(props, ctx) : slots.default?.(props),\n ),\n [[vShow, props.isVisible]],\n )\n })\n if (transition)\n return () => <Transition {...transition}>{renderList()}</Transition>\n\n return renderList\n })\n // @ts-expect-error There's a breaking type change in Vue 3.3 <https://github.com/vuejs/core/pull/7963>\n component.open = open\n return markRaw(component as TemplatePromise<Return, Args>)\n}\n"],"names":["_isSlot","s","Object","prototype","toString","call","_isVNode","useTemplatePromise","options","destroy","render","transition","name","appear","instances","ref","index","create","args","key","props","shallowReactive","promise","undefined","resolve","reject","isResolving","isVisible","value","push","Promise","_resolve","_reject","v","finally","indexOf","splice","open","com","nextTick","wrapper","document","querySelector","dialog","zIndex","style","classList","remove","component","defineComponent","_","ctx","slots","renderList","map","withDirectives","h","class","default","vShow","_slot","_createVNode","Transition","markRaw"],"mappings":";;AAuBY,SAAAA,QAAAC,CAAAA,EAAA;AAAA,EAAA,OAAA,OAAAA,CAAAA,KAAA,UAAA,IAAAC,MAAAA,CAAAC,SAAAA,CAAAC,QAAAA,CAAAC,IAAAA,CAAAJ,CAAA,CAAA,KAAA,iBAAA,IAAA,CAAAK,OAAAA,CAAAL,CAAA,CAAA;AAAA;AAgCL,MAAMM,kBAAAA,GAAqBA,CAChCC,OAAAA,GAAkC,EAAC,KACD;AAClC,EAAA,MAAM;AAAA,IACJC,OAAAA,GAAU,KAAA;AAAA,IACVC,MAAAA;AAAAA,IACAC,UAAAA,GAAa;AAAA,MACXC,IAAAA,EAAM,MAAA;AAAA,MACNC,MAAAA,EAAQ;AAAA;AACV,GACF,GAAIL,OAAAA;AACJ,EAAA,MAAMM,SAAAA,GAAYC,GAAAA,CAAI,EAAE,CAAA;AACxB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OAAOvC,KAAAA,CAAMO,SAAS,CAAC,CAC3B,CAAA;AAAA,IACF,CAAC,CAAA;AACH,IAAA,IAAIhB,UAAAA,SACK,MAAA;AAAA,MAAA,IAAAiD,KAAAA;AAAA,MAAA,OAAAC,WAAAA,CAAAC,YAAsBnD,UAAAA,EAAUX,OAAAA,CAAA4D,QAAGP,UAAAA,EAAY,IAAAO,KAAAA,GAAA;AAAA,QAAAF,OAAAA,EAAAA,MAAA,CAAAE,KAAA;AAAA,OAAA,CAAA;AAAA,IAAA,CAAA;AAExD,IAAA,OAAOP,UAAAA;AAAAA,EACT,CAAC,CAAA;AAEDL,EAAAA,SAAAA,CAAUX,IAAAA,GAAOA,IAAAA;AACjB,EAAA,OAAO0B,QAAQf,SAA0C,CAAA;AAC3D;;;;"}
@@ -1,4 +1,4 @@
1
- var version = "0.0.23";
1
+ var version = "0.0.25";
2
2
 
3
3
  export { version };
4
4
  //# sourceMappingURL=package.json.mjs.map
@@ -17,14 +17,14 @@ const useChooseDialog = (options = {}) => {
17
17
  multiple,
18
18
  ...rest
19
19
  } = options;
20
- let selections = [];
20
+ let selections = vue.ref([]);
21
21
  const showSingleSelectionCol = !multiple;
22
22
  const scopedSlots = {};
23
23
  if (!showSingleSelectionCol) {
24
24
  scopedSlots.footerPrepend = () => {
25
25
  return vue.createVNode("span", {
26
26
  "class": bem.e("selected-count")
27
- }, [t("ep.chooseDialog.selected"), selections.length, t("ep.chooseDialog.unit")]);
27
+ }, [t("ep.chooseDialog.selected"), selections.value.length, t("ep.chooseDialog.unit")]);
28
28
  };
29
29
  }
30
30
  return useDialog.useDialog({
@@ -34,7 +34,7 @@ const useChooseDialog = (options = {}) => {
34
34
  scopedSlots,
35
35
  title,
36
36
  onConfirm: (resolve) => {
37
- resolve(vue.toRaw(selections));
37
+ resolve(JSON.parse(JSON.stringify(selections)));
38
38
  },
39
39
  render: ({
40
40
  resolve
@@ -52,10 +52,10 @@ const useChooseDialog = (options = {}) => {
52
52
  tableProps: {
53
53
  height: 300,
54
54
  onSelectionChange: (newSel) => {
55
- selections = newSel;
55
+ selections.value = newSel;
56
56
  },
57
57
  onSingleSelectionChange: (newSel) => {
58
- selections = newSel;
58
+ selections.value = newSel;
59
59
  resolve(vue.toRaw(selections));
60
60
  }
61
61
  }
@@ -1 +1 @@
1
- {"version":3,"file":"use-choose-dialog.js","sources":["../../../../../packages/hooks/dialog/use-choose-dialog.tsx"],"sourcesContent":["import { useDialog } from './use-dialog'\nimport { createNameSpace } from '@el-plus/utils/bem'\nimport { EpSearchListPage } from '@el-plus/components/search-list-page'\nimport type { DialogOptions } from './use-dialog'\nimport type { SearchListPageProps } from '@el-plus/components/search-list-page'\nimport { reactive, ref, toRaw } from 'vue'\nconst bem = createNameSpace('choose-dialog')\nimport { useLocale } from '@el-plus/hooks/use-locale'\n\ntype Options = {\n title?: string\n dialogProps?: DialogOptions\n multiple?: boolean\n} & SearchListPageProps\nexport const useChooseDialog = (options: Options = {}) => {\n const { t } = useLocale()\n const { dialogProps, title, multiple, ...rest } = options\n let selections = []\n const showSingleSelectionCol = !multiple\n const scopedSlots: DialogOptions['scopedSlots'] = {}\n if (!showSingleSelectionCol) {\n scopedSlots.footerPrepend = () => {\n return (\n <span class={bem.e('selected-count')}>\n {t('ep.chooseDialog.selected')}\n {selections.length}\n {t('ep.chooseDialog.unit')}\n </span>\n )\n }\n }\n return useDialog({\n class: bem.b(),\n width: '80%',\n showFooter: !showSingleSelectionCol,\n scopedSlots,\n title,\n onConfirm: (resolve) => {\n resolve(toRaw(selections))\n },\n render: ({ resolve }) => {\n const formData = rest.formData || reactive({})\n return (\n <EpSearchListPage\n {...{\n showSelectionCol: multiple,\n showSingleSelectionCol,\n formData,\n ...rest,\n formProps: {\n col: 3,\n ...rest.formProps,\n },\n tableProps: {\n height: 300,\n onSelectionChange: (newSel) => {\n selections = newSel\n },\n onSingleSelectionChange: (newSel) => {\n selections = newSel\n resolve(toRaw(selections))\n },\n },\n }}\n />\n )\n },\n ...dialogProps,\n })\n}\n"],"names":["bem","createNameSpace","useChooseDialog","options","t","useLocale","dialogProps","title","multiple","rest","selections","showSingleSelectionCol","scopedSlots","footerPrepend","_createVNode","e","length","useDialog","class","b","width","showFooter","onConfirm","resolve","toRaw","render","formData","reactive","EpSearchListPage","showSelectionCol","formProps","col","tableProps","height","onSelectionChange","newSel","onSingleSelectionChange"],"mappings":";;;;;;;;AAMA,MAAMA,GAAAA,GAAMC,sBAAgB,eAAe,CAAA;AAQpC,MAAMC,eAAAA,GAAkBA,CAACC,OAAAA,GAAmB,EAAC,KAAM;AACxD,EAAA,MAAM;AAAA,IAAEC;AAAAA,MAAMC,mBAAAA,EAAU;AACxB,EAAA,MAAM;AAAA,IAAEC,WAAAA;AAAAA,IAAaC,KAAAA;AAAAA,IAAOC,QAAAA;AAAAA,IAAU,GAAGC;AAAAA,GAAK,GAAIN,OAAAA;AAClD,EAAA,IAAIO,aAAa,EAAA;AACjB,EAAA,MAAMC,yBAAyB,CAACH,QAAAA;AAChC,EAAA,MAAMI,cAA4C,EAAC;AACnD,EAAA,IAAI,CAACD,sBAAAA,EAAwB;AAC3BC,IAAAA,WAAAA,CAAYC,gBAAgB,MAAM;AAChC,MAAA,OAAAC,gBAAA,MAAA,EAAA;AAAA,QAAA,OAAA,EACed,GAAAA,CAAIe,CAAAA,CAAE,gBAAgB;AAAA,OAAC,EAAA,CACjCX,CAAAA,CAAE,0BAA0B,CAAA,EAC5BM,WAAWM,MAAAA,EACXZ,CAAAA,CAAE,sBAAsB,CAAC,CAAA,CAAA;AAAA,IAGhC,CAAA;AAAA,EACF;AACA,EAAA,OAAOa,mBAAAA,CAAU;AAAA,IACfC,KAAAA,EAAOlB,IAAImB,CAAAA,EAAE;AAAA,IACbC,KAAAA,EAAO,KAAA;AAAA,IACPC,YAAY,CAACV,sBAAAA;AAAAA,IACbC,WAAAA;AAAAA,IACAL,KAAAA;AAAAA,IACAe,WAAYC,CAAAA,OAAAA,KAAY;AACtBA,MAAAA,OAAAA,CAAQC,SAAAA,CAAMd,UAAU,CAAC,CAAA;AAAA,IAC3B,CAAA;AAAA,IACAe,QAAQA,CAAC;AAAA,MAAEF;AAAAA,KAAQ,KAAM;AACvB,MAAA,MAAMG,QAAAA,GAAWjB,IAAAA,CAAKiB,QAAAA,IAAYC,YAAAA,CAAS,EAAE,CAAA;AAC7C,MAAA,OAAAb,gBAAAc,sBAAAA,EAAA;AAAA,QAGMC,gBAAAA,EAAkBrB,QAAAA;AAAAA,QAClBG,sBAAAA;AAAAA,QACAe,QAAAA;AAAAA,QACA,GAAGjB,IAAAA;AAAAA,QACHqB,SAAAA,EAAW;AAAA,UACTC,GAAAA,EAAK,CAAA;AAAA,UACL,GAAGtB,IAAAA,CAAKqB;AAAAA,SACV;AAAA,QACAE,UAAAA,EAAY;AAAA,UACVC,MAAAA,EAAQ,GAAA;AAAA,UACRC,mBAAoBC,CAAAA,MAAAA,KAAW;AAC7BzB,YAAAA,UAAAA,GAAayB,MAAAA;AAAAA,UACf,CAAA;AAAA,UACAC,yBAA0BD,CAAAA,MAAAA,KAAW;AACnCzB,YAAAA,UAAAA,GAAayB,MAAAA;AACbZ,YAAAA,OAAAA,CAAQC,SAAAA,CAAMd,UAAU,CAAC,CAAA;AAAA,UAC3B;AAAA;AACF,SAAC,IAAA,CAAA;AAAA,IAIT,CAAA;AAAA,IACA,GAAGJ;AAAAA,GACJ,CAAA;AACH;;;;"}
1
+ {"version":3,"file":"use-choose-dialog.js","sources":["../../../../../packages/hooks/dialog/use-choose-dialog.tsx"],"sourcesContent":["import { useDialog } from './use-dialog'\nimport { createNameSpace } from '@el-plus/utils/bem'\nimport { EpSearchListPage } from '@el-plus/components/search-list-page'\nimport type { DialogOptions } from './use-dialog'\nimport type { SearchListPageProps } from '@el-plus/components/search-list-page'\nimport { reactive, ref, toRaw } from 'vue'\nconst bem = createNameSpace('choose-dialog')\nimport { useLocale } from '@el-plus/hooks/use-locale'\n\ntype Options = {\n title?: string\n dialogProps?: DialogOptions\n multiple?: boolean\n} & SearchListPageProps\nexport const useChooseDialog = (options: Options = {}) => {\n const { t } = useLocale()\n const { dialogProps, title, multiple, ...rest } = options\n let selections = ref([])\n const showSingleSelectionCol = !multiple\n const scopedSlots: DialogOptions['scopedSlots'] = {}\n if (!showSingleSelectionCol) {\n scopedSlots.footerPrepend = () => {\n return (\n <span class={bem.e('selected-count')}>\n {t('ep.chooseDialog.selected')}\n {selections.value.length}\n {t('ep.chooseDialog.unit')}\n </span>\n )\n }\n }\n return useDialog({\n class: bem.b(),\n width: '80%',\n showFooter: !showSingleSelectionCol,\n scopedSlots,\n title,\n onConfirm: (resolve) => {\n resolve(JSON.parse(JSON.stringify(selections)))\n },\n render: ({ resolve }) => {\n const formData = rest.formData || reactive({})\n return (\n <EpSearchListPage\n {...{\n showSelectionCol: multiple,\n showSingleSelectionCol,\n formData,\n ...rest,\n formProps: {\n col: 3,\n ...rest.formProps,\n },\n tableProps: {\n height: 300,\n onSelectionChange: (newSel) => {\n selections.value = newSel\n },\n onSingleSelectionChange: (newSel) => {\n selections.value = newSel\n resolve(toRaw(selections))\n },\n },\n }}\n />\n )\n },\n ...dialogProps,\n })\n}\n"],"names":["bem","createNameSpace","useChooseDialog","options","t","useLocale","dialogProps","title","multiple","rest","selections","ref","showSingleSelectionCol","scopedSlots","footerPrepend","_createVNode","e","value","length","useDialog","class","b","width","showFooter","onConfirm","resolve","JSON","parse","stringify","render","formData","reactive","EpSearchListPage","showSelectionCol","formProps","col","tableProps","height","onSelectionChange","newSel","onSingleSelectionChange","toRaw"],"mappings":";;;;;;;;AAMA,MAAMA,GAAAA,GAAMC,sBAAgB,eAAe,CAAA;AAQpC,MAAMC,eAAAA,GAAkBA,CAACC,OAAAA,GAAmB,EAAC,KAAM;AACxD,EAAA,MAAM;AAAA,IAAEC;AAAAA,MAAMC,mBAAAA,EAAU;AACxB,EAAA,MAAM;AAAA,IAAEC,WAAAA;AAAAA,IAAaC,KAAAA;AAAAA,IAAOC,QAAAA;AAAAA,IAA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AA,EAAK,CAAA;AAAA,UACL,GAAG1B,IAAAA,CAAKyB;AAAAA,SACV;AAAA,QACAE,UAAAA,EAAY;AAAA,UACVC,MAAAA,EAAQ,GAAA;AAAA,UACRC,mBAAoBC,CAAAA,MAAAA,KAAW;AAC7B7B,YAAAA,UAAAA,CAAWO,KAAAA,GAAQsB,MAAAA;AAAAA,UACrB,CAAA;AAAA,UACAC,yBAA0BD,CAAAA,MAAAA,KAAW;AACnC7B,YAAAA,UAAAA,CAAWO,KAAAA,GAAQsB,MAAAA;AACnBd,YAAAA,OAAAA,CAAQgB,SAAAA,CAAM/B,UAAU,CAAC,CAAA;AAAA,UAC3B;AAAA;AACF,SAAC,IAAA,CAAA;AAAA,IAIT,CAAA;AAAA,IACA,GAAGJ;AAAAA,GACJ,CAAA;AACH;;;;"}
@@ -44,22 +44,25 @@ const useTemplatePromise = (options = {}) => {
44
44
  if (index2 !== -1) instances.value.splice(index2, 1);
45
45
  } else {
46
46
  props.isVisible = false;
47
- const wrapper = document.querySelector(".ep-template-promise");
48
- if (wrapper.style["zIndex"]) {
49
- return;
50
- }
47
+ }
48
+ });
49
+ return props.promise;
50
+ };
51
+ const open = (...args) => {
52
+ instances.value = [];
53
+ const com = create(...args);
54
+ vue.nextTick(() => {
55
+ const wrapper = document.querySelector(".ep-template-promise.is-init");
56
+ if (wrapper) {
51
57
  const dialog = wrapper?.querySelector(".el-modal-dialog");
52
58
  const zIndex = dialog ? dialog.style["z-index"] : "";
53
59
  if (zIndex && wrapper) {
54
60
  wrapper.style.zIndex = zIndex;
55
61
  }
62
+ wrapper.classList.remove("is-init");
56
63
  }
57
64
  });
58
- return props.promise;
59
- };
60
- const open = (...args) => {
61
- instances.value = [];
62
- return create(...args);
65
+ return com;
63
66
  };
64
67
  const component = /* @__PURE__ */ vue.defineComponent((_, ctx) => {
65
68
  const {
@@ -68,7 +71,7 @@ const useTemplatePromise = (options = {}) => {
68
71
  const renderList = () => instances.value.map((props) => {
69
72
  return vue.withDirectives(vue.h("div", {
70
73
  // key: props.key,
71
- class: "ep-template-promise"
74
+ class: "ep-template-promise is-init"
72
75
  }, render ? render(props, ctx) : slots.default?.(props)), [[vue.vShow, props.isVisible]]);
73
76
  });
74
77
  if (transition) return () => {
@@ -1 +1 @@
1
- {"version":3,"file":"use-template-promise.js","sources":["../../../../packages/hooks/use-template-promise.tsx"],"sourcesContent":["// 参考 https://github.com/vueuse/vueuse/blob/main/packages/core/createTemplatePromise/index.ts\n\nimport type {\n DefineComponent,\n Ref,\n TransitionProps,\n VNode,\n SetupContext,\n} from 'vue'\nimport {\n defineComponent,\n ref,\n shallowReactive,\n Transition,\n Fragment,\n h,\n createApp,\n getCurrentInstance,\n render as vRender,\n markRaw,\n withDirectives,\n vShow,\n} from 'vue'\n\nexport interface TemplatePromiseOptions {\n // 过渡\n transition?: TransitionProps\n // 是否销毁\n destroy?: boolean\n // 自定义渲染\n render?: (props, ctx: SetupContext) => VNode\n}\nexport type TemplatePromise<\n Return,\n Args extends any[] = [],\n> = DefineComponent<object> & {\n // new (): {\n // $slots: {\n // default: (_: TemplatePromiseProps<Return, Args>) => any\n // }\n // }\n} & {\n open: (...args: Args) => Promise<Return>\n}\nexport interface TemplatePromiseProps<Return, Args extends any[] = []> {\n promise: Promise<Return> | undefined\n resolve: (v: Return) => void\n reject: (v: any) => void\n args: Args\n options: TemplatePromiseOptions\n isResolving: boolean\n isVisible: boolean\n key: number\n}\nexport const useTemplatePromise = <Return, Args extends any[] = []>(\n options: TemplatePromiseOptions = {},\n): TemplatePromise<Return, Args> => {\n const {\n destroy = false,\n render,\n transition = {\n name: 'fade',\n appear: true,\n },\n } = options\n const instances = ref([]) as Ref<TemplatePromiseProps<Return, Args>[]>\n let index = 0\n\n const create = (...args: Args) => {\n const key = index++\n const props = shallowReactive<TemplatePromiseProps<Return, Args>>({\n key,\n args,\n promise: undefined,\n resolve: () => {},\n reject: () => {},\n isResolving: false,\n isVisible: true,\n options,\n })\n instances.value.push(props)\n props.promise = new Promise<Return>((_resolve, _reject) => {\n props.resolve = (v) => {\n props.isResolving = true\n return _resolve(v)\n }\n props.reject = _reject\n }).finally(() => {\n if (destroy) {\n props.promise = undefined\n const index = instances.value.indexOf(props)\n if (index !== -1) instances.value.splice(index, 1)\n } else {\n props.isVisible = false\n const wrapper = document.querySelector(\n '.ep-template-promise',\n ) as HTMLElement\n if (wrapper.style['zIndex']) {\n return\n }\n const dialog = wrapper?.querySelector('.el-modal-dialog') as HTMLElement\n const zIndex = dialog ? dialog.style['z-index'] : ''\n if (zIndex && wrapper) {\n wrapper.style.zIndex = zIndex\n }\n }\n })\n return props.promise\n }\n const open = (...args: Args) => {\n instances.value = []\n return create(...args)\n }\n const component = defineComponent((_, ctx) => {\n const { slots } = ctx\n const renderList = () =>\n instances.value.map((props) => {\n return withDirectives(\n h(\n 'div',\n {\n // key: props.key,\n class: 'ep-template-promise',\n },\n render ? render(props, ctx) : slots.default?.(props),\n ),\n [[vShow, props.isVisible]],\n )\n })\n if (transition)\n return () => <Transition {...transition}>{renderList()}</Transition>\n\n return renderList\n })\n // @ts-expect-error There's a breaking type change in Vue 3.3 <https://github.com/vuejs/core/pull/7963>\n component.open = open\n return markRaw(component as TemplatePromise<Return, Args>)\n}\n"],"names":["_isSlot","s","Object","prototype","toString","call","_isVNode","useTemplatePromise","options","destroy","render","transition","name","appear","instances","ref","index","create","args","key","props","shallowReactive","promise","undefined","resolve","reject","isResolving","isVisible","value","push","Promise","_resolve","_reject","v","finally","indexOf","splice","wrapper","document","querySelector","style","dialog","zIndex","open","component","defineComponent","_","ctx","slots","renderList","map","withDirectives","h","class","default","vShow","_slot","_createVNode","Transition","markRaw"],"mappings":";;;;AAsBY,SAAAA,QAAAC,CAAAA,EAAA;AAAA,EAAA,OAAA,OAAAA,CAAAA,KAAA,UAAA,IAAAC,MAAAA,CAAAC,SAAAA,CAAAC,QAAAA,CAAAC,IAAAA,CAAAJ,CAAA,CAAA,KAAA,iBAAA,IAAA,CAAAK,WAAAA,CAAA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A,KAAU;AAC7B,MAAA,OAAO+B,kBAAAA,CACLC,MACE,KAAA,EACA;AAAA;AAAA,QAEEC,KAAAA,EAAO;AAAA,SAET3C,MAAAA,GAASA,MAAAA,CAAOU,KAAAA,EAAO2B,GAAG,IAAIC,KAAAA,CAAMM,OAAAA,GAAUlC,KAAK,CACrD,GACA,CAAC,CAACmC,WAAOnC,KAAAA,CAAMO,SAAS,CAAC,CAC3B,CAAA;AAAA,IACF,CAAC,CAAA;AACH,IAAA,IAAIhB,UAAAA,SACK,MAAA;AAAA,MAAA,IAAA6C,KAAAA;AAAA,MAAA,OAAAC,eAAAA,CAAAC,gBAAsB/C,UAAAA,EAAUX,OAAAA,CAAAwD,QAAGP,UAAAA,EAAY,IAAAO,KAAAA,GAAA;AAAA,QAAAF,OAAAA,EAAAA,MAAA,CAAAE,KAAA;AAAA,OAAA,CAAA;AAAA,IAAA,CAAA;AAExD,IAAA,OAAOP,UAAAA;AAAAA,EACT,CAAC,CAAA;AAEDL,EAAAA,SAAAA,CAAUD,IAAAA,GAAOA,IAAAA;AACjB,EAAA,OAAOgB,YAAQf,SAA0C,CAAA;AAC3D;;;;"}
1
+ {"version":3,"file":"use-template-promise.js","sources":["../../../../packages/hooks/use-template-promise.tsx"],"sourcesContent":["// 参考 https://github.com/vueuse/vueuse/blob/main/packages/core/createTemplatePromise/index.ts\n\nimport type {\n DefineComponent,\n Ref,\n TransitionProps,\n VNode,\n SetupContext,\n} from 'vue'\nimport {\n defineComponent,\n ref,\n shallowReactive,\n Transition,\n Fragment,\n h,\n createApp,\n getCurrentInstance,\n render as vRender,\n markRaw,\n withDirectives,\n vShow,\n nextTick,\n} from 'vue'\n\nexport interface TemplatePromiseOptions {\n // 过渡\n transition?: TransitionProps\n // 是否销毁\n destroy?: boolean\n // 自定义渲染\n render?: (props, ctx: SetupContext) => VNode\n}\nexport type TemplatePromise<\n Return,\n Args extends any[] = [],\n> = DefineComponent<object> & {\n // new (): {\n // $slots: {\n // default: (_: TemplatePromiseProps<Return, Args>) => any\n // }\n // }\n} & {\n open: (...args: Args) => Promise<Return>\n}\nexport interface TemplatePromiseProps<Return, Args extends any[] = []> {\n promise: Promise<Return> | undefined\n resolve: (v: Return) => void\n reject: (v: any) => void\n args: Args\n options: TemplatePromiseOptions\n isResolving: boolean\n isVisible: boolean\n key: number\n}\nexport const useTemplatePromise = <Return, Args extends any[] = []>(\n options: TemplatePromiseOptions = {},\n): TemplatePromise<Return, Args> => {\n const {\n destroy = false,\n render,\n transition = {\n name: 'fade',\n appear: true,\n },\n } = options\n const instances = ref([]) as Ref<TemplatePromiseProps<Return, Args>[]>\n let index = 0\n\n const create = (...args: Args) => {\n const key = index++\n const props = shallowReactive<TemplatePromiseProps<Return, Args>>({\n key,\n args,\n promise: undefined,\n resolve: () => {},\n reject: () => {},\n isResolving: false,\n isVisible: true,\n options,\n })\n instances.value.push(props)\n props.promise = new Promise<Return>((_resolve, _reject) => {\n props.resolve = (v) => {\n props.isResolving = true\n return _resolve(v)\n }\n props.reject = _reject\n }).finally(() => {\n if (destroy) {\n props.promise = undefined\n const index = instances.value.indexOf(props)\n if (index !== -1) instances.value.splice(index, 1)\n } else {\n props.isVisible = false\n // const wrapper = document.querySelector(\n // '.ep-template-promise',\n // ) as HTMLElement\n // if (wrapper.style['zIndex']) {\n // return\n // }\n // const dialog = wrapper?.querySelector('.el-modal-dialog') as HTMLElement\n // const zIndex = dialog ? dialog.style['z-index'] : ''\n // if (zIndex && wrapper) {\n // wrapper.style.zIndex = zIndex\n // }\n }\n })\n return props.promise\n }\n const open = (...args: Args) => {\n instances.value = []\n const com = create(...args)\n nextTick(() => {\n const wrapper = document.querySelector(\n '.ep-template-promise.is-init',\n ) as HTMLElement\n if (wrapper) {\n const dialog = wrapper?.querySelector('.el-modal-dialog') as HTMLElement\n const zIndex = dialog ? dialog.style['z-index'] : ''\n if (zIndex && wrapper) {\n wrapper.style.zIndex = zIndex\n }\n // 删除is-init的class\n wrapper.classList.remove('is-init')\n }\n })\n return com\n }\n const component = defineComponent((_, ctx) => {\n const { slots } = ctx\n const renderList = () =>\n instances.value.map((props) => {\n return withDirectives(\n h(\n 'div',\n {\n // key: props.key,\n class: 'ep-template-promise is-init',\n },\n render ? render(props, ctx) : slots.default?.(props),\n ),\n [[vShow, props.isVisible]],\n )\n })\n if (transition)\n return () => <Transition {...transition}>{renderList()}</Transition>\n\n return renderList\n })\n // @ts-expect-error There's a breaking type change in Vue 3.3 <https://github.com/vuejs/core/pull/7963>\n component.open = open\n return markRaw(component as TemplatePromise<Return, Args>)\n}\n"],"names":["_isSlot","s","Object","prototype","toString","call","_isVNode","useTemplatePromise","options","destroy","render","transition","name","appear","instances","ref","index","create","args","key","props","shallowReactive","promise","undefined","resolve","reject","isResolving","isVisible","value","push","Promise","_resolve","_reject","v","finally","indexOf","splice","open","com","nextTick","wrapper","document","querySelector","dialog","zIndex","style","classList","remove","component","defineComponent","_","ctx","slots","renderList","map","withDirectives","h","class","default","vShow","_slot","_createVNode","Transition","markRaw"],"mappings":";;;;AAuBY,SAAAA,QAAAC,CAAAA,EAAA;AAAA,EAAA,OAAA,OAAAA,CAAAA,KAAA,UAAA,IAAAC,MAAAA,CAAAC,SAAAA,CAAAC,QAAAA,CAAAC,IAAAA,CAAAJ,CAAA,CAAA,KAAA,iBAAA,IAAA,CAAAK,WAAAA,CAAAL,CAAA,CAAA;AAAA;AAgCL,MAAMM,kBAAAA,GAAqBA,CAChCC,OAAAA,GAAkC,EAAC,KACD;AAClC,EAAA,MAAM;AAAA,IACJC,OAAAA,GAAU,KAAA;AAAA,IACVC,MAAAA;AAAAA,IACAC,UAAAA,GAAa;AAAA,MACXC,IAAAA,EAAM,MAAA;AAAA,MACNC,MAAAA,EAAQ;AAAA;AACV,GACF,GAAIL,OAAAA;AACJ,EAAA,MAAMM,SAAAA,GAAYC,OAAAA,CAAI,EAAE,CAAA;AACxB,EAAA,IAAIC,KAAAA,GAAQ,CAAA;AAEZ,EAAA,MAAMC,MAAAA,GAASA,IA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AA;AACH,IAAA,IAAIhB,UAAAA,SACK,MAAA;AAAA,MAAA,IAAAiD,KAAAA;AAAA,MAAA,OAAAC,eAAAA,CAAAC,gBAAsBnD,UAAAA,EAAUX,OAAAA,CAAA4D,QAAGP,UAAAA,EAAY,IAAAO,KAAAA,GAAA;AAAA,QAAAF,OAAAA,EAAAA,MAAA,CAAAE,KAAA;AAAA,OAAA,CAAA;AAAA,IAAA,CAAA;AAExD,IAAA,OAAOP,UAAAA;AAAAA,EACT,CAAC,CAAA;AAEDL,EAAAA,SAAAA,CAAUX,IAAAA,GAAOA,IAAAA;AACjB,EAAA,OAAO0B,YAAQf,SAA0C,CAAA;AAC3D;;;;"}
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var version = "0.0.23";
3
+ var version = "0.0.25";
4
4
 
5
5
  exports.version = version;
6
6
  //# sourceMappingURL=package.json.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "el-plus",
3
- "version": "0.0.23",
3
+ "version": "0.0.25",
4
4
  "description": "pro base on element-plus",
5
5
  "module": "./es/index.mjs",
6
6
  "keywords": [
@@ -1 +1 @@
1
- .ep-template-promise{position:relative;z-index:8888888888}.ep-dialog{padding:20px 25px 40px}.ep-dialog .el-dialog__headerbtn{height:56px}.ep-dialog .el-dialog__headerbtn .el-dialog__close{transform:scale(1.3)}.ep-dialog .el-dialog__header{text-align:center}.ep-dialog .el-dialog__header .el-dialog__title{color:#505050;font-size:16px;font-weight:600;line-height:24px;margin:4px}.ep-dialog .el-dialog__body{padding:25px 0 0}.ep-dialog__footer{padding:14px 0 0}.ep-dialog__footer button{font-size:12px}.ep-choose-dialog__selected-count{color:#409eff;float:left;font-size:16px;line-height:32px}
1
+ .ep-template-promise{position:relative;z-index:8888888888888888}.ep-dialog{padding:20px 25px 40px}.ep-dialog .el-dialog__headerbtn{height:56px}.ep-dialog .el-dialog__headerbtn .el-dialog__close{transform:scale(1.3)}.ep-dialog .el-dialog__header{text-align:center}.ep-dialog .el-dialog__header .el-dialog__title{color:#505050;font-size:16px;font-weight:600;line-height:24px;margin:4px}.ep-dialog .el-dialog__body{padding:25px 0 0}.ep-dialog__footer{padding:14px 0 0}.ep-dialog__footer button{font-size:12px}.ep-choose-dialog__selected-count{color:#409eff;float:left;font-size:16px;line-height:32px}
@@ -1 +1 @@
1
- .ep-form{position:relative}.ep-form__fold{bottom:23px;color:#367ef5;cursor:pointer;font-size:14px;position:absolute;right:0;text-align:center;width:70px}.ep-form__fold:hover{text-decoration:underline}.ep-form.is-fold{padding-right:70px}.ep-form .el-form-item--small{margin-bottom:18px}.ep-form .el-form-item--small .el-form-item__label{display:block;height:32px;line-height:32px;overflow:hidden;padding-left:18px;padding-right:6px;text-overflow:ellipsis;white-space:nowrap}.ep-form .el-form-item--small .el-form-item__content{font-size:13px;line-height:32px}.ep-form .el-form-item--small .el-form-item__content .el-input{font-size:13px;height:32px}.ep-form .el-form-item--small .el-form-item__content .el-select__wrapper{font-size:13px;line-height:32px;min-height:32px}.ep-form .el-form-item--small .el-form-item__content .el-date-editor .el-range-input{font-size:13px}
1
+ .ep-form{position:relative}.ep-form__fold{bottom:23px;color:#367ef5;cursor:pointer;font-size:14px;position:absolute;right:0;text-align:center;width:70px}.ep-form__fold:hover{text-decoration:underline}.ep-form.is-fold{padding-right:70px}.ep-form .el-form-item--small{margin-bottom:18px}.ep-form .el-form-item--small .el-form-item__label{display:block;height:32px;line-height:32px;overflow:hidden;padding-left:18px;padding-right:6px;text-overflow:ellipsis;white-space:nowrap}.ep-form .el-form-item--small .el-form-item__content{font-size:13px;line-height:32px}.ep-form .el-form-item--small .el-form-item__content .el-input{font-size:13px;height:32px}.ep-form .el-form-item--small .el-form-item__content .el-textarea__inner{font-size:13px!important}.ep-form .el-form-item--small .el-form-item__content .el-select__wrapper{font-size:13px;line-height:32px;min-height:32px}.ep-form .el-form-item--small .el-form-item__content .el-date-editor .el-range-input{font-size:13px}
@@ -1 +1 @@
1
- .fade-enter-active,.fade-leave-active{transition:opacity .3s ease}.fade-enter-from,.fade-leave-to{opacity:0}body{-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility}.ep-form{position:relative}.ep-form__fold{bottom:23px;color:#367ef5;cursor:pointer;font-size:14px;position:absolute;right:0;text-align:center;width:70px}.ep-form__fold:hover{text-decoration:underline}.ep-form.is-fold{padding-right:70px}.ep-form .el-form-item--small{margin-bottom:18px}.ep-form .el-form-item--small .el-form-item__label{display:block;height:32px;line-height:32px;overflow:hidden;padding-left:18px;padding-right:6px;text-overflow:ellipsis;white-space:nowrap}.ep-form .el-form-item--small .el-form-item__content{font-size:13px;line-height:32px}.ep-form .el-form-item--small .el-form-item__content .el-input{font-size:13px;height:32px}.ep-form .el-form-item--small .el-form-item__content .el-select__wrapper{font-size:13px;line-height:32px;min-height:32px}.ep-form .el-form-item--small .el-form-item__content .el-date-editor .el-range-input{font-size:13px}.ep-table__action-buttons{white-space:nowrap}.ep-table .table-column-link .el-form-item{display:inline-block}.ep-table .table-column-link .el-form-item .el-form-item__label{display:none}.ep-table .el-table{font-size:13px}.ep-table .el-table .el-table__cell .is-edit{cursor:pointer}.ep-table .el-table .el-table__cell .is-edit:hover{color:#409eff}.ep-table .el-table .el-table__cell .is-edit .el-icon{vertical-align:-2px}.ep-table .el-table .cell{line-height:30px}.ep-table .el-table thead tr th{height:42px}.ep-table .el-table td,.ep-table .el-table th{padding:3px 0}.ep-table .el-form-item__error{position:unset;text-align:left}.ep-table .el-form-item{margin-bottom:0}.ep-table .el-form-item .el-form-item__label{padding:0}.ep-table .el-pagination{margin-top:12px;--el-pagination-font-size:13px}.ep-table .el-pagination .el-select{--el-select-font-size:13px}.ep-table .el-pagination .el-select .el-select__wrapper{font-size:13px}.ep-button{height:auto;padding:9px 15px}.ep-button.el-button--text{padding:0}.ep-button.el-button+.el-button{margin-left:10px}.ep-search-list-page #middle{overflow:hidden}.ep-search-list-page__middle-left{float:left}.ep-search-list-page__middle-left>.el-button{margin:16px 0}.ep-search-list-page__middle-right{float:right}.ep-search-list-page__middle-right .el-button{margin:16px 0}.ep-title__header{line-height:50px;overflow:hidden}.ep-title__title{float:left;font-size:15px;font-weight:500}.ep-title__toggle{color:#409eff;cursor:pointer;display:inline-block;font-size:14px;font-weight:400;margin-left:10px;white-space:nowrap}.ep-title__toggle .el-icon{transition:transform .3s;vertical-align:-2px}.ep-title.is-expanded .ep-title__toggle .el-icon{transform:rotate(-180deg)}.ep-title__buttons{float:right}.ep-title__content{overflow:hidden;transition:max-height .3s ease-in-out}.ep-header{display:flex;margin-bottom:10px}.ep-header .el-page-header .el-page-header__left{margin-right:-10px;margin-top:4px}.ep-template-promise{position:relative;z-index:8888888888}.ep-dialog{padding:20px 25px 40px}.ep-dialog .el-dialog__headerbtn{height:56px}.ep-dialog .el-dialog__headerbtn .el-dialog__close{transform:scale(1.3)}.ep-dialog .el-dialog__header{text-align:center}.ep-dialog .el-dialog__header .el-dialog__title{color:#505050;font-size:16px;font-weight:600;line-height:24px;margin:4px}.ep-dialog .el-dialog__body{padding:25px 0 0}.ep-dialog__footer{padding:14px 0 0}.ep-dialog__footer button{font-size:12px}.ep-choose-dialog__selected-count{color:#409eff;float:left;font-size:16px;line-height:32px}.ep-custom-column__dialog .el-dialog__body{text-align:center}.ep-custom-column__dialog .el-transfer{display:inline-block}.ep-custom-column__dialog .el-transfer-panel__footer{border-bottom:0;height:0}.ep-custom-column__dialog .el-transfer-panel{overflow:visible}.ep-custom-column__operate{position:absolute;right:-100%;top:50%;transform:translate(calc(25% - 52px),32px)}.ep-link{font-size:13px}
1
+ .fade-enter-active,.fade-leave-active{transition:opacity .3s ease}.fade-enter-from,.fade-leave-to{opacity:0}body{-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility}.ep-form{position:relative}.ep-form__fold{bottom:23px;color:#367ef5;cursor:pointer;font-size:14px;position:absolute;right:0;text-align:center;width:70px}.ep-form__fold:hover{text-decoration:underline}.ep-form.is-fold{padding-right:70px}.ep-form .el-form-item--small{margin-bottom:18px}.ep-form .el-form-item--small .el-form-item__label{display:block;height:32px;line-height:32px;overflow:hidden;padding-left:18px;padding-right:6px;text-overflow:ellipsis;white-space:nowrap}.ep-form .el-form-item--small .el-form-item__content{font-size:13px;line-height:32px}.ep-form .el-form-item--small .el-form-item__content .el-input{font-size:13px;height:32px}.ep-form .el-form-item--small .el-form-item__content .el-textarea__inner{font-size:13px!important}.ep-form .el-form-item--small .el-form-item__content .el-select__wrapper{font-size:13px;line-height:32px;min-height:32px}.ep-form .el-form-item--small .el-form-item__content .el-date-editor .el-range-input{font-size:13px}.ep-table__action-buttons{white-space:nowrap}.ep-table .table-column-link .el-form-item{display:inline-block}.ep-table .table-column-link .el-form-item .el-form-item__label{display:none}.ep-table .el-table{font-size:13px}.ep-table .el-table .el-table__cell .is-edit{cursor:pointer}.ep-table .el-table .el-table__cell .is-edit:hover{color:#409eff}.ep-table .el-table .el-table__cell .is-edit .el-icon{vertical-align:-2px}.ep-table .el-table .cell{line-height:30px}.ep-table .el-table thead tr th{height:42px}.ep-table .el-table td,.ep-table .el-table th{padding:3px 0}.ep-table .el-form-item__error{position:unset;text-align:left}.ep-table .el-form-item{margin-bottom:0}.ep-table .el-form-item .el-form-item__label{padding:0}.ep-table .el-pagination{margin-top:12px;--el-pagination-font-size:13px}.ep-table .el-pagination .el-select{--el-select-font-size:13px}.ep-table .el-pagination .el-select .el-select__wrapper{font-size:13px}.ep-button{height:auto;padding:9px 15px}.ep-button.el-button--text{padding:0}.ep-button.el-button+.el-button{margin-left:10px}.ep-search-list-page #middle{overflow:hidden}.ep-search-list-page__middle-left{float:left}.ep-search-list-page__middle-left>.el-button{margin:16px 0}.ep-search-list-page__middle-right{float:right}.ep-search-list-page__middle-right .el-button{margin:16px 0}.ep-title__header{line-height:50px;overflow:hidden}.ep-title__title{float:left;font-size:15px;font-weight:500}.ep-title__toggle{color:#409eff;cursor:pointer;display:inline-block;font-size:14px;font-weight:400;margin-left:10px;white-space:nowrap}.ep-title__toggle .el-icon{transition:transform .3s;vertical-align:-2px}.ep-title.is-expanded .ep-title__toggle .el-icon{transform:rotate(-180deg)}.ep-title__buttons{float:right}.ep-title__content{overflow:hidden;transition:max-height .3s ease-in-out}.ep-header{display:flex;margin-bottom:10px}.ep-header .el-page-header .el-page-header__left{margin-right:-10px;margin-top:4px}.ep-template-promise{position:relative;z-index:8888888888888888}.ep-dialog{padding:20px 25px 40px}.ep-dialog .el-dialog__headerbtn{height:56px}.ep-dialog .el-dialog__headerbtn .el-dialog__close{transform:scale(1.3)}.ep-dialog .el-dialog__header{text-align:center}.ep-dialog .el-dialog__header .el-dialog__title{color:#505050;font-size:16px;font-weight:600;line-height:24px;margin:4px}.ep-dialog .el-dialog__body{padding:25px 0 0}.ep-dialog__footer{padding:14px 0 0}.ep-dialog__footer button{font-size:12px}.ep-choose-dialog__selected-count{color:#409eff;float:left;font-size:16px;line-height:32px}.ep-custom-column__dialog .el-dialog__body{text-align:center}.ep-custom-column__dialog .el-transfer{display:inline-block}.ep-custom-column__dialog .el-transfer-panel__footer{border-bottom:0;height:0}.ep-custom-column__dialog .el-transfer-panel{overflow:visible}.ep-custom-column__operate{position:absolute;right:-100%;top:50%;transform:translate(calc(25% - 52px),32px)}.ep-link{font-size:13px}
@@ -1,7 +1,7 @@
1
1
  @use 'mixins/mixins.scss' as *;
2
2
  @use 'common/var.scss' as *;
3
3
  .ep-template-promise{
4
- z-index:8888888888;
4
+ z-index:8888888888888888;
5
5
  position: relative;
6
6
  }
7
7
  @include b(dialog) {
@@ -45,6 +45,9 @@
45
45
  font-size: 13px;
46
46
  height: 32px;
47
47
  }
48
+ .el-textarea__inner {
49
+ font-size: 13px!important;
50
+ }
48
51
 
49
52
  .el-select__wrapper {
50
53
  line-height: 32px;