@g9tm/lynxcontrols-projects 2.5.9 → 2.5.10
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 +5 -0
- package/catalog/cards/G9ActivityFeed.md +17 -0
- package/catalog/cards/G9FileBrowser.md +17 -0
- package/catalog/cards/G9FormBuilder.md +15 -0
- package/catalog/cards/G9OrgChart.md +17 -0
- package/catalog/cards/G9QuestionField.md +17 -0
- package/catalog/cards/G9Timeline.md +3 -3
- package/catalog/catalog.json +2090 -18
- package/catalog/index.md +6 -1
- package/dist/.tsbuildinfo +1 -1
- package/dist/activity.css +105 -0
- package/dist/activity.css.map +1 -0
- package/dist/activity.d.ts +49 -0
- package/dist/activity.d.ts.map +1 -0
- package/dist/activity.jsx +129 -0
- package/dist/files.css +264 -0
- package/dist/files.css.map +1 -0
- package/dist/files.d.ts +86 -0
- package/dist/files.d.ts.map +1 -0
- package/dist/files.jsx +318 -0
- package/dist/forms.css +144 -0
- package/dist/forms.css.map +1 -0
- package/dist/forms.d.ts +89 -0
- package/dist/forms.d.ts.map +1 -0
- package/dist/forms.jsx +359 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.jsx +4 -0
- package/dist/org-chart.css +127 -0
- package/dist/org-chart.css.map +1 -0
- package/dist/org-chart.d.ts +73 -0
- package/dist/org-chart.d.ts.map +1 -0
- package/dist/org-chart.jsx +388 -0
- package/dist/projects.css +49 -0
- package/dist/projects.css.map +1 -1
- package/dist/rule-builder.d.ts +6 -0
- package/dist/rule-builder.d.ts.map +1 -1
- package/dist/rule-builder.jsx +24 -3
- package/dist/timeline.d.ts +28 -0
- package/dist/timeline.d.ts.map +1 -1
- package/dist/timeline.jsx +150 -14
- package/package.json +3 -3
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { g9IdProps } from "@g9tm/lynxcontrols/base";
|
|
2
|
+
import { G9Button } from "@g9tm/lynxcontrols/button";
|
|
3
|
+
import { G9ActivityIndicator, G9Avatar, avatarTone } from "@g9tm/lynxcontrols/display";
|
|
4
|
+
import { G9Icon } from "@g9tm/lynxcontrols/icon";
|
|
5
|
+
import { G9VirtualList } from "@g9tm/lynxcontrols/list";
|
|
6
|
+
import { useG9Culture, useG9Direction } from "@g9tm/lynxcontrols/provider";
|
|
7
|
+
import { formatLocalDateTime, localDateTimeFromEpochMs, toEpochDays, toNativeDigits } from "@g9tm/lynxcontrols-foundation";
|
|
8
|
+
import "./activity.css";
|
|
9
|
+
function G9ActivityFeed(props) {
|
|
10
|
+
var _props_utcOffsetMinutes, _props_words, _ref, _props_now, _w_empty, _props_height;
|
|
11
|
+
var _sorted_;
|
|
12
|
+
const rtl = 'rtl' === useG9Direction();
|
|
13
|
+
const culture = useG9Culture();
|
|
14
|
+
const offset = null != (_props_utcOffsetMinutes = props.utcOffsetMinutes) ? _props_utcOffsetMinutes : 0;
|
|
15
|
+
const w = null != (_props_words = props.words) ? _props_words : {};
|
|
16
|
+
const sorted = [
|
|
17
|
+
...props.items
|
|
18
|
+
].sort((a, b)=>b.at - a.at);
|
|
19
|
+
const dayOf = (ms)=>toEpochDays(localDateTimeFromEpochMs(ms, offset));
|
|
20
|
+
const today = dayOf(null != (_ref = null != (_props_now = props.now) ? _props_now : null == (_sorted_ = sorted[0]) ? void 0 : _sorted_.at) ? _ref : 0);
|
|
21
|
+
const label = (ms)=>{
|
|
22
|
+
const d = dayOf(ms);
|
|
23
|
+
if (props.dayLabel) return props.dayLabel(ms, d);
|
|
24
|
+
if (d === today && w.today) return w.today;
|
|
25
|
+
if (d === today - 1 && w.yesterday) return w.yesterday;
|
|
26
|
+
return formatLocalDateTime(localDateTimeFromEpochMs(ms, offset), 'dddd d MMMM', culture);
|
|
27
|
+
};
|
|
28
|
+
const time = (ms)=>{
|
|
29
|
+
const t = localDateTimeFromEpochMs(ms, offset);
|
|
30
|
+
return toNativeDigits(`${String(t.hour).padStart(2, '0')}:${String(t.minute).padStart(2, '0')}`, culture.numberingSystem);
|
|
31
|
+
};
|
|
32
|
+
const rows = [];
|
|
33
|
+
let day = null;
|
|
34
|
+
sorted.forEach((item, i)=>{
|
|
35
|
+
const d = dayOf(item.at);
|
|
36
|
+
if (d !== day) {
|
|
37
|
+
day = d;
|
|
38
|
+
rows.push({
|
|
39
|
+
kind: 'day',
|
|
40
|
+
key: `d${d}`,
|
|
41
|
+
label: label(item.at)
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
const nextDay = sorted[i + 1] ? dayOf(sorted[i + 1].at) : null;
|
|
45
|
+
rows.push({
|
|
46
|
+
kind: 'item',
|
|
47
|
+
key: item.id,
|
|
48
|
+
item,
|
|
49
|
+
last: nextDay !== d
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
if (props.onMore || props.loading) rows.push({
|
|
53
|
+
kind: 'more',
|
|
54
|
+
key: '__more'
|
|
55
|
+
});
|
|
56
|
+
const align = {
|
|
57
|
+
textAlign: rtl ? 'right' : 'left'
|
|
58
|
+
};
|
|
59
|
+
const id = (part)=>props.id ? `${props.id}_${part}` : void 0;
|
|
60
|
+
const render = (r)=>{
|
|
61
|
+
var _w_more, _it_actor_avatar, _it_actor_id;
|
|
62
|
+
if ('day' === r.kind) return <view className="g9-feed__day">
|
|
63
|
+
<text className="g9-feed__day-text" style={align}>
|
|
64
|
+
{r.label}
|
|
65
|
+
</text>
|
|
66
|
+
</view>;
|
|
67
|
+
if ('more' === r.kind) return <view className="g9-feed__more">
|
|
68
|
+
{props.loading ? <G9ActivityIndicator running={true} size={20}/> : <G9Button {...id('More') ? {
|
|
69
|
+
id: id('More')
|
|
70
|
+
} : {}} text={null != (_w_more = w.more) ? _w_more : '…'} variant="ghost" size="small" onPress={()=>{
|
|
71
|
+
var _props_onMore;
|
|
72
|
+
return null == (_props_onMore = props.onMore) ? void 0 : _props_onMore.call(props);
|
|
73
|
+
}}/>}
|
|
74
|
+
</view>;
|
|
75
|
+
const it = r.item;
|
|
76
|
+
return <view className="g9-feed__item" {...g9IdProps(id(it.id))} style={{
|
|
77
|
+
flexDirection: rtl ? 'row-reverse' : 'row',
|
|
78
|
+
direction: 'ltr'
|
|
79
|
+
}} {...props.onOpen ? {
|
|
80
|
+
bindtap: ()=>{
|
|
81
|
+
var _props_onOpen;
|
|
82
|
+
return null == (_props_onOpen = props.onOpen) ? void 0 : _props_onOpen.call(props, it);
|
|
83
|
+
}
|
|
84
|
+
} : {}} accessibility-element={true} accessibility-label={[
|
|
85
|
+
it.actor.name,
|
|
86
|
+
it.text,
|
|
87
|
+
it.detail,
|
|
88
|
+
time(it.at)
|
|
89
|
+
].filter(Boolean).join(', ')}>
|
|
90
|
+
<view className="g9-feed__rail">
|
|
91
|
+
<view className={`g9-feed__stem${r.last ? ' g9-feed__stem--last' : ''}`}/>
|
|
92
|
+
<view className="g9-feed__node" style={it.color ? {
|
|
93
|
+
backgroundColor: it.color
|
|
94
|
+
} : {}}>
|
|
95
|
+
{it.icon ? <G9Icon icon={it.icon} size={12} color="var(--g9-on-primary)"/> : null}
|
|
96
|
+
</view>
|
|
97
|
+
</view>
|
|
98
|
+
<G9Avatar name={it.actor.name} image={null != (_it_actor_avatar = it.actor.avatar) ? _it_actor_avatar : null} size={28} tone={avatarTone(null != (_it_actor_id = it.actor.id) ? _it_actor_id : it.actor.name)}/>
|
|
99
|
+
<view className="g9-feed__texts">
|
|
100
|
+
<text className="g9-feed__text" style={{
|
|
101
|
+
...align,
|
|
102
|
+
direction: rtl ? 'rtl' : 'ltr'
|
|
103
|
+
}}>
|
|
104
|
+
{}
|
|
105
|
+
<text className="g9-feed__actor">{`${rtl ? '' : ''}${it.actor.name} `}</text>
|
|
106
|
+
{it.text}
|
|
107
|
+
</text>
|
|
108
|
+
{it.detail ? <text className="g9-feed__detail" style={align}>
|
|
109
|
+
{it.detail}
|
|
110
|
+
</text> : null}
|
|
111
|
+
</view>
|
|
112
|
+
<text className="g9-feed__time">{time(it.at)}</text>
|
|
113
|
+
</view>;
|
|
114
|
+
};
|
|
115
|
+
if (0 === sorted.length && !props.loading) return <view className="g9-feed" {...g9IdProps(props.id)}>
|
|
116
|
+
<text className="g9-feed__empty">{null != (_w_empty = w.empty) ? _w_empty : ''}</text>
|
|
117
|
+
</view>;
|
|
118
|
+
if (false === props.virtual) return <view className="g9-feed" {...g9IdProps(props.id)}>
|
|
119
|
+
{rows.map((r)=><view key={r.key}>{render(r)}</view>)}
|
|
120
|
+
</view>;
|
|
121
|
+
return <view className="g9-feed" {...g9IdProps(props.id)} style={{
|
|
122
|
+
height: `${null != (_props_height = props.height) ? _props_height : 480}px`
|
|
123
|
+
}}>
|
|
124
|
+
<G9VirtualList {...id('List') ? {
|
|
125
|
+
id: id('List')
|
|
126
|
+
} : {}} items={rows} getKey={(r)=>r.key} isSticky={(r)=>'day' === r.kind} isFullSpan={(r)=>'item' !== r.kind} reuseKey={(r)=>r.kind} estimatedSize={(r)=>'day' === r.kind ? 32 : 'more' === r.kind ? 48 : 56} renderItem={render}/>
|
|
127
|
+
</view>;
|
|
128
|
+
}
|
|
129
|
+
export { G9ActivityFeed };
|
package/dist/files.css
ADDED
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
.g9-files {
|
|
2
|
+
flex-direction: column;
|
|
3
|
+
row-gap: 8px;
|
|
4
|
+
display: flex;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.g9-files__top {
|
|
8
|
+
align-items: center;
|
|
9
|
+
column-gap: 8px;
|
|
10
|
+
padding: 8px 12px 0;
|
|
11
|
+
display: flex;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.g9-files__crumbs {
|
|
15
|
+
flex: 1;
|
|
16
|
+
min-width: 0;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.g9-files__crumb-row {
|
|
20
|
+
flex-wrap: wrap;
|
|
21
|
+
align-items: center;
|
|
22
|
+
display: flex;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.g9-files__crumb-step {
|
|
26
|
+
align-items: center;
|
|
27
|
+
display: flex;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.g9-files__crumb {
|
|
31
|
+
padding: 6px;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.g9-files__crumb-text {
|
|
35
|
+
font-size: 13px;
|
|
36
|
+
font-family: var(--g9-font-text);
|
|
37
|
+
color: var(--g9-primary);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.g9-files__crumb-text--here {
|
|
41
|
+
font-weight: 600;
|
|
42
|
+
font-family: var(--g9-font-text-600);
|
|
43
|
+
color: var(--g9-text-primary);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.g9-files__sort {
|
|
47
|
+
column-gap: 14px;
|
|
48
|
+
padding: 0 16px;
|
|
49
|
+
display: flex;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.g9-files__sort-key {
|
|
53
|
+
align-items: center;
|
|
54
|
+
column-gap: 2px;
|
|
55
|
+
padding: 4px 0;
|
|
56
|
+
display: flex;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.g9-files__sort-text {
|
|
60
|
+
font-size: 12px;
|
|
61
|
+
font-family: var(--g9-font-text);
|
|
62
|
+
color: var(--g9-text-secondary);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.g9-files__sort-text--on {
|
|
66
|
+
color: var(--g9-primary);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.g9-files__selection {
|
|
70
|
+
background-color: var(--g9-primary-container);
|
|
71
|
+
border-radius: 10px;
|
|
72
|
+
align-items: center;
|
|
73
|
+
column-gap: 8px;
|
|
74
|
+
margin: 0 12px;
|
|
75
|
+
padding: 6px 10px;
|
|
76
|
+
display: flex;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.g9-files__selection-text {
|
|
80
|
+
font-size: 13px;
|
|
81
|
+
font-weight: 600;
|
|
82
|
+
font-family: var(--g9-font-text-600);
|
|
83
|
+
color: var(--g9-on-primary-container);
|
|
84
|
+
flex: 1;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.g9-files__selection-actions {
|
|
88
|
+
align-items: center;
|
|
89
|
+
column-gap: 4px;
|
|
90
|
+
display: flex;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.g9-files__empty {
|
|
94
|
+
flex-direction: column;
|
|
95
|
+
align-items: center;
|
|
96
|
+
row-gap: 6px;
|
|
97
|
+
padding: 32px 24px;
|
|
98
|
+
display: flex;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.g9-files__empty-text {
|
|
102
|
+
font-size: 14px;
|
|
103
|
+
font-weight: 600;
|
|
104
|
+
font-family: var(--g9-font-text-600);
|
|
105
|
+
color: var(--g9-text-secondary);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.g9-files__empty-hint {
|
|
109
|
+
font-size: 12px;
|
|
110
|
+
font-family: var(--g9-font-text);
|
|
111
|
+
text-align: center;
|
|
112
|
+
color: var(--g9-text-tertiary);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.g9-files__grid {
|
|
116
|
+
flex-wrap: wrap;
|
|
117
|
+
padding: 0 8px;
|
|
118
|
+
display: flex;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.g9-files__cell {
|
|
122
|
+
padding: 4px;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.g9-files__tile {
|
|
126
|
+
background-color: var(--g9-surface-container);
|
|
127
|
+
border: 2px solid #0000;
|
|
128
|
+
border-radius: 12px;
|
|
129
|
+
flex-direction: column;
|
|
130
|
+
width: 100%;
|
|
131
|
+
display: flex;
|
|
132
|
+
overflow: hidden;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.g9-files__tile--on {
|
|
136
|
+
border-color: var(--g9-primary);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.g9-files__preview {
|
|
140
|
+
aspect-ratio: 4 / 3;
|
|
141
|
+
background-color: var(--g9-surface-container-high);
|
|
142
|
+
justify-content: center;
|
|
143
|
+
align-items: center;
|
|
144
|
+
display: flex;
|
|
145
|
+
position: relative;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.g9-files__thumb {
|
|
149
|
+
position: absolute;
|
|
150
|
+
top: 0;
|
|
151
|
+
bottom: 0;
|
|
152
|
+
left: 0;
|
|
153
|
+
right: 0;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.g9-files__tile-foot {
|
|
157
|
+
align-items: center;
|
|
158
|
+
column-gap: 2px;
|
|
159
|
+
padding: 4px 4px 4px 8px;
|
|
160
|
+
display: flex;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.g9-files__name {
|
|
164
|
+
min-width: 0;
|
|
165
|
+
font-size: 12px;
|
|
166
|
+
font-family: var(--g9-font-text);
|
|
167
|
+
color: var(--g9-text-primary);
|
|
168
|
+
flex: 1;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.g9-files__menu {
|
|
172
|
+
display: flex;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.g9-files__check {
|
|
176
|
+
border-style: solid;
|
|
177
|
+
border-width: 2px;
|
|
178
|
+
border-color: var(--g9-outline);
|
|
179
|
+
background-color: var(--g9-surface);
|
|
180
|
+
border-radius: 10px;
|
|
181
|
+
justify-content: center;
|
|
182
|
+
align-items: center;
|
|
183
|
+
width: 20px;
|
|
184
|
+
height: 20px;
|
|
185
|
+
display: flex;
|
|
186
|
+
position: absolute;
|
|
187
|
+
top: 6px;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.g9-files__check--on {
|
|
191
|
+
border-color: var(--g9-primary);
|
|
192
|
+
background-color: var(--g9-primary);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.g9-files__progress {
|
|
196
|
+
background-color: var(--g9-outline-variant);
|
|
197
|
+
height: 3px;
|
|
198
|
+
position: absolute;
|
|
199
|
+
bottom: 0;
|
|
200
|
+
left: 0;
|
|
201
|
+
right: 0;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.g9-files__progress-fill {
|
|
205
|
+
background-color: var(--g9-primary);
|
|
206
|
+
position: absolute;
|
|
207
|
+
top: 0;
|
|
208
|
+
bottom: 0;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.g9-files__list {
|
|
212
|
+
flex-direction: column;
|
|
213
|
+
display: flex;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.g9-files__row {
|
|
217
|
+
align-items: center;
|
|
218
|
+
column-gap: 10px;
|
|
219
|
+
min-height: 52px;
|
|
220
|
+
padding: 0 12px;
|
|
221
|
+
display: flex;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.g9-files__row--on {
|
|
225
|
+
background-color: var(--g9-primary-container);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
.g9-files__check--inline {
|
|
229
|
+
position: relative;
|
|
230
|
+
top: 0;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.g9-files__row-icon {
|
|
234
|
+
background-color: var(--g9-surface-container-high);
|
|
235
|
+
border-radius: 8px;
|
|
236
|
+
justify-content: center;
|
|
237
|
+
align-items: center;
|
|
238
|
+
width: 36px;
|
|
239
|
+
height: 36px;
|
|
240
|
+
display: flex;
|
|
241
|
+
overflow: hidden;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
.g9-files__row-thumb {
|
|
245
|
+
width: 36px;
|
|
246
|
+
height: 36px;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
.g9-files__row-texts {
|
|
250
|
+
flex-direction: column;
|
|
251
|
+
flex: 1;
|
|
252
|
+
min-width: 0;
|
|
253
|
+
display: flex;
|
|
254
|
+
position: relative;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
.g9-files__meta {
|
|
258
|
+
font-size: 11px;
|
|
259
|
+
font-family: var(--g9-font-text);
|
|
260
|
+
color: var(--g9-text-tertiary);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
/*# sourceMappingURL=files.css.map */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["webpack://./src/files.css"],"names":[],"mappings":"AACA;EAAE,sBAAsB;EACtB,YAAY;EACZ,aAAa;AACf;;AAGA;EAAE,mBAAmB;EACnB,eAAe;EACf,mBAAmB;EACnB,aAAa;AACf;;AAGA;EAAE,OAAO;EACP,YAAY;AACd;;AAGA;EAAE,eAAe;EACf,mBAAmB;EACnB,aAAa;AACf;;AAGA;EAAE,mBAAmB;EACnB,aAAa;AACf;;AAGA;EAAE,YAAY;AACd;;AAGA;EAAE,eAAe;EACf,gCAAgC;EAChC,wBAAwB;AAC1B;;AAGA;EAAE,gBAAgB;EAChB,oCAAoC;EACpC,6BAA6B;AAC/B;;AAGA;EAAE,gBAAgB;EAChB,eAAe;EACf,aAAa;AACf;;AAGA;EAAE,mBAAmB;EACnB,eAAe;EACf,cAAc;EACd,aAAa;AACf;;AAGA;EAAE,eAAe;EACf,gCAAgC;EAChC,+BAA+B;AACjC;;AAGA;EAAE,wBAAwB;AAC1B;;AAGA;EAAE,6CAA6C;EAC7C,mBAAmB;EACnB,mBAAmB;EACnB,eAAe;EACf,cAAc;EACd,iBAAiB;EACjB,aAAa;AACf;;AAGA;EAAE,eAAe;EACf,gBAAgB;EAChB,oCAAoC;EACpC,qCAAqC;EACrC,OAAO;AACT;;AAGA;EAAE,mBAAmB;EACnB,eAAe;EACf,aAAa;AACf;;AAGA;EAAE,sBAAsB;EACtB,mBAAmB;EACnB,YAAY;EACZ,kBAAkB;EAClB,aAAa;AACf;;AAGA;EAAE,eAAe;EACf,gBAAgB;EAChB,oCAAoC;EACpC,+BAA+B;AACjC;;AAGA;EAAE,eAAe;EACf,gCAAgC;EAChC,kBAAkB;EAClB,8BAA8B;AAChC;;AAGA;EAAE,eAAe;EACf,cAAc;EACd,aAAa;AACf;;AAGA;EAAE,YAAY;AACd;;AAGA;EAAE,6CAA6C;EAC7C,uBAAuB;EACvB,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f,gCAAgC;EAChC,8BAA8B;AAChC","sourcesContent":["/* G9FileBrowser (2.5.10). */\n.g9-files {\n display: flex;\n flex-direction: column;\n row-gap: 8px;\n}\n\n.g9-files__top {\n display: flex;\n align-items: center;\n column-gap: 8px;\n padding: 8px 12px 0px 12px;\n}\n\n.g9-files__crumbs {\n flex: 1;\n min-width: 0px;\n}\n\n.g9-files__crumb-row {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n}\n\n.g9-files__crumb-step {\n display: flex;\n align-items: center;\n}\n\n.g9-files__crumb {\n padding: 6px 6px;\n}\n\n.g9-files__crumb-text {\n font-size: 13px;\n font-family: var(--g9-font-text);\n color: var(--g9-primary);\n}\n\n.g9-files__crumb-text--here {\n font-weight: 600;\n font-family: var(--g9-font-text-600);\n color: var(--g9-text-primary);\n}\n\n.g9-files__sort {\n display: flex;\n column-gap: 14px;\n padding: 0px 16px;\n}\n\n.g9-files__sort-key {\n display: flex;\n align-items: center;\n column-gap: 2px;\n padding: 4px 0px;\n}\n\n.g9-files__sort-text {\n font-size: 12px;\n font-family: var(--g9-font-text);\n color: var(--g9-text-secondary);\n}\n\n.g9-files__sort-text--on {\n color: var(--g9-primary);\n}\n\n.g9-files__selection {\n display: flex;\n align-items: center;\n column-gap: 8px;\n margin: 0px 12px;\n padding: 6px 10px;\n border-radius: 10px;\n background-color: var(--g9-primary-container);\n}\n\n.g9-files__selection-text {\n flex: 1;\n font-size: 13px;\n font-weight: 600;\n font-family: var(--g9-font-text-600);\n color: var(--g9-on-primary-container);\n}\n\n.g9-files__selection-actions {\n display: flex;\n align-items: center;\n column-gap: 4px;\n}\n\n.g9-files__empty {\n display: flex;\n flex-direction: column;\n align-items: center;\n row-gap: 6px;\n padding: 32px 24px;\n}\n\n.g9-files__empty-text {\n font-size: 14px;\n font-weight: 600;\n font-family: var(--g9-font-text-600);\n color: var(--g9-text-secondary);\n}\n\n.g9-files__empty-hint {\n font-size: 12px;\n font-family: var(--g9-font-text);\n text-align: center;\n color: var(--g9-text-tertiary);\n}\n\n.g9-files__grid {\n display: flex;\n flex-wrap: wrap;\n padding: 0px 8px;\n}\n\n.g9-files__cell {\n padding: 4px;\n}\n\n.g9-files__tile {\n width: 100%;\n display: flex;\n flex-direction: column;\n border-radius: 12px;\n overflow: hidden;\n border-width: 2px;\n border-style: solid;\n border-color: transparent;\n background-color: var(--g9-surface-container);\n}\n\n.g9-files__tile--on {\n border-color: var(--g9-primary);\n}\n\n.g9-files__preview {\n position: relative;\n display: flex;\n align-items: center;\n justify-content: center;\n aspect-ratio: 4 / 3;\n background-color: var(--g9-surface-container-high);\n}\n\n.g9-files__thumb {\n position: absolute;\n top: 0px;\n right: 0px;\n bottom: 0px;\n left: 0px;\n}\n\n.g9-files__tile-foot {\n display: flex;\n align-items: center;\n column-gap: 2px;\n padding: 4px 4px 4px 8px;\n}\n\n.g9-files__name {\n flex: 1;\n min-width: 0px;\n font-size: 12px;\n font-family: var(--g9-font-text);\n color: var(--g9-text-primary);\n}\n\n.g9-files__menu {\n display: flex;\n}\n\n.g9-files__check {\n position: absolute;\n top: 6px;\n display: flex;\n align-items: center;\n justify-content: center;\n width: 20px;\n height: 20px;\n border-radius: 10px;\n border-width: 2px;\n border-style: solid;\n border-color: var(--g9-outline);\n background-color: var(--g9-surface);\n}\n\n.g9-files__check--on {\n border-color: var(--g9-primary);\n background-color: var(--g9-primary);\n}\n\n.g9-files__progress {\n position: absolute;\n bottom: 0px;\n left: 0px;\n right: 0px;\n height: 3px;\n background-color: var(--g9-outline-variant);\n}\n\n.g9-files__progress-fill {\n position: absolute;\n top: 0px;\n bottom: 0px;\n background-color: var(--g9-primary);\n}\n\n.g9-files__list {\n display: flex;\n flex-direction: column;\n}\n\n.g9-files__row {\n display: flex;\n align-items: center;\n column-gap: 10px;\n min-height: 52px;\n padding: 0px 12px;\n}\n\n.g9-files__row--on {\n background-color: var(--g9-primary-container);\n}\n\n.g9-files__check--inline {\n position: relative;\n top: 0px;\n}\n\n.g9-files__row-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 36px;\n height: 36px;\n border-radius: 8px;\n overflow: hidden;\n background-color: var(--g9-surface-container-high);\n}\n\n.g9-files__row-thumb {\n width: 36px;\n height: 36px;\n}\n\n.g9-files__row-texts {\n position: relative;\n display: flex;\n flex: 1;\n min-width: 0px;\n flex-direction: column;\n}\n\n.g9-files__meta {\n font-size: 11px;\n font-family: var(--g9-font-text);\n color: var(--g9-text-tertiary);\n}\n"],"sourceRoot":""}
|
package/dist/files.d.ts
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { type G9MenuItem } from '@g9tm/lynxcontrols/popover';
|
|
2
|
+
import { type ReactNode } from '@lynx-js/react';
|
|
3
|
+
import './files.css';
|
|
4
|
+
/** What a file is (its icon). */
|
|
5
|
+
export type G9FileEntryKind = 'folder' | 'image' | 'video' | 'audio' | 'archive' | 'sheet' | 'doc' | 'other';
|
|
6
|
+
/** A file or a folder. */
|
|
7
|
+
export interface G9FileEntry {
|
|
8
|
+
readonly id: string;
|
|
9
|
+
readonly name: string;
|
|
10
|
+
/** Default from the name's extension (a folder says so). */
|
|
11
|
+
readonly kind?: G9FileEntryKind;
|
|
12
|
+
/** Bytes. */
|
|
13
|
+
readonly size?: number;
|
|
14
|
+
/** Changed (epoch ms) — shown as the app words it in `modifiedLabel`. */
|
|
15
|
+
readonly modified?: number;
|
|
16
|
+
readonly modifiedLabel?: string;
|
|
17
|
+
/** A picture's or a video's preview. */
|
|
18
|
+
readonly thumb?: string | null;
|
|
19
|
+
/** Uploading: 0–1. */
|
|
20
|
+
readonly progress?: number;
|
|
21
|
+
}
|
|
22
|
+
/** A name's kind from its extension. */
|
|
23
|
+
export declare function g9FileEntryKind(name: string): G9FileEntryKind;
|
|
24
|
+
/** Files sorted: folders first, then by the key (names in the Persian alphabet, Latin without case; no Intl). */
|
|
25
|
+
export declare function g9SortFiles(items: readonly G9FileEntry[], key: 'name' | 'modified' | 'size', dir: 'asc' | 'desc'): G9FileEntry[];
|
|
26
|
+
/** The kinds' icons (SVG). */
|
|
27
|
+
export declare const g9FileKindIcons: Readonly<Record<G9FileEntryKind, string>>;
|
|
28
|
+
/** Props of {@link G9FileBrowser}. */
|
|
29
|
+
export interface G9FileBrowserProps {
|
|
30
|
+
readonly id?: string;
|
|
31
|
+
readonly items: readonly G9FileEntry[];
|
|
32
|
+
/** The folders from the top to here (the breadcrumb); `rootLabel` first. */
|
|
33
|
+
readonly path?: readonly {
|
|
34
|
+
readonly id: string;
|
|
35
|
+
readonly name: string;
|
|
36
|
+
}[];
|
|
37
|
+
readonly rootLabel?: string;
|
|
38
|
+
/** A breadcrumb step (null: the top). */
|
|
39
|
+
readonly onNavigate?: (folderId: string | null) => void;
|
|
40
|
+
/** A file opened, or a folder entered. */
|
|
41
|
+
readonly onOpen?: (item: G9FileEntry) => void;
|
|
42
|
+
/** `grid` (default) or `list`; with `onViewChange` a switch. */
|
|
43
|
+
readonly view?: 'grid' | 'list';
|
|
44
|
+
readonly onViewChange?: (view: 'grid' | 'list') => void;
|
|
45
|
+
/** Multi-select: the chosen ids (a long press starts it; then taps toggle). */
|
|
46
|
+
readonly selected?: readonly string[];
|
|
47
|
+
readonly onSelectionChange?: (ids: readonly string[]) => void;
|
|
48
|
+
/** The selection's actions (move, delete) in a bar while some are chosen. */
|
|
49
|
+
readonly selectionActions?: ReactNode;
|
|
50
|
+
readonly sort?: {
|
|
51
|
+
readonly key: 'name' | 'modified' | 'size';
|
|
52
|
+
readonly dir: 'asc' | 'desc';
|
|
53
|
+
};
|
|
54
|
+
readonly onSortChange?: (sort: {
|
|
55
|
+
readonly key: 'name' | 'modified' | 'size';
|
|
56
|
+
readonly dir: 'asc' | 'desc';
|
|
57
|
+
}) => void;
|
|
58
|
+
/** An item's menu (rename, move, delete…). */
|
|
59
|
+
readonly menuFor?: (item: G9FileEntry) => readonly G9MenuItem[];
|
|
60
|
+
readonly onMenu?: (key: string, item: G9FileEntry) => void;
|
|
61
|
+
/** The upload button (the app's picker). */
|
|
62
|
+
readonly onUpload?: () => void;
|
|
63
|
+
/** Wraps the browser in the app's drop zone (a G9DropZone from the media package). */
|
|
64
|
+
readonly wrapDrop?: (content: ReactNode) => ReactNode;
|
|
65
|
+
/** A size in the app's words (default B / KB / MB / GB). */
|
|
66
|
+
readonly formatSize?: (bytes: number) => string;
|
|
67
|
+
readonly words?: {
|
|
68
|
+
readonly upload?: string;
|
|
69
|
+
readonly empty?: string;
|
|
70
|
+
readonly emptyHint?: string;
|
|
71
|
+
readonly grid?: string;
|
|
72
|
+
readonly list?: string;
|
|
73
|
+
readonly name?: string;
|
|
74
|
+
readonly modified?: string;
|
|
75
|
+
readonly size?: string;
|
|
76
|
+
readonly more?: string;
|
|
77
|
+
/** «3 selected». */
|
|
78
|
+
readonly selected?: (count: number) => string;
|
|
79
|
+
readonly clear?: string;
|
|
80
|
+
};
|
|
81
|
+
/** Grid columns (default 3). */
|
|
82
|
+
readonly columns?: number;
|
|
83
|
+
}
|
|
84
|
+
/** A project's files: folders, a breadcrumb, grid or list, previews, multi-select, uploads, menus, sorting. */
|
|
85
|
+
export declare function G9FileBrowser(props: G9FileBrowserProps): ReactNode;
|
|
86
|
+
//# sourceMappingURL=files.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../src/files.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAU,KAAK,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAIrE,OAAO,EAAE,KAAK,SAAS,EAAY,MAAM,gBAAgB,CAAC;AAC1D,OAAO,aAAa,CAAC;AAErB,iCAAiC;AACjC,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,KAAK,GAAG,OAAO,CAAC;AAE7G,0BAA0B;AAC1B,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAA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