@bagelink/vue 0.0.556 → 0.0.558

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 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAG1C,wBAAgB,QAAQ,CAAC,EAAE,EAAE,MAAM,IAAI,EAAE,KAAK,SAAM,QAGnD;AAED,wBAAgB,UAAU,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAI3D;AAED,wBAAsB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,iBAGtE;AAED,wBAAgB,QAAQ,CAAC,GAAG,MAAM,EAAE,MAAM,EAAE,UAG3C;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,IAAI,QAIrE;AAED,wBAAgB,QAAQ,CAAC,QAAQ,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,GAAG,OAAO,EAAE,GAAG,EAAE,UAKpE;AAED,wBAAgB,SAAS,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,KAAK,CAAC,EAAE,UAAU,EAAE,QAAQ,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC,OAS7F;AAED,wBAAgB,KAAK,CAAC,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,OAM9C;AAED,eAAO,MAAM,SAAS,cAAe,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,YAAY,MAAM,QAAqD,CAAA;AAE/H,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAExC,OAAO,KAAK,cAAc,MAAM,kBAAkB,CAAA;AAElD,OAAO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
2
  "name": "@bagelink/vue",
3
3
  "type": "module",
4
- "version": "0.0.556",
4
+ "version": "0.0.558",
5
5
  "description": "Bagel core sdk packages",
6
6
  "author": {
7
7
  "name": "Neveh Allon",
@@ -83,11 +83,11 @@ const themes: Partial<{ [key in ThemeType]: typeof computedDefaultColors }> = {
83
83
  }
84
84
 
85
85
  const cumputedTextColor = $computed(
86
- () => (themes[computedTheme as ThemeType]?.color || computedDefaultColors.color),
86
+ () => (themes[computedTheme as ThemeType]?.color ?? computedDefaultColors.color),
87
87
  )
88
88
 
89
89
  const computedBackgroundColor = $computed(
90
- () => (themes[computedTheme as ThemeType]?.backgroundColor || computedDefaultColors.backgroundColor),
90
+ () => (themes[computedTheme as ThemeType]?.backgroundColor ?? computedDefaultColors.backgroundColor),
91
91
  )
92
92
  </script>
93
93
 
@@ -31,6 +31,8 @@ function selectElement(item: Record<string, any>) { emit('select', item) }
31
31
  let sortDirection = $ref('ASC')
32
32
  let sortField = $ref('')
33
33
 
34
+ const computedSortField = $computed(() => `_transformed_${sortField}`)
35
+
34
36
  function getFallbackSchema() {
35
37
  const keys = [
36
38
  ...new Set((props.data || []).map(Object.keys).flat()),
@@ -40,7 +42,7 @@ function getFallbackSchema() {
40
42
  label: keyToLabel(id),
41
43
  }))
42
44
  return props.showFields
43
- ? schema.filter(f => props.showFields?.includes(f.id as string) || !f.id)
45
+ ? schema.filter(f => props.showFields?.includes(f.id as string) ?? !f.id)
44
46
  : schema
45
47
  }
46
48
 
