@@ -80,6 +80,7 @@ public function truncate(int $size = 20, $popOver = null)
8080
8181 public function toArray (): array
8282 {
83+ $ this ->solveType ();
8384 $ this ->solveSearchable ();
8485 $ this ->solveQuickEdit ();
8586
@@ -101,6 +102,16 @@ public function __call($name, $arguments)
101102 return $ this ;
102103 }
103104
105+ protected function solveType ()
106+ {
107+ $ type = $ this ->schema ['type ' ];
108+ if ($ type === 'mapping ' ) {
109+ if (isset ($ this ->schema ['map ' ])) {
110+ $ this ->schema ['map ' ] = (object )$ this ->schema ['map ' ]; // 0 1 会被转为数组的形式,amis 下需要使用 object,所以强制为 object
111+ }
112+ }
113+ }
114+
104115 protected function solveSearchable ()
105116 {
106117 $ searchable = $ this ->schema ['searchable ' ] ?? false ;
@@ -128,8 +139,8 @@ protected function solveSearchable()
128139 'label ' => strip_tags ($ label ),
129140 'value ' => $ value ,
130141 ],
131- array_values ($ this ->schema ['map ' ]),
132- array_keys ($ this ->schema ['map ' ])
142+ array_values (( array ) $ this ->schema ['map ' ]),
143+ array_keys (( array ) $ this ->schema ['map ' ])
133144 );
134145 }
135146 } elseif ($ type === 'date ' || $ type === 'datetime ' ) {
@@ -156,8 +167,8 @@ protected function solveQuickEdit()
156167 'label ' => strip_tags ($ label ),
157168 'value ' => $ value ,
158169 ],
159- array_values ($ this ->schema ['map ' ]),
160- array_keys ($ this ->schema ['map ' ])
170+ array_values (( array ) $ this ->schema ['map ' ]),
171+ array_keys (( array ) $ this ->schema ['map ' ])
161172 );
162173 }
163174 }
0 commit comments