labellife-design-tool 2.2.1 → 2.2.2
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/canvas/workspace.js +65 -3
- package/dist/cjs/canvas/workspace.js.map +1 -1
- package/dist/cjs/index.js +74 -3
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/model/store.js +9 -0
- package/dist/cjs/model/store.js.map +1 -1
- package/dist/esm/canvas/workspace.js +65 -3
- package/dist/esm/canvas/workspace.js.map +1 -1
- package/dist/esm/index.js +74 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/model/store.js +9 -0
- package/dist/esm/model/store.js.map +1 -1
- package/package.json +1 -1
|
@@ -6,6 +6,7 @@ import CloseIcon from '@mui/icons-material/Close';
|
|
|
6
6
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
7
7
|
import Konva from 'konva';
|
|
8
8
|
import CloudUploadIcon from '@mui/icons-material/CloudUpload';
|
|
9
|
+
import ArrowBackIcon from '@mui/icons-material/ArrowBack';
|
|
9
10
|
|
|
10
11
|
function _arrayLikeToArray(r, a) {
|
|
11
12
|
(null == a || a > r.length) && (a = r.length);
|
|
@@ -1670,6 +1671,8 @@ var SingleFieldDialog = function SingleFieldDialog(_ref) {
|
|
|
1670
1671
|
var field = _ref.field,
|
|
1671
1672
|
onSubmit = _ref.onSubmit,
|
|
1672
1673
|
onSkip = _ref.onSkip,
|
|
1674
|
+
onBack = _ref.onBack,
|
|
1675
|
+
canGoBack = _ref.canGoBack,
|
|
1673
1676
|
currentIndex = _ref.currentIndex,
|
|
1674
1677
|
totalCount = _ref.totalCount;
|
|
1675
1678
|
var _useState = useState(''),
|
|
@@ -1978,7 +1981,26 @@ var SingleFieldDialog = function SingleFieldDialog(_ref) {
|
|
|
1978
1981
|
gap: 2,
|
|
1979
1982
|
mt: 4.5
|
|
1980
1983
|
},
|
|
1981
|
-
children: [/*#__PURE__*/jsx(Button, {
|
|
1984
|
+
children: [canGoBack && /*#__PURE__*/jsx(Button, {
|
|
1985
|
+
variant: "outlined",
|
|
1986
|
+
onClick: onBack,
|
|
1987
|
+
startIcon: /*#__PURE__*/jsx(ArrowBackIcon, {}),
|
|
1988
|
+
sx: {
|
|
1989
|
+
textTransform: 'none',
|
|
1990
|
+
fontWeight: 500,
|
|
1991
|
+
fontSize: 21,
|
|
1992
|
+
px: 3,
|
|
1993
|
+
py: 1.65,
|
|
1994
|
+
borderRadius: '10px',
|
|
1995
|
+
color: '#555',
|
|
1996
|
+
borderColor: '#d0d5dd',
|
|
1997
|
+
'&:hover': {
|
|
1998
|
+
borderColor: '#aaa',
|
|
1999
|
+
backgroundColor: 'rgba(0,0,0,0.02)'
|
|
2000
|
+
}
|
|
2001
|
+
},
|
|
2002
|
+
children: t('inputFieldsDialog.back', 'Back')
|
|
2003
|
+
}), /*#__PURE__*/jsx(Button, {
|
|
1982
2004
|
variant: "contained",
|
|
1983
2005
|
onClick: handleSubmit,
|
|
1984
2006
|
disabled: isRequired && !value,
|
|
@@ -2037,6 +2059,7 @@ var InputFieldsDialog = observer(function (_ref2) {
|
|
|
2037
2059
|
displayIndex = _useState6[0],
|
|
2038
2060
|
setDisplayIndex = _useState6[1];
|
|
2039
2061
|
var initialTotalRef = useRef(0);
|
|
2062
|
+
var completedHistoryRef = useRef([]);
|
|
2040
2063
|
var config = getInputFieldsConfig();
|
|
2041
2064
|
var pendingFields = store._pendingInputFields || [];
|
|
2042
2065
|
|
|
@@ -2055,9 +2078,11 @@ var InputFieldsDialog = observer(function (_ref2) {
|
|
|
2055
2078
|
if (fields.length > 0 && initialTotalRef.current === 0) {
|
|
2056
2079
|
initialTotalRef.current = fields.length;
|
|
2057
2080
|
setDisplayIndex(0);
|
|
2081
|
+
completedHistoryRef.current = [];
|
|
2058
2082
|
}
|
|
2059
2083
|
if (fields.length === 0) {
|
|
2060
2084
|
initialTotalRef.current = 0;
|
|
2085
|
+
completedHistoryRef.current = [];
|
|
2061
2086
|
}
|
|
2062
2087
|
}, [fields.length]);
|
|
2063
2088
|
var totalCount = initialTotalRef.current || fields.length;
|
|
@@ -2067,11 +2092,17 @@ var InputFieldsDialog = observer(function (_ref2) {
|
|
|
2067
2092
|
var currentField = fields[0];
|
|
2068
2093
|
if (!currentField) return null;
|
|
2069
2094
|
|
|
2070
|
-
// ── Shared submit / skip helpers
|
|
2095
|
+
// ── Shared submit / skip / back helpers ─────────────────────────────
|
|
2071
2096
|
var handleSubmit = function handleSubmit(elementId, value) {
|
|
2072
2097
|
var el = store.getElementById(elementId);
|
|
2098
|
+
var isImage = el && el.custom && el.custom.inputType === 'image';
|
|
2099
|
+
var previousValue = el ? isImage ? el.src : el.text : '';
|
|
2100
|
+
completedHistoryRef.current.push({
|
|
2101
|
+
el: el,
|
|
2102
|
+
previousValue: previousValue,
|
|
2103
|
+
skipped: false
|
|
2104
|
+
});
|
|
2073
2105
|
if (el && el.set) {
|
|
2074
|
-
var isImage = el.custom && el.custom.inputType === 'image';
|
|
2075
2106
|
if (isImage) {
|
|
2076
2107
|
el.set({
|
|
2077
2108
|
src: String(value)
|
|
@@ -2093,6 +2124,14 @@ var InputFieldsDialog = observer(function (_ref2) {
|
|
|
2093
2124
|
}
|
|
2094
2125
|
};
|
|
2095
2126
|
var handleSkip = function handleSkip(elementId) {
|
|
2127
|
+
var el = store.getElementById(elementId);
|
|
2128
|
+
var isImage = el && el.custom && el.custom.inputType === 'image';
|
|
2129
|
+
var previousValue = el ? isImage ? el.src : el.text : '';
|
|
2130
|
+
completedHistoryRef.current.push({
|
|
2131
|
+
el: el,
|
|
2132
|
+
previousValue: previousValue,
|
|
2133
|
+
skipped: true
|
|
2134
|
+
});
|
|
2096
2135
|
store._resolveInputField(elementId);
|
|
2097
2136
|
if (fields.length <= 1) {
|
|
2098
2137
|
if (_onComplete) _onComplete();
|
|
@@ -2102,6 +2141,25 @@ var InputFieldsDialog = observer(function (_ref2) {
|
|
|
2102
2141
|
});
|
|
2103
2142
|
}
|
|
2104
2143
|
};
|
|
2144
|
+
var handleBack = function handleBack() {
|
|
2145
|
+
var last = completedHistoryRef.current.pop();
|
|
2146
|
+
if (!last) return;
|
|
2147
|
+
var el = last.el,
|
|
2148
|
+
previousValue = last.previousValue;
|
|
2149
|
+
if (el) {
|
|
2150
|
+
var isImage = el.custom && el.custom.inputType === 'image';
|
|
2151
|
+
el.set(isImage ? {
|
|
2152
|
+
src: previousValue || ''
|
|
2153
|
+
} : {
|
|
2154
|
+
text: previousValue || ''
|
|
2155
|
+
});
|
|
2156
|
+
store._unresolveInputField(el);
|
|
2157
|
+
}
|
|
2158
|
+
setDisplayIndex(function (prev) {
|
|
2159
|
+
return Math.max(0, prev - 1);
|
|
2160
|
+
});
|
|
2161
|
+
};
|
|
2162
|
+
var canGoBack = displayIndex > 0;
|
|
2105
2163
|
|
|
2106
2164
|
// ── Resolve which dialog component to use ───────────────────────────
|
|
2107
2165
|
// Priority: per-type custom dialog > global CustomDialog > built-in
|
|
@@ -2123,6 +2181,8 @@ var InputFieldsDialog = observer(function (_ref2) {
|
|
|
2123
2181
|
totalCount: totalCount,
|
|
2124
2182
|
onSubmit: handleSubmit,
|
|
2125
2183
|
onSkip: handleSkip,
|
|
2184
|
+
onBack: handleBack,
|
|
2185
|
+
canGoBack: canGoBack,
|
|
2126
2186
|
onComplete: function onComplete() {
|
|
2127
2187
|
store.history.addUndoState();
|
|
2128
2188
|
if (_onComplete) _onComplete();
|
|
@@ -2133,6 +2193,8 @@ var InputFieldsDialog = observer(function (_ref2) {
|
|
|
2133
2193
|
field: currentField,
|
|
2134
2194
|
onSubmit: handleSubmit,
|
|
2135
2195
|
onSkip: handleSkip,
|
|
2196
|
+
onBack: handleBack,
|
|
2197
|
+
canGoBack: canGoBack,
|
|
2136
2198
|
currentIndex: displayIndex,
|
|
2137
2199
|
totalCount: totalCount
|
|
2138
2200
|
});
|