@@ -64,10 +66,11 @@ function transform(rowData: any) {
64
66
  for (const field of fields) {
65
67
  const fieldData = rowData[`${field.id}`]
66
68
 
67
- const newFieldVal = field.transform?.(fieldData, rowData) || fieldData || ''
69
+ const newFieldVal = field.transform?.(fieldData, rowData)
68
70
 
69
71
  Object.assign(obj, {
70
- [`${field.id}`]: newFieldVal
72
+ [`${field.id}`]: fieldData,
73
+ [`_transformed_${field.id}`]: newFieldVal
71
74
  })
72
75
  }
73
76
  return obj
@@ -77,8 +80,8 @@ const computedData = $computed(() => {
77
80
  const dta = [...props.data].map(transform)
78
81
  if (sortField as string) {
79
82
  return dta.sort((a, b) => {
80
- const aValue = a[sortField]
81
- const bValue = b[sortField]
83
+ const aValue = a[computedSortField] ?? ''
84
+ const bValue = b[computedSortField] ?? ''
82
85
  const numAValue = Number.parseInt(aValue, 10)
83
86
  const numBValue = Number.parseInt(bValue, 10)
84
87
  if (!Number.isNaN(numAValue) && !Number.isNaN(numBValue)) {
@@ -150,10 +153,7 @@ function sort(fieldname: string) {
150
153
  @click="selectElement(row)"
151
154
  >
152
155
  <td
153
- v-for="field in computedSchema.map((c) => ({
154
- ...c,
155
- transform: undefined,
156
- }))"
156
+ v-for="field in computedSchema"
157
157
  :key="`${field.id}-${row.id}`"
158
158
  class="col"
159
159
  >
@@ -30,7 +30,7 @@ const is = $computed(() => {
30
30
  if (props.field.$el === 'check') return CheckInput
31
31
  if (props.field.$el === 'richtext') return RichText
32
32
  if (props.field.$el === 'date') return DateInput
33
- return props.field.$el || 'div'
33
+ return props.field.$el ?? 'div'
34
34
  })
35
35
 
36
36
  const formData = $computed({
@@ -63,40 +63,37 @@ const vIf = $computed(() => {
63
63
  return true
64
64
  })
65
65
 
66
- const badTransform = /undefined|NaN|Invalid Date/
67
66
  const computedFieldData = $computed(
68
- () => {
69
- // region AVOID_TRANSFORMING_DATA_MULTIPLE_TIMES
70
- // const alreadyTransformed = props.modelValue[props.field.id ?? ''] === fieldData
71
- // if (alreadyTransformed) return fieldData
72
- // return props.field.transform?.(fieldData, props.modelValue)
73
- // endregion AVOID_TRANSFORMING_DATA_MULTIPLE_TIMES
67
+ () => props.field.transform?.(fieldData, props.modelValue) ?? fieldData
68
+ )
74
69
 
75
- // region CHECK_FOR_BAD_TRANSFORMS
76
- const transformedData = props.field.transform?.(fieldData, props.modelValue)
77
- if (badTransform.test(String(transformedData))) return fieldData
78
- return transformedData
79
- // endregion CHECK_FOR_BAD_TRANSFORMS
80
- }
70
+ const computedOptions = $computed(
71
+ () => bindAttrs({ options: props.field.options }, fieldData, props.modelValue).options
72
+ )
73
+
74
+ const computedAttrs = $computed(
75
+ () => bindAttrs(props.field.attrs || {}, fieldData, props.modelValue)
76
+ )
77
+
78
+ const computedClass = $computed(
79
+ () => classify(fieldData, props.modelValue, props.field.class, props.field.attrs?.class)
81
80
  )
82
81
  </script>
83
82
 
84
83
  <template>
85
84
  <component
86
- v-bind="bindAttrs(field?.attrs || {}, fieldData, modelValue)"
85
+ v-bind="computedAttrs"
87
86
  :is="is"
88
87
  v-if="vIf"
89
88
  :id="field.id"
90
89
  v-model="fieldData"
91
90
  :required="field.required"
92
- :class="classify(fieldData, modelValue, field.class, field.attrs?.class)"
91
+ :class="computedClass"
93
92
  :label="field.label"
94
93
  :placeholder="field.placeholder || field.label"
95
94
  :defaultValue="field.defaultValue"
96
95
  :disabled="field.disabled"
97
- :options="
98
- bindAttrs({ options: field.options }, fieldData, modelValue).options
99
- "
96
+ :options="computedOptions"
100
97
  :helptext="field.helptext"
101
98
  @update:modelValue="($event: any) => field?.onUpdate?.($event, formData)"
102
99
  >
@@ -12,6 +12,7 @@ interface toolbarOption {
12
12
  name: ToolbarConfigOption
13
13
  icon: MaterialIcons
14
14
  }
15
+
15
16
  const toolbarOptions: toolbarOption[] = [
16
17
  { name: 'bold', icon: 'format_bold' },
17
18
  { name: 'italic', icon: 'format_italic' },
@@ -1,3 +1,5 @@
1
+ import { useModal } from '@bagelink/vue'
2
+
1
3
  export function applyFormatting(command: string, value: string = '') {
2
4
  const selection = window.getSelection()
3
5
  if (selection && selection.rangeCount > 0) {
@@ -74,7 +76,7 @@ export function applyFormatting(command: string, value: string = '') {
74
76
  case 'insertLink':
75
77
  insertLink()
76
78
  break
77
- case 'insertImage':
79
+ case 'image':
78
80
  insertImage()
79
81
  break
80
82
  case 'createTable':
@@ -153,17 +155,21 @@ export function insertLink() {
153
155
  }
154
156
 
155
157
  export function insertImage() {
156
- const url = prompt('Enter the image URL:')
157
- if (url) {
158
- const selection = window.getSelection()
159
- if (selection && selection.rangeCount > 0) {
160
- const range = selection.getRangeAt(0)
161
- const img = document.createElement('img')
162
- img.src = url
163
- range.deleteContents()
164
- range.insertNode(img)
165
- }
166
- }
158
+ console.log('image')
159
+ const { showModalForm } = useModal()
160
+ console.log(showModalForm)
161
+ showModalForm({ title: 'Upload Image', schema: [{ id: 'image', type: 'file' }], onSubmit: (data) => {} })
162
+ // const url = prompt('Enter the image URL:')
163
+ // if (url) {
164
+ // const selection = window.getSelection()
165
+ // if (selection && selection.rangeCount > 0) {
166
+ // const range = selection.getRangeAt(0)
167
+ // const img = document.createElement('img')
168
+ // img.src = url
169
+ // range.deleteContents()
170
+ // range.insertNode(img)
171
+ // }
172
+ // }
167
173
  }
168
174
 
169
175
  export function createTable() {
@@ -26,6 +26,10 @@
26
26
  border-radius: 0 ;
27
27
  }
28
28
 
29
+ .oval{
30
+ border-radius: 100% ;
31
+ }
32
+
29
33
  .flex-center {
30
34
  justify-content: center;
31
35
  align-items: center;
@@ -155,14 +159,142 @@
155
159
  inset-inline-start: 0;
156
160
  inset-inline-end: 0;
157
161
  }
158
-
159
162
  .inset-inline-start, .start{
160
163
  inset-inline-start: 0;
161
164
  }
162
165
 
166
+ .start-1{
167
+ inset-inline-start: 1rem;
168
+ }
169
+
170
+ .start-2{
171
+ inset-inline-start: 2rem;
172
+ }
173
+
174
+ .start-3{
175
+ inset-inline-start: 3rem;
176
+ }
177
+
178
+ .start-4{
179
+ inset-inline-start: 4rem;
180
+ }
181
+
182
+ .start-5{
183
+ inset-inline-start: 5rem;
184
+ }
185
+
186
+ .start-6{
187
+ inset-inline-start: 6rem;
188
+ }
189
+
190
+ .start-7{
191
+ inset-inline-start: 7rem;
192
+ }
193
+
194
+ .start-8{
195
+ inset-inline-start: 8rem;
196
+ }
197
+
198
+ .-start-1{
199
+ inset-inline-start: -1rem;
200
+ }
201
+
202
+ .-start-2{
203
+ inset-inline-start: -2rem;
204
+ }
205
+
206
+ .-start-3{
207
+ inset-inline-start: -3rem;
208
+ }
209
+
210
+ .-start-4{
211
+ inset-inline-start: -4rem;
212
+ }
213
+
214
+ .-start-5{
215
+ inset-inline-start: -5rem;
216
+ }
217
+
218
+ .-start-6{
219
+ inset-inline-start: -6rem;
220
+ }
221
+
222
+ .-start-7{
223
+ inset-inline-start: -7rem;
224
+ }
225
+
226
+ .-start-8{
227
+ inset-inline-start: -8rem;
228
+ }
229
+
163
230
  .inset-inline-end, .end{
164
231
  inset-inline-end: 0;
165
232
  }
233
+
234
+ .end-1{
235
+ inset-inline-end: 1rem;
236
+ }
237
+
238
+ .end-2{
239
+ inset-inline-end: 2rem;
240
+ }
241
+
242
+ .end-3{
243
+ inset-inline-end: 3rem;
244
+ }
245
+
246
+ .end-4{
247
+ inset-inline-end: 4rem;
248
+ }
249
+
250
+ .end-5{
251
+ inset-inline-end: 5rem;
252
+ }
253
+
254
+ .end-6{
255
+ inset-inline-end: 6rem;
256
+ }
257
+
258
+ .end-7{
259
+ inset-inline-end: 7rem;
260
+ }
261
+
262
+ .end-8{
263
+ inset-inline-end: 8rem;
264
+ }
265
+
266
+ .-end-1{
267
+ inset-inline-end: -1rem;
268
+ }
269
+
270
+ .-end-2{
271
+ inset-inline-end: -2rem;
272
+ }
273
+
274
+ .-end-3{
275
+ inset-inline-end: -3rem;
276
+ }
277
+
278
+ .-end-4{
279
+ inset-inline-end: -4rem;
280
+ }
281
+
282
+ .-end-5{
283
+ inset-inline-end: -5rem;
284
+ }
285
+
286
+ .-end-6{
287
+ inset-inline-end: -6rem;
288
+ }
289
+
290
+ .-end-7{
291
+ inset-inline-end: -7rem;
292
+ }
293
+
294
+ .-end-8{
295
+ inset-inline-end: -8rem;
296
+ }
297
+
166
298
  .top, .top-0{
167
299
  top: 0;
168
300
  }
@@ -183,6 +315,54 @@
183
315
  top: 4rem;
184
316
  }
185
317
 
318
+ .top-5{
319
+ top: 5rem;
320
+ }
321
+
322
+ .top-6{
323
+ top: 6rem;
324
+ }
325
+
326
+ .top-7{
327
+ top: 7rem;
328
+ }
329
+
330
+ .top-8{
331
+ top: 8rem;
332
+ }
333
+
334
+ .-top-1{
335
+ top: -1rem;
336
+ }
337
+
338
+ .-top-2{
339
+ top: -2rem;
340
+ }
341
+
342
+ .-top-3{
343
+ top: -3rem;
344
+ }
345
+
346
+ .-top-4{
347
+ top: -4rem;
348
+ }
349
+
350
+ .-top-5{
351
+ top: -5rem;
352
+ }
353
+
354
+ .-top-6{
355
+ top: -6rem;
356
+ }
357
+
358
+ .-top-7{
359
+ top: -7rem;
360
+ }
361
+
362
+ .-top-8{
363
+ top: -8rem;
364
+ }
365
+
186
366
  .bottom, .bottom-0{
187
367
  bottom: 0;
188
368
  }
@@ -203,6 +383,55 @@
203
383
  bottom: 4rem;
204
384
  }
205
385
 
386
+ .bottom-5{
387
+ bottom: 5rem;
388
+ }
389
+
390
+ .bottom-6{
391
+ bottom: 6rem;
392
+ }
393
+
394
+ .bottom-7{
395
+ bottom: 7rem;
396
+ }
397
+
398
+ .bottom-8{
399
+ bottom: 8rem;
400
+ }
401
+
402
+ .-bottom-1{
403
+ bottom: -1rem;
404
+ }
405
+
406
+ .-bottom-2{
407
+ bottom: -2rem;
408
+ }
409
+
410
+ .-bottom-3{
411
+ bottom: -3rem;
412
+ }
413
+
414
+ .-bottom-4{
415
+ bottom: -4rem;
416
+ }
417
+
418
+ .-bottom-5{
419
+ bottom: -5rem;
420
+ }
421
+
422
+ .-bottom-6{
423
+ bottom: -6rem;
424
+ }
425
+
426
+ .-bottom-7{
427
+ bottom: -7rem;
428
+ }
429
+
430
+ .-bottom-8{
431
+ bottom: -8rem;
432
+ }
433
+
434
+
206
435
  .auto-flow-rows {
207
436
  grid-auto-flow: row;
208
437
  }