mountain-ui 1.0.143 → 1.0.145
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/package.json +2 -2
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/Lines/Input.svelte +107 -90
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeFrequency/Button.svelte +8 -0
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeFrequency/Card.svelte +6 -0
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeFrequency/Icon.svelte +5 -0
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeFrequency/Input.svelte +12 -0
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeFrequency/TableView.svelte +41 -0
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeFrequency/View.svelte +45 -0
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeFrequency/index.js +41 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mountain-ui",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.145",
|
|
5
5
|
"description": "A comprehensive UI component library for ERP systems with field types, entities, and registry management built with Svelte",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"module": "index.js",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"vitest-browser-svelte": "^2.1.1"
|
|
77
77
|
},
|
|
78
78
|
"dependencies": {
|
|
79
|
-
"hamzus-ui": "^0.0.
|
|
79
|
+
"hamzus-ui": "^0.0.263"
|
|
80
80
|
},
|
|
81
81
|
"engines": {
|
|
82
82
|
"node": ">=18.0.0"
|
|
@@ -153,106 +153,114 @@
|
|
|
153
153
|
}
|
|
154
154
|
</script>
|
|
155
155
|
|
|
156
|
-
<div class="
|
|
157
|
-
<
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
<ResponsiveTable.
|
|
161
|
-
|
|
162
|
-
{#
|
|
163
|
-
|
|
164
|
-
<
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
{#
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
id={row.fieldId}
|
|
191
|
-
value={table[lineIndex].ctx?.[row.fieldId] ?? null}
|
|
192
|
-
registerCalculation={(config) => {
|
|
193
|
-
handleRegisterCalculation(lineIndex, config);
|
|
194
|
-
}}
|
|
195
|
-
></FieldInput>
|
|
196
|
-
{/each}
|
|
197
|
-
{#if columnIndex + 1 === columns.length}
|
|
198
|
-
<div class="delete">
|
|
199
|
-
<IconButton
|
|
200
|
-
variant="destructive"
|
|
201
|
-
onClick={() => {
|
|
202
|
-
handleDeleteLine(lineIndex);
|
|
156
|
+
<div class="table">
|
|
157
|
+
<div class="title">
|
|
158
|
+
<Label {label} {required} {secret} {unique}></Label>
|
|
159
|
+
</div>
|
|
160
|
+
<ResponsiveTable.Root let:ctx>
|
|
161
|
+
<ResponsiveTable.Header>
|
|
162
|
+
{#if columns.length > 0}
|
|
163
|
+
{#each columns as column, columnIndex}
|
|
164
|
+
<ResponsiveTable.HeaderCell align="left" label={column.name ?? '-'} {ctx}>
|
|
165
|
+
<h6>{columns[columnIndex].name ?? ''}</h6>
|
|
166
|
+
<!-- {column.columnIndex} -->
|
|
167
|
+
</ResponsiveTable.HeaderCell>
|
|
168
|
+
{/each}
|
|
169
|
+
{/if}
|
|
170
|
+
</ResponsiveTable.Header>
|
|
171
|
+
<ResponsiveTable.Body>
|
|
172
|
+
{#if $entity}
|
|
173
|
+
{#each table as line, lineIndex (line.id)}
|
|
174
|
+
<ResponsiveTable.Line>
|
|
175
|
+
{#each columns as column, columnIndex}
|
|
176
|
+
<ResponsiveTable.Cell {ctx}>
|
|
177
|
+
{#each column.rows as row, rowIndex}
|
|
178
|
+
<FieldInput
|
|
179
|
+
compact
|
|
180
|
+
detailsCtx={table[lineIndex].detailsCtx}
|
|
181
|
+
ctx={table[lineIndex].ctx}
|
|
182
|
+
onChangeDetails={(value) => {
|
|
183
|
+
handleChangeDetails(lineIndex, row.fieldId, value);
|
|
184
|
+
}}
|
|
185
|
+
onChange={(value) => {
|
|
186
|
+
handleChange(lineIndex, row.fieldId, value);
|
|
187
|
+
}}
|
|
188
|
+
changeCtx={(fieldId, value) => {
|
|
189
|
+
handleChange(lineIndex, fieldId, value);
|
|
203
190
|
}}
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
191
|
+
id={row.fieldId}
|
|
192
|
+
value={table[lineIndex].ctx?.[row.fieldId] ?? null}
|
|
193
|
+
registerCalculation={(config) => {
|
|
194
|
+
handleRegisterCalculation(lineIndex, config);
|
|
195
|
+
}}
|
|
196
|
+
></FieldInput>
|
|
197
|
+
{/each}
|
|
198
|
+
{#if columnIndex + 1 === columns.length}
|
|
199
|
+
<div class="delete">
|
|
200
|
+
<IconButton
|
|
201
|
+
variant="destructive"
|
|
202
|
+
onClick={() => {
|
|
203
|
+
handleDeleteLine(lineIndex);
|
|
204
|
+
}}
|
|
211
205
|
>
|
|
212
|
-
<
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
206
|
+
<svg
|
|
207
|
+
width="24"
|
|
208
|
+
height="24"
|
|
209
|
+
viewBox="0 0 24 24"
|
|
210
|
+
fill="none"
|
|
211
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
212
|
+
>
|
|
213
|
+
<path
|
|
214
|
+
d="M20.9997 6.72998C20.9797 6.72998 20.9497 6.72998 20.9197 6.72998C15.6297 6.19998 10.3497 5.99998 5.11967 6.52998L3.07967 6.72998C2.65967 6.76998 2.28967 6.46998 2.24967 6.04998C2.20967 5.62998 2.50967 5.26998 2.91967 5.22998L4.95967 5.02998C10.2797 4.48998 15.6697 4.69998 21.0697 5.22998C21.4797 5.26998 21.7797 5.63998 21.7397 6.04998C21.7097 6.43998 21.3797 6.72998 20.9997 6.72998Z"
|
|
215
|
+
fill="#292D32"
|
|
216
|
+
/>
|
|
217
|
+
<path
|
|
218
|
+
d="M8.50074 5.72C8.46074 5.72 8.42074 5.72 8.37074 5.71C7.97074 5.64 7.69074 5.25 7.76074 4.85L7.98074 3.54C8.14074 2.58 8.36074 1.25 10.6907 1.25H13.3107C15.6507 1.25 15.8707 2.63 16.0207 3.55L16.2407 4.85C16.3107 5.26 16.0307 5.65 15.6307 5.71C15.2207 5.78 14.8307 5.5 14.7707 5.1L14.5507 3.8C14.4107 2.93 14.3807 2.76 13.3207 2.76H10.7007C9.64074 2.76 9.62074 2.9 9.47074 3.79L9.24074 5.09C9.18074 5.46 8.86074 5.72 8.50074 5.72Z"
|
|
219
|
+
fill="#292D32"
|
|
220
|
+
/>
|
|
221
|
+
<path
|
|
222
|
+
d="M15.2104 22.7501H8.79039C5.30039 22.7501 5.16039 20.8201 5.05039 19.2601L4.40039 9.19007C4.37039 8.78007 4.69039 8.42008 5.10039 8.39008C5.52039 8.37008 5.87039 8.68008 5.90039 9.09008L6.55039 19.1601C6.66039 20.6801 6.70039 21.2501 8.79039 21.2501H15.2104C17.3104 21.2501 17.3504 20.6801 17.4504 19.1601L18.1004 9.09008C18.1304 8.68008 18.4904 8.37008 18.9004 8.39008C19.3104 8.42008 19.6304 8.77007 19.6004 9.19007L18.9504 19.2601C18.8404 20.8201 18.7004 22.7501 15.2104 22.7501Z"
|
|
223
|
+
fill="#292D32"
|
|
224
|
+
/>
|
|
225
|
+
<path
|
|
226
|
+
d="M13.6601 17.25H10.3301C9.92008 17.25 9.58008 16.91 9.58008 16.5C9.58008 16.09 9.92008 15.75 10.3301 15.75H13.6601C14.0701 15.75 14.4101 16.09 14.4101 16.5C14.4101 16.91 14.0701 17.25 13.6601 17.25Z"
|
|
227
|
+
fill="#292D32"
|
|
228
|
+
/>
|
|
229
|
+
<path
|
|
230
|
+
d="M14.5 13.25H9.5C9.09 13.25 8.75 12.91 8.75 12.5C8.75 12.09 9.09 11.75 9.5 11.75H14.5C14.91 11.75 15.25 12.09 15.25 12.5C15.25 12.91 14.91 13.25 14.5 13.25Z"
|
|
231
|
+
fill="#292D32"
|
|
232
|
+
/>
|
|
233
|
+
</svg>
|
|
234
|
+
</IconButton>
|
|
235
|
+
</div>
|
|
236
|
+
{/if}
|
|
237
|
+
</ResponsiveTable.Cell>
|
|
238
|
+
{/each}
|
|
239
|
+
</ResponsiveTable.Line>
|
|
240
|
+
{/each}
|
|
241
|
+
{/if}
|
|
242
|
+
</ResponsiveTable.Body>
|
|
243
|
+
</ResponsiveTable.Root>
|
|
244
|
+
<div class="title">
|
|
245
|
+
<Button onClick={handleAddLine}>
|
|
246
|
+
<h5>ajouter une rangée</h5>
|
|
247
|
+
</Button>
|
|
248
|
+
<Label label="/{label}" {required} {secret} {unique}></Label>
|
|
249
|
+
</div>
|
|
247
250
|
</div>
|
|
248
251
|
|
|
249
252
|
<style>
|
|
250
253
|
.title {
|
|
251
254
|
display: flex;
|
|
252
255
|
align-items: center;
|
|
256
|
+
justify-content: space-between;
|
|
257
|
+
padding: var(--pad-m);
|
|
253
258
|
width: 100%;
|
|
254
259
|
}
|
|
255
|
-
|
|
260
|
+
.title:last-child {
|
|
261
|
+
border-top: 1px solid var(--bg-blur);
|
|
262
|
+
}
|
|
263
|
+
:global(.table-container .line:has( > .cell > .delete .button:hover)) {
|
|
256
264
|
background-color: var(--red-b);
|
|
257
265
|
}
|
|
258
266
|
|
|
@@ -265,4 +273,13 @@
|
|
|
265
273
|
justify-content: end;
|
|
266
274
|
padding: var(--pad-s);
|
|
267
275
|
}
|
|
276
|
+
|
|
277
|
+
.table {
|
|
278
|
+
width: 100%;
|
|
279
|
+
height: fit-content;
|
|
280
|
+
border-radius: var(--radius-m);
|
|
281
|
+
overflow: clip;
|
|
282
|
+
border: 1px solid var(--stroke);
|
|
283
|
+
padding: var(--pad-s);
|
|
284
|
+
}
|
|
268
285
|
</style>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M12 22.75C6.76 22.75 2.5 18.49 2.5 13.25C2.5 8.01 6.76 3.75 12 3.75C17.24 3.75 21.5 8.01 21.5 13.25C21.5 18.49 17.24 22.75 12 22.75ZM12 5.25C7.59 5.25 4 8.84 4 13.25C4 17.66 7.59 21.25 12 21.25C16.41 21.25 20 17.66 20 13.25C20 8.84 16.41 5.25 12 5.25Z" fill="#292D32"/>
|
|
3
|
+
<path d="M12 13.75C11.59 13.75 11.25 13.41 11.25 13V8C11.25 7.59 11.59 7.25 12 7.25C12.41 7.25 12.75 7.59 12.75 8V13C12.75 13.41 12.41 13.75 12 13.75Z" fill="#292D32"/>
|
|
4
|
+
<path d="M15 2.75H9C8.59 2.75 8.25 2.41 8.25 2C8.25 1.59 8.59 1.25 9 1.25H15C15.41 1.25 15.75 1.59 15.75 2C15.75 2.41 15.41 2.75 15 2.75Z" fill="#292D32"/>
|
|
5
|
+
</svg>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import Label from '../../../components/Label.svelte';
|
|
3
|
+
import Line from '../../../components/Line.svelte';
|
|
4
|
+
import { FrequencyPicker, MonthPicker } from 'hamzus-ui';
|
|
5
|
+
|
|
6
|
+
let { label, unique = false, secret = false, compact = false, required, ...props } = $props();
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<Line {compact}>
|
|
10
|
+
<Label {unique} {secret} {label} {required}></Label>
|
|
11
|
+
<FrequencyPicker {...props} {required}></FrequencyPicker>
|
|
12
|
+
</Line>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import ViewText from "../../../components/ViewText.svelte";
|
|
3
|
+
|
|
4
|
+
let { value } = $props();
|
|
5
|
+
|
|
6
|
+
function getText(frequencyType, weekDays, monthDay, firstBusinessDay) {
|
|
7
|
+
let text = MODES[frequencyType];
|
|
8
|
+
|
|
9
|
+
if (frequencyType === 'weekly') {
|
|
10
|
+
text += ' | ';
|
|
11
|
+
for (let i = 0; i < weekDays.length; i++) {
|
|
12
|
+
const weekDay = weekDays[i];
|
|
13
|
+
|
|
14
|
+
text += DAYS[weekDay];
|
|
15
|
+
if (i < weekDays.length - 1) {
|
|
16
|
+
text += ', ';
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
if (frequencyType === 'monthly') {
|
|
21
|
+
text += ' | ';
|
|
22
|
+
for (let i = 0; i < monthDay.length; i++) {
|
|
23
|
+
const day = monthDay[i];
|
|
24
|
+
|
|
25
|
+
text += day === 'last' ? 'dernier jour' : day;
|
|
26
|
+
if (i < monthDay.length - 1) {
|
|
27
|
+
text += ', ';
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (ALLOWED_BUSINESS_TYPES.includes(frequencyType) && firstBusinessDay) {
|
|
33
|
+
text += ' | ignoré le weekend';
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return text;
|
|
37
|
+
}
|
|
38
|
+
</script>
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
<ViewText>{value === null || !value.flat ? '-' : getText(value.flat)}</ViewText>
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import Label from '../../../components/Label.svelte';
|
|
3
|
+
import LineView from '../../../components/LineView.svelte';
|
|
4
|
+
import ViewText from '../../../components/ViewText.svelte';
|
|
5
|
+
|
|
6
|
+
let { value, compact, unique, secret, label, required } = $props();
|
|
7
|
+
|
|
8
|
+
function getText(frequencyType, weekDays, monthDay, firstBusinessDay) {
|
|
9
|
+
let text = MODES[frequencyType];
|
|
10
|
+
|
|
11
|
+
if (frequencyType === 'weekly') {
|
|
12
|
+
text += ' | ';
|
|
13
|
+
for (let i = 0; i < weekDays.length; i++) {
|
|
14
|
+
const weekDay = weekDays[i];
|
|
15
|
+
|
|
16
|
+
text += DAYS[weekDay];
|
|
17
|
+
if (i < weekDays.length - 1) {
|
|
18
|
+
text += ', ';
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
if (frequencyType === 'monthly') {
|
|
23
|
+
text += ' | ';
|
|
24
|
+
for (let i = 0; i < monthDay.length; i++) {
|
|
25
|
+
const day = monthDay[i];
|
|
26
|
+
|
|
27
|
+
text += day === 'last' ? 'dernier jour' : day;
|
|
28
|
+
if (i < monthDay.length - 1) {
|
|
29
|
+
text += ', ';
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (ALLOWED_BUSINESS_TYPES.includes(frequencyType) && firstBusinessDay) {
|
|
35
|
+
text += ' | ignoré le weekend';
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return text;
|
|
39
|
+
}
|
|
40
|
+
</script>
|
|
41
|
+
|
|
42
|
+
<LineView {compact}>
|
|
43
|
+
<Label {unique} {secret} {label} {required}></Label>
|
|
44
|
+
<ViewText>{value === null || !value.flat ? '-' : getText(value.flat)}</ViewText>
|
|
45
|
+
</LineView>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { createFieldType } from '../../../createFieldType.js';
|
|
2
|
+
|
|
3
|
+
import Icon from './Icon.svelte';
|
|
4
|
+
import Button from './Button.svelte';
|
|
5
|
+
import Card from './Card.svelte';
|
|
6
|
+
import Input from './Input.svelte';
|
|
7
|
+
import TableView from './TableView.svelte';
|
|
8
|
+
import View from './View.svelte';
|
|
9
|
+
|
|
10
|
+
export default createFieldType({
|
|
11
|
+
type: 'time-frequency',
|
|
12
|
+
|
|
13
|
+
category_path: 'time',
|
|
14
|
+
|
|
15
|
+
label: 'Fréquence',
|
|
16
|
+
description: "Fréquence de répétition journalière, choisissez quelle jour répéter une action.",
|
|
17
|
+
|
|
18
|
+
is_hidden: false,
|
|
19
|
+
|
|
20
|
+
defaultProps: {},
|
|
21
|
+
|
|
22
|
+
can_be_required: true,
|
|
23
|
+
can_be_unique: false,
|
|
24
|
+
|
|
25
|
+
components: {
|
|
26
|
+
icon: Icon,
|
|
27
|
+
button: Button,
|
|
28
|
+
card: Card,
|
|
29
|
+
input: Input,
|
|
30
|
+
tableView: TableView,
|
|
31
|
+
view: View,
|
|
32
|
+
filter: null,
|
|
33
|
+
properties: null
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
allowBindings:["time-frequency"],
|
|
37
|
+
formatter: (value) => value,
|
|
38
|
+
parser: (value) => value,
|
|
39
|
+
|
|
40
|
+
validate: () => true
|
|
41
|
+
});
|