funda-ui 4.7.701 → 4.7.711

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.
@@ -51,7 +51,7 @@ export declare type EventCalendarTimelineProps = {
51
51
  cellAddBtnLabel?: string | React.ReactNode;
52
52
  forwardAndBackFillDisabled?: boolean;
53
53
  draggable?: boolean;
54
- showWeek?: boolean;
54
+ headerShowWeek?: boolean;
55
55
  autoScroll?: boolean;
56
56
  onChangeDate?: (e: any, currentData: any) => void;
57
57
  onChangeMonth?: (currentData: any) => void;
@@ -3977,7 +3977,7 @@ var EventCalendarTimeline = function EventCalendarTimeline(props) {
3977
3977
  cellAddBtnLabel = props.cellAddBtnLabel,
3978
3978
  forwardAndBackFillDisabled = props.forwardAndBackFillDisabled,
3979
3979
  draggable = props.draggable,
3980
- showWeek = props.showWeek,
3980
+ headerShowWeek = props.headerShowWeek,
3981
3981
  autoScroll = props.autoScroll,
3982
3982
  onChangeDate = props.onChangeDate,
3983
3983
  onChangeMonth = props.onChangeMonth,
@@ -4115,7 +4115,7 @@ var EventCalendarTimeline = function EventCalendarTimeline(props) {
4115
4115
 
4116
4116
  // table grid
4117
4117
  var AUTO_SCROLL = autoScroll || false;
4118
- var SHOW_WEEK = showWeek || false;
4118
+ var HEADER_SHOW_WEEK = headerShowWeek || false;
4119
4119
  var BODY_DRAG = draggable || false;
4120
4120
  var tableGridRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
4121
4121
  var tableGridHeaderRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
@@ -4161,13 +4161,13 @@ var EventCalendarTimeline = function EventCalendarTimeline(props) {
4161
4161
  // Calculate CELL_MIN_W based on appearanceMode and tableCellMinWidth
4162
4162
  var CELL_MIN_W = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(function () {
4163
4163
  if (typeof tableCellMinWidth === 'undefined') {
4164
- return appearanceMode === 'week' ? 100 : 50;
4164
+ return headerShowWeek || false ? 100 : 50;
4165
4165
  }
4166
4166
  if (typeof tableCellMinWidth === 'function') {
4167
4167
  return tableCellMinWidth(appearanceMode);
4168
4168
  }
4169
4169
  return tableCellMinWidth;
4170
- }, [tableCellMinWidth, appearanceMode]);
4170
+ }, [tableCellMinWidth, appearanceMode, headerShowWeek]);
4171
4171
  var findMondayAndTruncate = function findMondayAndTruncate(dates) {
4172
4172
  var _res = dates.map(function (s) {
4173
4173
  return new Date(s);
@@ -5076,7 +5076,7 @@ var EventCalendarTimeline = function EventCalendarTimeline(props) {
5076
5076
 
5077
5077
  // week day
5078
5078
  var weekDay = item.week[i];
5079
- var _weekDayStr = SHOW_WEEK ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("span", {
5079
+ var _weekDayStr = HEADER_SHOW_WEEK ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("span", {
5080
5080
  dangerouslySetInnerHTML: {
5081
5081
  __html: item.weekDisplay[i]
5082
5082
  }
@@ -5547,9 +5547,17 @@ var EventCalendarTimeline = function EventCalendarTimeline(props) {
5547
5547
  var tableGridEl = tableGridRef.current;
5548
5548
 
5549
5549
  // initialize cell height
5550
- var headerTitleTrElements = tableGridEl.querySelector('.custom-event-tl-table__datagrid-body__title tbody').getElementsByTagName('tr');
5551
- var trElements = tableGridEl.querySelector('.custom-event-tl-table__datagrid-body__content tbody').getElementsByTagName('tr');
5550
+ var headerTitleTbody = tableGridEl.querySelector('.custom-event-tl-table__datagrid-body__title tbody');
5551
+ var contentTbody = tableGridEl.querySelector('.custom-event-tl-table__datagrid-body__content tbody');
5552
+ if (!headerTitleTbody || !contentTbody) return;
5553
+ var headerTitleTrElements = headerTitleTbody.getElementsByTagName('tr');
5554
+ var trElements = contentTbody.getElementsByTagName('tr');
5555
+
5556
+ // Reset any previously set inline heights so we measure natural heights.
5552
5557
  for (var i = 0; i < headerTitleTrElements.length; i++) {
5558
+ // set to 'auto' (or remove inline style) to allow shrink
5559
+ headerTitleTrElements[i].style.height = 'auto';
5560
+ if (trElements[i]) trElements[i].style.height = 'auto';
5553
5561
  var targetElement = headerTitleTrElements[i].offsetHeight > trElements[i].offsetHeight ? headerTitleTrElements[i] : trElements[i];
5554
5562
  var tdOHeight = window.getComputedStyle(targetElement).height;
5555
5563
  headerTitleTrElements[i].style.height = tdOHeight;
@@ -0,0 +1,5 @@
1
+ declare type VisibilityCallback = () => void;
2
+ declare type UsePageVisibility = (onVisible?: VisibilityCallback, onHidden?: VisibilityCallback, onPageInit?: VisibilityCallback) => void;
3
+ declare const usePageVisibility: UsePageVisibility;
4
+ export default usePageVisibility;
5
+ export { usePageVisibility };
@@ -0,0 +1,166 @@
1
+ (function webpackUniversalModuleDefinition(root, factory) {
2
+ if(typeof exports === 'object' && typeof module === 'object')
3
+ module.exports = factory(require("react"));
4
+ else if(typeof define === 'function' && define.amd)
5
+ define(["react"], factory);
6
+ else if(typeof exports === 'object')
7
+ exports["RPB"] = factory(require("react"));
8
+ else
9
+ root["RPB"] = factory(root["React"]);
10
+ })(this, (__WEBPACK_EXTERNAL_MODULE__787__) => {
11
+ return /******/ (() => { // webpackBootstrap
12
+ /******/ "use strict";
13
+ /******/ var __webpack_modules__ = ({
14
+
15
+ /***/ 787:
16
+ /***/ ((module) => {
17
+
18
+ module.exports = __WEBPACK_EXTERNAL_MODULE__787__;
19
+
20
+ /***/ })
21
+
22
+ /******/ });
23
+ /************************************************************************/
24
+ /******/ // The module cache
25
+ /******/ var __webpack_module_cache__ = {};
26
+ /******/
27
+ /******/ // The require function
28
+ /******/ function __webpack_require__(moduleId) {
29
+ /******/ // Check if module is in cache
30
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
31
+ /******/ if (cachedModule !== undefined) {
32
+ /******/ return cachedModule.exports;
33
+ /******/ }
34
+ /******/ // Create a new module (and put it into the cache)
35
+ /******/ var module = __webpack_module_cache__[moduleId] = {
36
+ /******/ // no module.id needed
37
+ /******/ // no module.loaded needed
38
+ /******/ exports: {}
39
+ /******/ };
40
+ /******/
41
+ /******/ // Execute the module function
42
+ /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
43
+ /******/
44
+ /******/ // Return the exports of the module
45
+ /******/ return module.exports;
46
+ /******/ }
47
+ /******/
48
+ /************************************************************************/
49
+ /******/ /* webpack/runtime/compat get default export */
50
+ /******/ (() => {
51
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
52
+ /******/ __webpack_require__.n = (module) => {
53
+ /******/ var getter = module && module.__esModule ?
54
+ /******/ () => (module['default']) :
55
+ /******/ () => (module);
56
+ /******/ __webpack_require__.d(getter, { a: getter });
57
+ /******/ return getter;
58
+ /******/ };
59
+ /******/ })();
60
+ /******/
61
+ /******/ /* webpack/runtime/define property getters */
62
+ /******/ (() => {
63
+ /******/ // define getter functions for harmony exports
64
+ /******/ __webpack_require__.d = (exports, definition) => {
65
+ /******/ for(var key in definition) {
66
+ /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
67
+ /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
68
+ /******/ }
69
+ /******/ }
70
+ /******/ };
71
+ /******/ })();
72
+ /******/
73
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
74
+ /******/ (() => {
75
+ /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
76
+ /******/ })();
77
+ /******/
78
+ /******/ /* webpack/runtime/make namespace object */
79
+ /******/ (() => {
80
+ /******/ // define __esModule on exports
81
+ /******/ __webpack_require__.r = (exports) => {
82
+ /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
83
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
84
+ /******/ }
85
+ /******/ Object.defineProperty(exports, '__esModule', { value: true });
86
+ /******/ };
87
+ /******/ })();
88
+ /******/
89
+ /************************************************************************/
90
+ var __webpack_exports__ = {};
91
+ // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
92
+ (() => {
93
+ __webpack_require__.r(__webpack_exports__);
94
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
95
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
96
+ /* harmony export */ "usePageVisibility": () => (/* binding */ usePageVisibility)
97
+ /* harmony export */ });
98
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(787);
99
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
100
+ /**
101
+ * Watch for to know when a document becomes visible or hidden
102
+ * @param onVisible
103
+ * @param onHidden
104
+ * @param onPageInit executed once when the page first loads visibly
105
+ */
106
+ /*
107
+ @usage:
108
+
109
+ const App = () => {
110
+ usePageVisibility(
111
+ () => console.log("🍏 Page is now visible — current tab is active."),
112
+ () => console.log("🍎 Page is hidden — switched to another tab or minimized."),
113
+ () => console.log("🎬 Page initialized while visible.")
114
+ );
115
+
116
+ return <div>Try switching tabs to see the console output.</div>;
117
+ };
118
+
119
+ */
120
+
121
+ var usePageVisibility = function usePageVisibility(onVisible, onHidden, onPageInit) {
122
+ var visibleRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(document.visibilityState === "visible");
123
+ var onVisibleRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(onVisible);
124
+ var onHiddenRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(onHidden);
125
+ var initialVisibleTriggeredRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(false);
126
+ var onPageInitRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(onPageInit);
127
+ (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
128
+ onVisibleRef.current = onVisible;
129
+ }, [onVisible]);
130
+ (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
131
+ onHiddenRef.current = onHidden;
132
+ }, [onHidden]);
133
+ (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
134
+ onPageInitRef.current = onPageInit;
135
+ }, [onPageInit]);
136
+ (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
137
+ var handleVisibilityChange = function handleVisibilityChange() {
138
+ var isVisible = document.visibilityState === "visible";
139
+ if (isVisible && !visibleRef.current) {
140
+ onVisibleRef.current && onVisibleRef.current();
141
+ }
142
+ if (!isVisible && visibleRef.current) {
143
+ onHiddenRef.current && onHiddenRef.current();
144
+ }
145
+ visibleRef.current = isVisible;
146
+ };
147
+
148
+ // It retains the original switching monitor, and can ensure that onPageInit will run when the first screen is loaded.
149
+ if (visibleRef.current && !initialVisibleTriggeredRef.current) {
150
+ initialVisibleTriggeredRef.current = true;
151
+ onPageInitRef.current && onPageInitRef.current();
152
+ }
153
+ document.addEventListener("visibilitychange", handleVisibilityChange);
154
+ return function () {
155
+ document.removeEventListener("visibilitychange", handleVisibilityChange);
156
+ };
157
+ }, []);
158
+ };
159
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (usePageVisibility);
160
+
161
+ })();
162
+
163
+ /******/ return __webpack_exports__;
164
+ /******/ })()
165
+ ;
166
+ });
package/Utils/useSSE.d.ts CHANGED
@@ -1,3 +1,44 @@
1
+ /**
2
+ * SSE
3
+ *
4
+ * @usage:
5
+ *
6
+ const App = () => {
7
+ const { connected, messages, disconnect, reconnect } = useSSE('http://localhost:3000/sse');
8
+
9
+ return (
10
+ <div>
11
+ <p>Status: {connected ? '✅ Connected' : '❌ Disconnected'}</p>
12
+ <button onClick={disconnect}>Disconnect</button>
13
+ <button onClick={reconnect}>Reconnect</button>
14
+ {messages.map((m, i) => <div key={i}>{m}</div>)}
15
+ </div>
16
+ );
17
+ };
18
+
19
+ * It is recommended to use it in conjunction with usePageVisibility, because in HTTP mode,
20
+ * browsers allow a maximum of 6 connections; otherwise, other normal interfaces will be suspended and inaccessible.
21
+
22
+ import usePageVisibility from 'funda-ui/Utils/usePageVisibility';
23
+
24
+ const App = () => {
25
+ const { connected, messages, disconnect, reconnect } = useSSE('http://localhost:3000/sse');
26
+
27
+ // add new
28
+ usePageVisibility(
29
+ () => {
30
+ reconnect();
31
+ },
32
+ () => {
33
+ disconnect();
34
+ },
35
+ () => console.log("🎬 Page initialized while visible.")
36
+ );
37
+
38
+ return '';
39
+ };
40
+
41
+ */
1
42
  declare const useSSE: (url: string | null | undefined, retryDelay?: number) => {
2
43
  readonly connected: boolean;
3
44
  readonly messages: string[];
package/Utils/useSSE.js CHANGED
@@ -108,20 +108,44 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
108
108
  *
109
109
  * @usage:
110
110
  *
111
- * const App = () => {
112
- * const { connected, messages, disconnect, reconnect } = useSSE('http://localhost:3000/sse');
113
- *
114
- * return (
115
- * <div>
116
- * <p>Status: {connected ? '✅ Connected' : '❌ Disconnected'}</p>
117
- * <button onClick={disconnect}>Disconnect</button>
118
- * <button onClick={reconnect}>Reconnect</button>
119
- * {messages.map((m, i) => <div key={i}>{m}</div>)}
120
- * </div>
121
- * );
122
- * };
111
+ const App = () => {
112
+ const { connected, messages, disconnect, reconnect } = useSSE('http://localhost:3000/sse');
113
+
114
+ return (
115
+ <div>
116
+ <p>Status: {connected ? '✅ Connected' : '❌ Disconnected'}</p>
117
+ <button onClick={disconnect}>Disconnect</button>
118
+ <button onClick={reconnect}>Reconnect</button>
119
+ {messages.map((m, i) => <div key={i}>{m}</div>)}
120
+ </div>
121
+ );
122
+ };
123
+
124
+ * It is recommended to use it in conjunction with usePageVisibility, because in HTTP mode,
125
+ * browsers allow a maximum of 6 connections; otherwise, other normal interfaces will be suspended and inaccessible.
126
+
127
+ import usePageVisibility from 'funda-ui/Utils/usePageVisibility';
128
+
129
+ const App = () => {
130
+ const { connected, messages, disconnect, reconnect } = useSSE('http://localhost:3000/sse');
131
+
132
+ // add new
133
+ usePageVisibility(
134
+ () => {
135
+ reconnect();
136
+ },
137
+ () => {
138
+ disconnect();
139
+ },
140
+ () => console.log("🎬 Page initialized while visible.")
141
+ );
142
+
143
+ return '';
144
+ };
145
+
123
146
  */
124
147
 
148
+
125
149
  var useSSE = function useSSE(url) {
126
150
  var retryDelay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 3000;
127
151
  var _useState = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(false),
@@ -51,7 +51,7 @@ export declare type EventCalendarTimelineProps = {
51
51
  cellAddBtnLabel?: string | React.ReactNode;
52
52
  forwardAndBackFillDisabled?: boolean;
53
53
  draggable?: boolean;
54
- showWeek?: boolean;
54
+ headerShowWeek?: boolean;
55
55
  autoScroll?: boolean;
56
56
  onChangeDate?: (e: any, currentData: any) => void;
57
57
  onChangeMonth?: (currentData: any) => void;
@@ -3977,7 +3977,7 @@ var EventCalendarTimeline = function EventCalendarTimeline(props) {
3977
3977
  cellAddBtnLabel = props.cellAddBtnLabel,
3978
3978
  forwardAndBackFillDisabled = props.forwardAndBackFillDisabled,
3979
3979
  draggable = props.draggable,
3980
- showWeek = props.showWeek,
3980
+ headerShowWeek = props.headerShowWeek,
3981
3981
  autoScroll = props.autoScroll,
3982
3982
  onChangeDate = props.onChangeDate,
3983
3983
  onChangeMonth = props.onChangeMonth,
@@ -4115,7 +4115,7 @@ var EventCalendarTimeline = function EventCalendarTimeline(props) {
4115
4115
 
4116
4116
  // table grid
4117
4117
  var AUTO_SCROLL = autoScroll || false;
4118
- var SHOW_WEEK = showWeek || false;
4118
+ var HEADER_SHOW_WEEK = headerShowWeek || false;
4119
4119
  var BODY_DRAG = draggable || false;
4120
4120
  var tableGridRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
4121
4121
  var tableGridHeaderRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
@@ -4161,13 +4161,13 @@ var EventCalendarTimeline = function EventCalendarTimeline(props) {
4161
4161
  // Calculate CELL_MIN_W based on appearanceMode and tableCellMinWidth
4162
4162
  var CELL_MIN_W = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(function () {
4163
4163
  if (typeof tableCellMinWidth === 'undefined') {
4164
- return appearanceMode === 'week' ? 100 : 50;
4164
+ return headerShowWeek || false ? 100 : 50;
4165
4165
  }
4166
4166
  if (typeof tableCellMinWidth === 'function') {
4167
4167
  return tableCellMinWidth(appearanceMode);
4168
4168
  }
4169
4169
  return tableCellMinWidth;
4170
- }, [tableCellMinWidth, appearanceMode]);
4170
+ }, [tableCellMinWidth, appearanceMode, headerShowWeek]);
4171
4171
  var findMondayAndTruncate = function findMondayAndTruncate(dates) {
4172
4172
  var _res = dates.map(function (s) {
4173
4173
  return new Date(s);
@@ -5076,7 +5076,7 @@ var EventCalendarTimeline = function EventCalendarTimeline(props) {
5076
5076
 
5077
5077
  // week day
5078
5078
  var weekDay = item.week[i];
5079
- var _weekDayStr = SHOW_WEEK ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("span", {
5079
+ var _weekDayStr = HEADER_SHOW_WEEK ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("span", {
5080
5080
  dangerouslySetInnerHTML: {
5081
5081
  __html: item.weekDisplay[i]
5082
5082
  }
@@ -5547,9 +5547,17 @@ var EventCalendarTimeline = function EventCalendarTimeline(props) {
5547
5547
  var tableGridEl = tableGridRef.current;
5548
5548
 
5549
5549
  // initialize cell height
5550
- var headerTitleTrElements = tableGridEl.querySelector('.custom-event-tl-table__datagrid-body__title tbody').getElementsByTagName('tr');
5551
- var trElements = tableGridEl.querySelector('.custom-event-tl-table__datagrid-body__content tbody').getElementsByTagName('tr');
5550
+ var headerTitleTbody = tableGridEl.querySelector('.custom-event-tl-table__datagrid-body__title tbody');
5551
+ var contentTbody = tableGridEl.querySelector('.custom-event-tl-table__datagrid-body__content tbody');
5552
+ if (!headerTitleTbody || !contentTbody) return;
5553
+ var headerTitleTrElements = headerTitleTbody.getElementsByTagName('tr');
5554
+ var trElements = contentTbody.getElementsByTagName('tr');
5555
+
5556
+ // Reset any previously set inline heights so we measure natural heights.
5552
5557
  for (var i = 0; i < headerTitleTrElements.length; i++) {
5558
+ // set to 'auto' (or remove inline style) to allow shrink
5559
+ headerTitleTrElements[i].style.height = 'auto';
5560
+ if (trElements[i]) trElements[i].style.height = 'auto';
5553
5561
  var targetElement = headerTitleTrElements[i].offsetHeight > trElements[i].offsetHeight ? headerTitleTrElements[i] : trElements[i];
5554
5562
  var tdOHeight = window.getComputedStyle(targetElement).height;
5555
5563
  headerTitleTrElements[i].style.height = tdOHeight;
@@ -0,0 +1,5 @@
1
+ declare type VisibilityCallback = () => void;
2
+ declare type UsePageVisibility = (onVisible?: VisibilityCallback, onHidden?: VisibilityCallback, onPageInit?: VisibilityCallback) => void;
3
+ declare const usePageVisibility: UsePageVisibility;
4
+ export default usePageVisibility;
5
+ export { usePageVisibility };
@@ -0,0 +1,166 @@
1
+ (function webpackUniversalModuleDefinition(root, factory) {
2
+ if(typeof exports === 'object' && typeof module === 'object')
3
+ module.exports = factory(require("react"));
4
+ else if(typeof define === 'function' && define.amd)
5
+ define(["react"], factory);
6
+ else if(typeof exports === 'object')
7
+ exports["RPB"] = factory(require("react"));
8
+ else
9
+ root["RPB"] = factory(root["React"]);
10
+ })(this, (__WEBPACK_EXTERNAL_MODULE__787__) => {
11
+ return /******/ (() => { // webpackBootstrap
12
+ /******/ "use strict";
13
+ /******/ var __webpack_modules__ = ({
14
+
15
+ /***/ 787:
16
+ /***/ ((module) => {
17
+
18
+ module.exports = __WEBPACK_EXTERNAL_MODULE__787__;
19
+
20
+ /***/ })
21
+
22
+ /******/ });
23
+ /************************************************************************/
24
+ /******/ // The module cache
25
+ /******/ var __webpack_module_cache__ = {};
26
+ /******/
27
+ /******/ // The require function
28
+ /******/ function __webpack_require__(moduleId) {
29
+ /******/ // Check if module is in cache
30
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
31
+ /******/ if (cachedModule !== undefined) {
32
+ /******/ return cachedModule.exports;
33
+ /******/ }
34
+ /******/ // Create a new module (and put it into the cache)
35
+ /******/ var module = __webpack_module_cache__[moduleId] = {
36
+ /******/ // no module.id needed
37
+ /******/ // no module.loaded needed
38
+ /******/ exports: {}
39
+ /******/ };
40
+ /******/
41
+ /******/ // Execute the module function
42
+ /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
43
+ /******/
44
+ /******/ // Return the exports of the module
45
+ /******/ return module.exports;
46
+ /******/ }
47
+ /******/
48
+ /************************************************************************/
49
+ /******/ /* webpack/runtime/compat get default export */
50
+ /******/ (() => {
51
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
52
+ /******/ __webpack_require__.n = (module) => {
53
+ /******/ var getter = module && module.__esModule ?
54
+ /******/ () => (module['default']) :
55
+ /******/ () => (module);
56
+ /******/ __webpack_require__.d(getter, { a: getter });
57
+ /******/ return getter;
58
+ /******/ };
59
+ /******/ })();
60
+ /******/
61
+ /******/ /* webpack/runtime/define property getters */
62
+ /******/ (() => {
63
+ /******/ // define getter functions for harmony exports
64
+ /******/ __webpack_require__.d = (exports, definition) => {
65
+ /******/ for(var key in definition) {
66
+ /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
67
+ /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
68
+ /******/ }
69
+ /******/ }
70
+ /******/ };
71
+ /******/ })();
72
+ /******/
73
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
74
+ /******/ (() => {
75
+ /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
76
+ /******/ })();
77
+ /******/
78
+ /******/ /* webpack/runtime/make namespace object */
79
+ /******/ (() => {
80
+ /******/ // define __esModule on exports
81
+ /******/ __webpack_require__.r = (exports) => {
82
+ /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
83
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
84
+ /******/ }
85
+ /******/ Object.defineProperty(exports, '__esModule', { value: true });
86
+ /******/ };
87
+ /******/ })();
88
+ /******/
89
+ /************************************************************************/
90
+ var __webpack_exports__ = {};
91
+ // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
92
+ (() => {
93
+ __webpack_require__.r(__webpack_exports__);
94
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
95
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
96
+ /* harmony export */ "usePageVisibility": () => (/* binding */ usePageVisibility)
97
+ /* harmony export */ });
98
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(787);
99
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
100
+ /**
101
+ * Watch for to know when a document becomes visible or hidden
102
+ * @param onVisible
103
+ * @param onHidden
104
+ * @param onPageInit executed once when the page first loads visibly
105
+ */
106
+ /*
107
+ @usage:
108
+
109
+ const App = () => {
110
+ usePageVisibility(
111
+ () => console.log("🍏 Page is now visible — current tab is active."),
112
+ () => console.log("🍎 Page is hidden — switched to another tab or minimized."),
113
+ () => console.log("🎬 Page initialized while visible.")
114
+ );
115
+
116
+ return <div>Try switching tabs to see the console output.</div>;
117
+ };
118
+
119
+ */
120
+
121
+ var usePageVisibility = function usePageVisibility(onVisible, onHidden, onPageInit) {
122
+ var visibleRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(document.visibilityState === "visible");
123
+ var onVisibleRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(onVisible);
124
+ var onHiddenRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(onHidden);
125
+ var initialVisibleTriggeredRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(false);
126
+ var onPageInitRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(onPageInit);
127
+ (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
128
+ onVisibleRef.current = onVisible;
129
+ }, [onVisible]);
130
+ (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
131
+ onHiddenRef.current = onHidden;
132
+ }, [onHidden]);
133
+ (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
134
+ onPageInitRef.current = onPageInit;
135
+ }, [onPageInit]);
136
+ (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
137
+ var handleVisibilityChange = function handleVisibilityChange() {
138
+ var isVisible = document.visibilityState === "visible";
139
+ if (isVisible && !visibleRef.current) {
140
+ onVisibleRef.current && onVisibleRef.current();
141
+ }
142
+ if (!isVisible && visibleRef.current) {
143
+ onHiddenRef.current && onHiddenRef.current();
144
+ }
145
+ visibleRef.current = isVisible;
146
+ };
147
+
148
+ // It retains the original switching monitor, and can ensure that onPageInit will run when the first screen is loaded.
149
+ if (visibleRef.current && !initialVisibleTriggeredRef.current) {
150
+ initialVisibleTriggeredRef.current = true;
151
+ onPageInitRef.current && onPageInitRef.current();
152
+ }
153
+ document.addEventListener("visibilitychange", handleVisibilityChange);
154
+ return function () {
155
+ document.removeEventListener("visibilitychange", handleVisibilityChange);
156
+ };
157
+ }, []);
158
+ };
159
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (usePageVisibility);
160
+
161
+ })();
162
+
163
+ /******/ return __webpack_exports__;
164
+ /******/ })()
165
+ ;
166
+ });
@@ -1,3 +1,44 @@
1
+ /**
2
+ * SSE
3
+ *
4
+ * @usage:
5
+ *
6
+ const App = () => {
7
+ const { connected, messages, disconnect, reconnect } = useSSE('http://localhost:3000/sse');
8
+
9
+ return (
10
+ <div>
11
+ <p>Status: {connected ? '✅ Connected' : '❌ Disconnected'}</p>
12
+ <button onClick={disconnect}>Disconnect</button>
13
+ <button onClick={reconnect}>Reconnect</button>
14
+ {messages.map((m, i) => <div key={i}>{m}</div>)}
15
+ </div>
16
+ );
17
+ };
18
+
19
+ * It is recommended to use it in conjunction with usePageVisibility, because in HTTP mode,
20
+ * browsers allow a maximum of 6 connections; otherwise, other normal interfaces will be suspended and inaccessible.
21
+
22
+ import usePageVisibility from 'funda-ui/Utils/usePageVisibility';
23
+
24
+ const App = () => {
25
+ const { connected, messages, disconnect, reconnect } = useSSE('http://localhost:3000/sse');
26
+
27
+ // add new
28
+ usePageVisibility(
29
+ () => {
30
+ reconnect();
31
+ },
32
+ () => {
33
+ disconnect();
34
+ },
35
+ () => console.log("🎬 Page initialized while visible.")
36
+ );
37
+
38
+ return '';
39
+ };
40
+
41
+ */
1
42
  declare const useSSE: (url: string | null | undefined, retryDelay?: number) => {
2
43
  readonly connected: boolean;
3
44
  readonly messages: string[];
@@ -108,20 +108,44 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
108
108
  *
109
109
  * @usage:
110
110
  *
111
- * const App = () => {
112
- * const { connected, messages, disconnect, reconnect } = useSSE('http://localhost:3000/sse');
113
- *
114
- * return (
115
- * <div>
116
- * <p>Status: {connected ? '✅ Connected' : '❌ Disconnected'}</p>
117
- * <button onClick={disconnect}>Disconnect</button>
118
- * <button onClick={reconnect}>Reconnect</button>
119
- * {messages.map((m, i) => <div key={i}>{m}</div>)}
120
- * </div>
121
- * );
122
- * };
111
+ const App = () => {
112
+ const { connected, messages, disconnect, reconnect } = useSSE('http://localhost:3000/sse');
113
+
114
+ return (
115
+ <div>
116
+ <p>Status: {connected ? '✅ Connected' : '❌ Disconnected'}</p>
117
+ <button onClick={disconnect}>Disconnect</button>
118
+ <button onClick={reconnect}>Reconnect</button>
119
+ {messages.map((m, i) => <div key={i}>{m}</div>)}
120
+ </div>
121
+ );
122
+ };
123
+
124
+ * It is recommended to use it in conjunction with usePageVisibility, because in HTTP mode,
125
+ * browsers allow a maximum of 6 connections; otherwise, other normal interfaces will be suspended and inaccessible.
126
+
127
+ import usePageVisibility from 'funda-ui/Utils/usePageVisibility';
128
+
129
+ const App = () => {
130
+ const { connected, messages, disconnect, reconnect } = useSSE('http://localhost:3000/sse');
131
+
132
+ // add new
133
+ usePageVisibility(
134
+ () => {
135
+ reconnect();
136
+ },
137
+ () => {
138
+ disconnect();
139
+ },
140
+ () => console.log("🎬 Page initialized while visible.")
141
+ );
142
+
143
+ return '';
144
+ };
145
+
123
146
  */
124
147
 
148
+
125
149
  var useSSE = function useSSE(url) {
126
150
  var retryDelay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 3000;
127
151
  var _useState = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(false),
@@ -14,7 +14,6 @@ import { clsWrite, combinedCls } from 'funda-utils/dist/cjs/cls';
14
14
  import getOs from 'funda-utils//dist/cjs/os';
15
15
 
16
16
 
17
-
18
17
  export interface EventsValueConfig {
19
18
  id: string | number;
20
19
  date: string,
@@ -71,7 +70,7 @@ export type EventCalendarTimelineProps = {
71
70
  cellAddBtnLabel?: string | React.ReactNode;
72
71
  forwardAndBackFillDisabled?: boolean;
73
72
  draggable?: boolean;
74
- showWeek?: boolean;
73
+ headerShowWeek?: boolean;
75
74
  autoScroll?: boolean;
76
75
  onChangeDate?: (e: any, currentData: any) => void;
77
76
  onChangeMonth?: (currentData: any) => void;
@@ -161,7 +160,7 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
161
160
  cellAddBtnLabel,
162
161
  forwardAndBackFillDisabled,
163
162
  draggable,
164
- showWeek,
163
+ headerShowWeek,
165
164
  autoScroll,
166
165
  onChangeDate,
167
166
  onChangeMonth,
@@ -272,7 +271,7 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
272
271
 
273
272
  // table grid
274
273
  const AUTO_SCROLL = autoScroll || false;
275
- const SHOW_WEEK = showWeek || false;
274
+ const HEADER_SHOW_WEEK = headerShowWeek || false;
276
275
  const BODY_DRAG = draggable || false;
277
276
  const tableGridRef = useRef<any>(null);
278
277
  const tableGridHeaderRef = useRef<any>(null);
@@ -303,13 +302,13 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
303
302
  // Calculate CELL_MIN_W based on appearanceMode and tableCellMinWidth
304
303
  const CELL_MIN_W = useMemo(() => {
305
304
  if (typeof tableCellMinWidth === 'undefined') {
306
- return appearanceMode === 'week' ? 100 : 50;
305
+ return (headerShowWeek || false) ? 100 : 50;
307
306
  }
308
307
  if (typeof tableCellMinWidth === 'function') {
309
308
  return tableCellMinWidth(appearanceMode as 'week' | 'month');
310
309
  }
311
310
  return tableCellMinWidth;
312
- }, [tableCellMinWidth, appearanceMode]);
311
+ }, [tableCellMinWidth, appearanceMode, headerShowWeek]);
313
312
 
314
313
  const findMondayAndTruncate = (dates: string[]) => {
315
314
  const _res = dates.map((s: string) => new Date(s));
@@ -1255,7 +1254,7 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
1255
1254
 
1256
1255
  // week day
1257
1256
  const weekDay = item.week[i];
1258
- const _weekDayStr = SHOW_WEEK ? <span dangerouslySetInnerHTML={{
1257
+ const _weekDayStr = HEADER_SHOW_WEEK ? <span dangerouslySetInnerHTML={{
1259
1258
  __html: item.weekDisplay[i]
1260
1259
  }} /> : null;
1261
1260
 
@@ -1355,7 +1354,7 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
1355
1354
  'disabled': !isInteractive
1356
1355
  }
1357
1356
  )}
1358
- style={{ width: (CELL_MIN_W - 1) + 'px' }}
1357
+ style={{ width: (CELL_MIN_W as number - 1) + 'px' }}
1359
1358
  >
1360
1359
 
1361
1360
  {d}
@@ -1633,7 +1632,7 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
1633
1632
  'disabled': !isInteractive
1634
1633
  }
1635
1634
  )}
1636
- style={{ width: (CELL_MIN_W - 1) + 'px' }}
1635
+ style={{ width: (CELL_MIN_W as number - 1) + 'px' }}
1637
1636
  >
1638
1637
 
1639
1638
  {/*++++++++++++++++ EVENT ++++++++++++++++*/}
@@ -1865,18 +1864,26 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
1865
1864
  const tableGridEl: any = tableGridRef.current;
1866
1865
 
1867
1866
  // initialize cell height
1868
- const headerTitleTrElements = tableGridEl.querySelector('.custom-event-tl-table__datagrid-body__title tbody').getElementsByTagName('tr');
1869
- const trElements = tableGridEl.querySelector('.custom-event-tl-table__datagrid-body__content tbody').getElementsByTagName('tr');
1867
+ const headerTitleTbody = tableGridEl.querySelector('.custom-event-tl-table__datagrid-body__title tbody');
1868
+ const contentTbody = tableGridEl.querySelector('.custom-event-tl-table__datagrid-body__content tbody');
1869
+ if (!headerTitleTbody || !contentTbody) return;
1870
+
1871
+ const headerTitleTrElements = headerTitleTbody.getElementsByTagName('tr');
1872
+ const trElements = contentTbody.getElementsByTagName('tr');
1870
1873
 
1874
+ // Reset any previously set inline heights so we measure natural heights.
1871
1875
  for (let i = 0; i < headerTitleTrElements.length; i++) {
1876
+ // set to 'auto' (or remove inline style) to allow shrink
1877
+ headerTitleTrElements[i].style.height = 'auto';
1878
+ if (trElements[i]) trElements[i].style.height = 'auto';
1872
1879
 
1873
1880
  const targetElement = headerTitleTrElements[i].offsetHeight > trElements[i].offsetHeight ? headerTitleTrElements[i] : trElements[i];
1874
1881
  const tdOHeight = window.getComputedStyle(targetElement).height;
1875
1882
  headerTitleTrElements[i].style.height = tdOHeight;
1876
1883
  trElements[i].style.height = tdOHeight;
1877
-
1878
1884
  }
1879
1885
 
1886
+
1880
1887
  }
1881
1888
 
1882
1889
  function tableGridInit() {
@@ -1886,7 +1893,7 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
1886
1893
 
1887
1894
  const { forwardFillTotal, list: cellsList } = getCells();
1888
1895
  const tableGridEl: any = tableGridRef.current;
1889
- let _curCellMinWidth: number = CELL_MIN_W;
1896
+ let _curCellMinWidth: number = CELL_MIN_W as number;
1890
1897
  let _curColCount: number = FILL_BLANK_DATE_DISABLD ? days[month] : 7 * cellsList.length;
1891
1898
 
1892
1899
 
@@ -2203,6 +2210,7 @@ const EventCalendarTimeline = (props: EventCalendarTimelineProps) => {
2203
2210
  // Call a function when the list has been rendered completely
2204
2211
  onListRenderComplete?.();
2205
2212
 
2213
+
2206
2214
  }, [eventsValue, customTodayDate, appearanceMode]);
2207
2215
 
2208
2216
 
@@ -14,7 +14,6 @@ import {
14
14
 
15
15
 
16
16
 
17
-
18
17
  declare global {
19
18
  interface Window {
20
19
  curVideo?: any;
@@ -0,0 +1,84 @@
1
+ /**
2
+ * Watch for to know when a document becomes visible or hidden
3
+ * @param onVisible
4
+ * @param onHidden
5
+ * @param onPageInit executed once when the page first loads visibly
6
+ */
7
+ /*
8
+ @usage:
9
+
10
+ const App = () => {
11
+ usePageVisibility(
12
+ () => console.log("🍏 Page is now visible — current tab is active."),
13
+ () => console.log("🍎 Page is hidden — switched to another tab or minimized."),
14
+ () => console.log("🎬 Page initialized while visible.")
15
+ );
16
+
17
+ return <div>Try switching tabs to see the console output.</div>;
18
+ };
19
+
20
+ */
21
+ import { useEffect, useRef } from "react";
22
+
23
+ type VisibilityCallback = () => void;
24
+
25
+ type UsePageVisibility = (
26
+ onVisible?: VisibilityCallback,
27
+ onHidden?: VisibilityCallback,
28
+ onPageInit?: VisibilityCallback
29
+ ) => void;
30
+
31
+ const usePageVisibility: UsePageVisibility = (
32
+ onVisible,
33
+ onHidden,
34
+ onPageInit
35
+ ) => {
36
+ const visibleRef = useRef<boolean>(document.visibilityState === "visible");
37
+ const onVisibleRef = useRef<VisibilityCallback | undefined>(onVisible);
38
+ const onHiddenRef = useRef<VisibilityCallback | undefined>(onHidden);
39
+ const initialVisibleTriggeredRef = useRef<boolean>(false);
40
+ const onPageInitRef = useRef<VisibilityCallback | undefined>(onPageInit);
41
+
42
+ useEffect(() => {
43
+ onVisibleRef.current = onVisible;
44
+ }, [onVisible]);
45
+
46
+ useEffect(() => {
47
+ onHiddenRef.current = onHidden;
48
+ }, [onHidden]);
49
+
50
+ useEffect(() => {
51
+ onPageInitRef.current = onPageInit;
52
+ }, [onPageInit]);
53
+
54
+ useEffect(() => {
55
+ const handleVisibilityChange = () => {
56
+ const isVisible = document.visibilityState === "visible";
57
+
58
+ if (isVisible && !visibleRef.current) {
59
+ onVisibleRef.current && onVisibleRef.current();
60
+ }
61
+
62
+ if (!isVisible && visibleRef.current) {
63
+ onHiddenRef.current && onHiddenRef.current();
64
+ }
65
+
66
+ visibleRef.current = isVisible;
67
+ };
68
+
69
+ // It retains the original switching monitor, and can ensure that onPageInit will run when the first screen is loaded.
70
+ if (visibleRef.current && !initialVisibleTriggeredRef.current) {
71
+ initialVisibleTriggeredRef.current = true;
72
+ onPageInitRef.current && onPageInitRef.current();
73
+ }
74
+
75
+ document.addEventListener("visibilitychange", handleVisibilityChange);
76
+ return () => {
77
+ document.removeEventListener("visibilitychange", handleVisibilityChange);
78
+ };
79
+ }, []);
80
+ };
81
+
82
+
83
+ export default usePageVisibility;
84
+ export { usePageVisibility };
@@ -3,19 +3,44 @@
3
3
  *
4
4
  * @usage:
5
5
  *
6
- * const App = () => {
7
- * const { connected, messages, disconnect, reconnect } = useSSE('http://localhost:3000/sse');
8
- *
9
- * return (
10
- * <div>
11
- * <p>Status: {connected ? '✅ Connected' : '❌ Disconnected'}</p>
12
- * <button onClick={disconnect}>Disconnect</button>
13
- * <button onClick={reconnect}>Reconnect</button>
14
- * {messages.map((m, i) => <div key={i}>{m}</div>)}
15
- * </div>
16
- * );
17
- * };
6
+ const App = () => {
7
+ const { connected, messages, disconnect, reconnect } = useSSE('http://localhost:3000/sse');
8
+
9
+ return (
10
+ <div>
11
+ <p>Status: {connected ? '✅ Connected' : '❌ Disconnected'}</p>
12
+ <button onClick={disconnect}>Disconnect</button>
13
+ <button onClick={reconnect}>Reconnect</button>
14
+ {messages.map((m, i) => <div key={i}>{m}</div>)}
15
+ </div>
16
+ );
17
+ };
18
+
19
+ * It is recommended to use it in conjunction with usePageVisibility, because in HTTP mode,
20
+ * browsers allow a maximum of 6 connections; otherwise, other normal interfaces will be suspended and inaccessible.
21
+
22
+ import usePageVisibility from 'funda-ui/Utils/usePageVisibility';
23
+
24
+ const App = () => {
25
+ const { connected, messages, disconnect, reconnect } = useSSE('http://localhost:3000/sse');
26
+
27
+ // add new
28
+ usePageVisibility(
29
+ () => {
30
+ reconnect();
31
+ },
32
+ () => {
33
+ disconnect();
34
+ },
35
+ () => console.log("🎬 Page initialized while visible.")
36
+ );
37
+
38
+ return '';
39
+ };
40
+
18
41
  */
42
+
43
+
19
44
  import { useEffect, useRef, useState, useCallback } from 'react';
20
45
 
21
46
  const useSSE = (url: string | null | undefined, retryDelay: number = 3000) => {
package/package.json CHANGED
@@ -1 +1 @@
1
- {"author":"UIUX Lab","email":"uiuxlab@gmail.com","name":"funda-ui","version":"4.7.701","description":"React components using pure Bootstrap 5+ which does not contain any external style and script libraries.","repository":{"type":"git","url":"git+https://github.com/xizon/funda-ui.git"},"scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"keywords":["bootstrap","react-bootstrap","react-components","components","components-react","react-bootstrap-components","react","funda-ui","fundaui","uikit","ui-kit","ui-components"],"bugs":{"url":"https://github.com/xizon/funda-ui/issues"},"homepage":"https://github.com/xizon/funda-ui#readme","main":"all.js","license":"MIT","dependencies":{"react":"^18.2.0","react-dom":"^18.2.0"},"types":"all.d.ts","publishConfig":{"directory":"lib"},"directories":{"lib":"lib"}}
1
+ {"author":"UIUX Lab","email":"uiuxlab@gmail.com","name":"funda-ui","version":"4.7.711","description":"React components using pure Bootstrap 5+ which does not contain any external style and script libraries.","repository":{"type":"git","url":"git+https://github.com/xizon/funda-ui.git"},"scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"keywords":["bootstrap","react-bootstrap","react-components","components","components-react","react-bootstrap-components","react","funda-ui","fundaui","uikit","ui-kit","ui-components"],"bugs":{"url":"https://github.com/xizon/funda-ui/issues"},"homepage":"https://github.com/xizon/funda-ui#readme","main":"all.js","license":"MIT","dependencies":{"react":"^18.2.0","react-dom":"^18.2.0"},"types":"all.d.ts","publishConfig":{"directory":"lib"},"directories":{"lib":"lib"}}