Commit ee7a1e4b8501171f91d90a0c93d4f23d8b9018e6
1 parent
e2de30a5
add hk_filter in list view
Showing
27 changed files
with
148 additions
and
54 deletions
Show diff stats
ds_files/ds_types.anubis
| ... | ... | @@ -184,12 +184,19 @@ public define List(DS_Type_File) hayamiki_lib_types_description = |
| 184 | 184 | ]), |
| 185 | 185 | |
| 186 | 186 | |
| 187 | + ds_type("HK_Filter", [ | |
| 188 | + alternative("hk_filter", [ | |
| 189 | + component(string, "filter_name"), | |
| 190 | + component(string, "filter_string") | |
| 191 | + ]) | |
| 192 | + ]), | |
| 187 | 193 | |
| 188 | 194 | ds_type("HK_Viewer", [ |
| 189 | 195 | enum("list_view_all"), |
| 190 | 196 | alternative("list_view", [ |
| 191 | 197 | component(string, "view_name"), |
| 192 | 198 | component(list, string, "columns"), |
| 199 | + component(list, extern_type("HK_Filter", view_types+"hk_filter.anubis"), "l_filter"), | |
| 193 | 200 | component(extern_type("WEB_Action_Name", "calexium_lib/web/types/web_action_name.anubis"), "link_id_action") |
| 194 | 201 | ]) |
| 195 | 202 | ]), |
| ... | ... | @@ -232,7 +239,7 @@ public define List(DS_Type_File) hayamiki_lib_types_description = |
| 232 | 239 | ds_type("HK_Form", no_message, [ |
| 233 | 240 | alternative("hk_form_in_list", [ |
| 234 | 241 | component(string, "table_name", comment("database table name which belonging this form")), |
| 235 | - component(string, "view_name", comment("name of the view")), | |
| 242 | + component(string, "view_name", comment("name of the view")), | |
| 236 | 243 | component(list, extern_type("HK_Form_Entry", view_types+"hk_form_entry.anubis"), "list"), |
| 237 | 244 | component(list, extern_type("HK_Form_Tab", view_types+"hk_form_tab.anubis"), "tabs") |
| 238 | 245 | ]), | ... | ... |
model/display.anubis
| ... | ... | @@ -15,6 +15,7 @@ transmit hayamiki_lib/view/types/hk_display.anubis |
| 15 | 15 | transmit hayamiki_lib/view/types/hk_viewer.anubis |
| 16 | 16 | transmit hayamiki_lib/view/types/hk_editor.anubis |
| 17 | 17 | transmit hayamiki_lib/view/types/hk_fk_view.anubis |
| 18 | +transmit hayamiki_lib/view/types/hk_filter.anubis | |
| 18 | 19 | transmit hayamiki_lib/model/types/hk_icon.anubis |
| 19 | 20 | |
| 20 | 21 | public define HK_Viewer |
| ... | ... | @@ -23,9 +24,17 @@ public define HK_Viewer |
| 23 | 24 | String view_name, |
| 24 | 25 | List(String) columns |
| 25 | 26 | )= |
| 26 | - list_view(view_name, columns, no_action). | |
| 27 | - | |
| 27 | + list_view(view_name, columns, [], no_action). | |
| 28 | 28 | |
| 29 | +public define HK_Viewer | |
| 30 | + list_view | |
| 31 | + ( | |
| 32 | + String view_name, | |
| 33 | + List(String) columns, | |
| 34 | + List(HK_Filter) l_filter | |
| 35 | + )= | |
| 36 | + list_view(view_name, columns, l_filter, no_action). | |
| 37 | + | |
| 29 | 38 | public define HK_Editor |
| 30 | 39 | edit_view_list_form |
| 31 | 40 | ( | ... | ... |
model/types/hk_app.anubis
model/types/hk_app_name.anubis
model/types/hk_database.anubis
model/types/hk_datetime_field_attr.anubis
model/types/hk_help_text.anubis
model/types/hk_icon.anubis
model/types/hk_int_choice.anubis
model/types/hk_int_choices.anubis
model/types/hk_model.anubis
model/types/hk_model_attr.anubis
model/types/hk_model_column.anubis
model/types/hk_model_field.anubis
model/types/hk_table.anubis
model/types/hk_text_choice.anubis
model/types/hk_text_choices.anubis
model/types/hk_text_field_attr.anubis
view/types/hk_display.anubis
view/types/hk_editor.anubis
view/types/hk_editor_table.anubis
| 1 | +/* | |
| 2 | + * Created by 伝作 (Densaku). | |
| 3 | + * Types & Messages generator written by フランスのトトロ aka (David RENÉ) | |
| 4 | + * Date: 2017-05-19 | |
| 5 | + * Time: 09:34:01 | |
| 6 | + * | |
| 7 | + */ | |
| 8 | + | |
| 9 | +transmit system/muscle.anubis | |
| 10 | +transmit system/convert.anubis | |
| 11 | +transmit tools/basis.anubis | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | +public type HK_Filter: | |
| 17 | + hk_filter( | |
| 18 | + String filter_name, | |
| 19 | + String filter_string | |
| 20 | + ) | |
| 21 | +. | |
| 22 | + | |
| 23 | + HK_Filter message format | |
| 24 | + ======================== | |
| 25 | + | |
| 26 | + | |
| 27 | +public define Message | |
| 28 | + to_Message | |
| 29 | + ( | |
| 30 | + HK_Filter _hk_filter | |
| 31 | + )= | |
| 32 | + with _hk_filter_message = message((Word32)0), // | |
| 33 | + forget(add_string(_hk_filter_message, "__TYPE__", "HK_Filter")); | |
| 34 | + if _hk_filter is | |
| 35 | + { | |
| 36 | + //Alternative hk_filter | |
| 37 | + hk_filter(_filter_name, _filter_string) then | |
| 38 | + forget(add_string(_hk_filter_message, "__TYPE_ALT__", "hk_filter")); | |
| 39 | + // [type = String] hk_filter.filter_name | |
| 40 | + forget(add_string(_hk_filter_message, "filter_name", _filter_name)); | |
| 41 | + // [type = String] hk_filter.filter_string | |
| 42 | + forget(add_string(_hk_filter_message, "filter_string", _filter_string)), | |
| 43 | + | |
| 44 | + }; | |
| 45 | + _hk_filter_message | |
| 46 | +. | |
| 47 | + | |
| 48 | +public define Maybe(HK_Filter) | |
| 49 | + from_Message | |
| 50 | + ( | |
| 51 | + Message _hk_filter_message | |
| 52 | + )= | |
| 53 | + if find_string(_hk_filter_message, "__TYPE__") is {failure then failure, success(__type__) then | |
| 54 | + if find_string(_hk_filter_message, "__TYPE_ALT__") is {failure then failure, success(__type_alt__) then | |
| 55 | + if __type__ = "HK_Filter" then | |
| 56 | + //Alternative hk_filter | |
| 57 | + if __type_alt__ = "hk_filter" then //Alternative hk_filter | |
| 58 | + // [type = String] hk_filter.filter_name | |
| 59 | + if find_string(_hk_filter_message, "filter_name") is {failure then failure, success(_filter_name_) then | |
| 60 | + // [type = String] hk_filter.filter_string | |
| 61 | + if find_string(_hk_filter_message, "filter_string") is {failure then failure, success(_filter_string_) then | |
| 62 | + | |
| 63 | + success(hk_filter(_filter_name_, _filter_string_)) | |
| 64 | + }} | |
| 65 | + else | |
| 66 | + failure //No valid Alternative found ! | |
| 67 | + else | |
| 68 | + failure //Type not found in message ! | |
| 69 | + }} | |
| 70 | +. | |
| 71 | + | ... | ... |
view/types/hk_fk_view.anubis
view/types/hk_form.anubis
view/types/hk_form_tab.anubis
view/types/hk_form_table.anubis
view/types/hk_viewer.anubis
| 1 | 1 | /* |
| 2 | 2 | * Created by 伝作 (Densaku). |
| 3 | 3 | * Types & Messages generator written by フランスのトトロ aka (David RENÉ) |
| 4 | - * Date: 2017-04-12 | |
| 5 | - * Time: 23:52:21 | |
| 4 | + * Date: 2017-05-19 | |
| 5 | + * Time: 09:24:24 | |
| 6 | 6 | * |
| 7 | 7 | */ |
| 8 | 8 | |
| ... | ... | @@ -11,6 +11,7 @@ transmit system/convert.anubis |
| 11 | 11 | transmit tools/basis.anubis |
| 12 | 12 | |
| 13 | 13 | transmit calexium_lib/web/types/web_action_name.anubis |
| 14 | +transmit hayamiki_lib/view/types/hk_filter.anubis | |
| 14 | 15 | |
| 15 | 16 | |
| 16 | 17 | |
| ... | ... | @@ -19,6 +20,7 @@ public type HK_Viewer: |
| 19 | 20 | list_view( |
| 20 | 21 | String view_name, |
| 21 | 22 | List(String) columns, |
| 23 | + List(HK_Filter) l_filter, | |
| 22 | 24 | WEB_Action_Name link_id_action |
| 23 | 25 | ) |
| 24 | 26 | . |
| ... | ... | @@ -41,12 +43,14 @@ public define Message |
| 41 | 43 | forget(add_string(_hk_viewer_message, "__TYPE_ALT__", "list_view_all")), |
| 42 | 44 | |
| 43 | 45 | //Alternative list_view |
| 44 | - list_view(_view_name, __columns, _link_id_action) then | |
| 46 | + list_view(_view_name, __columns, __l_filter, _link_id_action) then | |
| 45 | 47 | forget(add_string(_hk_viewer_message, "__TYPE_ALT__", "list_view")); |
| 46 | 48 | // [type = String] list_view.view_name |
| 47 | 49 | forget(add_string(_hk_viewer_message, "view_name", _view_name)); |
| 48 | 50 | // [type = List(String)] list_view.columns |
| 49 | 51 | map_forget((String _columns) |-> add_string(_hk_viewer_message, "columns", _columns), __columns); |
| 52 | + // [type = List(HK_Filter)] list_view.l_filter | |
| 53 | + map_forget((HK_Filter _l_filter) |-> add_message(_hk_viewer_message, "l_filter", to_Message(_l_filter)), __l_filter); | |
| 50 | 54 | // [type = WEB_Action_Name] list_view.link_id_action |
| 51 | 55 | forget(add_message(_hk_viewer_message, "link_id_action", to_Message(_link_id_action))), |
| 52 | 56 | |
| ... | ... | @@ -71,12 +75,15 @@ public define Maybe(HK_Viewer) |
| 71 | 75 | if find_string(_hk_viewer_message, "view_name") is {failure then failure, success(_view_name_) then |
| 72 | 76 | // [type = List(String)] list_view.columns |
| 73 | 77 | with _columns_ = find_string_list(_hk_viewer_message, "columns"), |
| 78 | + // [type = List(HK_Filter)] list_view.l_filter | |
| 79 | + with mb__l_filter_ = map_escape(( Message msg ) |-> (Maybe(HK_Filter)) from_Message(msg), find_messages(_hk_viewer_message, "l_filter")), | |
| 80 | + if mb__l_filter_ is {failure then failure, success(_l_filter_) then | |
| 74 | 81 | // [type = WEB_Action_Name] list_view.link_id_action |
| 75 | 82 | if find_message(_hk_viewer_message, "link_id_action") is {failure then failure, success(_link_id_action__msg) then |
| 76 | 83 | if (Maybe(WEB_Action_Name))from_Message(_link_id_action__msg) is {failure then failure, success(_link_id_action_) then |
| 77 | 84 | |
| 78 | - success(list_view(_view_name_, _columns_, _link_id_action_)) | |
| 79 | - }}} | |
| 85 | + success(list_view(_view_name_, _columns_, _l_filter_, _link_id_action_)) | |
| 86 | + }}}} | |
| 80 | 87 | else |
| 81 | 88 | failure //No valid Alternative found ! |
| 82 | 89 | else | ... | ... |