trotl-filter 1.0.45 → 1.0.47
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/index.cjs.js +330 -2
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.esm.js +330 -3
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -9514,6 +9514,7 @@ function DateTimeInput({
|
|
|
9514
9514
|
style = {},
|
|
9515
9515
|
predefinedRanges = ["today", "yesterday"],
|
|
9516
9516
|
startWith = "sunday",
|
|
9517
|
+
presets = [],
|
|
9517
9518
|
...rest
|
|
9518
9519
|
}) {
|
|
9519
9520
|
let translate;
|
|
@@ -9883,6 +9884,56 @@ function DateTimeInput({
|
|
|
9883
9884
|
applySelection(d);
|
|
9884
9885
|
setSelectedPredefined(String(idx));
|
|
9885
9886
|
};
|
|
9887
|
+
const handlePresetClick = preset => {
|
|
9888
|
+
if (!preset || !preset.type) return;
|
|
9889
|
+
const type = String(preset.type).toLowerCase();
|
|
9890
|
+
if (type === 'clear') {
|
|
9891
|
+
handleClear();
|
|
9892
|
+
return;
|
|
9893
|
+
}
|
|
9894
|
+
if (type === 'today') {
|
|
9895
|
+
const d = new Date();
|
|
9896
|
+
if (time && timeStart) {
|
|
9897
|
+
const [h, m] = (timeStart || "00:00").split(":");
|
|
9898
|
+
d.setHours(Number(h), Number(m), 0, 0);
|
|
9899
|
+
} else if (!time) {
|
|
9900
|
+
d.setHours(0, 0, 0, 0);
|
|
9901
|
+
}
|
|
9902
|
+
applySelection(d);
|
|
9903
|
+
return;
|
|
9904
|
+
}
|
|
9905
|
+
|
|
9906
|
+
// base = selected date (if present) or now
|
|
9907
|
+
const base = selectedDate ? new Date(selectedDate) : new Date();
|
|
9908
|
+
const val = Number(preset.value || 0);
|
|
9909
|
+
if (type === 'days') {
|
|
9910
|
+
base.setDate(base.getDate() + val);
|
|
9911
|
+
if (!selectedDate && time && timeStart) {
|
|
9912
|
+
const [h, m] = (timeStart || "00:00").split(":");
|
|
9913
|
+
base.setHours(Number(h), Number(m), 0, 0);
|
|
9914
|
+
}
|
|
9915
|
+
applySelection(base);
|
|
9916
|
+
return;
|
|
9917
|
+
}
|
|
9918
|
+
if (type === 'months') {
|
|
9919
|
+
base.setMonth(base.getMonth() + val);
|
|
9920
|
+
if (!selectedDate && time && timeStart) {
|
|
9921
|
+
const [h, m] = (timeStart || "00:00").split(":");
|
|
9922
|
+
base.setHours(Number(h), Number(m), 0, 0);
|
|
9923
|
+
}
|
|
9924
|
+
applySelection(base);
|
|
9925
|
+
return;
|
|
9926
|
+
}
|
|
9927
|
+
if (type === 'years') {
|
|
9928
|
+
base.setFullYear(base.getFullYear() + val);
|
|
9929
|
+
if (!selectedDate && time && timeStart) {
|
|
9930
|
+
const [h, m] = (timeStart || "00:00").split(":");
|
|
9931
|
+
base.setHours(Number(h), Number(m), 0, 0);
|
|
9932
|
+
}
|
|
9933
|
+
applySelection(base);
|
|
9934
|
+
return;
|
|
9935
|
+
}
|
|
9936
|
+
};
|
|
9886
9937
|
const handleDayClick = day => {
|
|
9887
9938
|
applySelection(day);
|
|
9888
9939
|
};
|
|
@@ -10086,7 +10137,30 @@ function DateTimeInput({
|
|
|
10086
10137
|
background: disabled ? '#f9fafb' : undefined,
|
|
10087
10138
|
color: disabled ? '#9ca3af' : undefined
|
|
10088
10139
|
}
|
|
10089
|
-
})), /*#__PURE__*/React.createElement("div", {
|
|
10140
|
+
})), presets && presets.length > 0 && /*#__PURE__*/React.createElement("div", {
|
|
10141
|
+
style: {
|
|
10142
|
+
display: 'flex',
|
|
10143
|
+
gap: 8,
|
|
10144
|
+
marginTop: 8,
|
|
10145
|
+
marginBottom: 8,
|
|
10146
|
+
flexWrap: 'wrap'
|
|
10147
|
+
}
|
|
10148
|
+
}, presets.map((p, i) => /*#__PURE__*/React.createElement("button", {
|
|
10149
|
+
key: `preset_${i}`,
|
|
10150
|
+
type: "button",
|
|
10151
|
+
onClick: () => !disabled && handlePresetClick(p),
|
|
10152
|
+
disabled: disabled,
|
|
10153
|
+
className: "basic-btn",
|
|
10154
|
+
style: {
|
|
10155
|
+
padding: '6px 10px',
|
|
10156
|
+
fontSize: 12,
|
|
10157
|
+
background: disabled ? '#f9fafb' : '#fff',
|
|
10158
|
+
color: disabled ? '#9ca3af' : '#000',
|
|
10159
|
+
border: '1px solid #d9d9d9',
|
|
10160
|
+
borderRadius: 4,
|
|
10161
|
+
cursor: disabled ? 'not-allowed' : 'pointer'
|
|
10162
|
+
}
|
|
10163
|
+
}, p.label || p.type))), /*#__PURE__*/React.createElement("div", {
|
|
10090
10164
|
style: {
|
|
10091
10165
|
display: 'flex',
|
|
10092
10166
|
justifyContent: 'space-between',
|
|
@@ -10150,7 +10224,8 @@ DateTimeInput.propTypes = {
|
|
|
10150
10224
|
disabled: PropTypes.bool,
|
|
10151
10225
|
className: PropTypes.string,
|
|
10152
10226
|
style: PropTypes.object,
|
|
10153
|
-
predefinedRanges: PropTypes.array
|
|
10227
|
+
predefinedRanges: PropTypes.array,
|
|
10228
|
+
presets: PropTypes.array
|
|
10154
10229
|
};
|
|
10155
10230
|
const buttonStyle = {
|
|
10156
10231
|
padding: '6px 16px',
|
|
@@ -11600,8 +11675,261 @@ Upload.propTypes = {
|
|
|
11600
11675
|
customText: PropTypes.node
|
|
11601
11676
|
};
|
|
11602
11677
|
|
|
11678
|
+
const upper = 20;
|
|
11679
|
+
const bellow = 180;
|
|
11680
|
+
const _markers = [{
|
|
11681
|
+
key: "18",
|
|
11682
|
+
x: 15,
|
|
11683
|
+
y: upper
|
|
11684
|
+
}, {
|
|
11685
|
+
key: "17",
|
|
11686
|
+
x: 45,
|
|
11687
|
+
y: upper
|
|
11688
|
+
}, {
|
|
11689
|
+
key: "16",
|
|
11690
|
+
x: 75,
|
|
11691
|
+
y: upper
|
|
11692
|
+
}, {
|
|
11693
|
+
key: "15",
|
|
11694
|
+
x: 105,
|
|
11695
|
+
y: upper
|
|
11696
|
+
}, {
|
|
11697
|
+
key: "14",
|
|
11698
|
+
x: 135,
|
|
11699
|
+
y: upper
|
|
11700
|
+
}, {
|
|
11701
|
+
key: "13",
|
|
11702
|
+
x: 165,
|
|
11703
|
+
y: upper
|
|
11704
|
+
}, {
|
|
11705
|
+
key: "12",
|
|
11706
|
+
x: 195,
|
|
11707
|
+
y: upper
|
|
11708
|
+
}, {
|
|
11709
|
+
key: "11",
|
|
11710
|
+
x: 225,
|
|
11711
|
+
y: upper
|
|
11712
|
+
}, {
|
|
11713
|
+
key: "21",
|
|
11714
|
+
x: 255,
|
|
11715
|
+
y: upper
|
|
11716
|
+
}, {
|
|
11717
|
+
key: "22",
|
|
11718
|
+
x: 285,
|
|
11719
|
+
y: upper
|
|
11720
|
+
}, {
|
|
11721
|
+
key: "23",
|
|
11722
|
+
x: 315,
|
|
11723
|
+
y: upper
|
|
11724
|
+
}, {
|
|
11725
|
+
key: "24",
|
|
11726
|
+
x: 345,
|
|
11727
|
+
y: upper
|
|
11728
|
+
}, {
|
|
11729
|
+
key: "25",
|
|
11730
|
+
x: 375,
|
|
11731
|
+
y: upper
|
|
11732
|
+
}, {
|
|
11733
|
+
key: "26",
|
|
11734
|
+
x: 405,
|
|
11735
|
+
y: upper
|
|
11736
|
+
}, {
|
|
11737
|
+
key: "27",
|
|
11738
|
+
x: 435,
|
|
11739
|
+
y: upper
|
|
11740
|
+
}, {
|
|
11741
|
+
key: "28",
|
|
11742
|
+
x: 465,
|
|
11743
|
+
y: upper
|
|
11744
|
+
}, {
|
|
11745
|
+
key: "48",
|
|
11746
|
+
x: 15,
|
|
11747
|
+
y: bellow
|
|
11748
|
+
}, {
|
|
11749
|
+
key: "47",
|
|
11750
|
+
x: 45,
|
|
11751
|
+
y: bellow
|
|
11752
|
+
}, {
|
|
11753
|
+
key: "46",
|
|
11754
|
+
x: 75,
|
|
11755
|
+
y: bellow
|
|
11756
|
+
}, {
|
|
11757
|
+
key: "45",
|
|
11758
|
+
x: 105,
|
|
11759
|
+
y: bellow
|
|
11760
|
+
}, {
|
|
11761
|
+
key: "44",
|
|
11762
|
+
x: 135,
|
|
11763
|
+
y: bellow
|
|
11764
|
+
}, {
|
|
11765
|
+
key: "43",
|
|
11766
|
+
x: 165,
|
|
11767
|
+
y: bellow
|
|
11768
|
+
}, {
|
|
11769
|
+
key: "42",
|
|
11770
|
+
x: 195,
|
|
11771
|
+
y: bellow
|
|
11772
|
+
}, {
|
|
11773
|
+
key: "41",
|
|
11774
|
+
x: 225,
|
|
11775
|
+
y: bellow
|
|
11776
|
+
}, {
|
|
11777
|
+
key: "31",
|
|
11778
|
+
x: 255,
|
|
11779
|
+
y: bellow
|
|
11780
|
+
}, {
|
|
11781
|
+
key: "32",
|
|
11782
|
+
x: 285,
|
|
11783
|
+
y: bellow
|
|
11784
|
+
}, {
|
|
11785
|
+
key: "33",
|
|
11786
|
+
x: 315,
|
|
11787
|
+
y: bellow
|
|
11788
|
+
}, {
|
|
11789
|
+
key: "34",
|
|
11790
|
+
x: 345,
|
|
11791
|
+
y: bellow
|
|
11792
|
+
}, {
|
|
11793
|
+
key: "35",
|
|
11794
|
+
x: 375,
|
|
11795
|
+
y: bellow
|
|
11796
|
+
}, {
|
|
11797
|
+
key: "36",
|
|
11798
|
+
x: 405,
|
|
11799
|
+
y: bellow
|
|
11800
|
+
}, {
|
|
11801
|
+
key: "37",
|
|
11802
|
+
x: 435,
|
|
11803
|
+
y: bellow
|
|
11804
|
+
}, {
|
|
11805
|
+
key: "38",
|
|
11806
|
+
x: 465,
|
|
11807
|
+
_x: 625,
|
|
11808
|
+
y: bellow
|
|
11809
|
+
}];
|
|
11810
|
+
const getBackgroundColor = (isSelected, card) => {
|
|
11811
|
+
let color = "white";
|
|
11812
|
+
if (isSelected) color = "#e6f7ff";
|
|
11813
|
+
if (card?.basicMaterial?.Color) color = "#dedede";
|
|
11814
|
+
if (card?.productValue?.colorTooth) color = card?.productValue?.colorTooth;
|
|
11815
|
+
return color;
|
|
11816
|
+
};
|
|
11817
|
+
const CardSelect = ({
|
|
11818
|
+
mk,
|
|
11819
|
+
sk,
|
|
11820
|
+
finalMarkers = () => {},
|
|
11821
|
+
callbackValues,
|
|
11822
|
+
callbackEvent
|
|
11823
|
+
}) => {
|
|
11824
|
+
const [disabled, setDisabled] = React.useState(true);
|
|
11825
|
+
const [markers, setMarkers] = React.useState(mk ?? _markers);
|
|
11826
|
+
const [selectedKeys, setSelectedKeys] = React.useState(sk ?? []);
|
|
11827
|
+
const [isMouseDown, setIsMouseDown] = React.useState(false);
|
|
11828
|
+
const {
|
|
11829
|
+
lang
|
|
11830
|
+
} = React.useMemo(() => ({
|
|
11831
|
+
lang: {}
|
|
11832
|
+
}), []);
|
|
11833
|
+
React.useEffect(() => {
|
|
11834
|
+
const handleGlobalMouseUp = () => setIsMouseDown(false);
|
|
11835
|
+
window.addEventListener("mouseup", handleGlobalMouseUp);
|
|
11836
|
+
return () => window.removeEventListener("mouseup", handleGlobalMouseUp);
|
|
11837
|
+
}, []);
|
|
11838
|
+
React.useEffect(() => {
|
|
11839
|
+
finalMarkers(selectedKeys);
|
|
11840
|
+
if (callbackValues) callbackValues(selectedKeys);
|
|
11841
|
+
if (callbackEvent) callbackEvent({
|
|
11842
|
+
type: "selection",
|
|
11843
|
+
values: selectedKeys
|
|
11844
|
+
});
|
|
11845
|
+
}, [selectedKeys]);
|
|
11846
|
+
const toggleCardSelection = card => {
|
|
11847
|
+
setSelectedKeys(prev => prev.includes(card.key) ? prev.filter(k => k !== card.key) : [...prev, card.key]);
|
|
11848
|
+
};
|
|
11849
|
+
const addCardToSelection = card => {
|
|
11850
|
+
setSelectedKeys(prev => prev.includes(card.key) ? prev : [...prev, card.key]);
|
|
11851
|
+
};
|
|
11852
|
+
const renderCard = card => {
|
|
11853
|
+
const isSelected = selectedKeys.includes(card?.key);
|
|
11854
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
11855
|
+
key: card?.key,
|
|
11856
|
+
className: `no-select custom-card-tooth ${isSelected ? "selected" : ""}`,
|
|
11857
|
+
onMouseDown: e => {
|
|
11858
|
+
if (e.button === 0) {
|
|
11859
|
+
setIsMouseDown(true);
|
|
11860
|
+
toggleCardSelection(card);
|
|
11861
|
+
}
|
|
11862
|
+
},
|
|
11863
|
+
onMouseOver: () => {
|
|
11864
|
+
if (isMouseDown) addCardToSelection(card);
|
|
11865
|
+
},
|
|
11866
|
+
style: {
|
|
11867
|
+
backgroundColor: getBackgroundColor(isSelected, card)
|
|
11868
|
+
}
|
|
11869
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
11870
|
+
className: "card-header-tooth",
|
|
11871
|
+
style: {
|
|
11872
|
+
zIndex: 2
|
|
11873
|
+
}
|
|
11874
|
+
}, card?.key), /*#__PURE__*/React.createElement("div", {
|
|
11875
|
+
title: card?.basicMaterial?.MaterialTypeLabel,
|
|
11876
|
+
className: "card-body-tooth"
|
|
11877
|
+
}, card?.basicMaterial?.MaterialTypeLabel), /*#__PURE__*/React.createElement("div", {
|
|
11878
|
+
title: card?.colorLotRef && card?.colorLotRef?.length > 0 ? card?.colorLotRef.map(el => JSON.stringify(el, null, 4)) : "",
|
|
11879
|
+
className: "card-body-tooth"
|
|
11880
|
+
}, card?.colorLotRef && card?.colorLotRef?.length > 0 ? "colors" : ""), /*#__PURE__*/React.createElement("div", {
|
|
11881
|
+
title: card?.productValue?.label,
|
|
11882
|
+
className: "card-body-tooth"
|
|
11883
|
+
}, card?.productValue?.label ? " " + card?.productValue?.label + " " : ""), /*#__PURE__*/React.createElement("div", {
|
|
11884
|
+
title: card?.basicMaterial?.MaterialTypeLabel,
|
|
11885
|
+
className: "card-body-tooth"
|
|
11886
|
+
}, card?.basicMaterial?.disk ? " " + card?.basicMaterial?.disk + " " : ""), /*#__PURE__*/React.createElement("div", {
|
|
11887
|
+
className: "card-footer-tooth"
|
|
11888
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
11889
|
+
className: "card-footer-tooth-multi"
|
|
11890
|
+
}, card?.clen ? /*#__PURE__*/React.createElement("b", null, "X") : "", card?.ankerValues?.value ? " A " : "", card?.implantatValues ? " I " : "")));
|
|
11891
|
+
};
|
|
11892
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
11893
|
+
className: "fieldsInline001 fieldsInlineTeeth"
|
|
11894
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
11895
|
+
title: lang?.["clearSelectedDescription"] ?? "clearSelectedDescription",
|
|
11896
|
+
type: "delete",
|
|
11897
|
+
style: {
|
|
11898
|
+
float: "end"
|
|
11899
|
+
},
|
|
11900
|
+
onClick: () => setSelectedKeys([]),
|
|
11901
|
+
disabled: selectedKeys?.length === 0
|
|
11902
|
+
}, lang?.["clearSelected"] ?? "clearSelected"), /*#__PURE__*/React.createElement(Button, {
|
|
11903
|
+
title: lang?.["selectAllDescription"] ?? "selectAllDescription",
|
|
11904
|
+
type: "ok",
|
|
11905
|
+
style: {
|
|
11906
|
+
float: "end"
|
|
11907
|
+
},
|
|
11908
|
+
onClick: () => setSelectedKeys(_markers.map(el => el.key))
|
|
11909
|
+
}, lang?.["selectAll"] ?? "selectAll"), /*#__PURE__*/React.createElement(Button, {
|
|
11910
|
+
title: lang?.["clearLastSelectedOneAtOnceDescription"] ?? "clearLastSelectedOneAtOnceDescription",
|
|
11911
|
+
type: "cancel",
|
|
11912
|
+
style: {
|
|
11913
|
+
float: "end"
|
|
11914
|
+
},
|
|
11915
|
+
onClick: () => setSelectedKeys(prev => prev.slice(0, -1)),
|
|
11916
|
+
disabled: selectedKeys?.length === 0
|
|
11917
|
+
}, lang?.["clearLastSelectedOneAtOnce"] ?? "clearLastSelectedOneAtOnce")), /*#__PURE__*/React.createElement("div", {
|
|
11918
|
+
className: "bodyTeeth"
|
|
11919
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
11920
|
+
className: "bodyTeeth-first-row"
|
|
11921
|
+
}, markers.slice(0, 16).map(m => renderCard(m))), /*#__PURE__*/React.createElement("div", {
|
|
11922
|
+
className: "bodyTeeth-second-row"
|
|
11923
|
+
}, markers.slice(16, 32).map(m => renderCard(m))), /*#__PURE__*/React.createElement("div", {
|
|
11924
|
+
className: "horizontal-line-h"
|
|
11925
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
11926
|
+
className: "vertical-line-v"
|
|
11927
|
+
})));
|
|
11928
|
+
};
|
|
11929
|
+
|
|
11603
11930
|
exports.Button = Button;
|
|
11604
11931
|
exports.CalendarRangePicker = CalendarRangePicker;
|
|
11932
|
+
exports.CardSelect = CardSelect;
|
|
11605
11933
|
exports.ColorPicker = ColorPicker;
|
|
11606
11934
|
exports.DateTimeInput = DateTimeInput;
|
|
11607
11935
|
exports.DebounceSelect = DebounceSelect;
|