@sheinx/hooks 3.9.3-beta.12 → 3.9.3-beta.14
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/cjs/components/use-datepicker/use-date.d.ts.map +1 -1
- package/cjs/components/use-datepicker/use-date.js +11 -2
- package/cjs/components/use-form/use-form-fieldset/fieldset-context.d.ts.map +1 -1
- package/cjs/components/use-form/use-form-fieldset/fieldset-context.js +6 -1
- package/esm/components/use-datepicker/use-date.d.ts.map +1 -1
- package/esm/components/use-datepicker/use-date.js +11 -2
- package/esm/components/use-form/use-form-fieldset/fieldset-context.d.ts.map +1 -1
- package/esm/components/use-form/use-form-fieldset/fieldset-context.js +6 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-date.d.ts","sourceRoot":"","sources":["use-date.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAW/C,QAAA,MAAM,OAAO,UAAW,YAAY;;;;;;;;;;wBAoBX,IAAI;2BAkDD,IAAI;yBAkBN,IAAI;
|
|
1
|
+
{"version":3,"file":"use-date.d.ts","sourceRoot":"","sources":["use-date.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAW/C,QAAA,MAAM,OAAO,UAAW,YAAY;;;;;;;;;;wBAoBX,IAAI;2BAkDD,IAAI;yBAkBN,IAAI;0BA2EH,IAAI;+BAjGC,IAAI;+BAiDJ,IAAI,YAAY,OAAO;0BAnB5B,IAAI;2BAIH,IAAI;;gCAIC,IAAI;;CA0GpC,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -125,15 +125,24 @@ var useDate = function useDate(props) {
|
|
|
125
125
|
var getTimeStr = function getTimeStr() {
|
|
126
126
|
var format = props.format,
|
|
127
127
|
type = props.type;
|
|
128
|
-
if (!props.value) return '';
|
|
129
128
|
if (type !== 'datetime' || !format) return '';
|
|
130
|
-
if (/^[X|x]$/.test(format)) {
|
|
129
|
+
if (/^[X|x]$/.test(_util.default.compatibleFmt(format))) {
|
|
131
130
|
format = 'HH:mm:ss';
|
|
132
131
|
} else {
|
|
133
132
|
var match = format.match(/[H|h].*/);
|
|
134
133
|
// eslint-disable-next-line
|
|
135
134
|
if (match) format = match[0];
|
|
136
135
|
}
|
|
136
|
+
|
|
137
|
+
// 当不存在 props.value 时,根据 format 格式返回默认时间字符串
|
|
138
|
+
if (!props.value) {
|
|
139
|
+
return format.replace(/[Hh]+/g, '00') // HH/hh -> 00
|
|
140
|
+
.replace(/m+/g, '00') // mm -> 00
|
|
141
|
+
.replace(/s+/g, '00') // ss -> 00
|
|
142
|
+
.replace(/S+/g, '0') // SSS -> 0
|
|
143
|
+
.replace(/A/g, 'AM') // A -> AM
|
|
144
|
+
.replace(/a/g, 'am'); // a -> am
|
|
145
|
+
}
|
|
137
146
|
return _util.default.format(props.value, format, options);
|
|
138
147
|
};
|
|
139
148
|
var isInRange = function isInRange(date) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fieldset-context.d.ts","sourceRoot":"","sources":["fieldset-context.ts"],"names":[],"mappings":"AACA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAE7C,eAAO,MAAM,eAAe;;;EAA0D,CAAC;AAGvF,UAAU,cAAc;IACtB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CACzB;AAiBD,eAAO,MAAM,mBAAmB;;;;
|
|
1
|
+
{"version":3,"file":"fieldset-context.d.ts","sourceRoot":"","sources":["fieldset-context.ts"],"names":[],"mappings":"AACA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAE7C,eAAO,MAAM,eAAe;;;EAA0D,CAAC;AAGvF,UAAU,cAAc;IACtB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CACzB;AAiBD,eAAO,MAAM,mBAAmB;;;;CAoB/B,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -36,7 +36,12 @@ var useFieldSetConsumer = exports.useFieldSetConsumer = function useFieldSetCons
|
|
|
36
36
|
path = _React$useContext.path,
|
|
37
37
|
validateFieldSet = _React$useContext.validateFieldSet;
|
|
38
38
|
var bind = _react.default.useMemo(function () {
|
|
39
|
-
|
|
39
|
+
var _bind = path ? (props.bind || []).concat(path) : props.bind;
|
|
40
|
+
// 只有当路径中包含超过1个索引时才需要去掉最后一个索引
|
|
41
|
+
return _bind === null || _bind === void 0 ? void 0 : _bind.map(function (b) {
|
|
42
|
+
var indexCount = (b.match(/\[\d+\]/g) || []).length;
|
|
43
|
+
return indexCount > 1 ? b.replace(/\[\d+\]$/, '') : b;
|
|
44
|
+
});
|
|
40
45
|
}, [path, props.bind]);
|
|
41
46
|
var name = _react.default.useMemo(function () {
|
|
42
47
|
return extendName(path, props.name);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-date.d.ts","sourceRoot":"","sources":["use-date.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAW/C,QAAA,MAAM,OAAO,UAAW,YAAY;;;;;;;;;;wBAoBX,IAAI;2BAkDD,IAAI;yBAkBN,IAAI;
|
|
1
|
+
{"version":3,"file":"use-date.d.ts","sourceRoot":"","sources":["use-date.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAW/C,QAAA,MAAM,OAAO,UAAW,YAAY;;;;;;;;;;wBAoBX,IAAI;2BAkDD,IAAI;yBAkBN,IAAI;0BA2EH,IAAI;+BAjGC,IAAI;+BAiDJ,IAAI,YAAY,OAAO;0BAnB5B,IAAI;2BAIH,IAAI;;gCAIC,IAAI;;CA0GpC,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -119,15 +119,24 @@ var useDate = function useDate(props) {
|
|
|
119
119
|
var getTimeStr = function getTimeStr() {
|
|
120
120
|
var format = props.format,
|
|
121
121
|
type = props.type;
|
|
122
|
-
if (!props.value) return '';
|
|
123
122
|
if (type !== 'datetime' || !format) return '';
|
|
124
|
-
if (/^[X|x]$/.test(format)) {
|
|
123
|
+
if (/^[X|x]$/.test(utils.compatibleFmt(format))) {
|
|
125
124
|
format = 'HH:mm:ss';
|
|
126
125
|
} else {
|
|
127
126
|
var match = format.match(/[H|h].*/);
|
|
128
127
|
// eslint-disable-next-line
|
|
129
128
|
if (match) format = match[0];
|
|
130
129
|
}
|
|
130
|
+
|
|
131
|
+
// 当不存在 props.value 时,根据 format 格式返回默认时间字符串
|
|
132
|
+
if (!props.value) {
|
|
133
|
+
return format.replace(/[Hh]+/g, '00') // HH/hh -> 00
|
|
134
|
+
.replace(/m+/g, '00') // mm -> 00
|
|
135
|
+
.replace(/s+/g, '00') // ss -> 00
|
|
136
|
+
.replace(/S+/g, '0') // SSS -> 0
|
|
137
|
+
.replace(/A/g, 'AM') // A -> AM
|
|
138
|
+
.replace(/a/g, 'am'); // a -> am
|
|
139
|
+
}
|
|
131
140
|
return dateUtil.format(props.value, format, options);
|
|
132
141
|
};
|
|
133
142
|
var isInRange = function isInRange(date) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fieldset-context.d.ts","sourceRoot":"","sources":["fieldset-context.ts"],"names":[],"mappings":"AACA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAE7C,eAAO,MAAM,eAAe;;;EAA0D,CAAC;AAGvF,UAAU,cAAc;IACtB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CACzB;AAiBD,eAAO,MAAM,mBAAmB;;;;
|
|
1
|
+
{"version":3,"file":"fieldset-context.d.ts","sourceRoot":"","sources":["fieldset-context.ts"],"names":[],"mappings":"AACA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAE7C,eAAO,MAAM,eAAe;;;EAA0D,CAAC;AAGvF,UAAU,cAAc;IACtB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CACzB;AAiBD,eAAO,MAAM,mBAAmB;;;;CAoB/B,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -29,7 +29,12 @@ export var useFieldSetConsumer = function useFieldSetConsumer(props) {
|
|
|
29
29
|
path = _React$useContext.path,
|
|
30
30
|
validateFieldSet = _React$useContext.validateFieldSet;
|
|
31
31
|
var bind = React.useMemo(function () {
|
|
32
|
-
|
|
32
|
+
var _bind = path ? (props.bind || []).concat(path) : props.bind;
|
|
33
|
+
// 只有当路径中包含超过1个索引时才需要去掉最后一个索引
|
|
34
|
+
return _bind === null || _bind === void 0 ? void 0 : _bind.map(function (b) {
|
|
35
|
+
var indexCount = (b.match(/\[\d+\]/g) || []).length;
|
|
36
|
+
return indexCount > 1 ? b.replace(/\[\d+\]$/, '') : b;
|
|
37
|
+
});
|
|
33
38
|
}, [path, props.bind]);
|
|
34
39
|
var name = React.useMemo(function () {
|
|
35
40
|
return extendName(path, props.name);
|