Skip to content

Commit

Permalink
$mol_select_list, review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
zerkalica committed Sep 29, 2023
1 parent 1454905 commit 9faa4ec
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion check/list/list.view.tree
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$mol_check_list $mol_view
options_checked *
dictionary_checked *
Option* $mol_check
checked? <=> option_checked*? false
label <= option_label* /
Expand Down
8 changes: 4 additions & 4 deletions check/list/list.view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ namespace $.$$ {
return {}
}

override options_checked(next?: Record<string, boolean>) {
override dictionary_checked(next?: Record<string, boolean>) {
return next ?? {}
}

override option_checked(id: string, next?: boolean | null) {
const prev = this.options_checked()
if (next === undefined) return prev[id]
const prev = this.dictionary_checked()
if (next === undefined) return prev[id] ?? null

const next_rec = { ... prev, [id]: next } as Record<string, boolean>
if (next === null) delete next_rec[id]

return this.options_checked(next_rec)[id]
return this.dictionary_checked(next_rec)[id] ?? null
}

@ $mol_mem
Expand Down
6 changes: 3 additions & 3 deletions form/draft/demo/demo.view.tree
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ $mol_form_draft_demo $mol_example
submit? => publish?
submit_allowed => publish_allowed
value_str*? => value_str*?
value_arr_str*? => value_arr_str*?
list_string*? => list_string*?
value_rec_bool*? => value_rec_bool*?
changed => changed
form_fields /
Expand Down Expand Up @@ -61,7 +61,7 @@ $mol_form_draft_demo $mol_example
<= Hobbies_field $mol_form_field
name \Hobbies
Content <= Hobbies $mol_check_list
options_checked? <=> value_rec_bool*hobbies?
dictionary_checked? <=> value_rec_bool*hobbies?
options *
programming \Programming
bikinkg \Biking
Expand All @@ -78,7 +78,7 @@ $mol_form_draft_demo $mol_example
freeze \Mister Freeze
clay \Clayface
mask \Black Mask
value? <=> value_arr_str*friends?
value? <=> list_string*friends?
body <= form_body /
<= Title_field
<= Config $mol_form_group sub /
Expand Down
2 changes: 1 addition & 1 deletion form/draft/draft.view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ namespace $.$$ {
*/
export class $mol_form_draft extends $.$mol_form_draft {
@ $mol_mem_key
value_arr_str( field: string, next? : readonly string[] | null ) {
list_string( field: string, next? : readonly string[] | null ) {
return this.value( field, next )?.map(norm_string) ?? []
}

Expand Down

0 comments on commit 9faa4ec

Please sign in to comment.