dn-react-router-toolkit 0.6.6 → 0.6.8
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/client/index.js +22 -10
- package/dist/client/index.mjs +23 -11
- package/dist/client/store_text_editor.d.mts +1 -1
- package/dist/client/store_text_editor.d.ts +1 -1
- package/dist/client/store_text_editor.js +22 -10
- package/dist/client/store_text_editor.mjs +23 -11
- package/dist/crud/crud_form.js +22 -10
- package/dist/crud/crud_form.mjs +23 -11
- package/dist/crud/crud_page.js +22 -10
- package/dist/crud/crud_page.mjs +23 -11
- package/dist/crud/generate_routes.js +7578 -1
- package/dist/crud/generate_routes.mjs +7601 -1
- package/dist/crud/index.js +7611 -22
- package/dist/crud/index.mjs +7624 -12
- package/package.json +4 -4
package/dist/client/index.js
CHANGED
|
@@ -125,29 +125,40 @@ var import_react4 = __toESM(require("react"));
|
|
|
125
125
|
function StoreTextEditor({
|
|
126
126
|
store,
|
|
127
127
|
name,
|
|
128
|
+
getter,
|
|
129
|
+
setter,
|
|
128
130
|
defaultValue,
|
|
129
131
|
...props
|
|
130
132
|
}) {
|
|
133
|
+
const ref = (0, import_react4.useRef)(null);
|
|
131
134
|
const { dispatch } = (0, import_react_store_input.useStoreController)(store, {
|
|
132
|
-
onSubscribe: (state
|
|
133
|
-
const
|
|
134
|
-
if (
|
|
135
|
-
|
|
135
|
+
onSubscribe: (state) => {
|
|
136
|
+
const controller = ref.current;
|
|
137
|
+
if (!controller) {
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
const result = (getter ? getter(state) : name ? state[name] : "") || "";
|
|
141
|
+
if (controller.value !== result) {
|
|
142
|
+
controller.value = result;
|
|
136
143
|
}
|
|
137
144
|
},
|
|
138
|
-
onDispatch: (state
|
|
139
|
-
|
|
140
|
-
|
|
145
|
+
onDispatch: (state) => {
|
|
146
|
+
const controller = ref.current;
|
|
147
|
+
if (!controller) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
if (setter) {
|
|
151
|
+
setter(state, controller.value);
|
|
141
152
|
return;
|
|
142
153
|
}
|
|
143
154
|
if (name) {
|
|
144
|
-
state[name] =
|
|
155
|
+
state[name] = controller.value;
|
|
145
156
|
}
|
|
146
157
|
}
|
|
147
158
|
});
|
|
148
159
|
const getDefaultValue = () => {
|
|
149
|
-
if (
|
|
150
|
-
return
|
|
160
|
+
if (getter) {
|
|
161
|
+
return getter(store.state);
|
|
151
162
|
}
|
|
152
163
|
if (name) {
|
|
153
164
|
return store.state[name];
|
|
@@ -158,6 +169,7 @@ function StoreTextEditor({
|
|
|
158
169
|
import_dn_react_text_editor.TextEditor,
|
|
159
170
|
{
|
|
160
171
|
...props,
|
|
172
|
+
ref,
|
|
161
173
|
defaultValue: defaultValue ?? getDefaultValue(),
|
|
162
174
|
onChange: (e) => {
|
|
163
175
|
dispatch();
|
package/dist/client/index.mjs
CHANGED
|
@@ -83,33 +83,44 @@ import {
|
|
|
83
83
|
TextEditor
|
|
84
84
|
} from "dn-react-text-editor";
|
|
85
85
|
import { useStoreController } from "react-store-input";
|
|
86
|
-
import React3 from "react";
|
|
86
|
+
import React3, { useRef } from "react";
|
|
87
87
|
function StoreTextEditor({
|
|
88
88
|
store,
|
|
89
89
|
name,
|
|
90
|
+
getter,
|
|
91
|
+
setter,
|
|
90
92
|
defaultValue,
|
|
91
93
|
...props
|
|
92
94
|
}) {
|
|
95
|
+
const ref = useRef(null);
|
|
93
96
|
const { dispatch } = useStoreController(store, {
|
|
94
|
-
onSubscribe: (state
|
|
95
|
-
const
|
|
96
|
-
if (
|
|
97
|
-
|
|
97
|
+
onSubscribe: (state) => {
|
|
98
|
+
const controller = ref.current;
|
|
99
|
+
if (!controller) {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
const result = (getter ? getter(state) : name ? state[name] : "") || "";
|
|
103
|
+
if (controller.value !== result) {
|
|
104
|
+
controller.value = result;
|
|
98
105
|
}
|
|
99
106
|
},
|
|
100
|
-
onDispatch: (state
|
|
101
|
-
|
|
102
|
-
|
|
107
|
+
onDispatch: (state) => {
|
|
108
|
+
const controller = ref.current;
|
|
109
|
+
if (!controller) {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
if (setter) {
|
|
113
|
+
setter(state, controller.value);
|
|
103
114
|
return;
|
|
104
115
|
}
|
|
105
116
|
if (name) {
|
|
106
|
-
state[name] =
|
|
117
|
+
state[name] = controller.value;
|
|
107
118
|
}
|
|
108
119
|
}
|
|
109
120
|
});
|
|
110
121
|
const getDefaultValue = () => {
|
|
111
|
-
if (
|
|
112
|
-
return
|
|
122
|
+
if (getter) {
|
|
123
|
+
return getter(store.state);
|
|
113
124
|
}
|
|
114
125
|
if (name) {
|
|
115
126
|
return store.state[name];
|
|
@@ -120,6 +131,7 @@ function StoreTextEditor({
|
|
|
120
131
|
TextEditor,
|
|
121
132
|
{
|
|
122
133
|
...props,
|
|
134
|
+
ref,
|
|
123
135
|
defaultValue: defaultValue ?? getDefaultValue(),
|
|
124
136
|
onChange: (e) => {
|
|
125
137
|
dispatch();
|
|
@@ -8,6 +8,6 @@ type Props<TState> = {
|
|
|
8
8
|
getter?: (state: TState) => string;
|
|
9
9
|
setter?: (state: TState, value: string) => void;
|
|
10
10
|
} & TextEditorProps;
|
|
11
|
-
declare function StoreTextEditor<TState>({ store, name, defaultValue, ...props }: Props<TState>): React__default.JSX.Element;
|
|
11
|
+
declare function StoreTextEditor<TState>({ store, name, getter, setter, defaultValue, ...props }: Props<TState>): React__default.JSX.Element;
|
|
12
12
|
|
|
13
13
|
export { StoreTextEditor };
|
|
@@ -8,6 +8,6 @@ type Props<TState> = {
|
|
|
8
8
|
getter?: (state: TState) => string;
|
|
9
9
|
setter?: (state: TState, value: string) => void;
|
|
10
10
|
} & TextEditorProps;
|
|
11
|
-
declare function StoreTextEditor<TState>({ store, name, defaultValue, ...props }: Props<TState>): React__default.JSX.Element;
|
|
11
|
+
declare function StoreTextEditor<TState>({ store, name, getter, setter, defaultValue, ...props }: Props<TState>): React__default.JSX.Element;
|
|
12
12
|
|
|
13
13
|
export { StoreTextEditor };
|
|
@@ -39,29 +39,40 @@ var import_react = __toESM(require("react"));
|
|
|
39
39
|
function StoreTextEditor({
|
|
40
40
|
store,
|
|
41
41
|
name,
|
|
42
|
+
getter,
|
|
43
|
+
setter,
|
|
42
44
|
defaultValue,
|
|
43
45
|
...props
|
|
44
46
|
}) {
|
|
47
|
+
const ref = (0, import_react.useRef)(null);
|
|
45
48
|
const { dispatch } = (0, import_react_store_input.useStoreController)(store, {
|
|
46
|
-
onSubscribe: (state
|
|
47
|
-
const
|
|
48
|
-
if (
|
|
49
|
-
|
|
49
|
+
onSubscribe: (state) => {
|
|
50
|
+
const controller = ref.current;
|
|
51
|
+
if (!controller) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
const result = (getter ? getter(state) : name ? state[name] : "") || "";
|
|
55
|
+
if (controller.value !== result) {
|
|
56
|
+
controller.value = result;
|
|
50
57
|
}
|
|
51
58
|
},
|
|
52
|
-
onDispatch: (state
|
|
53
|
-
|
|
54
|
-
|
|
59
|
+
onDispatch: (state) => {
|
|
60
|
+
const controller = ref.current;
|
|
61
|
+
if (!controller) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
if (setter) {
|
|
65
|
+
setter(state, controller.value);
|
|
55
66
|
return;
|
|
56
67
|
}
|
|
57
68
|
if (name) {
|
|
58
|
-
state[name] =
|
|
69
|
+
state[name] = controller.value;
|
|
59
70
|
}
|
|
60
71
|
}
|
|
61
72
|
});
|
|
62
73
|
const getDefaultValue = () => {
|
|
63
|
-
if (
|
|
64
|
-
return
|
|
74
|
+
if (getter) {
|
|
75
|
+
return getter(store.state);
|
|
65
76
|
}
|
|
66
77
|
if (name) {
|
|
67
78
|
return store.state[name];
|
|
@@ -72,6 +83,7 @@ function StoreTextEditor({
|
|
|
72
83
|
import_dn_react_text_editor.TextEditor,
|
|
73
84
|
{
|
|
74
85
|
...props,
|
|
86
|
+
ref,
|
|
75
87
|
defaultValue: defaultValue ?? getDefaultValue(),
|
|
76
88
|
onChange: (e) => {
|
|
77
89
|
dispatch();
|
|
@@ -3,33 +3,44 @@ import {
|
|
|
3
3
|
TextEditor
|
|
4
4
|
} from "dn-react-text-editor";
|
|
5
5
|
import { useStoreController } from "react-store-input";
|
|
6
|
-
import React from "react";
|
|
6
|
+
import React, { useRef } from "react";
|
|
7
7
|
function StoreTextEditor({
|
|
8
8
|
store,
|
|
9
9
|
name,
|
|
10
|
+
getter,
|
|
11
|
+
setter,
|
|
10
12
|
defaultValue,
|
|
11
13
|
...props
|
|
12
14
|
}) {
|
|
15
|
+
const ref = useRef(null);
|
|
13
16
|
const { dispatch } = useStoreController(store, {
|
|
14
|
-
onSubscribe: (state
|
|
15
|
-
const
|
|
16
|
-
if (
|
|
17
|
-
|
|
17
|
+
onSubscribe: (state) => {
|
|
18
|
+
const controller = ref.current;
|
|
19
|
+
if (!controller) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
const result = (getter ? getter(state) : name ? state[name] : "") || "";
|
|
23
|
+
if (controller.value !== result) {
|
|
24
|
+
controller.value = result;
|
|
18
25
|
}
|
|
19
26
|
},
|
|
20
|
-
onDispatch: (state
|
|
21
|
-
|
|
22
|
-
|
|
27
|
+
onDispatch: (state) => {
|
|
28
|
+
const controller = ref.current;
|
|
29
|
+
if (!controller) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
if (setter) {
|
|
33
|
+
setter(state, controller.value);
|
|
23
34
|
return;
|
|
24
35
|
}
|
|
25
36
|
if (name) {
|
|
26
|
-
state[name] =
|
|
37
|
+
state[name] = controller.value;
|
|
27
38
|
}
|
|
28
39
|
}
|
|
29
40
|
});
|
|
30
41
|
const getDefaultValue = () => {
|
|
31
|
-
if (
|
|
32
|
-
return
|
|
42
|
+
if (getter) {
|
|
43
|
+
return getter(store.state);
|
|
33
44
|
}
|
|
34
45
|
if (name) {
|
|
35
46
|
return store.state[name];
|
|
@@ -40,6 +51,7 @@ function StoreTextEditor({
|
|
|
40
51
|
TextEditor,
|
|
41
52
|
{
|
|
42
53
|
...props,
|
|
54
|
+
ref,
|
|
43
55
|
defaultValue: defaultValue ?? getDefaultValue(),
|
|
44
56
|
onChange: (e) => {
|
|
45
57
|
dispatch();
|
package/dist/crud/crud_form.js
CHANGED
|
@@ -89,29 +89,40 @@ var import_react7 = __toESM(require("react"));
|
|
|
89
89
|
function StoreTextEditor({
|
|
90
90
|
store,
|
|
91
91
|
name,
|
|
92
|
+
getter,
|
|
93
|
+
setter,
|
|
92
94
|
defaultValue,
|
|
93
95
|
...props
|
|
94
96
|
}) {
|
|
97
|
+
const ref = (0, import_react7.useRef)(null);
|
|
95
98
|
const { dispatch } = (0, import_react_store_input2.useStoreController)(store, {
|
|
96
|
-
onSubscribe: (state
|
|
97
|
-
const
|
|
98
|
-
if (
|
|
99
|
-
|
|
99
|
+
onSubscribe: (state) => {
|
|
100
|
+
const controller = ref.current;
|
|
101
|
+
if (!controller) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
const result = (getter ? getter(state) : name ? state[name] : "") || "";
|
|
105
|
+
if (controller.value !== result) {
|
|
106
|
+
controller.value = result;
|
|
100
107
|
}
|
|
101
108
|
},
|
|
102
|
-
onDispatch: (state
|
|
103
|
-
|
|
104
|
-
|
|
109
|
+
onDispatch: (state) => {
|
|
110
|
+
const controller = ref.current;
|
|
111
|
+
if (!controller) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
if (setter) {
|
|
115
|
+
setter(state, controller.value);
|
|
105
116
|
return;
|
|
106
117
|
}
|
|
107
118
|
if (name) {
|
|
108
|
-
state[name] =
|
|
119
|
+
state[name] = controller.value;
|
|
109
120
|
}
|
|
110
121
|
}
|
|
111
122
|
});
|
|
112
123
|
const getDefaultValue = () => {
|
|
113
|
-
if (
|
|
114
|
-
return
|
|
124
|
+
if (getter) {
|
|
125
|
+
return getter(store.state);
|
|
115
126
|
}
|
|
116
127
|
if (name) {
|
|
117
128
|
return store.state[name];
|
|
@@ -122,6 +133,7 @@ function StoreTextEditor({
|
|
|
122
133
|
import_dn_react_text_editor.TextEditor,
|
|
123
134
|
{
|
|
124
135
|
...props,
|
|
136
|
+
ref,
|
|
125
137
|
defaultValue: defaultValue ?? getDefaultValue(),
|
|
126
138
|
onChange: (e) => {
|
|
127
139
|
dispatch();
|
package/dist/crud/crud_form.mjs
CHANGED
|
@@ -51,33 +51,44 @@ import {
|
|
|
51
51
|
TextEditor
|
|
52
52
|
} from "dn-react-text-editor";
|
|
53
53
|
import { useStoreController } from "react-store-input";
|
|
54
|
-
import React5 from "react";
|
|
54
|
+
import React5, { useRef } from "react";
|
|
55
55
|
function StoreTextEditor({
|
|
56
56
|
store,
|
|
57
57
|
name,
|
|
58
|
+
getter,
|
|
59
|
+
setter,
|
|
58
60
|
defaultValue,
|
|
59
61
|
...props
|
|
60
62
|
}) {
|
|
63
|
+
const ref = useRef(null);
|
|
61
64
|
const { dispatch } = useStoreController(store, {
|
|
62
|
-
onSubscribe: (state
|
|
63
|
-
const
|
|
64
|
-
if (
|
|
65
|
-
|
|
65
|
+
onSubscribe: (state) => {
|
|
66
|
+
const controller = ref.current;
|
|
67
|
+
if (!controller) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
const result = (getter ? getter(state) : name ? state[name] : "") || "";
|
|
71
|
+
if (controller.value !== result) {
|
|
72
|
+
controller.value = result;
|
|
66
73
|
}
|
|
67
74
|
},
|
|
68
|
-
onDispatch: (state
|
|
69
|
-
|
|
70
|
-
|
|
75
|
+
onDispatch: (state) => {
|
|
76
|
+
const controller = ref.current;
|
|
77
|
+
if (!controller) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
if (setter) {
|
|
81
|
+
setter(state, controller.value);
|
|
71
82
|
return;
|
|
72
83
|
}
|
|
73
84
|
if (name) {
|
|
74
|
-
state[name] =
|
|
85
|
+
state[name] = controller.value;
|
|
75
86
|
}
|
|
76
87
|
}
|
|
77
88
|
});
|
|
78
89
|
const getDefaultValue = () => {
|
|
79
|
-
if (
|
|
80
|
-
return
|
|
90
|
+
if (getter) {
|
|
91
|
+
return getter(store.state);
|
|
81
92
|
}
|
|
82
93
|
if (name) {
|
|
83
94
|
return store.state[name];
|
|
@@ -88,6 +99,7 @@ function StoreTextEditor({
|
|
|
88
99
|
TextEditor,
|
|
89
100
|
{
|
|
90
101
|
...props,
|
|
102
|
+
ref,
|
|
91
103
|
defaultValue: defaultValue ?? getDefaultValue(),
|
|
92
104
|
onChange: (e) => {
|
|
93
105
|
dispatch();
|
package/dist/crud/crud_page.js
CHANGED
|
@@ -630,29 +630,40 @@ var import_react12 = __toESM(require("react"));
|
|
|
630
630
|
function StoreTextEditor({
|
|
631
631
|
store,
|
|
632
632
|
name,
|
|
633
|
+
getter,
|
|
634
|
+
setter,
|
|
633
635
|
defaultValue,
|
|
634
636
|
...props
|
|
635
637
|
}) {
|
|
638
|
+
const ref = (0, import_react12.useRef)(null);
|
|
636
639
|
const { dispatch } = (0, import_react_store_input2.useStoreController)(store, {
|
|
637
|
-
onSubscribe: (state
|
|
638
|
-
const
|
|
639
|
-
if (
|
|
640
|
-
|
|
640
|
+
onSubscribe: (state) => {
|
|
641
|
+
const controller = ref.current;
|
|
642
|
+
if (!controller) {
|
|
643
|
+
return;
|
|
644
|
+
}
|
|
645
|
+
const result = (getter ? getter(state) : name ? state[name] : "") || "";
|
|
646
|
+
if (controller.value !== result) {
|
|
647
|
+
controller.value = result;
|
|
641
648
|
}
|
|
642
649
|
},
|
|
643
|
-
onDispatch: (state
|
|
644
|
-
|
|
645
|
-
|
|
650
|
+
onDispatch: (state) => {
|
|
651
|
+
const controller = ref.current;
|
|
652
|
+
if (!controller) {
|
|
653
|
+
return;
|
|
654
|
+
}
|
|
655
|
+
if (setter) {
|
|
656
|
+
setter(state, controller.value);
|
|
646
657
|
return;
|
|
647
658
|
}
|
|
648
659
|
if (name) {
|
|
649
|
-
state[name] =
|
|
660
|
+
state[name] = controller.value;
|
|
650
661
|
}
|
|
651
662
|
}
|
|
652
663
|
});
|
|
653
664
|
const getDefaultValue = () => {
|
|
654
|
-
if (
|
|
655
|
-
return
|
|
665
|
+
if (getter) {
|
|
666
|
+
return getter(store.state);
|
|
656
667
|
}
|
|
657
668
|
if (name) {
|
|
658
669
|
return store.state[name];
|
|
@@ -663,6 +674,7 @@ function StoreTextEditor({
|
|
|
663
674
|
import_dn_react_text_editor.TextEditor,
|
|
664
675
|
{
|
|
665
676
|
...props,
|
|
677
|
+
ref,
|
|
666
678
|
defaultValue: defaultValue ?? getDefaultValue(),
|
|
667
679
|
onChange: (e) => {
|
|
668
680
|
dispatch();
|
package/dist/crud/crud_page.mjs
CHANGED
|
@@ -600,33 +600,44 @@ import {
|
|
|
600
600
|
TextEditor
|
|
601
601
|
} from "dn-react-text-editor";
|
|
602
602
|
import { useStoreController } from "react-store-input";
|
|
603
|
-
import React10 from "react";
|
|
603
|
+
import React10, { useRef } from "react";
|
|
604
604
|
function StoreTextEditor({
|
|
605
605
|
store,
|
|
606
606
|
name,
|
|
607
|
+
getter,
|
|
608
|
+
setter,
|
|
607
609
|
defaultValue,
|
|
608
610
|
...props
|
|
609
611
|
}) {
|
|
612
|
+
const ref = useRef(null);
|
|
610
613
|
const { dispatch } = useStoreController(store, {
|
|
611
|
-
onSubscribe: (state
|
|
612
|
-
const
|
|
613
|
-
if (
|
|
614
|
-
|
|
614
|
+
onSubscribe: (state) => {
|
|
615
|
+
const controller = ref.current;
|
|
616
|
+
if (!controller) {
|
|
617
|
+
return;
|
|
618
|
+
}
|
|
619
|
+
const result = (getter ? getter(state) : name ? state[name] : "") || "";
|
|
620
|
+
if (controller.value !== result) {
|
|
621
|
+
controller.value = result;
|
|
615
622
|
}
|
|
616
623
|
},
|
|
617
|
-
onDispatch: (state
|
|
618
|
-
|
|
619
|
-
|
|
624
|
+
onDispatch: (state) => {
|
|
625
|
+
const controller = ref.current;
|
|
626
|
+
if (!controller) {
|
|
627
|
+
return;
|
|
628
|
+
}
|
|
629
|
+
if (setter) {
|
|
630
|
+
setter(state, controller.value);
|
|
620
631
|
return;
|
|
621
632
|
}
|
|
622
633
|
if (name) {
|
|
623
|
-
state[name] =
|
|
634
|
+
state[name] = controller.value;
|
|
624
635
|
}
|
|
625
636
|
}
|
|
626
637
|
});
|
|
627
638
|
const getDefaultValue = () => {
|
|
628
|
-
if (
|
|
629
|
-
return
|
|
639
|
+
if (getter) {
|
|
640
|
+
return getter(store.state);
|
|
630
641
|
}
|
|
631
642
|
if (name) {
|
|
632
643
|
return store.state[name];
|
|
@@ -637,6 +648,7 @@ function StoreTextEditor({
|
|
|
637
648
|
TextEditor,
|
|
638
649
|
{
|
|
639
650
|
...props,
|
|
651
|
+
ref,
|
|
640
652
|
defaultValue: defaultValue ?? getDefaultValue(),
|
|
641
653
|
onChange: (e) => {
|
|
642
654
|
dispatch();
|