PageSourceSearch

https://thai-mecc.go.th/share/js/sarfunkel/input/TextInput.js

js thai-mecc.go.th collected 2026-10-09 03:33:57 UTC 3,619 bytes, 143 lines download raw bytes

1class TextInput extends InputMetaData{
2	getInputTemplate(){
3		return TEMPLATE.input.TextInput;
4	}
5
6	getDetailTemplate(){
7		return TEMPLATE.DetailInputView;
8	}
9
10	getTableFilterTemplate(){
11		return TEMPLATE.input.TextInput;
12	}
13
14	getCellTemplate(){
15		return TEMPLATE.TableCellView;
16	}
17
18	getCardRowTemplate(){
19		return TEMPLATE.CardRow;
20	}
21
22	getTableFormInputTemplate(){
23		return TEMPLATE.input.TableFormTextInput;
24	}
25
26	/**
27	 * 
28	 * @param {InputConfig} config 
29	 */
30	static create(config) {
31		let data = InputConfigCreator.createByConfig(config);
32		data.typeName = "Text";
33		return data;
34	}
35
36	async renderForm(record){
37		this.currentRecord = record;
38		if (this.input == null){
39			let parameter = {...this};
40			/// Do we need InputDOMObject?
41			this.input = new InputDOMObject(this.getInputTemplate(), parameter);
42			this.setInputPerLine(this.input);
43			this.setFormSideIcon(this.input, record);
44			this.setFormEvent(this.input);
45		}
46		this.checkEditable(this.input);
47		if (record == undefined || record == null || Object.keys(record).length == 0) {
48			this.clearFormValue(this.input)
49		} else if(record){
50			this.setFormValue(this.input, record);
51		}
52		return this.input;
53	}
54
55	async renderDetail(record, reference){
56		if(this.detail == null){
57			let parameter = {...this};
58			this.detail = new DOMObject(this.getDetailTemplate(), parameter);
59			this.setInputPerLine(this.detail, 2);
60		}
61		if(record){
62			this.setDetailValue(this.detail, record, reference);
63		}
64		return this.detail;
65	}
66
67	async renderTableFilter(record){
68		if(this.filterInput == null){
69			let parameter = {...this};
70			parameter.isRequired = false;
71			this.filterInput = new InputDOMObject(this.getTableFilterTemplate(), parameter);
72			this.setInputPerLine(this.filterInput);
73		}
74		this.checkEditable(this.filterInput);
75		if(record){
76			this.setFormValue(this.filterInput, record);
77		}
78		return this.filterInput;
79	}
80
81	async renderDialogForm(record){
82		// let parameter = {...this};
83		// let input = new InputDOMObject(this.getInputTemplate(), parameter);
84		// this.setInputPerLine(input);
85		// this.checkEditable(input);
86		// if(record){
87		// 	this.setFormValue(input, record);
88		// }
89		// return this.input;
90		this.currentRecord = record;
91		if (this.input == null){
92			let parameter = {...this};
93			/// Do we need InputDOMObject?
94			this.input = new InputDOMObject(this.getInputTemplate(), parameter);
95			this.setInputPerLine(this.input);
96			this.setFormSideIcon(this.input, record);
97			this.setFormEvent(this.input);
98		}
99		this.checkEditable(this.input);
100		if (record == undefined || record == null || Object.keys(record).length == 0) {
101			this.clearFormValue(this.input)
102		} else if(record){
103			this.setFormValue(this.input, record);
104		}
105		return this.input;
106	}
107
108	async renderCell(record, reference) {
109		let parameter = {...this};
110		let cell = new DOMObject(this.getCellTemplate(), parameter);
111		if(record){
112			this.setTableValue(cell, record, reference);
113		}
114		return cell;
115	}
116
117	async renderCardRow(record, reference) {
118		let parameter = {...this};
119		let cell = new DOMObject(this.getCardRowTemplate(), parameter);
120		if(record){
121			this.setCardValue(cell, record, reference);
122		}
123		return cell;
124	}
125
126	async renderFormCell(record, reference, row){
127		let parameter = {...this};
128		let cell = new InputDOMObject(this.getTableFormInputTemplate(), parameter);
129		cell.row = row;
130		this.checkTableFormEditable(cell);
131		this.setTableFormEvent(cell);
132		if(record){
133			this.setTableFormValue(cell, record);
134		}
135		return cell;
136	}
137
138	getFilterValue(inputForm) {
139		let result = super.getFilterValue(inputForm);
140		if (result?.length == 0) return;
141		return result;
142	}
143}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.