@nascentdigital/funnel-editor 5.0.1 → 5.0.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/dist/components.d.ts +1 -0
- package/dist/components.js +1 -0
- package/dist/core/components/fields/OptInField.js +42 -2
- package/dist/core/components/fields/asset/AssetEditor.d.ts +1 -2
- package/dist/core/components/fields/asset/AssetEditor.js +18 -6
- package/dist/core/components/fields/asset/AssetUploader.d.ts +1 -2
- package/dist/core/components/fields/asset/AssetUploader.js +18 -6
- package/dist/core/components/fields/collection/CollectionEditor.d.ts +2 -1
- package/dist/core/components/fields/collection/CollectionEditor.js +17 -3
- package/dist/core/components/fields/embed/EmbeddedVideoEditor.d.ts +2 -2
- package/dist/core/components/fields/embed/EmbeddedVideoEditor.js +17 -5
- package/dist/core/components/fields/factories/AssetFactory.d.ts +3 -3
- package/dist/core/components/fields/factories/AssetFactory.js +18 -13
- package/dist/core/components/fields/factories/CollectionFactory.d.ts +3 -3
- package/dist/core/components/fields/factories/CollectionFactory.js +20 -13
- package/dist/core/components/fields/factories/EmbeddedVideoFactory.d.ts +3 -3
- package/dist/core/components/fields/factories/EmbeddedVideoFactory.js +17 -8
- package/dist/core/components/fields/factories/FieldValueFactory.d.ts +7 -5
- package/dist/core/components/fields/factories/FieldValueFactory.js +49 -12
- package/dist/core/components/fields/factories/LinkFactory.d.ts +3 -3
- package/dist/core/components/fields/factories/LinkFactory.js +17 -8
- package/dist/core/components/fields/factories/MediaFactory.d.ts +3 -3
- package/dist/core/components/fields/factories/MediaFactory.js +105 -149
- package/dist/core/components/fields/factories/ObjectFactory.d.ts +3 -2
- package/dist/core/components/fields/factories/ObjectFactory.js +16 -2
- package/dist/core/components/fields/factories/TextFactory.d.ts +3 -3
- package/dist/core/components/fields/factories/TextFactory.js +16 -10
- package/dist/core/components/fields/link/LinkEditor.d.ts +2 -2
- package/dist/core/components/fields/link/LinkEditor.js +18 -6
- package/dist/core/components/fields/media/MediaEditor.d.ts +2 -3
- package/dist/core/components/fields/media/MediaEditor.js +40 -11
- package/dist/core/components/fields/media/index.d.ts +0 -1
- package/dist/core/components/fields/media/index.js +0 -1
- package/dist/core/components/fields/object/ObjectEditor.d.ts +2 -1
- package/dist/core/components/fields/object/ObjectEditor.js +15 -1
- package/dist/core/components/interaction/Popup.d.ts +11 -7
- package/dist/core/components/interaction/Popup.js +8 -6
- package/dist/core/components/interaction/QuickInput.d.ts +2 -4
- package/dist/core/components/interaction/QuickInput.js +6 -2
- package/dist/core/components/interaction/menu/Menu.d.ts +8 -19
- package/dist/core/components/interaction/menu/Menu.js +26 -60
- package/dist/core/components/interaction/menu/useMenuController.d.ts +4 -2
- package/dist/core/components/interaction/menu/useMenuController.js +4 -1
- package/dist/core/domain/CollectionFieldProxy.js +1 -1
- package/dist/core/domain/Collections.js +0 -2
- package/dist/core/domain/ICollection.d.ts +1 -0
- package/dist/core/domain/IPage.d.ts +2 -1
- package/dist/core/domain/Site.js +0 -2
- package/dist/core/hooks/useCollectionRepository.d.ts +1 -1
- package/dist/core/hooks/useCollections.js +4 -0
- package/dist/core/hooks/usePageRepository.d.ts +1 -1
- package/dist/core/hooks/useSite.js +4 -0
- package/dist/core/repository/CollectionRepository.d.ts +2 -2
- package/dist/core/repository/ICollectionRepository.d.ts +2 -3
- package/dist/core/repository/SerializeCollectionUpdate.d.ts +5 -5
- package/dist/core/repository/SerializePageUpdate.d.ts +7 -8
- package/dist/core/splash/SplashContainer.d.ts +4 -2
- package/dist/core/splash/SplashContainer.js +3 -3
- package/dist/styles/index.css +8 -8
- package/package.json +2 -2
- package/dist/core/components/fields/media/MediaPicker.d.ts +0 -15
- package/dist/core/components/fields/media/MediaPicker.js +0 -251
package/dist/components.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export * from './core/repository/PageTarget';
|
|
|
14
14
|
export * from './core/repository/SerializeCollectionUpdate';
|
|
15
15
|
export * from './core/repository/SerializePageUpdate';
|
|
16
16
|
export * from './core/repository/TagSerializer';
|
|
17
|
+
export * from './core/splash';
|
|
17
18
|
export * from './page/hooks';
|
|
18
19
|
export * from './page/components/SettingsEditor';
|
|
19
20
|
export * from './collection/hooks';
|
package/dist/components.js
CHANGED
|
@@ -34,6 +34,7 @@ __exportStar(require("./core/repository/PageTarget"), exports);
|
|
|
34
34
|
__exportStar(require("./core/repository/SerializeCollectionUpdate"), exports);
|
|
35
35
|
__exportStar(require("./core/repository/SerializePageUpdate"), exports);
|
|
36
36
|
__exportStar(require("./core/repository/TagSerializer"), exports);
|
|
37
|
+
__exportStar(require("./core/splash"), exports);
|
|
37
38
|
// page
|
|
38
39
|
__exportStar(require("./page/hooks"), exports);
|
|
39
40
|
__exportStar(require("./page/components/SettingsEditor"), exports);
|
|
@@ -5,19 +5,59 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.OptInField = OptInField;
|
|
7
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const funnel_core_1 = require("@nascentdigital/funnel-core");
|
|
8
9
|
const client_1 = require("@nascentdigital/funnel-ui/client");
|
|
9
10
|
const classnames_1 = __importDefault(require("classnames"));
|
|
11
|
+
const react_1 = require("react");
|
|
12
|
+
const interaction_1 = require("../interaction");
|
|
10
13
|
const visuals_1 = require("../visuals");
|
|
14
|
+
const factories_1 = require("./factories");
|
|
11
15
|
// component
|
|
12
16
|
function OptInField({ className, field, disabled = false }) {
|
|
17
|
+
// bind hooks
|
|
18
|
+
const id = (0, react_1.useId)();
|
|
19
|
+
const [factoryDeferral, setFactoryDeferral] = (0, react_1.useState)(undefined);
|
|
13
20
|
// helpers
|
|
14
21
|
const onOptIn = (e) => {
|
|
15
22
|
// consume event
|
|
16
23
|
e.preventDefault();
|
|
17
24
|
e.stopPropagation();
|
|
25
|
+
// stage add (if opting in)
|
|
26
|
+
if (factories_1.FieldValueFactory.isCompatibleField(field)) {
|
|
27
|
+
const create = async () => {
|
|
28
|
+
// try to create
|
|
29
|
+
try {
|
|
30
|
+
// create deferral
|
|
31
|
+
const deferral = new funnel_core_1.Deferral();
|
|
32
|
+
setFactoryDeferral(deferral);
|
|
33
|
+
// wait for completion
|
|
34
|
+
const result = await deferral.promise;
|
|
35
|
+
// create value on success
|
|
36
|
+
if (result) {
|
|
37
|
+
// opt-in field + bind data
|
|
38
|
+
field.optIn();
|
|
39
|
+
field.value = result;
|
|
40
|
+
// close factory
|
|
41
|
+
setFactoryDeferral(undefined);
|
|
42
|
+
}
|
|
43
|
+
// or cancel
|
|
44
|
+
else {
|
|
45
|
+
setFactoryDeferral(undefined);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
// or cancel on failure
|
|
49
|
+
catch (e) {
|
|
50
|
+
setFactoryDeferral(undefined);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
create().catch(console.error);
|
|
54
|
+
}
|
|
18
55
|
// toggle opt-in
|
|
19
|
-
|
|
56
|
+
else {
|
|
57
|
+
field.optIn();
|
|
58
|
+
}
|
|
20
59
|
};
|
|
21
60
|
// render
|
|
22
|
-
return ((0, jsx_runtime_1.jsxs)("button", { className: (0, classnames_1.default)(className, 'flex items-center gap-l2 pl-l1 pr-l2 overflow-hidden select-none appearance-none cursor-pointer interpolate', 'border-2 border-solid border-transparent rounded-full', 'outline outline-offset-1 outline-transparent', 'hover:border-ix-primary', 'focus-visible:border-ix-primary focus-visible:outline-ix-primary', 'active:scale-[.95] active:interpolate-fast'), onClick: onOptIn, onKeyDown: client_1.OnKey.enter(onOptIn), disabled: disabled, children: [(0, jsx_runtime_1.jsx)(visuals_1.Icon, { className: "text-ix-primary", variant: "CirclePlus", size: "sm" }), (0, jsx_runtime_1.jsxs)("span", { className: "label-sm label-strong text-content-primary", children: ["Add ", field.name] })] }))
|
|
61
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(interaction_1.Popup.AnchorElement, { tag: "div", anchorId: id, children: (0, jsx_runtime_1.jsxs)("button", { className: (0, classnames_1.default)(className, 'flex items-center gap-l2 pl-l1 pr-l2 overflow-hidden select-none appearance-none cursor-pointer interpolate', 'border-2 border-solid border-transparent rounded-full', 'outline outline-offset-1 outline-transparent', 'hover:border-ix-primary', 'focus-visible:border-ix-primary focus-visible:outline-ix-primary', 'active:scale-[.95] active:interpolate-fast'), onClick: onOptIn, onKeyDown: client_1.OnKey.enter(onOptIn), disabled: disabled, children: [(0, jsx_runtime_1.jsx)(visuals_1.Icon, { className: "text-ix-primary", variant: "CirclePlus", size: "sm" }), (0, jsx_runtime_1.jsxs)("span", { className: "label-sm label-strong text-content-primary", children: ["Add ", field.name] })] }) }), factories_1.FieldValueFactory.isCompatibleField(field) && factoryDeferral &&
|
|
62
|
+
(0, jsx_runtime_1.jsx)(factories_1.FieldValueFactory, { itemSchema: field.schema, field: field, anchor: id, anchorOffset: 4, placement: "bottom", onCommit: result => factoryDeferral === null || factoryDeferral === void 0 ? void 0 : factoryDeferral.resolve(result), onCancel: () => factoryDeferral === null || factoryDeferral === void 0 ? void 0 : factoryDeferral.resolve(undefined) })] }));
|
|
23
63
|
}
|
|
@@ -6,9 +6,8 @@ export declare namespace AssetEditor {
|
|
|
6
6
|
interface Ref {
|
|
7
7
|
edit(options: Options): Promise<Schema.AssetField.LinkedValue | undefined>;
|
|
8
8
|
}
|
|
9
|
-
type Options = {
|
|
9
|
+
type Options = Popup.Props.Delegated & {
|
|
10
10
|
schema: Schema.AssetField;
|
|
11
11
|
asset: Schema.AssetField.LinkedValue;
|
|
12
|
-
anchor: Popup.Anchor;
|
|
13
12
|
};
|
|
14
13
|
}
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
2
13
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
15
|
};
|
|
@@ -27,7 +38,7 @@ exports.AssetEditor = (0, react_2.forwardRef)(function AssetEditor(_, ref) {
|
|
|
27
38
|
const [result, setResult] = (0, react_2.useState)();
|
|
28
39
|
const [schema, setSchema] = (0, react_2.useState)();
|
|
29
40
|
const [asset, setAsset] = (0, react_2.useState)();
|
|
30
|
-
const [
|
|
41
|
+
const [popupProps, setPopupProps] = (0, react_2.useState)();
|
|
31
42
|
const [errorLevel, setErrorLevel] = (0, react_2.useState)('none');
|
|
32
43
|
const [error, setError] = (0, react_2.useState)();
|
|
33
44
|
const { nameField, descriptionField } = (0, useAssetFields_1.useAssetFields)();
|
|
@@ -37,11 +48,12 @@ exports.AssetEditor = (0, react_2.forwardRef)(function AssetEditor(_, ref) {
|
|
|
37
48
|
const { valid, modified } = checkFields({ asset, nameField, descriptionField, shared });
|
|
38
49
|
// export service
|
|
39
50
|
(0, react_2.useImperativeHandle)(ref, () => ({
|
|
40
|
-
edit: async (
|
|
51
|
+
edit: async (_a) => {
|
|
52
|
+
var { schema, asset } = _a, popupProps = __rest(_a, ["schema", "asset"]);
|
|
41
53
|
// reset state
|
|
42
54
|
setSchema(schema);
|
|
43
55
|
setAsset(asset);
|
|
44
|
-
|
|
56
|
+
setPopupProps(popupProps);
|
|
45
57
|
setErrorLevel('none');
|
|
46
58
|
setError(undefined);
|
|
47
59
|
setShared(asset.scope === 'global');
|
|
@@ -118,12 +130,12 @@ exports.AssetEditor = (0, react_2.forwardRef)(function AssetEditor(_, ref) {
|
|
|
118
130
|
deferral.resolve(result !== null && result !== void 0 ? result : undefined);
|
|
119
131
|
};
|
|
120
132
|
// skip if we don't have any params
|
|
121
|
-
if (!deferral || !schema || !
|
|
133
|
+
if (!deferral || !schema || !popupProps) {
|
|
122
134
|
return null;
|
|
123
135
|
}
|
|
124
136
|
// render
|
|
125
|
-
return ((0, jsx_runtime_1.jsxs)(interaction_1.MiniEditor, { className: "flex flex-col gap-l8", title: "Edit Asset", open: result === undefined,
|
|
126
|
-
(0, jsx_runtime_1.jsx)(feedback_1.Note, { variant: "tip", children: schema.description }), (0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)('relative h-[210px] overflow-hidden', 'border border-solid border-border-l2 rounded-md'), children: [(0, jsx_runtime_1.jsx)(AssetPreview_1.AssetPreview, { asset: asset }), (0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)('absolute inset-x-0 bottom-l5 z-overlay pointer-events-none', 'flex flex-col justify-center items-center px-l6'), children: (0, jsx_runtime_1.jsx)(AssetSpecs_1.AssetSpecs, { asset: asset }) })] }), (0, jsx_runtime_1.jsx)(react_1.AnimatePresence, { children: (0, jsx_runtime_1.jsx)(FieldErrorController_1.FieldErrorController, { errorLevel: errorLevel, children: renderFields({ asset, nameField, descriptionField, shared, setShared }) }) })] }));
|
|
137
|
+
return ((0, jsx_runtime_1.jsxs)(interaction_1.MiniEditor, Object.assign({ className: "flex flex-col gap-l8", title: "Edit Asset", open: result === undefined, canSave: onValidate, disableSave: !valid || !modified, renderSaveLabel: state => state === 'saving' ? 'Updating...' : 'Update', onSave: onUpdate, onClose: onCancel, onClosed: onPickerClosed }, popupProps, { children: [(0, jsx_runtime_1.jsx)(feedback_1.ErrorMessage, { error: error }), schema.description && !error &&
|
|
138
|
+
(0, jsx_runtime_1.jsx)(feedback_1.Note, { variant: "tip", children: schema.description }), (0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)('relative h-[210px] overflow-hidden', 'border border-solid border-border-l2 rounded-md'), children: [(0, jsx_runtime_1.jsx)(AssetPreview_1.AssetPreview, { asset: asset }), (0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)('absolute inset-x-0 bottom-l5 z-overlay pointer-events-none', 'flex flex-col justify-center items-center px-l6'), children: (0, jsx_runtime_1.jsx)(AssetSpecs_1.AssetSpecs, { asset: asset }) })] }), (0, jsx_runtime_1.jsx)(react_1.AnimatePresence, { children: (0, jsx_runtime_1.jsx)(FieldErrorController_1.FieldErrorController, { errorLevel: errorLevel, children: renderFields({ asset, nameField, descriptionField, shared, setShared }) }) })] })));
|
|
127
139
|
});
|
|
128
140
|
async function getAssetMetadata({ asset }) {
|
|
129
141
|
const { type, metadata } = asset;
|
|
@@ -6,9 +6,8 @@ export declare namespace AssetUploader {
|
|
|
6
6
|
interface Ref {
|
|
7
7
|
upload(options: Options): Promise<Result>;
|
|
8
8
|
}
|
|
9
|
-
type Options = {
|
|
9
|
+
type Options = Popup.Props.Delegated & {
|
|
10
10
|
schema: Schema.AssetField;
|
|
11
|
-
anchor: Popup.Anchor;
|
|
12
11
|
};
|
|
13
12
|
type Result = Schema.Field.LinkedData<Schema.AssetField> | 'pick' | undefined;
|
|
14
13
|
}
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
2
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
14
|
exports.AssetUploader = void 0;
|
|
4
15
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
@@ -22,7 +33,7 @@ exports.AssetUploader = (0, react_2.forwardRef)(function AssetUploader(_, ref) {
|
|
|
22
33
|
const [result, setResult] = (0, react_2.useState)();
|
|
23
34
|
const [uploading, setUploading] = (0, react_2.useState)(false);
|
|
24
35
|
const [schema, setSchema] = (0, react_2.useState)();
|
|
25
|
-
const [
|
|
36
|
+
const [popupProps, setPopupProps] = (0, react_2.useState)();
|
|
26
37
|
const [errorLevel, setErrorLevel] = (0, react_2.useState)('none');
|
|
27
38
|
const [error, setError] = (0, react_2.useState)();
|
|
28
39
|
const [assetInfo, setAssetInfo] = (0, react_2.useState)();
|
|
@@ -33,10 +44,11 @@ exports.AssetUploader = (0, react_2.forwardRef)(function AssetUploader(_, ref) {
|
|
|
33
44
|
const assetOptions = (0, react_2.useMemo)(() => getAssetOptions(schema), [schema]);
|
|
34
45
|
// export service
|
|
35
46
|
(0, react_2.useImperativeHandle)(ref, () => ({
|
|
36
|
-
upload: async (
|
|
47
|
+
upload: async (_a) => {
|
|
48
|
+
var { schema } = _a, popupProps = __rest(_a, ["schema"]);
|
|
37
49
|
// reset state
|
|
38
50
|
setSchema(schema);
|
|
39
|
-
|
|
51
|
+
setPopupProps(popupProps);
|
|
40
52
|
setErrorLevel('none');
|
|
41
53
|
setError(undefined);
|
|
42
54
|
setShared(false);
|
|
@@ -132,12 +144,12 @@ exports.AssetUploader = (0, react_2.forwardRef)(function AssetUploader(_, ref) {
|
|
|
132
144
|
deferral.resolve(result !== null && result !== void 0 ? result : undefined);
|
|
133
145
|
};
|
|
134
146
|
// skip if we don't have any params
|
|
135
|
-
if (!deferral || !schema || !
|
|
147
|
+
if (!deferral || !schema || !popupProps) {
|
|
136
148
|
return null;
|
|
137
149
|
}
|
|
138
150
|
// render
|
|
139
|
-
return ((0, jsx_runtime_1.jsxs)(interaction_1.MiniEditor, { className: "flex flex-col gap-l8", title: "Upload Asset", open: result === undefined,
|
|
140
|
-
(0, jsx_runtime_1.jsx)(feedback_1.Note, { variant: "tip", children: schema.description }), (0, jsx_runtime_1.jsx)(AssetSelectorPane_1.AssetSelectorPane, { options: assetOptions, onAssetChanged: onAssetChanged }), (0, jsx_runtime_1.jsx)(react_1.AnimatePresence, { children: (0, jsx_runtime_1.jsx)(FieldErrorController_1.FieldErrorController, { errorLevel: errorLevel, children: renderAssetInfo({ assetInfo, nameField, descriptionField, shared, setShared, uploading }) }) })] }));
|
|
151
|
+
return ((0, jsx_runtime_1.jsxs)(interaction_1.MiniEditor, Object.assign({ className: "flex flex-col gap-l8", title: "Upload Asset", open: result === undefined, canSave: onValidate, disableSave: !(assetInfo === null || assetInfo === void 0 ? void 0 : assetInfo.isValid), renderSaveLabel: () => 'Upload', customActions: (0, jsx_runtime_1.jsx)(interaction_1.Button, { variant: "secondary", size: "sm", iconLeft: "ImageDown", disabled: uploading, onClick: () => setResult('pick'), children: "Open Library" }), onSave: onUpload, onClose: onCancel, onClosed: onPickerClosed }, popupProps, { children: [schema.description &&
|
|
152
|
+
(0, jsx_runtime_1.jsx)(feedback_1.Note, { variant: "tip", children: schema.description }), (0, jsx_runtime_1.jsx)(AssetSelectorPane_1.AssetSelectorPane, { options: assetOptions, onAssetChanged: onAssetChanged }), (0, jsx_runtime_1.jsx)(react_1.AnimatePresence, { children: (0, jsx_runtime_1.jsx)(FieldErrorController_1.FieldErrorController, { errorLevel: errorLevel, children: renderAssetInfo({ assetInfo, nameField, descriptionField, shared, setShared, uploading }) }) })] })));
|
|
141
153
|
});
|
|
142
154
|
function getAssetOptions(schema) {
|
|
143
155
|
// return empty options if there's no schema
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Language, Schema } from '@nascentdigital/funnel-core';
|
|
2
|
+
import { Popup } from '../../interaction';
|
|
2
3
|
export declare const CollectionEditor: import("react").ForwardRefExoticComponent<CollectionEditor.Props & import("react").RefAttributes<CollectionEditor.Ref>>;
|
|
3
4
|
export declare namespace CollectionEditor {
|
|
4
5
|
type Props = {
|
|
@@ -7,7 +8,7 @@ export declare namespace CollectionEditor {
|
|
|
7
8
|
interface Ref {
|
|
8
9
|
edit(options: Options): Promise<Schema.Field.Data<Schema.CollectionField> | undefined>;
|
|
9
10
|
}
|
|
10
|
-
type Options = {
|
|
11
|
+
type Options = Popup.Props.Delegated & {
|
|
11
12
|
schema: Schema.CollectionField;
|
|
12
13
|
collectionSchema: Schema.Collection;
|
|
13
14
|
value?: Schema.CollectionField.Value;
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
2
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
14
|
exports.CollectionEditor = void 0;
|
|
4
15
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
@@ -21,6 +32,7 @@ exports.CollectionEditor = (0, react_1.forwardRef)(function CollectionEditor({ l
|
|
|
21
32
|
const [schema, setSchema] = (0, react_1.useState)();
|
|
22
33
|
const [collectionSchema, setCollectionSchema] = (0, react_1.useState)();
|
|
23
34
|
const [initialValue, setInitialValue] = (0, react_1.useState)();
|
|
35
|
+
const [popupProps, setPopupProps] = (0, react_1.useState)();
|
|
24
36
|
const [field, setField] = (0, react_1.useState)();
|
|
25
37
|
const [shared, setShared] = (0, react_1.useState)(false);
|
|
26
38
|
const page = (0, hooks_1.usePossiblePage)();
|
|
@@ -32,11 +44,13 @@ exports.CollectionEditor = (0, react_1.forwardRef)(function CollectionEditor({ l
|
|
|
32
44
|
(0, hooks_1.useCollectionFieldProxy)(field);
|
|
33
45
|
// export service
|
|
34
46
|
(0, react_1.useImperativeHandle)(ref, () => ({
|
|
35
|
-
edit: async (
|
|
47
|
+
edit: async (_a) => {
|
|
48
|
+
var { schema, collectionSchema, value } = _a, popupProps = __rest(_a, ["schema", "collectionSchema", "value"]);
|
|
36
49
|
// reset state
|
|
37
50
|
setSchema(schema);
|
|
38
51
|
setCollectionSchema(collectionSchema);
|
|
39
52
|
setInitialValue(value);
|
|
53
|
+
setPopupProps(popupProps);
|
|
40
54
|
setField(undefined);
|
|
41
55
|
setShared(false);
|
|
42
56
|
// create deferral
|
|
@@ -69,8 +83,8 @@ exports.CollectionEditor = (0, react_1.forwardRef)(function CollectionEditor({ l
|
|
|
69
83
|
setShared(!field.isNew && field.isRef);
|
|
70
84
|
});
|
|
71
85
|
}, [language, collectionRepository, collectionStore, schema, collectionSchema, initialValue]);
|
|
72
|
-
// skip if
|
|
73
|
-
if (!schema || !collectionSchema) {
|
|
86
|
+
// skip if not ready
|
|
87
|
+
if (!schema || !collectionSchema || !popupProps) {
|
|
74
88
|
return null;
|
|
75
89
|
}
|
|
76
90
|
// helpers
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Language, Schema } from '@nascentdigital/funnel-core';
|
|
2
|
+
import { Popup } from '../../interaction';
|
|
2
3
|
export declare const EmbeddedVideoEditor: import("react").ForwardRefExoticComponent<EmbeddedVideoEditor.Props & import("react").RefAttributes<EmbeddedVideoEditor.Ref>>;
|
|
3
4
|
export declare namespace EmbeddedVideoEditor {
|
|
4
5
|
type Props = {
|
|
@@ -7,9 +8,8 @@ export declare namespace EmbeddedVideoEditor {
|
|
|
7
8
|
interface Ref {
|
|
8
9
|
edit(options: Options): Promise<Schema.Field.Data<Schema.EmbeddedVideoField> | undefined>;
|
|
9
10
|
}
|
|
10
|
-
type Options = {
|
|
11
|
+
type Options = Popup.Props.Delegated & {
|
|
11
12
|
schema: Schema.EmbeddedVideoField;
|
|
12
13
|
initialValue?: Schema.Field.Data<Schema.EmbeddedVideoField>;
|
|
13
|
-
anchor: string;
|
|
14
14
|
};
|
|
15
15
|
}
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
2
13
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
15
|
};
|
|
@@ -22,7 +33,7 @@ exports.EmbeddedVideoEditor = (0, react_1.forwardRef)(function EmbeddedVideoEdit
|
|
|
22
33
|
const [deferral, setDeferral] = (0, react_1.useState)(undefined);
|
|
23
34
|
const [schema, setSchema] = (0, react_1.useState)();
|
|
24
35
|
const [initialValue, setInitialValue] = (0, react_1.useState)();
|
|
25
|
-
const [
|
|
36
|
+
const [popupProps, setPopupProps] = (0, react_1.useState)();
|
|
26
37
|
const [state, setState] = (0, react_1.useState)('initializing');
|
|
27
38
|
const touch = (0, client_1.useTouch)();
|
|
28
39
|
const { uriField } = (0, hooks_1.useTempFields)({
|
|
@@ -40,11 +51,12 @@ exports.EmbeddedVideoEditor = (0, react_1.forwardRef)(function EmbeddedVideoEdit
|
|
|
40
51
|
const video = video$.value;
|
|
41
52
|
// export service
|
|
42
53
|
(0, react_1.useImperativeHandle)(ref, () => ({
|
|
43
|
-
edit: async (
|
|
54
|
+
edit: async (_a) => {
|
|
55
|
+
var { schema, initialValue } = _a, popupProps = __rest(_a, ["schema", "initialValue"]);
|
|
44
56
|
// reset state
|
|
45
57
|
setSchema(schema);
|
|
46
58
|
setInitialValue(initialValue);
|
|
47
|
-
|
|
59
|
+
setPopupProps(popupProps);
|
|
48
60
|
setState('initializing');
|
|
49
61
|
// setup inputs
|
|
50
62
|
const video = initialValue === null || initialValue === void 0 ? void 0 : initialValue.value;
|
|
@@ -154,8 +166,8 @@ exports.EmbeddedVideoEditor = (0, react_1.forwardRef)(function EmbeddedVideoEdit
|
|
|
154
166
|
touch();
|
|
155
167
|
};
|
|
156
168
|
// render
|
|
157
|
-
return ((0, jsx_runtime_1.jsxs)(interaction_1.MiniEditor, { title: `${initialValue ? 'Edit' : 'Add'} ${name}`, open: !!deferral && !deferral.isComplete,
|
|
158
|
-
(0, jsx_runtime_1.jsx)(feedback_1.Note, { variant: "tip", children: description }), renderPreview({ state, video }), (0, jsx_runtime_1.jsx)(FieldErrorController_1.FieldErrorController, { errorLevel: "none", children: (0, jsx_runtime_1.jsx)(TextField_1.TextField, { field: uriField }) })] }));
|
|
169
|
+
return ((0, jsx_runtime_1.jsxs)(interaction_1.MiniEditor, Object.assign({ title: `${initialValue ? 'Edit' : 'Add'} ${name}`, open: !!deferral && !deferral.isComplete, canSave: canSave, onSave: onSave, onClose: onCancel, disabled: state === 'validating' }, popupProps, { children: [description &&
|
|
170
|
+
(0, jsx_runtime_1.jsx)(feedback_1.Note, { variant: "tip", children: description }), renderPreview({ state, video }), (0, jsx_runtime_1.jsx)(FieldErrorController_1.FieldErrorController, { errorLevel: "none", children: (0, jsx_runtime_1.jsx)(TextField_1.TextField, { field: uriField }) })] })));
|
|
159
171
|
});
|
|
160
172
|
async function getVideoThumbnailUrl(video) {
|
|
161
173
|
// skip if there's no video
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Callback, Schema } from '@nascentdigital/funnel-core';
|
|
2
|
-
|
|
2
|
+
import { Popup } from '../../interaction';
|
|
3
|
+
export declare function AssetFactory({ schema, assetId, onCommit, onCancel: onCancelRaw, ...popupProps }: AssetFactory.Props): import("react/jsx-runtime").JSX.Element;
|
|
3
4
|
export declare namespace AssetFactory {
|
|
4
|
-
type Props = {
|
|
5
|
+
type Props = Popup.Props.Delegated & {
|
|
5
6
|
schema: Schema.AssetField;
|
|
6
7
|
assetId?: Schema.Asset.Id;
|
|
7
|
-
anchor: string;
|
|
8
8
|
onCommit: Callback<Schema.Field.Data<Schema.AssetField>>;
|
|
9
9
|
onCancel: Callback.Void;
|
|
10
10
|
};
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
2
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
14
|
exports.AssetFactory = AssetFactory;
|
|
4
15
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
@@ -8,14 +19,15 @@ const hooks_1 = require("../../../hooks");
|
|
|
8
19
|
const interaction_1 = require("../../interaction");
|
|
9
20
|
const asset_1 = require("../asset");
|
|
10
21
|
// component
|
|
11
|
-
function AssetFactory(
|
|
22
|
+
function AssetFactory(_a) {
|
|
23
|
+
var { schema, assetId, onCommit, onCancel: onCancelRaw } = _a, popupProps = __rest(_a, ["schema", "assetId", "onCommit", "onCancel"]);
|
|
12
24
|
// bind refs
|
|
13
25
|
const menu = (0, interaction_1.useMenuController)();
|
|
14
26
|
const pickerRef = (0, react_1.useRef)(null);
|
|
15
27
|
const uploaderRef = (0, react_1.useRef)(null);
|
|
16
28
|
const editorRef = (0, react_1.useRef)(null);
|
|
17
|
-
const
|
|
18
|
-
|
|
29
|
+
const popupPropsRef = (0, react_1.useRef)(popupProps);
|
|
30
|
+
popupPropsRef.current = popupProps;
|
|
19
31
|
const onCommitRef = (0, react_1.useRef)(onCommit);
|
|
20
32
|
onCommitRef.current = onCommit;
|
|
21
33
|
const onCancelRef = (0, react_1.useRef)(onCancelRaw);
|
|
@@ -35,7 +47,7 @@ function AssetFactory({ schema, assetId, anchor, onCommit, onCancel: onCancelRaw
|
|
|
35
47
|
menu.items = createMenuItems;
|
|
36
48
|
}
|
|
37
49
|
// open menu
|
|
38
|
-
menu.open(
|
|
50
|
+
menu.open(popupPropsRef.current.anchor);
|
|
39
51
|
}, [menu, assetId]);
|
|
40
52
|
// helpers
|
|
41
53
|
const onPick = async () => {
|
|
@@ -60,10 +72,7 @@ function AssetFactory({ schema, assetId, anchor, onCommit, onCancel: onCancelRaw
|
|
|
60
72
|
const onUpload = async () => {
|
|
61
73
|
var _a;
|
|
62
74
|
// launch uploader
|
|
63
|
-
const asset = await ((_a = uploaderRef.current) === null || _a === void 0 ? void 0 : _a.upload({
|
|
64
|
-
schema,
|
|
65
|
-
anchor
|
|
66
|
-
}));
|
|
75
|
+
const asset = await ((_a = uploaderRef.current) === null || _a === void 0 ? void 0 : _a.upload(Object.assign({ schema }, (popupPropsRef.current))));
|
|
67
76
|
// cancel if no visual was selected
|
|
68
77
|
if (!asset) {
|
|
69
78
|
onCancel();
|
|
@@ -85,11 +94,7 @@ function AssetFactory({ schema, assetId, anchor, onCommit, onCancel: onCancelRaw
|
|
|
85
94
|
return;
|
|
86
95
|
}
|
|
87
96
|
// perform edit
|
|
88
|
-
const updatedAsset = await ((_a = editorRef.current) === null || _a === void 0 ? void 0 : _a.edit({
|
|
89
|
-
schema,
|
|
90
|
-
asset: asset.value,
|
|
91
|
-
anchor
|
|
92
|
-
}));
|
|
97
|
+
const updatedAsset = await ((_a = editorRef.current) === null || _a === void 0 ? void 0 : _a.edit(Object.assign({ schema, asset: asset.value }, (popupPropsRef.current))));
|
|
93
98
|
// always cancel
|
|
94
99
|
onCancel();
|
|
95
100
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Callback, Language, Schema } from '@nascentdigital/funnel-core';
|
|
2
|
-
|
|
2
|
+
import { Popup } from '../../interaction';
|
|
3
|
+
export declare function CollectionFactory({ schema, language, collection: initialValue, onCommit, onCancel: onCancelRaw, ...popupProps }: CollectionFactory.Props): import("react/jsx-runtime").JSX.Element;
|
|
3
4
|
export declare namespace CollectionFactory {
|
|
4
|
-
type Props = {
|
|
5
|
+
type Props = Popup.Props.Delegated & {
|
|
5
6
|
schema: Schema.CollectionField;
|
|
6
7
|
language: Language;
|
|
7
8
|
collection?: Schema.CollectionField.Value;
|
|
8
|
-
anchor: string;
|
|
9
9
|
onCommit: Callback<Schema.Field.Data<Schema.CollectionField>>;
|
|
10
10
|
onCancel: Callback.Void;
|
|
11
11
|
};
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
2
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
14
|
exports.CollectionFactory = CollectionFactory;
|
|
4
15
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
@@ -7,13 +18,14 @@ const react_1 = require("react");
|
|
|
7
18
|
const interaction_1 = require("../../interaction");
|
|
8
19
|
const collection_1 = require("../collection");
|
|
9
20
|
// component
|
|
10
|
-
function CollectionFactory(
|
|
21
|
+
function CollectionFactory(_a) {
|
|
22
|
+
var { schema, language, collection: initialValue, onCommit, onCancel: onCancelRaw } = _a, popupProps = __rest(_a, ["schema", "language", "collection", "onCommit", "onCancel"]);
|
|
11
23
|
// bind refs
|
|
12
24
|
const menu = (0, interaction_1.useMenuController)();
|
|
13
25
|
const pickerRef = (0, react_1.useRef)(null);
|
|
14
26
|
const editorRef = (0, react_1.useRef)(null);
|
|
15
|
-
const
|
|
16
|
-
|
|
27
|
+
const popupPropsRef = (0, react_1.useRef)(popupProps);
|
|
28
|
+
popupPropsRef.current = popupProps;
|
|
17
29
|
const onCommitRef = (0, react_1.useRef)(onCommit);
|
|
18
30
|
onCommitRef.current = onCommit;
|
|
19
31
|
const onCancelRef = (0, react_1.useRef)(onCancelRaw);
|
|
@@ -55,7 +67,7 @@ function CollectionFactory({ schema, language, collection: initialValue, anchor,
|
|
|
55
67
|
];
|
|
56
68
|
}
|
|
57
69
|
// open menu
|
|
58
|
-
menu.open(
|
|
70
|
+
menu.open(popupPropsRef.current.anchor);
|
|
59
71
|
}, [menu, collectionOptions, initialValue]);
|
|
60
72
|
// helpers
|
|
61
73
|
const onPick = async () => {
|
|
@@ -76,10 +88,8 @@ function CollectionFactory({ schema, language, collection: initialValue, anchor,
|
|
|
76
88
|
const onCreate = async (collectionSchema) => {
|
|
77
89
|
var _a;
|
|
78
90
|
// start picker (cancel if nothing was picked
|
|
79
|
-
const collection = await ((_a = editorRef.current) === null || _a === void 0 ? void 0 : _a.edit({
|
|
80
|
-
|
|
81
|
-
collectionSchema
|
|
82
|
-
}));
|
|
91
|
+
const collection = await ((_a = editorRef.current) === null || _a === void 0 ? void 0 : _a.edit(Object.assign({ schema,
|
|
92
|
+
collectionSchema }, (popupPropsRef.current))));
|
|
83
93
|
if (!collection) {
|
|
84
94
|
onCancel();
|
|
85
95
|
}
|
|
@@ -98,11 +108,8 @@ function CollectionFactory({ schema, language, collection: initialValue, anchor,
|
|
|
98
108
|
throw new funnel_core_1.IllegalStateError(`Unable to resolve "${collectionType}" Collection`);
|
|
99
109
|
}
|
|
100
110
|
// start picker (cancel if nothing was picked
|
|
101
|
-
const collection = await ((_a = editorRef.current) === null || _a === void 0 ? void 0 : _a.edit({
|
|
102
|
-
|
|
103
|
-
collectionSchema,
|
|
104
|
-
value: initialValue
|
|
105
|
-
}));
|
|
111
|
+
const collection = await ((_a = editorRef.current) === null || _a === void 0 ? void 0 : _a.edit(Object.assign({ schema,
|
|
112
|
+
collectionSchema, value: initialValue }, (popupPropsRef.current))));
|
|
106
113
|
if (!collection) {
|
|
107
114
|
onCancel();
|
|
108
115
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Callback, Language, Schema } from '@nascentdigital/funnel-core';
|
|
2
|
-
|
|
2
|
+
import { Popup } from '../../interaction';
|
|
3
|
+
export declare function EmbeddedVideoFactory({ schema, initialValue, language, onCommit, onCancel, ...popupProps }: EmbeddedVideoFactory.Props): import("react/jsx-runtime").JSX.Element;
|
|
3
4
|
export declare namespace EmbeddedVideoFactory {
|
|
4
|
-
type Props = {
|
|
5
|
+
type Props = Popup.Props.Delegated & {
|
|
5
6
|
schema: Schema.EmbeddedVideoField;
|
|
6
7
|
initialValue?: Schema.Field.Data<Schema.EmbeddedVideoField>;
|
|
7
8
|
language: Language;
|
|
8
|
-
anchor: string;
|
|
9
9
|
onCommit: Callback<Schema.Field.Data<Schema.EmbeddedVideoField>>;
|
|
10
10
|
onCancel: Callback.Void;
|
|
11
11
|
};
|
|
@@ -1,15 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
2
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
14
|
exports.EmbeddedVideoFactory = EmbeddedVideoFactory;
|
|
4
15
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
16
|
const react_1 = require("react");
|
|
6
17
|
const embed_1 = require("../embed");
|
|
7
18
|
// component
|
|
8
|
-
function EmbeddedVideoFactory(
|
|
19
|
+
function EmbeddedVideoFactory(_a) {
|
|
20
|
+
var { schema, initialValue, language, onCommit, onCancel } = _a, popupProps = __rest(_a, ["schema", "initialValue", "language", "onCommit", "onCancel"]);
|
|
9
21
|
// bind refs
|
|
10
22
|
const editorRef = (0, react_1.useRef)(null);
|
|
11
|
-
const
|
|
12
|
-
|
|
23
|
+
const popupPropsRef = (0, react_1.useRef)(popupProps);
|
|
24
|
+
popupPropsRef.current = popupProps;
|
|
13
25
|
const onCommitRef = (0, react_1.useRef)(onCommit);
|
|
14
26
|
onCommitRef.current = onCommit;
|
|
15
27
|
const onCancelRef = (0, react_1.useRef)(onCancel);
|
|
@@ -20,11 +32,8 @@ function EmbeddedVideoFactory({ schema, initialValue, language, anchor, onCommit
|
|
|
20
32
|
const onEdit = async () => {
|
|
21
33
|
var _a;
|
|
22
34
|
// start editor (cancel if dismissed)
|
|
23
|
-
const value = await ((_a = editorRef.current) === null || _a === void 0 ? void 0 : _a.edit({
|
|
24
|
-
|
|
25
|
-
initialValue,
|
|
26
|
-
anchor: anchorRef.current
|
|
27
|
-
}));
|
|
35
|
+
const value = await ((_a = editorRef.current) === null || _a === void 0 ? void 0 : _a.edit(Object.assign({ schema,
|
|
36
|
+
initialValue }, (popupPropsRef.current))));
|
|
28
37
|
if (!value) {
|
|
29
38
|
onCancelRef.current();
|
|
30
39
|
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { Callback, Field, ObjectField, Schema } from '@nascentdigital/funnel-core';
|
|
2
|
-
|
|
1
|
+
import { Callback, Field, FieldModel, ObjectField, Schema } from '@nascentdigital/funnel-core';
|
|
2
|
+
import { Popup } from '../../interaction';
|
|
3
|
+
export declare function FieldValueFactory<T extends Schema.Field.Type>({ itemSchema, field, onCommit, onCancel, ...popupProps }: FieldValueFactory.Props<T>): import("react/jsx-runtime").JSX.Element | null;
|
|
3
4
|
export declare namespace FieldValueFactory {
|
|
4
|
-
type Props<T extends Schema.Field.Type = Schema.Field.Type> = {
|
|
5
|
-
|
|
5
|
+
type Props<T extends Schema.Field.Type = Schema.Field.Type> = Popup.Props.Delegated & {
|
|
6
|
+
field?: CompatibleField<T>;
|
|
6
7
|
itemSchema: T;
|
|
7
|
-
field?: Field<T> | ObjectField;
|
|
8
8
|
onCommit?: Callback<Schema.Field.Data<T>>;
|
|
9
9
|
onCancel?: Callback.Void;
|
|
10
10
|
};
|
|
11
|
+
type CompatibleField<T extends Schema.Field.Type = Schema.Field.Type> = Field<T> | ObjectField;
|
|
12
|
+
function isCompatibleField(field: FieldModel | undefined): field is CompatibleField;
|
|
11
13
|
}
|