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
package/dist/cjs/index.js
CHANGED
|
@@ -52,6 +52,7 @@ var ZoomOutIcon = require('@mui/icons-material/ZoomOut');
|
|
|
52
52
|
var FitScreenIcon = require('@mui/icons-material/FitScreen');
|
|
53
53
|
var reactKonva = require('react-konva');
|
|
54
54
|
var Konva = require('konva');
|
|
55
|
+
var ArrowBackIcon = require('@mui/icons-material/ArrowBack');
|
|
55
56
|
|
|
56
57
|
function _arrayLikeToArray(r, a) {
|
|
57
58
|
(null == a || a > r.length) && (a = r.length);
|
|
@@ -1680,6 +1681,15 @@ var Store = mobxStateTree.types.model('Store', {
|
|
|
1680
1681
|
return el.id !== id;
|
|
1681
1682
|
});
|
|
1682
1683
|
},
|
|
1684
|
+
_unresolveInputField: function _unresolveInputField(el) {
|
|
1685
|
+
// Re-insert at the front so it becomes the next field shown (back navigation)
|
|
1686
|
+
var alreadyPending = self._pendingInputFields.some(function (f) {
|
|
1687
|
+
return f.id === el.id;
|
|
1688
|
+
});
|
|
1689
|
+
if (!alreadyPending) {
|
|
1690
|
+
self._pendingInputFields.unshift(el);
|
|
1691
|
+
}
|
|
1692
|
+
},
|
|
1683
1693
|
clearPendingInputFields: function clearPendingInputFields() {
|
|
1684
1694
|
self._pendingInputFields = [];
|
|
1685
1695
|
}
|
|
@@ -10253,6 +10263,8 @@ var SingleFieldDialog = function SingleFieldDialog(_ref) {
|
|
|
10253
10263
|
var field = _ref.field,
|
|
10254
10264
|
onSubmit = _ref.onSubmit,
|
|
10255
10265
|
onSkip = _ref.onSkip,
|
|
10266
|
+
onBack = _ref.onBack,
|
|
10267
|
+
canGoBack = _ref.canGoBack,
|
|
10256
10268
|
currentIndex = _ref.currentIndex,
|
|
10257
10269
|
totalCount = _ref.totalCount;
|
|
10258
10270
|
var _useState = React.useState(''),
|
|
@@ -10561,7 +10573,26 @@ var SingleFieldDialog = function SingleFieldDialog(_ref) {
|
|
|
10561
10573
|
gap: 2,
|
|
10562
10574
|
mt: 4.5
|
|
10563
10575
|
},
|
|
10564
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(material.Button, {
|
|
10576
|
+
children: [canGoBack && /*#__PURE__*/jsxRuntime.jsx(material.Button, {
|
|
10577
|
+
variant: "outlined",
|
|
10578
|
+
onClick: onBack,
|
|
10579
|
+
startIcon: /*#__PURE__*/jsxRuntime.jsx(ArrowBackIcon, {}),
|
|
10580
|
+
sx: {
|
|
10581
|
+
textTransform: 'none',
|
|
10582
|
+
fontWeight: 500,
|
|
10583
|
+
fontSize: 21,
|
|
10584
|
+
px: 3,
|
|
10585
|
+
py: 1.65,
|
|
10586
|
+
borderRadius: '10px',
|
|
10587
|
+
color: '#555',
|
|
10588
|
+
borderColor: '#d0d5dd',
|
|
10589
|
+
'&:hover': {
|
|
10590
|
+
borderColor: '#aaa',
|
|
10591
|
+
backgroundColor: 'rgba(0,0,0,0.02)'
|
|
10592
|
+
}
|
|
10593
|
+
},
|
|
10594
|
+
children: t('inputFieldsDialog.back', 'Back')
|
|
10595
|
+
}), /*#__PURE__*/jsxRuntime.jsx(material.Button, {
|
|
10565
10596
|
variant: "contained",
|
|
10566
10597
|
onClick: handleSubmit,
|
|
10567
10598
|
disabled: isRequired && !value,
|
|
@@ -10620,6 +10651,7 @@ var InputFieldsDialog = mobxReactLite.observer(function (_ref2) {
|
|
|
10620
10651
|
displayIndex = _useState6[0],
|
|
10621
10652
|
setDisplayIndex = _useState6[1];
|
|
10622
10653
|
var initialTotalRef = React.useRef(0);
|
|
10654
|
+
var completedHistoryRef = React.useRef([]);
|
|
10623
10655
|
var config = getInputFieldsConfig();
|
|
10624
10656
|
var pendingFields = store._pendingInputFields || [];
|
|
10625
10657
|
|
|
@@ -10638,9 +10670,11 @@ var InputFieldsDialog = mobxReactLite.observer(function (_ref2) {
|
|
|
10638
10670
|
if (fields.length > 0 && initialTotalRef.current === 0) {
|
|
10639
10671
|
initialTotalRef.current = fields.length;
|
|
10640
10672
|
setDisplayIndex(0);
|
|
10673
|
+
completedHistoryRef.current = [];
|
|
10641
10674
|
}
|
|
10642
10675
|
if (fields.length === 0) {
|
|
10643
10676
|
initialTotalRef.current = 0;
|
|
10677
|
+
completedHistoryRef.current = [];
|
|
10644
10678
|
}
|
|
10645
10679
|
}, [fields.length]);
|
|
10646
10680
|
var totalCount = initialTotalRef.current || fields.length;
|
|
@@ -10650,11 +10684,17 @@ var InputFieldsDialog = mobxReactLite.observer(function (_ref2) {
|
|
|
10650
10684
|
var currentField = fields[0];
|
|
10651
10685
|
if (!currentField) return null;
|
|
10652
10686
|
|
|
10653
|
-
// ── Shared submit / skip helpers
|
|
10687
|
+
// ── Shared submit / skip / back helpers ─────────────────────────────
|
|
10654
10688
|
var handleSubmit = function handleSubmit(elementId, value) {
|
|
10655
10689
|
var el = store.getElementById(elementId);
|
|
10690
|
+
var isImage = el && el.custom && el.custom.inputType === 'image';
|
|
10691
|
+
var previousValue = el ? isImage ? el.src : el.text : '';
|
|
10692
|
+
completedHistoryRef.current.push({
|
|
10693
|
+
el: el,
|
|
10694
|
+
previousValue: previousValue,
|
|
10695
|
+
skipped: false
|
|
10696
|
+
});
|
|
10656
10697
|
if (el && el.set) {
|
|
10657
|
-
var isImage = el.custom && el.custom.inputType === 'image';
|
|
10658
10698
|
if (isImage) {
|
|
10659
10699
|
el.set({
|
|
10660
10700
|
src: String(value)
|
|
@@ -10676,6 +10716,14 @@ var InputFieldsDialog = mobxReactLite.observer(function (_ref2) {
|
|
|
10676
10716
|
}
|
|
10677
10717
|
};
|
|
10678
10718
|
var handleSkip = function handleSkip(elementId) {
|
|
10719
|
+
var el = store.getElementById(elementId);
|
|
10720
|
+
var isImage = el && el.custom && el.custom.inputType === 'image';
|
|
10721
|
+
var previousValue = el ? isImage ? el.src : el.text : '';
|
|
10722
|
+
completedHistoryRef.current.push({
|
|
10723
|
+
el: el,
|
|
10724
|
+
previousValue: previousValue,
|
|
10725
|
+
skipped: true
|
|
10726
|
+
});
|
|
10679
10727
|
store._resolveInputField(elementId);
|
|
10680
10728
|
if (fields.length <= 1) {
|
|
10681
10729
|
if (_onComplete) _onComplete();
|
|
@@ -10685,6 +10733,25 @@ var InputFieldsDialog = mobxReactLite.observer(function (_ref2) {
|
|
|
10685
10733
|
});
|
|
10686
10734
|
}
|
|
10687
10735
|
};
|
|
10736
|
+
var handleBack = function handleBack() {
|
|
10737
|
+
var last = completedHistoryRef.current.pop();
|
|
10738
|
+
if (!last) return;
|
|
10739
|
+
var el = last.el,
|
|
10740
|
+
previousValue = last.previousValue;
|
|
10741
|
+
if (el) {
|
|
10742
|
+
var isImage = el.custom && el.custom.inputType === 'image';
|
|
10743
|
+
el.set(isImage ? {
|
|
10744
|
+
src: previousValue || ''
|
|
10745
|
+
} : {
|
|
10746
|
+
text: previousValue || ''
|
|
10747
|
+
});
|
|
10748
|
+
store._unresolveInputField(el);
|
|
10749
|
+
}
|
|
10750
|
+
setDisplayIndex(function (prev) {
|
|
10751
|
+
return Math.max(0, prev - 1);
|
|
10752
|
+
});
|
|
10753
|
+
};
|
|
10754
|
+
var canGoBack = displayIndex > 0;
|
|
10688
10755
|
|
|
10689
10756
|
// ── Resolve which dialog component to use ───────────────────────────
|
|
10690
10757
|
// Priority: per-type custom dialog > global CustomDialog > built-in
|
|
@@ -10706,6 +10773,8 @@ var InputFieldsDialog = mobxReactLite.observer(function (_ref2) {
|
|
|
10706
10773
|
totalCount: totalCount,
|
|
10707
10774
|
onSubmit: handleSubmit,
|
|
10708
10775
|
onSkip: handleSkip,
|
|
10776
|
+
onBack: handleBack,
|
|
10777
|
+
canGoBack: canGoBack,
|
|
10709
10778
|
onComplete: function onComplete() {
|
|
10710
10779
|
store.history.addUndoState();
|
|
10711
10780
|
if (_onComplete) _onComplete();
|
|
@@ -10716,6 +10785,8 @@ var InputFieldsDialog = mobxReactLite.observer(function (_ref2) {
|
|
|
10716
10785
|
field: currentField,
|
|
10717
10786
|
onSubmit: handleSubmit,
|
|
10718
10787
|
onSkip: handleSkip,
|
|
10788
|
+
onBack: handleBack,
|
|
10789
|
+
canGoBack: canGoBack,
|
|
10719
10790
|
currentIndex: displayIndex,
|
|
10720
10791
|
totalCount: totalCount
|
|
10721
10792
|
});
|