dn-react-router-toolkit 0.9.11 → 0.10.0
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/api/default_api_handler.d.mts +2 -1
- package/dist/api/default_api_handler.d.ts +2 -1
- package/dist/api/default_api_handler.js +15 -14
- package/dist/api/default_api_handler.mjs +1 -0
- package/dist/api/index.js +17 -37
- package/dist/api/index.mjs +4 -31
- package/dist/api/patch_resource_handler.js +2 -23
- package/dist/api/patch_resource_handler.mjs +3 -31
- package/dist/api/put_resource_handler.js +2 -23
- package/dist/api/put_resource_handler.mjs +3 -31
- package/dist/api/resource_handler.d.mts +3 -2
- package/dist/api/resource_handler.d.ts +3 -2
- package/dist/api/resource_handler.js +2 -23
- package/dist/api/resource_handler.mjs +3 -31
- package/dist/auth/cookie_manager.d.mts +5 -2
- package/dist/auth/cookie_manager.d.ts +5 -2
- package/dist/auth/cookie_manager.js +16 -9
- package/dist/auth/cookie_manager.mjs +14 -8
- package/dist/auth/index.d.mts +1 -1
- package/dist/auth/index.d.ts +1 -1
- package/dist/auth/index.js +14 -7
- package/dist/auth/index.mjs +13 -7
- package/dist/client/env_loader.d.mts +2 -2
- package/dist/client/env_loader.d.ts +2 -2
- package/dist/client/file_input.d.mts +2 -2
- package/dist/client/file_input.d.ts +2 -2
- package/dist/client/index.d.mts +0 -7
- package/dist/client/index.d.ts +0 -7
- package/dist/client/index.js +0 -117
- package/dist/client/index.mjs +0 -117
- package/dist/crud/crud_form.d.mts +2 -2
- package/dist/crud/crud_form.d.ts +2 -2
- package/dist/crud/crud_form.js +40 -151
- package/dist/crud/crud_form.mjs +40 -158
- package/dist/crud/crud_form_provider.d.mts +6 -7
- package/dist/crud/crud_form_provider.d.ts +6 -7
- package/dist/crud/crud_form_provider.mjs +1 -4
- package/dist/crud/index.d.mts +0 -1
- package/dist/crud/index.d.ts +0 -1
- package/dist/crud/index.js +2 -23
- package/dist/crud/index.mjs +3 -31
- package/dist/form/create_form_component.d.mts +2 -2
- package/dist/form/create_form_component.d.ts +2 -2
- package/dist/form/form_components.d.mts +3 -4
- package/dist/form/form_components.d.ts +3 -4
- package/dist/form/index.d.mts +0 -1
- package/dist/form/index.d.ts +0 -1
- package/dist/index.d.mts +2 -3
- package/dist/index.d.ts +2 -3
- package/dist/post/index.d.mts +2 -3
- package/dist/post/index.d.ts +2 -3
- package/dist/post/thumbnail_picker.d.mts +4 -4
- package/dist/post/thumbnail_picker.d.ts +4 -4
- package/dist/seo/index.d.mts +1 -1
- package/dist/seo/index.d.ts +1 -1
- package/dist/seo/seo.d.mts +2 -2
- package/dist/seo/seo.d.ts +2 -2
- package/dist/table/buttons.d.mts +2 -2
- package/dist/table/buttons.d.ts +2 -2
- package/dist/table/index.d.mts +1 -2
- package/dist/table/index.d.ts +1 -2
- package/dist/table/table.d.mts +2 -2
- package/dist/table/table.d.ts +2 -2
- package/dist/table/table_form.d.mts +2 -3
- package/dist/table/table_form.d.ts +2 -3
- package/package.json +12 -12
- package/dist/client/editor.d.mts +0 -12
- package/dist/client/editor.d.ts +0 -12
- package/dist/client/editor.js +0 -63
- package/dist/client/editor.mjs +0 -38
- package/dist/client/store_text_editor.d.mts +0 -13
- package/dist/client/store_text_editor.d.ts +0 -13
- package/dist/client/store_text_editor.js +0 -104
- package/dist/client/store_text_editor.mjs +0 -81
|
@@ -5,10 +5,13 @@ declare class ReactRouterCookieManager implements CookieManager {
|
|
|
5
5
|
name: string;
|
|
6
6
|
options: SerializeOptions;
|
|
7
7
|
private cookie;
|
|
8
|
-
constructor(name: string);
|
|
8
|
+
constructor(name: string, options?: SerializeOptions);
|
|
9
9
|
parseFromRequest(request: Request, parseOptions?: ParseOptions | undefined): Promise<string | undefined>;
|
|
10
10
|
parse(cookieHeader: string, parseOptions?: ParseOptions | undefined): Promise<string | undefined>;
|
|
11
11
|
serialize(value: string | undefined, serializeOptions?: SerializeOptions | undefined): Promise<string>;
|
|
12
12
|
}
|
|
13
|
+
declare class ReactRouterSessionCookieManager extends ReactRouterCookieManager {
|
|
14
|
+
serialize(value: string | undefined, serializeOptions?: SerializeOptions | undefined): Promise<string>;
|
|
15
|
+
}
|
|
13
16
|
|
|
14
|
-
export { ReactRouterCookieManager };
|
|
17
|
+
export { ReactRouterCookieManager, ReactRouterSessionCookieManager };
|
|
@@ -5,10 +5,13 @@ declare class ReactRouterCookieManager implements CookieManager {
|
|
|
5
5
|
name: string;
|
|
6
6
|
options: SerializeOptions;
|
|
7
7
|
private cookie;
|
|
8
|
-
constructor(name: string);
|
|
8
|
+
constructor(name: string, options?: SerializeOptions);
|
|
9
9
|
parseFromRequest(request: Request, parseOptions?: ParseOptions | undefined): Promise<string | undefined>;
|
|
10
10
|
parse(cookieHeader: string, parseOptions?: ParseOptions | undefined): Promise<string | undefined>;
|
|
11
11
|
serialize(value: string | undefined, serializeOptions?: SerializeOptions | undefined): Promise<string>;
|
|
12
12
|
}
|
|
13
|
+
declare class ReactRouterSessionCookieManager extends ReactRouterCookieManager {
|
|
14
|
+
serialize(value: string | undefined, serializeOptions?: SerializeOptions | undefined): Promise<string>;
|
|
15
|
+
}
|
|
13
16
|
|
|
14
|
-
export { ReactRouterCookieManager };
|
|
17
|
+
export { ReactRouterCookieManager, ReactRouterSessionCookieManager };
|
|
@@ -20,22 +20,19 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/auth/cookie_manager.ts
|
|
21
21
|
var cookie_manager_exports = {};
|
|
22
22
|
__export(cookie_manager_exports, {
|
|
23
|
-
ReactRouterCookieManager: () => ReactRouterCookieManager
|
|
23
|
+
ReactRouterCookieManager: () => ReactRouterCookieManager,
|
|
24
|
+
ReactRouterSessionCookieManager: () => ReactRouterSessionCookieManager
|
|
24
25
|
});
|
|
25
26
|
module.exports = __toCommonJS(cookie_manager_exports);
|
|
26
27
|
var import_react_router = require("react-router");
|
|
28
|
+
var import_server = require("gw-auth/server");
|
|
27
29
|
var ReactRouterCookieManager = class {
|
|
28
30
|
name;
|
|
29
31
|
options;
|
|
30
32
|
cookie;
|
|
31
|
-
constructor(name) {
|
|
33
|
+
constructor(name, options = import_server.defaultCookieOptions) {
|
|
32
34
|
this.name = name;
|
|
33
|
-
this.options =
|
|
34
|
-
path: "/",
|
|
35
|
-
httpOnly: process.env.NODE_ENV === "production",
|
|
36
|
-
secure: process.env.NODE_ENV === "production",
|
|
37
|
-
sameSite: "strict"
|
|
38
|
-
};
|
|
35
|
+
this.options = options;
|
|
39
36
|
this.cookie = (0, import_react_router.createCookie)(this.name, this.options);
|
|
40
37
|
}
|
|
41
38
|
async parseFromRequest(request, parseOptions) {
|
|
@@ -56,7 +53,17 @@ var ReactRouterCookieManager = class {
|
|
|
56
53
|
});
|
|
57
54
|
}
|
|
58
55
|
};
|
|
56
|
+
var ReactRouterSessionCookieManager = class extends ReactRouterCookieManager {
|
|
57
|
+
serialize(value, serializeOptions) {
|
|
58
|
+
return super.serialize(value, {
|
|
59
|
+
...serializeOptions,
|
|
60
|
+
maxAge: void 0,
|
|
61
|
+
expires: void 0
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
};
|
|
59
65
|
// Annotate the CommonJS export names for ESM import in node:
|
|
60
66
|
0 && (module.exports = {
|
|
61
|
-
ReactRouterCookieManager
|
|
67
|
+
ReactRouterCookieManager,
|
|
68
|
+
ReactRouterSessionCookieManager
|
|
62
69
|
});
|
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
// src/auth/cookie_manager.ts
|
|
2
2
|
import { createCookie } from "react-router";
|
|
3
|
+
import { defaultCookieOptions } from "gw-auth/server";
|
|
3
4
|
var ReactRouterCookieManager = class {
|
|
4
5
|
name;
|
|
5
6
|
options;
|
|
6
7
|
cookie;
|
|
7
|
-
constructor(name) {
|
|
8
|
+
constructor(name, options = defaultCookieOptions) {
|
|
8
9
|
this.name = name;
|
|
9
|
-
this.options =
|
|
10
|
-
path: "/",
|
|
11
|
-
httpOnly: process.env.NODE_ENV === "production",
|
|
12
|
-
secure: process.env.NODE_ENV === "production",
|
|
13
|
-
sameSite: "strict"
|
|
14
|
-
};
|
|
10
|
+
this.options = options;
|
|
15
11
|
this.cookie = createCookie(this.name, this.options);
|
|
16
12
|
}
|
|
17
13
|
async parseFromRequest(request, parseOptions) {
|
|
@@ -32,6 +28,16 @@ var ReactRouterCookieManager = class {
|
|
|
32
28
|
});
|
|
33
29
|
}
|
|
34
30
|
};
|
|
31
|
+
var ReactRouterSessionCookieManager = class extends ReactRouterCookieManager {
|
|
32
|
+
serialize(value, serializeOptions) {
|
|
33
|
+
return super.serialize(value, {
|
|
34
|
+
...serializeOptions,
|
|
35
|
+
maxAge: void 0,
|
|
36
|
+
expires: void 0
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
};
|
|
35
40
|
export {
|
|
36
|
-
ReactRouterCookieManager
|
|
41
|
+
ReactRouterCookieManager,
|
|
42
|
+
ReactRouterSessionCookieManager
|
|
37
43
|
};
|
package/dist/auth/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { WithAuthHandler, createWithStrictAuthHandler } from './with_auth.mjs';
|
|
2
|
-
export { ReactRouterCookieManager } from './cookie_manager.mjs';
|
|
2
|
+
export { ReactRouterCookieManager, ReactRouterSessionCookieManager } from './cookie_manager.mjs';
|
|
3
3
|
import 'gw-auth';
|
|
4
4
|
import 'gw-auth/server';
|
|
5
5
|
import 'react-router';
|
package/dist/auth/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { WithAuthHandler, createWithStrictAuthHandler } from './with_auth.js';
|
|
2
|
-
export { ReactRouterCookieManager } from './cookie_manager.js';
|
|
2
|
+
export { ReactRouterCookieManager, ReactRouterSessionCookieManager } from './cookie_manager.js';
|
|
3
3
|
import 'gw-auth';
|
|
4
4
|
import 'gw-auth/server';
|
|
5
5
|
import 'react-router';
|
package/dist/auth/index.js
CHANGED
|
@@ -21,6 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
var auth_exports = {};
|
|
22
22
|
__export(auth_exports, {
|
|
23
23
|
ReactRouterCookieManager: () => ReactRouterCookieManager,
|
|
24
|
+
ReactRouterSessionCookieManager: () => ReactRouterSessionCookieManager,
|
|
24
25
|
createWithStrictAuthHandler: () => createWithStrictAuthHandler
|
|
25
26
|
});
|
|
26
27
|
module.exports = __toCommonJS(auth_exports);
|
|
@@ -83,18 +84,14 @@ function createWithStrictAuthHandler({ authService }) {
|
|
|
83
84
|
|
|
84
85
|
// src/auth/cookie_manager.ts
|
|
85
86
|
var import_react_router = require("react-router");
|
|
87
|
+
var import_server = require("gw-auth/server");
|
|
86
88
|
var ReactRouterCookieManager = class {
|
|
87
89
|
name;
|
|
88
90
|
options;
|
|
89
91
|
cookie;
|
|
90
|
-
constructor(name) {
|
|
92
|
+
constructor(name, options = import_server.defaultCookieOptions) {
|
|
91
93
|
this.name = name;
|
|
92
|
-
this.options =
|
|
93
|
-
path: "/",
|
|
94
|
-
httpOnly: process.env.NODE_ENV === "production",
|
|
95
|
-
secure: process.env.NODE_ENV === "production",
|
|
96
|
-
sameSite: "strict"
|
|
97
|
-
};
|
|
94
|
+
this.options = options;
|
|
98
95
|
this.cookie = (0, import_react_router.createCookie)(this.name, this.options);
|
|
99
96
|
}
|
|
100
97
|
async parseFromRequest(request, parseOptions) {
|
|
@@ -115,8 +112,18 @@ var ReactRouterCookieManager = class {
|
|
|
115
112
|
});
|
|
116
113
|
}
|
|
117
114
|
};
|
|
115
|
+
var ReactRouterSessionCookieManager = class extends ReactRouterCookieManager {
|
|
116
|
+
serialize(value, serializeOptions) {
|
|
117
|
+
return super.serialize(value, {
|
|
118
|
+
...serializeOptions,
|
|
119
|
+
maxAge: void 0,
|
|
120
|
+
expires: void 0
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
};
|
|
118
124
|
// Annotate the CommonJS export names for ESM import in node:
|
|
119
125
|
0 && (module.exports = {
|
|
120
126
|
ReactRouterCookieManager,
|
|
127
|
+
ReactRouterSessionCookieManager,
|
|
121
128
|
createWithStrictAuthHandler
|
|
122
129
|
});
|
package/dist/auth/index.mjs
CHANGED
|
@@ -56,18 +56,14 @@ function createWithStrictAuthHandler({ authService }) {
|
|
|
56
56
|
|
|
57
57
|
// src/auth/cookie_manager.ts
|
|
58
58
|
import { createCookie } from "react-router";
|
|
59
|
+
import { defaultCookieOptions } from "gw-auth/server";
|
|
59
60
|
var ReactRouterCookieManager = class {
|
|
60
61
|
name;
|
|
61
62
|
options;
|
|
62
63
|
cookie;
|
|
63
|
-
constructor(name) {
|
|
64
|
+
constructor(name, options = defaultCookieOptions) {
|
|
64
65
|
this.name = name;
|
|
65
|
-
this.options =
|
|
66
|
-
path: "/",
|
|
67
|
-
httpOnly: process.env.NODE_ENV === "production",
|
|
68
|
-
secure: process.env.NODE_ENV === "production",
|
|
69
|
-
sameSite: "strict"
|
|
70
|
-
};
|
|
66
|
+
this.options = options;
|
|
71
67
|
this.cookie = createCookie(this.name, this.options);
|
|
72
68
|
}
|
|
73
69
|
async parseFromRequest(request, parseOptions) {
|
|
@@ -88,7 +84,17 @@ var ReactRouterCookieManager = class {
|
|
|
88
84
|
});
|
|
89
85
|
}
|
|
90
86
|
};
|
|
87
|
+
var ReactRouterSessionCookieManager = class extends ReactRouterCookieManager {
|
|
88
|
+
serialize(value, serializeOptions) {
|
|
89
|
+
return super.serialize(value, {
|
|
90
|
+
...serializeOptions,
|
|
91
|
+
maxAge: void 0,
|
|
92
|
+
expires: void 0
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
};
|
|
91
96
|
export {
|
|
92
97
|
ReactRouterCookieManager,
|
|
98
|
+
ReactRouterSessionCookieManager,
|
|
93
99
|
createWithStrictAuthHandler
|
|
94
100
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react from 'react';
|
|
2
2
|
|
|
3
3
|
declare function EnvLoader({ dataKey }: {
|
|
4
4
|
dataKey?: string;
|
|
5
|
-
}):
|
|
5
|
+
}): react.JSX.Element | undefined;
|
|
6
6
|
|
|
7
7
|
export { EnvLoader };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react from 'react';
|
|
2
2
|
|
|
3
3
|
declare function EnvLoader({ dataKey }: {
|
|
4
4
|
dataKey?: string;
|
|
5
|
-
}):
|
|
5
|
+
}): react.JSX.Element | undefined;
|
|
6
6
|
|
|
7
7
|
export { EnvLoader };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react from 'react';
|
|
2
2
|
import { DetailedHTMLProps, InputHTMLAttributes, Ref, ChangeEvent } from 'react';
|
|
3
3
|
|
|
4
4
|
type Props = Omit<DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "onChange"> & {
|
|
@@ -6,6 +6,6 @@ type Props = Omit<DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLI
|
|
|
6
6
|
} & {
|
|
7
7
|
onChange?: (event: ChangeEvent<HTMLInputElement>) => void | Promise<void>;
|
|
8
8
|
};
|
|
9
|
-
declare function FileInput({ buttonRef, className, ref, children, onClick, onChange, ...props }: Props):
|
|
9
|
+
declare function FileInput({ buttonRef, className, ref, children, onClick, onChange, ...props }: Props): react.JSX.Element;
|
|
10
10
|
|
|
11
11
|
export { FileInput };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react from 'react';
|
|
2
2
|
import { DetailedHTMLProps, InputHTMLAttributes, Ref, ChangeEvent } from 'react';
|
|
3
3
|
|
|
4
4
|
type Props = Omit<DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "onChange"> & {
|
|
@@ -6,6 +6,6 @@ type Props = Omit<DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLI
|
|
|
6
6
|
} & {
|
|
7
7
|
onChange?: (event: ChangeEvent<HTMLInputElement>) => void | Promise<void>;
|
|
8
8
|
};
|
|
9
|
-
declare function FileInput({ buttonRef, className, ref, children, onClick, onChange, ...props }: Props):
|
|
9
|
+
declare function FileInput({ buttonRef, className, ref, children, onClick, onChange, ...props }: Props): react.JSX.Element;
|
|
10
10
|
|
|
11
11
|
export { FileInput };
|
package/dist/client/index.d.mts
CHANGED
|
@@ -2,11 +2,4 @@ export { env } from './env.mjs';
|
|
|
2
2
|
export { EnvLoader } from './env_loader.mjs';
|
|
3
3
|
export { FileInput } from './file_input.mjs';
|
|
4
4
|
export { useUserAgent } from './use_user_agent.mjs';
|
|
5
|
-
export { StoreTextEditor } from './store_text_editor.mjs';
|
|
6
|
-
export { createAttachFileOptions } from './editor.mjs';
|
|
7
|
-
import 'react/jsx-runtime';
|
|
8
5
|
import 'react';
|
|
9
|
-
import 'gw-react-text-editor';
|
|
10
|
-
import 'react-store-input';
|
|
11
|
-
import 'gw-file/client';
|
|
12
|
-
import 'gw-file';
|
package/dist/client/index.d.ts
CHANGED
|
@@ -2,11 +2,4 @@ export { env } from './env.js';
|
|
|
2
2
|
export { EnvLoader } from './env_loader.js';
|
|
3
3
|
export { FileInput } from './file_input.js';
|
|
4
4
|
export { useUserAgent } from './use_user_agent.js';
|
|
5
|
-
export { StoreTextEditor } from './store_text_editor.js';
|
|
6
|
-
export { createAttachFileOptions } from './editor.js';
|
|
7
|
-
import 'react/jsx-runtime';
|
|
8
5
|
import 'react';
|
|
9
|
-
import 'gw-react-text-editor';
|
|
10
|
-
import 'react-store-input';
|
|
11
|
-
import 'gw-file/client';
|
|
12
|
-
import 'gw-file';
|
package/dist/client/index.js
CHANGED
|
@@ -22,8 +22,6 @@ var client_exports = {};
|
|
|
22
22
|
__export(client_exports, {
|
|
23
23
|
EnvLoader: () => EnvLoader,
|
|
24
24
|
FileInput: () => FileInput,
|
|
25
|
-
StoreTextEditor: () => StoreTextEditor,
|
|
26
|
-
createAttachFileOptions: () => createAttachFileOptions,
|
|
27
25
|
env: () => env,
|
|
28
26
|
useUserAgent: () => useUserAgent
|
|
29
27
|
});
|
|
@@ -111,125 +109,10 @@ function useUserAgent() {
|
|
|
111
109
|
const isDesktop = !isMobile && !isTablet;
|
|
112
110
|
return { userAgent, isMobile, isTablet, isDesktop };
|
|
113
111
|
}
|
|
114
|
-
|
|
115
|
-
// src/client/store_text_editor.tsx
|
|
116
|
-
var import_gw_react_text_editor = require("gw-react-text-editor");
|
|
117
|
-
var import_react_store_input = require("react-store-input");
|
|
118
|
-
var import_react2 = require("react");
|
|
119
|
-
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
120
|
-
function StoreTextEditor({
|
|
121
|
-
store,
|
|
122
|
-
name,
|
|
123
|
-
getter,
|
|
124
|
-
setter,
|
|
125
|
-
defaultValue,
|
|
126
|
-
ref,
|
|
127
|
-
...props
|
|
128
|
-
}) {
|
|
129
|
-
const controllerRef = (0, import_react2.useRef)(null);
|
|
130
|
-
(0, import_react2.useImperativeHandle)(
|
|
131
|
-
ref,
|
|
132
|
-
() => controllerRef.current,
|
|
133
|
-
[]
|
|
134
|
-
);
|
|
135
|
-
const { dispatch } = (0, import_react_store_input.useStoreController)(store, {
|
|
136
|
-
onSubscribe: (state) => {
|
|
137
|
-
const controller = controllerRef.current;
|
|
138
|
-
if (!controller) {
|
|
139
|
-
return;
|
|
140
|
-
}
|
|
141
|
-
const getResult = () => {
|
|
142
|
-
if (getter) {
|
|
143
|
-
return getter(state) || "";
|
|
144
|
-
}
|
|
145
|
-
if (name) {
|
|
146
|
-
return state[name] || "";
|
|
147
|
-
}
|
|
148
|
-
return "";
|
|
149
|
-
};
|
|
150
|
-
const result = getResult();
|
|
151
|
-
if (controller.value !== result) {
|
|
152
|
-
controller.value = result;
|
|
153
|
-
}
|
|
154
|
-
},
|
|
155
|
-
onDispatch: (state) => {
|
|
156
|
-
const controller = controllerRef.current;
|
|
157
|
-
if (!controller) {
|
|
158
|
-
return;
|
|
159
|
-
}
|
|
160
|
-
if (setter) {
|
|
161
|
-
setter(state, controller.value);
|
|
162
|
-
return;
|
|
163
|
-
}
|
|
164
|
-
if (name) {
|
|
165
|
-
state[name] = controller.value;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
});
|
|
169
|
-
const getDefaultValue = () => {
|
|
170
|
-
if (getter) {
|
|
171
|
-
return getter(store.state);
|
|
172
|
-
}
|
|
173
|
-
if (name) {
|
|
174
|
-
return store.state[name];
|
|
175
|
-
}
|
|
176
|
-
return void 0;
|
|
177
|
-
};
|
|
178
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
179
|
-
import_gw_react_text_editor.TextEditor,
|
|
180
|
-
{
|
|
181
|
-
...props,
|
|
182
|
-
ref: controllerRef,
|
|
183
|
-
defaultValue: defaultValue ?? getDefaultValue(),
|
|
184
|
-
onChange: (e) => {
|
|
185
|
-
dispatch();
|
|
186
|
-
props.onChange?.(e);
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
);
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
// src/client/editor.tsx
|
|
193
|
-
var import_client = require("gw-file/client");
|
|
194
|
-
function createAttachFileOptions({
|
|
195
|
-
cdn,
|
|
196
|
-
fileUploader
|
|
197
|
-
}) {
|
|
198
|
-
return {
|
|
199
|
-
uploadFile: async (file) => {
|
|
200
|
-
const result = await fileUploader.uploadFile(file, {
|
|
201
|
-
convertToWebp: true
|
|
202
|
-
});
|
|
203
|
-
if (result.isErr) {
|
|
204
|
-
throw new Error(result.error.message);
|
|
205
|
-
}
|
|
206
|
-
return {
|
|
207
|
-
alt: file.name,
|
|
208
|
-
src: cdn(result.value.key)
|
|
209
|
-
};
|
|
210
|
-
},
|
|
211
|
-
generateMetadata: (file) => (0, import_client.generateMetadata)(file, {
|
|
212
|
-
uploadBlob: async (blob) => {
|
|
213
|
-
const result = await fileUploader.uploadBlob(blob, "file", {
|
|
214
|
-
convertToWebp: true
|
|
215
|
-
});
|
|
216
|
-
if (result.isErr) {
|
|
217
|
-
throw new Error(result.error.message);
|
|
218
|
-
}
|
|
219
|
-
return {
|
|
220
|
-
alt: file.name,
|
|
221
|
-
src: cdn(result.value.key)
|
|
222
|
-
};
|
|
223
|
-
}
|
|
224
|
-
})
|
|
225
|
-
};
|
|
226
|
-
}
|
|
227
112
|
// Annotate the CommonJS export names for ESM import in node:
|
|
228
113
|
0 && (module.exports = {
|
|
229
114
|
EnvLoader,
|
|
230
115
|
FileInput,
|
|
231
|
-
StoreTextEditor,
|
|
232
|
-
createAttachFileOptions,
|
|
233
116
|
env,
|
|
234
117
|
useUserAgent
|
|
235
118
|
});
|
package/dist/client/index.mjs
CHANGED
|
@@ -82,126 +82,9 @@ function useUserAgent() {
|
|
|
82
82
|
const isDesktop = !isMobile && !isTablet;
|
|
83
83
|
return { userAgent, isMobile, isTablet, isDesktop };
|
|
84
84
|
}
|
|
85
|
-
|
|
86
|
-
// src/client/store_text_editor.tsx
|
|
87
|
-
import {
|
|
88
|
-
TextEditor
|
|
89
|
-
} from "gw-react-text-editor";
|
|
90
|
-
import { useStoreController } from "react-store-input";
|
|
91
|
-
import { useImperativeHandle, useRef as useRef2 } from "react";
|
|
92
|
-
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
93
|
-
function StoreTextEditor({
|
|
94
|
-
store,
|
|
95
|
-
name,
|
|
96
|
-
getter,
|
|
97
|
-
setter,
|
|
98
|
-
defaultValue,
|
|
99
|
-
ref,
|
|
100
|
-
...props
|
|
101
|
-
}) {
|
|
102
|
-
const controllerRef = useRef2(null);
|
|
103
|
-
useImperativeHandle(
|
|
104
|
-
ref,
|
|
105
|
-
() => controllerRef.current,
|
|
106
|
-
[]
|
|
107
|
-
);
|
|
108
|
-
const { dispatch } = useStoreController(store, {
|
|
109
|
-
onSubscribe: (state) => {
|
|
110
|
-
const controller = controllerRef.current;
|
|
111
|
-
if (!controller) {
|
|
112
|
-
return;
|
|
113
|
-
}
|
|
114
|
-
const getResult = () => {
|
|
115
|
-
if (getter) {
|
|
116
|
-
return getter(state) || "";
|
|
117
|
-
}
|
|
118
|
-
if (name) {
|
|
119
|
-
return state[name] || "";
|
|
120
|
-
}
|
|
121
|
-
return "";
|
|
122
|
-
};
|
|
123
|
-
const result = getResult();
|
|
124
|
-
if (controller.value !== result) {
|
|
125
|
-
controller.value = result;
|
|
126
|
-
}
|
|
127
|
-
},
|
|
128
|
-
onDispatch: (state) => {
|
|
129
|
-
const controller = controllerRef.current;
|
|
130
|
-
if (!controller) {
|
|
131
|
-
return;
|
|
132
|
-
}
|
|
133
|
-
if (setter) {
|
|
134
|
-
setter(state, controller.value);
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
if (name) {
|
|
138
|
-
state[name] = controller.value;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
});
|
|
142
|
-
const getDefaultValue = () => {
|
|
143
|
-
if (getter) {
|
|
144
|
-
return getter(store.state);
|
|
145
|
-
}
|
|
146
|
-
if (name) {
|
|
147
|
-
return store.state[name];
|
|
148
|
-
}
|
|
149
|
-
return void 0;
|
|
150
|
-
};
|
|
151
|
-
return /* @__PURE__ */ jsx3(
|
|
152
|
-
TextEditor,
|
|
153
|
-
{
|
|
154
|
-
...props,
|
|
155
|
-
ref: controllerRef,
|
|
156
|
-
defaultValue: defaultValue ?? getDefaultValue(),
|
|
157
|
-
onChange: (e) => {
|
|
158
|
-
dispatch();
|
|
159
|
-
props.onChange?.(e);
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
);
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
// src/client/editor.tsx
|
|
166
|
-
import { generateMetadata } from "gw-file/client";
|
|
167
|
-
function createAttachFileOptions({
|
|
168
|
-
cdn,
|
|
169
|
-
fileUploader
|
|
170
|
-
}) {
|
|
171
|
-
return {
|
|
172
|
-
uploadFile: async (file) => {
|
|
173
|
-
const result = await fileUploader.uploadFile(file, {
|
|
174
|
-
convertToWebp: true
|
|
175
|
-
});
|
|
176
|
-
if (result.isErr) {
|
|
177
|
-
throw new Error(result.error.message);
|
|
178
|
-
}
|
|
179
|
-
return {
|
|
180
|
-
alt: file.name,
|
|
181
|
-
src: cdn(result.value.key)
|
|
182
|
-
};
|
|
183
|
-
},
|
|
184
|
-
generateMetadata: (file) => generateMetadata(file, {
|
|
185
|
-
uploadBlob: async (blob) => {
|
|
186
|
-
const result = await fileUploader.uploadBlob(blob, "file", {
|
|
187
|
-
convertToWebp: true
|
|
188
|
-
});
|
|
189
|
-
if (result.isErr) {
|
|
190
|
-
throw new Error(result.error.message);
|
|
191
|
-
}
|
|
192
|
-
return {
|
|
193
|
-
alt: file.name,
|
|
194
|
-
src: cdn(result.value.key)
|
|
195
|
-
};
|
|
196
|
-
}
|
|
197
|
-
})
|
|
198
|
-
};
|
|
199
|
-
}
|
|
200
85
|
export {
|
|
201
86
|
EnvLoader,
|
|
202
87
|
FileInput,
|
|
203
|
-
StoreTextEditor,
|
|
204
|
-
createAttachFileOptions,
|
|
205
88
|
env,
|
|
206
89
|
useUserAgent
|
|
207
90
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react from 'react';
|
|
2
2
|
import { FC, ReactNode } from 'react';
|
|
3
3
|
|
|
4
4
|
type Props = {
|
|
@@ -7,6 +7,6 @@ type Props = {
|
|
|
7
7
|
actions?: ReactNode;
|
|
8
8
|
}>;
|
|
9
9
|
};
|
|
10
|
-
declare function CrudForm<TModel extends Record<string, unknown>>({ AdminHeader
|
|
10
|
+
declare function CrudForm<TModel extends Record<string, unknown>>({ AdminHeader }: Props): react.JSX.Element;
|
|
11
11
|
|
|
12
12
|
export { CrudForm as default };
|
package/dist/crud/crud_form.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react from 'react';
|
|
2
2
|
import { FC, ReactNode } from 'react';
|
|
3
3
|
|
|
4
4
|
type Props = {
|
|
@@ -7,6 +7,6 @@ type Props = {
|
|
|
7
7
|
actions?: ReactNode;
|
|
8
8
|
}>;
|
|
9
9
|
};
|
|
10
|
-
declare function CrudForm<TModel extends Record<string, unknown>>({ AdminHeader
|
|
10
|
+
declare function CrudForm<TModel extends Record<string, unknown>>({ AdminHeader }: Props): react.JSX.Element;
|
|
11
11
|
|
|
12
12
|
export { CrudForm as default };
|