@lowentry/mui 1.2.9 → 1.2.11
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/DatePicker/index.js +157 -1
- package/DatePicker/index.js.map +1 -1
- package/Dialog/index.js +27 -1
- package/Dialog/index.js.map +1 -1
- package/InitiallyInvisible/index.js +39 -1
- package/InitiallyInvisible/index.js.map +1 -1
- package/LeMuiUtils-c46ed1cc.js +33 -1
- package/LeMuiUtils-c46ed1cc.js.map +1 -1
- package/LoadingSpinner/index.js +8 -1
- package/LoadingSpinner/index.js.map +1 -1
- package/LoadingSpinner-49031768.js +65 -1
- package/LoadingSpinner-49031768.js.map +1 -1
- package/LoadingSpinnerWidget/index.js +8 -1
- package/LoadingSpinnerWidget/index.js.map +1 -1
- package/MenuButton/index.js +61 -1
- package/MenuButton/index.js.map +1 -1
- package/MuiRoot/index.js +28 -1
- package/MuiRoot/index.js.map +1 -1
- package/NumericTextField/index.js +107 -1
- package/NumericTextField/index.js.map +1 -1
- package/RemovableNumericTextField/index.js +47 -1
- package/RemovableNumericTextField/index.js.map +1 -1
- package/RemovableTextField/index.js +53 -1
- package/RemovableTextField/index.js.map +1 -1
- package/Submittable/index.js +32 -1
- package/Submittable/index.js.map +1 -1
- package/TextField/index.js +32 -1
- package/TextField/index.js.map +1 -1
- package/index.js +26 -1
- package/index.js.map +1 -1
- package/package.json +2 -2
- package/src/components/NumericTextField.jsx +64 -66
- package/src/components/RemovableNumericTextField.jsx +1 -1
- package/style-inject.es-1f59c1d0.js +28 -1
- package/style-inject.es-1f59c1d0.js.map +1 -1
package/DatePicker/index.js
CHANGED
|
@@ -1,2 +1,158 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
2
|
+
import _extends from '@babel/runtime/helpers/extends';
|
|
3
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
4
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { LeRed } from '@lowentry/react-redux';
|
|
7
|
+
import { IS_ARRAY } from '@lowentry/utils';
|
|
8
|
+
import Dayjs from 'dayjs';
|
|
9
|
+
import { Button, TextField, Stack } from '@mui/material';
|
|
10
|
+
import { DatePicker as DatePicker$1 } from '@mui/x-date-pickers';
|
|
11
|
+
import ArrowBackIosNewIcon from '@mui/icons-material/ArrowBackIosNew';
|
|
12
|
+
import ArrowForwardIosIcon from '@mui/icons-material/ArrowForwardIos';
|
|
13
|
+
import { s as styleInject } from '../style-inject.es-1f59c1d0.js';
|
|
14
|
+
|
|
15
|
+
var css_248z = ".lowentry-mui--date-picker{padding:.5rem}.lowentry-mui--date-picker .lowentry-mui--date-picker--arrow-button{min-width:0;padding:6px 12px}.lowentry-mui--date-picker .lowentry-mui--date-picker--textfield{cursor:pointer!important;max-width:150px}.lowentry-mui--date-picker .lowentry-mui--date-picker--textfield .MuiInputBase-input{padding:10px 0;text-align:center}.lowentry-mui--date-picker .lowentry-mui--date-picker--textfield .MuiOutlinedInput-notchedOutline{border:0!important}.lowentry-mui--date-picker .lowentry-mui--date-picker--textfield *{cursor:pointer!important}";
|
|
16
|
+
styleInject(css_248z);
|
|
17
|
+
|
|
18
|
+
var _excluded = ["dateFormat", "value", "className"],
|
|
19
|
+
_excluded2 = ["value", "dateFormat", "onChange", "className", "children"];
|
|
20
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
21
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
22
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
23
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
24
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
25
|
+
var DatePickerTextField = LeRed.memo(function (_ref) {
|
|
26
|
+
var _props$ownerState2, _props$InputProps2, _props$InputProps3;
|
|
27
|
+
var dateFormat = _ref.dateFormat,
|
|
28
|
+
value = _ref.value,
|
|
29
|
+
className = _ref.className,
|
|
30
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
31
|
+
var onClick = LeRed.useMemo(function () {
|
|
32
|
+
var _props$ownerState, _props$InputProps;
|
|
33
|
+
if (props !== null && props !== void 0 && (_props$ownerState = props.ownerState) !== null && _props$ownerState !== void 0 && _props$ownerState.open) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
var propsLoop = props === null || props === void 0 || (_props$InputProps = props.InputProps) === null || _props$InputProps === void 0 || (_props$InputProps = _props$InputProps.endAdornment) === null || _props$InputProps === void 0 ? void 0 : _props$InputProps.props;
|
|
37
|
+
while (propsLoop) {
|
|
38
|
+
var _propsLoop, _propsLoop2;
|
|
39
|
+
if (propsLoop.onClick) {
|
|
40
|
+
return propsLoop.onClick;
|
|
41
|
+
}
|
|
42
|
+
if ((_propsLoop = propsLoop) !== null && _propsLoop !== void 0 && _propsLoop.children) {
|
|
43
|
+
propsLoop = propsLoop.children;
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
if (IS_ARRAY(propsLoop)) {
|
|
47
|
+
var continueLoop = false;
|
|
48
|
+
var _iterator = _createForOfIteratorHelper(propsLoop),
|
|
49
|
+
_step;
|
|
50
|
+
try {
|
|
51
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
52
|
+
var propsLoopItem = _step.value;
|
|
53
|
+
if (propsLoopItem !== null && propsLoopItem !== void 0 && propsLoopItem.props) {
|
|
54
|
+
propsLoop = propsLoopItem.props;
|
|
55
|
+
continueLoop = true;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
} catch (err) {
|
|
59
|
+
_iterator.e(err);
|
|
60
|
+
} finally {
|
|
61
|
+
_iterator.f();
|
|
62
|
+
}
|
|
63
|
+
if (continueLoop) {
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
propsLoop = (_propsLoop2 = propsLoop) === null || _propsLoop2 === void 0 ? void 0 : _propsLoop2.props;
|
|
68
|
+
}
|
|
69
|
+
return null;
|
|
70
|
+
}, [props === null || props === void 0 || (_props$ownerState2 = props.ownerState) === null || _props$ownerState2 === void 0 ? void 0 : _props$ownerState2.open, props === null || props === void 0 || (_props$InputProps2 = props.InputProps) === null || _props$InputProps2 === void 0 || (_props$InputProps2 = _props$InputProps2.endAdornment) === null || _props$InputProps2 === void 0 ? void 0 : _props$InputProps2.props]);
|
|
71
|
+
var onSelect = LeRed.useCallback(function (event) {
|
|
72
|
+
event.target.selectionStart = event.target.selectionEnd;
|
|
73
|
+
event.preventDefault();
|
|
74
|
+
}, []);
|
|
75
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
|
|
76
|
+
variant: "outlined",
|
|
77
|
+
onClick: onClick
|
|
78
|
+
}, /*#__PURE__*/React.createElement(TextField, _extends({}, props, {
|
|
79
|
+
className: 'lowentry-mui--date-picker--textfield ' + (className !== null && className !== void 0 ? className : ''),
|
|
80
|
+
variant: "outlined",
|
|
81
|
+
value: Dayjs(value).format(dateFormat),
|
|
82
|
+
InputProps: _objectSpread(_objectSpread({}, (_props$InputProps3 = props.InputProps) !== null && _props$InputProps3 !== void 0 ? _props$InputProps3 : {}), {}, {
|
|
83
|
+
readOnly: true,
|
|
84
|
+
endAdornment: null,
|
|
85
|
+
onSelect: onSelect,
|
|
86
|
+
onSelectCapture: onSelect,
|
|
87
|
+
onMouseDown: onSelect,
|
|
88
|
+
onTouchStart: onSelect,
|
|
89
|
+
onTouchMove: onSelect
|
|
90
|
+
})
|
|
91
|
+
}))));
|
|
92
|
+
});
|
|
93
|
+
var DatePicker = LeRed.memo(function (_ref2) {
|
|
94
|
+
var value = _ref2.value,
|
|
95
|
+
dateFormat = _ref2.dateFormat,
|
|
96
|
+
onChange = _ref2.onChange,
|
|
97
|
+
className = _ref2.className;
|
|
98
|
+
_ref2.children;
|
|
99
|
+
var props = _objectWithoutProperties(_ref2, _excluded2);
|
|
100
|
+
if (!dateFormat) {
|
|
101
|
+
dateFormat = 'ddd, D MMM YYYY';
|
|
102
|
+
}
|
|
103
|
+
var _LeRed$useHistoryStat = LeRed.useHistoryState(false),
|
|
104
|
+
_LeRed$useHistoryStat2 = _slicedToArray(_LeRed$useHistoryStat, 3),
|
|
105
|
+
datepickerOpen = _LeRed$useHistoryStat2[0],
|
|
106
|
+
openDatepicker = _LeRed$useHistoryStat2[1],
|
|
107
|
+
closeDatepicker = _LeRed$useHistoryStat2[2];
|
|
108
|
+
var onChanged = LeRed.useCallback(function () {
|
|
109
|
+
if (onChange) {
|
|
110
|
+
onChange.apply(void 0, arguments);
|
|
111
|
+
}
|
|
112
|
+
}, [onChange]);
|
|
113
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Stack, _extends({
|
|
114
|
+
className: 'lowentry-mui--date-picker ' + (className !== null && className !== void 0 ? className : ''),
|
|
115
|
+
direction: "row",
|
|
116
|
+
justifyContent: "space-between",
|
|
117
|
+
spacing: 1
|
|
118
|
+
}, props), /*#__PURE__*/React.createElement(Button, {
|
|
119
|
+
className: "lowentry-mui--date-picker--arrow-button",
|
|
120
|
+
variant: "text",
|
|
121
|
+
color: "primary",
|
|
122
|
+
onClick: function onClick() {
|
|
123
|
+
return onChanged(Dayjs(value).subtract(1, 'day'));
|
|
124
|
+
}
|
|
125
|
+
}, /*#__PURE__*/React.createElement(ArrowBackIosNewIcon, null)), /*#__PURE__*/React.createElement(DatePicker$1, {
|
|
126
|
+
open: datepickerOpen,
|
|
127
|
+
onOpen: openDatepicker,
|
|
128
|
+
onClose: closeDatepicker,
|
|
129
|
+
showDaysOutsideCurrentMonth: true,
|
|
130
|
+
views: ['day'],
|
|
131
|
+
format: "YYYY-MM-DD",
|
|
132
|
+
label: "",
|
|
133
|
+
isRequired: true,
|
|
134
|
+
value: value,
|
|
135
|
+
onChange: onChanged,
|
|
136
|
+
slots: {
|
|
137
|
+
textField: DatePickerTextField,
|
|
138
|
+
toolbar: function toolbar(props) {
|
|
139
|
+
return null;
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
slotProps: {
|
|
143
|
+
textField: {
|
|
144
|
+
dateFormat: dateFormat
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}), /*#__PURE__*/React.createElement(Button, {
|
|
148
|
+
className: "lowentry-mui--date-picker--arrow-button",
|
|
149
|
+
variant: "text",
|
|
150
|
+
color: "primary",
|
|
151
|
+
onClick: function onClick() {
|
|
152
|
+
return onChanged(Dayjs(value).add(1, 'day'));
|
|
153
|
+
}
|
|
154
|
+
}, /*#__PURE__*/React.createElement(ArrowForwardIosIcon, null))));
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
export { DatePicker as default };
|
|
2
158
|
//# sourceMappingURL=index.js.map
|
package/DatePicker/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/components/DatePicker.jsx"],"sourcesContent":["import React from 'react';\nimport {LeRed} from '@lowentry/react-redux';\nimport {IS_ARRAY} from '@lowentry/utils';\nimport Dayjs from 'dayjs';\nimport {Button, Stack, TextField} from '@mui/material';\nimport {DatePicker as MuiDatePicker} from '@mui/x-date-pickers';\nimport ArrowBackIosNewIcon from '@mui/icons-material/ArrowBackIosNew';\nimport ArrowForwardIosIcon from '@mui/icons-material/ArrowForwardIos';\nimport './DatePicker.less';\n\n\nconst DatePickerTextField = LeRed.memo(({dateFormat, value, className, ...props}) =>\n{\n\tconst onClick = LeRed.useMemo(() =>\n\t{\n\t\tif(props?.ownerState?.open)\n\t\t{\n\t\t\treturn null;\n\t\t}\n\t\tlet propsLoop = props?.InputProps?.endAdornment?.props;\n\t\twhile(propsLoop)\n\t\t{\n\t\t\tif(propsLoop.onClick)\n\t\t\t{\n\t\t\t\treturn propsLoop.onClick;\n\t\t\t}\n\t\t\tif(propsLoop?.children)\n\t\t\t{\n\t\t\t\tpropsLoop = propsLoop.children;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif(IS_ARRAY(propsLoop))\n\t\t\t{\n\t\t\t\tlet continueLoop = false;\n\t\t\t\tfor(const propsLoopItem of propsLoop)\n\t\t\t\t{\n\t\t\t\t\tif(propsLoopItem?.props)\n\t\t\t\t\t{\n\t\t\t\t\t\tpropsLoop = propsLoopItem.props;\n\t\t\t\t\t\tcontinueLoop = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(continueLoop)\n\t\t\t\t{\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t\tpropsLoop = propsLoop?.props;\n\t\t}\n\t\treturn null;\n\t}, [props?.ownerState?.open, props?.InputProps?.endAdornment?.props]);\n\t\n\t\n\tconst onSelect = LeRed.useCallback((event) =>\n\t{\n\t\tevent.target.selectionStart = event.target.selectionEnd;\n\t\tevent.preventDefault();\n\t}, []);\n\t\n\t\n\treturn (<>\n\t\t<Button variant=\"outlined\" onClick={onClick}>\n\t\t\t<TextField {...props} className={'lowentry-mui--date-picker--textfield ' + (className ?? '')} variant=\"outlined\" value={Dayjs(value).format(dateFormat)} InputProps={{...(props.InputProps ?? {}), readOnly:true, endAdornment:null, onSelect:onSelect, onSelectCapture:onSelect, onMouseDown:onSelect, onTouchStart:onSelect, onTouchMove:onSelect}}/>\n\t\t</Button>\n\t</>);\n});\n\n\nconst DatePicker = LeRed.memo(({value, dateFormat, onChange, className, children, ...props}) =>\n{\n\tif(!dateFormat)\n\t{\n\t\tdateFormat = 'ddd, D MMM YYYY';\n\t}\n\t\n\tconst [datepickerOpen, openDatepicker, closeDatepicker] = LeRed.useHistoryState(false);\n\t\n\t\n\tconst onChanged = LeRed.useCallback((...args) =>\n\t{\n\t\tif(onChange)\n\t\t{\n\t\t\tonChange(...args);\n\t\t}\n\t}, [onChange]);\n\t\n\t\n\treturn (<>\n\t\t<Stack className={'lowentry-mui--date-picker ' + (className ?? '')} direction=\"row\" justifyContent=\"space-between\" spacing={1} {...props}>\n\t\t\t<Button className=\"lowentry-mui--date-picker--arrow-button\" variant=\"text\" color=\"primary\" onClick={() => onChanged(Dayjs(value).subtract(1, 'day'))}><ArrowBackIosNewIcon/></Button>\n\t\t\t<MuiDatePicker\n\t\t\t\topen={datepickerOpen}\n\t\t\t\tonOpen={openDatepicker}\n\t\t\t\tonClose={closeDatepicker}\n\t\t\t\tshowDaysOutsideCurrentMonth={true}\n\t\t\t\tviews={['day']}\n\t\t\t\tformat=\"YYYY-MM-DD\"\n\t\t\t\tlabel=\"\"\n\t\t\t\tisRequired={true}\n\t\t\t\tvalue={value}\n\t\t\t\tonChange={onChanged}\n\t\t\t\tslots={{\n\t\t\t\t\ttextField:DatePickerTextField,\n\t\t\t\t\ttoolbar: (props) => null,\n\t\t\t\t}}\n\t\t\t\tslotProps={{\n\t\t\t\t\ttextField:{dateFormat},\n\t\t\t\t}}\n\t\t\t/>\n\t\t\t<Button className=\"lowentry-mui--date-picker--arrow-button\" variant=\"text\" color=\"primary\" onClick={() => onChanged(Dayjs(value).add(1, 'day'))}><ArrowForwardIosIcon/></Button>\n\t\t</Stack>\n\t</>);\n});\nexport default DatePicker;\n"],"names":["DatePickerTextField","LeRed","memo","_ref","_props$ownerState2","_props$InputProps2","_props$InputProps3","dateFormat","value","className","props","_objectWithoutProperties","_excluded","onClick","useMemo","_props$ownerState","_props$InputProps","ownerState","open","propsLoop","InputProps","endAdornment","_propsLoop","_propsLoop2","children","IS_ARRAY","_step","continueLoop","_iterator","_createForOfIteratorHelper","s","n","done","propsLoopItem","err","e","f","onSelect","useCallback","event","target","selectionStart","selectionEnd","preventDefault","React","createElement","Fragment","Button","variant","TextField","_extends","Dayjs","format","_objectSpread","readOnly","onSelectCapture","onMouseDown","onTouchStart","onTouchMove","DatePicker","_ref2","onChange","_excluded2","_LeRed$useHistoryStat","useHistoryState","_LeRed$useHistoryStat2","_slicedToArray","datepickerOpen","openDatepicker","closeDatepicker","onChanged","apply","arguments","Stack","direction","justifyContent","spacing","color","subtract","ArrowBackIosNewIcon","MuiDatePicker","onOpen","onClose","showDaysOutsideCurrentMonth","views","label","isRequired","slots","textField","toolbar","slotProps","add","ArrowForwardIosIcon"],"mappings":"4zFAWA,IAAMA,EAAsBC,EAAMC,MAAK,SAAAC,GACvC,IAAAC,EAAAC,EAAAC,EADyCC,EAAUJ,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,EAAa,CACb9D,KAAMiD,EACNc,OAAQb,EACRc,QAASb,EACTc,6BAA6B,EAC7BC,MAAO,CAAC,OACRhC,OAAO,aACPiC,MAAM,GACNC,YAAY,EACZ9E,MAAOA,EACPqD,SAAUS,EACViB,MAAO,CACNC,UAAUxF,EACVyF,QAAU,SAAC/E,GAAK,OAAK,IAAI,GAE1BgF,UAAW,CACVF,UAAU,CAACjF,WAAAA,MAGbqC,EAAAC,cAACE,EAAM,CAACtC,UAAU,0CAA0CuC,QAAQ,OAAO6B,MAAM,UAAUhE,QAAS,WAAA,OAAMyD,EAAUnB,EAAM3C,GAAOmF,IAAI,EAAG,OAAO,GAAE/C,EAAAC,cAAC+C,EAAoB,QAGzK"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/components/DatePicker.jsx"],"sourcesContent":["import React from 'react';\nimport {LeRed} from '@lowentry/react-redux';\nimport {IS_ARRAY} from '@lowentry/utils';\nimport Dayjs from 'dayjs';\nimport {Button, Stack, TextField} from '@mui/material';\nimport {DatePicker as MuiDatePicker} from '@mui/x-date-pickers';\nimport ArrowBackIosNewIcon from '@mui/icons-material/ArrowBackIosNew';\nimport ArrowForwardIosIcon from '@mui/icons-material/ArrowForwardIos';\nimport './DatePicker.less';\n\n\nconst DatePickerTextField = LeRed.memo(({dateFormat, value, className, ...props}) =>\n{\n\tconst onClick = LeRed.useMemo(() =>\n\t{\n\t\tif(props?.ownerState?.open)\n\t\t{\n\t\t\treturn null;\n\t\t}\n\t\tlet propsLoop = props?.InputProps?.endAdornment?.props;\n\t\twhile(propsLoop)\n\t\t{\n\t\t\tif(propsLoop.onClick)\n\t\t\t{\n\t\t\t\treturn propsLoop.onClick;\n\t\t\t}\n\t\t\tif(propsLoop?.children)\n\t\t\t{\n\t\t\t\tpropsLoop = propsLoop.children;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif(IS_ARRAY(propsLoop))\n\t\t\t{\n\t\t\t\tlet continueLoop = false;\n\t\t\t\tfor(const propsLoopItem of propsLoop)\n\t\t\t\t{\n\t\t\t\t\tif(propsLoopItem?.props)\n\t\t\t\t\t{\n\t\t\t\t\t\tpropsLoop = propsLoopItem.props;\n\t\t\t\t\t\tcontinueLoop = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(continueLoop)\n\t\t\t\t{\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t\tpropsLoop = propsLoop?.props;\n\t\t}\n\t\treturn null;\n\t}, [props?.ownerState?.open, props?.InputProps?.endAdornment?.props]);\n\t\n\t\n\tconst onSelect = LeRed.useCallback((event) =>\n\t{\n\t\tevent.target.selectionStart = event.target.selectionEnd;\n\t\tevent.preventDefault();\n\t}, []);\n\t\n\t\n\treturn (<>\n\t\t<Button variant=\"outlined\" onClick={onClick}>\n\t\t\t<TextField {...props} className={'lowentry-mui--date-picker--textfield ' + (className ?? '')} variant=\"outlined\" value={Dayjs(value).format(dateFormat)} InputProps={{...(props.InputProps ?? {}), readOnly:true, endAdornment:null, onSelect:onSelect, onSelectCapture:onSelect, onMouseDown:onSelect, onTouchStart:onSelect, onTouchMove:onSelect}}/>\n\t\t</Button>\n\t</>);\n});\n\n\nconst DatePicker = LeRed.memo(({value, dateFormat, onChange, className, children, ...props}) =>\n{\n\tif(!dateFormat)\n\t{\n\t\tdateFormat = 'ddd, D MMM YYYY';\n\t}\n\t\n\tconst [datepickerOpen, openDatepicker, closeDatepicker] = LeRed.useHistoryState(false);\n\t\n\t\n\tconst onChanged = LeRed.useCallback((...args) =>\n\t{\n\t\tif(onChange)\n\t\t{\n\t\t\tonChange(...args);\n\t\t}\n\t}, [onChange]);\n\t\n\t\n\treturn (<>\n\t\t<Stack className={'lowentry-mui--date-picker ' + (className ?? '')} direction=\"row\" justifyContent=\"space-between\" spacing={1} {...props}>\n\t\t\t<Button className=\"lowentry-mui--date-picker--arrow-button\" variant=\"text\" color=\"primary\" onClick={() => onChanged(Dayjs(value).subtract(1, 'day'))}><ArrowBackIosNewIcon/></Button>\n\t\t\t<MuiDatePicker\n\t\t\t\topen={datepickerOpen}\n\t\t\t\tonOpen={openDatepicker}\n\t\t\t\tonClose={closeDatepicker}\n\t\t\t\tshowDaysOutsideCurrentMonth={true}\n\t\t\t\tviews={['day']}\n\t\t\t\tformat=\"YYYY-MM-DD\"\n\t\t\t\tlabel=\"\"\n\t\t\t\tisRequired={true}\n\t\t\t\tvalue={value}\n\t\t\t\tonChange={onChanged}\n\t\t\t\tslots={{\n\t\t\t\t\ttextField:DatePickerTextField,\n\t\t\t\t\ttoolbar: (props) => null,\n\t\t\t\t}}\n\t\t\t\tslotProps={{\n\t\t\t\t\ttextField:{dateFormat},\n\t\t\t\t}}\n\t\t\t/>\n\t\t\t<Button className=\"lowentry-mui--date-picker--arrow-button\" variant=\"text\" color=\"primary\" onClick={() => onChanged(Dayjs(value).add(1, 'day'))}><ArrowForwardIosIcon/></Button>\n\t\t</Stack>\n\t</>);\n});\nexport default DatePicker;\n"],"names":["DatePickerTextField","LeRed","memo","_ref","_props$ownerState2","_props$InputProps2","_props$InputProps3","dateFormat","value","className","props","_objectWithoutProperties","_excluded","onClick","useMemo","_props$ownerState","_props$InputProps","ownerState","open","propsLoop","InputProps","endAdornment","_propsLoop","_propsLoop2","children","IS_ARRAY","continueLoop","_iterator","_createForOfIteratorHelper","_step","s","n","done","propsLoopItem","err","e","f","onSelect","useCallback","event","target","selectionStart","selectionEnd","preventDefault","React","createElement","Fragment","Button","variant","TextField","_extends","Dayjs","format","_objectSpread","readOnly","onSelectCapture","onMouseDown","onTouchStart","onTouchMove","DatePicker","_ref2","onChange","_excluded2","_LeRed$useHistoryStat","useHistoryState","_LeRed$useHistoryStat2","_slicedToArray","datepickerOpen","openDatepicker","closeDatepicker","onChanged","apply","arguments","Stack","direction","justifyContent","spacing","color","subtract","ArrowBackIosNewIcon","MuiDatePicker","onOpen","onClose","showDaysOutsideCurrentMonth","views","label","isRequired","slots","textField","toolbar","slotProps","add","ArrowForwardIosIcon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AM;AACbqD,IAAAA,QAAQ,EAAES,SAAU;AACpBiB,IAAAA,KAAK,EAAE;AACNC,MAAAA,SAAS,EAACxF,mBAAmB;MAC7ByF,OAAO,EAAG,SAAAA,OAAAA,CAAC/E,KAAK,EAAA;AAAA,QAAA,OAAK,IAAI,CAAA;AAAA,OAAA;KACxB;AACFgF,IAAAA,SAAS,EAAE;AACVF,MAAAA,SAAS,EAAC;AAACjF,QAAAA,UAAU,EAAVA,UAAAA;AAAU,OAAA;AACtB,KAAA;AAAE,GACF,CAAC,eACFqC,KAAA,CAAAC,aAAA,CAACE,MAAM,EAAA;AAACtC,IAAAA,SAAS,EAAC,yCAAyC;AAACuC,IAAAA,OAAO,EAAC,MAAM;AAAC6B,IAAAA,KAAK,EAAC,SAAS;IAAChE,OAAO,EAAE,SAAAA,OAAA,GAAA;AAAA,MAAA,OAAMyD,SAAS,CAACnB,KAAK,CAAC3C,KAAK,CAAC,CAACmF,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAA;AAAA,KAAA;GAAE/C,eAAAA,KAAA,CAAAC,aAAA,CAAC+C,mBAAmB,EAAC,IAAA,CAAS,CACzK,CACN,CAAC,CAAA;AACJ,CAAC;;;;"}
|
package/Dialog/index.js
CHANGED
|
@@ -1,2 +1,28 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _extends from '@babel/runtime/helpers/extends';
|
|
2
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { LeRed } from '@lowentry/react-redux';
|
|
5
|
+
import { STRING } from '@lowentry/utils';
|
|
6
|
+
import { Dialog as Dialog$1 } from '@mui/material';
|
|
7
|
+
|
|
8
|
+
var _excluded = ["onClose", "children"];
|
|
9
|
+
var Dialog = LeRed.memo(function (_ref) {
|
|
10
|
+
var onClose = _ref.onClose,
|
|
11
|
+
children = _ref.children,
|
|
12
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
13
|
+
var onClosed = LeRed.useCallback(function (event, reason) {
|
|
14
|
+
if (!STRING(reason).toLowerCase().includes('escape')) {
|
|
15
|
+
// prevent closing when clicking on the backdrop, only allow escape-key closing
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
if (onClose) {
|
|
19
|
+
onClose(event, reason);
|
|
20
|
+
}
|
|
21
|
+
}, [onClose]);
|
|
22
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Dialog$1, _extends({
|
|
23
|
+
onClose: onClosed
|
|
24
|
+
}, props), children));
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export { Dialog as default };
|
|
2
28
|
//# sourceMappingURL=index.js.map
|
package/Dialog/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/components/Dialog.jsx"],"sourcesContent":["import React from 'react';\nimport {LeRed} from '@lowentry/react-redux';\nimport {STRING} from '@lowentry/utils';\nimport {Dialog as MuiDialog} from '@mui/material';\n\n\nconst Dialog = LeRed.memo(({onClose, children, ...props}) =>\n{\n\tconst onClosed = LeRed.useCallback((event, reason) =>\n\t{\n\t\tif(!STRING(reason).toLowerCase().includes('escape'))\n\t\t{\n\t\t\t// prevent closing when clicking on the backdrop, only allow escape-key closing\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif(onClose)\n\t\t{\n\t\t\tonClose(event, reason);\n\t\t}\n\t}, [onClose]);\n\t\n\t\n\treturn (<>\n\t\t<MuiDialog onClose={onClosed} {...props}>\n\t\t\t{children}\n\t\t</MuiDialog>\n\t</>);\n});\nexport default Dialog;\n"],"names":["Dialog","LeRed","memo","_ref","onClose","children","props","_objectWithoutProperties","_excluded","onClosed","useCallback","event","reason","STRING","toLowerCase","includes","React","createElement","Fragment","MuiDialog","_extends"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/components/Dialog.jsx"],"sourcesContent":["import React from 'react';\nimport {LeRed} from '@lowentry/react-redux';\nimport {STRING} from '@lowentry/utils';\nimport {Dialog as MuiDialog} from '@mui/material';\n\n\nconst Dialog = LeRed.memo(({onClose, children, ...props}) =>\n{\n\tconst onClosed = LeRed.useCallback((event, reason) =>\n\t{\n\t\tif(!STRING(reason).toLowerCase().includes('escape'))\n\t\t{\n\t\t\t// prevent closing when clicking on the backdrop, only allow escape-key closing\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif(onClose)\n\t\t{\n\t\t\tonClose(event, reason);\n\t\t}\n\t}, [onClose]);\n\t\n\t\n\treturn (<>\n\t\t<MuiDialog onClose={onClosed} {...props}>\n\t\t\t{children}\n\t\t</MuiDialog>\n\t</>);\n});\nexport default Dialog;\n"],"names":["Dialog","LeRed","memo","_ref","onClose","children","props","_objectWithoutProperties","_excluded","onClosed","useCallback","event","reason","STRING","toLowerCase","includes","React","createElement","Fragment","MuiDialog","_extends"],"mappings":";;;;;;;;AAMMA,IAAAA,MAAM,GAAGC,KAAK,CAACC,IAAI,CAAC,UAAAC,IAAA,EAC1B;AAAA,EAAA,IAD4BC,OAAO,GAAAD,IAAA,CAAPC,OAAO;IAAEC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;AAAKC,IAAAA,KAAK,GAAAC,wBAAA,CAAAJ,IAAA,EAAAK,SAAA,CAAA,CAAA;EAEtD,IAAMC,QAAQ,GAAGR,KAAK,CAACS,WAAW,CAAC,UAACC,KAAK,EAAEC,MAAM,EACjD;AACC,IAAA,IAAG,CAACC,MAAM,CAACD,MAAM,CAAC,CAACE,WAAW,EAAE,CAACC,QAAQ,CAAC,QAAQ,CAAC,EACnD;AACC;AACA,MAAA,OAAA;AACD,KAAA;AAEA,IAAA,IAAGX,OAAO,EACV;AACCA,MAAAA,OAAO,CAACO,KAAK,EAAEC,MAAM,CAAC,CAAA;AACvB,KAAA;AACD,GAAC,EAAE,CAACR,OAAO,CAAC,CAAC,CAAA;AAGb,EAAA,oBAAQY,KAAA,CAAAC,aAAA,CAAAD,KAAA,CAAAE,QAAA,EACPF,IAAAA,eAAAA,KAAA,CAAAC,aAAA,CAACE,QAAS,EAAAC,QAAA,CAAA;AAAChB,IAAAA,OAAO,EAAEK,QAAAA;AAAS,GAAA,EAAKH,KAAK,CAAA,EACrCD,QACS,CACV,CAAC,CAAA;AACJ,CAAC;;;;"}
|
|
@@ -1,2 +1,40 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _extends from '@babel/runtime/helpers/extends';
|
|
2
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
3
|
+
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
4
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { LeRed } from '@lowentry/react-redux';
|
|
7
|
+
import { LeUtils, INT_LAX } from '@lowentry/utils';
|
|
8
|
+
|
|
9
|
+
var _excluded = ["frames", "transition", "style", "children", "opacityKey"];
|
|
10
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
11
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
12
|
+
var InitiallyInvisible = LeRed.memo(function (_ref) {
|
|
13
|
+
var frames = _ref.frames,
|
|
14
|
+
transition = _ref.transition,
|
|
15
|
+
style = _ref.style,
|
|
16
|
+
children = _ref.children,
|
|
17
|
+
opacityKey = _ref.opacityKey,
|
|
18
|
+
other = _objectWithoutProperties(_ref, _excluded);
|
|
19
|
+
var _LeRed$useState = LeRed.useState(0),
|
|
20
|
+
_LeRed$useState2 = _slicedToArray(_LeRed$useState, 2),
|
|
21
|
+
opacity = _LeRed$useState2[0],
|
|
22
|
+
setOpacity = _LeRed$useState2[1];
|
|
23
|
+
LeRed.useEffect(function () {
|
|
24
|
+
setOpacity(0);
|
|
25
|
+
return LeUtils.setAnimationFrameTimeout(function () {
|
|
26
|
+
return setOpacity(1);
|
|
27
|
+
}, Math.max(opacityKey ? 2 : 0, INT_LAX(frames))).remove;
|
|
28
|
+
}, [opacityKey]);
|
|
29
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
30
|
+
style: _objectSpread({
|
|
31
|
+
width: '100%',
|
|
32
|
+
height: '100%',
|
|
33
|
+
opacity: opacity,
|
|
34
|
+
transition: opacity > 0 && transition ? 'opacity ' + transition : 'none'
|
|
35
|
+
}, style !== null && style !== void 0 ? style : {})
|
|
36
|
+
}, other), children);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
export { InitiallyInvisible as default };
|
|
2
40
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/components/InitiallyInvisible.jsx"],"sourcesContent":["import React from 'react';\nimport {LeRed} from '@lowentry/react-redux';\nimport {LeUtils, INT_LAX} from '@lowentry/utils';\n\n\nconst InitiallyInvisible = LeRed.memo(({frames, transition, style, children, opacityKey, ...other}) =>\n{\n\tconst [opacity, setOpacity] = LeRed.useState(0);\n\t\n\t\n\tLeRed.useEffect(() =>\n\t{\n\t\tsetOpacity(0);\n\t\treturn LeUtils.setAnimationFrameTimeout(() => setOpacity(1), Math.max((opacityKey ? 2 : 0), INT_LAX(frames))).remove;\n\t}, [opacityKey]);\n\t\n\t\n\treturn (<div style={{width:'100%', height:'100%', opacity, transition:(((opacity > 0) && transition) ? ('opacity ' + transition) : 'none'), ...(style ?? {})}} {...other}>{children}</div>);\n});\nexport default InitiallyInvisible;\n"],"names":["InitiallyInvisible","LeRed","memo","_ref","frames","transition","style","children","opacityKey","other","_objectWithoutProperties","_excluded","_LeRed$useState","useState","_LeRed$useState2","_slicedToArray","opacity","setOpacity","useEffect","LeUtils","setAnimationFrameTimeout","Math","max","INT_LAX","remove","React","createElement","_extends","_objectSpread","width","height"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/components/InitiallyInvisible.jsx"],"sourcesContent":["import React from 'react';\nimport {LeRed} from '@lowentry/react-redux';\nimport {LeUtils, INT_LAX} from '@lowentry/utils';\n\n\nconst InitiallyInvisible = LeRed.memo(({frames, transition, style, children, opacityKey, ...other}) =>\n{\n\tconst [opacity, setOpacity] = LeRed.useState(0);\n\t\n\t\n\tLeRed.useEffect(() =>\n\t{\n\t\tsetOpacity(0);\n\t\treturn LeUtils.setAnimationFrameTimeout(() => setOpacity(1), Math.max((opacityKey ? 2 : 0), INT_LAX(frames))).remove;\n\t}, [opacityKey]);\n\t\n\t\n\treturn (<div style={{width:'100%', height:'100%', opacity, transition:(((opacity > 0) && transition) ? ('opacity ' + transition) : 'none'), ...(style ?? {})}} {...other}>{children}</div>);\n});\nexport default InitiallyInvisible;\n"],"names":["InitiallyInvisible","LeRed","memo","_ref","frames","transition","style","children","opacityKey","other","_objectWithoutProperties","_excluded","_LeRed$useState","useState","_LeRed$useState2","_slicedToArray","opacity","setOpacity","useEffect","LeUtils","setAnimationFrameTimeout","Math","max","INT_LAX","remove","React","createElement","_extends","_objectSpread","width","height"],"mappings":";;;;;;;;;;;AAKMA,IAAAA,kBAAkB,GAAGC,KAAK,CAACC,IAAI,CAAC,UAAAC,IAAA,EACtC;AAAA,EAAA,IADwCC,MAAM,GAAAD,IAAA,CAANC,MAAM;IAAEC,UAAU,GAAAF,IAAA,CAAVE,UAAU;IAAEC,KAAK,GAAAH,IAAA,CAALG,KAAK;IAAEC,QAAQ,GAAAJ,IAAA,CAARI,QAAQ;IAAEC,UAAU,GAAAL,IAAA,CAAVK,UAAU;AAAKC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, LeUtils } from '@lowentry/utils';
|
|
2
|
+
|
|
3
|
+
var HIDDEN_CHAR = "\u200B";
|
|
4
|
+
var LeMuiUtils = {
|
|
5
|
+
onSelectEnsureMinimumOffset: function onSelectEnsureMinimumOffset(charactersCount) {
|
|
6
|
+
charactersCount = Math.max(0, INT_LAX(charactersCount));
|
|
7
|
+
if (charactersCount <= 0) {
|
|
8
|
+
return function () {};
|
|
9
|
+
}
|
|
10
|
+
return function (event) {
|
|
11
|
+
if (event && event.target) {
|
|
12
|
+
if (event.target.selectionEnd < charactersCount) {
|
|
13
|
+
event.target.setSelectionRange(charactersCount, charactersCount);
|
|
14
|
+
} else if (event.target.selectionStart < charactersCount) {
|
|
15
|
+
event.target.setSelectionRange(charactersCount, event.target.selectionEnd);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
},
|
|
20
|
+
prependHiddenChar: function prependHiddenChar(string) {
|
|
21
|
+
string = STRING(string);
|
|
22
|
+
if (string.startsWith(HIDDEN_CHAR)) {
|
|
23
|
+
return string;
|
|
24
|
+
}
|
|
25
|
+
return HIDDEN_CHAR + string;
|
|
26
|
+
},
|
|
27
|
+
purgePrependedHiddenChar: function purgePrependedHiddenChar(string) {
|
|
28
|
+
string = STRING(string);
|
|
29
|
+
return LeUtils.trimStart(string, ["\u200B", ' ', '\t', '\r', '\n']);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export { LeMuiUtils as L };
|
|
2
34
|
//# sourceMappingURL=LeMuiUtils-c46ed1cc.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LeMuiUtils-c46ed1cc.js","sources":["src/LeMuiUtils.js"],"sourcesContent":["import {LeUtils, STRING, INT_LAX} from '@lowentry/utils';\n\n\nconst HIDDEN_CHAR = '\\u200B';\n\n\nexport const LeMuiUtils = {\n\tonSelectEnsureMinimumOffset:\n\t\t(charactersCount) =>\n\t\t{\n\t\t\tcharactersCount = Math.max(0, INT_LAX(charactersCount));\n\t\t\tif(charactersCount <= 0)\n\t\t\t{\n\t\t\t\treturn () =>\n\t\t\t\t{\n\t\t\t\t};\n\t\t\t}\n\t\t\t\n\t\t\treturn (event) =>\n\t\t\t{\n\t\t\t\tif(event && event.target)\n\t\t\t\t{\n\t\t\t\t\tif(event.target.selectionEnd < charactersCount)\n\t\t\t\t\t{\n\t\t\t\t\t\tevent.target.setSelectionRange(charactersCount, charactersCount);\n\t\t\t\t\t}\n\t\t\t\t\telse if(event.target.selectionStart < charactersCount)\n\t\t\t\t\t{\n\t\t\t\t\t\tevent.target.setSelectionRange(charactersCount, event.target.selectionEnd);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\t\t},\n\t\n\tprependHiddenChar:\n\t\t(string) =>\n\t\t{\n\t\t\tstring = STRING(string);\n\t\t\tif(string.startsWith(HIDDEN_CHAR))\n\t\t\t{\n\t\t\t\treturn string;\n\t\t\t}\n\t\t\treturn HIDDEN_CHAR + string;\n\t\t},\n\t\n\tpurgePrependedHiddenChar:\n\t\t(string) =>\n\t\t{\n\t\t\tstring = STRING(string);\n\t\t\treturn LeUtils.trimStart(string, ['\\u200B', ' ', '\\t', '\\r', '\\n']);\n\t\t},\n};\n"],"names":["LeMuiUtils","onSelectEnsureMinimumOffset","charactersCount","Math","max","INT_LAX","event","target","selectionEnd","setSelectionRange","selectionStart","prependHiddenChar","string","STRING","startsWith","purgePrependedHiddenChar","LeUtils","trimStart"],"mappings":"
|
|
1
|
+
{"version":3,"file":"LeMuiUtils-c46ed1cc.js","sources":["src/LeMuiUtils.js"],"sourcesContent":["import {LeUtils, STRING, INT_LAX} from '@lowentry/utils';\n\n\nconst HIDDEN_CHAR = '\\u200B';\n\n\nexport const LeMuiUtils = {\n\tonSelectEnsureMinimumOffset:\n\t\t(charactersCount) =>\n\t\t{\n\t\t\tcharactersCount = Math.max(0, INT_LAX(charactersCount));\n\t\t\tif(charactersCount <= 0)\n\t\t\t{\n\t\t\t\treturn () =>\n\t\t\t\t{\n\t\t\t\t};\n\t\t\t}\n\t\t\t\n\t\t\treturn (event) =>\n\t\t\t{\n\t\t\t\tif(event && event.target)\n\t\t\t\t{\n\t\t\t\t\tif(event.target.selectionEnd < charactersCount)\n\t\t\t\t\t{\n\t\t\t\t\t\tevent.target.setSelectionRange(charactersCount, charactersCount);\n\t\t\t\t\t}\n\t\t\t\t\telse if(event.target.selectionStart < charactersCount)\n\t\t\t\t\t{\n\t\t\t\t\t\tevent.target.setSelectionRange(charactersCount, event.target.selectionEnd);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\t\t},\n\t\n\tprependHiddenChar:\n\t\t(string) =>\n\t\t{\n\t\t\tstring = STRING(string);\n\t\t\tif(string.startsWith(HIDDEN_CHAR))\n\t\t\t{\n\t\t\t\treturn string;\n\t\t\t}\n\t\t\treturn HIDDEN_CHAR + string;\n\t\t},\n\t\n\tpurgePrependedHiddenChar:\n\t\t(string) =>\n\t\t{\n\t\t\tstring = STRING(string);\n\t\t\treturn LeUtils.trimStart(string, ['\\u200B', ' ', '\\t', '\\r', '\\n']);\n\t\t},\n};\n"],"names":["HIDDEN_CHAR","LeMuiUtils","onSelectEnsureMinimumOffset","charactersCount","Math","max","INT_LAX","event","target","selectionEnd","setSelectionRange","selectionStart","prependHiddenChar","string","STRING","startsWith","purgePrependedHiddenChar","LeUtils","trimStart"],"mappings":";;AAGA,IAAMA,WAAW,GAAG,QAAQ,CAAA;AAGrB,IAAMC,UAAU,GAAG;AACzBC,EAAAA,2BAA2B,EAC1B,SAAAA,2BAACC,CAAAA,eAAe,EAChB;IACCA,eAAe,GAAGC,IAAI,CAACC,GAAG,CAAC,CAAC,EAAEC,OAAO,CAACH,eAAe,CAAC,CAAC,CAAA;IACvD,IAAGA,eAAe,IAAI,CAAC,EACvB;MACC,OAAO,YACP,EACC,CAAA;AACF,KAAA;IAEA,OAAO,UAACI,KAAK,EACb;AACC,MAAA,IAAGA,KAAK,IAAIA,KAAK,CAACC,MAAM,EACxB;AACC,QAAA,IAAGD,KAAK,CAACC,MAAM,CAACC,YAAY,GAAGN,eAAe,EAC9C;UACCI,KAAK,CAACC,MAAM,CAACE,iBAAiB,CAACP,eAAe,EAAEA,eAAe,CAAC,CAAA;SAChE,MACI,IAAGI,KAAK,CAACC,MAAM,CAACG,cAAc,GAAGR,eAAe,EACrD;AACCI,UAAAA,KAAK,CAACC,MAAM,CAACE,iBAAiB,CAACP,eAAe,EAAEI,KAAK,CAACC,MAAM,CAACC,YAAY,CAAC,CAAA;AAC3E,SAAA;AACD,OAAA;KACA,CAAA;GACD;AAEFG,EAAAA,iBAAiB,EAChB,SAAAA,iBAACC,CAAAA,MAAM,EACP;AACCA,IAAAA,MAAM,GAAGC,MAAM,CAACD,MAAM,CAAC,CAAA;AACvB,IAAA,IAAGA,MAAM,CAACE,UAAU,CAACf,WAAW,CAAC,EACjC;AACC,MAAA,OAAOa,MAAM,CAAA;AACd,KAAA;IACA,OAAOb,WAAW,GAAGa,MAAM,CAAA;GAC3B;AAEFG,EAAAA,wBAAwB,EACvB,SAAAA,wBAACH,CAAAA,MAAM,EACP;AACCA,IAAAA,MAAM,GAAGC,MAAM,CAACD,MAAM,CAAC,CAAA;AACvB,IAAA,OAAOI,OAAO,CAACC,SAAS,CAACL,MAAM,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAA;AACpE,GAAA;AACF;;;;"}
|
package/LoadingSpinner/index.js
CHANGED
|
@@ -1,2 +1,9 @@
|
|
|
1
|
-
export{L as default}from
|
|
1
|
+
export { L as default } from '../LoadingSpinner-49031768.js';
|
|
2
|
+
import '@babel/runtime/helpers/extends';
|
|
3
|
+
import '@babel/runtime/helpers/defineProperty';
|
|
4
|
+
import '@babel/runtime/helpers/objectWithoutProperties';
|
|
5
|
+
import 'react';
|
|
6
|
+
import '@lowentry/react-redux';
|
|
7
|
+
import '@mui/material';
|
|
8
|
+
import '../style-inject.es-1f59c1d0.js';
|
|
2
9
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
|
|
@@ -1,2 +1,66 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _extends from '@babel/runtime/helpers/extends';
|
|
2
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
3
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { LeRed } from '@lowentry/react-redux';
|
|
6
|
+
import { Backdrop, CircularProgress } from '@mui/material';
|
|
7
|
+
import { s as styleInject } from './style-inject.es-1f59c1d0.js';
|
|
8
|
+
|
|
9
|
+
var css_248z = ".lowentry-mui--loading-spinner{color:hsla(0,0%,100%,.04)}.lowentry-mui--loading-spinner.lowentry-mui--loading-spinner--transparent{background:transparent}";
|
|
10
|
+
styleInject(css_248z);
|
|
11
|
+
|
|
12
|
+
var _excluded = ["type", "className", "sx", "children"];
|
|
13
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
14
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
15
|
+
var loadingSpinnerCount = {};
|
|
16
|
+
var LoadingSpinnerGrab = function LoadingSpinnerGrab(_ref) {
|
|
17
|
+
var type = _ref.type;
|
|
18
|
+
loadingSpinnerCount[type] = (loadingSpinnerCount[type] || 0) + 1;
|
|
19
|
+
if (loadingSpinnerCount[type] === 1) {
|
|
20
|
+
LeRed.trigger('lowentry-mui--loading-spinner--' + type);
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
var LoadingSpinnerRelease = function LoadingSpinnerRelease(_ref2) {
|
|
24
|
+
var type = _ref2.type;
|
|
25
|
+
loadingSpinnerCount[type] = (loadingSpinnerCount[type] || 1) - 1;
|
|
26
|
+
if (loadingSpinnerCount[type] === 0) {
|
|
27
|
+
LeRed.trigger('lowentry-mui--loading-spinner--' + type);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
var LoadingSpinner = LeRed.memo(function (_ref3) {
|
|
31
|
+
var type = _ref3.type;
|
|
32
|
+
LeRed.useEffect(function () {
|
|
33
|
+
LoadingSpinnerGrab({
|
|
34
|
+
type: type
|
|
35
|
+
});
|
|
36
|
+
return function () {
|
|
37
|
+
return LoadingSpinnerRelease({
|
|
38
|
+
type: type
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
}, []);
|
|
42
|
+
return null;
|
|
43
|
+
});
|
|
44
|
+
var LoadingSpinnerWidget = LeRed.memo(function (_ref4) {
|
|
45
|
+
var type = _ref4.type,
|
|
46
|
+
className = _ref4.className,
|
|
47
|
+
sx = _ref4.sx;
|
|
48
|
+
_ref4.children;
|
|
49
|
+
var props = _objectWithoutProperties(_ref4, _excluded);
|
|
50
|
+
LeRed.useTriggerable('lowentry-mui--loading-spinner--' + type);
|
|
51
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Backdrop, _extends({
|
|
52
|
+
className: 'lowentry-mui--loading-spinner lowentry-mui--loading-spinner--' + type + ' ' + (className !== null && className !== void 0 ? className : ''),
|
|
53
|
+
sx: _objectSpread({
|
|
54
|
+
zIndex: function zIndex(theme) {
|
|
55
|
+
return theme.zIndex.drawer + 1;
|
|
56
|
+
}
|
|
57
|
+
}, sx !== null && sx !== void 0 ? sx : {}),
|
|
58
|
+
open: (loadingSpinnerCount[type] || 0) > 0
|
|
59
|
+
}, props), /*#__PURE__*/React.createElement(CircularProgress, {
|
|
60
|
+
color: "inherit",
|
|
61
|
+
size: "min(120px,30vw)"
|
|
62
|
+
})));
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
export { LoadingSpinner as L, LoadingSpinnerWidget as a };
|
|
2
66
|
//# sourceMappingURL=LoadingSpinner-49031768.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LoadingSpinner-49031768.js","sources":["src/components/LoadingSpinner/LoadingSpinner.jsx"],"sourcesContent":["import React from 'react';\nimport {LeRed} from '@lowentry/react-redux';\nimport {Backdrop, CircularProgress} from '@mui/material';\nimport './LoadingSpinner.less';\n\n\nlet loadingSpinnerCount = {};\nlet loadingSpinnerCountNonTransparent = 0;\n\nconst LoadingSpinnerGrab = ({type}) =>\n{\n\tloadingSpinnerCount[type] = (loadingSpinnerCount[type] || 0) + 1;\n\tif(loadingSpinnerCount[type] === 1)\n\t{\n\t\tLeRed.trigger('lowentry-mui--loading-spinner--' + type);\n\t}\n};\n\nconst LoadingSpinnerRelease = ({type}) =>\n{\n\tloadingSpinnerCount[type] = (loadingSpinnerCount[type] || 1) - 1;\n\tif(loadingSpinnerCount[type] === 0)\n\t{\n\t\tLeRed.trigger('lowentry-mui--loading-spinner--' + type);\n\t}\n};\n\n\nexport const LoadingSpinner = LeRed.memo(({type}) =>\n{\n\tLeRed.useEffect(() =>\n\t{\n\t\tLoadingSpinnerGrab({type});\n\t\treturn () => LoadingSpinnerRelease({type});\n\t}, []);\n\t\n\treturn null;\n});\n\n\nexport const LoadingSpinnerWidget = LeRed.memo(({type, className, sx, children, ...props}) =>\n{\n\tLeRed.useTriggerable('lowentry-mui--loading-spinner--' + type);\n\t\n\treturn (<>\n\t\t<Backdrop className={'lowentry-mui--loading-spinner lowentry-mui--loading-spinner--' + type + ' ' + (className ?? '')} sx={{zIndex:(theme) => theme.zIndex.drawer + 1, ...(sx ?? {})}} open={(loadingSpinnerCount[type] || 0) > 0} {...props}>\n\t\t\t<CircularProgress color=\"inherit\" size=\"min(120px,30vw)\"/>\n\t\t</Backdrop>\n\t</>);\n});\n"],"names":["loadingSpinnerCount","
|
|
1
|
+
{"version":3,"file":"LoadingSpinner-49031768.js","sources":["src/components/LoadingSpinner/LoadingSpinner.jsx"],"sourcesContent":["import React from 'react';\nimport {LeRed} from '@lowentry/react-redux';\nimport {Backdrop, CircularProgress} from '@mui/material';\nimport './LoadingSpinner.less';\n\n\nlet loadingSpinnerCount = {};\nlet loadingSpinnerCountNonTransparent = 0;\n\nconst LoadingSpinnerGrab = ({type}) =>\n{\n\tloadingSpinnerCount[type] = (loadingSpinnerCount[type] || 0) + 1;\n\tif(loadingSpinnerCount[type] === 1)\n\t{\n\t\tLeRed.trigger('lowentry-mui--loading-spinner--' + type);\n\t}\n};\n\nconst LoadingSpinnerRelease = ({type}) =>\n{\n\tloadingSpinnerCount[type] = (loadingSpinnerCount[type] || 1) - 1;\n\tif(loadingSpinnerCount[type] === 0)\n\t{\n\t\tLeRed.trigger('lowentry-mui--loading-spinner--' + type);\n\t}\n};\n\n\nexport const LoadingSpinner = LeRed.memo(({type}) =>\n{\n\tLeRed.useEffect(() =>\n\t{\n\t\tLoadingSpinnerGrab({type});\n\t\treturn () => LoadingSpinnerRelease({type});\n\t}, []);\n\t\n\treturn null;\n});\n\n\nexport const LoadingSpinnerWidget = LeRed.memo(({type, className, sx, children, ...props}) =>\n{\n\tLeRed.useTriggerable('lowentry-mui--loading-spinner--' + type);\n\t\n\treturn (<>\n\t\t<Backdrop className={'lowentry-mui--loading-spinner lowentry-mui--loading-spinner--' + type + ' ' + (className ?? '')} sx={{zIndex:(theme) => theme.zIndex.drawer + 1, ...(sx ?? {})}} open={(loadingSpinnerCount[type] || 0) > 0} {...props}>\n\t\t\t<CircularProgress color=\"inherit\" size=\"min(120px,30vw)\"/>\n\t\t</Backdrop>\n\t</>);\n});\n"],"names":["loadingSpinnerCount","LoadingSpinnerGrab","_ref","type","LeRed","trigger","LoadingSpinnerRelease","_ref2","LoadingSpinner","memo","_ref3","useEffect","LoadingSpinnerWidget","_ref4","className","sx","children","props","_objectWithoutProperties","_excluded","useTriggerable","React","createElement","Fragment","Backdrop","_extends","_objectSpread","zIndex","theme","drawer","open","CircularProgress","color","size"],"mappings":";;;;;;;;;;;;;;AAMA,IAAIA,mBAAmB,GAAG,EAAE,CAAA;AAG5B,IAAMC,kBAAkB,GAAG,SAArBA,kBAAkBA,CAAAC,IAAA,EACxB;AAAA,EAAA,IAD6BC,IAAI,GAAAD,IAAA,CAAJC,IAAI,CAAA;AAEhCH,EAAAA,mBAAmB,CAACG,IAAI,CAAC,GAAG,CAACH,mBAAmB,CAACG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AAChE,EAAA,IAAGH,mBAAmB,CAACG,IAAI,CAAC,KAAK,CAAC,EAClC;AACCC,IAAAA,KAAK,CAACC,OAAO,CAAC,iCAAiC,GAAGF,IAAI,CAAC,CAAA;AACxD,GAAA;AACD,CAAC,CAAA;AAED,IAAMG,qBAAqB,GAAG,SAAxBA,qBAAqBA,CAAAC,KAAA,EAC3B;AAAA,EAAA,IADgCJ,IAAI,GAAAI,KAAA,CAAJJ,IAAI,CAAA;AAEnCH,EAAAA,mBAAmB,CAACG,IAAI,CAAC,GAAG,CAACH,mBAAmB,CAACG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AAChE,EAAA,IAAGH,mBAAmB,CAACG,IAAI,CAAC,KAAK,CAAC,EAClC;AACCC,IAAAA,KAAK,CAACC,OAAO,CAAC,iCAAiC,GAAGF,IAAI,CAAC,CAAA;AACxD,GAAA;AACD,CAAC,CAAA;AAGM,IAAMK,cAAc,GAAGJ,KAAK,CAACK,IAAI,CAAC,UAAAC,KAAA,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AAA;AAAA,OAAA;KAAMd,EAAAA,EAAE,aAAFA,EAAE,KAAA,KAAA,CAAA,GAAFA,EAAE,GAAI,EAAE,CAAG;IAACe,IAAI,EAAE,CAAC9B,mBAAmB,CAACG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAA;AAAE,GAAA,EAAKc,KAAK,CAC3OI,eAAAA,KAAA,CAAAC,aAAA,CAACS,gBAAgB,EAAA;AAACC,IAAAA,KAAK,EAAC,SAAS;AAACC,IAAAA,IAAI,EAAC,iBAAA;GAAkB,CAChD,CACT,CAAC,CAAA;AACJ,CAAC;;;;"}
|
|
@@ -1,2 +1,9 @@
|
|
|
1
|
-
export{a as default}from
|
|
1
|
+
export { a as default } from '../LoadingSpinner-49031768.js';
|
|
2
|
+
import '@babel/runtime/helpers/extends';
|
|
3
|
+
import '@babel/runtime/helpers/defineProperty';
|
|
4
|
+
import '@babel/runtime/helpers/objectWithoutProperties';
|
|
5
|
+
import 'react';
|
|
6
|
+
import '@lowentry/react-redux';
|
|
7
|
+
import '@mui/material';
|
|
8
|
+
import '../style-inject.es-1f59c1d0.js';
|
|
2
9
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
|
package/MenuButton/index.js
CHANGED
|
@@ -1,2 +1,62 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _extends from '@babel/runtime/helpers/extends';
|
|
2
|
+
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
3
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { LeRed } from '@lowentry/react-redux';
|
|
6
|
+
import { LeUtils, ARRAY } from '@lowentry/utils';
|
|
7
|
+
import { Button, Menu } from '@mui/material';
|
|
8
|
+
|
|
9
|
+
var _excluded = ["icon", "className", "ref", "onClick", "onClose", "children"];
|
|
10
|
+
var MenuButton = LeRed.memo(function (_ref) {
|
|
11
|
+
var icon = _ref.icon,
|
|
12
|
+
className = _ref.className,
|
|
13
|
+
ref = _ref.ref,
|
|
14
|
+
onClick = _ref.onClick,
|
|
15
|
+
onClose = _ref.onClose,
|
|
16
|
+
children = _ref.children,
|
|
17
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
18
|
+
var buttonRef = LeRed.useRef();
|
|
19
|
+
var _LeRed$useState = LeRed.useState(false),
|
|
20
|
+
_LeRed$useState2 = _slicedToArray(_LeRed$useState, 2),
|
|
21
|
+
open = _LeRed$useState2[0],
|
|
22
|
+
setOpen = _LeRed$useState2[1];
|
|
23
|
+
var onClicked = LeRed.useCallback(function (event) {
|
|
24
|
+
setOpen(true);
|
|
25
|
+
if (onClick) {
|
|
26
|
+
onClick(event);
|
|
27
|
+
}
|
|
28
|
+
}, [onClick]);
|
|
29
|
+
var onClosed = LeRed.useCallback(function (event) {
|
|
30
|
+
setOpen(false);
|
|
31
|
+
if (onClose) {
|
|
32
|
+
onClose(event);
|
|
33
|
+
}
|
|
34
|
+
}, [onClose]);
|
|
35
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, _extends({
|
|
36
|
+
ref: LeRed.mergeRefs(buttonRef, ref),
|
|
37
|
+
className: 'lowentry-mui--menu-button allow-mobile-hover ' + (className !== null && className !== void 0 ? className : ''),
|
|
38
|
+
variant: "text",
|
|
39
|
+
color: "primary",
|
|
40
|
+
onClick: onClicked
|
|
41
|
+
}, props), icon), /*#__PURE__*/React.createElement(Menu, {
|
|
42
|
+
anchorEl: buttonRef.current,
|
|
43
|
+
open: open,
|
|
44
|
+
onClose: onClosed
|
|
45
|
+
}, LeUtils.mapToArray(ARRAY(children), function (child, index) {
|
|
46
|
+
var _child$props2, _child$props3;
|
|
47
|
+
return !!child && LeRed.cloneElement(child, {
|
|
48
|
+
key: index,
|
|
49
|
+
onClick: function onClick() {
|
|
50
|
+
var _child$props;
|
|
51
|
+
setOpen(false);
|
|
52
|
+
if (child !== null && child !== void 0 && (_child$props = child.props) !== null && _child$props !== void 0 && _child$props.onClick) {
|
|
53
|
+
child.props.onClick();
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
disabled: typeof (child === null || child === void 0 || (_child$props2 = child.props) === null || _child$props2 === void 0 ? void 0 : _child$props2.disabled) !== 'undefined' ? child.props.disabled : !(child !== null && child !== void 0 && (_child$props3 = child.props) !== null && _child$props3 !== void 0 && _child$props3.onClick)
|
|
57
|
+
});
|
|
58
|
+
})));
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
export { MenuButton as default };
|
|
2
62
|
//# sourceMappingURL=index.js.map
|