plain-design 1.0.0-beta.8 → 1.0.0-beta.9

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": "plain-design",
3
- "version": "1.0.0-beta.8",
3
+ "version": "1.0.0-beta.9",
4
4
  "description": "",
5
5
  "main": "dist/plain-design.min.js",
6
6
  "module": "dist/plain-design.commonjs.min.js",
@@ -20,8 +20,8 @@
20
20
  "exceljs": "^4.2.1",
21
21
  "file-saver": "^2.0.5",
22
22
  "plain-design-composition": "^0.0.167",
23
- "react": "^17.0.1",
24
- "react-dom": "^17.0.1"
23
+ "react": "^18.0.1",
24
+ "react-dom": "^18.0.1"
25
25
  },
26
26
  "resolutions": {
27
27
  "@types/react": "18.2.4",
@@ -1,4 +1,4 @@
1
- import {ComponentPropsType, computed, designComponent, getComponentCls, onBeforeUnmount, PropType, reactive, RenderNode, useClassCache, useModel, useStyleCache, watch, watchEffect} from "plain-design-composition";
1
+ import {ComponentPropsType, Fragment, computed, designComponent, getComponentCls, onBeforeUnmount, PropType, reactive, RenderNode, useClassCache, useModel, useStyleCache, watch, watchEffect} from "plain-design-composition";
2
2
  import {iPopupAnimation, iPopupCustomOption, iPopupDefaultOption, iPopupPlacement, iPopupTrigger, iPopupUseOption, PopupItemProvide} from "../usePopup/utils/popup.utils";
3
3
  import {Reference} from "../Reference";
4
4
  import {usePopup} from "../usePopup";
@@ -139,7 +139,9 @@ export const Popup = designComponent({
139
139
  const reference = computed(() => {
140
140
  let reference: any = props.reference || state.getReference();
141
141
  if (!!reference) {
142
- if (typeof reference === "function") {reference = reference();}
142
+ if (typeof reference === "function") {
143
+ reference = reference();
144
+ }
143
145
  if (!!reference && !!reference.$el) {
144
146
  reference = reference.$el;
145
147
  }
@@ -155,7 +157,9 @@ export const Popup = designComponent({
155
157
  const stickyReference = computed(() => {
156
158
  let reference: any = props.stickyReference;
157
159
  if (!!reference) {
158
- if (typeof reference === "function") {reference = reference();}
160
+ if (typeof reference === "function") {
161
+ reference = reference();
162
+ }
159
163
  if (!!reference && !!reference.$el) {
160
164
  reference = reference.$el;
161
165
  }
@@ -266,12 +270,16 @@ export const Popup = designComponent({
266
270
  },
267
271
  /*开启之前检查,如果已经禁用则禁止显示*/
268
272
  beforeShow: () => {
269
- if (props.disabled || props.readonly) {return false;}
273
+ if (props.disabled || props.readonly) {
274
+ return false;
275
+ }
270
276
  return props.beforeShow?.();
271
277
  },
272
278
  /*关闭之前检查,如果已经禁用则禁止关闭*/
273
279
  beforeHide: () => {
274
- if (props.disabled || props.readonly) {return false;}
280
+ if (props.disabled || props.readonly) {
281
+ return false;
282
+ }
275
283
  return props.beforeHide?.();
276
284
  },
277
285
 
@@ -284,7 +292,7 @@ export const Popup = designComponent({
284
292
  {(slots.head.isExist() || !!props.title) && (
285
293
  <div className="popper-head">{slots.head(typeof props.title === "function" ? props.title() : props.title)}</div>
286
294
  )}
287
- {slots.popper(typeof props.message === "function" ? props.message() : props.message)}
295
+ <Fragment key="popper">{slots.popper(typeof props.message === "function" ? props.message() : props.message)}</Fragment>
288
296
  </div>
289
297
  );
290
298
 
@@ -346,14 +354,18 @@ export const Popup = designComponent({
346
354
  */
347
355
  if (!!model.value) {
348
356
  const unwatch = watch(() => reference.value, reference => {
349
- if (!reference) {return;}
357
+ if (!reference) {
358
+ return;
359
+ }
350
360
  unwatch();
351
361
  $popup.show(state.getOption());
352
362
  });
353
363
  }
354
364
 
355
365
  onBeforeUnmount(
356
- watch(() => props.watchData, () => {$popup.update(state.getOption());})
366
+ watch(() => props.watchData, () => {
367
+ $popup.update(state.getOption());
368
+ })
357
369
  );
358
370
 
359
371
  const refresh = () => {