phx-react 1.3.19 → 1.3.22
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/cjs/components/FormStep/FormStep.d.ts +4 -1
- package/dist/cjs/components/FormStep/FormStep.js +157 -52
- package/dist/cjs/components/FormStep/FormStep.js.map +1 -1
- package/dist/esm/components/FormStep/FormStep.d.ts +4 -1
- package/dist/esm/components/FormStep/FormStep.js +158 -53
- package/dist/esm/components/FormStep/FormStep.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { UseFormRegisterReturn } from 'react-hook-form';
|
|
2
1
|
import React, { ReactNode } from 'react';
|
|
2
|
+
import { UseFormRegisterReturn } from 'react-hook-form';
|
|
3
3
|
import { FooterBarProps } from '../FormWrap';
|
|
4
4
|
export interface FormStepProps {
|
|
5
5
|
className?: string;
|
|
@@ -20,7 +20,10 @@ export interface FormStepProps {
|
|
|
20
20
|
step: number;
|
|
21
21
|
onNext?: any;
|
|
22
22
|
onBack?: any;
|
|
23
|
+
isNext?: boolean;
|
|
24
|
+
isBack?: boolean;
|
|
23
25
|
}>;
|
|
24
26
|
backRout: any;
|
|
27
|
+
isLoading?: boolean;
|
|
25
28
|
}
|
|
26
29
|
export declare const PHXFormStep: React.FC<FormStepProps>;
|
|
@@ -2,56 +2,152 @@
|
|
|
2
2
|
exports.__esModule = true;
|
|
3
3
|
exports.PHXFormStep = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
|
-
var react_hook_form_1 = require("react-hook-form");
|
|
6
|
-
var react_1 = tslib_1.__importStar(require("react"));
|
|
7
5
|
var solid_1 = require("@heroicons/react/24/solid");
|
|
8
|
-
var
|
|
6
|
+
var react_1 = tslib_1.__importStar(require("react"));
|
|
7
|
+
var react_hook_form_1 = require("react-hook-form");
|
|
9
8
|
var FormWrap_1 = require("../FormWrap");
|
|
9
|
+
var Card_1 = require("../Card");
|
|
10
10
|
var PHXFormStep = function (_a) {
|
|
11
11
|
var _b;
|
|
12
|
-
var
|
|
13
|
-
var
|
|
14
|
-
var
|
|
12
|
+
var backLabel = _a.backLabel, backRout = _a.backRout, className = _a.className, formMode = _a.formMode, _c = _a.isLoading, isLoading = _c === void 0 ? false : _c, nextLabel = _a.nextLabel, onSubmit = _a.onSubmit, _d = _a.size, size = _d === void 0 ? 'large' : _d, steps = _a.steps, title = _a.title, triggerStep = _a.triggerStep;
|
|
13
|
+
var _e = (0, react_1.useState)(1), currentStep = _e[0], setCurrentStep = _e[1];
|
|
14
|
+
var _f = (0, react_1.useState)([]), listSteps = _f[0], setListSteps = _f[1];
|
|
15
15
|
var form = (0, react_hook_form_1.useForm)();
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
16
|
+
var triggerStepRef = (0, react_1.useRef)();
|
|
17
|
+
function findNextStepCurrent(item) {
|
|
18
|
+
return item.step === currentStep + 1 && item.status !== 'complete';
|
|
19
|
+
}
|
|
20
|
+
var nextStep = function (data, stepItem) { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
|
|
21
|
+
var funcCallNextStep, isPass, error_1;
|
|
22
|
+
var _a, _b;
|
|
23
|
+
return tslib_1.__generator(this, function (_c) {
|
|
24
|
+
switch (_c.label) {
|
|
25
|
+
case 0:
|
|
26
|
+
_c.trys.push([0, 3, , 4]);
|
|
27
|
+
funcCallNextStep = (_a = triggerStep === null || triggerStep === void 0 ? void 0 : triggerStep.find(function (func) { return func.step === currentStep; })) === null || _a === void 0 ? void 0 : _a.onNext;
|
|
28
|
+
if (!funcCallNextStep) return [3 /*break*/, 2];
|
|
29
|
+
return [4 /*yield*/, funcCallNextStep()
|
|
30
|
+
// kiểm tra điều kiện xem có pass hay không trước khi cập nhật trạng thái của step
|
|
31
|
+
];
|
|
32
|
+
case 1:
|
|
33
|
+
_c.sent();
|
|
34
|
+
_c.label = 2;
|
|
35
|
+
case 2:
|
|
36
|
+
isPass = (_b = triggerStep === null || triggerStep === void 0 ? void 0 : triggerStep.find(function (func) { return func.step === currentStep; })) === null || _b === void 0 ? void 0 : _b.isNext;
|
|
37
|
+
if (isPass === false)
|
|
38
|
+
return [2 /*return*/];
|
|
39
|
+
if (currentStep === (listSteps === null || listSteps === void 0 ? void 0 : listSteps.length)) {
|
|
40
|
+
onSubmit(data);
|
|
41
|
+
return [2 /*return*/];
|
|
42
|
+
}
|
|
43
|
+
listSteps === null || listSteps === void 0 ? void 0 : listSteps.forEach(function (item) {
|
|
44
|
+
if (findNextStepCurrent(item)) {
|
|
45
|
+
// Cập nhật trạng thái cho thằng step tiếp theo
|
|
46
|
+
item.status = 'current';
|
|
47
|
+
}
|
|
48
|
+
if (item.step === currentStep)
|
|
49
|
+
item.status = 'complete';
|
|
50
|
+
});
|
|
51
|
+
// Kiểm tra xem có thằng StepItem truyền đến không và Step đó phải khác upcoming thì mới cho truyển đến Step đó
|
|
52
|
+
if (stepItem && stepItem.step && stepItem.status !== 'upcoming') {
|
|
53
|
+
setCurrentStep(stepItem.step);
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
setCurrentStep(function (currentStep) { return currentStep + 1; });
|
|
57
|
+
}
|
|
58
|
+
return [3 /*break*/, 4];
|
|
59
|
+
case 3:
|
|
60
|
+
error_1 = _c.sent();
|
|
61
|
+
console.error;
|
|
62
|
+
return [3 /*break*/, 4];
|
|
63
|
+
case 4: return [2 /*return*/];
|
|
25
64
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
65
|
+
});
|
|
66
|
+
}); };
|
|
67
|
+
// Tạo một hàm trung gian để xử lý việc gọi hàm nextStep với tham số bổ sung.
|
|
68
|
+
var handleNextStepWithParam = function (stepItem) { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
|
|
69
|
+
var onSubmitWithParam;
|
|
70
|
+
return tslib_1.__generator(this, function (_a) {
|
|
71
|
+
onSubmitWithParam = form.handleSubmit(function (data) { return nextStep(data, stepItem); });
|
|
72
|
+
onSubmitWithParam();
|
|
73
|
+
return [2 /*return*/];
|
|
74
|
+
});
|
|
75
|
+
}); };
|
|
76
|
+
var handleBackStep = function (stepItem) { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
|
|
77
|
+
var funcCallBackStep, isBack;
|
|
78
|
+
var _a, _b;
|
|
79
|
+
return tslib_1.__generator(this, function (_c) {
|
|
80
|
+
switch (_c.label) {
|
|
81
|
+
case 0:
|
|
82
|
+
funcCallBackStep = (_a = triggerStep === null || triggerStep === void 0 ? void 0 : triggerStep.find(function (func) { return func.step === currentStep; })) === null || _a === void 0 ? void 0 : _a.onBack;
|
|
83
|
+
if (!(funcCallBackStep && formMode !== 'readOnly')) return [3 /*break*/, 2];
|
|
84
|
+
return [4 /*yield*/, funcCallBackStep()
|
|
85
|
+
// kiểm tra điều kiện xem có pass hay không trước khi cập nhật trạng thái của step
|
|
86
|
+
];
|
|
87
|
+
case 1:
|
|
88
|
+
_c.sent();
|
|
89
|
+
_c.label = 2;
|
|
90
|
+
case 2:
|
|
91
|
+
isBack = (_b = triggerStep === null || triggerStep === void 0 ? void 0 : triggerStep.find(function (func) { return func.step === currentStep; })) === null || _b === void 0 ? void 0 : _b.isBack;
|
|
92
|
+
if (isBack === false)
|
|
93
|
+
return [2 /*return*/];
|
|
94
|
+
if (stepItem && stepItem.step) {
|
|
95
|
+
setCurrentStep(stepItem.step);
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
setCurrentStep(function (currentStep) { return currentStep - 1; });
|
|
99
|
+
}
|
|
100
|
+
return [2 /*return*/];
|
|
33
101
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
102
|
+
});
|
|
103
|
+
}); };
|
|
104
|
+
var handleNextStep = function () {
|
|
105
|
+
setCurrentStep(function (currentStep) { return currentStep + 1; });
|
|
39
106
|
};
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
funcCallBackStep();
|
|
45
|
-
if (stepItem && stepItem.step) {
|
|
46
|
-
setCurrentStep(stepItem.step);
|
|
107
|
+
// Hàm kiểm tra hai mảng trigger có cùng nội dung hay không
|
|
108
|
+
var arraysAreEqual = function (arr1, arr2) {
|
|
109
|
+
if ((arr1 === null || arr1 === void 0 ? void 0 : arr1.length) !== (arr2 === null || arr2 === void 0 ? void 0 : arr2.length)) {
|
|
110
|
+
return false;
|
|
47
111
|
}
|
|
48
|
-
|
|
49
|
-
|
|
112
|
+
var compareLength = arr1 === null || arr1 === void 0 ? void 0 : arr1.length;
|
|
113
|
+
for (var i = 0; i < compareLength; i++) {
|
|
114
|
+
if (arr1[i].isBack !== arr2[i].isBack || arr1[i].isNext !== arr2[i].isNext) {
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
50
117
|
}
|
|
118
|
+
return true;
|
|
51
119
|
};
|
|
52
|
-
var
|
|
120
|
+
var triggerNextStep = function () {
|
|
121
|
+
listSteps === null || listSteps === void 0 ? void 0 : listSteps.forEach(function (item) {
|
|
122
|
+
if (item.step === currentStep + 1 && item.status !== 'complete') {
|
|
123
|
+
item.status = 'current';
|
|
124
|
+
}
|
|
125
|
+
if (item.step === currentStep)
|
|
126
|
+
item.status = 'complete';
|
|
127
|
+
});
|
|
53
128
|
setCurrentStep(function (currentStep) { return currentStep + 1; });
|
|
54
129
|
};
|
|
130
|
+
function isEmptyFuncTrigger(funcCallBackStep) {
|
|
131
|
+
return !funcCallBackStep || (funcCallBackStep && !funcCallBackStep.isNext && !funcCallBackStep.isBack);
|
|
132
|
+
}
|
|
133
|
+
function isNextCondition(funcCallBackStep) {
|
|
134
|
+
return funcCallBackStep && funcCallBackStep.isNext && !funcCallBackStep.isBack;
|
|
135
|
+
}
|
|
136
|
+
// Theo dõi triggerStep truyền vào isPass và isNext và chuyển hướng
|
|
137
|
+
(0, react_1.useEffect)(function () {
|
|
138
|
+
if (!arraysAreEqual(triggerStep, triggerStepRef.current)) {
|
|
139
|
+
var funcCallBackStep = triggerStep === null || triggerStep === void 0 ? void 0 : triggerStep.find(function (func) { return func.step === currentStep; });
|
|
140
|
+
if (isEmptyFuncTrigger(funcCallBackStep))
|
|
141
|
+
return;
|
|
142
|
+
if (isNextCondition(funcCallBackStep)) {
|
|
143
|
+
triggerNextStep();
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
setCurrentStep(function (currentStep) { return currentStep - 1; });
|
|
147
|
+
}
|
|
148
|
+
triggerStepRef.current = triggerStep;
|
|
149
|
+
}
|
|
150
|
+
}, [triggerStep]);
|
|
55
151
|
(0, react_1.useEffect)(function () {
|
|
56
152
|
if (steps) {
|
|
57
153
|
var listNew = steps === null || steps === void 0 ? void 0 : steps.map(function (item, index) {
|
|
@@ -62,29 +158,38 @@ var PHXFormStep = function (_a) {
|
|
|
62
158
|
return tslib_1.__assign(tslib_1.__assign({}, item), { status: 'upcoming' });
|
|
63
159
|
}
|
|
64
160
|
});
|
|
65
|
-
if (formMode !== 'addNew')
|
|
161
|
+
if (formMode !== 'addNew') {
|
|
66
162
|
listNew = steps === null || steps === void 0 ? void 0 : steps.map(function (item) { return (tslib_1.__assign(tslib_1.__assign({}, item), { status: 'complete' })); });
|
|
163
|
+
}
|
|
67
164
|
setListSteps(listNew);
|
|
68
165
|
}
|
|
69
166
|
}, []);
|
|
70
167
|
return (react_1["default"].createElement("div", { className: className },
|
|
71
168
|
react_1["default"].createElement(react_hook_form_1.FormProvider, tslib_1.__assign({}, form),
|
|
72
|
-
react_1["default"].createElement(FormWrap_1.PHXFormWrap, { className: 'w-full',
|
|
169
|
+
react_1["default"].createElement(FormWrap_1.PHXFormWrap, { className: 'w-full', footerAction: false, onCancel: backRout, onSubmit: formMode === 'readOnly' ? form.handleSubmit(handleNextStep) : form.handleSubmit(nextStep), size: size, title: title },
|
|
73
170
|
react_1["default"].createElement(Card_1.PHXCard, { primaryFooterAction: {
|
|
74
171
|
content: currentStep === (listSteps === null || listSteps === void 0 ? void 0 : listSteps.length) ? (formMode !== 'readOnly' ? 'Submit' : '') : nextLabel,
|
|
75
|
-
submit: true
|
|
76
|
-
|
|
172
|
+
submit: true,
|
|
173
|
+
loading: isLoading
|
|
174
|
+
}, secondaryFooterActions: [
|
|
175
|
+
{
|
|
176
|
+
content: currentStep !== 1 ? backLabel : '',
|
|
177
|
+
onClick: handleBackStep
|
|
178
|
+
},
|
|
179
|
+
] },
|
|
77
180
|
react_1["default"].createElement("nav", { "aria-label": 'Progress' },
|
|
78
|
-
react_1["default"].createElement("ol", {
|
|
181
|
+
react_1["default"].createElement("ol", { className: 'divide-y divide-gray-300 rounded-md border border-gray-300 md:flex md:divide-y-0', role: 'list' }, listSteps &&
|
|
79
182
|
listSteps.map(function (stepItem, stepIdx) { return (react_1["default"].createElement("li", { key: stepIdx, className: 'relative cursor-pointer md:flex md:flex-1' },
|
|
80
|
-
react_1["default"].createElement("button", {
|
|
81
|
-
return
|
|
82
|
-
|
|
183
|
+
react_1["default"].createElement("button", { disabled: stepItem.step === currentStep, onClick: function () {
|
|
184
|
+
return stepItem.step < currentStep || formMode === 'readOnly'
|
|
185
|
+
? handleBackStep(stepItem)
|
|
186
|
+
: handleNextStepWithParam(stepItem);
|
|
187
|
+
}, type: 'button' },
|
|
83
188
|
stepItem.status === 'complete' ? (react_1["default"].createElement("div", { className: 'group flex w-full items-center' },
|
|
84
189
|
react_1["default"].createElement("span", { className: 'flex items-center px-6 py-3 text-sm font-medium' },
|
|
85
|
-
react_1["default"].createElement("span", { className:
|
|
86
|
-
react_1["default"].createElement(solid_1.CheckIcon, { className: 'h-6 w-6 text-white'
|
|
87
|
-
react_1["default"].createElement("span", { className: 'ml-4 text-sm font-medium text-gray-900' }, stepItem.title)))) : stepItem.status === 'current' ? (react_1["default"].createElement("div", { className: 'flex items-center px-6 py-3 text-sm font-medium'
|
|
190
|
+
react_1["default"].createElement("span", { className: "flex h-10 w-10 flex-shrink-0 items-center justify-center rounded-full bg-indigo-500 group-hover:bg-indigo-700 ".concat(stepItem.step === currentStep && 'bg-indigo-800') },
|
|
191
|
+
react_1["default"].createElement(solid_1.CheckIcon, { "aria-hidden": 'true', className: 'h-6 w-6 text-white' })),
|
|
192
|
+
react_1["default"].createElement("span", { className: 'ml-4 text-sm font-medium text-gray-900' }, stepItem.title)))) : stepItem.status === 'current' ? (react_1["default"].createElement("div", { "aria-current": 'step', className: 'flex items-center px-6 py-3 text-sm font-medium' },
|
|
88
193
|
react_1["default"].createElement("span", { className: 'flex h-10 w-10 flex-shrink-0 items-center justify-center rounded-full border-2 border-indigo-600' },
|
|
89
194
|
react_1["default"].createElement("span", { className: 'text-indigo-600' }, stepItem.step)),
|
|
90
195
|
react_1["default"].createElement("span", { className: 'ml-4 text-sm font-medium text-indigo-600' }, stepItem.title))) : (react_1["default"].createElement("div", { className: 'group flex items-center' },
|
|
@@ -93,10 +198,10 @@ var PHXFormStep = function (_a) {
|
|
|
93
198
|
react_1["default"].createElement("span", { className: 'text-gray-500 group-hover:text-gray-900' }, stepItem.step)),
|
|
94
199
|
react_1["default"].createElement("span", { className: 'ml-4 text-sm font-medium text-gray-500 group-hover:text-gray-900' }, stepItem.title)))),
|
|
95
200
|
stepIdx !== (listSteps === null || listSteps === void 0 ? void 0 : listSteps.length) - 1 ? (react_1["default"].createElement(react_1["default"].Fragment, null,
|
|
96
|
-
react_1["default"].createElement("div", { className: 'absolute right-0 top-0 hidden h-full w-5 md:block'
|
|
97
|
-
react_1["default"].createElement("svg", { className: 'h-full w-full text-gray-300',
|
|
98
|
-
react_1["default"].createElement("path", { d: 'M0 -2L20 40L0 82',
|
|
99
|
-
_b.component)))));
|
|
201
|
+
react_1["default"].createElement("div", { "aria-hidden": 'true', className: 'absolute right-0 top-0 hidden h-full w-5 md:block' },
|
|
202
|
+
react_1["default"].createElement("svg", { className: 'h-full w-full text-gray-300', fill: 'none', preserveAspectRatio: 'none', viewBox: '0 0 22 80' },
|
|
203
|
+
react_1["default"].createElement("path", { d: 'M0 -2L20 40L0 82', stroke: 'currentcolor', strokeLinejoin: 'round', vectorEffect: 'non-scaling-stroke' }))))) : null))); }))),
|
|
204
|
+
react_1["default"].createElement("div", { className: 'pt-3' }, (_b = listSteps === null || listSteps === void 0 ? void 0 : listSteps.find(function (item) { return item.step === currentStep; })) === null || _b === void 0 ? void 0 : _b.component))))));
|
|
100
205
|
};
|
|
101
206
|
exports.PHXFormStep = PHXFormStep;
|
|
102
207
|
//# sourceMappingURL=FormStep.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormStep.js","sourceRoot":"","sources":["../../../../src/components/FormStep/FormStep.tsx"],"names":[],"mappings":";;;;AAAA,
|
|
1
|
+
{"version":3,"file":"FormStep.js","sourceRoot":"","sources":["../../../../src/components/FormStep/FormStep.tsx"],"names":[],"mappings":";;;;AAAA,mDAAqD;AACrD,qDAAqE;AACrE,mDAA8E;AAC9E,wCAAyD;AACzD,gCAAiC;AA4B1B,IAAM,WAAW,GAA4B,UAAC,EAYrC;;QAXd,SAAS,eAAA,EACT,QAAQ,cAAA,EACR,SAAS,eAAA,EACT,QAAQ,cAAA,EACR,iBAAiB,EAAjB,SAAS,mBAAG,KAAK,KAAA,EACjB,SAAS,eAAA,EACT,QAAQ,cAAA,EACR,YAAc,EAAd,IAAI,mBAAG,OAAO,KAAA,EACd,KAAK,WAAA,EACL,KAAK,WAAA,EACL,WAAW,iBAAA;IAEL,IAAA,KAAgC,IAAA,gBAAQ,EAAC,CAAC,CAAC,EAA1C,WAAW,QAAA,EAAE,cAAc,QAAe,CAAA;IAC3C,IAAA,KAA4B,IAAA,gBAAQ,EAAyB,EAAE,CAAC,EAA/D,SAAS,QAAA,EAAE,YAAY,QAAwC,CAAA;IACtE,IAAM,IAAI,GAAG,IAAA,yBAAO,GAAE,CAAA;IACtB,IAAM,cAAc,GAAQ,IAAA,cA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,IAC/E,QAAQ,CAAC,KAAK,CACV,CACF,CACH,CACP;oCACA,OAAO,KAAK,CAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,MAAM,IAAG,CAAC,CAAC,CAAC,CAAC,CACnC;wCAEE,yDAAiB,MAAM,EAAC,SAAS,EAAC,mDAAmD;4CACnF,0CACE,SAAS,EAAC,6BAA6B,EACvC,IAAI,EAAC,MAAM,EACX,mBAAmB,EAAC,MAAM,EAC1B,OAAO,EAAC,WAAW;gDAEnB,2CACE,CAAC,EAAC,kBAAkB,EACpB,MAAM,EAAC,cAAc,EACrB,cAAc,EAAC,OAAO,EACtB,YAAY,EAAC,oBAAoB,GACjC,CACE,CACF,CACL,CACJ,CAAC,CAAC,CAAC,IAAI,CACD,CACN,CACN,EAjEoC,CAiEpC,CAAC,CACD,CACD;oBACN,0CAAK,SAAS,EAAC,MAAM,IAAE,MAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,IAAI,CAAC,UAAC,IAAI,IAAK,OAAA,IAAI,CAAC,IAAI,KAAK,WAAW,EAAzB,CAAyB,CAAC,0CAAE,SAAS,CAAO,CACrF,CACE,CACD,CACX,CACP,CAAA;AACH,CAAC,CAAA;AAlPY,QAAA,WAAW,eAkPvB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { UseFormRegisterReturn } from 'react-hook-form';
|
|
2
1
|
import React, { ReactNode } from 'react';
|
|
2
|
+
import { UseFormRegisterReturn } from 'react-hook-form';
|
|
3
3
|
import { FooterBarProps } from '../FormWrap';
|
|
4
4
|
export interface FormStepProps {
|
|
5
5
|
className?: string;
|
|
@@ -20,7 +20,10 @@ export interface FormStepProps {
|
|
|
20
20
|
step: number;
|
|
21
21
|
onNext?: any;
|
|
22
22
|
onBack?: any;
|
|
23
|
+
isNext?: boolean;
|
|
24
|
+
isBack?: boolean;
|
|
23
25
|
}>;
|
|
24
26
|
backRout: any;
|
|
27
|
+
isLoading?: boolean;
|
|
25
28
|
}
|
|
26
29
|
export declare const PHXFormStep: React.FC<FormStepProps>;
|
|
@@ -1,54 +1,150 @@
|
|
|
1
|
-
import { __assign } from "tslib";
|
|
2
|
-
import { FormProvider, useForm } from 'react-hook-form';
|
|
3
|
-
import React, { useEffect, useState } from 'react';
|
|
1
|
+
import { __assign, __awaiter, __generator } from "tslib";
|
|
4
2
|
import { CheckIcon } from '@heroicons/react/24/solid';
|
|
5
|
-
import {
|
|
3
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
4
|
+
import { FormProvider, useForm } from 'react-hook-form';
|
|
6
5
|
import { PHXFormWrap } from '../FormWrap';
|
|
6
|
+
import { PHXCard } from '../Card';
|
|
7
7
|
export var PHXFormStep = function (_a) {
|
|
8
8
|
var _b;
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
9
|
+
var backLabel = _a.backLabel, backRout = _a.backRout, className = _a.className, formMode = _a.formMode, _c = _a.isLoading, isLoading = _c === void 0 ? false : _c, nextLabel = _a.nextLabel, onSubmit = _a.onSubmit, _d = _a.size, size = _d === void 0 ? 'large' : _d, steps = _a.steps, title = _a.title, triggerStep = _a.triggerStep;
|
|
10
|
+
var _e = useState(1), currentStep = _e[0], setCurrentStep = _e[1];
|
|
11
|
+
var _f = useState([]), listSteps = _f[0], setListSteps = _f[1];
|
|
12
12
|
var form = useForm();
|
|
13
|
-
var
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
13
|
+
var triggerStepRef = useRef();
|
|
14
|
+
function findNextStepCurrent(item) {
|
|
15
|
+
return item.step === currentStep + 1 && item.status !== 'complete';
|
|
16
|
+
}
|
|
17
|
+
var nextStep = function (data, stepItem) { return __awaiter(void 0, void 0, void 0, function () {
|
|
18
|
+
var funcCallNextStep, isPass, error_1;
|
|
19
|
+
var _a, _b;
|
|
20
|
+
return __generator(this, function (_c) {
|
|
21
|
+
switch (_c.label) {
|
|
22
|
+
case 0:
|
|
23
|
+
_c.trys.push([0, 3, , 4]);
|
|
24
|
+
funcCallNextStep = (_a = triggerStep === null || triggerStep === void 0 ? void 0 : triggerStep.find(function (func) { return func.step === currentStep; })) === null || _a === void 0 ? void 0 : _a.onNext;
|
|
25
|
+
if (!funcCallNextStep) return [3 /*break*/, 2];
|
|
26
|
+
return [4 /*yield*/, funcCallNextStep()
|
|
27
|
+
// kiểm tra điều kiện xem có pass hay không trước khi cập nhật trạng thái của step
|
|
28
|
+
];
|
|
29
|
+
case 1:
|
|
30
|
+
_c.sent();
|
|
31
|
+
_c.label = 2;
|
|
32
|
+
case 2:
|
|
33
|
+
isPass = (_b = triggerStep === null || triggerStep === void 0 ? void 0 : triggerStep.find(function (func) { return func.step === currentStep; })) === null || _b === void 0 ? void 0 : _b.isNext;
|
|
34
|
+
if (isPass === false)
|
|
35
|
+
return [2 /*return*/];
|
|
36
|
+
if (currentStep === (listSteps === null || listSteps === void 0 ? void 0 : listSteps.length)) {
|
|
37
|
+
onSubmit(data);
|
|
38
|
+
return [2 /*return*/];
|
|
39
|
+
}
|
|
40
|
+
listSteps === null || listSteps === void 0 ? void 0 : listSteps.forEach(function (item) {
|
|
41
|
+
if (findNextStepCurrent(item)) {
|
|
42
|
+
// Cập nhật trạng thái cho thằng step tiếp theo
|
|
43
|
+
item.status = 'current';
|
|
44
|
+
}
|
|
45
|
+
if (item.step === currentStep)
|
|
46
|
+
item.status = 'complete';
|
|
47
|
+
});
|
|
48
|
+
// Kiểm tra xem có thằng StepItem truyền đến không và Step đó phải khác upcoming thì mới cho truyển đến Step đó
|
|
49
|
+
if (stepItem && stepItem.step && stepItem.status !== 'upcoming') {
|
|
50
|
+
setCurrentStep(stepItem.step);
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
setCurrentStep(function (currentStep) { return currentStep + 1; });
|
|
54
|
+
}
|
|
55
|
+
return [3 /*break*/, 4];
|
|
56
|
+
case 3:
|
|
57
|
+
error_1 = _c.sent();
|
|
58
|
+
console.error;
|
|
59
|
+
return [3 /*break*/, 4];
|
|
60
|
+
case 4: return [2 /*return*/];
|
|
22
61
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
62
|
+
});
|
|
63
|
+
}); };
|
|
64
|
+
// Tạo một hàm trung gian để xử lý việc gọi hàm nextStep với tham số bổ sung.
|
|
65
|
+
var handleNextStepWithParam = function (stepItem) { return __awaiter(void 0, void 0, void 0, function () {
|
|
66
|
+
var onSubmitWithParam;
|
|
67
|
+
return __generator(this, function (_a) {
|
|
68
|
+
onSubmitWithParam = form.handleSubmit(function (data) { return nextStep(data, stepItem); });
|
|
69
|
+
onSubmitWithParam();
|
|
70
|
+
return [2 /*return*/];
|
|
71
|
+
});
|
|
72
|
+
}); };
|
|
73
|
+
var handleBackStep = function (stepItem) { return __awaiter(void 0, void 0, void 0, function () {
|
|
74
|
+
var funcCallBackStep, isBack;
|
|
75
|
+
var _a, _b;
|
|
76
|
+
return __generator(this, function (_c) {
|
|
77
|
+
switch (_c.label) {
|
|
78
|
+
case 0:
|
|
79
|
+
funcCallBackStep = (_a = triggerStep === null || triggerStep === void 0 ? void 0 : triggerStep.find(function (func) { return func.step === currentStep; })) === null || _a === void 0 ? void 0 : _a.onBack;
|
|
80
|
+
if (!(funcCallBackStep && formMode !== 'readOnly')) return [3 /*break*/, 2];
|
|
81
|
+
return [4 /*yield*/, funcCallBackStep()
|
|
82
|
+
// kiểm tra điều kiện xem có pass hay không trước khi cập nhật trạng thái của step
|
|
83
|
+
];
|
|
84
|
+
case 1:
|
|
85
|
+
_c.sent();
|
|
86
|
+
_c.label = 2;
|
|
87
|
+
case 2:
|
|
88
|
+
isBack = (_b = triggerStep === null || triggerStep === void 0 ? void 0 : triggerStep.find(function (func) { return func.step === currentStep; })) === null || _b === void 0 ? void 0 : _b.isBack;
|
|
89
|
+
if (isBack === false)
|
|
90
|
+
return [2 /*return*/];
|
|
91
|
+
if (stepItem && stepItem.step) {
|
|
92
|
+
setCurrentStep(stepItem.step);
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
setCurrentStep(function (currentStep) { return currentStep - 1; });
|
|
96
|
+
}
|
|
97
|
+
return [2 /*return*/];
|
|
30
98
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
99
|
+
});
|
|
100
|
+
}); };
|
|
101
|
+
var handleNextStep = function () {
|
|
102
|
+
setCurrentStep(function (currentStep) { return currentStep + 1; });
|
|
36
103
|
};
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
funcCallBackStep();
|
|
42
|
-
if (stepItem && stepItem.step) {
|
|
43
|
-
setCurrentStep(stepItem.step);
|
|
104
|
+
// Hàm kiểm tra hai mảng trigger có cùng nội dung hay không
|
|
105
|
+
var arraysAreEqual = function (arr1, arr2) {
|
|
106
|
+
if ((arr1 === null || arr1 === void 0 ? void 0 : arr1.length) !== (arr2 === null || arr2 === void 0 ? void 0 : arr2.length)) {
|
|
107
|
+
return false;
|
|
44
108
|
}
|
|
45
|
-
|
|
46
|
-
|
|
109
|
+
var compareLength = arr1 === null || arr1 === void 0 ? void 0 : arr1.length;
|
|
110
|
+
for (var i = 0; i < compareLength; i++) {
|
|
111
|
+
if (arr1[i].isBack !== arr2[i].isBack || arr1[i].isNext !== arr2[i].isNext) {
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
47
114
|
}
|
|
115
|
+
return true;
|
|
48
116
|
};
|
|
49
|
-
var
|
|
117
|
+
var triggerNextStep = function () {
|
|
118
|
+
listSteps === null || listSteps === void 0 ? void 0 : listSteps.forEach(function (item) {
|
|
119
|
+
if (item.step === currentStep + 1 && item.status !== 'complete') {
|
|
120
|
+
item.status = 'current';
|
|
121
|
+
}
|
|
122
|
+
if (item.step === currentStep)
|
|
123
|
+
item.status = 'complete';
|
|
124
|
+
});
|
|
50
125
|
setCurrentStep(function (currentStep) { return currentStep + 1; });
|
|
51
126
|
};
|
|
127
|
+
function isEmptyFuncTrigger(funcCallBackStep) {
|
|
128
|
+
return !funcCallBackStep || (funcCallBackStep && !funcCallBackStep.isNext && !funcCallBackStep.isBack);
|
|
129
|
+
}
|
|
130
|
+
function isNextCondition(funcCallBackStep) {
|
|
131
|
+
return funcCallBackStep && funcCallBackStep.isNext && !funcCallBackStep.isBack;
|
|
132
|
+
}
|
|
133
|
+
// Theo dõi triggerStep truyền vào isPass và isNext và chuyển hướng
|
|
134
|
+
useEffect(function () {
|
|
135
|
+
if (!arraysAreEqual(triggerStep, triggerStepRef.current)) {
|
|
136
|
+
var funcCallBackStep = triggerStep === null || triggerStep === void 0 ? void 0 : triggerStep.find(function (func) { return func.step === currentStep; });
|
|
137
|
+
if (isEmptyFuncTrigger(funcCallBackStep))
|
|
138
|
+
return;
|
|
139
|
+
if (isNextCondition(funcCallBackStep)) {
|
|
140
|
+
triggerNextStep();
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
setCurrentStep(function (currentStep) { return currentStep - 1; });
|
|
144
|
+
}
|
|
145
|
+
triggerStepRef.current = triggerStep;
|
|
146
|
+
}
|
|
147
|
+
}, [triggerStep]);
|
|
52
148
|
useEffect(function () {
|
|
53
149
|
if (steps) {
|
|
54
150
|
var listNew = steps === null || steps === void 0 ? void 0 : steps.map(function (item, index) {
|
|
@@ -59,29 +155,38 @@ export var PHXFormStep = function (_a) {
|
|
|
59
155
|
return __assign(__assign({}, item), { status: 'upcoming' });
|
|
60
156
|
}
|
|
61
157
|
});
|
|
62
|
-
if (formMode !== 'addNew')
|
|
158
|
+
if (formMode !== 'addNew') {
|
|
63
159
|
listNew = steps === null || steps === void 0 ? void 0 : steps.map(function (item) { return (__assign(__assign({}, item), { status: 'complete' })); });
|
|
160
|
+
}
|
|
64
161
|
setListSteps(listNew);
|
|
65
162
|
}
|
|
66
163
|
}, []);
|
|
67
164
|
return (React.createElement("div", { className: className },
|
|
68
165
|
React.createElement(FormProvider, __assign({}, form),
|
|
69
|
-
React.createElement(PHXFormWrap, { className: 'w-full',
|
|
166
|
+
React.createElement(PHXFormWrap, { className: 'w-full', footerAction: false, onCancel: backRout, onSubmit: formMode === 'readOnly' ? form.handleSubmit(handleNextStep) : form.handleSubmit(nextStep), size: size, title: title },
|
|
70
167
|
React.createElement(PHXCard, { primaryFooterAction: {
|
|
71
168
|
content: currentStep === (listSteps === null || listSteps === void 0 ? void 0 : listSteps.length) ? (formMode !== 'readOnly' ? 'Submit' : '') : nextLabel,
|
|
72
|
-
submit: true
|
|
73
|
-
|
|
169
|
+
submit: true,
|
|
170
|
+
loading: isLoading
|
|
171
|
+
}, secondaryFooterActions: [
|
|
172
|
+
{
|
|
173
|
+
content: currentStep !== 1 ? backLabel : '',
|
|
174
|
+
onClick: handleBackStep
|
|
175
|
+
},
|
|
176
|
+
] },
|
|
74
177
|
React.createElement("nav", { "aria-label": 'Progress' },
|
|
75
|
-
React.createElement("ol", {
|
|
178
|
+
React.createElement("ol", { className: 'divide-y divide-gray-300 rounded-md border border-gray-300 md:flex md:divide-y-0', role: 'list' }, listSteps &&
|
|
76
179
|
listSteps.map(function (stepItem, stepIdx) { return (React.createElement("li", { key: stepIdx, className: 'relative cursor-pointer md:flex md:flex-1' },
|
|
77
|
-
React.createElement("button", {
|
|
78
|
-
return
|
|
79
|
-
|
|
180
|
+
React.createElement("button", { disabled: stepItem.step === currentStep, onClick: function () {
|
|
181
|
+
return stepItem.step < currentStep || formMode === 'readOnly'
|
|
182
|
+
? handleBackStep(stepItem)
|
|
183
|
+
: handleNextStepWithParam(stepItem);
|
|
184
|
+
}, type: 'button' },
|
|
80
185
|
stepItem.status === 'complete' ? (React.createElement("div", { className: 'group flex w-full items-center' },
|
|
81
186
|
React.createElement("span", { className: 'flex items-center px-6 py-3 text-sm font-medium' },
|
|
82
|
-
React.createElement("span", { className:
|
|
83
|
-
React.createElement(CheckIcon, { className: 'h-6 w-6 text-white'
|
|
84
|
-
React.createElement("span", { className: 'ml-4 text-sm font-medium text-gray-900' }, stepItem.title)))) : stepItem.status === 'current' ? (React.createElement("div", { className: 'flex items-center px-6 py-3 text-sm font-medium'
|
|
187
|
+
React.createElement("span", { className: "flex h-10 w-10 flex-shrink-0 items-center justify-center rounded-full bg-indigo-500 group-hover:bg-indigo-700 ".concat(stepItem.step === currentStep && 'bg-indigo-800') },
|
|
188
|
+
React.createElement(CheckIcon, { "aria-hidden": 'true', className: 'h-6 w-6 text-white' })),
|
|
189
|
+
React.createElement("span", { className: 'ml-4 text-sm font-medium text-gray-900' }, stepItem.title)))) : stepItem.status === 'current' ? (React.createElement("div", { "aria-current": 'step', className: 'flex items-center px-6 py-3 text-sm font-medium' },
|
|
85
190
|
React.createElement("span", { className: 'flex h-10 w-10 flex-shrink-0 items-center justify-center rounded-full border-2 border-indigo-600' },
|
|
86
191
|
React.createElement("span", { className: 'text-indigo-600' }, stepItem.step)),
|
|
87
192
|
React.createElement("span", { className: 'ml-4 text-sm font-medium text-indigo-600' }, stepItem.title))) : (React.createElement("div", { className: 'group flex items-center' },
|
|
@@ -90,9 +195,9 @@ export var PHXFormStep = function (_a) {
|
|
|
90
195
|
React.createElement("span", { className: 'text-gray-500 group-hover:text-gray-900' }, stepItem.step)),
|
|
91
196
|
React.createElement("span", { className: 'ml-4 text-sm font-medium text-gray-500 group-hover:text-gray-900' }, stepItem.title)))),
|
|
92
197
|
stepIdx !== (listSteps === null || listSteps === void 0 ? void 0 : listSteps.length) - 1 ? (React.createElement(React.Fragment, null,
|
|
93
|
-
React.createElement("div", { className: 'absolute right-0 top-0 hidden h-full w-5 md:block'
|
|
94
|
-
React.createElement("svg", { className: 'h-full w-full text-gray-300',
|
|
95
|
-
React.createElement("path", { d: 'M0 -2L20 40L0 82',
|
|
96
|
-
_b.component)))));
|
|
198
|
+
React.createElement("div", { "aria-hidden": 'true', className: 'absolute right-0 top-0 hidden h-full w-5 md:block' },
|
|
199
|
+
React.createElement("svg", { className: 'h-full w-full text-gray-300', fill: 'none', preserveAspectRatio: 'none', viewBox: '0 0 22 80' },
|
|
200
|
+
React.createElement("path", { d: 'M0 -2L20 40L0 82', stroke: 'currentcolor', strokeLinejoin: 'round', vectorEffect: 'non-scaling-stroke' }))))) : null))); }))),
|
|
201
|
+
React.createElement("div", { className: 'pt-3' }, (_b = listSteps === null || listSteps === void 0 ? void 0 : listSteps.find(function (item) { return item.step === currentStep; })) === null || _b === void 0 ? void 0 : _b.component))))));
|
|
97
202
|
};
|
|
98
203
|
//# sourceMappingURL=FormStep.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormStep.js","sourceRoot":"","sources":["../../../../src/components/FormStep/FormStep.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"FormStep.js","sourceRoot":"","sources":["../../../../src/components/FormStep/FormStep.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AACrD,OAAO,KAAK,EAAE,EAAa,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACrE,OAAO,EAAE,YAAY,EAAyB,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAC9E,OAAO,EAAkB,WAAW,EAAE,MAAM,aAAa,CAAA;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AA4BjC,MAAM,CAAC,IAAM,WAAW,GAA4B,UAAC,EAYrC;;QAXd,SAAS,eAAA,EACT,QAAQ,cAAA,EACR,SAAS,eAAA,EACT,QAAQ,cAAA,EACR,iBAAiB,EAAjB,SAAS,mBAAG,KAAK,KAAA,EACjB,SAAS,eAAA,EACT,QAAQ,cAAA,EACR,YAAc,EAAd,IAAI,mBAAG,OAAO,KAAA,EACd,KAAK,WAAA,EACL,KAAK,WAAA,EACL,WAAW,iBAAA;IAEL,IAAA,KAAgC,QAAQ,CAAC,CAAC,CAAC,EAA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B;wCACtC,8BAAM,SAAS,EAAC,iDAAiD;4CAC/D,8BAAM,SAAS,EAAC,4HAA4H;gDAC1I,8BAAM,SAAS,EAAC,yCAAyC,IAAE,QAAQ,CAAC,IAAI,CAAQ,CAC3E;4CACP,8BAAM,SAAS,EAAC,kEAAkE,IAC/E,QAAQ,CAAC,KAAK,CACV,CACF,CACH,CACP;oCACA,OAAO,KAAK,CAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,MAAM,IAAG,CAAC,CAAC,CAAC,CAAC,CACnC;wCAEE,4CAAiB,MAAM,EAAC,SAAS,EAAC,mDAAmD;4CACnF,6BACE,SAAS,EAAC,6BAA6B,EACvC,IAAI,EAAC,MAAM,EACX,mBAAmB,EAAC,MAAM,EAC1B,OAAO,EAAC,WAAW;gDAEnB,8BACE,CAAC,EAAC,kBAAkB,EACpB,MAAM,EAAC,cAAc,EACrB,cAAc,EAAC,OAAO,EACtB,YAAY,EAAC,oBAAoB,GACjC,CACE,CACF,CACL,CACJ,CAAC,CAAC,CAAC,IAAI,CACD,CACN,CACN,EAjEoC,CAiEpC,CAAC,CACD,CACD;oBACN,6BAAK,SAAS,EAAC,MAAM,IAAE,MAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,IAAI,CAAC,UAAC,IAAI,IAAK,OAAA,IAAI,CAAC,IAAI,KAAK,WAAW,EAAzB,CAAyB,CAAC,0CAAE,SAAS,CAAO,CACrF,CACE,CACD,CACX,CACP,CAAA;AACH,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "phx-react",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.22",
|
|
4
4
|
"description": "My first react typescript package",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -74,7 +74,6 @@
|
|
|
74
74
|
"prop-types": "^15.8.1",
|
|
75
75
|
"react": "^18.1.0",
|
|
76
76
|
"react-dom": "^18.1.0",
|
|
77
|
-
"react-hook-form": "^7.45.2",
|
|
78
77
|
"storybook": "^7.2.3",
|
|
79
78
|
"tailwindcss": "^3.3.3",
|
|
80
79
|
"ts-jest": "^28.0.4",
|
|
@@ -87,6 +86,7 @@
|
|
|
87
86
|
]
|
|
88
87
|
},
|
|
89
88
|
"dependencies": {
|
|
89
|
+
"react-hook-form": "^7.45.2",
|
|
90
90
|
"@fortawesome/fontawesome-svg-core": "^6.4.0",
|
|
91
91
|
"@fortawesome/free-solid-svg-icons": "^6.4.0",
|
|
92
92
|
"@fortawesome/react-fontawesome": "^0.2.0",
|