@sheinx/hooks 3.10.0-beta.2 → 3.10.0-beta.20

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.
@@ -5,7 +5,7 @@ declare const useInputFormat: (props: InputFormatProps) => {
5
5
  onBlur: (e: React.FocusEvent<HTMLInputElement>) => void;
6
6
  onFocus: (e: React.FocusEvent<HTMLInputElement>) => void;
7
7
  value: string | undefined;
8
- type: "search" | (string & {}) | "color" | "button" | "time" | "reset" | "submit" | "email" | "url" | "range" | "tel" | "hidden" | "image" | "checkbox" | "radio" | "text" | "date" | "datetime-local" | "file" | "month" | "password" | "week" | undefined;
8
+ type: "search" | (string & {}) | "color" | "button" | "time" | "reset" | "submit" | "email" | "url" | "range" | "tel" | "hidden" | "checkbox" | "radio" | "text" | "image" | "date" | "datetime-local" | "file" | "month" | "password" | "week" | undefined;
9
9
  };
10
10
  export default useInputFormat;
11
11
  //# sourceMappingURL=use-input-format.d.ts.map
@@ -8,7 +8,7 @@ declare const useNumberFormat: (props: InputNumberProps) => {
8
8
  onBlur: (e: React.FocusEvent<HTMLInputElement, Element>) => void;
9
9
  onFocus: (e: React.FocusEvent<HTMLInputElement, Element>) => void;
10
10
  value: string | undefined;
11
- type: "search" | (string & {}) | "color" | "button" | "time" | "reset" | "submit" | "email" | "url" | "range" | "tel" | "hidden" | "image" | "checkbox" | "radio" | "text" | "date" | "datetime-local" | "file" | "month" | "password" | "week" | undefined;
11
+ type: "search" | (string & {}) | "color" | "button" | "time" | "reset" | "submit" | "email" | "url" | "range" | "tel" | "hidden" | "checkbox" | "radio" | "text" | "image" | "date" | "datetime-local" | "file" | "month" | "password" | "week" | undefined;
12
12
  };
13
13
  export default useNumberFormat;
14
14
  //# sourceMappingURL=use-input-number.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-table-layout.d.ts","sourceRoot":"","sources":["use-table-layout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6C,MAAM,OAAO,CA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AAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,QAAA,MAAM,cAAc,UAAW,mBAAmB;;;;;;;;;;;yBAiDX,MAAM,UAAU,MAAM;;;;;;;CA2R5D,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -134,7 +134,9 @@ var useTableLayout = function useTableLayout(props) {
134
134
  context.clientWidth = scrollEl.clientWidth;
135
135
  if (scrollEl.clientHeight === 0) return;
136
136
  var overHeight = scrollEl.scrollHeight > scrollEl.clientHeight;
137
- var overWidth = scrollEl.scrollWidth > context.clientWidth;
137
+ // 使用 > 1 容差,与 checkFloat 中 floatRight 的判断保持一致
138
+ // 避免缩放比例下亚像素误差导致 isScrollX=true 但 floatRight=false 的不一致状态
139
+ var overWidth = scrollEl.scrollWidth - context.clientWidth > 1;
138
140
  var newScrollBarWidth = overHeight ? scrollEl.offsetWidth - scrollEl.clientWidth : 0;
139
141
  if (newScrollBarWidth !== scrollBarWidth) setScrollBarWidth(newScrollBarWidth);
140
142
  if (overWidth !== isScrollX) setIsScrollX(overWidth);
