@bpmn-io/feel-editor 0.4.1 → 0.6.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/README.md +13 -1
- package/dist/index.es.js +148 -99
- package/dist/index.js +145 -96
- package/package.json +21 -20
package/dist/index.js
CHANGED
|
@@ -31,339 +31,339 @@ function isPathExpression(node) {
|
|
|
31
31
|
var tags = [
|
|
32
32
|
{
|
|
33
33
|
name: "not()",
|
|
34
|
-
description: "<ul>\n<li>parameters:<ul>\n<li><code>negand</code>: boolean</li>\n</ul>\n</li>\n<li>result: boolean</li>\n</ul>\n<pre><code class=\"language-
|
|
34
|
+
description: "<ul>\n<li>parameters:<ul>\n<li><code>negand</code>: boolean</li>\n</ul>\n</li>\n<li>result: boolean</li>\n</ul>\n<pre><code class=\"language-feel\">not(true)\n// false\n</code></pre>\n"
|
|
35
35
|
},
|
|
36
36
|
{
|
|
37
37
|
name: "is defined()",
|
|
38
|
-
description: "<p>Checks if a given value is defined. A value is defined if it exists, and it is an instance of one of the FEEL data types including <code>null</code>.</p>\n<p>The function can be used to check if a variable or a context entry (e.g. a property of a variable) exists. It allows differentiating between a <code>null</code> variable and a value that doesn't exist.</p>\n<ul>\n<li>parameters:<ul>\n<li><code>value</code>: any</li>\n</ul>\n</li>\n<li>result: boolean</li>\n</ul>\n<pre><code class=\"language-
|
|
38
|
+
description: "<p>Checks if a given value is defined. A value is defined if it exists, and it is an instance of one of the FEEL data types including <code>null</code>.</p>\n<p>The function can be used to check if a variable or a context entry (e.g. a property of a variable) exists. It allows differentiating between a <code>null</code> variable and a value that doesn't exist.</p>\n<ul>\n<li>parameters:<ul>\n<li><code>value</code>: any</li>\n</ul>\n</li>\n<li>result: boolean</li>\n</ul>\n<pre><code class=\"language-feel\">is defined(1)\n// true\n\nis defined(null)\n// true\n\nis defined(x)\n// false - if no variable "x" exists\n\nis defined(x.y)\n// false - if no variable "x" exists or it doesn't have a property "y"\n</code></pre>\n"
|
|
39
39
|
},
|
|
40
40
|
{
|
|
41
41
|
name: "get value()",
|
|
42
|
-
description: "<p>Returns the value of the context entry with the given key.</p>\n<ul>\n<li>parameters:<ul>\n<li><code>context</code>: context</li>\n<li><code>key</code>: string</li>\n</ul>\n</li>\n<li>result: any</li>\n</ul>\n<pre><code class=\"language-
|
|
42
|
+
description: "<p>Returns the value of the context entry with the given key.</p>\n<ul>\n<li>parameters:<ul>\n<li><code>context</code>: context</li>\n<li><code>key</code>: string</li>\n</ul>\n</li>\n<li>result: any</li>\n</ul>\n<pre><code class=\"language-feel\">get value({foo: 123}, "foo")\n// 123\n</code></pre>\n"
|
|
43
43
|
},
|
|
44
44
|
{
|
|
45
45
|
name: "get entries()",
|
|
46
|
-
description: "<p>Returns the entries of the context as a list of key-value-pairs.</p>\n<ul>\n<li>parameters:<ul>\n<li><code>context</code>: context</li>\n</ul>\n</li>\n<li>result: list of context which contains two entries for "key" and "value"</li>\n</ul>\n<pre><code class=\"language-
|
|
46
|
+
description: "<p>Returns the entries of the context as a list of key-value-pairs.</p>\n<ul>\n<li>parameters:<ul>\n<li><code>context</code>: context</li>\n</ul>\n</li>\n<li>result: list of context which contains two entries for "key" and "value"</li>\n</ul>\n<pre><code class=\"language-feel\">get entries({foo: 123})\n// [{key: "foo", value: 123}]\n</code></pre>\n"
|
|
47
47
|
},
|
|
48
48
|
{
|
|
49
49
|
name: "put()",
|
|
50
|
-
description: "<p>Add the given key and value to a context. Returns a new context that includes the entry. It might override an existing entry of the context.</p>\n<p>Returns <code>null</code> if the value is not defined.</p>\n<ul>\n<li>parameters:<ul>\n<li><code>context</code>: context</li>\n<li><code>key</code>: string</li>\n<li><code>value</code>: any</li>\n</ul>\n</li>\n<li>result: context</li>\n</ul>\n<pre><code class=\"language-
|
|
50
|
+
description: "<p>Add the given key and value to a context. Returns a new context that includes the entry. It might override an existing entry of the context.</p>\n<p>Returns <code>null</code> if the value is not defined.</p>\n<ul>\n<li>parameters:<ul>\n<li><code>context</code>: context</li>\n<li><code>key</code>: string</li>\n<li><code>value</code>: any</li>\n</ul>\n</li>\n<li>result: context</li>\n</ul>\n<pre><code class=\"language-feel\">put({x:1}, "y", 2)\n// {x:1, y:2}\n</code></pre>\n"
|
|
51
51
|
},
|
|
52
52
|
{
|
|
53
53
|
name: "put all()",
|
|
54
|
-
description: "<p>Union the given contexts (two or more). Returns a new context that includes all entries of the given contexts. It might override context entries if the keys are equal. The entries are overridden in the same order as the contexts are passed in the method.</p>\n<p>Returns <code>null</code> if one of the values is not a context.</p>\n<ul>\n<li>parameters:<ul>\n<li><code>contexts</code>: contexts as varargs</li>\n</ul>\n</li>\n<li>result: context</li>\n</ul>\n<pre><code class=\"language-
|
|
54
|
+
description: "<p>Union the given contexts (two or more). Returns a new context that includes all entries of the given contexts. It might override context entries if the keys are equal. The entries are overridden in the same order as the contexts are passed in the method.</p>\n<p>Returns <code>null</code> if one of the values is not a context.</p>\n<ul>\n<li>parameters:<ul>\n<li><code>contexts</code>: contexts as varargs</li>\n</ul>\n</li>\n<li>result: context</li>\n</ul>\n<pre><code class=\"language-feel\">put all({x:1}, {y:2})\n// {x:1, y:2}\n</code></pre>\n"
|
|
55
55
|
},
|
|
56
56
|
{
|
|
57
57
|
name: "date()",
|
|
58
|
-
description: "<ul>\n<li>parameters:<ul>\n<li><code>from</code>: string / date-time</li>\n<li>or <code>year</code>, <code>month</code>, <code>day</code>: number</li>\n</ul>\n</li>\n<li>result: date</li>\n</ul>\n<pre><code class=\"language-
|
|
58
|
+
description: "<ul>\n<li>parameters:<ul>\n<li><code>from</code>: string / date-time</li>\n<li>or <code>year</code>, <code>month</code>, <code>day</code>: number</li>\n</ul>\n</li>\n<li>result: date</li>\n</ul>\n<pre><code class=\"language-feel\">date(birthday)\n// date("2018-04-29")\n\ndate(date and time("2012-12-25T11:00:00"))\n// date("2012-12-25")\n\ndate(2012, 12, 25)\n// date("2012-12-25")\n</code></pre>\n"
|
|
59
59
|
},
|
|
60
60
|
{
|
|
61
61
|
name: "time()",
|
|
62
|
-
description: "<ul>\n<li>parameters:<ul>\n<li><code>from</code>: string / date-time</li>\n<li>or <code>hour</code>, <code>minute</code>, <code>second</code>: number<ul>\n<li>(optional) <code>offset</code>: day-time-duration</li>\n</ul>\n</li>\n</ul>\n</li>\n<li>result: time</li>\n</ul>\n<pre><code class=\"language-
|
|
62
|
+
description: "<ul>\n<li>parameters:<ul>\n<li><code>from</code>: string / date-time</li>\n<li>or <code>hour</code>, <code>minute</code>, <code>second</code>: number<ul>\n<li>(optional) <code>offset</code>: day-time-duration</li>\n</ul>\n</li>\n</ul>\n</li>\n<li>result: time</li>\n</ul>\n<pre><code class=\"language-feel\">time(lunchTime)\n// time("12:00:00")\n\ntime(date and time("2012-12-25T11:00:00"))\n// time("11:00:00")\n\ntime(23, 59, 0)\n// time("23:59:00")\n\ntime(14, 30, 0, duration("PT1H"))\n// time("15:30:00")\n</code></pre>\n"
|
|
63
63
|
},
|
|
64
64
|
{
|
|
65
65
|
name: "date and time()",
|
|
66
|
-
description: "<ul>\n<li>parameters:<ul>\n<li><code>date</code>: date / date-time</li>\n<li><code>time</code>: time</li>\n<li>or <code>from</code>: string</li>\n</ul>\n</li>\n<li>result: date-time</li>\n</ul>\n<pre><code class=\"language-
|
|
66
|
+
description: "<ul>\n<li>parameters:<ul>\n<li><code>date</code>: date / date-time</li>\n<li><code>time</code>: time</li>\n<li>or <code>from</code>: string</li>\n</ul>\n</li>\n<li>result: date-time</li>\n</ul>\n<pre><code class=\"language-feel\">date and time(date("2012-12-24"),time("T23:59:00"))\n// date and time("2012-12-24T23:59:00")\n\ndate and time(date and time("2012-12-25T11:00:00"),time("T23:59:00"))\n// date and time("2012-12-25T23:59:00")\n\ndate and time(birthday)\n// date and time("2018-04-29T009:30:00")\n</code></pre>\n"
|
|
67
67
|
},
|
|
68
68
|
{
|
|
69
69
|
name: "duration()",
|
|
70
|
-
description: "<ul>\n<li>parameters:<ul>\n<li><code>from</code>: string</li>\n</ul>\n</li>\n<li>result: day-time-duration or year-month-duration</li>\n</ul>\n<pre><code class=\"language-
|
|
70
|
+
description: "<ul>\n<li>parameters:<ul>\n<li><code>from</code>: string</li>\n</ul>\n</li>\n<li>result: day-time-duration or year-month-duration</li>\n</ul>\n<pre><code class=\"language-feel\">duration(weekDays)\n// duration("P5D")\n\nduration(age)\n// duration("P32Y")\n</code></pre>\n"
|
|
71
71
|
},
|
|
72
72
|
{
|
|
73
73
|
name: "years and months duration()",
|
|
74
|
-
description: "<ul>\n<li>parameters:<ul>\n<li><code>from</code>: date</li>\n<li><code>to</code>: date</li>\n</ul>\n</li>\n<li>result: year-month-duration</li>\n</ul>\n<pre><code class=\"language-
|
|
74
|
+
description: "<ul>\n<li>parameters:<ul>\n<li><code>from</code>: date</li>\n<li><code>to</code>: date</li>\n</ul>\n</li>\n<li>result: year-month-duration</li>\n</ul>\n<pre><code class=\"language-feel\">years and months duration(date("2011-12-22"), date("2013-08-24"))\n// duration("P1Y8M")\n</code></pre>\n"
|
|
75
75
|
},
|
|
76
76
|
{
|
|
77
77
|
name: "number()",
|
|
78
|
-
description: "<ul>\n<li>parameters:<ul>\n<li><code>from</code>: string</li>\n</ul>\n</li>\n<li>result: number</li>\n</ul>\n<pre><code class=\"language-
|
|
78
|
+
description: "<ul>\n<li>parameters:<ul>\n<li><code>from</code>: string</li>\n</ul>\n</li>\n<li>result: number</li>\n</ul>\n<pre><code class=\"language-feel\">number("1500.5")\n// 1500.5\n</code></pre>\n"
|
|
79
79
|
},
|
|
80
80
|
{
|
|
81
81
|
name: "string()",
|
|
82
|
-
description: "<ul>\n<li>parameters:<ul>\n<li><code>from</code>: any</li>\n</ul>\n</li>\n<li>result: string</li>\n</ul>\n<pre><code class=\"language-
|
|
82
|
+
description: "<ul>\n<li>parameters:<ul>\n<li><code>from</code>: any</li>\n</ul>\n</li>\n<li>result: string</li>\n</ul>\n<pre><code class=\"language-feel\">string(1.1)\n// "1.1"\n\nstring(date("2012-12-25"))\n// "2012-12-25"\n</code></pre>\n"
|
|
83
83
|
},
|
|
84
84
|
{
|
|
85
85
|
name: "context()",
|
|
86
|
-
description: "<p>Constructs a context of the given list of key-value pairs. It is the reverse function to <a href=\"feel-built-in-functions-context.md#get-entries\">get entries()</a>.</p>\n<p>Each key-value pair must be a context with two entries: <code>key</code> and <code>value</code>. The entry with name <code>key</code> must have a value of the type <code>string</code>.</p>\n<p>It might override context entries if the keys are equal. The entries are overridden in the same order as the contexts in the given list.</p>\n<p>Returns <code>null</code> if one of the entries is not a context or if a context doesn't contain the required entries.</p>\n<ul>\n<li>parameters:<ul>\n<li><code>entries</code>: list of contexts</li>\n</ul>\n</li>\n<li>result: context</li>\n</ul>\n<pre><code class=\"language-
|
|
86
|
+
description: "<p>Constructs a context of the given list of key-value pairs. It is the reverse function to <a href=\"feel-built-in-functions-context.md#get-entries\">get entries()</a>.</p>\n<p>Each key-value pair must be a context with two entries: <code>key</code> and <code>value</code>. The entry with name <code>key</code> must have a value of the type <code>string</code>.</p>\n<p>It might override context entries if the keys are equal. The entries are overridden in the same order as the contexts in the given list.</p>\n<p>Returns <code>null</code> if one of the entries is not a context or if a context doesn't contain the required entries.</p>\n<ul>\n<li>parameters:<ul>\n<li><code>entries</code>: list of contexts</li>\n</ul>\n</li>\n<li>result: context</li>\n</ul>\n<pre><code class=\"language-feel\">context([{"key":"a", "value":1}, {"key":"b", "value":2}])\n// {a:1, b:2}\n</code></pre>\n"
|
|
87
87
|
},
|
|
88
88
|
{
|
|
89
89
|
name: "list contains()",
|
|
90
|
-
description: "<ul>\n<li>parameters:<ul>\n<li><code>list</code>: list</li>\n<li><code>element</code>: any</li>\n</ul>\n</li>\n<li>result: boolean</li>\n</ul>\n<pre><code class=\"language-
|
|
90
|
+
description: "<ul>\n<li>parameters:<ul>\n<li><code>list</code>: list</li>\n<li><code>element</code>: any</li>\n</ul>\n</li>\n<li>result: boolean</li>\n</ul>\n<pre><code class=\"language-feel\">list contains([1,2,3], 2)\n// true\n</code></pre>\n"
|
|
91
91
|
},
|
|
92
92
|
{
|
|
93
93
|
name: "count()",
|
|
94
|
-
description: "<ul>\n<li>parameters:<ul>\n<li><code>list</code>: list</li>\n</ul>\n</li>\n<li>result: number</li>\n</ul>\n<pre><code class=\"language-
|
|
94
|
+
description: "<ul>\n<li>parameters:<ul>\n<li><code>list</code>: list</li>\n</ul>\n</li>\n<li>result: number</li>\n</ul>\n<pre><code class=\"language-feel\">count([1,2,3])\n// 3\n</code></pre>\n"
|
|
95
95
|
},
|
|
96
96
|
{
|
|
97
97
|
name: "min()",
|
|
98
|
-
description: "<ul>\n<li>parameters:<ul>\n<li><code>list</code>: list of numbers</li>\n<li>or numbers as varargs</li>\n</ul>\n</li>\n<li>result: number</li>\n</ul>\n<pre><code class=\"language-
|
|
98
|
+
description: "<ul>\n<li>parameters:<ul>\n<li><code>list</code>: list of numbers</li>\n<li>or numbers as varargs</li>\n</ul>\n</li>\n<li>result: number</li>\n</ul>\n<pre><code class=\"language-feel\">min([1,2,3])\n// 1\n\nmin(1,2,3)\n// 1\n</code></pre>\n"
|
|
99
99
|
},
|
|
100
100
|
{
|
|
101
101
|
name: "max()",
|
|
102
|
-
description: "<ul>\n<li>parameters:<ul>\n<li><code>list</code>: list of numbers</li>\n<li>or numbers as varargs</li>\n</ul>\n</li>\n<li>result: number</li>\n</ul>\n<pre><code class=\"language-
|
|
102
|
+
description: "<ul>\n<li>parameters:<ul>\n<li><code>list</code>: list of numbers</li>\n<li>or numbers as varargs</li>\n</ul>\n</li>\n<li>result: number</li>\n</ul>\n<pre><code class=\"language-feel\">max([1,2,3])\n// 3\n\nmax(1,2,3)\n// 3\n</code></pre>\n"
|
|
103
103
|
},
|
|
104
104
|
{
|
|
105
105
|
name: "sum()",
|
|
106
|
-
description: "<ul>\n<li>parameters:<ul>\n<li><code>list</code>: list of numbers</li>\n<li>or numbers as varargs</li>\n</ul>\n</li>\n<li>result: number</li>\n</ul>\n<pre><code class=\"language-
|
|
106
|
+
description: "<ul>\n<li>parameters:<ul>\n<li><code>list</code>: list of numbers</li>\n<li>or numbers as varargs</li>\n</ul>\n</li>\n<li>result: number</li>\n</ul>\n<pre><code class=\"language-feel\">sum([1,2,3])\n// 6\n\nsum(1,2,3)\n// 6\n</code></pre>\n"
|
|
107
107
|
},
|
|
108
108
|
{
|
|
109
109
|
name: "product()",
|
|
110
|
-
description: "<ul>\n<li>parameters:<ul>\n<li><code>list</code>: list of numbers</li>\n<li>or numbers as varargs</li>\n</ul>\n</li>\n<li>result: number</li>\n</ul>\n<pre><code class=\"language-
|
|
110
|
+
description: "<ul>\n<li>parameters:<ul>\n<li><code>list</code>: list of numbers</li>\n<li>or numbers as varargs</li>\n</ul>\n</li>\n<li>result: number</li>\n</ul>\n<pre><code class=\"language-feel\">product([2, 3, 4])\n// 24\n\nproduct(2, 3, 4)\n// 24\n</code></pre>\n"
|
|
111
111
|
},
|
|
112
112
|
{
|
|
113
113
|
name: "mean()",
|
|
114
|
-
description: "<p>Returns the arithmetic mean (i.e. average).</p>\n<ul>\n<li>parameters:<ul>\n<li><code>list</code>: list of numbers</li>\n<li>or numbers as varargs</li>\n</ul>\n</li>\n<li>result: number</li>\n</ul>\n<pre><code class=\"language-
|
|
114
|
+
description: "<p>Returns the arithmetic mean (i.e. average).</p>\n<ul>\n<li>parameters:<ul>\n<li><code>list</code>: list of numbers</li>\n<li>or numbers as varargs</li>\n</ul>\n</li>\n<li>result: number</li>\n</ul>\n<pre><code class=\"language-feel\">mean([1,2,3])\n// 2\n\nmean(1,2,3)\n// 2\n</code></pre>\n"
|
|
115
115
|
},
|
|
116
116
|
{
|
|
117
117
|
name: "median()",
|
|
118
|
-
description: "<p>Returns the median element of the list of numbers.</p>\n<ul>\n<li>parameters:<ul>\n<li><code>list</code>: list of numbers</li>\n<li>or numbers as varargs</li>\n</ul>\n</li>\n<li>result: number</li>\n</ul>\n<pre><code class=\"language-
|
|
118
|
+
description: "<p>Returns the median element of the list of numbers.</p>\n<ul>\n<li>parameters:<ul>\n<li><code>list</code>: list of numbers</li>\n<li>or numbers as varargs</li>\n</ul>\n</li>\n<li>result: number</li>\n</ul>\n<pre><code class=\"language-feel\">median(8, 2, 5, 3, 4)\n// 4\n\nmedian([6, 1, 2, 3])\n// 2.5\n</code></pre>\n"
|
|
119
119
|
},
|
|
120
120
|
{
|
|
121
121
|
name: "stddev()",
|
|
122
|
-
description: "<p>Returns the standard deviation.</p>\n<ul>\n<li>parameters:<ul>\n<li><code>list</code>: list of numbers</li>\n<li>or numbers as varargs</li>\n</ul>\n</li>\n<li>result: number</li>\n</ul>\n<pre><code class=\"language-
|
|
122
|
+
description: "<p>Returns the standard deviation.</p>\n<ul>\n<li>parameters:<ul>\n<li><code>list</code>: list of numbers</li>\n<li>or numbers as varargs</li>\n</ul>\n</li>\n<li>result: number</li>\n</ul>\n<pre><code class=\"language-feel\">stddev(2, 4, 7, 5)\n// 2.0816659994661326\n\nstddev([2, 4, 7, 5])\n// 2.0816659994661326\n</code></pre>\n"
|
|
123
123
|
},
|
|
124
124
|
{
|
|
125
125
|
name: "mode()",
|
|
126
|
-
description: "<p>Returns the mode of the list of numbers.</p>\n<ul>\n<li>parameters:<ul>\n<li><code>list</code>: list of numbers</li>\n<li>or numbers as varargs</li>\n</ul>\n</li>\n<li>result: list of numbers</li>\n</ul>\n<pre><code class=\"language-
|
|
126
|
+
description: "<p>Returns the mode of the list of numbers.</p>\n<ul>\n<li>parameters:<ul>\n<li><code>list</code>: list of numbers</li>\n<li>or numbers as varargs</li>\n</ul>\n</li>\n<li>result: list of numbers</li>\n</ul>\n<pre><code class=\"language-feel\">mode(6, 3, 9, 6, 6)\n// [6]\n\nmode([6, 1, 9, 6, 1])\n// [1, 6]\n</code></pre>\n"
|
|
127
127
|
},
|
|
128
128
|
{
|
|
129
129
|
name: "and()",
|
|
130
|
-
description: "<ul>\n<li>parameters:<ul>\n<li><code>list</code>: list of booleans</li>\n<li>or booleans as varargs</li>\n</ul>\n</li>\n<li>result: boolean</li>\n</ul>\n<pre><code class=\"language-
|
|
130
|
+
description: "<ul>\n<li>parameters:<ul>\n<li><code>list</code>: list of booleans</li>\n<li>or booleans as varargs</li>\n</ul>\n</li>\n<li>result: boolean</li>\n</ul>\n<pre><code class=\"language-feel\">and([true,false])\n// false\n\nand(false,null,true)\n// false\n</code></pre>\n"
|
|
131
131
|
},
|
|
132
132
|
{
|
|
133
133
|
name: "all()",
|
|
134
|
-
description: "<ul>\n<li>parameters:<ul>\n<li><code>list</code>: list of booleans</li>\n<li>or booleans as varargs</li>\n</ul>\n</li>\n<li>result: boolean</li>\n</ul>\n<pre><code class=\"language-
|
|
134
|
+
description: "<ul>\n<li>parameters:<ul>\n<li><code>list</code>: list of booleans</li>\n<li>or booleans as varargs</li>\n</ul>\n</li>\n<li>result: boolean</li>\n</ul>\n<pre><code class=\"language-feel\">and([true,false])\n// false\n\nand(false,null,true)\n// false\n</code></pre>\n"
|
|
135
135
|
},
|
|
136
136
|
{
|
|
137
137
|
name: "or()",
|
|
138
|
-
description: "<ul>\n<li>parameters:<ul>\n<li><code>list</code>: list of booleans</li>\n<li>or booleans as varargs</li>\n</ul>\n</li>\n<li>result: boolean</li>\n</ul>\n<pre><code class=\"language-
|
|
138
|
+
description: "<ul>\n<li>parameters:<ul>\n<li><code>list</code>: list of booleans</li>\n<li>or booleans as varargs</li>\n</ul>\n</li>\n<li>result: boolean</li>\n</ul>\n<pre><code class=\"language-feel\">or([false,true])\n// true\n\nor(false,null,true)\n// true\n</code></pre>\n"
|
|
139
139
|
},
|
|
140
140
|
{
|
|
141
141
|
name: "any()",
|
|
142
|
-
description: "<ul>\n<li>parameters:<ul>\n<li><code>list</code>: list of booleans</li>\n<li>or booleans as varargs</li>\n</ul>\n</li>\n<li>result: boolean</li>\n</ul>\n<pre><code class=\"language-
|
|
142
|
+
description: "<ul>\n<li>parameters:<ul>\n<li><code>list</code>: list of booleans</li>\n<li>or booleans as varargs</li>\n</ul>\n</li>\n<li>result: boolean</li>\n</ul>\n<pre><code class=\"language-feel\">or([false,true])\n// true\n\nor(false,null,true)\n// true\n</code></pre>\n"
|
|
143
143
|
},
|
|
144
144
|
{
|
|
145
145
|
name: "sublist()",
|
|
146
|
-
description: "<ul>\n<li>parameters:<ul>\n<li><code>list</code>: list</li>\n<li><code>start position</code>: number</li>\n<li>(optional) <code>length</code>: number</li>\n</ul>\n</li>\n<li>result: list</li>\n</ul>\n<pre><code class=\"language-
|
|
146
|
+
description: "<ul>\n<li>parameters:<ul>\n<li><code>list</code>: list</li>\n<li><code>start position</code>: number</li>\n<li>(optional) <code>length</code>: number</li>\n</ul>\n</li>\n<li>result: list</li>\n</ul>\n<pre><code class=\"language-feel\">sublist([1,2,3], 2)\n// [2,3]\n\nsublist([1,2,3], 1, 2)\n// [1,2]\n</code></pre>\n"
|
|
147
147
|
},
|
|
148
148
|
{
|
|
149
149
|
name: "append()",
|
|
150
|
-
description: "<ul>\n<li>parameters:<ul>\n<li><code>list</code>: list</li>\n<li><code>items</code>: elements as varargs</li>\n</ul>\n</li>\n<li>result: list</li>\n</ul>\n<pre><code class=\"language-
|
|
150
|
+
description: "<ul>\n<li>parameters:<ul>\n<li><code>list</code>: list</li>\n<li><code>items</code>: elements as varargs</li>\n</ul>\n</li>\n<li>result: list</li>\n</ul>\n<pre><code class=\"language-feel\">append([1], 2, 3)\n// [1,2,3]\n</code></pre>\n"
|
|
151
151
|
},
|
|
152
152
|
{
|
|
153
153
|
name: "concatenate()",
|
|
154
|
-
description: "<ul>\n<li>parameters:<ul>\n<li><code>lists</code>: lists as varargs</li>\n</ul>\n</li>\n<li>result: list</li>\n</ul>\n<pre><code class=\"language-
|
|
154
|
+
description: "<ul>\n<li>parameters:<ul>\n<li><code>lists</code>: lists as varargs</li>\n</ul>\n</li>\n<li>result: list</li>\n</ul>\n<pre><code class=\"language-feel\">concatenate([1,2],[3])\n// [1,2,3]\n\nconcatenate([1],[2],[3])\n// [1,2,3]\n</code></pre>\n"
|
|
155
155
|
},
|
|
156
156
|
{
|
|
157
157
|
name: "insert before()",
|
|
158
|
-
description: "<ul>\n<li>parameters:<ul>\n<li><code>list</code>: list</li>\n<li><code>position</code>: number</li>\n<li><code>newItem</code>: any</li>\n</ul>\n</li>\n<li>result: list</li>\n</ul>\n<pre><code class=\"language-
|
|
158
|
+
description: "<ul>\n<li>parameters:<ul>\n<li><code>list</code>: list</li>\n<li><code>position</code>: number</li>\n<li><code>newItem</code>: any</li>\n</ul>\n</li>\n<li>result: list</li>\n</ul>\n<pre><code class=\"language-feel\">insert before([1,3],1,2)\n// [1,2,3]\n</code></pre>\n"
|
|
159
159
|
},
|
|
160
160
|
{
|
|
161
161
|
name: "remove()",
|
|
162
|
-
description: "<ul>\n<li>parameters:<ul>\n<li><code>list</code>: list</li>\n<li><code>position</code>: number</li>\n</ul>\n</li>\n<li>result: list</li>\n</ul>\n<pre><code class=\"language-
|
|
162
|
+
description: "<ul>\n<li>parameters:<ul>\n<li><code>list</code>: list</li>\n<li><code>position</code>: number</li>\n</ul>\n</li>\n<li>result: list</li>\n</ul>\n<pre><code class=\"language-feel\">remove([1,2,3], 2)\n// [1,3]\n</code></pre>\n"
|
|
163
163
|
},
|
|
164
164
|
{
|
|
165
165
|
name: "reverse()",
|
|
166
|
-
description: "<ul>\n<li>parameters:<ul>\n<li><code>list</code>: list</li>\n</ul>\n</li>\n<li>result: list</li>\n</ul>\n<pre><code class=\"language-
|
|
166
|
+
description: "<ul>\n<li>parameters:<ul>\n<li><code>list</code>: list</li>\n</ul>\n</li>\n<li>result: list</li>\n</ul>\n<pre><code class=\"language-feel\">reverse([1,2,3])\n// [3,2,1]\n</code></pre>\n"
|
|
167
167
|
},
|
|
168
168
|
{
|
|
169
169
|
name: "index of()",
|
|
170
|
-
description: "<ul>\n<li>parameters:<ul>\n<li><code>list</code>: list</li>\n<li><code>match</code>: any</li>\n</ul>\n</li>\n<li>result: list of numbers</li>\n</ul>\n<pre><code class=\"language-
|
|
170
|
+
description: "<ul>\n<li>parameters:<ul>\n<li><code>list</code>: list</li>\n<li><code>match</code>: any</li>\n</ul>\n</li>\n<li>result: list of numbers</li>\n</ul>\n<pre><code class=\"language-feel\">index of([1,2,3,2],2)\n// [2,4]\n</code></pre>\n"
|
|
171
171
|
},
|
|
172
172
|
{
|
|
173
173
|
name: "union()",
|
|
174
|
-
description: "<ul>\n<li>parameters:<ul>\n<li><code>lists</code>: lists as varargs</li>\n</ul>\n</li>\n<li>result: list</li>\n</ul>\n<pre><code class=\"language-
|
|
174
|
+
description: "<ul>\n<li>parameters:<ul>\n<li><code>lists</code>: lists as varargs</li>\n</ul>\n</li>\n<li>result: list</li>\n</ul>\n<pre><code class=\"language-feel\">union([1,2],[2,3])\n// [1,2,3]\n</code></pre>\n"
|
|
175
175
|
},
|
|
176
176
|
{
|
|
177
177
|
name: "distinct values()",
|
|
178
|
-
description: "<ul>\n<li>parameters:<ul>\n<li><code>list</code>: list</li>\n</ul>\n</li>\n<li>result: list</li>\n</ul>\n<pre><code class=\"language-
|
|
178
|
+
description: "<ul>\n<li>parameters:<ul>\n<li><code>list</code>: list</li>\n</ul>\n</li>\n<li>result: list</li>\n</ul>\n<pre><code class=\"language-feel\">distinct values([1,2,3,2,1])\n// [1,2,3]\n</code></pre>\n"
|
|
179
179
|
},
|
|
180
180
|
{
|
|
181
181
|
name: "flatten()",
|
|
182
|
-
description: "<ul>\n<li>parameters:<ul>\n<li><code>list</code>: list</li>\n</ul>\n</li>\n<li>result: list</li>\n</ul>\n<pre><code class=\"language-
|
|
182
|
+
description: "<ul>\n<li>parameters:<ul>\n<li><code>list</code>: list</li>\n</ul>\n</li>\n<li>result: list</li>\n</ul>\n<pre><code class=\"language-feel\">flatten([[1,2],[[3]], 4])\n// [1,2,3,4]\n</code></pre>\n"
|
|
183
183
|
},
|
|
184
184
|
{
|
|
185
185
|
name: "sort()",
|
|
186
|
-
description: "<ul>\n<li>parameters:<ul>\n<li><code>list</code>: list</li>\n<li><code>precedes</code>: function with two arguments and boolean result</li>\n</ul>\n</li>\n<li>result: list</li>\n</ul>\n<pre><code class=\"language-
|
|
186
|
+
description: "<ul>\n<li>parameters:<ul>\n<li><code>list</code>: list</li>\n<li><code>precedes</code>: function with two arguments and boolean result</li>\n</ul>\n</li>\n<li>result: list</li>\n</ul>\n<pre><code class=\"language-feel\">sort(list: [3,1,4,5,2], precedes: function(x,y) x < y)\n// [1,2,3,4,5]\n</code></pre>\n"
|
|
187
187
|
},
|
|
188
188
|
{
|
|
189
189
|
name: "string join()",
|
|
190
|
-
description: "<p>This joins a list of strings into a single string. This is similar to\nJava's <a href=\"https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/stream/Collectors.html#joining(java.lang.CharSequence,java.lang.CharSequence,java.lang.CharSequence)\">joining</a>\nfunction.</p>\n<p>If an item of the list is <code>null</code>, the item is ignored for the result string. If an item is\nneither a string nor <code>null</code>, the function returns <code>null</code> instead of a string.</p>\n<ul>\n<li>Parameters:<ul>\n<li><code>list</code>: The list of strings to join</li>\n<li><code>delimiter</code>: (Optional) The string used between each element (default: empty string)</li>\n<li><code>prefix</code>: (Optional) The string used at the beginning of the joined result (default:\nempty string)</li>\n<li><code>suffix</code>: (Optional) The string used at the end of the joined result (default: empty\nstring)</li>\n</ul>\n</li>\n<li>Result: The joined list as a string</li>\n</ul>\n<pre><code class=\"language-
|
|
190
|
+
description: "<p>This joins a list of strings into a single string. This is similar to\nJava's <a href=\"https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/stream/Collectors.html#joining(java.lang.CharSequence,java.lang.CharSequence,java.lang.CharSequence)\">joining</a>\nfunction.</p>\n<p>If an item of the list is <code>null</code>, the item is ignored for the result string. If an item is\nneither a string nor <code>null</code>, the function returns <code>null</code> instead of a string.</p>\n<ul>\n<li>Parameters:<ul>\n<li><code>list</code>: The list of strings to join</li>\n<li><code>delimiter</code>: (Optional) The string used between each element (default: empty string)</li>\n<li><code>prefix</code>: (Optional) The string used at the beginning of the joined result (default:\nempty string)</li>\n<li><code>suffix</code>: (Optional) The string used at the end of the joined result (default: empty\nstring)</li>\n</ul>\n</li>\n<li>Result: The joined list as a string</li>\n</ul>\n<pre><code class=\"language-feel\">string join(["a","b","c"])\n// "abc"\nstring join(["a"], "X")\n// "a"\nstring join(["a","b","c"], ", ")\n// "a, b, c"\nstring join(["a","b","c"], ", ", "[", "]")\n// "[a, b, c]"\nstring join(["a",null,"c"])\n// "ac"\nstring join([])\n// ""\n</code></pre>\n"
|
|
191
191
|
},
|
|
192
192
|
{
|
|
193
193
|
name: "decimal()",
|
|
194
|
-
description: "<p>Round the given number at the given scale using the given rounding mode. If no rounding mode is passed in, it uses <code>HALF_EVEN</code> as default.</p>\n<ul>\n<li>parameters:<ul>\n<li><code>n</code>: number</li>\n<li><code>scale</code>: number</li>\n<li>(optional) <code>mode</code>: string - one of <code>UP, DOWN, CEILING, FLOOR, HALF_UP, HALF_DOWN, HALF_EVEN, UNNECESSARY</code> (default: <code>HALF_EVEN</code>)</li>\n</ul>\n</li>\n<li>result: number</li>\n</ul>\n<pre><code class=\"language-
|
|
194
|
+
description: "<p>Round the given number at the given scale using the given rounding mode. If no rounding mode is passed in, it uses <code>HALF_EVEN</code> as default.</p>\n<ul>\n<li>parameters:<ul>\n<li><code>n</code>: number</li>\n<li><code>scale</code>: number</li>\n<li>(optional) <code>mode</code>: string - one of <code>UP, DOWN, CEILING, FLOOR, HALF_UP, HALF_DOWN, HALF_EVEN, UNNECESSARY</code> (default: <code>HALF_EVEN</code>)</li>\n</ul>\n</li>\n<li>result: number</li>\n</ul>\n<pre><code class=\"language-feel\">decimal(1/3, 2)\n// .33\n\ndecimal(1.5, 0)\n// 2\n\ndecimal(2.5, 0, "half_up")\n// 3\n</code></pre>\n"
|
|
195
195
|
},
|
|
196
196
|
{
|
|
197
197
|
name: "floor()",
|
|
198
|
-
description: "<ul>\n<li>parameters:<ul>\n<li><code>n</code>: number</li>\n</ul>\n</li>\n<li>result: number</li>\n</ul>\n<pre><code class=\"language-
|
|
198
|
+
description: "<ul>\n<li>parameters:<ul>\n<li><code>n</code>: number</li>\n</ul>\n</li>\n<li>result: number</li>\n</ul>\n<pre><code class=\"language-feel\">floor(1.5)\n// 1\n\nfloor(-1.5)\n// -2\n</code></pre>\n"
|
|
199
199
|
},
|
|
200
200
|
{
|
|
201
201
|
name: "ceiling()",
|
|
202
|
-
description: "<ul>\n<li>parameters:<ul>\n<li><code>n</code>: number</li>\n</ul>\n</li>\n<li>result: number</li>\n</ul>\n<pre><code class=\"language-
|
|
202
|
+
description: "<p>Round the given number at the given scale using the ceiling rounding mode.</p>\n<ul>\n<li>parameters:<ul>\n<li><code>n</code>: number</li>\n</ul>\n</li>\n<li>result: number</li>\n</ul>\n<pre><code class=\"language-feel\">ceiling(1.5)\n// 2\n\nceiling(-1.5)\n// -1\n</code></pre>\n"
|
|
203
203
|
},
|
|
204
204
|
{
|
|
205
205
|
name: "abs()",
|
|
206
|
-
description: "<ul>\n<li>parameters:<ul>\n<li><code>number</code>: number</li>\n</ul>\n</li>\n<li>result: number</li>\n</ul>\n<pre><code class=\"language-
|
|
206
|
+
description: "<p>Returns the absolute value of the given numeric value.</p>\n<ul>\n<li>parameters:<ul>\n<li><code>number</code>: number</li>\n</ul>\n</li>\n<li>result: number</li>\n</ul>\n<pre><code class=\"language-feel\">abs(10)\n// 10\n\nabs(-10)\n// 10\n</code></pre>\n"
|
|
207
207
|
},
|
|
208
208
|
{
|
|
209
209
|
name: "modulo()",
|
|
210
|
-
description: "<p>Returns the remainder of the division of dividend by divisor.</p>\n<ul>\n<li>parameters:<ul>\n<li><code>dividend</code>: number</li>\n<li><code>divisor</code>: number</li>\n</ul>\n</li>\n<li>result: number</li>\n</ul>\n<pre><code class=\"language-
|
|
210
|
+
description: "<p>Returns the remainder of the division of dividend by divisor.</p>\n<ul>\n<li>parameters:<ul>\n<li><code>dividend</code>: number</li>\n<li><code>divisor</code>: number</li>\n</ul>\n</li>\n<li>result: number</li>\n</ul>\n<pre><code class=\"language-feel\">modulo(12, 5)\n// 2\n</code></pre>\n"
|
|
211
211
|
},
|
|
212
212
|
{
|
|
213
213
|
name: "sqrt()",
|
|
214
|
-
description: "<p>Returns the square root.</p>\n<ul>\n<li>parameters:<ul>\n<li><code>number</code>: number</li>\n</ul>\n</li>\n<li>result: number</li>\n</ul>\n<pre><code class=\"language-
|
|
214
|
+
description: "<p>Returns the square root.</p>\n<ul>\n<li>parameters:<ul>\n<li><code>number</code>: number</li>\n</ul>\n</li>\n<li>result: number</li>\n</ul>\n<pre><code class=\"language-feel\">sqrt(16)\n// 4\n</code></pre>\n"
|
|
215
215
|
},
|
|
216
216
|
{
|
|
217
217
|
name: "log()",
|
|
218
|
-
description: "<p>Returns the natural logarithm (base e) of the number.</p>\n<ul>\n<li>parameters:<ul>\n<li><code>number</code>: number</li>\n</ul>\n</li>\n<li>result: number</li>\n</ul>\n<pre><code class=\"language-
|
|
218
|
+
description: "<p>Returns the natural logarithm (base e) of the number.</p>\n<ul>\n<li>parameters:<ul>\n<li><code>number</code>: number</li>\n</ul>\n</li>\n<li>result: number</li>\n</ul>\n<pre><code class=\"language-feel\">log(10)\n// 2.302585092994046\n</code></pre>\n"
|
|
219
219
|
},
|
|
220
220
|
{
|
|
221
221
|
name: "exp()",
|
|
222
|
-
description: "<p>Returns the Euler’s number e raised to the power of number .</p>\n<ul>\n<li>parameters:<ul>\n<li><code>number</code>: number</li>\n</ul>\n</li>\n<li>result: number</li>\n</ul>\n<pre><code class=\"language-
|
|
222
|
+
description: "<p>Returns the Euler’s number e raised to the power of number .</p>\n<ul>\n<li>parameters:<ul>\n<li><code>number</code>: number</li>\n</ul>\n</li>\n<li>result: number</li>\n</ul>\n<pre><code class=\"language-feel\">exp(5)\n// 148.4131591025766\n</code></pre>\n"
|
|
223
223
|
},
|
|
224
224
|
{
|
|
225
225
|
name: "odd()",
|
|
226
|
-
description: "<ul>\n<li>parameters:<ul>\n<li><code>number</code>: number</li>\n</ul>\n</li>\n<li>result: boolean</li>\n</ul>\n<pre><code class=\"language-
|
|
226
|
+
description: "<p>Returns <code>true</code> if the given numeric value is odd. Otherwise, it returns <code>false</code>.</p>\n<ul>\n<li>parameters:<ul>\n<li><code>number</code>: number</li>\n</ul>\n</li>\n<li>result: boolean</li>\n</ul>\n<pre><code class=\"language-feel\">odd(5)\n// true\n\nodd(2)\n// false\n</code></pre>\n"
|
|
227
227
|
},
|
|
228
228
|
{
|
|
229
229
|
name: "even()",
|
|
230
|
-
description: "<ul>\n<li>parameters:<ul>\n<li><code>number</code>: number</li>\n</ul>\n</li>\n<li>result: boolean</li>\n</ul>\n<pre><code class=\"language-
|
|
230
|
+
description: "<p>Returns <code>true</code> if the given numeric value is even. Otherwise, it returns <code>false</code>.</p>\n<ul>\n<li>parameters:<ul>\n<li><code>number</code>: number</li>\n</ul>\n</li>\n<li>result: boolean</li>\n</ul>\n<pre><code class=\"language-feel\">even(5)\n// false\n\neven(2)\n// true\n</code></pre>\n"
|
|
231
231
|
},
|
|
232
232
|
{
|
|
233
233
|
name: "before()",
|
|
234
|
-
description: "<ul>\n<li>parameters:<ul>\n<li><code>point1</code>, <code>point2</code>: any</li>\n<li>or <code>range</code>: range, <code>point</code>: any</li>\n<li>or <code>point</code>: any, <code>range</code>: range</li>\n<li>or <code>range1</code>, <code>range2</code>: range</li>\n</ul>\n</li>\n<li>result: boolean</li>\n</ul>\n<pre><code class=\"language-
|
|
234
|
+
description: "<ul>\n<li>parameters:<ul>\n<li><code>point1</code>, <code>point2</code>: any</li>\n<li>or <code>range</code>: range, <code>point</code>: any</li>\n<li>or <code>point</code>: any, <code>range</code>: range</li>\n<li>or <code>range1</code>, <code>range2</code>: range</li>\n</ul>\n</li>\n<li>result: boolean</li>\n</ul>\n<pre><code class=\"language-feel\">before(1, 10)\n// true\n\nbefore(10, 1)\n// false\n\nbefore(1, [2..5])\n// true\n\nbefore([1..5], 10)\n// true\n\nbefore([1..5], [6..10])\n// true\n\nbefore([1..5),[5..10])\n// true\n</code></pre>\n"
|
|
235
235
|
},
|
|
236
236
|
{
|
|
237
237
|
name: "after()",
|
|
238
|
-
description: "<ul>\n<li>parameters:<ul>\n<li><code>point1</code>, <code>point2</code>: any</li>\n<li>or <code>range</code>: range, <code>point</code>: any</li>\n<li>or <code>point</code>: any, <code>range</code>: range</li>\n<li>or <code>range1</code>, <code>range2</code>: range</li>\n</ul>\n</li>\n<li>result: boolean</li>\n</ul>\n<pre><code class=\"language-
|
|
238
|
+
description: "<ul>\n<li>parameters:<ul>\n<li><code>point1</code>, <code>point2</code>: any</li>\n<li>or <code>range</code>: range, <code>point</code>: any</li>\n<li>or <code>point</code>: any, <code>range</code>: range</li>\n<li>or <code>range1</code>, <code>range2</code>: range</li>\n</ul>\n</li>\n<li>result: boolean</li>\n</ul>\n<pre><code class=\"language-feel\">after(10, 1)\n// true\n\nafter(1, 10)\n// false\n\nafter(12, [2..5])\n// true\n\n([1..5], 10)\n// false\n\nbefore([6..10], [1..5])\n// true\n\nbefore([5..10], [1..5))\n// true\n</code></pre>\n"
|
|
239
239
|
},
|
|
240
240
|
{
|
|
241
241
|
name: "meets()",
|
|
242
|
-
description: "<ul>\n<li>parameters:<ul>\n<li><code>range1</code>: range</li>\n<li><code>range2</code>: range</li>\n</ul>\n</li>\n<li>result: boolean</li>\n</ul>\n<pre><code class=\"language-
|
|
242
|
+
description: "<ul>\n<li>parameters:<ul>\n<li><code>range1</code>: range</li>\n<li><code>range2</code>: range</li>\n</ul>\n</li>\n<li>result: boolean</li>\n</ul>\n<pre><code class=\"language-feel\">meets([1..5], [5..10])\n// true\n\nmeets([1..3], [4..6])\n// false\n\nmeets([1..3], [3..5])\n// true\n\nmeets([1..5], (5..8])\n// false\n</code></pre>\n"
|
|
243
243
|
},
|
|
244
244
|
{
|
|
245
245
|
name: "met by()",
|
|
246
|
-
description: "<ul>\n<li>parameters:<ul>\n<li><code>range1</code>: range</li>\n<li><code>range2</code>: range</li>\n</ul>\n</li>\n<li>result: boolean</li>\n</ul>\n<pre><code class=\"language-
|
|
246
|
+
description: "<ul>\n<li>parameters:<ul>\n<li><code>range1</code>: range</li>\n<li><code>range2</code>: range</li>\n</ul>\n</li>\n<li>result: boolean</li>\n</ul>\n<pre><code class=\"language-feel\">met by([5..10], [1..5])\n// true\n\nmet by([3..4], [1..2])\n// false\n\nmet by([3..5], [1..3])\n// true\n\nmet by((5..8], [1..5))\n// false\n\nmet by([5..10], [1..5))\n// false\n</code></pre>\n"
|
|
247
247
|
},
|
|
248
248
|
{
|
|
249
249
|
name: "overlaps()",
|
|
250
|
-
description: "<ul>\n<li>parameters:<ul>\n<li><code>range1</code>: range</li>\n<li><code>range2</code>: range</li>\n</ul>\n</li>\n<li>result: boolean</li>\n</ul>\n<pre><code class=\"language-
|
|
250
|
+
description: "<ul>\n<li>parameters:<ul>\n<li><code>range1</code>: range</li>\n<li><code>range2</code>: range</li>\n</ul>\n</li>\n<li>result: boolean</li>\n</ul>\n<pre><code class=\"language-feel\">overlaps([5..10], [1..6])\n// true\n\noverlaps((3..7], [1..4])\n// true\n\noverlaps([1..3], (3..6])\n// false\n\noverlaps((5..8], [1..5))\n// false\n\noverlaps([4..10], [1..5))\n// treu\n</code></pre>\n"
|
|
251
251
|
},
|
|
252
252
|
{
|
|
253
253
|
name: "overlaps before()",
|
|
254
|
-
description: "<ul>\n<li>parameters:<ul>\n<li><code>range1</code>: range</li>\n<li><code>range2</code>: range</li>\n</ul>\n</li>\n<li>result: boolean</li>\n</ul>\n<pre><code class=\"language-
|
|
254
|
+
description: "<ul>\n<li>parameters:<ul>\n<li><code>range1</code>: range</li>\n<li><code>range2</code>: range</li>\n</ul>\n</li>\n<li>result: boolean</li>\n</ul>\n<pre><code class=\"language-feel\">overlaps before([1..5], [4..10])\n// true\n\noverlaps before([3..4], [1..2])\n// false\n\noverlaps before([1..3], (3..5])\n// false\n\noverlaps before([1..5), (3..8])\n// true\n\noverlaps before([1..5), [5..10])\n// false\n</code></pre>\n"
|
|
255
255
|
},
|
|
256
256
|
{
|
|
257
257
|
name: "overlaps after()",
|
|
258
|
-
description: "<ul>\n<li>parameters:<ul>\n<li><code>range1</code>: range</li>\n<li><code>range2</code>: range</li>\n</ul>\n</li>\n<li>result: boolean</li>\n</ul>\n<pre><code class=\"language-
|
|
258
|
+
description: "<ul>\n<li>parameters:<ul>\n<li><code>range1</code>: range</li>\n<li><code>range2</code>: range</li>\n</ul>\n</li>\n<li>result: boolean</li>\n</ul>\n<pre><code class=\"language-feel\">overlaps after([4..10], [1..5])\n// true\n\noverlaps after([3..4], [1..2])\n// false\n\noverlaps after([3..5], [1..3))\n// false\n\noverlaps after((5..8], [1..5))\n// false\n\noverlaps after([4..10], [1..5))\n// true\n</code></pre>\n"
|
|
259
259
|
},
|
|
260
260
|
{
|
|
261
261
|
name: "finishes()",
|
|
262
|
-
description: "<ul>\n<li>parameters:<ul>\n<li><code>point</code>: any, <code>range</code>: range</li>\n<li>or <code>range1</code>, <code>range2</code>: range</li>\n</ul>\n</li>\n<li>result: boolean</li>\n</ul>\n<pre><code class=\"language-
|
|
262
|
+
description: "<ul>\n<li>parameters:<ul>\n<li><code>point</code>: any, <code>range</code>: range</li>\n<li>or <code>range1</code>, <code>range2</code>: range</li>\n</ul>\n</li>\n<li>result: boolean</li>\n</ul>\n<pre><code class=\"language-feel\">finishes(5, [1..5])\n// true\n\nfinishes(10, [1..7])\n// false\n\nfinishes([3..5], [1..5])\n// true\n\nfinishes((1..5], [1..5))\n// false\n\nfinishes([5..10], [1..10))\n// false\n</code></pre>\n"
|
|
263
263
|
},
|
|
264
264
|
{
|
|
265
265
|
name: "finished by()",
|
|
266
|
-
description: "<ul>\n<li>parameters:<ul>\n<li><code>range</code>: range, <code>point</code>: any</li>\n<li>or <code>range1</code>, <code>range2</code>: range</li>\n</ul>\n</li>\n<li>result: boolean</li>\n</ul>\n<pre><code class=\"language-
|
|
266
|
+
description: "<ul>\n<li>parameters:<ul>\n<li><code>range</code>: range, <code>point</code>: any</li>\n<li>or <code>range1</code>, <code>range2</code>: range</li>\n</ul>\n</li>\n<li>result: boolean</li>\n</ul>\n<pre><code class=\"language-feel\">finishes by([5..10], 10)\n// true\n\nfinishes by([3..4], 2)\n// false\n\nfinishes by([3..5], [1..5])\n// true\n\nfinishes by((5..8], [1..5))\n// false\n\nfinishes by([5..10], (1..10))\n// true\n</code></pre>\n"
|
|
267
267
|
},
|
|
268
268
|
{
|
|
269
269
|
name: "includes()",
|
|
270
|
-
description: "<ul>\n<li>parameters:<ul>\n<li><code>range</code>: range, <code>point</code>: any</li>\n<li>or <code>range1</code>, <code>range2</code>: range</li>\n</ul>\n</li>\n<li>result: boolean</li>\n</ul>\n<pre><code class=\"language-
|
|
270
|
+
description: "<ul>\n<li>parameters:<ul>\n<li><code>range</code>: range, <code>point</code>: any</li>\n<li>or <code>range1</code>, <code>range2</code>: range</li>\n</ul>\n</li>\n<li>result: boolean</li>\n</ul>\n<pre><code class=\"language-feel\">includes([5..10], 6)\n// true\n\nincludes([3..4], 5)\n// false\n\nincludes([1..10], [4..6])\n// true\n\nincludes((5..8], [1..5))\n// false\n\nincludes([1..10], [1..5))\n// true\n</code></pre>\n"
|
|
271
271
|
},
|
|
272
272
|
{
|
|
273
273
|
name: "during()",
|
|
274
|
-
description: "<ul>\n<li>parameters:<ul>\n<li><code>point</code>: any, <code>range</code>: range</li>\n<li>or <code>range1</code>, <code>range2</code>: range</li>\n</ul>\n</li>\n<li>result: boolean</li>\n</ul>\n<pre><code class=\"language-
|
|
274
|
+
description: "<ul>\n<li>parameters:<ul>\n<li><code>point</code>: any, <code>range</code>: range</li>\n<li>or <code>range1</code>, <code>range2</code>: range</li>\n</ul>\n</li>\n<li>result: boolean</li>\n</ul>\n<pre><code class=\"language-feel\">during(5, [1..10])\n// true\n\nduring(12, [1..10])\n// false\n\nduring(1, (1..10])\n// false\n\nduring([4..6], [1..10))\n// true\n\nduring((1..5], (1..10])\n// true\n</code></pre>\n"
|
|
275
275
|
},
|
|
276
276
|
{
|
|
277
277
|
name: "starts()",
|
|
278
|
-
description: "<ul>\n<li>parameters:<ul>\n<li><code>point</code>: any, <code>range</code>: range</li>\n<li>or <code>range1</code>, <code>range2</code>: range</li>\n</ul>\n</li>\n<li>result: boolean</li>\n</ul>\n<pre><code class=\"language-
|
|
278
|
+
description: "<ul>\n<li>parameters:<ul>\n<li><code>point</code>: any, <code>range</code>: range</li>\n<li>or <code>range1</code>, <code>range2</code>: range</li>\n</ul>\n</li>\n<li>result: boolean</li>\n</ul>\n<pre><code class=\"language-feel\">starts(1, [1..5])\n// true\n\nstarts(1, (1..8])\n// false\n\nstarts((1..5], [1..5])\n// false\n\nstarts([1..10], [1..10])\n// true\n\nstarts((1..10), (1..10))\n// true\n</code></pre>\n"
|
|
279
279
|
},
|
|
280
280
|
{
|
|
281
281
|
name: "started by()",
|
|
282
|
-
description: "<ul>\n<li>parameters:<ul>\n<li><code>range</code>: range, <code>point</code>: any</li>\n<li>or <code>range1</code>, <code>range2</code>: range</li>\n</ul>\n</li>\n<li>result: boolean</li>\n</ul>\n<pre><code class=\"language-
|
|
282
|
+
description: "<ul>\n<li>parameters:<ul>\n<li><code>range</code>: range, <code>point</code>: any</li>\n<li>or <code>range1</code>, <code>range2</code>: range</li>\n</ul>\n</li>\n<li>result: boolean</li>\n</ul>\n<pre><code class=\"language-feel\">started by([1..10], 1)\n// true\n\nstarted by((1..10], 1)\n// false\n\nstarted by([1..10], [1..5])\n// true\n\nstarted by((1..10], [1..5))\n// false\n\nstarted by([1..10], [1..10))\n// true\n</code></pre>\n"
|
|
283
283
|
},
|
|
284
284
|
{
|
|
285
285
|
name: "coincides()",
|
|
286
|
-
description: "<ul>\n<li>parameters:<ul>\n<li><code>point1</code>, <code>point2</code>: any</li>\n<li>or <code>range1</code>, <code>range2</code>: range</li>\n</ul>\n</li>\n<li>result: boolean</li>\n</ul>\n<pre><code class=\"language-
|
|
286
|
+
description: "<ul>\n<li>parameters:<ul>\n<li><code>point1</code>, <code>point2</code>: any</li>\n<li>or <code>range1</code>, <code>range2</code>: range</li>\n</ul>\n</li>\n<li>result: boolean</li>\n</ul>\n<pre><code class=\"language-feel\">coincides(5, 5)\n// true\n\ncoincides(3, 4)\n// false\n\ncoincides([1..5], [1..5])\n// true\n\ncoincides((1..5], [1..5))\n// false\n\ncoincides([1..5], [2..6])\n// false\n</code></pre>\n"
|
|
287
287
|
},
|
|
288
288
|
{
|
|
289
289
|
name: "substring()",
|
|
290
|
-
description: "<ul>\n<li>parameters:<ul>\n<li><code>string</code>: string</li>\n<li><code>start position</code>: number</li>\n<li>(optional) <code>length</code>: number</li>\n</ul>\n</li>\n<li>result: string</li>\n</ul>\n<pre><code class=\"language-
|
|
290
|
+
description: "<ul>\n<li>parameters:<ul>\n<li><code>string</code>: string</li>\n<li><code>start position</code>: number</li>\n<li>(optional) <code>length</code>: number</li>\n</ul>\n</li>\n<li>result: string</li>\n</ul>\n<pre><code class=\"language-feel\">substring("foobar",3)\n// "obar"\n\nsubstring("foobar",3,3)\n// "oba"\n</code></pre>\n"
|
|
291
291
|
},
|
|
292
292
|
{
|
|
293
293
|
name: "string length()",
|
|
294
|
-
description: "<ul>\n<li>parameters:<ul>\n<li><code>string</code>: string</li>\n</ul>\n</li>\n<li>result: number</li>\n</ul>\n<pre><code class=\"language-
|
|
294
|
+
description: "<ul>\n<li>parameters:<ul>\n<li><code>string</code>: string</li>\n</ul>\n</li>\n<li>result: number</li>\n</ul>\n<pre><code class=\"language-feel\">string length("foo")\n// 3\n</code></pre>\n"
|
|
295
295
|
},
|
|
296
296
|
{
|
|
297
297
|
name: "upper case()",
|
|
298
|
-
description: "<ul>\n<li>parameters:<ul>\n<li><code>string</code>: string</li>\n</ul>\n</li>\n<li>result: string</li>\n</ul>\n<pre><code class=\"language-
|
|
298
|
+
description: "<ul>\n<li>parameters:<ul>\n<li><code>string</code>: string</li>\n</ul>\n</li>\n<li>result: string</li>\n</ul>\n<pre><code class=\"language-feel\">upper case("aBc4")\n// "ABC4"\n</code></pre>\n"
|
|
299
299
|
},
|
|
300
300
|
{
|
|
301
301
|
name: "lower case()",
|
|
302
|
-
description: "<ul>\n<li>parameters:<ul>\n<li><code>string</code>: string</li>\n</ul>\n</li>\n<li>result: string</li>\n</ul>\n<pre><code class=\"language-
|
|
302
|
+
description: "<ul>\n<li>parameters:<ul>\n<li><code>string</code>: string</li>\n</ul>\n</li>\n<li>result: string</li>\n</ul>\n<pre><code class=\"language-feel\">lower case("aBc4")\n// "abc4"\n</code></pre>\n"
|
|
303
303
|
},
|
|
304
304
|
{
|
|
305
305
|
name: "substring before()",
|
|
306
|
-
description: "<ul>\n<li>parameters:<ul>\n<li><code>string</code>: string</li>\n<li><code>match</code>: string</li>\n</ul>\n</li>\n<li>result: string</li>\n</ul>\n<pre><code class=\"language-
|
|
306
|
+
description: "<ul>\n<li>parameters:<ul>\n<li><code>string</code>: string</li>\n<li><code>match</code>: string</li>\n</ul>\n</li>\n<li>result: string</li>\n</ul>\n<pre><code class=\"language-feel\">substring before("foobar", "bar")\n// "foo"\n</code></pre>\n"
|
|
307
307
|
},
|
|
308
308
|
{
|
|
309
309
|
name: "substring after()",
|
|
310
|
-
description: "<ul>\n<li>parameters:<ul>\n<li><code>string</code>: string</li>\n<li><code>match</code>: string</li>\n</ul>\n</li>\n<li>result: string</li>\n</ul>\n<pre><code class=\"language-
|
|
310
|
+
description: "<ul>\n<li>parameters:<ul>\n<li><code>string</code>: string</li>\n<li><code>match</code>: string</li>\n</ul>\n</li>\n<li>result: string</li>\n</ul>\n<pre><code class=\"language-feel\">substring after("foobar", "ob")\n// "ar"\n</code></pre>\n"
|
|
311
311
|
},
|
|
312
312
|
{
|
|
313
313
|
name: "contains()",
|
|
314
|
-
description: "<ul>\n<li>parameters:<ul>\n<li><code>string</code>: string</li>\n<li><code>match</code>: string</li>\n</ul>\n</li>\n<li>result: boolean</li>\n</ul>\n<pre><code class=\"language-
|
|
314
|
+
description: "<ul>\n<li>parameters:<ul>\n<li><code>string</code>: string</li>\n<li><code>match</code>: string</li>\n</ul>\n</li>\n<li>result: boolean</li>\n</ul>\n<pre><code class=\"language-feel\">contains("foobar", "of")\n// false\n</code></pre>\n"
|
|
315
315
|
},
|
|
316
316
|
{
|
|
317
317
|
name: "starts with()",
|
|
318
|
-
description: "<ul>\n<li>parameters:<ul>\n<li><code>input</code>: string</li>\n<li><code>match</code>: string</li>\n</ul>\n</li>\n<li>result: boolean</li>\n</ul>\n<pre><code class=\"language-
|
|
318
|
+
description: "<ul>\n<li>parameters:<ul>\n<li><code>input</code>: string</li>\n<li><code>match</code>: string</li>\n</ul>\n</li>\n<li>result: boolean</li>\n</ul>\n<pre><code class=\"language-feel\">starts with("foobar", "fo")\n// true\n</code></pre>\n"
|
|
319
319
|
},
|
|
320
320
|
{
|
|
321
321
|
name: "ends with()",
|
|
322
|
-
description: "<ul>\n<li>parameters:<ul>\n<li><code>input</code>: string</li>\n<li><code>match</code>: string</li>\n</ul>\n</li>\n<li>result: boolean</li>\n</ul>\n<pre><code class=\"language-
|
|
322
|
+
description: "<ul>\n<li>parameters:<ul>\n<li><code>input</code>: string</li>\n<li><code>match</code>: string</li>\n</ul>\n</li>\n<li>result: boolean</li>\n</ul>\n<pre><code class=\"language-feel\">ends with("foobar", "r")\n// true\n</code></pre>\n"
|
|
323
323
|
},
|
|
324
324
|
{
|
|
325
325
|
name: "matches()",
|
|
326
|
-
description: "<ul>\n<li>parameters:<ul>\n<li><code>input</code>: string</li>\n<li><code>pattern</code>: string (regular expression)</li>\n</ul>\n</li>\n<li>result: boolean</li>\n</ul>\n<pre><code class=\"language-
|
|
326
|
+
description: "<ul>\n<li>parameters:<ul>\n<li><code>input</code>: string</li>\n<li><code>pattern</code>: string (regular expression)</li>\n</ul>\n</li>\n<li>result: boolean</li>\n</ul>\n<pre><code class=\"language-feel\">matches("foobar", "^fo*bar")\n// true\n</code></pre>\n"
|
|
327
327
|
},
|
|
328
328
|
{
|
|
329
329
|
name: "replace()",
|
|
330
|
-
description: "<ul>\n<li>parameters:<ul>\n<li><code>input</code>: string</li>\n<li><code>pattern</code>: string (regular expression)</li>\n<li><code>replacement</code>: string (e.g. <code>$1</code> returns the first match group)</li>\n<li>(optional) <code>flags</code>: string ("s", "m", "i", "x")</li>\n</ul>\n</li>\n<li>result: string</li>\n</ul>\n<pre><code class=\"language-
|
|
330
|
+
description: "<ul>\n<li>parameters:<ul>\n<li><code>input</code>: string</li>\n<li><code>pattern</code>: string (regular expression)</li>\n<li><code>replacement</code>: string (e.g. <code>$1</code> returns the first match group)</li>\n<li>(optional) <code>flags</code>: string ("s", "m", "i", "x")</li>\n</ul>\n</li>\n<li>result: string</li>\n</ul>\n<pre><code class=\"language-feel\">replace("abcd", "(ab)|(a)", "[1=$1][2=$2]")\n// "[1=ab][2=]cd"\n\nreplace("0123456789", "(\\d{3})(\\d{3})(\\d{4})", "($1) $2-$3")\n// "(012) 345-6789"\n</code></pre>\n"
|
|
331
331
|
},
|
|
332
332
|
{
|
|
333
333
|
name: "split()",
|
|
334
|
-
description: "<ul>\n<li>parameters:<ul>\n<li><code>string</code>: string</li>\n<li><code>delimiter</code>: string (regular expression)</li>\n</ul>\n</li>\n<li>result: list of strings</li>\n</ul>\n<pre><code class=\"language-
|
|
334
|
+
description: "<ul>\n<li>parameters:<ul>\n<li><code>string</code>: string</li>\n<li><code>delimiter</code>: string (regular expression)</li>\n</ul>\n</li>\n<li>result: list of strings</li>\n</ul>\n<pre><code class=\"language-feel\">split("John Doe", "\\s" )\n// ["John", "Doe"]\n\nsplit("a;b;c;;", ";")\n// ["a", "b", "c", "", ""]\n</code></pre>\n"
|
|
335
335
|
},
|
|
336
336
|
{
|
|
337
337
|
name: "extract()",
|
|
338
|
-
description: "<p>Returns all matches of the pattern in the given string. Returns an empty list if the pattern doesn't\nmatch.</p>\n<ul>\n<li>parameters:<ul>\n<li><code>string</code>: string</li>\n<li><code>pattern</code>: string (regular expression)</li>\n</ul>\n</li>\n<li>result: list of strings</li>\n</ul>\n<pre><code class=\"language-
|
|
338
|
+
description: "<p>Returns all matches of the pattern in the given string. Returns an empty list if the pattern doesn't\nmatch.</p>\n<ul>\n<li>parameters:<ul>\n<li><code>string</code>: string</li>\n<li><code>pattern</code>: string (regular expression)</li>\n</ul>\n</li>\n<li>result: list of strings</li>\n</ul>\n<pre><code class=\"language-feel\">extract("references are 1234, 1256, 1378", "12[0-9]*")\n// ["1234","1256"]\n</code></pre>\n"
|
|
339
339
|
},
|
|
340
340
|
{
|
|
341
341
|
name: "now()",
|
|
342
|
-
description: "<p>Returns the current date and time including the timezone.</p>\n<ul>\n<li>parameters: no</li>\n<li>result: date-time with timezone</li>\n</ul>\n<pre><code class=\"language-
|
|
342
|
+
description: "<p>Returns the current date and time including the timezone.</p>\n<ul>\n<li>parameters: no</li>\n<li>result: date-time with timezone</li>\n</ul>\n<pre><code class=\"language-feel\">now()\n// date and time("2020-07-31T14:27:30@Europe/Berlin")\n</code></pre>\n"
|
|
343
343
|
},
|
|
344
344
|
{
|
|
345
345
|
name: "today()",
|
|
346
|
-
description: "<p>Returns the current date.</p>\n<ul>\n<li>parameters: no</li>\n<li>result: date</li>\n</ul>\n<pre><code class=\"language-
|
|
346
|
+
description: "<p>Returns the current date.</p>\n<ul>\n<li>parameters: no</li>\n<li>result: date</li>\n</ul>\n<pre><code class=\"language-feel\">today()\n// date("2020-07-31")\n</code></pre>\n"
|
|
347
347
|
},
|
|
348
348
|
{
|
|
349
349
|
name: "day of week()",
|
|
350
|
-
description: "<p>Returns the day of the week according to the Gregorian calendar. Note that it always returns the English name of the day.</p>\n<ul>\n<li>parameters:<ul>\n<li><code>date</code>: date/date-time</li>\n</ul>\n</li>\n<li>result: string</li>\n</ul>\n<pre><code class=\"language-
|
|
350
|
+
description: "<p>Returns the day of the week according to the Gregorian calendar. Note that it always returns the English name of the day.</p>\n<ul>\n<li>parameters:<ul>\n<li><code>date</code>: date/date-time</li>\n</ul>\n</li>\n<li>result: string</li>\n</ul>\n<pre><code class=\"language-feel\">day of week(date("2019-09-17"))\n// "Tuesday"\n</code></pre>\n"
|
|
351
351
|
},
|
|
352
352
|
{
|
|
353
353
|
name: "day of year()",
|
|
354
|
-
description: "<p>Returns the Gregorian number of the day within the year.</p>\n<ul>\n<li>parameters:<ul>\n<li><code>date</code>: date/date-time</li>\n</ul>\n</li>\n<li>result: number</li>\n</ul>\n<pre><code class=\"language-
|
|
354
|
+
description: "<p>Returns the Gregorian number of the day within the year.</p>\n<ul>\n<li>parameters:<ul>\n<li><code>date</code>: date/date-time</li>\n</ul>\n</li>\n<li>result: number</li>\n</ul>\n<pre><code class=\"language-feel\">day of year(date("2019-09-17"))\n// 260\n</code></pre>\n"
|
|
355
355
|
},
|
|
356
356
|
{
|
|
357
357
|
name: "week of year()",
|
|
358
|
-
description: "<p>Returns the Gregorian number of the week within the year, according to ISO 8601.</p>\n<ul>\n<li>parameters:<ul>\n<li><code>date</code>: date/date-time</li>\n</ul>\n</li>\n<li>result: number</li>\n</ul>\n<pre><code class=\"language-
|
|
358
|
+
description: "<p>Returns the Gregorian number of the week within the year, according to ISO 8601.</p>\n<ul>\n<li>parameters:<ul>\n<li><code>date</code>: date/date-time</li>\n</ul>\n</li>\n<li>result: number</li>\n</ul>\n<pre><code class=\"language-feel\">week of year(date("2019-09-17"))\n// 38\n</code></pre>\n"
|
|
359
359
|
},
|
|
360
360
|
{
|
|
361
361
|
name: "month of year()",
|
|
362
|
-
description: "<p>Returns the month of the week according to the Gregorian calendar. Note that it always returns the English name of the month.</p>\n<ul>\n<li>parameters:<ul>\n<li><code>date</code>: date/date-time</li>\n</ul>\n</li>\n<li>result: string</li>\n</ul>\n<pre><code class=\"language-
|
|
362
|
+
description: "<p>Returns the month of the week according to the Gregorian calendar. Note that it always returns the English name of the month.</p>\n<ul>\n<li>parameters:<ul>\n<li><code>date</code>: date/date-time</li>\n</ul>\n</li>\n<li>result: string</li>\n</ul>\n<pre><code class=\"language-feel\">month of year(date("2019-09-17"))\n// "September"\n</code></pre>\n"
|
|
363
363
|
},
|
|
364
364
|
{
|
|
365
365
|
name: "abs()",
|
|
366
|
-
description: "<p>Returns the absolute value of a given duration.</p>\n<ul>\n<li>parameters:<ul>\n<li><code>n</code>: days-time-duration/years-months-duration</li>\n</ul>\n</li>\n<li>result: duration</li>\n</ul>\n<pre><code class=\"language-
|
|
366
|
+
description: "<p>Returns the absolute value of a given duration.</p>\n<ul>\n<li>parameters:<ul>\n<li><code>n</code>: days-time-duration/years-months-duration</li>\n</ul>\n</li>\n<li>result: duration</li>\n</ul>\n<pre><code class=\"language-feel\">abs(duration("-PT5H"))\n// "duration("PT5H")"\n\nabs(duration("PT5H"))\n// "duration("PT5H")"\n\nabs(duration("-P2M"))\n// duration("P2M")\n</code></pre>\n"
|
|
367
367
|
}
|
|
368
368
|
];
|
|
369
369
|
|
|
@@ -409,7 +409,18 @@ var builtins = context => {
|
|
|
409
409
|
};
|
|
410
410
|
};
|
|
411
411
|
|
|
412
|
-
|
|
412
|
+
/**
|
|
413
|
+
* @type {Facet<import('..').Variable[]>} Variable
|
|
414
|
+
*/
|
|
415
|
+
const variablesFacet = state.Facet.define();
|
|
416
|
+
|
|
417
|
+
/**
|
|
418
|
+
* @type {import('@codemirror/autocomplete').CompletionSource}
|
|
419
|
+
*/
|
|
420
|
+
var variables = context => {
|
|
421
|
+
|
|
422
|
+
const variables = context.state.facet(variablesFacet)[0];
|
|
423
|
+
|
|
413
424
|
const options = variables.map(v => ({
|
|
414
425
|
label: v.name,
|
|
415
426
|
type: 'variable',
|
|
@@ -448,11 +459,11 @@ var variables = variables => context => {
|
|
|
448
459
|
return result;
|
|
449
460
|
};
|
|
450
461
|
|
|
451
|
-
function autocompletion(
|
|
462
|
+
function autocompletion() {
|
|
452
463
|
return [
|
|
453
464
|
autocomplete.autocompletion({
|
|
454
465
|
override: [
|
|
455
|
-
variables
|
|
466
|
+
variables,
|
|
456
467
|
builtins,
|
|
457
468
|
autocomplete.completeFromList(langFeel.snippets)
|
|
458
469
|
]
|
|
@@ -576,22 +587,33 @@ const syntaxClasses = language$1.syntaxHighlighting(
|
|
|
576
587
|
|
|
577
588
|
var theme = [ baseTheme, highlightTheme, syntaxClasses ];
|
|
578
589
|
|
|
590
|
+
/**
|
|
591
|
+
* @typedef {object} Variable
|
|
592
|
+
* @property {string} name
|
|
593
|
+
* @property {string} [info]
|
|
594
|
+
* @property {string} [detail]
|
|
595
|
+
*/
|
|
596
|
+
|
|
597
|
+
const autocompletionConf = new state.Compartment();
|
|
598
|
+
|
|
579
599
|
/**
|
|
580
600
|
* Creates a FEEL editor in the supplied container
|
|
581
601
|
*
|
|
582
602
|
* @param {Object} config
|
|
583
603
|
* @param {DOMNode} config.container
|
|
604
|
+
* @param {DOMNode|String} [config.tooltipContainer]
|
|
584
605
|
* @param {Function} [config.onChange]
|
|
585
606
|
* @param {Function} [config.onKeyDown]
|
|
586
607
|
* @param {Function} [config.onLint]
|
|
587
608
|
* @param {Boolean} [config.readOnly]
|
|
588
609
|
* @param {String} [config.value]
|
|
589
|
-
* @param {
|
|
610
|
+
* @param {Variable[]} [config.variables]
|
|
590
611
|
*
|
|
591
612
|
* @returns {Object} editor
|
|
592
613
|
*/
|
|
593
614
|
function FeelEditor({
|
|
594
615
|
container,
|
|
616
|
+
tooltipContainer,
|
|
595
617
|
onChange = () => {},
|
|
596
618
|
onKeyDown = () => {},
|
|
597
619
|
onLint = () => {},
|
|
@@ -626,20 +648,32 @@ function FeelEditor({
|
|
|
626
648
|
}
|
|
627
649
|
);
|
|
628
650
|
|
|
651
|
+
if (typeof tooltipContainer === 'string') {
|
|
652
|
+
tooltipContainer = document.querySelector(tooltipContainer);
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
const tooltipLayout = tooltipContainer ? view.tooltips({
|
|
656
|
+
tooltipSpace: function() {
|
|
657
|
+
return tooltipContainer.getBoundingClientRect();
|
|
658
|
+
}
|
|
659
|
+
}) : [];
|
|
660
|
+
|
|
629
661
|
const extensions = [
|
|
662
|
+
autocompletionConf.of(variablesFacet.of(variables)),
|
|
663
|
+
autocompletion(),
|
|
664
|
+
language$1.bracketMatching(),
|
|
665
|
+
changeHandler,
|
|
666
|
+
autocomplete.closeBrackets(),
|
|
667
|
+
language$1.indentOnInput(),
|
|
668
|
+
keyHandler,
|
|
630
669
|
view.keymap.of([
|
|
631
670
|
...commands.defaultKeymap,
|
|
632
671
|
]),
|
|
633
|
-
changeHandler,
|
|
634
|
-
keyHandler,
|
|
635
672
|
language(),
|
|
636
|
-
autocompletion(variables),
|
|
637
|
-
theme,
|
|
638
673
|
linter,
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
lintHandler
|
|
674
|
+
lintHandler,
|
|
675
|
+
tooltipLayout,
|
|
676
|
+
theme
|
|
643
677
|
];
|
|
644
678
|
|
|
645
679
|
if (readOnly) {
|
|
@@ -677,6 +711,10 @@ FeelEditor.prototype.setValue = function(value) {
|
|
|
677
711
|
*/
|
|
678
712
|
FeelEditor.prototype.focus = function(position) {
|
|
679
713
|
const cmEditor = this._cmEditor;
|
|
714
|
+
|
|
715
|
+
// the Codemirror `focus` method always calls `focus` with `preventScroll`,
|
|
716
|
+
// so we have to focus + scroll manually
|
|
717
|
+
cmEditor.contentDOM.focus();
|
|
680
718
|
cmEditor.focus();
|
|
681
719
|
|
|
682
720
|
if (typeof position === 'number') {
|
|
@@ -696,4 +734,15 @@ FeelEditor.prototype.getSelection = function() {
|
|
|
696
734
|
return this._cmEditor.state.selection;
|
|
697
735
|
};
|
|
698
736
|
|
|
737
|
+
/**
|
|
738
|
+
* Set variables to be used for autocompletion.
|
|
739
|
+
* @param {Variable[]} variables
|
|
740
|
+
* @returns {void}
|
|
741
|
+
*/
|
|
742
|
+
FeelEditor.prototype.setVariables = function(variables) {
|
|
743
|
+
this._cmEditor.dispatch({
|
|
744
|
+
effects: autocompletionConf.reconfigure(variablesFacet.of(variables))
|
|
745
|
+
});
|
|
746
|
+
};
|
|
747
|
+
|
|
699
748
|
module.exports = FeelEditor;
|