@inglorious/web 4.4.0 → 4.5.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.
@@ -1,133 +0,0 @@
1
- .iw-select {
2
- .iw-select-control {
3
- min-height: 2em;
4
- border: 1px solid #ccc;
5
- border-radius: 0.25em;
6
- padding: 0.5em 0.75em;
7
- background: white;
8
- gap: 0.5em;
9
-
10
- &:hover {
11
- border-color: #999;
12
- }
13
-
14
- &.iw-select-control-open {
15
- border-color: #007bff;
16
- outline: 2px solid rgba(0, 123, 255, 0.25);
17
- }
18
-
19
- &.iw-select-control-disabled {
20
- background: #f5f5f5;
21
- cursor: not-allowed;
22
- opacity: 0.6;
23
- }
24
-
25
- &.iw-select-control-selection {
26
- padding: 0.25em 0.75em;
27
- }
28
-
29
- .iw-select-placeholder {
30
- color: #999;
31
- }
32
-
33
- .iw-select-multi-value {
34
- gap: 0.25em;
35
-
36
- .iw-select-multi-value-tag {
37
- padding: 0.25em 0.5em;
38
- background: #e9ecef;
39
- border-radius: 0.25em;
40
- gap: 0.25em;
41
-
42
- .iw-select-multi-value-tag-label {
43
- font-size: 0.75em;
44
- }
45
-
46
- .iw-select-multi-value-remove {
47
- font-size: 1.2em;
48
- line-height: 1;
49
- }
50
- }
51
- }
52
-
53
- .iw-select-clear,
54
- .iw-select-arrow {
55
- width: 1.2em;
56
- height: 1.2em;
57
- display: flex;
58
- justify-content: center;
59
- align-items: center;
60
- }
61
-
62
- .iw-select-clear {
63
- span {
64
- font-size: 1.2em;
65
- line-height: 1;
66
- }
67
- }
68
-
69
- .iw-select-arrow {
70
- transition: transform 0.2s;
71
-
72
- span {
73
- font-size: 0.75em;
74
- }
75
- }
76
-
77
- &.iw-select-control-open {
78
- .iw-select-arrow {
79
- transform: rotate(180deg);
80
- }
81
- }
82
- }
83
- .iw-select-dropdown {
84
- max-height: 18em;
85
- overflow: hidden;
86
- background: white;
87
- border: 1px solid #ccc;
88
- border-radius: 4px;
89
- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
90
-
91
- .iw-select-dropdown-search {
92
- padding: 0.5em 0.75em;
93
- border: none;
94
- border-bottom: 1px solid #eee;
95
- outline: none;
96
- }
97
-
98
- .iw-select-dropdown-options {
99
- max-height: 15em;
100
- overflow-y: auto;
101
-
102
- .iw-select-dropdown-options-option {
103
- padding: 0.5em 0.75em;
104
- gap: 0.5em;
105
-
106
- &.iw-select-dropdown-options-option-disabled {
107
- opacity: 0.5;
108
- cursor: not-allowed;
109
-
110
- input[type="checkbox"] {
111
- cursor: not-allowed;
112
- }
113
- }
114
- }
115
-
116
- .iw-select-dropdown-options-option:hover,
117
- .iw-select-dropdown-options-option-focused {
118
- background: #f8f9fa;
119
- }
120
-
121
- .iw-select-dropdown-options-option-selected {
122
- background: #e7f3ff;
123
- }
124
- }
125
-
126
- .iw-select-loading,
127
- .iw-select-no-options {
128
- padding: 0.75em;
129
- text-align: center;
130
- color: #999;
131
- }
132
- }
133
- }
@@ -1,34 +0,0 @@
1
- .iw-table {
2
- user-select: none;
3
-
4
- .iw-table-header {
5
- display: flex;
6
- flex-direction: column;
7
- }
8
-
9
- .iw-table-header-row {
10
- display: flex;
11
- }
12
-
13
- .iw-table-header-column {
14
- display: flex;
15
- flex-direction: column;
16
- }
17
-
18
- .iw-table-filter-input,
19
- .iw-table-filter-select {
20
- width: 100%;
21
- }
22
-
23
- .iw-table-searchbar {
24
- width: 100%;
25
- }
26
-
27
- .iw-table-row {
28
- display: flex;
29
- }
30
-
31
- .iw-table-footer-row {
32
- display: flex;
33
- }
34
- }
@@ -1,42 +0,0 @@
1
- import { html } from "@inglorious/web"
2
-
3
- const INPUT_TYPE = {
4
- date: "date",
5
- time: "time",
6
- datetime: "datetime-local",
7
- }
8
-
9
- export const dateFilter = {
10
- render(entity, column, api) {
11
- const filter = entity.filters[column.id] ?? {}
12
-
13
- return html`<input
14
- name=${`${column.id}Min`}
15
- type=${INPUT_TYPE[column.filter.type]}
16
- value=${entity.filters[column.id]}
17
- @input=${(event) => {
18
- const value = event.target.value
19
- const formattedValue = value ? new Date(value).getTime() : null
20
-
21
- api.notify(`#${entity.id}:filterChange`, {
22
- columnId: column.id,
23
- value: { ...filter, min: formattedValue },
24
- })
25
- }}
26
- />
27
- <input
28
- name=${`${column.id}Max`}
29
- type=${INPUT_TYPE[column.filter.type]}
30
- value=${entity.filters[column.id]}
31
- @input=${(event) => {
32
- const value = event.target.value
33
- const formattedValue = value ? new Date(value).getTime() : null
34
-
35
- api.notify(`#${entity.id}:filterChange`, {
36
- columnId: column.id,
37
- value: { ...filter, max: formattedValue },
38
- })
39
- }}
40
- />`
41
- },
42
- }
@@ -1,22 +0,0 @@
1
- import { html } from "@inglorious/web"
2
-
3
- export const numberFilter = {
4
- render(entity, column, api) {
5
- return html`<input
6
- name=${column.id}
7
- type="number"
8
- placeholder=${column.filter.placeholder ?? "="}
9
- value=${entity.filters[column.id]}
10
- @input=${(event) => {
11
- const value = event.target.value
12
- const formattedValue = value ? Number(value) : null
13
-
14
- api.notify(`#${entity.id}:filterChange`, {
15
- columnId: column.id,
16
- value: formattedValue,
17
- })
18
- }}
19
- class="iw-table-cell-number"
20
- />`
21
- },
22
- }
@@ -1,40 +0,0 @@
1
- import { html } from "@inglorious/web"
2
-
3
- export const rangeFilter = {
4
- render(entity, column, api) {
5
- const filter = entity.filters[column.id] ?? {}
6
-
7
- return html`<input
8
- name=${`${column.id}Min`}
9
- type="number"
10
- placeholder=${column.filter.placeholder ?? "≥"}
11
- value=${filter.min}
12
- @input=${(event) => {
13
- const value = event.target.value
14
- const formattedValue = value ? Number(value) : null
15
-
16
- api.notify(`#${entity.id}:filterChange`, {
17
- columnId: column.id,
18
- value: { ...filter, min: formattedValue },
19
- })
20
- }}
21
- class="iw-table-cell-number"
22
- />
23
- <input
24
- name=${`${column.id}Max`}
25
- type="number"
26
- placeholder=${column.filter.placeholder ?? "≤"}
27
- value=${filter.max}
28
- @input=${(event) => {
29
- const value = event.target.value
30
- const formattedValue = value ? Number(value) : null
31
-
32
- api.notify(`#${entity.id}:filterChange`, {
33
- columnId: column.id,
34
- value: { ...filter, max: formattedValue },
35
- })
36
- }}
37
- class="iw-table-cell-number"
38
- />`
39
- },
40
- }
@@ -1,34 +0,0 @@
1
- import { html } from "@inglorious/web"
2
-
3
- export const selectFilter = {
4
- render(entity, column, api) {
5
- return html`<select
6
- name=${column.id}
7
- ?multiple=${column.filter.isMultiple}
8
- autocomplete="off"
9
- value=${entity.filters[column.id]}
10
- @change=${(event) => {
11
- const value = event.target.value
12
- const formattedValue = value ? format(value, column.type) : null
13
-
14
- api.notify(`#${entity.id}:filterChange`, {
15
- columnId: column.id,
16
- value: formattedValue,
17
- })
18
- }}
19
- >
20
- ${column.filter.options.map(
21
- (option) => html`<option value=${option}>${option}</option>`,
22
- )}
23
- </select>`
24
- },
25
- }
26
-
27
- function format(value, type) {
28
- if (type === "number") return Number(value)
29
- if (type === "boolean")
30
- return value === "true" ? true : value === "false" ? false : null
31
- if (["date", "time", "datetime"].includes(type))
32
- return new Date(value).getTime()
33
- return value
34
- }
@@ -1,22 +0,0 @@
1
- import { html } from "@inglorious/web"
2
-
3
- export const textFilter = {
4
- render(entity, column, api) {
5
- return html`<input
6
- name=${column.id}
7
- type="text"
8
- placeholder=${column.filter.placeholder ?? "Contains..."}
9
- autocomplete="off"
10
- value=${entity.filters[column.id]}
11
- @input=${(event) => {
12
- const value = event.target.value
13
- const formattedValue = value || null
14
-
15
- api.notify(`#${entity.id}:filterChange`, {
16
- columnId: column.id,
17
- value: formattedValue,
18
- })
19
- }}
20
- />`
21
- },
22
- }
@@ -1,24 +0,0 @@
1
- import { choose, html } from "@inglorious/web"
2
-
3
- import { dateFilter } from "./filters/date.js"
4
- import { numberFilter } from "./filters/number.js"
5
- import { rangeFilter } from "./filters/range.js"
6
- import { selectFilter } from "./filters/select.js"
7
- import { textFilter } from "./filters/text.js"
8
-
9
- export const filters = {
10
- render(entity, column, api) {
11
- return html`${choose(
12
- column.filter.type,
13
- [
14
- ["number", () => numberFilter.render(entity, column, api)],
15
- ["range", () => rangeFilter.render(entity, column, api)],
16
- ["select", () => selectFilter.render(entity, column, api)],
17
- ["date", () => dateFilter.render(entity, column, api)],
18
- ["time", () => dateFilter.render(entity, column, api)],
19
- ["datetime", () => dateFilter.render(entity, column, api)],
20
- ],
21
- () => textFilter.render(entity, column, api),
22
- )}`
23
- },
24
- }
@@ -1,7 +0,0 @@
1
- import { logic } from "./logic.js"
2
- import { rendering } from "./rendering.js"
3
-
4
- export const table = {
5
- ...logic,
6
- ...rendering,
7
- }