ywana-core8 0.0.678 → 0.0.679
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/dist/index.cjs +30 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +39 -0
- package/dist/index.css.map +1 -1
- package/dist/index.modern.js +30 -9
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +30 -9
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/domain/CollectionPage.css +39 -0
- package/src/domain/CollectionPage.js +29 -10
- package/src/site/site.test.js +3 -3
package/package.json
CHANGED
@@ -67,4 +67,43 @@ main.collection-page.dock-to-right>main {
|
|
67
67
|
|
68
68
|
main.collection-page.dock-to-right>article {
|
69
69
|
grid-area: dock;
|
70
|
+
}
|
71
|
+
|
72
|
+
.filters-header>.icon {
|
73
|
+
width: 2rem;
|
74
|
+
font-size: 1.2rem;
|
75
|
+
}
|
76
|
+
|
77
|
+
.filters-resume {
|
78
|
+
flex: 1;
|
79
|
+
display: flex;
|
80
|
+
flex-wrap: wrap;
|
81
|
+
}
|
82
|
+
|
83
|
+
.filter-field {
|
84
|
+
flex: 0;
|
85
|
+
display: flex;
|
86
|
+
padding: .2rem .4rem;
|
87
|
+
margin: .2rem;
|
88
|
+
align-items: baseline;
|
89
|
+
background-color: var(--background-color);
|
90
|
+
border-radius: .2rem;
|
91
|
+
}
|
92
|
+
|
93
|
+
.filter-field>label {
|
94
|
+
display: flex;
|
95
|
+
font-size: .7rem;
|
96
|
+
color: var(--text-color-lighter);
|
97
|
+
margin-right: .2rem;
|
98
|
+
}
|
99
|
+
|
100
|
+
.filter-field>.value {
|
101
|
+
font-size: .8rem;
|
102
|
+
padding:
|
103
|
+
}
|
104
|
+
|
105
|
+
.placeholder {
|
106
|
+
font-size: .8rem;
|
107
|
+
font-style: italic;
|
108
|
+
color: var(--text-color-lighter);
|
70
109
|
}
|
@@ -75,7 +75,7 @@ export const CollectionPage = (props) => {
|
|
75
75
|
</Header>
|
76
76
|
<menu className={`collection-page ${className}`}>
|
77
77
|
{canFilter ? <CollectionFilters schema={schema} /> : null}
|
78
|
-
{levels ? <CollectionTree schema={schema} icon={icon} levels={levels} onSelect={onSelect} sorter={sorter} searchBy={searchBy} namer={namer}/> : <CollectionList groupBy={groupBy} onSelect={onSelect} searchBy={searchBy} />}
|
78
|
+
{levels ? <CollectionTree schema={schema} icon={icon} levels={levels} onSelect={onSelect} sorter={sorter} searchBy={searchBy} namer={namer} /> : <CollectionList groupBy={groupBy} onSelect={onSelect} searchBy={searchBy} />}
|
79
79
|
</menu>
|
80
80
|
<main key={id} className={`collection-page ${className}`}>
|
81
81
|
<CollectionEditor icon={icon} schema={schema} layout={editor} autosave={autosave} delay={delay} canDelete={canDelete} onReload={reloadSelection} patch={patch} onChange={onChange} />
|
@@ -95,7 +95,7 @@ export const CollectionFilters = (props) => {
|
|
95
95
|
|
96
96
|
const { schema, onChange } = props
|
97
97
|
const [form, setForm] = useState({})
|
98
|
-
const [
|
98
|
+
const [showFilters, setShowFilters] = useState(false)
|
99
99
|
|
100
100
|
const filterSchema = useMemo(() => {
|
101
101
|
const filterSchema = Object.assign({}, schema)
|
@@ -127,19 +127,17 @@ export const CollectionFilters = (props) => {
|
|
127
127
|
}
|
128
128
|
|
129
129
|
function toggleFilters() {
|
130
|
-
|
130
|
+
setShowFilters(!showFilters)
|
131
131
|
}
|
132
132
|
|
133
133
|
const content = new Content(filterSchema, form)
|
134
134
|
return (
|
135
135
|
<Fragment>
|
136
|
-
<header>
|
137
|
-
<
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
</header>
|
142
|
-
{showFilter ? (
|
136
|
+
<Header icon="filter_list" className="filters-header">
|
137
|
+
{showFilters ? <Icon icon="expand_less" size="small" clickable action={toggleFilters} /> : <Icon icon="expand_more" size="small" clickable action={toggleFilters} />}
|
138
|
+
<FilterResume form={form} />
|
139
|
+
</Header>
|
140
|
+
{showFilters ? (
|
143
141
|
<>
|
144
142
|
<nav className="collection-filters">
|
145
143
|
<Icon icon="clear_all" size="small" clickable action={clear} />
|
@@ -153,6 +151,27 @@ export const CollectionFilters = (props) => {
|
|
153
151
|
)
|
154
152
|
}
|
155
153
|
|
154
|
+
const FilterResume = (props) => {
|
155
|
+
|
156
|
+
const { form = {} } = props
|
157
|
+
|
158
|
+
const fields = Object.keys(form)
|
159
|
+
.filter(key => form[key] !== undefined && form[key] !== null && form[key] !== "")
|
160
|
+
|
161
|
+
return (
|
162
|
+
<div className='filters-resume'>
|
163
|
+
{
|
164
|
+
fields.length > 0 ? fields.map(key => (
|
165
|
+
<div className='filter-field'>
|
166
|
+
<label>{key}</label>
|
167
|
+
<div className='value'>{form[key]}</div>
|
168
|
+
</div>
|
169
|
+
)) : <div className="placeholder">No se aplican filtros</div>
|
170
|
+
}
|
171
|
+
</div>
|
172
|
+
)
|
173
|
+
}
|
174
|
+
|
156
175
|
/**
|
157
176
|
* Collection List
|
158
177
|
*/
|
package/src/site/site.test.js
CHANGED
@@ -205,11 +205,11 @@ const Page5 = (props) => {
|
|
205
205
|
{ label: "Pendiente", value: "NOT_CLASSIFIED" },
|
206
206
|
{ label: "Clasificada", value: "CLASSIFIED"},
|
207
207
|
]},
|
208
|
-
field1: { id: "field1", section: "A", type: TYPES.STRING , format: FORMATS.NONE , required: true, tab: false, grouper: true , column: true , filter:
|
209
|
-
field2: { id: "field2", section: "B", type: TYPES.STRING , format: FORMATS.NONE , required: true, tab: false, grouper: true , column: true , filter:
|
208
|
+
field1: { id: "field1", section: "A", type: TYPES.STRING , format: FORMATS.NONE , required: true, tab: false, grouper: true , column: true , filter: true , label: "field1" },
|
209
|
+
field2: { id: "field2", section: "B", type: TYPES.STRING , format: FORMATS.NONE , required: true, tab: false, grouper: true , column: true , filter: true , label: "field2" },
|
210
210
|
field4: { id: "field4", section: "B", type: TYPES.STRING , format: FORMATS.COLOR, required: true, tab: false, grouper: true , column: true , filter: false , label: "Color" },
|
211
211
|
field5: { id: "field5", section: "B", type: TYPES.ENTITY, item: ENTITYTYPE, format: FORMATS.NONE , editable: true, tab: false, grouper: false, column: true , filter: false, like: false, label: "Entity5"},
|
212
|
-
id
|
212
|
+
id : { id: "id" , type: TYPES.STRING , filter: false },
|
213
213
|
}
|
214
214
|
|
215
215
|
return (
|