@operato/form 1.0.0-beta.8 → 1.0.1
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/CHANGELOG.md +379 -0
- package/demo/index.html +68 -2
- package/dist/src/components/ox-search-form.d.ts +2 -0
- package/dist/src/components/ox-search-form.js +19 -4
- package/dist/src/components/ox-search-form.js.map +1 -1
- package/dist/src/filters/filter-checkbox.d.ts +3 -0
- package/dist/src/filters/filter-checkbox.js +26 -0
- package/dist/src/filters/filter-checkbox.js.map +1 -0
- package/dist/src/filters/filter-input-barcode.d.ts +3 -0
- package/dist/src/filters/filter-input-barcode.js +27 -0
- package/dist/src/filters/filter-input-barcode.js.map +1 -0
- package/dist/src/filters/filter-input.d.ts +2 -0
- package/dist/src/filters/filter-input.js +24 -0
- package/dist/src/filters/filter-input.js.map +1 -0
- package/dist/src/filters/filter-range-date.d.ts +2 -0
- package/dist/src/filters/filter-range-date.js +54 -0
- package/dist/src/filters/filter-range-date.js.map +1 -0
- package/dist/src/filters/filter-range-number.d.ts +2 -0
- package/dist/src/filters/filter-range-number.js +53 -0
- package/dist/src/filters/filter-range-number.js.map +1 -0
- package/dist/src/filters/filter-select.d.ts +3 -0
- package/dist/src/filters/filter-select.js +33 -0
- package/dist/src/filters/filter-select.js.map +1 -0
- package/dist/src/filters/filter-styles.d.ts +1 -0
- package/dist/src/filters/filter-styles.js +88 -0
- package/dist/src/filters/filter-styles.js.map +1 -0
- package/dist/src/filters/index.d.ts +8 -0
- package/dist/src/filters/index.js +9 -0
- package/dist/src/filters/index.js.map +1 -0
- package/dist/src/filters/ox-filters-form-base.d.ts +25 -0
- package/dist/src/filters/ox-filters-form-base.js +238 -0
- package/dist/src/filters/ox-filters-form-base.js.map +1 -0
- package/dist/src/filters/registry.d.ts +7 -0
- package/dist/src/filters/registry.js +46 -0
- package/dist/src/filters/registry.js.map +1 -0
- package/dist/src/filters/types.d.ts +17 -0
- package/dist/src/filters/types.js +2 -0
- package/dist/src/filters/types.js.map +1 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +1 -0
- package/dist/src/index.js.map +1 -1
- package/dist/stories/ox-filter-form-barcode.stories.d.ts +29 -0
- package/dist/stories/ox-filter-form-barcode.stories.js +82 -0
- package/dist/stories/ox-filter-form-barcode.stories.js.map +1 -0
- package/dist/stories/ox-filter-form-base.stories.d.ts +29 -0
- package/dist/stories/ox-filter-form-base.stories.js +82 -0
- package/dist/stories/ox-filter-form-base.stories.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +10 -8
- package/src/components/ox-search-form.ts +16 -4
- package/src/filters/filter-checkbox.ts +31 -0
- package/src/filters/filter-input-barcode.ts +33 -0
- package/src/filters/filter-input.ts +29 -0
- package/src/filters/filter-range-date.ts +64 -0
- package/src/filters/filter-range-number.ts +62 -0
- package/src/filters/filter-select.ts +47 -0
- package/src/filters/filter-styles.ts +88 -0
- package/src/filters/index.ts +10 -0
- package/src/filters/ox-filters-form-base.ts +261 -0
- package/src/filters/registry.ts +54 -0
- package/src/filters/types.ts +47 -0
- package/src/index.ts +1 -0
- package/stories/ox-filter-form-barcode.stories.ts +97 -0
- package/stories/ox-filter-form-base.stories.ts +97 -0
- package/themes/app-theme.css +142 -0
- /package/{src/themes → themes}/form-theme.css +0 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import '@operato/input/ox-checkbox.js';
|
|
2
|
+
import { html } from 'lit-html';
|
|
3
|
+
export const FilterCheckbox = (filter, value, owner) => {
|
|
4
|
+
const { name } = filter;
|
|
5
|
+
return html `
|
|
6
|
+
<ox-checkbox
|
|
7
|
+
name=${name}
|
|
8
|
+
?checked=${value}
|
|
9
|
+
indeterminatable
|
|
10
|
+
?indeterminate=${value === undefined}
|
|
11
|
+
@change=${(e) => {
|
|
12
|
+
;
|
|
13
|
+
e.target.dispatchEvent(new CustomEvent('filter-change', {
|
|
14
|
+
bubbles: true,
|
|
15
|
+
composed: true,
|
|
16
|
+
detail: {
|
|
17
|
+
name: name,
|
|
18
|
+
operator: filter.operator,
|
|
19
|
+
value: e.target.checked
|
|
20
|
+
}
|
|
21
|
+
}));
|
|
22
|
+
}}
|
|
23
|
+
/>
|
|
24
|
+
`;
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=filter-checkbox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter-checkbox.js","sourceRoot":"","sources":["../../../src/filters/filter-checkbox.ts"],"names":[],"mappings":"AAAA,OAAO,+BAA+B,CAAA;AAEtC,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAI/B,MAAM,CAAC,MAAM,cAAc,GAAyB,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;IAC3E,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,CAAA;IAEvB,OAAO,IAAI,CAAA;;aAEA,IAAI;iBACA,KAAK;;uBAEC,KAAK,KAAK,SAAS;gBAC1B,CAAC,CAAc,EAAE,EAAE;QAC3B,CAAC;QAAC,CAAC,CAAC,MAAsB,CAAC,aAAa,CACtC,IAAI,WAAW,CAAC,eAAe,EAAE;YAC/B,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE;gBACN,IAAI,EAAE,IAAI;gBACV,QAAQ,EAAE,MAAM,CAAC,QAAQ;gBACzB,KAAK,EAAG,CAAC,CAAC,MAAqD,CAAC,OAAO;aACxE;SACF,CAAC,CACH,CAAA;IACH,CAAC;;GAEJ,CAAA;AACH,CAAC,CAAA","sourcesContent":["import '@operato/input/ox-checkbox.js'\n\nimport { html } from 'lit-html'\n\nimport { FilterSelectRenderer } from './types.js'\n\nexport const FilterCheckbox: FilterSelectRenderer = (filter, value, owner) => {\n const { name } = filter\n\n return html`\n <ox-checkbox\n name=${name}\n ?checked=${value}\n indeterminatable\n ?indeterminate=${value === undefined}\n @change=${(e: CustomEvent) => {\n ;(e.target as HTMLElement).dispatchEvent(\n new CustomEvent('filter-change', {\n bubbles: true,\n composed: true,\n detail: {\n name: name,\n operator: filter.operator,\n value: (e.target as Element & { checked: boolean | undefined }).checked\n }\n })\n )\n }}\n />\n `\n}\n"]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import '@operato/input/ox-input-barcode.js';
|
|
2
|
+
import { html } from 'lit-html';
|
|
3
|
+
export const FilterInputBarcode = (filter, value, owner) => {
|
|
4
|
+
const { name, type } = filter;
|
|
5
|
+
const { englishOnly, selectAfterChange } = filter.options || {};
|
|
6
|
+
return html `
|
|
7
|
+
<ox-input-barcode
|
|
8
|
+
name=${name}
|
|
9
|
+
?english-only=${englishOnly}
|
|
10
|
+
?select-after-change=${selectAfterChange}
|
|
11
|
+
.value=${value === undefined ? '' : value}
|
|
12
|
+
@change=${(e) => {
|
|
13
|
+
const input = e.target;
|
|
14
|
+
input.dispatchEvent(new CustomEvent('filter-change', {
|
|
15
|
+
bubbles: true,
|
|
16
|
+
composed: true,
|
|
17
|
+
detail: {
|
|
18
|
+
name,
|
|
19
|
+
operator: filter.operator,
|
|
20
|
+
value: input.value
|
|
21
|
+
}
|
|
22
|
+
}));
|
|
23
|
+
}}
|
|
24
|
+
/>
|
|
25
|
+
`;
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=filter-input-barcode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter-input-barcode.js","sourceRoot":"","sources":["../../../src/filters/filter-input-barcode.ts"],"names":[],"mappings":"AAAA,OAAO,oCAAoC,CAAA;AAE3C,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAI/B,MAAM,CAAC,MAAM,kBAAkB,GAAyB,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;IAC/E,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,MAAM,CAAA;IAC7B,MAAM,EAAE,WAAW,EAAE,iBAAiB,EAAE,GAAG,MAAM,CAAC,OAAO,IAAI,EAAE,CAAA;IAE/D,OAAO,IAAI,CAAA;;aAEA,IAAI;sBACK,WAAW;6BACJ,iBAAiB;eAC/B,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK;gBAC/B,CAAC,CAAc,EAAE,EAAE;QAC3B,MAAM,KAAK,GAAG,CAAC,CAAC,MAA0B,CAAA;QAC1C,KAAK,CAAC,aAAa,CACjB,IAAI,WAAW,CAAC,eAAe,EAAE;YAC/B,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE;gBACN,IAAI;gBACJ,QAAQ,EAAE,MAAM,CAAC,QAAQ;gBACzB,KAAK,EAAE,KAAK,CAAC,KAAK;aACnB;SACF,CAAC,CACH,CAAA;IACH,CAAC;;GAEJ,CAAA;AACH,CAAC,CAAA","sourcesContent":["import '@operato/input/ox-input-barcode.js'\n\nimport { html } from 'lit-html'\n\nimport { FilterSelectRenderer } from './types.js'\n\nexport const FilterInputBarcode: FilterSelectRenderer = (filter, value, owner) => {\n const { name, type } = filter\n const { englishOnly, selectAfterChange } = filter.options || {}\n\n return html`\n <ox-input-barcode\n name=${name}\n ?english-only=${englishOnly}\n ?select-after-change=${selectAfterChange}\n .value=${value === undefined ? '' : value}\n @change=${(e: CustomEvent) => {\n const input = e.target as HTMLInputElement\n input.dispatchEvent(\n new CustomEvent('filter-change', {\n bubbles: true,\n composed: true,\n detail: {\n name,\n operator: filter.operator,\n value: input.value\n }\n })\n )\n }}\n />\n `\n}\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { html } from 'lit-html';
|
|
2
|
+
export const FilterInput = (filter, value, owner) => {
|
|
3
|
+
const { name, type } = filter;
|
|
4
|
+
return html `
|
|
5
|
+
<input
|
|
6
|
+
type=${type}
|
|
7
|
+
name=${name}
|
|
8
|
+
.value=${value === undefined ? '' : value}
|
|
9
|
+
@change=${(e) => {
|
|
10
|
+
const input = e.target;
|
|
11
|
+
input.dispatchEvent(new CustomEvent('filter-change', {
|
|
12
|
+
bubbles: true,
|
|
13
|
+
composed: true,
|
|
14
|
+
detail: {
|
|
15
|
+
name: name,
|
|
16
|
+
operator: filter.operator,
|
|
17
|
+
value: input.value
|
|
18
|
+
}
|
|
19
|
+
}));
|
|
20
|
+
}}
|
|
21
|
+
/>
|
|
22
|
+
`;
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=filter-input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter-input.js","sourceRoot":"","sources":["../../../src/filters/filter-input.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAI/B,MAAM,CAAC,MAAM,WAAW,GAAyB,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;IACxE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,MAAM,CAAA;IAE7B,OAAO,IAAI,CAAA;;aAEA,IAAI;aACJ,IAAI;eACF,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK;gBAC/B,CAAC,CAAc,EAAE,EAAE;QAC3B,MAAM,KAAK,GAAG,CAAC,CAAC,MAA0B,CAAA;QAC1C,KAAK,CAAC,aAAa,CACjB,IAAI,WAAW,CAAC,eAAe,EAAE;YAC/B,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE;gBACN,IAAI,EAAE,IAAI;gBACV,QAAQ,EAAE,MAAM,CAAC,QAAQ;gBACzB,KAAK,EAAE,KAAK,CAAC,KAAK;aACnB;SACF,CAAC,CACH,CAAA;IACH,CAAC;;GAEJ,CAAA;AACH,CAAC,CAAA","sourcesContent":["import { html } from 'lit-html'\n\nimport { FilterSelectRenderer } from './types.js'\n\nexport const FilterInput: FilterSelectRenderer = (filter, value, owner) => {\n const { name, type } = filter\n\n return html`\n <input\n type=${type}\n name=${name}\n .value=${value === undefined ? '' : value}\n @change=${(e: CustomEvent) => {\n const input = e.target as HTMLInputElement\n input.dispatchEvent(\n new CustomEvent('filter-change', {\n bubbles: true,\n composed: true,\n detail: {\n name: name,\n operator: filter.operator,\n value: input.value\n }\n })\n )\n }}\n />\n `\n}\n"]}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { html } from 'lit-html';
|
|
2
|
+
export const FilterRangeDate = (filter, value, owner) => {
|
|
3
|
+
var { name, type, operator } = filter;
|
|
4
|
+
const [from, to] = value instanceof Array ? value : [];
|
|
5
|
+
if (type === 'datetime') {
|
|
6
|
+
type = 'datetime-local';
|
|
7
|
+
}
|
|
8
|
+
return html `
|
|
9
|
+
<input
|
|
10
|
+
name=${name}
|
|
11
|
+
type=${type}
|
|
12
|
+
.value=${from}
|
|
13
|
+
from
|
|
14
|
+
@keyup=${(e) => {
|
|
15
|
+
if (e.key !== 'Enter') {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
;
|
|
19
|
+
e.target.dispatchEvent(new CustomEvent('filter-change', {
|
|
20
|
+
bubbles: true,
|
|
21
|
+
composed: true,
|
|
22
|
+
detail: {
|
|
23
|
+
name,
|
|
24
|
+
operator,
|
|
25
|
+
value: Array.from(e.target.parentElement.querySelectorAll('input[from], input[to]')).map(input => input.value)
|
|
26
|
+
}
|
|
27
|
+
}));
|
|
28
|
+
}}
|
|
29
|
+
/>
|
|
30
|
+
~
|
|
31
|
+
<input
|
|
32
|
+
name=${name}
|
|
33
|
+
type=${type}
|
|
34
|
+
.value=${to}
|
|
35
|
+
to
|
|
36
|
+
@keyup=${(e) => {
|
|
37
|
+
if (e.key !== 'Enter') {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
;
|
|
41
|
+
e.target.dispatchEvent(new CustomEvent('filter-change', {
|
|
42
|
+
bubbles: true,
|
|
43
|
+
composed: true,
|
|
44
|
+
detail: {
|
|
45
|
+
name,
|
|
46
|
+
operator,
|
|
47
|
+
value: Array.from(e.target.parentElement.querySelectorAll('input[from], input[to]')).map(input => input.value)
|
|
48
|
+
}
|
|
49
|
+
}));
|
|
50
|
+
}}
|
|
51
|
+
/>
|
|
52
|
+
`;
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=filter-range-date.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter-range-date.js","sourceRoot":"","sources":["../../../src/filters/filter-range-date.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAI/B,MAAM,CAAC,MAAM,eAAe,GAAyB,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;IAC5E,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAA;IACrC,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAA;IAEtD,IAAI,IAAI,KAAK,UAAU,EAAE;QACvB,IAAI,GAAG,gBAAgB,CAAA;KACxB;IAED,OAAO,IAAI,CAAA;;aAEA,IAAI;aACJ,IAAI;eACF,IAAI;;eAEJ,CAAC,CAAgB,EAAE,EAAE;QAC5B,IAAI,CAAC,CAAC,GAAG,KAAK,OAAO,EAAE;YACrB,OAAM;SACP;QACD,CAAC;QAAC,CAAC,CAAC,MAAsB,CAAC,aAAa,CACtC,IAAI,WAAW,CAAC,eAAe,EAAE;YAC/B,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE;gBACN,IAAI;gBACJ,QAAQ;gBACR,KAAK,EAAE,KAAK,CAAC,IAAI,CACd,CAAC,CAAC,MAAsB,CAAC,aAAc,CAAC,gBAAgB,CAAC,wBAAwB,CAAC,CACpF,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAE,KAA0B,CAAC,KAAK,CAAC;aAClD;SACF,CAAC,CACH,CAAA;IACH,CAAC;;;;aAIM,IAAI;aACJ,IAAI;eACF,EAAE;;eAEF,CAAC,CAAgB,EAAE,EAAE;QAC5B,IAAI,CAAC,CAAC,GAAG,KAAK,OAAO,EAAE;YACrB,OAAM;SACP;QACD,CAAC;QAAC,CAAC,CAAC,MAAsB,CAAC,aAAa,CACtC,IAAI,WAAW,CAAC,eAAe,EAAE;YAC/B,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE;gBACN,IAAI;gBACJ,QAAQ;gBACR,KAAK,EAAE,KAAK,CAAC,IAAI,CACd,CAAC,CAAC,MAAsB,CAAC,aAAc,CAAC,gBAAgB,CAAC,wBAAwB,CAAC,CACpF,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAE,KAA0B,CAAC,KAAK,CAAC;aAClD;SACF,CAAC,CACH,CAAA;IACH,CAAC;;GAEJ,CAAA;AACH,CAAC,CAAA","sourcesContent":["import { html } from 'lit-html'\n\nimport { FilterSelectRenderer } from './types.js'\n\nexport const FilterRangeDate: FilterSelectRenderer = (filter, value, owner) => {\n var { name, type, operator } = filter\n const [from, to] = value instanceof Array ? value : []\n\n if (type === 'datetime') {\n type = 'datetime-local'\n }\n\n return html`\n <input\n name=${name}\n type=${type}\n .value=${from}\n from\n @keyup=${(e: KeyboardEvent) => {\n if (e.key !== 'Enter') {\n return\n }\n ;(e.target as HTMLElement).dispatchEvent(\n new CustomEvent('filter-change', {\n bubbles: true,\n composed: true,\n detail: {\n name,\n operator,\n value: Array.from(\n (e.target as HTMLElement).parentElement!.querySelectorAll('input[from], input[to]')\n ).map(input => (input as HTMLInputElement).value)\n }\n })\n )\n }}\n />\n ~\n <input\n name=${name}\n type=${type}\n .value=${to}\n to\n @keyup=${(e: KeyboardEvent) => {\n if (e.key !== 'Enter') {\n return\n }\n ;(e.target as HTMLElement).dispatchEvent(\n new CustomEvent('filter-change', {\n bubbles: true,\n composed: true,\n detail: {\n name,\n operator,\n value: Array.from(\n (e.target as HTMLElement).parentElement!.querySelectorAll('input[from], input[to]')\n ).map(input => (input as HTMLInputElement).value)\n }\n })\n )\n }}\n />\n `\n}\n"]}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { html } from 'lit-html';
|
|
2
|
+
export const FilterRangeNumber = (filter, value, owner) => {
|
|
3
|
+
const { name, operator } = filter;
|
|
4
|
+
const [from, to] = value instanceof Array ? value : [];
|
|
5
|
+
return html `
|
|
6
|
+
<input
|
|
7
|
+
name=${name}
|
|
8
|
+
type="number"
|
|
9
|
+
placeholder="minimum"
|
|
10
|
+
.value=${from}
|
|
11
|
+
from
|
|
12
|
+
@keyup=${(e) => {
|
|
13
|
+
if (e.key !== 'Enter') {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
;
|
|
17
|
+
e.target.dispatchEvent(new CustomEvent('filter-change', {
|
|
18
|
+
bubbles: true,
|
|
19
|
+
composed: true,
|
|
20
|
+
detail: {
|
|
21
|
+
name,
|
|
22
|
+
operator,
|
|
23
|
+
value: Array.from(e.target.parentElement.querySelectorAll('input[from], input[to]')).map(input => input.value)
|
|
24
|
+
}
|
|
25
|
+
}));
|
|
26
|
+
}}
|
|
27
|
+
/>
|
|
28
|
+
~
|
|
29
|
+
<input
|
|
30
|
+
name=${name}
|
|
31
|
+
type="number"
|
|
32
|
+
placeholder="maximum"
|
|
33
|
+
.value=${to}
|
|
34
|
+
to
|
|
35
|
+
@keyup=${(e) => {
|
|
36
|
+
if (e.key !== 'Enter') {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
;
|
|
40
|
+
e.target.dispatchEvent(new CustomEvent('filter-change', {
|
|
41
|
+
bubbles: true,
|
|
42
|
+
composed: true,
|
|
43
|
+
detail: {
|
|
44
|
+
name,
|
|
45
|
+
operator,
|
|
46
|
+
value: Array.from(e.target.parentElement.querySelectorAll('input[from], input[to]')).map(input => input.value)
|
|
47
|
+
}
|
|
48
|
+
}));
|
|
49
|
+
}}
|
|
50
|
+
/>
|
|
51
|
+
`;
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=filter-range-number.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter-range-number.js","sourceRoot":"","sources":["../../../src/filters/filter-range-number.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAI/B,MAAM,CAAC,MAAM,iBAAiB,GAAyB,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;IAC9E,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAA;IACjC,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAA;IAEtD,OAAO,IAAI,CAAA;;aAEA,IAAI;;;eAGF,IAAI;;eAEJ,CAAC,CAAgB,EAAE,EAAE;QAC5B,IAAI,CAAC,CAAC,GAAG,KAAK,OAAO,EAAE;YACrB,OAAM;SACP;QACD,CAAC;QAAC,CAAC,CAAC,MAAsB,CAAC,aAAa,CACtC,IAAI,WAAW,CAAC,eAAe,EAAE;YAC/B,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE;gBACN,IAAI;gBACJ,QAAQ;gBACR,KAAK,EAAE,KAAK,CAAC,IAAI,CACd,CAAC,CAAC,MAAsB,CAAC,aAAc,CAAC,gBAAgB,CAAC,wBAAwB,CAAC,CACpF,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAE,KAA0B,CAAC,KAAK,CAAC;aAClD;SACF,CAAC,CACH,CAAA;IACH,CAAC;;;;aAIM,IAAI;;;eAGF,EAAE;;eAEF,CAAC,CAAgB,EAAE,EAAE;QAC5B,IAAI,CAAC,CAAC,GAAG,KAAK,OAAO,EAAE;YACrB,OAAM;SACP;QACD,CAAC;QAAC,CAAC,CAAC,MAAsB,CAAC,aAAa,CACtC,IAAI,WAAW,CAAC,eAAe,EAAE;YAC/B,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE;gBACN,IAAI;gBACJ,QAAQ;gBACR,KAAK,EAAE,KAAK,CAAC,IAAI,CACd,CAAC,CAAC,MAAsB,CAAC,aAAc,CAAC,gBAAgB,CAAC,wBAAwB,CAAC,CACpF,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAE,KAA0B,CAAC,KAAK,CAAC;aAClD;SACF,CAAC,CACH,CAAA;IACH,CAAC;;GAEJ,CAAA;AACH,CAAC,CAAA","sourcesContent":["import { html } from 'lit-html'\n\nimport { FilterSelectRenderer } from './types.js'\n\nexport const FilterRangeNumber: FilterSelectRenderer = (filter, value, owner) => {\n const { name, operator } = filter\n const [from, to] = value instanceof Array ? value : []\n\n return html`\n <input\n name=${name}\n type=\"number\"\n placeholder=\"minimum\"\n .value=${from}\n from\n @keyup=${(e: KeyboardEvent) => {\n if (e.key !== 'Enter') {\n return\n }\n ;(e.target as HTMLElement).dispatchEvent(\n new CustomEvent('filter-change', {\n bubbles: true,\n composed: true,\n detail: {\n name,\n operator,\n value: Array.from(\n (e.target as HTMLElement).parentElement!.querySelectorAll('input[from], input[to]')\n ).map(input => (input as HTMLInputElement).value)\n }\n })\n )\n }}\n />\n ~\n <input\n name=${name}\n type=\"number\"\n placeholder=\"maximum\"\n .value=${to}\n to\n @keyup=${(e: KeyboardEvent) => {\n if (e.key !== 'Enter') {\n return\n }\n ;(e.target as HTMLElement).dispatchEvent(\n new CustomEvent('filter-change', {\n bubbles: true,\n composed: true,\n detail: {\n name,\n operator,\n value: Array.from(\n (e.target as HTMLElement).parentElement!.querySelectorAll('input[from], input[to]')\n ).map(input => (input as HTMLInputElement).value)\n }\n })\n )\n }}\n />\n `\n}\n"]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import '@operato/input/ox-checkbox.js';
|
|
2
|
+
import { html } from 'lit-html';
|
|
3
|
+
export const FilterSelect = (filter, value, owner) => {
|
|
4
|
+
/* value는 filters-form이나 grid-header에서 처리되므로 이 곳에서는 무시한다. */
|
|
5
|
+
var { name, type, operator, options = [] } = filter;
|
|
6
|
+
if (typeof options === 'function') {
|
|
7
|
+
options = options.call(filter, owner);
|
|
8
|
+
}
|
|
9
|
+
options = options.map((option) => {
|
|
10
|
+
switch (typeof option) {
|
|
11
|
+
case 'string':
|
|
12
|
+
return {
|
|
13
|
+
display: option,
|
|
14
|
+
value: option
|
|
15
|
+
};
|
|
16
|
+
case 'object':
|
|
17
|
+
return {
|
|
18
|
+
display: option.display,
|
|
19
|
+
value: option.value
|
|
20
|
+
};
|
|
21
|
+
default:
|
|
22
|
+
return option;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
return operator === 'in'
|
|
26
|
+
? html `
|
|
27
|
+
${options === null || options === void 0 ? void 0 : options.filter((option) => !!option).map((option) => html ` <ox-checkbox option value=${option.value}>${option.display}</ox-checkbox> `)}
|
|
28
|
+
`
|
|
29
|
+
: html `
|
|
30
|
+
${options === null || options === void 0 ? void 0 : options.map((option) => html ` <div option value=${option.value}>${option.display} </div> `)}
|
|
31
|
+
`;
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=filter-select.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter-select.js","sourceRoot":"","sources":["../../../src/filters/filter-select.ts"],"names":[],"mappings":"AAAA,OAAO,+BAA+B,CAAA;AAEtC,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAI/B,MAAM,CAAC,MAAM,YAAY,GAAyB,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;IACzE,4DAA4D;IAC5D,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,GAAG,EAAE,EAAE,GAAG,MAAM,CAAA;IAEnD,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE;QACjC,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;KACtC;IAED,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,MAAW,EAAE,EAAE;QACpC,QAAQ,OAAO,MAAM,EAAE;YACrB,KAAK,QAAQ;gBACX,OAAO;oBACL,OAAO,EAAE,MAAM;oBACf,KAAK,EAAE,MAAM;iBACd,CAAA;YACH,KAAK,QAAQ;gBACX,OAAO;oBACL,OAAO,EAAE,MAAM,CAAC,OAAO;oBACvB,KAAK,EAAE,MAAM,CAAC,KAAK;iBACpB,CAAA;YACH;gBACE,OAAO,MAAM,CAAA;SAChB;IACH,CAAC,CAAC,CAAA;IAEF,OAAO,QAAQ,KAAK,IAAI;QACtB,CAAC,CAAC,IAAI,CAAA;UACA,OAAO,aAAP,OAAO,uBAAP,OAAO,CACL,MAAM,CAAC,CAAC,MAAuC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,EAC7D,GAAG,CACF,CAAC,MAAuC,EAAE,EAAE,CAC1C,IAAI,CAAA,8BAA8B,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,OAAO,iBAAiB,CACpF;OACJ;QACH,CAAC,CAAC,IAAI,CAAA;UACA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,GAAG,CACZ,CAAC,MAAuC,EAAE,EAAE,CAC1C,IAAI,CAAA,sBAAsB,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,OAAO,eAAe,CAC1E;OACF,CAAA;AACP,CAAC,CAAA","sourcesContent":["import '@operato/input/ox-checkbox.js'\n\nimport { html } from 'lit-html'\n\nimport { FilterSelectRenderer } from './types.js'\n\nexport const FilterSelect: FilterSelectRenderer = (filter, value, owner) => {\n /* value는 filters-form이나 grid-header에서 처리되므로 이 곳에서는 무시한다. */\n var { name, type, operator, options = [] } = filter\n\n if (typeof options === 'function') {\n options = options.call(filter, owner)\n }\n\n options = options.map((option: any) => {\n switch (typeof option) {\n case 'string':\n return {\n display: option,\n value: option\n }\n case 'object':\n return {\n display: option.display,\n value: option.value\n }\n default:\n return option\n }\n })\n\n return operator === 'in'\n ? html`\n ${options\n ?.filter((option: { display: string; value: any }) => !!option)\n .map(\n (option: { display: string; value: any }) =>\n html` <ox-checkbox option value=${option.value}>${option.display}</ox-checkbox> `\n )}\n `\n : html`\n ${options?.map(\n (option: { display: string; value: any }) =>\n html` <div option value=${option.value}>${option.display} </div> `\n )}\n `\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const FilterStyles: import("lit").CSSResult;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
export const FilterStyles = css `
|
|
3
|
+
:host {
|
|
4
|
+
--ox-input-placeholder-color: var(--primary-color);
|
|
5
|
+
|
|
6
|
+
--ox-input-padding: var(--padding-narrow) var(--padding-default);
|
|
7
|
+
--ox-input-border: 1px solid rgba(0, 0, 0, 0.2);
|
|
8
|
+
--ox-input-focus-border: 1px solid var(--primary-color);
|
|
9
|
+
--ox-input-border-radius: var(--border-radius);
|
|
10
|
+
--ox-input-font: normal 14px var(--theme-font);
|
|
11
|
+
--ox-input-color: var(--primary-text-color);
|
|
12
|
+
|
|
13
|
+
--ox-filters-form-gap: var(--margin-wide);
|
|
14
|
+
--ox-filters-form-label-font: var(--label-font);
|
|
15
|
+
--ox-filters-form-label-color: var(--label-color);
|
|
16
|
+
--ox-select-padding: 0 var(--padding-narrow);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
label {
|
|
20
|
+
font: var(--ox-filters-form-label-font);
|
|
21
|
+
color: var(--ox-filters-form-label-color);
|
|
22
|
+
}
|
|
23
|
+
span {
|
|
24
|
+
margin-right: var(--margin-narrow);
|
|
25
|
+
text-transform: capitalize;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
input::placeholder {
|
|
29
|
+
color: var(--ox-input-placeholder-color);
|
|
30
|
+
opacity: 0.6;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
ox-select,
|
|
34
|
+
input {
|
|
35
|
+
padding: var(--input-padding);
|
|
36
|
+
border: none;
|
|
37
|
+
border-bottom: var(--ox-input-border);
|
|
38
|
+
font: var(--ox-input-font);
|
|
39
|
+
color: var(--ox-input-color);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
ox-select:focus,
|
|
43
|
+
input:focus {
|
|
44
|
+
outline: none;
|
|
45
|
+
border-bottom: var(--ox-input-focus-border);
|
|
46
|
+
color: var(--primary-color);
|
|
47
|
+
}
|
|
48
|
+
ox-select {
|
|
49
|
+
padding: var(--ox-select-padding);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
input[type='number'] {
|
|
53
|
+
padding-right: var(--padding-narrow);
|
|
54
|
+
max-width: 90px;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
input[type*='date'],
|
|
58
|
+
input[type*='time'],
|
|
59
|
+
input[type='week'],
|
|
60
|
+
input[type='month'] {
|
|
61
|
+
padding: 8px var(--padding-narrow) 8px var(--padding-default);
|
|
62
|
+
max-width: 170px;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
@media only screen and (max-width: 460px) {
|
|
66
|
+
:host {
|
|
67
|
+
--ox-filters-form-label-font: bold 13px var(--theme-font);
|
|
68
|
+
--ox-input-font: normal 16px var(--theme-font);
|
|
69
|
+
--ox-filters-form-gap: var(--margin-narrow);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
ox-checkbox {
|
|
73
|
+
margin-top: var(--margin-narrow);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
input[from],
|
|
77
|
+
input[to] {
|
|
78
|
+
max-width: 44%;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
input[type*='datetime'][from],
|
|
82
|
+
input[type*='datetime'][to] {
|
|
83
|
+
padding-right: var(--padding-narrow);
|
|
84
|
+
min-width: 91%;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
`;
|
|
88
|
+
//# sourceMappingURL=filter-styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter-styles.js","sourceRoot":"","sources":["../../../src/filters/filter-styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAEzB,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqF9B,CAAA","sourcesContent":["import { css } from 'lit'\n\nexport const FilterStyles = css`\n :host {\n --ox-input-placeholder-color: var(--primary-color);\n\n --ox-input-padding: var(--padding-narrow) var(--padding-default);\n --ox-input-border: 1px solid rgba(0, 0, 0, 0.2);\n --ox-input-focus-border: 1px solid var(--primary-color);\n --ox-input-border-radius: var(--border-radius);\n --ox-input-font: normal 14px var(--theme-font);\n --ox-input-color: var(--primary-text-color);\n\n --ox-filters-form-gap: var(--margin-wide);\n --ox-filters-form-label-font: var(--label-font);\n --ox-filters-form-label-color: var(--label-color);\n --ox-select-padding: 0 var(--padding-narrow);\n }\n\n label {\n font: var(--ox-filters-form-label-font);\n color: var(--ox-filters-form-label-color);\n }\n span {\n margin-right: var(--margin-narrow);\n text-transform: capitalize;\n }\n\n input::placeholder {\n color: var(--ox-input-placeholder-color);\n opacity: 0.6;\n }\n\n ox-select,\n input {\n padding: var(--input-padding);\n border: none;\n border-bottom: var(--ox-input-border);\n font: var(--ox-input-font);\n color: var(--ox-input-color);\n }\n\n ox-select:focus,\n input:focus {\n outline: none;\n border-bottom: var(--ox-input-focus-border);\n color: var(--primary-color);\n }\n ox-select {\n padding: var(--ox-select-padding);\n }\n\n input[type='number'] {\n padding-right: var(--padding-narrow);\n max-width: 90px;\n }\n\n input[type*='date'],\n input[type*='time'],\n input[type='week'],\n input[type='month'] {\n padding: 8px var(--padding-narrow) 8px var(--padding-default);\n max-width: 170px;\n }\n\n @media only screen and (max-width: 460px) {\n :host {\n --ox-filters-form-label-font: bold 13px var(--theme-font);\n --ox-input-font: normal 16px var(--theme-font);\n --ox-filters-form-gap: var(--margin-narrow);\n }\n\n ox-checkbox {\n margin-top: var(--margin-narrow);\n }\n\n input[from],\n input[to] {\n max-width: 44%;\n }\n\n input[type*='datetime'][from],\n input[type*='datetime'][to] {\n padding-right: var(--padding-narrow);\n min-width: 91%;\n }\n }\n`\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './registry.js';
|
|
2
|
+
export * from './filter-select.js';
|
|
3
|
+
export * from './filter-input.js';
|
|
4
|
+
export * from './filter-checkbox.js';
|
|
5
|
+
export * from './filter-range-date.js';
|
|
6
|
+
export * from './filter-range-number.js';
|
|
7
|
+
export * from './ox-filters-form-base.js';
|
|
8
|
+
export * from './types.js';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './registry.js';
|
|
2
|
+
export * from './filter-select.js';
|
|
3
|
+
export * from './filter-input.js';
|
|
4
|
+
export * from './filter-checkbox.js';
|
|
5
|
+
export * from './filter-range-date.js';
|
|
6
|
+
export * from './filter-range-number.js';
|
|
7
|
+
export * from './ox-filters-form-base.js';
|
|
8
|
+
export * from './types.js';
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/filters/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAE7B,cAAc,oBAAoB,CAAA;AAClC,cAAc,mBAAmB,CAAA;AACjC,cAAc,sBAAsB,CAAA;AACpC,cAAc,wBAAwB,CAAA;AACtC,cAAc,0BAA0B,CAAA;AAExC,cAAc,2BAA2B,CAAA;AACzC,cAAc,YAAY,CAAA","sourcesContent":["export * from './registry.js'\n\nexport * from './filter-select.js'\nexport * from './filter-input.js'\nexport * from './filter-checkbox.js'\nexport * from './filter-range-date.js'\nexport * from './filter-range-number.js'\n\nexport * from './ox-filters-form-base.js'\nexport * from './types.js'\n"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import '@operato/input/ox-checkbox.js';
|
|
2
|
+
import '@operato/input/ox-select.js';
|
|
3
|
+
import '@operato/popup/ox-popup-list.js';
|
|
4
|
+
import '@operato/input/ox-input-search.js';
|
|
5
|
+
import { LitElement, PropertyValues, TemplateResult } from 'lit';
|
|
6
|
+
import { FilterConfig, FilterOperator, FilterValue } from './types.js';
|
|
7
|
+
export declare type QueryFilterRangeValue = [from: number, to: number];
|
|
8
|
+
export declare type QueryFilter = {
|
|
9
|
+
name: string;
|
|
10
|
+
operator: FilterOperator;
|
|
11
|
+
value: any;
|
|
12
|
+
};
|
|
13
|
+
export declare class FiltersFormBase extends LitElement {
|
|
14
|
+
static styles: import("lit").CSSResult[];
|
|
15
|
+
value: FilterValue[];
|
|
16
|
+
filters: FilterConfig[];
|
|
17
|
+
urlParamsSensitive?: boolean;
|
|
18
|
+
form: HTMLFormElement;
|
|
19
|
+
private _popstateEventHandler?;
|
|
20
|
+
private _filtersChangeHandler?;
|
|
21
|
+
connectedCallback(): void;
|
|
22
|
+
render(): TemplateResult;
|
|
23
|
+
updated(changes: PropertyValues<this>): Promise<void>;
|
|
24
|
+
getQueryFilters(): Promise<QueryFilter[]>;
|
|
25
|
+
}
|