@things-factory/biz-ui 4.3.700 → 4.3.701
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/client/components/contact-points-popup.js +1 -15
- package/client/pages/contact-point-list.js +3 -187
- package/package.json +3 -3
- package/translations/en.json +1 -2
- package/translations/ja.json +0 -1
- package/translations/ko.json +0 -1
- package/translations/ms.json +0 -1
- package/translations/zh.json +0 -1
|
@@ -105,7 +105,7 @@ class ContactPointsPopup extends localize(i18next)(LitElement) {
|
|
|
105
105
|
firstUpdated() {
|
|
106
106
|
this.config = {
|
|
107
107
|
list: {
|
|
108
|
-
fields: ['companyName', 'accountNo', 'email', 'name', 'description'
|
|
108
|
+
fields: ['companyName', 'accountNo', 'email', 'name', 'description']
|
|
109
109
|
},
|
|
110
110
|
pagination: { pages: [10, 20, 50, 100] },
|
|
111
111
|
rows: {
|
|
@@ -154,18 +154,6 @@ class ContactPointsPopup extends localize(i18next)(LitElement) {
|
|
|
154
154
|
header: i18next.t('field.billing_address'),
|
|
155
155
|
width: 350
|
|
156
156
|
},
|
|
157
|
-
{
|
|
158
|
-
type: 'string',
|
|
159
|
-
name: 'country',
|
|
160
|
-
header: i18next.t('field.country'),
|
|
161
|
-
width: 350
|
|
162
|
-
},
|
|
163
|
-
{
|
|
164
|
-
type: 'number',
|
|
165
|
-
name: 'releaseShelfLife',
|
|
166
|
-
header: i18next.t('field.release_shelf_life'),
|
|
167
|
-
width: 350
|
|
168
|
-
},
|
|
169
157
|
{
|
|
170
158
|
type: 'string',
|
|
171
159
|
name: 'phone',
|
|
@@ -246,10 +234,8 @@ class ContactPointsPopup extends localize(i18next)(LitElement) {
|
|
|
246
234
|
address
|
|
247
235
|
address2
|
|
248
236
|
postCode
|
|
249
|
-
country
|
|
250
237
|
city
|
|
251
238
|
state
|
|
252
|
-
releaseShelfLife
|
|
253
239
|
billingAddress
|
|
254
240
|
}
|
|
255
241
|
total
|
|
@@ -51,7 +51,6 @@ export class ContactPointList extends localize(i18next)(PageView) {
|
|
|
51
51
|
.config=${this.config}
|
|
52
52
|
.data=${this.data}
|
|
53
53
|
.fetchHandler="${this.fetchHandler.bind(this)}"
|
|
54
|
-
@field-change=${this._onFieldChange.bind(this)}
|
|
55
54
|
></data-grist>
|
|
56
55
|
`
|
|
57
56
|
}
|
|
@@ -82,20 +81,12 @@ export class ContactPointList extends localize(i18next)(PageView) {
|
|
|
82
81
|
rows: this.config.rows,
|
|
83
82
|
columns: [...this.config.columns.filter(column => column.imex !== undefined)]
|
|
84
83
|
}
|
|
85
|
-
|
|
86
|
-
const normalizedRecords = records.map(record => {
|
|
87
|
-
let normalized = this._normalizeStringFields(record)
|
|
88
|
-
normalized = this._normalizeNumericFields(normalized)
|
|
89
|
-
return normalized
|
|
90
|
-
})
|
|
91
|
-
openImportPopUp(normalizedRecords, config, async patches => {
|
|
84
|
+
openImportPopUp(records, config, async patches => {
|
|
92
85
|
try {
|
|
93
86
|
patches = patches.map(patch => {
|
|
94
87
|
if (!patch?.id) delete patch.id
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
normalized = this._normalizeNumericFields(normalized)
|
|
98
|
-
return normalized
|
|
88
|
+
|
|
89
|
+
return patch
|
|
99
90
|
})
|
|
100
91
|
await this._validateImport(patches)
|
|
101
92
|
await this._saveContactPoints(patches)
|
|
@@ -311,14 +302,6 @@ export class ContactPointList extends localize(i18next)(PageView) {
|
|
|
311
302
|
header: i18next.t('field.contact_point_state'),
|
|
312
303
|
width: 150
|
|
313
304
|
},
|
|
314
|
-
{
|
|
315
|
-
type: 'string',
|
|
316
|
-
name: 'country',
|
|
317
|
-
record: { editable: true },
|
|
318
|
-
imex: { header: i18next.t('field.country'), key: 'country', width: 40, type: 'string' },
|
|
319
|
-
header: i18next.t('field.country'),
|
|
320
|
-
width: 150
|
|
321
|
-
},
|
|
322
305
|
{
|
|
323
306
|
type: 'string',
|
|
324
307
|
name: 'billingAddress',
|
|
@@ -332,25 +315,6 @@ export class ContactPointList extends localize(i18next)(PageView) {
|
|
|
332
315
|
header: i18next.t('field.contact_point_billing_address'),
|
|
333
316
|
width: 300
|
|
334
317
|
},
|
|
335
|
-
{
|
|
336
|
-
type: 'number',
|
|
337
|
-
name: 'releaseShelfLife',
|
|
338
|
-
record: {
|
|
339
|
-
editable: true,
|
|
340
|
-
validation: (after, before, record, column) => {
|
|
341
|
-
const validation = this._validateReleaseShelfLife(after, true)
|
|
342
|
-
return validation.valid
|
|
343
|
-
}
|
|
344
|
-
},
|
|
345
|
-
header: i18next.t('field.release_shelf_life'),
|
|
346
|
-
imex: {
|
|
347
|
-
header: i18next.t('field.release_shelf_life'),
|
|
348
|
-
key: 'releaseShelfLife',
|
|
349
|
-
width: 40,
|
|
350
|
-
type: 'number'
|
|
351
|
-
},
|
|
352
|
-
width: 150
|
|
353
|
-
},
|
|
354
318
|
{
|
|
355
319
|
name: 'type',
|
|
356
320
|
record: { editable: true },
|
|
@@ -393,131 +357,6 @@ export class ContactPointList extends localize(i18next)(PageView) {
|
|
|
393
357
|
}
|
|
394
358
|
}
|
|
395
359
|
|
|
396
|
-
/**
|
|
397
|
-
* Validates releaseShelfLife value
|
|
398
|
-
* @param {any} value - The value to validate
|
|
399
|
-
* @param {boolean} allowEmpty - Whether to allow empty/null/undefined values (default: true)
|
|
400
|
-
* @returns {{valid: boolean, error?: string}} - Validation result with optional error message
|
|
401
|
-
*/
|
|
402
|
-
_validateReleaseShelfLife(value, allowEmpty = true) {
|
|
403
|
-
// Allow empty/null values if allowed
|
|
404
|
-
if (allowEmpty && (value === null || value === undefined || value === '')) {
|
|
405
|
-
return { valid: true }
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
// If not allowed and empty, return error
|
|
409
|
-
if (!allowEmpty && (value === null || value === undefined || value === '')) {
|
|
410
|
-
return { valid: false, error: i18next.t('field.release_shelf_life') + ' is required' }
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
const numValue = Number(value)
|
|
414
|
-
|
|
415
|
-
// Check if it's a valid number
|
|
416
|
-
if (isNaN(numValue)) {
|
|
417
|
-
return { valid: false, error: i18next.t('field.release_shelf_life') + ' must be a valid number' }
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
// Check if it's negative
|
|
421
|
-
if (numValue < 0) {
|
|
422
|
-
return { valid: false, error: i18next.t('field.release_shelf_life') + ' cannot be negative' }
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
// Check if it's an integer (no decimals)
|
|
426
|
-
if (!Number.isInteger(numValue)) {
|
|
427
|
-
return { valid: false, error: i18next.t('field.release_shelf_life') + ' must be an integer (no decimal values)' }
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
return { valid: true }
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
_onFieldChange(e) {
|
|
434
|
-
const { after, before, column, record, row } = e.detail
|
|
435
|
-
|
|
436
|
-
// Handle releaseShelfLife validation (redundant with column validation, but kept for user feedback)
|
|
437
|
-
if (column.name === 'releaseShelfLife') {
|
|
438
|
-
const validation = this._validateReleaseShelfLife(after, true)
|
|
439
|
-
if (!validation.valid) {
|
|
440
|
-
// Revert to previous value
|
|
441
|
-
this.dataGrist._data.records[row][column.name] = before
|
|
442
|
-
this.data = {
|
|
443
|
-
...this.dataGrist._data
|
|
444
|
-
}
|
|
445
|
-
// Show error message
|
|
446
|
-
this.showToast(validation.error)
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
_normalizeStringFields(record) {
|
|
452
|
-
// Normalize object values to strings (e.g., Excel hyperlinks for email fields)
|
|
453
|
-
// ExcelJS may return email cells as objects like { text: 'email@example.com', hyperlink: 'mailto:...' }
|
|
454
|
-
const normalized = { ...record }
|
|
455
|
-
const stringFields = [
|
|
456
|
-
'email',
|
|
457
|
-
'name',
|
|
458
|
-
'companyName',
|
|
459
|
-
'description',
|
|
460
|
-
'fax',
|
|
461
|
-
'phone',
|
|
462
|
-
'accountNo',
|
|
463
|
-
'address',
|
|
464
|
-
'address2',
|
|
465
|
-
'postCode',
|
|
466
|
-
'city',
|
|
467
|
-
'state',
|
|
468
|
-
'country',
|
|
469
|
-
'billingAddress',
|
|
470
|
-
'type'
|
|
471
|
-
]
|
|
472
|
-
stringFields.forEach(field => {
|
|
473
|
-
if (normalized[field] && typeof normalized[field] === 'object' && !Array.isArray(normalized[field])) {
|
|
474
|
-
// Handle ExcelJS hyperlink objects
|
|
475
|
-
if (normalized[field].text !== undefined) {
|
|
476
|
-
normalized[field] = normalized[field].text
|
|
477
|
-
} else {
|
|
478
|
-
// Fallback: try to stringify or use empty string
|
|
479
|
-
normalized[field] = normalized[field].toString ? normalized[field].toString() : ''
|
|
480
|
-
}
|
|
481
|
-
}
|
|
482
|
-
})
|
|
483
|
-
return normalized
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
_normalizeNumericFields(record) {
|
|
487
|
-
// Normalize numeric fields - convert string numbers to integers/floats
|
|
488
|
-
// GraphQL requires integers to be actual numbers, not strings
|
|
489
|
-
const normalized = { ...record }
|
|
490
|
-
|
|
491
|
-
// releaseShelfLife must be an integer
|
|
492
|
-
// Explicitly check for 0 as a valid value (both number 0 and string "0")
|
|
493
|
-
const releaseShelfLifeValue = normalized.releaseShelfLife
|
|
494
|
-
|
|
495
|
-
if (releaseShelfLifeValue === 0 || releaseShelfLifeValue === '0') {
|
|
496
|
-
// 0 is a valid value, ensure it's stored as integer 0
|
|
497
|
-
normalized.releaseShelfLife = 0
|
|
498
|
-
} else if (releaseShelfLifeValue !== null && releaseShelfLifeValue !== undefined && releaseShelfLifeValue !== '') {
|
|
499
|
-
if (typeof releaseShelfLifeValue === 'string') {
|
|
500
|
-
const numValue = Number(releaseShelfLifeValue)
|
|
501
|
-
if (!isNaN(numValue)) {
|
|
502
|
-
normalized.releaseShelfLife = Number.isInteger(numValue) ? numValue : Math.floor(numValue)
|
|
503
|
-
} else {
|
|
504
|
-
// Invalid number string, set to default 0
|
|
505
|
-
normalized.releaseShelfLife = 0
|
|
506
|
-
}
|
|
507
|
-
} else if (typeof releaseShelfLifeValue === 'number') {
|
|
508
|
-
// Ensure it's an integer
|
|
509
|
-
normalized.releaseShelfLife = Number.isInteger(releaseShelfLifeValue)
|
|
510
|
-
? releaseShelfLifeValue
|
|
511
|
-
: Math.floor(releaseShelfLifeValue)
|
|
512
|
-
}
|
|
513
|
-
} else {
|
|
514
|
-
// Empty/null values should default to 0
|
|
515
|
-
normalized.releaseShelfLife = 0
|
|
516
|
-
}
|
|
517
|
-
|
|
518
|
-
return normalized
|
|
519
|
-
}
|
|
520
|
-
|
|
521
360
|
async fetchPartnersBizplaces() {
|
|
522
361
|
const response = await client.query({
|
|
523
362
|
query: gql`
|
|
@@ -563,11 +402,9 @@ export class ContactPointList extends localize(i18next)(PageView) {
|
|
|
563
402
|
state
|
|
564
403
|
city
|
|
565
404
|
postCode
|
|
566
|
-
country
|
|
567
405
|
billingAddress
|
|
568
406
|
description
|
|
569
407
|
type
|
|
570
|
-
releaseShelfLife
|
|
571
408
|
updatedAt
|
|
572
409
|
bizplace {
|
|
573
410
|
id
|
|
@@ -635,19 +472,6 @@ export class ContactPointList extends localize(i18next)(PageView) {
|
|
|
635
472
|
if (!errors.find(err => err.type == 'customerName'))
|
|
636
473
|
errors.push({ type: 'customerName', value: 'customer name is required' })
|
|
637
474
|
}
|
|
638
|
-
|
|
639
|
-
// Validate releaseShelfLife: must be non-negative integer
|
|
640
|
-
const releaseShelfLifeValidation = this._validateReleaseShelfLife(itm.releaseShelfLife, true)
|
|
641
|
-
if (!releaseShelfLifeValidation.valid) {
|
|
642
|
-
itm.error = true
|
|
643
|
-
if (!errors.find(err => err.type == 'releaseShelfLife')) {
|
|
644
|
-
errors.push({
|
|
645
|
-
type: 'releaseShelfLife',
|
|
646
|
-
value: releaseShelfLifeValidation.error
|
|
647
|
-
})
|
|
648
|
-
}
|
|
649
|
-
}
|
|
650
|
-
|
|
651
475
|
return itm
|
|
652
476
|
})
|
|
653
477
|
|
|
@@ -738,14 +562,6 @@ export class ContactPointList extends localize(i18next)(PageView) {
|
|
|
738
562
|
throw new Error(i18next.t('text.contact_type_does_not_exist'))
|
|
739
563
|
}
|
|
740
564
|
|
|
741
|
-
// Validate releaseShelfLife: must be non-negative integer
|
|
742
|
-
const releaseShelfLifeValidation = this._validateReleaseShelfLife(item.releaseShelfLife, true)
|
|
743
|
-
if (!releaseShelfLifeValidation.valid) {
|
|
744
|
-
if (!errors.find(error => error.type == 'releaseShelfLife')) {
|
|
745
|
-
errors.push({ type: 'releaseShelfLife', value: releaseShelfLifeValidation.error })
|
|
746
|
-
}
|
|
747
|
-
}
|
|
748
|
-
|
|
749
565
|
return item
|
|
750
566
|
})
|
|
751
567
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@things-factory/biz-ui",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.701",
|
|
4
4
|
"main": "dist-server/index.js",
|
|
5
5
|
"browser": "client/index.js",
|
|
6
6
|
"things-factory": true,
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"migration:create": "node ../../node_modules/typeorm/cli.js migration:create -d ./server/migrations"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@things-factory/biz-base": "^4.3.
|
|
26
|
+
"@things-factory/biz-base": "^4.3.701",
|
|
27
27
|
"@things-factory/code-base": "^4.3.695",
|
|
28
28
|
"@things-factory/form-ui": "^4.3.695",
|
|
29
29
|
"@things-factory/grist-ui": "^4.3.695",
|
|
@@ -32,5 +32,5 @@
|
|
|
32
32
|
"@things-factory/layout-base": "^4.3.695",
|
|
33
33
|
"@things-factory/shell": "^4.3.695"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "2cb46fe9d95770899e069846c590a3b24c847d9c"
|
|
36
36
|
}
|
package/translations/en.json
CHANGED
|
@@ -5,13 +5,12 @@
|
|
|
5
5
|
"field.billing_address": "billing address",
|
|
6
6
|
"field.company_name": "company name",
|
|
7
7
|
"field.other_company": "other company",
|
|
8
|
-
"field.release_shelf_life": "release shelf life",
|
|
9
8
|
"title.contact_points": "contact points",
|
|
10
9
|
"title.select_supplier": "select supplier",
|
|
11
10
|
"text.bizplace_is_not_selected": "customer is not selected",
|
|
12
11
|
"label.account_no": "account no",
|
|
13
12
|
"text.invalid_form": "invalid form",
|
|
14
|
-
|
|
13
|
+
|
|
15
14
|
"field.contact_point_customer_name": "Customer Name",
|
|
16
15
|
"field.contact_point_company_name": "Company Name",
|
|
17
16
|
"field.contact_point_other_company_name": "Other Company",
|
package/translations/ja.json
CHANGED
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
"field.billing_address": "[jp]billing address",
|
|
6
6
|
"field.company_name": "[jp]company name",
|
|
7
7
|
"field.other_company": "[jp]other company",
|
|
8
|
-
"field.release_shelf_life": "[jp]release shelf life",
|
|
9
8
|
"title.contact_points": "[jp]contact points",
|
|
10
9
|
"title.select_supplier": "[jp]select supplier",
|
|
11
10
|
"text.bizplace_is_not_selected": "[jp]customer is not selected",
|
package/translations/ko.json
CHANGED
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
"field.billing_address": "[ko]billing address",
|
|
6
6
|
"field.company_name": "[ko]company name",
|
|
7
7
|
"field.other_company": "[ko]other company",
|
|
8
|
-
"field.release_shelf_life": "[ko]release shelf life",
|
|
9
8
|
"title.contact_points": "[ko]contact points",
|
|
10
9
|
"title.select_supplier": "[ko]select supplier",
|
|
11
10
|
"text.bizplace_is_not_selected": "[ko]customer is not selected",
|
package/translations/ms.json
CHANGED
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
"field.billing_address": "[ms]billing address",
|
|
6
6
|
"field.company_name": "[ms]company name",
|
|
7
7
|
"field.other_company": "[ms]other company",
|
|
8
|
-
"field.release_shelf_life": "[ms]release shelf life",
|
|
9
8
|
"title.contact_points": "[ms]contact points",
|
|
10
9
|
"title.select_supplier": "[ms]select supplier",
|
|
11
10
|
"text.bizplace_is_not_selected": "[ms]customer is not selected",
|
package/translations/zh.json
CHANGED
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
"field.billing_address": "[zh]billing address",
|
|
6
6
|
"field.company_name": "[zh]company name",
|
|
7
7
|
"field.other_company": "[zh]other company",
|
|
8
|
-
"field.release_shelf_life": "[zh]release shelf life",
|
|
9
8
|
"title.contact_points": "[zh]contact points",
|
|
10
9
|
"title.select_supplier": "[zh]select supplier",
|
|
11
10
|
"text.bizplace_is_not_selected": "[zh]customer is not selected",
|