@gx-design-vue/pro-utils 0.0.16 → 0.0.18

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/dist/index.d.ts CHANGED
@@ -3,6 +3,7 @@ import { isScroll, getScrollContainer, isInContainer } from './scroll';
3
3
  import scrollTo from './scroll/scrollTo';
4
4
  import getScroll from './scroll/getScroll';
5
5
  import throttleByAnimationFrame from './scroll/throttleByAnimationFrame';
6
+ export * from './isBrowser';
6
7
  export * from './omitBoolean';
7
8
  export * from './omitUndefined';
8
9
  export * from './slots';
package/dist/index.es.js CHANGED
@@ -200,6 +200,17 @@ function throttleByAnimationFrame(fn) {
200
200
  return throttled;
201
201
  }
202
202
 
203
+ const isNode = typeof process !== 'undefined' && process.versions != null && process.versions.node != null;
204
+ const isBrowser = () => {
205
+ if (process.env.NODE_ENV === 'TEST') {
206
+ return true;
207
+ }
208
+ return (typeof window !== 'undefined' &&
209
+ typeof window.document !== 'undefined' &&
210
+ typeof window.matchMedia !== 'undefined' &&
211
+ !isNode);
212
+ };
213
+
203
214
  /**
204
215
  * 剔除 boolean 值
205
216
  * @param {boolean|T} obj
@@ -968,4 +979,4 @@ function off(element, event, handler, useCapture = false) {
968
979
  }
969
980
  }
970
981
 
971
- export { arrayRepeat, blobToDataURL, checkFileType, compareArray, dataURLtoBlob, dataURLtoFile, deepCopy, formatDuraton, genColumnKey, generateVidoePicture, getBase64, getBlobUrl, getFileSuffix, getLevelData, getMaxFloor, getMediaInfos, getPrefixCls, getRandomNumber, getScroll, getScrollContainer, getSlot, getSlotVNode, getSlotsProps, getSortIndex, getVideoCoverPicture, getVideoFileUrl, handleCurrentPage, handleShowIndex, hanndleField, is, isArray, isBase64, isBoolean, isFunction, isInContainer, isNumber, isObject, isScroll, isServer, isString, off, omitBoolean, omitUndefined, on, runFunction, scrollTo, throttleByAnimationFrame, treeData };
982
+ export { arrayRepeat, blobToDataURL, checkFileType, compareArray, dataURLtoBlob, dataURLtoFile, deepCopy, formatDuraton, genColumnKey, generateVidoePicture, getBase64, getBlobUrl, getFileSuffix, getLevelData, getMaxFloor, getMediaInfos, getPrefixCls, getRandomNumber, getScroll, getScrollContainer, getSlot, getSlotVNode, getSlotsProps, getSortIndex, getVideoCoverPicture, getVideoFileUrl, handleCurrentPage, handleShowIndex, hanndleField, is, isArray, isBase64, isBoolean, isBrowser, isFunction, isInContainer, isNumber, isObject, isScroll, isServer, isString, off, omitBoolean, omitUndefined, on, runFunction, scrollTo, throttleByAnimationFrame, treeData };
package/dist/index.js CHANGED
@@ -204,6 +204,17 @@ function throttleByAnimationFrame(fn) {
204
204
  return throttled;
205
205
  }
206
206
 
207
+ const isNode = typeof process !== 'undefined' && process.versions != null && process.versions.node != null;
208
+ const isBrowser = () => {
209
+ if (process.env.NODE_ENV === 'TEST') {
210
+ return true;
211
+ }
212
+ return (typeof window !== 'undefined' &&
213
+ typeof window.document !== 'undefined' &&
214
+ typeof window.matchMedia !== 'undefined' &&
215
+ !isNode);
216
+ };
217
+
207
218
  /**
208
219
  * 剔除 boolean 值
209
220
  * @param {boolean|T} obj
@@ -1005,6 +1016,7 @@ exports.is = is;
1005
1016
  exports.isArray = isArray;
1006
1017
  exports.isBase64 = isBase64;
1007
1018
  exports.isBoolean = isBoolean;
1019
+ exports.isBrowser = isBrowser;
1008
1020
  exports.isFunction = isFunction;
1009
1021
  exports.isInContainer = isInContainer;
1010
1022
  exports.isNumber = isNumber;
@@ -0,0 +1 @@
1
+ export declare const isBrowser: () => boolean;
@@ -2,6 +2,6 @@ import { Slots } from 'vue';
2
2
  import type { CustomRender, WithFalse } from '../typings';
3
3
  export declare function getSlot<T>(slots: Slots, props: Record<string, unknown>, prop?: string): T | false;
4
4
  export declare function getSlotVNode<T>(slots: Slots, props: Record<string, unknown>, prop?: string): T | false;
5
- declare type KeyValue<T, K> = Record<T, K>;
5
+ declare type KeyValue<T extends keyof any, K> = Record<T, K>;
6
6
  export declare function getSlotsProps<T extends keyof any, VNode = WithFalse<CustomRender>>(data: T[], slots: Slots, props: Record<string, unknown>): KeyValue<T, VNode | false>;
7
7
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gx-design-vue/pro-utils",
3
- "version": "0.0.16",
3
+ "version": "0.0.18",
4
4
  "description": "@gx-design-vue/pro-utils",
5
5
  "license": "MIT",
6
6
  "types": "dist/index.d.ts",