Yanzhen Yu
ef2669992f
perf(runtime): implement slot receiver to avoid of re-render when passing fallback elements
...
The slot receiver is a magic hole of sunmao's runtime.
In sunmao, we support pass props and fallback elements to a slot.
But if we pass them as React component's props,
it will cause re-render since most of them could not use a shallow equal checker.
Also, in sunmao's runtime, we are not using a traditional React render mechanism.
Instead, we keep most of the components not be rendered and only subscribe to related state updates.
To continue with our design,
we need a way to render slot's fallback elements without passing the elements as props.
This is where the slot receiver comes.
It contains a map and an event emitter, when a slot need render,
it will attach the fallback elements to the map and send a signal via the emitter.
When the Receiver component receive a signal, it will force render the fallback elements.
related: #388
2022-08-23 10:28:06 +08:00
Yanzhen Yu
b5df69f21c
perf(runtime): refactor the slot's props and fallback implementation
...
The main idea of this patch is to set slot props to a reactive store
instead of passing them as React props to the slot children elements.
Same as other state management in sunmao, the component will subscribe
to the slot store to get the latest value of slot props.
Same as component id, we need a way to identify every slot props in the store.
So we add a new parameter key to the `getSlot` function,
where [component id, slot name, key] will be a unique identifier.
Another challenge is to subscribe the slot store in a efficient way.
Currently we are using vue's reactivity system, which need set `deep: true`
to observe multiple value during effect.
By setting `deep: true`, if we write code like `const $slot = slotStore[slotKey]`,
it will subscribe all the sub-fields of this slot key be cause we 'access' the property.
The solution is to implement a redirector Proxy.
With the redirector, expression `$slot.a.b` will be redirect to `slotStore[slotKey].a.b`.
related to: #388
2022-08-23 10:26:18 +08:00
xzdry
cd71cf74d2
fix(SpaceWidget): fix padding display misalignment
2022-08-17 17:50:40 +08:00
MrWindlike
a3f0c24e48
fix: fix selecting component would change the properties' values issue
2022-08-17 10:09:24 +08:00
tanbowensg
87074162c9
Merge pull request #568 from smartxworks/fix/windlike-dev
...
fix: fix the `exampleProperties` type errors
2022-08-16 15:39:06 +08:00
MrWindlike
c718e0ca22
refactor: remove the shared package from core
2022-08-16 14:53:41 +08:00
MrWindlike
5216fd1e3c
fix: fix the exampleProperties
type errors
2022-08-16 11:52:16 +08:00
Bowen Tan
789058e1e3
refactor(runtime): remove full import of lodash
2022-08-15 18:30:04 +08:00
MrWindlike
08bec57287
fix: fix clicking outside can't close the popover widget
...
when clicking the outside node which would stop propagation, it can't close the popover widget
2022-08-11 10:28:00 +08:00
tanbowensg
dc9c921838
Merge pull request #565 from smartxworks/arco/select
...
feat(Select): add title to select option
2022-08-10 10:33:59 +08:00
yz-yu
97ee05f0fd
Merge pull request #566 from smartxworks/fix/windlike-dev
...
fix(PopoverWidget): compatible with the React 16
2022-08-09 09:50:51 +08:00
MrWindlike
01b1ba14d4
fix(PopoverWidget): compatible with the React 16
2022-08-09 09:31:52 +08:00
yz-yu
9e80727540
Merge pull request #564 from smartxworks/fix/mask
...
fix(mask): fix wrong mask position
2022-08-08 21:59:17 +08:00
tanbowensg
15c9176f68
Merge pull request #559 from smartxworks/fix/expression-problems
...
Refactor some expressions logics
2022-08-08 18:01:35 +08:00
xzdry
55dd952d0e
feat(Select): add title to select option
2022-08-08 17:56:17 +08:00
Bowen Tan
41c0d0e7ae
fix(mask): fix wrong mask position
2022-08-08 14:37:01 +08:00
yz-yu
6304215a8b
Merge pull request #560 from smartxworks/fix/mask-container-resize
...
observe mask container resize
2022-08-04 18:58:47 +08:00
Bowen Tan
7b47bbe475
fix(mask): observe mask container resize
...
Mask container size will change when left panel resizes.
So when it happens, the maskContainerRect needs to update.
2022-08-04 14:12:50 +08:00
yz-yu
d1a147f118
Merge pull request #552 from smartxworks/feat/windlike-dev
...
feat(RecordWidget): allow use the widget for object
2022-08-03 08:29:41 +08:00
Bowen Tan
28e0a752e0
fix(stateManager): don't console.error expression errors by default
2022-08-02 17:39:39 +08:00
Bowen Tan
f7a68d2447
feat(booleanWidget): auto convert non-boolean value to boolean
2022-08-02 17:38:18 +08:00
Bowen Tan
efe6865ecc
feat(numberWidget): auto convert non-number value to number
2022-08-02 17:38:18 +08:00
Bowen Tan
2e1f012698
feat(expressionWidget): don't auto convert string to other type
2022-08-02 17:38:18 +08:00
Bowen Tan
8bab7855a9
feat(stateManager): don't auto convert string to number or boolean
2022-08-02 17:38:18 +08:00
Bowen Tan
59e1147277
feat(ArrayWidget): arrayWidget will try to eval value before render it
2022-08-02 17:38:18 +08:00
yz-yu
7e214cafea
Merge pull request #558 from smartxworks/fix/toraw
...
fix(stateManager): add toRaw in maskEval
2022-08-02 14:29:11 +08:00
Bowen Tan
f9ee4136b2
fix(stateManager): add toRaw in maskEval
...
move toRaw logic to maskEval to make sure component will not receive Proxy
2022-08-02 13:50:59 +08:00
tanbowensg
d88b38744a
Merge pull request #555 from FriedRiceNoodles/fix/chakra-checkbox-mask
...
fix(editor): fix a bug which will cause the mask of chakra-ui/checkbo…
2022-08-02 13:49:34 +08:00
炒米粉
2c18a9820a
fix(editor): add a dependency array on a effect hook
2022-08-02 12:35:54 +08:00
BugMaker.Huang
94bf9a393b
fix(editor-sdk): remove a wrong attribute
2022-08-01 21:06:43 +08:00
BugMaker.Huang
20b52c74bb
fix(editor): fix the bug of chakra/checkbox with correct way
2022-08-01 19:52:26 +08:00
tanbowensg
158613d97e
Merge pull request #542 from smartxworks/fix/scroll
...
fix(structureTree): if a component item is already in viewport, then don't scroll it into view
2022-08-01 14:05:06 +08:00
MrWindlike
0bce0e9bb9
feat: watch the expression string change
2022-08-01 13:33:05 +08:00
MrWindlike
9d4b93412a
refactor: let the \deepEval\
support eval the expression string
2022-08-01 08:57:42 +08:00
BugMaker.Huang
86205162fb
fix(editor): fix a bug which will cause the mask of chakra-ui/checkbox render incorrectly
2022-07-29 18:24:03 +08:00
Bowen Tan
499a1ee3e3
fix(validator): ignore error if event trait parameter is expression
2022-07-29 17:25:42 +08:00
Bowen Tan
81028bbf42
fix(validator): don't count keys of array destructuring assignment in property refs
2022-07-29 16:52:08 +08:00
Bowen Tan
a1c2730fc5
fix(validator): don't count keys of object destructuring assignment in property refs
2022-07-29 16:13:48 +08:00
Bowen Tan
65f400863b
fix(validator): fieldModel should not count object keys in property ref
2022-07-29 14:56:35 +08:00
Bowen Tan
8f53cd83c1
fix(validator): fix the bug that property reference is wrong in complex expression
2022-07-29 11:11:51 +08:00
MrWindlike
0b11b9fe30
feat(RecordWidget): allow use the widget for object
2022-07-29 10:22:22 +08:00
tanbowensg
30d335040e
Merge pull request #550 from FriedRiceNoodles/chore/comments
...
chore(validator): comment out a log-line
2022-07-28 16:44:35 +08:00
炒米粉
14ac195f37
chore(validator): remove a log-line
2022-07-28 11:19:00 +08:00
yz-yu
b4eba0e5aa
Merge pull request #548 from smartxworks/chore/export
...
chore: reexport the shared package by runtime
2022-07-28 07:27:30 +08:00
炒米粉
c20a02ed61
chore(validator): comment out a log-line
2022-07-28 01:54:59 +08:00
yz-yu
e0bb00c7f4
Merge pull request #549 from smartxworks/fix/type-bug
...
fix(editor): import chakra arco widgets correctly
2022-07-27 18:12:59 +08:00
yz-yu
95da710e0a
Merge pull request #546 from smartxworks/fix/validators-bugs-2
...
Fix some validator bugs
2022-07-27 18:11:19 +08:00
Bowen Tan
d9671e6515
fix(validator): if a object json schema does not have specific properties, treat it as any type
2022-07-27 17:58:40 +08:00
Bowen Tan
85d653381f
fix(validator): validator will crash when it fails to find util method
2022-07-27 17:37:03 +08:00
Bowen Tan
cf62b867ba
fix(validator): allow using question mask in expression
2022-07-27 17:13:33 +08:00