pcm-shared-components 2.1.408 → 2.1.410
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.
|
@@ -18,10 +18,15 @@ export const openNativeDatePicker = e => {
|
|
|
18
18
|
}
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
-
// Collapsed
|
|
22
|
-
//
|
|
23
|
-
//
|
|
24
|
-
|
|
21
|
+
// Collapsed size for a notice's rich-text content before it needs a "Show More" link -- kept
|
|
22
|
+
// deliberately small (3 text lines, clamped on a clean line boundary with an ellipsis via
|
|
23
|
+
// -webkit-line-clamp) so a long admin-entered notice doesn't dominate the panel's vertical space;
|
|
24
|
+
// anything longer is offered in full through the dialog below. Short content still renders in
|
|
25
|
+
// full with no link at all (overflow-measured, not char-counted). NOTICE_COLLAPSED_MAX_HEIGHT is
|
|
26
|
+
// only a fallback ceiling for engines without line-clamp support, sized generously enough that
|
|
27
|
+
// the line-clamp is what actually cuts in normal browsers.
|
|
28
|
+
const NOTICE_COLLAPSED_LINES = 3;
|
|
29
|
+
const NOTICE_COLLAPSED_MAX_HEIGHT = 130;
|
|
25
30
|
|
|
26
31
|
/**
|
|
27
32
|
* The control for a `notice` field: the admin's sanitized rich text inside a bounded-height
|
|
@@ -76,30 +81,46 @@ const NoticeFieldControl = ({
|
|
|
76
81
|
sx: {
|
|
77
82
|
p: 1.5,
|
|
78
83
|
borderRadius: 1,
|
|
79
|
-
bgcolor: 'action.hover'
|
|
80
|
-
maxHeight: NOTICE_COLLAPSED_MAX_HEIGHT,
|
|
81
|
-
overflow: 'hidden'
|
|
84
|
+
bgcolor: 'action.hover'
|
|
82
85
|
}
|
|
83
86
|
}, /*#__PURE__*/React.createElement("div", {
|
|
84
87
|
ref: contentRef,
|
|
88
|
+
style: {
|
|
89
|
+
display: '-webkit-box',
|
|
90
|
+
WebkitLineClamp: NOTICE_COLLAPSED_LINES,
|
|
91
|
+
WebkitBoxOrient: 'vertical',
|
|
92
|
+
maxHeight: NOTICE_COLLAPSED_MAX_HEIGHT,
|
|
93
|
+
overflow: 'hidden'
|
|
94
|
+
},
|
|
85
95
|
dangerouslySetInnerHTML: {
|
|
86
96
|
__html: contentHtml
|
|
87
97
|
}
|
|
88
|
-
})), overflowing &&
|
|
98
|
+
})), overflowing &&
|
|
99
|
+
/*#__PURE__*/
|
|
100
|
+
// Bottom-right, per the requested layout. NOT disabled in read-only mode -- reading the
|
|
101
|
+
// full notice is always legitimate, only the checkbox below is a mutation. stopPropagation:
|
|
102
|
+
// some hosts render this control inside a click-to-edit card (e.g. the admin reservation
|
|
103
|
+
// review's occupant card) whose background clicks deliberately bubble up to open the
|
|
104
|
+
// editor -- opening the read-more dialog must not also trigger that.
|
|
105
|
+
React.createElement(Button, {
|
|
89
106
|
size: "small",
|
|
90
|
-
|
|
91
|
-
|
|
107
|
+
onClick: e => {
|
|
108
|
+
e.stopPropagation();
|
|
109
|
+
setDialogOpen(true);
|
|
110
|
+
},
|
|
92
111
|
sx: {
|
|
93
|
-
alignSelf: 'flex-
|
|
112
|
+
alignSelf: 'flex-end',
|
|
94
113
|
textTransform: 'none',
|
|
95
114
|
minWidth: 0,
|
|
96
115
|
p: 0
|
|
97
116
|
}
|
|
98
|
-
}, i18next.t('
|
|
99
|
-
label: field.label
|
|
100
|
-
})), /*#__PURE__*/React.createElement(Dialog, {
|
|
117
|
+
}, i18next.t('common.app.show_more')), /*#__PURE__*/React.createElement(Dialog, {
|
|
101
118
|
open: dialogOpen,
|
|
102
|
-
onClose:
|
|
119
|
+
onClose: e => {
|
|
120
|
+
if (e && e.stopPropagation) e.stopPropagation();
|
|
121
|
+
setDialogOpen(false);
|
|
122
|
+
},
|
|
123
|
+
onClick: e => e.stopPropagation(),
|
|
103
124
|
maxWidth: "sm",
|
|
104
125
|
fullWidth: true,
|
|
105
126
|
scroll: "paper"
|
|
@@ -110,7 +131,10 @@ const NoticeFieldControl = ({
|
|
|
110
131
|
__html: contentHtml
|
|
111
132
|
}
|
|
112
133
|
})), /*#__PURE__*/React.createElement(DialogActions, null, /*#__PURE__*/React.createElement(Button, {
|
|
113
|
-
onClick:
|
|
134
|
+
onClick: e => {
|
|
135
|
+
e.stopPropagation();
|
|
136
|
+
setDialogOpen(false);
|
|
137
|
+
}
|
|
114
138
|
}, i18next.t('common.app.close')))), /*#__PURE__*/React.createElement(FormControlLabel, {
|
|
115
139
|
control: /*#__PURE__*/React.createElement(Checkbox, {
|
|
116
140
|
checked: value === true,
|