imm-element-ui 1.3.8 → 1.3.9
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/esm2022/lib/form/form-field/field-utils.mjs +3 -3
- package/esm2022/lib/form/form-type/datepicker.type.mjs +43 -1
- package/esm2022/lib/grid/grid-utils.mjs +2 -2
- package/esm2022/lib/search/search/search.component.mjs +2 -2
- package/esm2022/lib/search/search-utils.mjs +11 -4
- package/fesm2022/imm-element-ui.mjs +56 -7
- package/fesm2022/imm-element-ui.mjs.map +1 -1
- package/lib/crumb-action/crumb-action.component.d.ts +1 -1
- package/lib/form/form-type/datepicker.type.d.ts +3 -0
- package/lib/grid/grid/grid.component.d.ts +2 -2
- package/lib/search/search-utils.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1238,8 +1238,8 @@ const _fieldUtils = {
|
|
|
1238
1238
|
return '';
|
|
1239
1239
|
}
|
|
1240
1240
|
if (_fieldUtils.isISO8601(raw)) {
|
|
1241
|
-
const
|
|
1242
|
-
return datePipe.transform(raw,
|
|
1241
|
+
const datePipeFormat = field.datePickerProps?.datePipeFormat ?? 'yyyy-MM-dd';
|
|
1242
|
+
return datePipe.transform(raw, datePipeFormat, 'GMT') || raw;
|
|
1243
1243
|
}
|
|
1244
1244
|
if (!stringMode && field?.datePickerProps?.selectionMode == 'range' && raw.includes('~')) {
|
|
1245
1245
|
const [start, end] = raw.split('~');
|
|
@@ -2091,6 +2091,7 @@ class DatePickerComponent {
|
|
|
2091
2091
|
this.props = this.field().datePickerProps;
|
|
2092
2092
|
this.handleHookChange();
|
|
2093
2093
|
this.handleDisabled();
|
|
2094
|
+
this.handleDatePipeFormat();
|
|
2094
2095
|
}
|
|
2095
2096
|
});
|
|
2096
2097
|
effect(() => {
|
|
@@ -2147,6 +2148,47 @@ class DatePickerComponent {
|
|
|
2147
2148
|
throw new Error('Invalid date format. Expected yyyy-MM-dd hh:mm:ss');
|
|
2148
2149
|
}
|
|
2149
2150
|
}
|
|
2151
|
+
handleDatePipeFormat() {
|
|
2152
|
+
this.props.datePipeFormat = this.convertPrimeNgToDatePipeFormat(this.props.dateFormat);
|
|
2153
|
+
if (!this.props.showTime)
|
|
2154
|
+
return;
|
|
2155
|
+
const timeSeparator = this.props.timeSeparator ?? ':';
|
|
2156
|
+
const timeFormat = `HH${timeSeparator}mm${timeSeparator}ss`;
|
|
2157
|
+
this.props.datePipeFormat += ` ${timeFormat}`;
|
|
2158
|
+
}
|
|
2159
|
+
convertPrimeNgToDatePipeFormat(primeNgFormat) {
|
|
2160
|
+
if (!primeNgFormat)
|
|
2161
|
+
return 'yyyy-MM-dd';
|
|
2162
|
+
const formatMap = {
|
|
2163
|
+
d: 'd',
|
|
2164
|
+
dd: 'dd',
|
|
2165
|
+
m: 'M',
|
|
2166
|
+
mm: 'MM',
|
|
2167
|
+
M: 'MMM',
|
|
2168
|
+
MM: 'MMMM',
|
|
2169
|
+
y: 'yy',
|
|
2170
|
+
yy: 'yyyy',
|
|
2171
|
+
};
|
|
2172
|
+
const commonFormats = {
|
|
2173
|
+
'mm/dd/yy': 'MM/dd/yyyy',
|
|
2174
|
+
'dd/mm/yy': 'dd/MM/yyyy',
|
|
2175
|
+
'yy-mm-dd': 'yyyy-MM-dd',
|
|
2176
|
+
'dd-mm-yy': 'dd-MM-yyyy',
|
|
2177
|
+
'mm-dd-yy': 'MM-dd-yyyy',
|
|
2178
|
+
};
|
|
2179
|
+
if (commonFormats[primeNgFormat]) {
|
|
2180
|
+
return commonFormats[primeNgFormat];
|
|
2181
|
+
}
|
|
2182
|
+
// 替换转义字符
|
|
2183
|
+
let result = primeNgFormat.replace(/'([^']*)'/g, (match, p1) => {
|
|
2184
|
+
return `'${p1}'`;
|
|
2185
|
+
});
|
|
2186
|
+
// 替换格式标记
|
|
2187
|
+
result = result.replace(/[a-zA-Z]+/g, (match) => {
|
|
2188
|
+
return formatMap[match] || match;
|
|
2189
|
+
});
|
|
2190
|
+
return result;
|
|
2191
|
+
}
|
|
2150
2192
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DatePickerComponent, deps: [{ token: ActionService }, { token: i0.Renderer2 }, { token: i1$2.DatePipe }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2151
2193
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: DatePickerComponent, isStandalone: true, selector: "form-datepicker", inputs: { field: { classPropertyName: "field", publicName: "field", isSignal: true, isRequired: false, transformFunction: null } }, providers: [DatePipe], viewQueries: [{ propertyName: "datePicker", first: true, predicate: DatePicker, descendants: true }, { propertyName: "datePickerRef", first: true, predicate: DatePicker, descendants: true, read: ElementRef }], ngImport: i0, template: `<p-datepicker
|
|
2152
2194
|
[id]="field()?.uuid"
|
|
@@ -4443,7 +4485,7 @@ const _gridUtils = {
|
|
|
4443
4485
|
if (item.hasOwnProperty('i18nKey')) {
|
|
4444
4486
|
let headerName = i18n.fanyi(item.i18nKey);
|
|
4445
4487
|
cols = { ...item, headerName };
|
|
4446
|
-
delete cols.i18nKey;
|
|
4488
|
+
// delete cols.i18nKey;
|
|
4447
4489
|
}
|
|
4448
4490
|
else {
|
|
4449
4491
|
cols = { ...item };
|
|
@@ -6391,16 +6433,23 @@ const _searchUitls = {
|
|
|
6391
6433
|
}
|
|
6392
6434
|
return columnFilters?.filter((columnFilter) => !cascadeClearList.includes(columnFilter.columnField));
|
|
6393
6435
|
},
|
|
6394
|
-
extractSearchItems(columnDefs, searchItems = []) {
|
|
6436
|
+
extractSearchItems(columnDefs, i18n, searchItems = []) {
|
|
6395
6437
|
columnDefs?.forEach((col) => {
|
|
6396
6438
|
if (col.children) {
|
|
6397
|
-
this.extractSearchItems(col.children, searchItems);
|
|
6439
|
+
this.extractSearchItems(col.children, i18n, searchItems);
|
|
6398
6440
|
}
|
|
6399
6441
|
else {
|
|
6400
6442
|
if (!col.search) {
|
|
6401
6443
|
return;
|
|
6402
6444
|
}
|
|
6403
|
-
let
|
|
6445
|
+
let label;
|
|
6446
|
+
if (col.hasOwnProperty('i18nKey')) {
|
|
6447
|
+
label = i18n.fanyi(col.i18nKey);
|
|
6448
|
+
}
|
|
6449
|
+
else {
|
|
6450
|
+
label = col.headerName || col.field;
|
|
6451
|
+
}
|
|
6452
|
+
let searchItem = { field: col.field, label, filterType: col.searchType, filter: true };
|
|
6404
6453
|
if (col.searchType == 'date') {
|
|
6405
6454
|
searchItem.format = col.searchFormat ?? 'yy-mm-dd';
|
|
6406
6455
|
}
|
|
@@ -6855,7 +6904,7 @@ class SearchComponent {
|
|
|
6855
6904
|
effect(() => {
|
|
6856
6905
|
const columnDefs = this.gridOptions()?.columnDefs;
|
|
6857
6906
|
this.visible = this.gridOptions()?.showSearch ?? true;
|
|
6858
|
-
this.searchItems = searchUtils.extractSearchItems(columnDefs);
|
|
6907
|
+
this.searchItems = searchUtils.extractSearchItems(columnDefs, this.i18n);
|
|
6859
6908
|
this.sortOptions = columnDefs.map((columnDef) => ({ key: columnDef.field, label: columnDef.headerName }));
|
|
6860
6909
|
}, { allowSignalWrites: true });
|
|
6861
6910
|
effect(() => {
|