@akinon/akiform-builder 0.5.0 → 0.6.0
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormBuilderWatch.d.ts","sourceRoot":"","sources":["../../src/FormBuilderWatch.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC,KAAK,qBAAqB,GAAG;IAC3B,aAAa,EAAE,SAAS,EAAE,CAAC;IAE3B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,CAAC;CACnC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,iDAI1B,qBAAqB,
|
|
1
|
+
{"version":3,"file":"FormBuilderWatch.d.ts","sourceRoot":"","sources":["../../src/FormBuilderWatch.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC,KAAK,qBAAqB,GAAG;IAC3B,aAAa,EAAE,SAAS,EAAE,CAAC;IAE3B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,CAAC;CACnC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,iDAI1B,qBAAqB,sBAgFvB,CAAC"}
|
|
@@ -22,16 +22,13 @@ const FormBuilderWatch = ({ builderFields, handleChange, isDebounced = false })
|
|
|
22
22
|
const isSame = builderFields.every(field => {
|
|
23
23
|
// if field type is datepicker, convert the formWatch value to string before comparing
|
|
24
24
|
if (field.type === 'datepicker') {
|
|
25
|
-
// datepicker would return null if it's cleared by user. turn it into undefined
|
|
26
25
|
if (formWatch[field.key] === null) {
|
|
27
26
|
formWatch[field.key] = undefined;
|
|
28
27
|
}
|
|
29
|
-
// dayjs would return current date if formWatch[field.key] is nullish. So directly compare with formWatch[field.key]
|
|
30
28
|
if (!formWatch[field.key]) {
|
|
31
29
|
return field.value === formWatch[field.key];
|
|
32
30
|
}
|
|
33
|
-
const compareResult = field.value
|
|
34
|
-
(0, dayjs_1.default)(formWatch[field.key]).format('YYYY-MM-DD');
|
|
31
|
+
const compareResult = (0, dayjs_1.default)(field.value).isSame((0, dayjs_1.default)(formWatch[field.key]), 'day');
|
|
35
32
|
return compareResult;
|
|
36
33
|
}
|
|
37
34
|
// TODO write tests for this part because it can be a source of bug
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormBuilderWatch.d.ts","sourceRoot":"","sources":["../../src/FormBuilderWatch.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC,KAAK,qBAAqB,GAAG;IAC3B,aAAa,EAAE,SAAS,EAAE,CAAC;IAE3B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,CAAC;CACnC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,iDAI1B,qBAAqB,
|
|
1
|
+
{"version":3,"file":"FormBuilderWatch.d.ts","sourceRoot":"","sources":["../../src/FormBuilderWatch.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC,KAAK,qBAAqB,GAAG;IAC3B,aAAa,EAAE,SAAS,EAAE,CAAC;IAE3B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,CAAC;CACnC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,iDAI1B,qBAAqB,sBAgFvB,CAAC"}
|
|
@@ -19,16 +19,13 @@ export const FormBuilderWatch = ({ builderFields, handleChange, isDebounced = fa
|
|
|
19
19
|
const isSame = builderFields.every(field => {
|
|
20
20
|
// if field type is datepicker, convert the formWatch value to string before comparing
|
|
21
21
|
if (field.type === 'datepicker') {
|
|
22
|
-
// datepicker would return null if it's cleared by user. turn it into undefined
|
|
23
22
|
if (formWatch[field.key] === null) {
|
|
24
23
|
formWatch[field.key] = undefined;
|
|
25
24
|
}
|
|
26
|
-
// dayjs would return current date if formWatch[field.key] is nullish. So directly compare with formWatch[field.key]
|
|
27
25
|
if (!formWatch[field.key]) {
|
|
28
26
|
return field.value === formWatch[field.key];
|
|
29
27
|
}
|
|
30
|
-
const compareResult = field.value
|
|
31
|
-
dayjs(formWatch[field.key]).format('YYYY-MM-DD');
|
|
28
|
+
const compareResult = dayjs(field.value).isSame(dayjs(formWatch[field.key]), 'day');
|
|
32
29
|
return compareResult;
|
|
33
30
|
}
|
|
34
31
|
// TODO write tests for this part because it can be a source of bug
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@akinon/akiform-builder",
|
|
3
3
|
"description": "Form builder library for form operations.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.6.0",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "dist/esm/index.js",
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
"@akinon/akiform": "0.7.0",
|
|
14
14
|
"@akinon/akival": "0.4.0",
|
|
15
15
|
"@akinon/ui-checkbox": "0.3.0",
|
|
16
|
-
"@akinon/ui-date-picker": "0.3.0",
|
|
17
16
|
"@akinon/ui-input": "0.4.0",
|
|
18
17
|
"@akinon/ui-input-number": "0.3.0",
|
|
19
18
|
"@akinon/ui-select": "0.3.0",
|
|
19
|
+
"@akinon/ui-date-picker": "0.3.0",
|
|
20
20
|
"@akinon/ui-button": "0.5.0"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"rimraf": "^5.0.5",
|
|
26
26
|
"typescript": "^5.2.2",
|
|
27
27
|
"@akinon/typescript-config": "0.2.0",
|
|
28
|
-
"@akinon/
|
|
29
|
-
"@akinon/
|
|
28
|
+
"@akinon/vite-config": "0.4.0",
|
|
29
|
+
"@akinon/eslint-config": "0.1.0"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"react": ">=18",
|