foobara-typescript-react-command-form-generator 0.0.11 → 0.0.13
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/src/typescript_react_command_form_generator.rb +20 -8
- data/templates/CommandForm.tsx.erb +1 -0
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 467c16c27b86a4c0aede45050097f8cd67737b3276ff03dd3d303d760ba314ee
|
4
|
+
data.tar.gz: f886f32ce4b8ce156082fcb46a904e55357d68b487b56625845491c248f136b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d2f7a25c256ef1c9a715de4f50b1b43408ad2f646a58a56453f07d943d4b52a5077cde055d916e72b06027c413cf1db1cbdcde27f049ed11ad270d107c9710d4
|
7
|
+
data.tar.gz: b6715c387a8a59b4ef8d3d3a2e943b122bdf4725af8b1909da152223fa61bb834e43a8cacddfd64ab1692573f94553c8255eb391f45bb36abf955d767271d809
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
## [0.0.13] - 2025-08-05
|
2
|
+
|
3
|
+
- Properly cast values passed to set<State> functions
|
4
|
+
- Properly build forms for detached entities as if they were proper entities
|
5
|
+
|
6
|
+
## [0.0.12] - 2025-04-15
|
7
|
+
|
8
|
+
- Fix non-camelized get/set useState names for nested types
|
9
|
+
- Do not include Model/Entity classes in inputs types to simplify things for now
|
10
|
+
|
1
11
|
## [0.0.11] - 2025-04-08
|
2
12
|
|
3
13
|
- Print out stringified errors for unexpected errors
|
@@ -35,12 +35,20 @@ module Foobara
|
|
35
35
|
def type_generators(type_declaration = inputs_type, initial = true)
|
36
36
|
return @type_generators if defined?(@type_generators)
|
37
37
|
|
38
|
-
generators = if type_declaration.
|
39
|
-
|
40
|
-
|
38
|
+
generators = if type_declaration.detached_entity?
|
39
|
+
# For now, we'll not bother with entity/model classes in the inputs.
|
40
|
+
# This simplifies things a bit re: form generation and setting UI
|
41
|
+
# inputs into the inputs value.
|
42
|
+
# TODO: test this path or delete it if unreachable!
|
43
|
+
# :nocov:
|
44
|
+
type_generators(type_declaration.to_type.primary_key_type, false)
|
45
|
+
# :nocov:
|
46
|
+
# generator_class = RemoteGenerator::Services::UnloadedEntityGenerator
|
47
|
+
# [generator_class.new(type_declaration.to_entity)]
|
41
48
|
elsif type_declaration.model?
|
42
|
-
|
43
|
-
|
49
|
+
type_generators(type_declaration.to_type.attributes_type, false)
|
50
|
+
# generator_class = RemoteGenerator::Services::AtomModelGenerator
|
51
|
+
# [generator_class.new(type_declaration.to_model)]
|
44
52
|
elsif type_declaration.type.to_sym == :attributes
|
45
53
|
type_declaration.attribute_declarations.values.map do |attribute_declaration|
|
46
54
|
type_generators(attribute_declaration, false)
|
@@ -102,9 +110,12 @@ module Foobara
|
|
102
110
|
type_declaration.attribute_declarations.each_pair do |attribute_name, attribute_declaration|
|
103
111
|
non_colliding_inputs(attribute_declaration, result, [*path, attribute_name])
|
104
112
|
end
|
105
|
-
elsif type_declaration.
|
113
|
+
elsif type_declaration.detached_entity?
|
106
114
|
# TODO: figure out how to not pass self here...
|
115
|
+
# TODO: test this path or delete it if unreachable!
|
116
|
+
# :nocov:
|
107
117
|
result << FlattenedAttribute.new(self, path, type_declaration.to_type.primary_key_type)
|
118
|
+
# :nocov:
|
108
119
|
elsif type_declaration.model?
|
109
120
|
non_colliding_inputs(type_declaration.to_type.attributes_type, result, path)
|
110
121
|
elsif type_declaration.array?
|
@@ -198,7 +209,7 @@ module Foobara
|
|
198
209
|
first, *rest = path
|
199
210
|
|
200
211
|
first = Util.camelize(first)
|
201
|
-
rest = rest.map { |part| Util.
|
212
|
+
rest = rest.map { |part| Util.classify(part) }
|
202
213
|
|
203
214
|
[first, *rest].join
|
204
215
|
end
|
@@ -252,7 +263,8 @@ module Foobara
|
|
252
263
|
"parseFloat(e.target.value)"
|
253
264
|
# :nocov:
|
254
265
|
else
|
255
|
-
|
266
|
+
ts_type = generator.foobara_type_to_ts_type(type_declaration)
|
267
|
+
"e.target.value as #{ts_type}"
|
256
268
|
end
|
257
269
|
|
258
270
|
"<input
|
@@ -6,6 +6,7 @@ import { <%= command_name %> } from "<%= path_to_root %><%= command_generator.im
|
|
6
6
|
<% unless empty_inputs? %>
|
7
7
|
import <%= inputs_class_name %> from "<%= path_to_root %><%= command_generator.import_path %>/Inputs"
|
8
8
|
<% end %>
|
9
|
+
<%# TODO: why isn't the result type handled via dependency_roots to avoid collisions with other types? %>
|
9
10
|
import <%= result_class_name %> from "<%= path_to_root %><%= command_generator.import_path %>/Result"
|
10
11
|
import { Error as <%= error_class_name %> } from "<%= path_to_root %><%= command_generator.import_path %>/Errors"
|
11
12
|
|
metadata
CHANGED
@@ -1,28 +1,28 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foobara-typescript-react-command-form-generator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miles Georgi
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: foobara-typescript-remote-command-generator
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
15
15
|
requirements:
|
16
|
-
- - "
|
16
|
+
- - "<"
|
17
17
|
- !ruby/object:Gem::Version
|
18
|
-
version: 0.0
|
18
|
+
version: 2.0.0
|
19
19
|
type: :runtime
|
20
20
|
prerelease: false
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
22
22
|
requirements:
|
23
|
-
- - "
|
23
|
+
- - "<"
|
24
24
|
- !ruby/object:Gem::Version
|
25
|
-
version: 0.0
|
25
|
+
version: 2.0.0
|
26
26
|
email:
|
27
27
|
- azimux@gmail.com
|
28
28
|
executables: []
|
@@ -60,7 +60,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
requirements: []
|
63
|
-
rubygems_version: 3.6.
|
63
|
+
rubygems_version: 3.6.9
|
64
64
|
specification_version: 4
|
65
65
|
summary: Generates Typescript React forms for Foobara remote commands
|
66
66
|
test_files: []
|