@mindful-web/marko-web-search 1.0.0
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.
- package/.eslintignore +1 -0
- package/LICENSE +21 -0
- package/browser/.eslintrc.js +1 -0
- package/browser/index.js +9 -0
- package/browser/sort-select.vue +37 -0
- package/browser/toggle-filter-button.vue +69 -0
- package/browser/toggle-filters-button.vue +87 -0
- package/components/build-href.marko +14 -0
- package/components/build-href.marko.js +46 -0
- package/components/filters/content-types.marko +12 -0
- package/components/filters/content-types.marko.js +40 -0
- package/components/filters/filter-block.marko +66 -0
- package/components/filters/filter-block.marko.js +151 -0
- package/components/filters/filter-container.marko +29 -0
- package/components/filters/filter-container.marko.js +85 -0
- package/components/filters/load-website-sections.js +69 -0
- package/components/filters/marko.json +36 -0
- package/components/filters/selected/index.marko +51 -0
- package/components/filters/selected/index.marko.js +113 -0
- package/components/filters/selected/item.marko +27 -0
- package/components/filters/selected/item.marko.js +101 -0
- package/components/filters/selected/marko.json +8 -0
- package/components/filters/website-sections-by-alias.marko +46 -0
- package/components/filters/website-sections-by-alias.marko.js +139 -0
- package/components/filters/website-sections.marko +42 -0
- package/components/filters/website-sections.marko.js +123 -0
- package/components/form/index.marko +23 -0
- package/components/form/index.marko.js +79 -0
- package/components/form/input.marko +8 -0
- package/components/form/input.marko.js +30 -0
- package/components/form/marko.json +10 -0
- package/components/links/link.marko +14 -0
- package/components/links/link.marko.js +47 -0
- package/components/links/marko.json +17 -0
- package/components/links/next-page.marko +25 -0
- package/components/links/next-page.marko.js +59 -0
- package/components/links/previous-page.marko +25 -0
- package/components/links/previous-page.marko.js +59 -0
- package/components/links/reset-filter.marko +24 -0
- package/components/links/reset-filter.marko.js +55 -0
- package/components/links/set-filter-value.marko +45 -0
- package/components/links/set-filter-value.marko.js +86 -0
- package/components/marko.json +25 -0
- package/components/pagination-controls.marko +42 -0
- package/components/pagination-controls.marko.js +108 -0
- package/components/query-child-sections.marko +24 -0
- package/components/query-child-sections.marko.js +60 -0
- package/components/query.marko +30 -0
- package/components/query.marko.js +67 -0
- package/components/sort-by/index.marko +25 -0
- package/components/sort-by/index.marko.js +72 -0
- package/components/sort-by/marko.json +5 -0
- package/config/index.js +84 -0
- package/config/param.js +69 -0
- package/config/query-params.js +101 -0
- package/index.js +113 -0
- package/loaders/search.js +108 -0
- package/marko.json +6 -0
- package/middleware.js +9 -0
- package/package.json +32 -0
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
// Compiled using marko@4.20.2 - DO NOT EDIT
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var marko_template = module.exports = require("marko/dist/html").t(__filename),
|
|
5
|
+
marko_componentType = "/@mindful-web/marko-web-search$1.0.0/components/filters/website-sections.marko",
|
|
6
|
+
marko_component = require("./website-sections.marko"),
|
|
7
|
+
marko_renderer = require("marko/dist/runtime/components/renderer"),
|
|
8
|
+
module_objectPath_module = require("@mindful-web/object-path"),
|
|
9
|
+
objectPath_module = module_objectPath_module.default || module_objectPath_module,
|
|
10
|
+
getAsArray = module_objectPath_module.getAsArray,
|
|
11
|
+
module_utils_module = require("@mindful-web/utils"),
|
|
12
|
+
utils_module = module_utils_module.default || module_utils_module,
|
|
13
|
+
isFunction = module_utils_module.isFunction,
|
|
14
|
+
module_loadWebsiteSections = require("./load-website-sections"),
|
|
15
|
+
loadWebsiteSections = module_loadWebsiteSections.default || module_loadWebsiteSections,
|
|
16
|
+
marko_forOf = require("marko/dist/runtime/helpers/for-of"),
|
|
17
|
+
helpers_escape_xml = require("marko/dist/runtime/html/helpers/escape-xml"),
|
|
18
|
+
marko_escapeXml = helpers_escape_xml.x,
|
|
19
|
+
marko_web_search_set_filter_value_link_template = require("../links/set-filter-value.marko"),
|
|
20
|
+
marko_loadTag = require("marko/dist/runtime/helpers/load-tag"),
|
|
21
|
+
marko_web_search_set_filter_value_link_tag = marko_loadTag(marko_web_search_set_filter_value_link_template),
|
|
22
|
+
marko_web_element_template = require("@mindful-web/marko-web/components/element/index.marko"),
|
|
23
|
+
marko_web_element_tag = marko_loadTag(marko_web_element_template),
|
|
24
|
+
marko_web_search_filter_block_template = require("./filter-block.marko"),
|
|
25
|
+
marko_web_search_filter_block_tag = marko_loadTag(marko_web_search_filter_block_template),
|
|
26
|
+
marko_web_resolve_template = require("@mindful-web/marko-core/components/resolve.marko"),
|
|
27
|
+
marko_web_resolve_tag = marko_loadTag(marko_web_resolve_template);
|
|
28
|
+
|
|
29
|
+
function render(input, out, __component, component, state) {
|
|
30
|
+
var data = input;
|
|
31
|
+
|
|
32
|
+
const { $markoWebSearch, apollo, i18n } = out.global;
|
|
33
|
+
|
|
34
|
+
const filterKey = "assignedToWebsiteSectionIds";
|
|
35
|
+
|
|
36
|
+
const title = isFunction(i18n) ? i18n("Website Sections") : "Website Sections";
|
|
37
|
+
|
|
38
|
+
marko_web_resolve_tag({
|
|
39
|
+
promise: loadWebsiteSections({
|
|
40
|
+
$markoWebSearch: $markoWebSearch,
|
|
41
|
+
apolloMindfulWebCMS: apollo
|
|
42
|
+
}),
|
|
43
|
+
renderBody: function(out, { resolved }) {
|
|
44
|
+
const { selectedSection, configuredSections } = resolved;
|
|
45
|
+
|
|
46
|
+
marko_web_search_filter_block_tag({
|
|
47
|
+
filterKey: filterKey,
|
|
48
|
+
items: configuredSections,
|
|
49
|
+
title: {
|
|
50
|
+
value: title
|
|
51
|
+
},
|
|
52
|
+
item: {
|
|
53
|
+
renderBody: function(out, { node, blockName }) {
|
|
54
|
+
if (selectedSection && selectedSection.hierarchyMap.has(node.id)) {
|
|
55
|
+
const { hierarchy } = selectedSection;
|
|
56
|
+
|
|
57
|
+
marko_web_element_tag({
|
|
58
|
+
name: "item",
|
|
59
|
+
tag: "div",
|
|
60
|
+
blockName: blockName,
|
|
61
|
+
modifiers: [
|
|
62
|
+
"breadcrumbs"
|
|
63
|
+
],
|
|
64
|
+
renderBody: function(out) {
|
|
65
|
+
var $for$0 = 0;
|
|
66
|
+
|
|
67
|
+
marko_forOf(hierarchy, function(section) {
|
|
68
|
+
var $keyScope$0 = "[" + (($for$0++) + "]");
|
|
69
|
+
|
|
70
|
+
marko_web_search_set_filter_value_link_tag({
|
|
71
|
+
name: filterKey,
|
|
72
|
+
value: section.id,
|
|
73
|
+
resetClass: blockName + "__clear-item",
|
|
74
|
+
renderBody: function(out) {
|
|
75
|
+
out.w(marko_escapeXml(section.name));
|
|
76
|
+
}
|
|
77
|
+
}, out, __component, "5" + $keyScope$0);
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
}, out, __component, "4");
|
|
81
|
+
|
|
82
|
+
const children = getAsArray(selectedSection, "children.edges").map(edge => edge.node);
|
|
83
|
+
|
|
84
|
+
marko_web_search_filter_block_tag({
|
|
85
|
+
filterKey: filterKey,
|
|
86
|
+
items: children,
|
|
87
|
+
modifiers: [
|
|
88
|
+
"children"
|
|
89
|
+
],
|
|
90
|
+
item: {
|
|
91
|
+
labelPath: "name"
|
|
92
|
+
}
|
|
93
|
+
}, out, __component, "6");
|
|
94
|
+
} else {
|
|
95
|
+
marko_web_search_set_filter_value_link_tag({
|
|
96
|
+
name: filterKey,
|
|
97
|
+
value: node.id,
|
|
98
|
+
renderBody: function(out) {
|
|
99
|
+
out.w(marko_escapeXml(node.name));
|
|
100
|
+
}
|
|
101
|
+
}, out, __component, "8");
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}, out, __component, "1");
|
|
106
|
+
}
|
|
107
|
+
}, out, __component, "0");
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
marko_template._ = marko_renderer(render, {
|
|
111
|
+
e_: marko_componentType
|
|
112
|
+
}, marko_component);
|
|
113
|
+
|
|
114
|
+
marko_template.meta = {
|
|
115
|
+
id: "/@mindful-web/marko-web-search$1.0.0/components/filters/website-sections.marko",
|
|
116
|
+
component: "./website-sections.marko",
|
|
117
|
+
tags: [
|
|
118
|
+
"../links/set-filter-value.marko",
|
|
119
|
+
"@mindful-web/marko-web/components/element/index.marko",
|
|
120
|
+
"./filter-block.marko",
|
|
121
|
+
"@mindful-web/marko-core/components/resolve.marko"
|
|
122
|
+
]
|
|
123
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { getAsObject } from "@mindful-web/object-path";
|
|
2
|
+
import defaultValue from "@mindful-web/marko-core/utils/default-value";
|
|
3
|
+
import { cleanPath } from "@mindful-web/utils";
|
|
4
|
+
|
|
5
|
+
$ const blockName = "marko-web-search-form";
|
|
6
|
+
$ const { req, $markoWebSearch: search } = out.global;
|
|
7
|
+
$ const path = defaultValue(input.path, req.path);
|
|
8
|
+
$ const params = search.buildURLSearchParams({ page: 1 }, { searchQuery: true });
|
|
9
|
+
|
|
10
|
+
<marko-web-block ...input.block tag="form" name=blockName>
|
|
11
|
+
<@attrs
|
|
12
|
+
...getAsObject(input.block, "attrs")
|
|
13
|
+
method="GET"
|
|
14
|
+
action=`/${cleanPath(path)}`
|
|
15
|
+
/>
|
|
16
|
+
<for|name| of=params.keys()>
|
|
17
|
+
$ const value = params.get(name);
|
|
18
|
+
<if(value)>
|
|
19
|
+
<input type="hidden" name=name value=params.get(name)>
|
|
20
|
+
</if>
|
|
21
|
+
</for>
|
|
22
|
+
<${input.renderBody} block-name=blockName />
|
|
23
|
+
</marko-web-block>
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// Compiled using marko@4.20.2 - DO NOT EDIT
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var marko_template = module.exports = require("marko/dist/html").t(__filename),
|
|
5
|
+
marko_componentType = "/@mindful-web/marko-web-search$1.0.0/components/form/index.marko",
|
|
6
|
+
marko_renderer = require("marko/dist/runtime/components/renderer"),
|
|
7
|
+
module_objectPath_module = require("@mindful-web/object-path"),
|
|
8
|
+
objectPath_module = module_objectPath_module.default || module_objectPath_module,
|
|
9
|
+
getAsObject = module_objectPath_module.getAsObject,
|
|
10
|
+
module_defaultValue = require("@mindful-web/marko-core/utils/default-value"),
|
|
11
|
+
defaultValue = module_defaultValue.default || module_defaultValue,
|
|
12
|
+
module_utils_module = require("@mindful-web/utils"),
|
|
13
|
+
utils_module = module_utils_module.default || module_utils_module,
|
|
14
|
+
cleanPath = module_utils_module.cleanPath,
|
|
15
|
+
marko_assign = require("marko/dist/runtime/helpers/assign"),
|
|
16
|
+
marko_forOf = require("marko/dist/runtime/helpers/for-of"),
|
|
17
|
+
marko_attr = require("marko/dist/runtime/html/helpers/attr"),
|
|
18
|
+
marko_dynamicTag = require("marko/dist/runtime/helpers/dynamic-tag"),
|
|
19
|
+
marko_web_block_template = require("@mindful-web/marko-web/components/element/block.marko"),
|
|
20
|
+
marko_loadTag = require("marko/dist/runtime/helpers/load-tag"),
|
|
21
|
+
marko_web_block_tag = marko_loadTag(marko_web_block_template);
|
|
22
|
+
|
|
23
|
+
function render(input, out, __component, component, state) {
|
|
24
|
+
var data = input;
|
|
25
|
+
|
|
26
|
+
const blockName = "marko-web-search-form";
|
|
27
|
+
|
|
28
|
+
const { req, $markoWebSearch: search } = out.global;
|
|
29
|
+
|
|
30
|
+
const path = defaultValue(input.path, req.path);
|
|
31
|
+
|
|
32
|
+
const params = search.buildURLSearchParams({ page: 1 }, { searchQuery: true });
|
|
33
|
+
|
|
34
|
+
marko_web_block_tag(marko_assign({
|
|
35
|
+
name: "block",
|
|
36
|
+
tag: "div"
|
|
37
|
+
}, input.block, {
|
|
38
|
+
tag: "form",
|
|
39
|
+
name: blockName,
|
|
40
|
+
attrs: marko_assign({}, getAsObject(input.block, "attrs"), {
|
|
41
|
+
method: "GET",
|
|
42
|
+
action: "/" + cleanPath(path)
|
|
43
|
+
}),
|
|
44
|
+
renderBody: function(out) {
|
|
45
|
+
var $for$0 = 0;
|
|
46
|
+
|
|
47
|
+
marko_forOf(params.keys(), function(name) {
|
|
48
|
+
var $keyScope$0 = "[" + (($for$0++) + "]");
|
|
49
|
+
|
|
50
|
+
const value = params.get(name);
|
|
51
|
+
|
|
52
|
+
if (value) {
|
|
53
|
+
out.w("<input type=\"hidden\"" +
|
|
54
|
+
marko_attr("name", name) +
|
|
55
|
+
marko_attr("value", params.get(name)) +
|
|
56
|
+
">");
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
marko_dynamicTag(out, input.renderBody, function() {
|
|
61
|
+
return {
|
|
62
|
+
"block-name": blockName
|
|
63
|
+
};
|
|
64
|
+
}, null, null, null, __component, "3");
|
|
65
|
+
}
|
|
66
|
+
}), out, __component, "0");
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
marko_template._ = marko_renderer(render, {
|
|
70
|
+
d_: true,
|
|
71
|
+
e_: marko_componentType
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
marko_template.meta = {
|
|
75
|
+
id: "/@mindful-web/marko-web-search$1.0.0/components/form/index.marko",
|
|
76
|
+
tags: [
|
|
77
|
+
"@mindful-web/marko-web/components/element/block.marko"
|
|
78
|
+
]
|
|
79
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Compiled using marko@4.20.2 - DO NOT EDIT
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var marko_template = module.exports = require("marko/dist/html").t(__filename),
|
|
5
|
+
marko_componentType = "/@mindful-web/marko-web-search$1.0.0/components/form/input.marko",
|
|
6
|
+
marko_renderer = require("marko/dist/runtime/components/renderer"),
|
|
7
|
+
marko_mergeAttrs = require("marko/dist/runtime/html/helpers/merge-attrs");
|
|
8
|
+
|
|
9
|
+
function render(input, out, __component, component, state) {
|
|
10
|
+
var data = input;
|
|
11
|
+
|
|
12
|
+
const { $markoWebSearch: search } = out.global;
|
|
13
|
+
|
|
14
|
+
out.w("<input" +
|
|
15
|
+
marko_mergeAttrs(input, {
|
|
16
|
+
name: "searchQuery",
|
|
17
|
+
type: "search",
|
|
18
|
+
value: search.input.searchQuery
|
|
19
|
+
}) +
|
|
20
|
+
">");
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
marko_template._ = marko_renderer(render, {
|
|
24
|
+
d_: true,
|
|
25
|
+
e_: marko_componentType
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
marko_template.meta = {
|
|
29
|
+
id: "/@mindful-web/marko-web-search$1.0.0/components/form/input.marko"
|
|
30
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<marko-web-search-build-href|{ href }|
|
|
2
|
+
path=input.path
|
|
3
|
+
query-values=input.queryValues
|
|
4
|
+
>
|
|
5
|
+
<marko-web-link
|
|
6
|
+
class=input.class
|
|
7
|
+
href=href
|
|
8
|
+
target=input.target
|
|
9
|
+
rel=input.rel
|
|
10
|
+
attrs=input.attrs
|
|
11
|
+
>
|
|
12
|
+
<${input.renderBody} />
|
|
13
|
+
</marko-web-link>
|
|
14
|
+
</marko-web-search-build-href>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// Compiled using marko@4.20.2 - DO NOT EDIT
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var marko_template = module.exports = require("marko/dist/html").t(__filename),
|
|
5
|
+
marko_componentType = "/@mindful-web/marko-web-search$1.0.0/components/links/link.marko",
|
|
6
|
+
marko_component = require("./link.marko"),
|
|
7
|
+
marko_renderer = require("marko/dist/runtime/components/renderer"),
|
|
8
|
+
marko_dynamicTag = require("marko/dist/runtime/helpers/dynamic-tag"),
|
|
9
|
+
marko_web_link_template = require("@mindful-web/marko-web/components/element/link.marko"),
|
|
10
|
+
marko_loadTag = require("marko/dist/runtime/helpers/load-tag"),
|
|
11
|
+
marko_web_link_tag = marko_loadTag(marko_web_link_template),
|
|
12
|
+
marko_web_search_build_href_template = require("../build-href.marko"),
|
|
13
|
+
marko_web_search_build_href_tag = marko_loadTag(marko_web_search_build_href_template);
|
|
14
|
+
|
|
15
|
+
function render(input, out, __component, component, state) {
|
|
16
|
+
var data = input;
|
|
17
|
+
|
|
18
|
+
marko_web_search_build_href_tag({
|
|
19
|
+
path: input.path,
|
|
20
|
+
queryValues: input.queryValues,
|
|
21
|
+
renderBody: function(out, { href }) {
|
|
22
|
+
marko_web_link_tag({
|
|
23
|
+
class: input.class,
|
|
24
|
+
href: href,
|
|
25
|
+
target: input.target,
|
|
26
|
+
rel: input.rel,
|
|
27
|
+
attrs: input.attrs,
|
|
28
|
+
renderBody: function(out) {
|
|
29
|
+
marko_dynamicTag(out, input.renderBody, null, null, null, null, __component, "2");
|
|
30
|
+
}
|
|
31
|
+
}, out, __component, "1");
|
|
32
|
+
}
|
|
33
|
+
}, out, __component, "0");
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
marko_template._ = marko_renderer(render, {
|
|
37
|
+
e_: marko_componentType
|
|
38
|
+
}, marko_component);
|
|
39
|
+
|
|
40
|
+
marko_template.meta = {
|
|
41
|
+
id: "/@mindful-web/marko-web-search$1.0.0/components/links/link.marko",
|
|
42
|
+
component: "./link.marko",
|
|
43
|
+
tags: [
|
|
44
|
+
"@mindful-web/marko-web/components/element/link.marko",
|
|
45
|
+
"../build-href.marko"
|
|
46
|
+
]
|
|
47
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"<marko-web-search-link>": {
|
|
3
|
+
"template": "./link.marko"
|
|
4
|
+
},
|
|
5
|
+
"<marko-web-search-next-page-link>": {
|
|
6
|
+
"template": "./next-page.marko"
|
|
7
|
+
},
|
|
8
|
+
"<marko-web-search-previous-page-link>": {
|
|
9
|
+
"template": "./previous-page.marko"
|
|
10
|
+
},
|
|
11
|
+
"<marko-web-search-reset-filter-link>": {
|
|
12
|
+
"template": "./reset-filter.marko"
|
|
13
|
+
},
|
|
14
|
+
"<marko-web-search-set-filter-value-link>": {
|
|
15
|
+
"template": "./set-filter-value.marko"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { isFunction } from '@mindful-web/utils';
|
|
2
|
+
|
|
3
|
+
$ const { $markoWebSearch: search, i18n } = out.global;
|
|
4
|
+
|
|
5
|
+
$ const nextPage = search.getNextPage(input.totalCount);
|
|
6
|
+
|
|
7
|
+
$ const { sortField, sortOrder } = search.input;
|
|
8
|
+
|
|
9
|
+
<if(nextPage)>
|
|
10
|
+
<marko-web-search-link
|
|
11
|
+
path=input.path
|
|
12
|
+
query-values={ page: nextPage, sortField, sortOrder }
|
|
13
|
+
class=input.class
|
|
14
|
+
target=input.target
|
|
15
|
+
rel=input.rel
|
|
16
|
+
attrs=input.attrs
|
|
17
|
+
>
|
|
18
|
+
<if(input.renderBody)>
|
|
19
|
+
<${input.renderBody} />
|
|
20
|
+
</if>
|
|
21
|
+
<else>
|
|
22
|
+
${isFunction(i18n) ? i18n("Next Page") : "Next Page"}
|
|
23
|
+
</else>
|
|
24
|
+
</marko-web-search-link>
|
|
25
|
+
</if>
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// Compiled using marko@4.20.2 - DO NOT EDIT
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var marko_template = module.exports = require("marko/dist/html").t(__filename),
|
|
5
|
+
marko_componentType = "/@mindful-web/marko-web-search$1.0.0/components/links/next-page.marko",
|
|
6
|
+
marko_renderer = require("marko/dist/runtime/components/renderer"),
|
|
7
|
+
module_utils_module = require("@mindful-web/utils"),
|
|
8
|
+
utils_module = module_utils_module.default || module_utils_module,
|
|
9
|
+
isFunction = module_utils_module.isFunction,
|
|
10
|
+
marko_dynamicTag = require("marko/dist/runtime/helpers/dynamic-tag"),
|
|
11
|
+
helpers_escape_xml = require("marko/dist/runtime/html/helpers/escape-xml"),
|
|
12
|
+
marko_escapeXml = helpers_escape_xml.x,
|
|
13
|
+
marko_web_search_link_template = require("./link.marko"),
|
|
14
|
+
marko_loadTag = require("marko/dist/runtime/helpers/load-tag"),
|
|
15
|
+
marko_web_search_link_tag = marko_loadTag(marko_web_search_link_template);
|
|
16
|
+
|
|
17
|
+
function render(input, out, __component, component, state) {
|
|
18
|
+
var data = input;
|
|
19
|
+
|
|
20
|
+
const { $markoWebSearch: search, i18n } = out.global;
|
|
21
|
+
|
|
22
|
+
const nextPage = search.getNextPage(input.totalCount);
|
|
23
|
+
|
|
24
|
+
const { sortField, sortOrder } = search.input;
|
|
25
|
+
|
|
26
|
+
if (nextPage) {
|
|
27
|
+
marko_web_search_link_tag({
|
|
28
|
+
path: input.path,
|
|
29
|
+
queryValues: {
|
|
30
|
+
page: nextPage,
|
|
31
|
+
sortField: sortField,
|
|
32
|
+
sortOrder: sortOrder
|
|
33
|
+
},
|
|
34
|
+
class: input.class,
|
|
35
|
+
target: input.target,
|
|
36
|
+
rel: input.rel,
|
|
37
|
+
attrs: input.attrs,
|
|
38
|
+
renderBody: function(out) {
|
|
39
|
+
if (input.renderBody) {
|
|
40
|
+
marko_dynamicTag(out, input.renderBody, null, null, null, null, __component, "1");
|
|
41
|
+
} else {
|
|
42
|
+
out.w(marko_escapeXml(isFunction(i18n) ? i18n("Next Page") : "Next Page"));
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}, out, __component, "0");
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
marko_template._ = marko_renderer(render, {
|
|
50
|
+
d_: true,
|
|
51
|
+
e_: marko_componentType
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
marko_template.meta = {
|
|
55
|
+
id: "/@mindful-web/marko-web-search$1.0.0/components/links/next-page.marko",
|
|
56
|
+
tags: [
|
|
57
|
+
"./link.marko"
|
|
58
|
+
]
|
|
59
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { isFunction } from '@mindful-web/utils';
|
|
2
|
+
|
|
3
|
+
$ const { $markoWebSearch: search, i18n } = out.global;
|
|
4
|
+
|
|
5
|
+
$ const previousPage = search.getPrevPage();
|
|
6
|
+
|
|
7
|
+
$ const { sortField, sortOrder } = search.input;
|
|
8
|
+
|
|
9
|
+
<if(previousPage)>
|
|
10
|
+
<marko-web-search-link
|
|
11
|
+
path=input.path
|
|
12
|
+
query-values={ page: previousPage, sortField, sortOrder }
|
|
13
|
+
class=input.class
|
|
14
|
+
target=input.target
|
|
15
|
+
rel=input.rel
|
|
16
|
+
attrs=input.attrs
|
|
17
|
+
>
|
|
18
|
+
<if(input.renderBody)>
|
|
19
|
+
<${input.renderBody} />
|
|
20
|
+
</if>
|
|
21
|
+
<else>
|
|
22
|
+
${isFunction(i18n) ? i18n("Previous Page") : "Previous Page"}
|
|
23
|
+
</else>
|
|
24
|
+
</marko-web-search-link>
|
|
25
|
+
</if>
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// Compiled using marko@4.20.2 - DO NOT EDIT
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var marko_template = module.exports = require("marko/dist/html").t(__filename),
|
|
5
|
+
marko_componentType = "/@mindful-web/marko-web-search$1.0.0/components/links/previous-page.marko",
|
|
6
|
+
marko_renderer = require("marko/dist/runtime/components/renderer"),
|
|
7
|
+
module_utils_module = require("@mindful-web/utils"),
|
|
8
|
+
utils_module = module_utils_module.default || module_utils_module,
|
|
9
|
+
isFunction = module_utils_module.isFunction,
|
|
10
|
+
marko_dynamicTag = require("marko/dist/runtime/helpers/dynamic-tag"),
|
|
11
|
+
helpers_escape_xml = require("marko/dist/runtime/html/helpers/escape-xml"),
|
|
12
|
+
marko_escapeXml = helpers_escape_xml.x,
|
|
13
|
+
marko_web_search_link_template = require("./link.marko"),
|
|
14
|
+
marko_loadTag = require("marko/dist/runtime/helpers/load-tag"),
|
|
15
|
+
marko_web_search_link_tag = marko_loadTag(marko_web_search_link_template);
|
|
16
|
+
|
|
17
|
+
function render(input, out, __component, component, state) {
|
|
18
|
+
var data = input;
|
|
19
|
+
|
|
20
|
+
const { $markoWebSearch: search, i18n } = out.global;
|
|
21
|
+
|
|
22
|
+
const previousPage = search.getPrevPage();
|
|
23
|
+
|
|
24
|
+
const { sortField, sortOrder } = search.input;
|
|
25
|
+
|
|
26
|
+
if (previousPage) {
|
|
27
|
+
marko_web_search_link_tag({
|
|
28
|
+
path: input.path,
|
|
29
|
+
queryValues: {
|
|
30
|
+
page: previousPage,
|
|
31
|
+
sortField: sortField,
|
|
32
|
+
sortOrder: sortOrder
|
|
33
|
+
},
|
|
34
|
+
class: input.class,
|
|
35
|
+
target: input.target,
|
|
36
|
+
rel: input.rel,
|
|
37
|
+
attrs: input.attrs,
|
|
38
|
+
renderBody: function(out) {
|
|
39
|
+
if (input.renderBody) {
|
|
40
|
+
marko_dynamicTag(out, input.renderBody, null, null, null, null, __component, "1");
|
|
41
|
+
} else {
|
|
42
|
+
out.w(marko_escapeXml(isFunction(i18n) ? i18n("Previous Page") : "Previous Page"));
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}, out, __component, "0");
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
marko_template._ = marko_renderer(render, {
|
|
50
|
+
d_: true,
|
|
51
|
+
e_: marko_componentType
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
marko_template.meta = {
|
|
55
|
+
id: "/@mindful-web/marko-web-search$1.0.0/components/links/previous-page.marko",
|
|
56
|
+
tags: [
|
|
57
|
+
"./link.marko"
|
|
58
|
+
]
|
|
59
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import defaultValue from "@mindful-web/marko-core/utils/default-value";
|
|
2
|
+
|
|
3
|
+
$ const { $markoWebSearch: search } = out.global;
|
|
4
|
+
$ const resetPage = defaultValue(input.resetPage, true);
|
|
5
|
+
$ const { name } = input;
|
|
6
|
+
|
|
7
|
+
$ const isDefaultValue = search.isDefaultInputValueFor(name);
|
|
8
|
+
$ const queryValues = {
|
|
9
|
+
[name]: null,
|
|
10
|
+
...(resetPage && { page: 1 }),
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
<if(!isDefaultValue)>
|
|
14
|
+
<marko-web-search-link
|
|
15
|
+
path=input.path
|
|
16
|
+
query-values=queryValues
|
|
17
|
+
class=input.class
|
|
18
|
+
target=input.target
|
|
19
|
+
rel=input.rel
|
|
20
|
+
attrs=input.attrs
|
|
21
|
+
>
|
|
22
|
+
<${input.renderBody} />
|
|
23
|
+
</marko-web-search-link>
|
|
24
|
+
</if>
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// Compiled using marko@4.20.2 - DO NOT EDIT
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var marko_template = module.exports = require("marko/dist/html").t(__filename),
|
|
5
|
+
marko_componentType = "/@mindful-web/marko-web-search$1.0.0/components/links/reset-filter.marko",
|
|
6
|
+
marko_renderer = require("marko/dist/runtime/components/renderer"),
|
|
7
|
+
module_defaultValue = require("@mindful-web/marko-core/utils/default-value"),
|
|
8
|
+
defaultValue = module_defaultValue.default || module_defaultValue,
|
|
9
|
+
marko_dynamicTag = require("marko/dist/runtime/helpers/dynamic-tag"),
|
|
10
|
+
marko_web_search_link_template = require("./link.marko"),
|
|
11
|
+
marko_loadTag = require("marko/dist/runtime/helpers/load-tag"),
|
|
12
|
+
marko_web_search_link_tag = marko_loadTag(marko_web_search_link_template);
|
|
13
|
+
|
|
14
|
+
function render(input, out, __component, component, state) {
|
|
15
|
+
var data = input;
|
|
16
|
+
|
|
17
|
+
const { $markoWebSearch: search } = out.global;
|
|
18
|
+
|
|
19
|
+
const resetPage = defaultValue(input.resetPage, true);
|
|
20
|
+
|
|
21
|
+
const { name } = input;
|
|
22
|
+
|
|
23
|
+
const isDefaultValue = search.isDefaultInputValueFor(name);
|
|
24
|
+
|
|
25
|
+
const queryValues = {
|
|
26
|
+
[name]: null,
|
|
27
|
+
...(resetPage && { page: 1 }),
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
if (!isDefaultValue) {
|
|
31
|
+
marko_web_search_link_tag({
|
|
32
|
+
path: input.path,
|
|
33
|
+
queryValues: queryValues,
|
|
34
|
+
class: input.class,
|
|
35
|
+
target: input.target,
|
|
36
|
+
rel: input.rel,
|
|
37
|
+
attrs: input.attrs,
|
|
38
|
+
renderBody: function(out) {
|
|
39
|
+
marko_dynamicTag(out, input.renderBody, null, null, null, null, __component, "1");
|
|
40
|
+
}
|
|
41
|
+
}, out, __component, "0");
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
marko_template._ = marko_renderer(render, {
|
|
46
|
+
d_: true,
|
|
47
|
+
e_: marko_componentType
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
marko_template.meta = {
|
|
51
|
+
id: "/@mindful-web/marko-web-search$1.0.0/components/links/reset-filter.marko",
|
|
52
|
+
tags: [
|
|
53
|
+
"./link.marko"
|
|
54
|
+
]
|
|
55
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import defaultValue from "@mindful-web/marko-core/utils/default-value";
|
|
2
|
+
|
|
3
|
+
$ const { isArray } = Array;
|
|
4
|
+
$ const { $markoWebSearch: search } = out.global;
|
|
5
|
+
$ const { name } = input;
|
|
6
|
+
|
|
7
|
+
$ const { value } = input;
|
|
8
|
+
$ const v = search.isArrayParam(name) && !isArray(value) ? [value] : value;
|
|
9
|
+
$ const resetPage = defaultValue(input.resetPage, true);
|
|
10
|
+
$ const queryValues = {
|
|
11
|
+
[name]: v,
|
|
12
|
+
...(resetPage && { page: 1 }),
|
|
13
|
+
};
|
|
14
|
+
$ const resetValues = {
|
|
15
|
+
...queryValues,
|
|
16
|
+
[name]: null,
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
$ const isSelected = search.isInputValueSelectedFor(name, v);
|
|
20
|
+
|
|
21
|
+
<if(isSelected)>
|
|
22
|
+
<!-- instruct the link to remove the current value -->
|
|
23
|
+
<marko-web-search-link
|
|
24
|
+
path=input.path
|
|
25
|
+
query-values=resetValues
|
|
26
|
+
class=input.resetClass
|
|
27
|
+
target=input.target
|
|
28
|
+
rel=input.rel
|
|
29
|
+
attrs=input.attrs
|
|
30
|
+
>
|
|
31
|
+
<${input.renderBody} is-selected=false />
|
|
32
|
+
</marko-web-search-link>
|
|
33
|
+
</if>
|
|
34
|
+
<else>
|
|
35
|
+
<marko-web-search-link
|
|
36
|
+
path=input.path
|
|
37
|
+
query-values=queryValues
|
|
38
|
+
class=input.class
|
|
39
|
+
target=input.target
|
|
40
|
+
rel=input.rel
|
|
41
|
+
attrs=input.attrs
|
|
42
|
+
>
|
|
43
|
+
<${input.renderBody} is-selected=false />
|
|
44
|
+
</marko-web-search-link>
|
|
45
|
+
</else>
|