@saltcorn/builder 0.9.0-beta.0 → 0.9.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
setInitialConfig,
|
|
17
17
|
isBlock,
|
|
18
18
|
fetchFieldPreview,
|
|
19
|
+
HelpTopicLink,
|
|
19
20
|
} from "./utils";
|
|
20
21
|
|
|
21
22
|
export /**
|
|
@@ -166,7 +167,15 @@ const FieldSettings = () => {
|
|
|
166
167
|
{fvs && (
|
|
167
168
|
<tr>
|
|
168
169
|
<td>
|
|
169
|
-
<label>
|
|
170
|
+
<label>
|
|
171
|
+
Field view
|
|
172
|
+
<HelpTopicLink
|
|
173
|
+
topic="Field views"
|
|
174
|
+
field_name={name}
|
|
175
|
+
table_name={options.tableName}
|
|
176
|
+
mode={options.mode}
|
|
177
|
+
/>
|
|
178
|
+
</label>
|
|
170
179
|
</td>
|
|
171
180
|
|
|
172
181
|
<td>
|
|
@@ -232,6 +241,8 @@ const FieldSettings = () => {
|
|
|
232
241
|
</table>
|
|
233
242
|
{cfgFields ? (
|
|
234
243
|
<ConfigForm
|
|
244
|
+
tableName={options.tableName}
|
|
245
|
+
fieldName={name}
|
|
235
246
|
fields={cfgFields}
|
|
236
247
|
configuration={configuration}
|
|
237
248
|
setProp={setProp}
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
setAPropGen,
|
|
16
16
|
FormulaTooltip,
|
|
17
17
|
buildOptions,
|
|
18
|
+
HelpTopicLink,
|
|
18
19
|
} from "./utils";
|
|
19
20
|
|
|
20
21
|
import { RelationPicker } from "./RelationPicker";
|
|
@@ -121,7 +122,8 @@ const ViewSettings = () => {
|
|
|
121
122
|
else viewname = rest;
|
|
122
123
|
}
|
|
123
124
|
if (viewname.includes(".")) viewname = viewname.split(".")[0];
|
|
124
|
-
|
|
125
|
+
const helpContext = { view_name: viewname };
|
|
126
|
+
if (options.tableName) helpContext.srcTable = options.tableName;
|
|
125
127
|
const set_view_name = (e) => {
|
|
126
128
|
if (e.target) {
|
|
127
129
|
const target_value = e.target.value;
|
|
@@ -237,9 +239,9 @@ const ViewSettings = () => {
|
|
|
237
239
|
)}
|
|
238
240
|
{(state === "shared" || options.mode === "page") && (
|
|
239
241
|
<Fragment>
|
|
240
|
-
{" "}
|
|
241
242
|
<label>
|
|
242
|
-
Extra state Formula
|
|
243
|
+
Extra state Formula
|
|
244
|
+
<HelpTopicLink topic="Extra state formula" {...helpContext} />
|
|
243
245
|
</label>
|
|
244
246
|
<input
|
|
245
247
|
type="text"
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
ButtonOrLinkSettingsRows,
|
|
16
16
|
setAPropGen,
|
|
17
17
|
FormulaTooltip,
|
|
18
|
+
HelpTopicLink,
|
|
18
19
|
} from "./utils";
|
|
19
20
|
|
|
20
21
|
import { RelationPicker } from "./RelationPicker";
|
|
@@ -149,6 +150,8 @@ const ViewLinkSettings = () => {
|
|
|
149
150
|
}
|
|
150
151
|
}
|
|
151
152
|
};
|
|
153
|
+
const helpContext = { view_name: use_view_name };
|
|
154
|
+
if (options.tableName) helpContext.srcTable = options.tableName;
|
|
152
155
|
return (
|
|
153
156
|
<div>
|
|
154
157
|
<table className="w-100">
|
|
@@ -213,7 +216,8 @@ const ViewLinkSettings = () => {
|
|
|
213
216
|
<tr>
|
|
214
217
|
<td colSpan="2">
|
|
215
218
|
<label>
|
|
216
|
-
Extra state Formula
|
|
219
|
+
Extra state Formula
|
|
220
|
+
<HelpTopicLink topic="Extra state formula" {...helpContext} />
|
|
217
221
|
</label>
|
|
218
222
|
<input
|
|
219
223
|
type="text"
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
faChevronDown,
|
|
12
12
|
faChevronRight,
|
|
13
13
|
faInfoCircle,
|
|
14
|
+
faQuestionCircle,
|
|
14
15
|
} from "@fortawesome/free-solid-svg-icons";
|
|
15
16
|
import { useNode, Element } from "@craftjs/core";
|
|
16
17
|
import FontIconPicker from "@fonticonpicker/react-fonticonpicker";
|
|
@@ -78,6 +79,21 @@ export const BlockOrInlineSetting = ({ block, inline, textStyle, setProp }) =>
|
|
|
78
79
|
</div>
|
|
79
80
|
);
|
|
80
81
|
|
|
82
|
+
export const HelpTopicLink = ({ topic, ...context }) => {
|
|
83
|
+
const { mode } = useContext(optionsCtx);
|
|
84
|
+
let qs = "";
|
|
85
|
+
Object.keys(context).forEach((k) => {
|
|
86
|
+
qs += `${encodeURIComponent(k)}=${encodeURIComponent(context[k])}&`;
|
|
87
|
+
});
|
|
88
|
+
return (
|
|
89
|
+
<FontAwesomeIcon
|
|
90
|
+
className="ms-1"
|
|
91
|
+
icon={faQuestionCircle}
|
|
92
|
+
onClick={() => window.ajax_modal(`/admin/help/${topic}?${qs}`)}
|
|
93
|
+
/>
|
|
94
|
+
);
|
|
95
|
+
};
|
|
96
|
+
|
|
81
97
|
export const FormulaTooltip = () => {
|
|
82
98
|
const { fields } = useContext(optionsCtx);
|
|
83
99
|
return (
|
|
@@ -631,7 +647,15 @@ export /**
|
|
|
631
647
|
* @subcategory components / elements / utils
|
|
632
648
|
* @namespace
|
|
633
649
|
*/
|
|
634
|
-
const ConfigForm = ({
|
|
650
|
+
const ConfigForm = ({
|
|
651
|
+
fields,
|
|
652
|
+
configuration,
|
|
653
|
+
setProp,
|
|
654
|
+
node,
|
|
655
|
+
onChange,
|
|
656
|
+
tableName,
|
|
657
|
+
fieldName,
|
|
658
|
+
}) => (
|
|
635
659
|
<div>
|
|
636
660
|
{fields.map((f, ix) => {
|
|
637
661
|
if (f.showIf && configuration) {
|
|
@@ -644,8 +668,19 @@ const ConfigForm = ({ fields, configuration, setProp, node, onChange }) => (
|
|
|
644
668
|
if (noshow) return null;
|
|
645
669
|
}
|
|
646
670
|
return (
|
|
647
|
-
<div key={ix}>
|
|
648
|
-
{!isCheckbox(f) ?
|
|
671
|
+
<div key={ix} className="builder-config-field">
|
|
672
|
+
{!isCheckbox(f) ? (
|
|
673
|
+
<label>
|
|
674
|
+
{f.label || f.name}
|
|
675
|
+
{f.help ? (
|
|
676
|
+
<HelpTopicLink
|
|
677
|
+
topic={f.help.topic}
|
|
678
|
+
field_name={fieldName}
|
|
679
|
+
table_name={tableName}
|
|
680
|
+
/>
|
|
681
|
+
) : null}
|
|
682
|
+
</label>
|
|
683
|
+
) : null}
|
|
649
684
|
<ConfigField
|
|
650
685
|
field={f}
|
|
651
686
|
configuration={configuration}
|
|
@@ -653,7 +688,17 @@ const ConfigForm = ({ fields, configuration, setProp, node, onChange }) => (
|
|
|
653
688
|
onChange={onChange}
|
|
654
689
|
/>
|
|
655
690
|
{f.sublabel ? (
|
|
656
|
-
<i
|
|
691
|
+
<i
|
|
692
|
+
className="small"
|
|
693
|
+
dangerouslySetInnerHTML={{ __html: f.sublabel }}
|
|
694
|
+
></i>
|
|
695
|
+
) : null}
|
|
696
|
+
{isCheckbox(f) && f.help ? (
|
|
697
|
+
<HelpTopicLink
|
|
698
|
+
topic={f.help.topic}
|
|
699
|
+
fieldName={fieldName}
|
|
700
|
+
tableName={tableName}
|
|
701
|
+
/>
|
|
657
702
|
) : null}
|
|
658
703
|
</div>
|
|
659
704
|
);
|