@@ -1 +1 @@
1
- {"version":3,"file":"use-upload.d.ts","sourceRoot":"","sources":["use-upload.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAa,MAAM,mBAAmB,CAAC;AAiC1E,QAAA,MAAM,SAAS;;;;;;0BAiM+B,IAAI,EAAE;yBAoFb,MAAM;6BAqBF,MAAM;8BAqBL,MAAM;;CA2BjD,CAAC;AAEF,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"use-upload.d.ts","sourceRoot":"","sources":["use-upload.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAa,MAAM,mBAAmB,CAAC;AAiC1E,QAAA,MAAM,SAAS;;;;;;0BAiM+B,IAAI,EAAE;yBAkFb,MAAM;6BAqBF,MAAM;8BAqBL,MAAM;;CA2BjD,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -387,12 +387,12 @@ var useUpload = function useUpload(props) {
387
387
  _context2.next = 36;
388
388
  break;
389
389
  }
390
- beforeUploadResult = props.beforeUpload(blob); // @ts-ignoreq
390
+ beforeUploadResult = props.beforeUpload(blob);
391
391
  if (!(beforeUploadResult && beforeUploadResult.then)) {
392
392
  _context2.next = 34;
393
393
  break;
394
394
  }
395
- props.beforeUpload(blob).then(function (args) {
395
+ beforeUploadResult.then(function (args) {
396
396
  if (args.status !== 'error') {
397
397
  newFiles[id].xhr = uploadFile(id, blob, fileRecord.src);
398
398
  setFiles(function (prev) {
@@ -52,7 +52,7 @@ export interface UseUploadProps<ValueItem = any> {
52
52
  headers?: ObjectType;
53
53
  /**
54
54
  * @en The filename received by the server. If it is not filled in, use the name.
55
- * @cn 服务端接收的 filename,不填使用 name
55
+ * @cn 服务端接收的 filename,取值规则是: htmlName ?? name ?? "file"
56
56
  */
57
57
  htmlName?: string;
58
58
  /**
@@ -5,7 +5,7 @@ declare const useInputFormat: (props: InputFormatProps) => {
5
5
  onBlur: (e: React.FocusEvent<HTMLInputElement>) => void;
6
6
  onFocus: (e: React.FocusEvent<HTMLInputElement>) => void;
7
7
  value: string | undefined;
8
- type: "search" | (string & {}) | "color" | "button" | "time" | "reset" | "submit" | "email" | "url" | "range" | "tel" | "hidden" | "image" | "checkbox" | "radio" | "text" | "date" | "datetime-local" | "file" | "month" | "password" | "week" | undefined;
8
+ type: "search" | (string & {}) | "color" | "button" | "time" | "reset" | "submit" | "email" | "url" | "range" | "tel" | "hidden" | "checkbox" | "radio" | "text" | "image" | "date" | "datetime-local" | "file" | "month" | "password" | "week" | undefined;
9
9
  };
10
10
  export default useInputFormat;
11
11
  //# sourceMappingURL=use-input-format.d.ts.map
@@ -8,7 +8,7 @@ declare const useNumberFormat: (props: InputNumberProps) => {
8
8
  onBlur: (e: React.FocusEvent<HTMLInputElement, Element>) => void;
9
9
  onFocus: (e: React.FocusEvent<HTMLInputElement, Element>) => void;
10
10
  value: string | undefined;
11
- type: "search" | (string & {}) | "color" | "button" | "time" | "reset" | "submit" | "email" | "url" | "range" | "tel" | "hidden" | "image" | "checkbox" | "radio" | "text" | "date" | "datetime-local" | "file" | "month" | "password" | "week" | undefined;
11
+ type: "search" | (string & {}) | "color" | "button" | "time" | "reset" | "submit" | "email" | "url" | "range" | "tel" | "hidden" | "checkbox" | "radio" | "text" | "image" | "date" | "datetime-local" | "file" | "month" | "password" | "week" | undefined;
12
12
  };
13
13
  export default useNumberFormat;
14
14
  //# sourceMappingURL=use-input-number.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-table-layout.d.ts","sourceRoot":"","sources":["use-table-layout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6C,MAAM,OAAO,CAAC;AAKlE,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AA0CrE,MAAM,WAAW,mBACf,SAAQ,IAAI,CACV,cAAc,CAAC,GAAG,CAAC,EACnB,MAAM,GAAG,kBAAkB,GAAG,iBAAiB,GAAG,gBAAgB,GAAG,OAAO,CAC7E;IACD,OAAO,EAAE,iBAAiB,CAAC,GAAG,CAAC,EAAE,CAAC;IAClC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACvC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACvC,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACxC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,QAAA,MAAM,cAAc,UAAW,mBAAmB;;;;;;;;;;;yBA+CX,MAAM,UAAU,MAAM;;;;;;;CA2R5D,CAAC;AAEF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"use-table-layout.d.ts","sourceRoot":"","sources":["use-table-layout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6C,MAAM,OAAO,CAAC;AAKlE,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AA0CrE,MAAM,WAAW,mBACf,SAAQ,IAAI,CACV,cAAc,CAAC,GAAG,CAAC,EACnB,MAAM,GAAG,kBAAkB,GAAG,iBAAiB,GAAG,gBAAgB,GAAG,OAAO,CAC7E;IACD,OAAO,EAAE,iBAAiB,CAAC,GAAG,CAAC,EAAE,CAAC;IAClC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACvC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACvC,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACxC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,QAAA,MAAM,cAAc,UAAW,mBAAmB;;;;;;;;;;;yBAiDX,MAAM,UAAU,MAAM;;;;;;;CA2R5D,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -125,7 +125,9 @@ var useTableLayout = function useTableLayout(props) {
125
125
  context.clientWidth = scrollEl.clientWidth;
126
126
  if (scrollEl.clientHeight === 0) return;
127
127
  var overHeight = scrollEl.scrollHeight > scrollEl.clientHeight;
128
- var overWidth = scrollEl.scrollWidth > context.clientWidth;
128
+ // 使用 > 1 容差,与 checkFloat 中 floatRight 的判断保持一致
129
+ // 避免缩放比例下亚像素误差导致 isScrollX=true 但 floatRight=false 的不一致状态
130
+ var overWidth = scrollEl.scrollWidth - context.clientWidth > 1;
129
131
  var newScrollBarWidth = overHeight ? scrollEl.offsetWidth - scrollEl.clientWidth : 0;
130
132
  if (newScrollBarWidth !== scrollBarWidth) setScrollBarWidth(newScrollBarWidth);
131
133
  if (overWidth !== isScrollX) setIsScrollX(overWidth);
@@ -1 +1 @@
1
- {"version":3,"file":"use-upload.d.ts","sourceRoot":"","sources":["use-upload.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAa,MAAM,mBAAmB,CAAC;AAiC1E,QAAA,MAAM,SAAS;;;;;;0BAiM+B,IAAI,EAAE;yBAoFb,MAAM;6BAqBF,MAAM;8BAqBL,MAAM;;CA2BjD,CAAC;AAEF,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"use-upload.d.ts","sourceRoot":"","sources":["use-upload.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAa,MAAM,mBAAmB,CAAC;AAiC1E,QAAA,MAAM,SAAS;;;;;;0BAiM+B,IAAI,EAAE;yBAkFb,MAAM;6BAqBF,MAAM;8BAqBL,MAAM;;CA2BjD,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -380,12 +380,12 @@ var useUpload = function useUpload(props) {
380
380
  _context2.next = 36;
381
381
  break;
382
382
  }
383
- beforeUploadResult = props.beforeUpload(blob); // @ts-ignoreq
383
+ beforeUploadResult = props.beforeUpload(blob);
384
384
  if (!(beforeUploadResult && beforeUploadResult.then)) {
385
385
  _context2.next = 34;
386
386
  break;
387
387
  }
388
- props.beforeUpload(blob).then(function (args) {
388
+ beforeUploadResult.then(function (args) {
389
389
  if (args.status !== 'error') {
390
390
  newFiles[id].xhr = uploadFile(id, blob, fileRecord.src);
391
391
  setFiles(function (prev) {
@@ -52,7 +52,7 @@ export interface UseUploadProps<ValueItem = any> {
52
52
  headers?: ObjectType;
53
53
  /**
54
54
  * @en The filename received by the server. If it is not filled in, use the name.
55
- * @cn 服务端接收的 filename,不填使用 name
55
+ * @cn 服务端接收的 filename,取值规则是: htmlName ?? name ?? "file"
56
56
  */
57
57
  htmlName?: string;
58
58
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sheinx/hooks",
3
- "version": "3.10.0-beta.2",
3
+ "version": "3.10.0-beta.20",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "license": "MIT",