@sheinx/hooks 3.5.2-beta.9 → 3.5.3-beta.1
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/common/use-list-select/use-list-select-multiple.js +1 -1
- package/cjs/components/use-datepicker/use-datepicker-format.d.ts +1 -1
- package/cjs/components/use-datepicker/use-datepicker-format.d.ts.map +1 -1
- package/cjs/components/use-datepicker/use-datepicker-format.js +6 -3
- package/cjs/components/use-datepicker/use-datepicker-range.d.ts +2 -0
- package/cjs/components/use-datepicker/use-datepicker-range.d.ts.map +1 -1
- package/cjs/components/use-datepicker/use-datepicker-range.js +15 -0
- package/cjs/components/use-datepicker/use-time.d.ts +1 -1
- package/cjs/components/use-datepicker/use-time.d.ts.map +1 -1
- package/cjs/components/use-datepicker/use-time.js +20 -4
- package/cjs/components/use-datepicker/use-time.type.d.ts +2 -0
- package/cjs/components/use-datepicker/use-time.type.d.ts.map +1 -1
- package/cjs/components/use-datepicker/util.d.ts.map +1 -1
- package/cjs/components/use-datepicker/util.js +5 -2
- package/cjs/components/use-form/form-func-context.d.ts +2 -2
- package/cjs/components/use-form/form-func-context.d.ts.map +1 -1
- package/cjs/components/use-form/use-form-context.type.d.ts +12 -2
- package/cjs/components/use-form/use-form-context.type.d.ts.map +1 -1
- package/cjs/components/use-form/use-form-control/use-form-control.d.ts.map +1 -1
- package/cjs/components/use-form/use-form-control/use-form-control.js +6 -6
- package/cjs/components/use-form/use-form-control/use-form-control.type.d.ts +4 -0
- package/cjs/components/use-form/use-form-control/use-form-control.type.d.ts.map +1 -1
- package/cjs/components/use-form/use-form-fieldset/use-form-fieldset.d.ts.map +1 -1
- package/cjs/components/use-form/use-form-fieldset/use-form-fieldset.js +2 -1
- package/cjs/components/use-form/use-form.d.ts +5 -3
- package/cjs/components/use-form/use-form.d.ts.map +1 -1
- package/cjs/components/use-form/use-form.js +109 -38
- package/cjs/components/use-form/use-form.type.d.ts +27 -7
- package/cjs/components/use-form/use-form.type.d.ts.map +1 -1
- package/cjs/components/use-table/use-table-expand.d.ts.map +1 -1
- package/cjs/components/use-table/use-table-expand.js +3 -2
- package/cjs/components/use-tabs/context.d.ts +3 -3
- package/cjs/components/use-tabs/context.d.ts.map +1 -1
- package/cjs/components/use-tabs/context.js +4 -1
- package/cjs/components/use-tabs/context.type.d.ts +15 -3
- package/cjs/components/use-tabs/context.type.d.ts.map +1 -1
- package/cjs/components/use-tabs/use-tabs.d.ts +4 -2
- package/cjs/components/use-tabs/use-tabs.d.ts.map +1 -1
- package/cjs/components/use-tabs/use-tabs.js +6 -0
- package/cjs/components/use-tree/use-tree.d.ts.map +1 -1
- package/cjs/components/use-tree/use-tree.js +2 -1
- package/cjs/components/use-upload/xhr.d.ts.map +1 -1
- package/cjs/components/use-upload/xhr.js +2 -1
- package/cjs/utils/dom/element.d.ts +2 -0
- package/cjs/utils/dom/element.d.ts.map +1 -1
- package/cjs/utils/dom/element.js +25 -0
- package/cjs/utils/index.d.ts +1 -0
- package/cjs/utils/index.d.ts.map +1 -1
- package/cjs/utils/index.js +12 -0
- package/cjs/utils/lazyload.d.ts.map +1 -1
- package/cjs/utils/lazyload.js +8 -2
- package/cjs/utils/number.d.ts.map +1 -1
- package/cjs/utils/number.js +2 -1
- package/cjs/utils/render.d.ts.map +1 -1
- package/cjs/utils/render.js +2 -1
- package/cjs/utils/rule/length.d.ts.map +1 -1
- package/cjs/utils/rule/length.js +2 -1
- package/cjs/utils/rule/regexp.d.ts.map +1 -1
- package/cjs/utils/rule/regexp.js +2 -1
- package/cjs/utils/rule/rule.d.ts.map +1 -1
- package/cjs/utils/rule/rule.js +3 -2
- package/cjs/utils/validate/get-rule.js +1 -1
- package/cjs/utils/validate/type.d.ts.map +1 -1
- package/cjs/utils/validate/type.js +2 -1
- package/cjs/utils/warning.d.ts +8 -0
- package/cjs/utils/warning.d.ts.map +1 -0
- package/cjs/utils/warning.js +36 -0
- package/esm/common/use-list-select/use-list-select-multiple.js +1 -1
- package/esm/components/use-datepicker/use-datepicker-format.d.ts +1 -1
- package/esm/components/use-datepicker/use-datepicker-format.d.ts.map +1 -1
- package/esm/components/use-datepicker/use-datepicker-format.js +6 -3
- package/esm/components/use-datepicker/use-datepicker-range.d.ts +2 -0
- package/esm/components/use-datepicker/use-datepicker-range.d.ts.map +1 -1
- package/esm/components/use-datepicker/use-datepicker-range.js +15 -0
- package/esm/components/use-datepicker/use-time.d.ts +1 -1
- package/esm/components/use-datepicker/use-time.d.ts.map +1 -1
- package/esm/components/use-datepicker/use-time.js +20 -4
- package/esm/components/use-datepicker/use-time.type.d.ts +2 -0
- package/esm/components/use-datepicker/use-time.type.d.ts.map +1 -1
- package/esm/components/use-datepicker/util.d.ts.map +1 -1
- package/esm/components/use-datepicker/util.js +4 -2
- package/esm/components/use-form/form-func-context.d.ts +2 -2
- package/esm/components/use-form/form-func-context.d.ts.map +1 -1
- package/esm/components/use-form/use-form-context.type.d.ts +12 -2
- package/esm/components/use-form/use-form-context.type.d.ts.map +1 -1
- package/esm/components/use-form/use-form-control/use-form-control.d.ts.map +1 -1
- package/esm/components/use-form/use-form-control/use-form-control.js +6 -6
- package/esm/components/use-form/use-form-control/use-form-control.type.d.ts +4 -0
- package/esm/components/use-form/use-form-control/use-form-control.type.d.ts.map +1 -1
- package/esm/components/use-form/use-form-fieldset/use-form-fieldset.d.ts.map +1 -1
- package/esm/components/use-form/use-form-fieldset/use-form-fieldset.js +2 -1
- package/esm/components/use-form/use-form.d.ts +5 -3
- package/esm/components/use-form/use-form.d.ts.map +1 -1
- package/esm/components/use-form/use-form.js +109 -38
- package/esm/components/use-form/use-form.type.d.ts +27 -7
- package/esm/components/use-form/use-form.type.d.ts.map +1 -1
- package/esm/components/use-table/use-table-expand.d.ts.map +1 -1
- package/esm/components/use-table/use-table-expand.js +3 -2
- package/esm/components/use-tabs/context.d.ts +3 -3
- package/esm/components/use-tabs/context.d.ts.map +1 -1
- package/esm/components/use-tabs/context.js +4 -1
- package/esm/components/use-tabs/context.type.d.ts +15 -3
- package/esm/components/use-tabs/context.type.d.ts.map +1 -1
- package/esm/components/use-tabs/use-tabs.d.ts +4 -2
- package/esm/components/use-tabs/use-tabs.d.ts.map +1 -1
- package/esm/components/use-tabs/use-tabs.js +6 -0
- package/esm/components/use-tree/use-tree.d.ts.map +1 -1
- package/esm/components/use-tree/use-tree.js +2 -1
- package/esm/components/use-upload/xhr.d.ts.map +1 -1
- package/esm/components/use-upload/xhr.js +2 -1
- package/esm/utils/dom/element.d.ts +2 -0
- package/esm/utils/dom/element.d.ts.map +1 -1
- package/esm/utils/dom/element.js +23 -0
- package/esm/utils/index.d.ts +1 -0
- package/esm/utils/index.d.ts.map +1 -1
- package/esm/utils/index.js +1 -0
- package/esm/utils/lazyload.d.ts.map +1 -1
- package/esm/utils/lazyload.js +9 -3
- package/esm/utils/number.d.ts.map +1 -1
- package/esm/utils/number.js +2 -1
- package/esm/utils/render.d.ts.map +1 -1
- package/esm/utils/render.js +2 -1
- package/esm/utils/rule/length.d.ts.map +1 -1
- package/esm/utils/rule/length.js +2 -1
- package/esm/utils/rule/regexp.d.ts.map +1 -1
- package/esm/utils/rule/regexp.js +2 -1
- package/esm/utils/rule/rule.d.ts.map +1 -1
- package/esm/utils/rule/rule.js +3 -2
- package/esm/utils/validate/get-rule.js +1 -1
- package/esm/utils/validate/type.d.ts.map +1 -1
- package/esm/utils/validate/type.js +2 -1
- package/esm/utils/warning.d.ts +8 -0
- package/esm/utils/warning.d.ts.map +1 -0
- package/esm/utils/warning.js +30 -0
- package/package.json +1 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"context.type.d.ts","sourceRoot":"","sources":["context.type.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,MAAM,WAAW,gBAAgB;
|
1
|
+
{"version":3,"file":"context.type.d.ts","sourceRoot":"","sources":["context.type.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,MAAM,WAAW,gBAAgB,CAAC,OAAO,GAAG,GAAG;IAC7C;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB;;OAEG;IACH,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;OAEG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,KAAK,IAAI,CAAC;IAC1C;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B;;OAEG;IACH,IAAI,EAAE,OAAO,EAAE,CAAC;IAChB;;OAEG;IACH,OAAO,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC,CAAC,CAAA;IACxD;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,iBAAiB,CAAC,OAAO;IACxC,KAAK,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACjC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B"}
|
@@ -1,9 +1,11 @@
|
|
1
1
|
/// <reference types="react" />
|
2
2
|
import { BaseTabsProps } from './use-tabs.type';
|
3
|
-
declare const useTabs: (props: BaseTabsProps) => {
|
3
|
+
declare const useTabs: <TabData = any>(props: BaseTabsProps) => {
|
4
4
|
active: string | number | undefined;
|
5
5
|
onChange: (key: string | number) => void;
|
6
|
-
|
6
|
+
tabs: TabData[];
|
7
|
+
setTabs: import("react").Dispatch<import("react").SetStateAction<TabData[]>>;
|
8
|
+
Provider: <TabData_1>(props: import("./context.type").TabsProviderProps<TabData_1>) => JSX.Element;
|
7
9
|
};
|
8
10
|
export default useTabs;
|
9
11
|
//# sourceMappingURL=use-tabs.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"use-tabs.d.ts","sourceRoot":"","sources":["use-tabs.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,QAAA,MAAM,OAAO,
|
1
|
+
{"version":3,"file":"use-tabs.d.ts","sourceRoot":"","sources":["use-tabs.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,QAAA,MAAM,OAAO,yBAA0B,aAAa;;oBAYvB,MAAM,GAAG,MAAM;;;;CAY3C,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
@@ -15,6 +15,10 @@ var useTabs = function useTabs(props) {
|
|
15
15
|
_useState2 = _slicedToArray(_useState, 2),
|
16
16
|
activeTabs = _useState2[0],
|
17
17
|
setActiveTabs = _useState2[1];
|
18
|
+
var _useState3 = useState([]),
|
19
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
20
|
+
tabs = _useState4[0],
|
21
|
+
setTabs = _useState4[1];
|
18
22
|
var getActive = function getActive() {
|
19
23
|
if (props.active === undefined) {
|
20
24
|
return activeTabs;
|
@@ -28,6 +32,8 @@ var useTabs = function useTabs(props) {
|
|
28
32
|
return {
|
29
33
|
active: getActive(),
|
30
34
|
onChange: handleChange,
|
35
|
+
tabs: tabs,
|
36
|
+
setTabs: setTabs,
|
31
37
|
Provider: Provider
|
32
38
|
};
|
33
39
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"use-tree.d.ts","sourceRoot":"","sources":["use-tree.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,aAAa,EAKb,SAAS,EACV,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;
|
1
|
+
{"version":3,"file":"use-tree.d.ts","sourceRoot":"","sources":["use-tree.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,aAAa,EAKb,SAAS,EACV,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAUjD,eAAO,MAAM,IAAI;IACf;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;CAEJ,CAAC;AAEF,QAAA,MAAM,OAAO;;;;;CA4bZ,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
@@ -13,6 +13,7 @@ import useLatestObj from "../../common/use-latest-obj";
|
|
13
13
|
import { useInputAble } from "../../common/use-input-able";
|
14
14
|
import { usePersistFn } from "../../common/use-persist-fn";
|
15
15
|
import { isFunc, isString, isNumber, isArray, isUnMatchedData } from "../../utils/is";
|
16
|
+
import { devUseWarning } from "../../utils";
|
16
17
|
function toArray(value) {
|
17
18
|
if (!value) return [];
|
18
19
|
if (!Array.isArray(value)) return [value];
|
@@ -229,7 +230,7 @@ var useTree = function useTree(props) {
|
|
229
230
|
var id = getKey(item, path[path.length - 1], i);
|
230
231
|
// 重复 id 警告
|
231
232
|
if (context.dataMap.get(id)) {
|
232
|
-
|
233
|
+
devUseWarning.error("There is already a key \"".concat(id, "\" exists. The key must be unique."));
|
233
234
|
continue;
|
234
235
|
}
|
235
236
|
// 制作 data mapping
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"xhr.d.ts","sourceRoot":"","sources":["xhr.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"xhr.d.ts","sourceRoot":"","sources":["xhr.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAoBlD,MAAM,CAAC,OAAO,WAAW,IAAI,EAAE,aAAa,CAAC,GAAG,CAAC,8BA8ChD"}
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { devUseWarning } from "../../utils";
|
1
2
|
function createCORSRequest(method, url) {
|
2
3
|
var xhr = new XMLHttpRequest();
|
3
4
|
if ('withCredentials' in xhr) {
|
@@ -28,7 +29,7 @@ export default function (args) {
|
|
28
29
|
onStart = args.onStart,
|
29
30
|
responseType = args.responseType;
|
30
31
|
if (!url) {
|
31
|
-
|
32
|
+
devUseWarning.error("action is required, but its value is ".concat(url));
|
32
33
|
return undefined;
|
33
34
|
}
|
34
35
|
var data = new FormData();
|
@@ -13,6 +13,8 @@ export declare const addResizeObserver: (el: HTMLElement, handler: any, options?
|
|
13
13
|
}) => () => void;
|
14
14
|
export declare function getParent(el: HTMLElement | null | Element, target?: string | HTMLElement): Element | null;
|
15
15
|
export declare function getClosestScrollContainer(element: HTMLElement | null): HTMLElement | null;
|
16
|
+
export declare function getClosestFixedContainer(element: Element | HTMLElement | null): HTMLElement | null;
|
16
17
|
export declare function cssSupport(attr: keyof CSSStyleDeclaration, value: string): boolean;
|
17
18
|
export declare const parsePxToNumber: (str: string) => number;
|
19
|
+
export declare const getFieldId: (name?: string, formName?: string) => string | undefined;
|
18
20
|
//# sourceMappingURL=element.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"element.d.ts","sourceRoot":"","sources":["element.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAa1B;;;;;;GAMG;AACH,wBAAgB,QAAQ,CACtB,QAAQ,EAAE,KAAK,CAAC,SAAS,EACzB,WAAW,UAAQ,EACnB,SAAS,CAAC,EAAE,MAAM,GACjB,KAAK,CAAC,SAAS,CASjB;AAGD,eAAO,MAAM,iBAAiB,OACxB,WAAW,WACN,GAAG;;;gBA4Cb,CAAC;AAEF,wBAAgB,SAAS,CAAC,EAAE,EAAE,WAAW,GAAG,IAAI,GAAG,OAAO,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,WAAW,kBAmBxF;AAED,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,GAAG,WAAW,GAAG,IAAI,
|
1
|
+
{"version":3,"file":"element.d.ts","sourceRoot":"","sources":["element.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAa1B;;;;;;GAMG;AACH,wBAAgB,QAAQ,CACtB,QAAQ,EAAE,KAAK,CAAC,SAAS,EACzB,WAAW,UAAQ,EACnB,SAAS,CAAC,EAAE,MAAM,GACjB,KAAK,CAAC,SAAS,CASjB;AAGD,eAAO,MAAM,iBAAiB,OACxB,WAAW,WACN,GAAG;;;gBA4Cb,CAAC;AAEF,wBAAgB,SAAS,CAAC,EAAE,EAAE,WAAW,GAAG,IAAI,GAAG,OAAO,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,WAAW,kBAmBxF;AAED,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,GAAG,WAAW,GAAG,IAAI,CAmCzF;AAED,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,OAAO,GAAG,WAAW,GAAG,IAAI,sBAqB7E;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,mBAAmB,EAAE,KAAK,EAAE,MAAM,WAYxE;AAED,eAAO,MAAM,eAAe,QAAS,MAAM,WAAwC,CAAC;AAEpF,eAAO,MAAM,UAAU,UAAW,MAAM,aAAa,MAAM,uBAG1D,CAAC"}
|
package/esm/utils/dom/element.js
CHANGED
@@ -145,6 +145,25 @@ export function getClosestScrollContainer(element) {
|
|
145
145
|
// 如果没有找到可滚动的祖先,返回 body 或 documentElement
|
146
146
|
return document.scrollingElement || document.documentElement;
|
147
147
|
}
|
148
|
+
export function getClosestFixedContainer(element) {
|
149
|
+
if (!element) {
|
150
|
+
return null;
|
151
|
+
}
|
152
|
+
var isFixable = function isFixable(el) {
|
153
|
+
var style = window.getComputedStyle(el);
|
154
|
+
return style.position === 'fixed';
|
155
|
+
};
|
156
|
+
|
157
|
+
// 遍历父元素
|
158
|
+
var parent = element.parentElement;
|
159
|
+
while (parent) {
|
160
|
+
if (isFixable(parent)) {
|
161
|
+
return parent;
|
162
|
+
}
|
163
|
+
parent = parent.parentElement;
|
164
|
+
}
|
165
|
+
return null;
|
166
|
+
}
|
148
167
|
export function cssSupport(attr, value) {
|
149
168
|
if (isBrowser()) {
|
150
169
|
var element = document.createElement('div');
|
@@ -160,4 +179,8 @@ export function cssSupport(attr, value) {
|
|
160
179
|
}
|
161
180
|
export var parsePxToNumber = function parsePxToNumber(str) {
|
162
181
|
return Number(str.replace(/\s+|px/gi, ''));
|
182
|
+
};
|
183
|
+
export var getFieldId = function getFieldId(name, formName) {
|
184
|
+
if (!name) return undefined;
|
185
|
+
return "".concat(formName ? "".concat(formName, "_") : '').concat(name);
|
163
186
|
};
|
package/esm/utils/index.d.ts
CHANGED
package/esm/utils/index.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,MAAM,CAAC;AACrB,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAC3E,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC"}
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,MAAM,CAAC;AACrB,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAC3E,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC"}
|
package/esm/utils/index.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"lazyload.d.ts","sourceRoot":"","sources":["lazyload.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"lazyload.d.ts","sourceRoot":"","sources":["lazyload.ts"],"names":[],"mappings":"AAKA,KAAK,UAAU,GAAG;IAChB,SAAS,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,oBAAoB,CAAC;CACjC,CAAC;AAsBF,wBAAgB,QAAQ,SAgBvB;AAWD,wBAAgB,WAAW,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,EAAE,cAAc,CAAC,EAAE,OAAO,QAUvE;AAyBD,wBAAgB,QAAQ,CAAC,GAAG,EAAE,UAAU,iBA4BvC"}
|
package/esm/utils/lazyload.js
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
import { generateUUID, docSize } from "../utils";
|
1
|
+
import { generateUUID, docSize, devUseWarning } from "../utils";
|
2
|
+
import { getClosestFixedContainer } from "./dom/element";
|
2
3
|
var throttle = 80;
|
3
4
|
var components = {};
|
4
5
|
var timeout = null;
|
@@ -7,7 +8,10 @@ var winHeight = docSize.height;
|
|
7
8
|
var getRect = function getRect(el) {
|
8
9
|
// document or invalid element
|
9
10
|
if (!el || !el.getBoundingClientRect) {
|
10
|
-
if (el)
|
11
|
+
if (el) {
|
12
|
+
devUseWarning.error("the ".concat(el, " is not a element"));
|
13
|
+
}
|
14
|
+
;
|
11
15
|
return {
|
12
16
|
top: 0,
|
13
17
|
bottom: winHeight
|
@@ -58,10 +62,12 @@ export function removeStack(id, removeListener) {
|
|
58
62
|
function getObserver(obj, id) {
|
59
63
|
var _obj$container = obj.container,
|
60
64
|
container = _obj$container === void 0 ? null : _obj$container,
|
65
|
+
element = obj.element,
|
61
66
|
offset = obj.offset,
|
62
67
|
render = obj.render,
|
63
68
|
offscreen = obj.offscreen,
|
64
69
|
noRemove = obj.noRemove;
|
70
|
+
var fixedContainer = getClosestFixedContainer(element);
|
65
71
|
var observer = new IntersectionObserver(function (entries) {
|
66
72
|
entries.forEach(function (en) {
|
67
73
|
if (en.isIntersecting || en.intersectionRatio > 0) {
|
@@ -72,7 +78,7 @@ function getObserver(obj, id) {
|
|
72
78
|
}
|
73
79
|
});
|
74
80
|
}, {
|
75
|
-
root: container,
|
81
|
+
root: fixedContainer || container,
|
76
82
|
rootMargin: "".concat(offset, "px")
|
77
83
|
});
|
78
84
|
obj.observer = observer;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"number.d.ts","sourceRoot":"","sources":["number.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"number.d.ts","sourceRoot":"","sources":["number.ts"],"names":[],"mappings":"AAEA,wBAAgB,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,SAAI,YAM3C;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,SAAK,UAEtD;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,OAAO,WAgB1C;AACD,wBAAgB,GAAG,CAAC,MAAM,EAAE,OAAO,WAIlC;AACD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,OAAO,UAgBjD;AAED,wBAAgB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,UAY7C;AAED,wBAAgB,KAAK,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,CAe5D"}
|
package/esm/utils/number.js
CHANGED
@@ -1,8 +1,9 @@
|
|
1
|
+
import { devUseWarning } from "./warning";
|
1
2
|
export function range(end) {
|
2
3
|
var start = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
3
4
|
var delta = end - start;
|
4
5
|
if (typeof delta !== 'number' || Number.isNaN(delta)) {
|
5
|
-
|
6
|
+
devUseWarning.error('end can not computed with start');
|
6
7
|
}
|
7
8
|
return Array.from({
|
8
9
|
length: end - start
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["render.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;
|
1
|
+
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["render.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAG5C,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,GAAG,EAAE,IAAI,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,KAAK,CAAC,SAAS,CAAC;AAE1E,eAAO,MAAM,MAAM,6EAIlB,CAAC;AAQF,wBAAgB,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,SAAS,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,OAAO,mBAMpG"}
|
package/esm/utils/render.js
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
2
|
+
import { devUseWarning } from "./warning";
|
2
3
|
export var render = function render(r) {
|
3
4
|
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
4
5
|
args[_key - 1] = arguments[_key];
|
@@ -16,7 +17,7 @@ function $getKey(gen, d, index) {
|
|
16
17
|
export function getKey(gen, d, index, ignoreError) {
|
17
18
|
var key = $getKey(gen, d, index);
|
18
19
|
if (typeof key !== 'string' && typeof key !== 'number' && !ignoreError) {
|
19
|
-
|
20
|
+
devUseWarning.error("keygen result expect a string or a number, get '".concat(_typeof(key), "'"));
|
20
21
|
}
|
21
22
|
return key;
|
22
23
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"length.d.ts","sourceRoot":"","sources":["length.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;
|
1
|
+
{"version":3,"file":"length.d.ts","sourceRoot":"","sources":["length.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAsB1C,eAAO,MAAM,aAAa;iBAnB4B,UAAU;iBAAV,UAAU;CAsB/D,CAAC;8BAEmB,KAAK,GAAG,KAAK;;YAC1B,MAAM,QAAQ,WAAW;AADjC,wBAWI"}
|
package/esm/utils/rule/length.js
CHANGED
@@ -3,6 +3,7 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
3
3
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
4
4
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
5
5
|
import { deepMerge } from "../object";
|
6
|
+
import { devUseWarning } from "../warning";
|
6
7
|
var createMessage = function createMessage(key) {
|
7
8
|
return function (props) {
|
8
9
|
var lt = '';
|
@@ -32,7 +33,7 @@ export default (function (key) {
|
|
32
33
|
message = _ref.message;
|
33
34
|
return function (len, msg) {
|
34
35
|
if (typeof len !== 'number') {
|
35
|
-
|
36
|
+
devUseWarning.error("Rule \"".concat(key, "\" param expect a number, get ").concat(_typeof(len)));
|
36
37
|
return null;
|
37
38
|
}
|
38
39
|
return deepMerge({
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"regexp.d.ts","sourceRoot":"","sources":["regexp.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;;;
|
1
|
+
{"version":3,"file":"regexp.d.ts","sourceRoot":"","sources":["regexp.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;;;eAM/B,MAAM,GAAG,MAAM,QAAQ,WAAW;AAD7C,wBAaI"}
|
package/esm/utils/rule/regexp.js
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
2
2
|
import { deepMerge } from "../object";
|
3
|
+
import { devUseWarning } from "../warning";
|
3
4
|
var options = {
|
4
5
|
skipUndefined: true
|
5
6
|
};
|
@@ -8,7 +9,7 @@ export default (function () {
|
|
8
9
|
message = _ref.message;
|
9
10
|
return function (regExp, msg) {
|
10
11
|
if (typeof regExp !== 'string' && !(regExp instanceof RegExp)) {
|
11
|
-
|
12
|
+
devUseWarning.error("Rule \"reg\" param expect a RegExp object or a string, get ".concat(_typeof(regExp)));
|
12
13
|
return null;
|
13
14
|
}
|
14
15
|
return deepMerge({
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"rule.d.ts","sourceRoot":"","sources":["rule.ts"],"names":[],"mappings":"AAMA,OAAO,EAEL,gBAAgB,EAChB,cAAc,EACd,UAAU,EAIX,MAAM,aAAa,CAAC;
|
1
|
+
{"version":3,"file":"rule.d.ts","sourceRoot":"","sources":["rule.ts"],"names":[],"mappings":"AAMA,OAAO,EAEL,gBAAgB,EAChB,cAAc,EACd,UAAU,EAIX,MAAM,aAAa,CAAC;AAIrB,eAAO,MAAM,SAAS,gBAAgB,CAAC;AA2BvC,MAAM,CAAC,OAAO,UAAU,IAAI,IAAI,gBAAgB,CAAC;AAEjD,MAAM,CAAC,OAAO,UAAU,IAAI,CAAC,CAAC,SAAS,UAAU,EAC/C,CAAC,EAAE,CAAC,GACH;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,cAAc;CAAE,GAAG,gBAAgB,CAAC;AAEzD,MAAM,CAAC,OAAO,UAAU,IAAI,CAAC,CAAC,SAAS,UAAU,EAAE,CAAC,SAAS,UAAU,EACrE,CAAC,EAAE,CAAC,EACJ,CAAC,EAAE,CAAC,GACH;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,cAAc;CAAE,GAAG,gBAAgB,CAAC;AAE/D,MAAM,CAAC,OAAO,UAAU,IAAI,CAAC,CAAC,SAAS,UAAU,EAAE,CAAC,SAAS,UAAU,EAAE,CAAC,SAAS,UAAU,EAC3F,CAAC,EAAE,CAAC,EACJ,CAAC,EAAE,CAAC,EACJ,CAAC,EAAE,CAAC,GACH;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,cAAc;CAAE,GAAG,gBAAgB,CAAC;AAEnE,MAAM,CAAC,OAAO,UAAU,IAAI,CAC1B,CAAC,SAAS,UAAU,EACpB,CAAC,SAAS,UAAU,EACpB,CAAC,SAAS,UAAU,EACpB,CAAC,SAAS,UAAU,EACpB,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,cAAc;CAAE,GAAG,gBAAgB,CAAC"}
|
package/esm/utils/rule/rule.js
CHANGED
@@ -5,12 +5,13 @@ import required from "./required";
|
|
5
5
|
import length from "./length";
|
6
6
|
import _type from "./type";
|
7
7
|
import regExp from "./regexp";
|
8
|
+
import { devUseWarning } from "../warning";
|
8
9
|
export var RULE_TYPE = 'RULE_OBJECT';
|
9
10
|
var innerType = ['email', 'integer', 'number', 'url', 'json', 'hex', 'rgb', 'ipv4'];
|
10
11
|
var mergeOptions = function mergeOptions() {
|
11
12
|
var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
12
13
|
if (!isObject(opts)) {
|
13
|
-
|
14
|
+
devUseWarning.error("rules expect an object, got ".concat(_typeof(opts)));
|
14
15
|
return {};
|
15
16
|
}
|
16
17
|
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
@@ -59,7 +60,7 @@ export default function Rule() {
|
|
59
60
|
});
|
60
61
|
};
|
61
62
|
} else {
|
62
|
-
|
63
|
+
devUseWarning.error("Rule ".concat(k, " is invalid, expect a function or an object."));
|
63
64
|
}
|
64
65
|
}
|
65
66
|
});
|
@@ -101,7 +101,7 @@ export default function getRule(rule, props) {
|
|
101
101
|
} else if (type) {
|
102
102
|
cb = typeOf(type, po.message);
|
103
103
|
} else {
|
104
|
-
var err = new FormError("Rule ".concat(JSON.stringify(rule), " is not valid."), po);
|
104
|
+
var err = new FormError("[shineout] Rule ".concat(JSON.stringify(rule), " is not valid."), po);
|
105
105
|
console.error(err);
|
106
106
|
throw err;
|
107
107
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["type.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;
|
1
|
+
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["type.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhD,MAAM,MAAM,QAAQ,GAAG,MAAM,OAAO,IAAI,GAAG,MAAM,CAAC;AAElD,eAAO,MAAM,IAAI;;;;;;;;;;CAiEhB,CAAC;+BAIoB,QAAQ,YAAW,WAAW;AAApD,wBA8BK"}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import nullable from "./nullable";
|
2
2
|
import isJson from "./isJson";
|
3
|
+
import { devUseWarning } from "../warning";
|
3
4
|
/* eslint-disable */
|
4
5
|
export var regs = {
|
5
6
|
get email() {
|
@@ -75,7 +76,7 @@ export default (function (type) {
|
|
75
76
|
}
|
76
77
|
var reg = regs[type];
|
77
78
|
if (!reg) {
|
78
|
-
|
79
|
+
devUseWarning.error("Type '".concat(type, "' not existed."));
|
79
80
|
callback(new Error("Validate failured. Type '".concat(type, "' not existed.")));
|
80
81
|
}
|
81
82
|
if (typeof value === 'string' && reg.test(value)) {
|
@@ -0,0 +1,8 @@
|
|
1
|
+
export declare const devUseWarning: {
|
2
|
+
error: (message: string) => void;
|
3
|
+
deprecated: (prop: string, newProp: string, component: string, extraMessage?: string) => void;
|
4
|
+
warn: (message: string) => void;
|
5
|
+
breaking: (message: string) => void;
|
6
|
+
conflict: (component: string, prop1: string, prop2: string) => void;
|
7
|
+
};
|
8
|
+
//# sourceMappingURL=warning.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"warning.d.ts","sourceRoot":"","sources":["warning.ts"],"names":[],"mappings":"AAmCA,eAAO,MAAM,aAAa;qBAJF,MAAM;uBA9BtB,MAAM,WACH,MAAM,aACJ,MAAM,iBACF,MAAM;oBAeG,MAAM;wBANC,MAAM;0BAYH,MAAM,SAAS,MAAM,SAAS,MAAM;CAgBvE,CAAC"}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
var deprecated = function deprecated(prop, newProp, component, extraMessage) {
|
2
|
+
if (process.env.NODE_ENV !== 'production') {
|
3
|
+
console.error("[shineout] '".concat(prop, "' in ").concat(component, " component is deprecated, please use '").concat(newProp, "' instead. ").concat(extraMessage));
|
4
|
+
}
|
5
|
+
};
|
6
|
+
var breakingChange = function breakingChange(message) {
|
7
|
+
if (process.env.NODE_ENV !== 'production') {
|
8
|
+
console.error("[shineout] ".concat(message));
|
9
|
+
}
|
10
|
+
};
|
11
|
+
var devWarn = function devWarn(message) {
|
12
|
+
if (process.env.NODE_ENV !== 'production') {
|
13
|
+
console.warn("[shineout] ".concat(message));
|
14
|
+
}
|
15
|
+
};
|
16
|
+
var conflictWarning = function conflictWarning(component, prop1, prop2) {
|
17
|
+
if (process.env.NODE_ENV !== 'production') {
|
18
|
+
console.warn("[shineout] ".concat(prop1, " and ").concat(prop2, " cannot be used at the same time in ").concat(component, "."));
|
19
|
+
}
|
20
|
+
};
|
21
|
+
var error = function error(message) {
|
22
|
+
console.error(new Error("[shineout] ".concat(message)));
|
23
|
+
};
|
24
|
+
export var devUseWarning = {
|
25
|
+
error: error,
|
26
|
+
deprecated: deprecated,
|
27
|
+
warn: devWarn,
|
28
|
+
breaking: breakingChange,
|
29
|
+
conflict: conflictWarning
|
30
|
+
};
|